[ewg] [PATCH] Subject: [PATCH] IB/IPoIB: Fix change of mtu to use kernel API

Eli Cohen eli at mellanox.co.il
Thu Jul 3 01:52:45 PDT 2008


When the driver sets the MTU of the net device, it should make use of
dev_set_mtu() instead of directly setting the mtu field of struct
netdevice. Failure to do so will result in functions registered to be
called upon MTU change will not get called (this is done through
call_netdevice_notifiers()).
We have seen problems with performance degredation upon changing the
MTU with ofed which has a patch to set the MTU when changing to CM
mode to its maximum allowed value. Using dev_set_mtu() solved that
problem.

Signed-off-by: Eli Cohen <eli at mellanox.co.il>
---
 drivers/infiniband/ulp/ipoib/ipoib_cm.c        |    2 +-
 drivers/infiniband/ulp/ipoib/ipoib_multicast.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index f72e37d..99a4daf 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -1402,7 +1402,7 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr,
 			if (priv->hca_caps & IB_DEVICE_UD_TSO)
 				dev->features |= NETIF_F_TSO;
 		}
-		dev->mtu = min(priv->mcast_mtu, dev->mtu);
+		dev_set_mtu(dev, min(priv->mcast_mtu, dev->mtu));
 		rtnl_unlock();
 		ipoib_flush_paths(dev);
 
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index 189fe1f..f349079 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -577,7 +577,7 @@ void ipoib_mcast_join_task(struct work_struct *work)
 
 	if (!ipoib_cm_admin_enabled(dev)) {
 		rtnl_lock();
-		dev->mtu = min(priv->mcast_mtu, priv->admin_mtu);
+		dev_set_mtu(dev, min(priv->mcast_mtu, priv->admin_mtu));
 		rtnl_unlock();
 	}
 
-- 
1.5.6




More information about the ewg mailing list