aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx4
diff options
context:
space:
mode:
authorMatan Barak <matanb@mellanox.com>2014-03-19 12:11:49 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-20 16:18:29 -0400
commit82373701be26b893eaf7372db0af84235a51998a (patch)
tree3159467efb4de693e07c5e1c8bd1d08eb37faa7d /drivers/infiniband/hw/mlx4
parent8798998c2cdbc0df3c64e8845c1502ed93ef1ebd (diff)
IB/mlx4_ib: Adapt code to use caps.num_ports instead of a constant
Some code in the mlx4 IB driver stack assumed MLX4_MAX_PORTS ports. Instead, we should only loop until the number of actual ports in i the device, which is stored in dev->caps.num_ports. Signed-off-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/infiniband/hw/mlx4')
-rw-r--r--drivers/infiniband/hw/mlx4/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 1d1750ef000a..2ff428b17088 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -1546,7 +1546,7 @@ static int mlx4_ib_addr_event(int event, struct net_device *event_netdev,
1546 iboe = &ibdev->iboe; 1546 iboe = &ibdev->iboe;
1547 spin_lock(&iboe->lock); 1547 spin_lock(&iboe->lock);
1548 1548
1549 for (port = 1; port <= MLX4_MAX_PORTS; ++port) 1549 for (port = 1; port <= ibdev->dev->caps.num_ports; ++port)
1550 if ((netif_is_bond_master(real_dev) && 1550 if ((netif_is_bond_master(real_dev) &&
1551 (real_dev == iboe->masters[port - 1])) || 1551 (real_dev == iboe->masters[port - 1])) ||
1552 (!netif_is_bond_master(real_dev) && 1552 (!netif_is_bond_master(real_dev) &&
@@ -1569,14 +1569,14 @@ static u8 mlx4_ib_get_dev_port(struct net_device *dev,
1569 1569
1570 iboe = &ibdev->iboe; 1570 iboe = &ibdev->iboe;
1571 1571
1572 for (port = 1; port <= MLX4_MAX_PORTS; ++port) 1572 for (port = 1; port <= ibdev->dev->caps.num_ports; ++port)
1573 if ((netif_is_bond_master(real_dev) && 1573 if ((netif_is_bond_master(real_dev) &&
1574 (real_dev == iboe->masters[port - 1])) || 1574 (real_dev == iboe->masters[port - 1])) ||
1575 (!netif_is_bond_master(real_dev) && 1575 (!netif_is_bond_master(real_dev) &&
1576 (real_dev == iboe->netdevs[port - 1]))) 1576 (real_dev == iboe->netdevs[port - 1])))
1577 break; 1577 break;
1578 1578
1579 if ((port == 0) || (port > MLX4_MAX_PORTS)) 1579 if ((port == 0) || (port > ibdev->dev->caps.num_ports))
1580 return 0; 1580 return 0;
1581 else 1581 else
1582 return port; 1582 return port;
@@ -1626,7 +1626,7 @@ static void mlx4_ib_get_dev_addr(struct net_device *dev,
1626 union ib_gid gid; 1626 union ib_gid gid;
1627 1627
1628 1628
1629 if ((port == 0) || (port > MLX4_MAX_PORTS)) 1629 if ((port == 0) || (port > ibdev->dev->caps.num_ports))
1630 return; 1630 return;
1631 1631
1632 /* IPv4 gids */ 1632 /* IPv4 gids */