diff options
| author | Jack Morgenstein <jackm@dev.mellanox.co.il> | 2012-08-03 04:40:52 -0400 |
|---|---|---|
| committer | Roland Dreier <roland@purestorage.com> | 2012-09-30 23:33:40 -0400 |
| commit | efcd235d736ab05ef2b29d7fe1493a2f52b07b66 (patch) | |
| tree | 7111fa75eb2290a2c55962e6e1cd25007bdf0be0 | |
| parent | c1e7e466120b80ce49e91af0c9da1ce6dee4844a (diff) | |
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>
| -rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/port.c | 10 | ||||
| -rw-r--r-- | include/linux/mlx4/device.h | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c index e36dd0f2fa73..4c51b05efa28 100644 --- a/drivers/net/ethernet/mellanox/mlx4/port.c +++ b/drivers/net/ethernet/mellanox/mlx4/port.c | |||
| @@ -732,6 +732,16 @@ static int mlx4_common_set_port(struct mlx4_dev *dev, int slave, u32 in_mod, | |||
| 732 | new_cap_mask = ((__be32 *) inbox->buf)[1]; | 732 | new_cap_mask = ((__be32 *) inbox->buf)[1]; |
| 733 | } | 733 | } |
| 734 | 734 | ||
| 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 | |||
| 735 | agg_cap_mask = 0; | 745 | agg_cap_mask = 0; |
| 736 | slave_cap_mask = | 746 | slave_cap_mask = |
| 737 | priv->mfunc.master.slave_state[slave].ib_cap_mask[port]; | 747 | priv->mfunc.master.slave_state[slave].ib_cap_mask[port]; |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 380e01671d1e..b3f9b4500b9b 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
| @@ -54,6 +54,11 @@ enum { | |||
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | enum { | 56 | enum { |
| 57 | MLX4_PORT_CAP_IS_SM = 1 << 1, | ||
| 58 | MLX4_PORT_CAP_DEV_MGMT_SUP = 1 << 19, | ||
| 59 | }; | ||
| 60 | |||
| 61 | enum { | ||
| 57 | MLX4_MAX_PORTS = 2, | 62 | MLX4_MAX_PORTS = 2, |
| 58 | MLX4_MAX_PORT_PKEYS = 128 | 63 | MLX4_MAX_PORT_PKEYS = 128 |
| 59 | }; | 64 | }; |
