[ewg] [PATCH] IB/IPoIB: Fix change of mtu to use kernel API
Eli Cohen
eli at dev.mellanox.co.il
Tue Jul 1 02:45:25 PDT 2008
>From aefedbdec99b2db70a0f0de50b9bfb58ccb7e9ab Mon Sep 17 00:00:00 2001
From: Eli Cohen <eli at mellanox.co.il>
Date: Mon, 30 Jun 2008 18:59:54 +0300
Subject: [PATCH] IB/IPoIB: Fix change of mtu to use kernel API
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 6223fc3..82f3f2f 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -1410,7 +1410,7 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr,
if (!strcmp(buf, "datagram\n")) {
clear_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
- dev->mtu = min(priv->mcast_mtu, dev->mtu);
+ dev_set_mtu(dev, min(priv->mcast_mtu, dev->mtu))
ipoib_flush_paths(dev);
if (test_bit(IPOIB_FLAG_CSUM, &priv->flags)) {
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index 4a6538b..be10d78 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -574,7 +574,7 @@ void ipoib_mcast_join_task(struct work_struct *work)
priv->mcast_mtu = IPOIB_UD_MTU(ib_mtu_enum_to_int(priv->broadcast->mcmember.mtu));
if (!ipoib_cm_admin_enabled(dev))
- dev->mtu = min(priv->mcast_mtu, priv->admin_mtu);
+ dev_set_mtu(dev, min(priv->mcast_mtu, priv->admin_mtu));
ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n");
--
1.5.6
More information about the ewg
mailing list