Following patch check if current MTU needs to be changed before
issuing set-mtu ioctl.

Suggested-by: Jesse Gross <je...@nicira.com>
Signed-off-by: Pravin B Shelar <pshe...@nicira.com>

---
 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 19a80fb..4947536 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");
-- 
1.7.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to