From: Pravin B Shelar Date: Wed, 25 Jan 2012 23:44:26 +0000 (-0800) Subject: netdev-linux: Add MTU check before setting MTU. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=153e54814d81cafa89bae451dbfa92a31910e5a6;p=openvswitch netdev-linux: Add MTU check before setting MTU. Following patch check if current MTU needs to be changed before issuing set-mtu ioctl. Suggested-by: Jesse Gross Signed-off-by: Pravin B Shelar --- diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 19a80fbe..49475360 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -1030,6 +1030,10 @@ netdev_linux_set_mtu(const struct netdev *netdev_, int mtu) struct ifreq ifr; int error; + if (netdev_dev->cache_valid & VALID_MTU && + netdev_dev->mtu == mtu) { + return 0; + } ifr.ifr_mtu = mtu; error = netdev_linux_do_ioctl(netdev_get_name(netdev_), &ifr, SIOCSIFMTU, "SIOCSIFMTU");