|
@@ -3194,6 +3194,12 @@ int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port,
|
|
|
int enabled)
|
|
|
{
|
|
|
struct mlx4_priv *priv = mlx4_priv(dev);
|
|
|
+ struct mlx4_active_ports actv_ports = mlx4_get_active_ports(
|
|
|
+ &priv->dev, slave);
|
|
|
+ int min_port = find_first_bit(actv_ports.ports,
|
|
|
+ priv->dev.caps.num_ports) + 1;
|
|
|
+ int max_port = min_port - 1 +
|
|
|
+ bitmap_weight(actv_ports.ports, priv->dev.caps.num_ports);
|
|
|
|
|
|
if (slave == mlx4_master_func_num(dev))
|
|
|
return 0;
|
|
@@ -3203,6 +3209,11 @@ int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port,
|
|
|
enabled < 0 || enabled > 1)
|
|
|
return -EINVAL;
|
|
|
|
|
|
+ if (min_port == max_port && dev->caps.num_ports > 1) {
|
|
|
+ mlx4_info(dev, "SMI access disallowed for single ported VFs\n");
|
|
|
+ return -EPROTONOSUPPORT;
|
|
|
+ }
|
|
|
+
|
|
|
priv->mfunc.master.vf_admin[slave].enable_smi[port] = enabled;
|
|
|
return 0;
|
|
|
}
|