diff options
author | Pravin B Shelar <pshelar@nicira.com> | 2012-01-25 15:44:26 -0800 |
---|---|---|
committer | Pravin B Shelar <pshelar@nicira.com> | 2012-01-25 15:44:26 -0800 |
commit | 153e54814d81cafa89bae451dbfa92a31910e5a6 (patch) | |
tree | 6f22c1dad1e5ec73fcee1b65e7f7d581d10479af /lib/netdev-linux.c | |
parent | fe4a02e4fa6be030a0478f6b01b0d4b6ab9b808f (diff) | |
download | openvswitch-153e54814d81cafa89bae451dbfa92a31910e5a6.tar.gz |
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 <jesse@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Diffstat (limited to 'lib/netdev-linux.c')
-rw-r--r-- | lib/netdev-linux.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 19a80fbe1..49475360d 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"); |