Commit 14366da6 authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

mlxsw: spectrum_span: Wrap buffer change in a function

The code that adjusts the egress buffer size is not symmetric at the
moment. The update is done via a call to
mlxsw_sp_span_port_buffer_update(), but the disablement is done inline
by invoking the write to SBIB register directly.

Wrap the disablement code in mlxsw_sp_span_port_buffer_disable().
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Suggested-by: default avatarPetr Machata <petrm@mellanox.com>
Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eb773c3a
...@@ -803,6 +803,15 @@ mlxsw_sp_span_port_buffer_update(struct mlxsw_sp_port *mlxsw_sp_port, u16 mtu) ...@@ -803,6 +803,15 @@ mlxsw_sp_span_port_buffer_update(struct mlxsw_sp_port *mlxsw_sp_port, u16 mtu)
return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbib), sbib_pl); return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbib), sbib_pl);
} }
static void mlxsw_sp_span_port_buffer_disable(struct mlxsw_sp *mlxsw_sp,
u8 local_port)
{
char sbib_pl[MLXSW_REG_SBIB_LEN];
mlxsw_reg_sbib_pack(sbib_pl, local_port, 0);
mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbib), sbib_pl);
}
int mlxsw_sp_span_port_mtu_update(struct mlxsw_sp_port *port, u16 mtu) int mlxsw_sp_span_port_mtu_update(struct mlxsw_sp_port *port, u16 mtu)
{ {
/* If port is egress mirrored, the shared buffer size should be /* If port is egress mirrored, the shared buffer size should be
...@@ -1154,15 +1163,13 @@ mlxsw_sp_span_analyzed_port_destroy(struct mlxsw_sp_span *span, ...@@ -1154,15 +1163,13 @@ mlxsw_sp_span_analyzed_port_destroy(struct mlxsw_sp_span *span,
analyzed_port) analyzed_port)
{ {
struct mlxsw_sp *mlxsw_sp = span->mlxsw_sp; struct mlxsw_sp *mlxsw_sp = span->mlxsw_sp;
char sbib_pl[MLXSW_REG_SBIB_LEN];
/* Remove egress mirror buffer now that port is no longer analyzed /* Remove egress mirror buffer now that port is no longer analyzed
* at egress. * at egress.
*/ */
if (!analyzed_port->ingress) { if (!analyzed_port->ingress)
mlxsw_reg_sbib_pack(sbib_pl, analyzed_port->local_port, 0); mlxsw_sp_span_port_buffer_disable(mlxsw_sp,
mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbib), sbib_pl); analyzed_port->local_port);
}
list_del(&analyzed_port->list); list_del(&analyzed_port->list);
kfree(analyzed_port); kfree(analyzed_port);
......
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