diff options
author | Moni Shoua <monis@mellanox.co.il> | 2014-02-05 08:13:02 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-02-13 17:31:09 -0500 |
commit | ad4885d279b63c65347220236d07669a2f59634b (patch) | |
tree | 1d540ca627bc2b997320384dda5bd9d7907f40e9 | |
parent | 5071456fe244e409adcda7226e5f0b5d1b879fd3 (diff) |
IB/mlx4: Build the port IBoE GID table properly under bonding
When scanning netdevices we need to check a few more conditions and
cases to build the IBoE GID table properly. For example, under
bonding we must make sure that when a port is down, the bond IP
address isn't programmed as a GID, since doing so will cause failure
with IB core flows that selects ports by GID.
Signed-off-by: Moni Shoua <monis@mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 8e10630561c1..fdb5c7c9e127 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -1507,7 +1507,6 @@ static int reset_gid_table(struct mlx4_ib_dev *dev, u8 port) | |||
1507 | { | 1507 | { |
1508 | struct update_gid_work *work; | 1508 | struct update_gid_work *work; |
1509 | 1509 | ||
1510 | |||
1511 | work = kzalloc(sizeof(*work), GFP_ATOMIC); | 1510 | work = kzalloc(sizeof(*work), GFP_ATOMIC); |
1512 | if (!work) | 1511 | if (!work) |
1513 | return -ENOMEM; | 1512 | return -ENOMEM; |
@@ -1699,25 +1698,57 @@ static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev) | |||
1699 | 1698 | ||
1700 | spin_lock(&iboe->lock); | 1699 | spin_lock(&iboe->lock); |
1701 | mlx4_foreach_ib_transport_port(port, ibdev->dev) { | 1700 | mlx4_foreach_ib_transport_port(port, ibdev->dev) { |
1701 | enum ib_port_state port_state = IB_PORT_NOP; | ||
1702 | struct net_device *old_master = iboe->masters[port - 1]; | 1702 | struct net_device *old_master = iboe->masters[port - 1]; |
1703 | struct net_device *curr_netdev; | ||
1703 | struct net_device *curr_master; | 1704 | struct net_device *curr_master; |
1705 | |||
1704 | iboe->netdevs[port - 1] = | 1706 | iboe->netdevs[port - 1] = |
1705 | mlx4_get_protocol_dev(ibdev->dev, MLX4_PROT_ETH, port); | 1707 | mlx4_get_protocol_dev(ibdev->dev, MLX4_PROT_ETH, port); |
1706 | if (iboe->netdevs[port - 1]) | 1708 | if (iboe->netdevs[port - 1]) |
1707 | mlx4_ib_set_default_gid(ibdev, | 1709 | mlx4_ib_set_default_gid(ibdev, |
1708 | iboe->netdevs[port - 1], port); | 1710 | iboe->netdevs[port - 1], port); |
1711 | curr_netdev = iboe->netdevs[port - 1]; | ||
1712 | |||
1709 | if (iboe->netdevs[port - 1] && | 1713 | if (iboe->netdevs[port - 1] && |
1710 | netif_is_bond_slave(iboe->netdevs[port - 1])) { | 1714 | netif_is_bond_slave(iboe->netdevs[port - 1])) { |
1711 | iboe->masters[port - 1] = netdev_master_upper_dev_get( | 1715 | iboe->masters[port - 1] = netdev_master_upper_dev_get( |
1712 | iboe->netdevs[port - 1]); | 1716 | iboe->netdevs[port - 1]); |
1717 | } else { | ||
1718 | iboe->masters[port - 1] = NULL; | ||
1713 | } | 1719 | } |
1714 | curr_master = iboe->masters[port - 1]; | 1720 | curr_master = iboe->masters[port - 1]; |
1715 | 1721 | ||
1722 | if (curr_netdev) { | ||
1723 | port_state = (netif_running(curr_netdev) && netif_carrier_ok(curr_netdev)) ? | ||
1724 | IB_PORT_ACTIVE : IB_PORT_DOWN; | ||
1725 | mlx4_ib_set_default_gid(ibdev, curr_netdev, port); | ||
1726 | } else { | ||
1727 | reset_gid_table(ibdev, port); | ||
1728 | } | ||
1729 | /* if using bonding/team and a slave port is down, we don't the bond IP | ||
1730 | * based gids in the table since flows that select port by gid may get | ||
1731 | * the down port. | ||
1732 | */ | ||
1733 | if (curr_master && (port_state == IB_PORT_DOWN)) { | ||
1734 | reset_gid_table(ibdev, port); | ||
1735 | mlx4_ib_set_default_gid(ibdev, curr_netdev, port); | ||
1736 | } | ||
1716 | /* if bonding is used it is possible that we add it to masters | 1737 | /* if bonding is used it is possible that we add it to masters |
1717 | only after IP address is assigned to the net bonding | 1738 | * only after IP address is assigned to the net bonding |
1718 | interface */ | 1739 | * interface. |
1719 | if (curr_master && (old_master != curr_master)) | 1740 | */ |
1741 | if (curr_master && (old_master != curr_master)) { | ||
1742 | reset_gid_table(ibdev, port); | ||
1743 | mlx4_ib_set_default_gid(ibdev, curr_netdev, port); | ||
1720 | mlx4_ib_get_dev_addr(curr_master, ibdev, port); | 1744 | mlx4_ib_get_dev_addr(curr_master, ibdev, port); |
1745 | } | ||
1746 | |||
1747 | if (!curr_master && (old_master != curr_master)) { | ||
1748 | reset_gid_table(ibdev, port); | ||
1749 | mlx4_ib_set_default_gid(ibdev, curr_netdev, port); | ||
1750 | mlx4_ib_get_dev_addr(curr_netdev, ibdev, port); | ||
1751 | } | ||
1721 | } | 1752 | } |
1722 | 1753 | ||
1723 | spin_unlock(&iboe->lock); | 1754 | spin_unlock(&iboe->lock); |
@@ -2099,6 +2130,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
2099 | } | 2130 | } |
2100 | } | 2131 | } |
2101 | #endif | 2132 | #endif |
2133 | for (i = 1 ; i <= ibdev->num_ports ; ++i) | ||
2134 | reset_gid_table(ibdev, i); | ||
2102 | rtnl_lock(); | 2135 | rtnl_lock(); |
2103 | mlx4_ib_scan_netdevs(ibdev); | 2136 | mlx4_ib_scan_netdevs(ibdev); |
2104 | rtnl_unlock(); | 2137 | rtnl_unlock(); |