Skip to content

Commit efcd235

Browse files
Jack Morgensteinrolandd
authored andcommitted
net/mlx4_core: Adjustments to SET_PORT for IB SR-IOV
1. Slaves may not set the IS_SM capability for the port. 2. DEV_MGMT may not be set in multifunction mode. Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il> Signed-off-by: Roland Dreier <roland@purestorage.com>
1 parent c1e7e46 commit efcd235

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,16 @@ static int mlx4_common_set_port(struct mlx4_dev *dev, int slave, u32 in_mod,
732732
new_cap_mask = ((__be32 *) inbox->buf)[1];
733733
}
734734

735+
/* slave may not set the IS_SM capability for the port */
736+
if (slave != mlx4_master_func_num(dev) &&
737+
(be32_to_cpu(new_cap_mask) & MLX4_PORT_CAP_IS_SM))
738+
return -EINVAL;
739+
740+
/* No DEV_MGMT in multifunc mode */
741+
if (mlx4_is_mfunc(dev) &&
742+
(be32_to_cpu(new_cap_mask) & MLX4_PORT_CAP_DEV_MGMT_SUP))
743+
return -EINVAL;
744+
735745
agg_cap_mask = 0;
736746
slave_cap_mask =
737747
priv->mfunc.master.slave_state[slave].ib_cap_mask[port];

‎include/linux/mlx4/device.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ enum {
5353
MLX4_FLAG_SRIOV = 1 << 4,
5454
};
5555

56+
enum {
57+
MLX4_PORT_CAP_IS_SM = 1 << 1,
58+
MLX4_PORT_CAP_DEV_MGMT_SUP = 1 << 19,
59+
};
60+
5661
enum {
5762
MLX4_MAX_PORTS = 2,
5863
MLX4_MAX_PORT_PKEYS = 128

0 commit comments

Comments
 (0)