Skip to content

Commit 026149c

Browse files
Jack Morgensteinrolandd
authored andcommitted
mlx4: Activate SR-IOV mode for IB
Remove the error returns for IB ports from mlx4_ib_add, mlx4_INIT_PORT_wrapper, and mlx4_CLOSE_PORT_wrapper. Currently, SRIOV is supported only for devices for which the link layer is IB on all ports; RoCE support will be added later. Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il> Signed-off-by: Roland Dreier <roland@purestorage.com>
1 parent 992e8e6 commit 026149c

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

‎drivers/infiniband/hw/mlx4/main.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,11 +1293,15 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
12931293

12941294
pr_info_once("%s", mlx4_ib_version);
12951295

1296-
if (mlx4_is_mfunc(dev)) {
1297-
pr_warn("IB not yet supported in SRIOV\n");
1296+
mlx4_foreach_non_ib_transport_port(i, dev)
1297+
num_ports++;
1298+
1299+
if (mlx4_is_mfunc(dev) && num_ports) {
1300+
dev_err(&dev->pdev->dev, "RoCE is not supported over SRIOV as yet\n");
12981301
return NULL;
12991302
}
13001303

1304+
num_ports = 0;
13011305
mlx4_foreach_ib_transport_port(i, dev)
13021306
num_ports++;
13031307

‎drivers/net/ethernet/mellanox/mlx4/fw.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,9 +1391,6 @@ int mlx4_INIT_PORT_wrapper(struct mlx4_dev *dev, int slave,
13911391
if (priv->mfunc.master.slave_state[slave].init_port_mask & (1 << port))
13921392
return 0;
13931393

1394-
if (dev->caps.port_mask[port] == MLX4_PORT_TYPE_IB)
1395-
return -ENODEV;
1396-
13971394
if (dev->caps.port_mask[port] != MLX4_PORT_TYPE_IB) {
13981395
/* Enable port only if it was previously disabled */
13991396
if (!priv->mfunc.master.init_port_ref[port]) {
@@ -1489,9 +1486,6 @@ int mlx4_CLOSE_PORT_wrapper(struct mlx4_dev *dev, int slave,
14891486
(1 << port)))
14901487
return 0;
14911488

1492-
if (dev->caps.port_mask[port] == MLX4_PORT_TYPE_IB)
1493-
return -ENODEV;
1494-
14951489
if (dev->caps.port_mask[port] != MLX4_PORT_TYPE_IB) {
14961490
if (priv->mfunc.master.init_port_ref[port] == 1) {
14971491
err = mlx4_cmd(dev, 0, port, 0, MLX4_CMD_CLOSE_PORT,

‎include/linux/mlx4/device.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,10 @@ struct mlx4_init_port_param {
697697
for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
698698
if ((type) == (dev)->caps.port_mask[(port)])
699699

700+
#define mlx4_foreach_non_ib_transport_port(port, dev) \
701+
for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
702+
if (((dev)->caps.port_mask[port] != MLX4_PORT_TYPE_IB))
703+
700704
#define mlx4_foreach_ib_transport_port(port, dev) \
701705
for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
702706
if (((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_IB) || \

0 commit comments

Comments
 (0)