diff options
author | Eli Cohen <eli@mellanox.co.il> | 2008-07-15 02:48:51 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-07-15 02:48:51 -0400 |
commit | c8c2afe360b7366f586f6bece1109a72ea334876 (patch) | |
tree | c132fc0580deebde3dc49c59bac9c4a559aef192 /drivers/infiniband | |
parent | 9eae554c171e086c89ab83da2a2d3c8bf958fcb5 (diff) |
IPoIB: Use rtnl lock/unlock when changing device flags
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>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_cm.c | 8 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 5 |
2 files changed, 10 insertions, 3 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 37bf67b2a26f..b4269139135b 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
@@ -1440,7 +1440,9 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr, | |||
1440 | ipoib_warn(priv, "enabling connected mode " | 1440 | ipoib_warn(priv, "enabling connected mode " |
1441 | "will cause multicast packet drops\n"); | 1441 | "will cause multicast packet drops\n"); |
1442 | 1442 | ||
1443 | rtnl_lock(); | ||
1443 | dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO); | 1444 | dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO); |
1445 | rtnl_unlock(); | ||
1444 | priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM; | 1446 | priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM; |
1445 | 1447 | ||
1446 | ipoib_flush_paths(dev); | 1448 | ipoib_flush_paths(dev); |
@@ -1449,14 +1451,16 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr, | |||
1449 | 1451 | ||
1450 | if (!strcmp(buf, "datagram\n")) { | 1452 | if (!strcmp(buf, "datagram\n")) { |
1451 | clear_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags); | 1453 | clear_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags); |
1452 | dev->mtu = min(priv->mcast_mtu, dev->mtu); | ||
1453 | ipoib_flush_paths(dev); | ||
1454 | 1454 | ||
1455 | rtnl_lock(); | ||
1455 | if (test_bit(IPOIB_FLAG_CSUM, &priv->flags)) { | 1456 | if (test_bit(IPOIB_FLAG_CSUM, &priv->flags)) { |
1456 | dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; | 1457 | dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; |
1457 | if (priv->hca_caps & IB_DEVICE_UD_TSO) | 1458 | if (priv->hca_caps & IB_DEVICE_UD_TSO) |
1458 | dev->features |= NETIF_F_TSO; | 1459 | dev->features |= NETIF_F_TSO; |
1459 | } | 1460 | } |
1461 | dev->mtu = min(priv->mcast_mtu, dev->mtu); | ||
1462 | rtnl_unlock(); | ||
1463 | ipoib_flush_paths(dev); | ||
1460 | 1464 | ||
1461 | return count; | 1465 | return count; |
1462 | } | 1466 | } |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 71add7a8d53c..be1ed38cdcfd 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -575,8 +575,11 @@ void ipoib_mcast_join_task(struct work_struct *work) | |||
575 | 575 | ||
576 | priv->mcast_mtu = IPOIB_UD_MTU(ib_mtu_enum_to_int(priv->broadcast->mcmember.mtu)); | 576 | priv->mcast_mtu = IPOIB_UD_MTU(ib_mtu_enum_to_int(priv->broadcast->mcmember.mtu)); |
577 | 577 | ||
578 | if (!ipoib_cm_admin_enabled(dev)) | 578 | if (!ipoib_cm_admin_enabled(dev)) { |
579 | rtnl_lock(); | ||
579 | dev->mtu = min(priv->mcast_mtu, priv->admin_mtu); | 580 | dev->mtu = min(priv->mcast_mtu, priv->admin_mtu); |
581 | rtnl_unlock(); | ||
582 | } | ||
580 | 583 | ||
581 | ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n"); | 584 | ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n"); |
582 | 585 | ||