]> err.no Git - linux-2.6/commitdiff
IPoIB: Use rtnl lock/unlock when changing device flags
authorEli Cohen <eli@mellanox.co.il>
Tue, 15 Jul 2008 06:48:51 +0000 (23:48 -0700)
committerRoland Dreier <rolandd@cisco.com>
Tue, 15 Jul 2008 06:48:51 +0000 (23:48 -0700)
Use of this lock is required to synchronize changes to the netdvice's
data structs.  Also move the call to ipoib_flush_paths() after the
modification of the netdevice flags in set_mode().

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/ulp/ipoib/ipoib_cm.c
drivers/infiniband/ulp/ipoib/ipoib_multicast.c

index 37bf67b2a26faf636afd878384ca7a7b82fe6136..b4269139135bbb4a740b17c115efa4ffcfab7c95 100644 (file)
@@ -1440,7 +1440,9 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr,
                ipoib_warn(priv, "enabling connected mode "
                           "will cause multicast packet drops\n");
 
+               rtnl_lock();
                dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO);
+               rtnl_unlock();
                priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM;
 
                ipoib_flush_paths(dev);
@@ -1449,14 +1451,16 @@ 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);
-               ipoib_flush_paths(dev);
 
+               rtnl_lock();
                if (test_bit(IPOIB_FLAG_CSUM, &priv->flags)) {
                        dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
                        if (priv->hca_caps & IB_DEVICE_UD_TSO)
                                dev->features |= NETIF_F_TSO;
                }
+               dev->mtu = min(priv->mcast_mtu, dev->mtu);
+               rtnl_unlock();
+               ipoib_flush_paths(dev);
 
                return count;
        }
index 71add7a8d53cecef8f6512fdd27942f858a44cb9..be1ed38cdcfda02b94d400548699a808f15f0c34 100644 (file)
@@ -575,8 +575,11 @@ 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))
+       if (!ipoib_cm_admin_enabled(dev)) {
+               rtnl_lock();
                dev->mtu = min(priv->mcast_mtu, priv->admin_mtu);
+               rtnl_unlock();
+       }
 
        ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n");