Skip to content

Commit

Permalink
mlxsw: spectrum_buffers: Prevent changing CPU port's configuration
Browse files Browse the repository at this point in the history
Next patch is going to register the CPU port with devlink, but only so
that the CPU port's shared buffer configuration and occupancy could be
queried.

Prevent changing CPU port's shared buffer threshold and binding
configuration.

Signed-off-by: Shalom Toledo <shalomt@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Shalom Toledo authored and David S. Miller committed Sep 16, 2019
1 parent b63e1a0 commit 9d0aa05
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,11 @@ int mlxsw_sp_sb_port_pool_set(struct mlxsw_core_port *mlxsw_core_port,
u32 max_buff;
int err;

if (local_port == MLXSW_PORT_CPU_PORT) {
NL_SET_ERR_MSG_MOD(extack, "Changing CPU port's threshold is forbidden");
return -EINVAL;
}

err = mlxsw_sp_sb_threshold_in(mlxsw_sp, pool_index,
threshold, &max_buff, extack);
if (err)
Expand Down Expand Up @@ -1130,6 +1135,11 @@ int mlxsw_sp_sb_tc_pool_bind_set(struct mlxsw_core_port *mlxsw_core_port,
u32 max_buff;
int err;

if (local_port == MLXSW_PORT_CPU_PORT) {
NL_SET_ERR_MSG_MOD(extack, "Changing CPU port's binding is forbidden");
return -EINVAL;
}

if (dir != mlxsw_sp->sb_vals->pool_dess[pool_index].dir) {
NL_SET_ERR_MSG_MOD(extack, "Binding egress TC to ingress pool and vice versa is forbidden");
return -EINVAL;
Expand Down

0 comments on commit 9d0aa05

Please sign in to comment.