Commit 2a500090 authored by Eugenia Emantayev's avatar Eugenia Emantayev Committed by David S. Miller

net/mlx4_core: Don't allow to VF change global pause settings

Currently changing global pause settings is done via SET_PORT
command with input modifier GENERAL. This command is allowed
for each VF since MTU setting is done via the same command.

Change the above to the following scheme: before passing the
request to the FW, the PF will check whether it was issued
by a slave. If yes, don't change global pause and warn,
otherwise change to the requested value and store for
further reference.
Signed-off-by: default avatarEugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4bfd2e6e
...@@ -586,6 +586,8 @@ struct mlx4_mfunc_master_ctx { ...@@ -586,6 +586,8 @@ struct mlx4_mfunc_master_ctx {
struct mlx4_master_qp0_state qp0_state[MLX4_MAX_PORTS + 1]; struct mlx4_master_qp0_state qp0_state[MLX4_MAX_PORTS + 1];
int init_port_ref[MLX4_MAX_PORTS + 1]; int init_port_ref[MLX4_MAX_PORTS + 1];
u16 max_mtu[MLX4_MAX_PORTS + 1]; u16 max_mtu[MLX4_MAX_PORTS + 1];
u8 pptx;
u8 pprx;
int disable_mcast_ref[MLX4_MAX_PORTS + 1]; int disable_mcast_ref[MLX4_MAX_PORTS + 1];
struct mlx4_resource_tracker res_tracker; struct mlx4_resource_tracker res_tracker;
struct workqueue_struct *comm_wq; struct workqueue_struct *comm_wq;
......
...@@ -1317,6 +1317,19 @@ static int mlx4_common_set_port(struct mlx4_dev *dev, int slave, u32 in_mod, ...@@ -1317,6 +1317,19 @@ static int mlx4_common_set_port(struct mlx4_dev *dev, int slave, u32 in_mod,
} }
gen_context->mtu = cpu_to_be16(master->max_mtu[port]); gen_context->mtu = cpu_to_be16(master->max_mtu[port]);
/* Slave cannot change Global Pause configuration */
if (slave != mlx4_master_func_num(dev) &&
((gen_context->pptx != master->pptx) ||
(gen_context->pprx != master->pprx))) {
gen_context->pptx = master->pptx;
gen_context->pprx = master->pprx;
mlx4_warn(dev,
"denying Global Pause change for slave:%d\n",
slave);
} else {
master->pptx = gen_context->pptx;
master->pprx = gen_context->pprx;
}
break; break;
case MLX4_SET_PORT_GID_TABLE: case MLX4_SET_PORT_GID_TABLE:
/* change to MULTIPLE entries: number of guest's gids /* change to MULTIPLE entries: number of guest's gids
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment