Skip to content

Commit c8c2afe

Browse files
Eli CohenRoland Dreier
authored andcommitted
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 <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
1 parent 9eae554 commit c8c2afe

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

drivers/infiniband/ulp/ipoib/ipoib_cm.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,9 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr,
14401440
ipoib_warn(priv, "enabling connected mode "
14411441
"will cause multicast packet drops\n");
14421442

1443+
rtnl_lock();
14431444
dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO);
1445+
rtnl_unlock();
14441446
priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM;
14451447

14461448
ipoib_flush_paths(dev);
@@ -1449,14 +1451,16 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr,
14491451

14501452
if (!strcmp(buf, "datagram\n")) {
14511453
clear_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
1452-
dev->mtu = min(priv->mcast_mtu, dev->mtu);
1453-
ipoib_flush_paths(dev);
14541454

1455+
rtnl_lock();
14551456
if (test_bit(IPOIB_FLAG_CSUM, &priv->flags)) {
14561457
dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
14571458
if (priv->hca_caps & IB_DEVICE_UD_TSO)
14581459
dev->features |= NETIF_F_TSO;
14591460
}
1461+
dev->mtu = min(priv->mcast_mtu, dev->mtu);
1462+
rtnl_unlock();
1463+
ipoib_flush_paths(dev);
14601464

14611465
return count;
14621466
}

drivers/infiniband/ulp/ipoib/ipoib_multicast.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,11 @@ void ipoib_mcast_join_task(struct work_struct *work)
575575

576576
priv->mcast_mtu = IPOIB_UD_MTU(ib_mtu_enum_to_int(priv->broadcast->mcmember.mtu));
577577

578-
if (!ipoib_cm_admin_enabled(dev))
578+
if (!ipoib_cm_admin_enabled(dev)) {
579+
rtnl_lock();
579580
dev->mtu = min(priv->mcast_mtu, priv->admin_mtu);
581+
rtnl_unlock();
582+
}
580583

581584
ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n");
582585

0 commit comments

Comments
 (0)