[PATCH] mlxsw: spectrum: Reset lossiness configuration when changing MTU

Wentao Liang posted 1 patch 8 months, 4 weeks ago
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] mlxsw: spectrum: Reset lossiness configuration when changing MTU
Posted by Wentao Liang 8 months, 4 weeks ago
The function mlxsw_sp_port_change_mtu() reset the buffer sizes but does
not reset the lossiness configuration of the buffers. This could lead to
inconsistent lossiness settings. A proper implementation can be found
in mlxsw_sp_port_headroom_ets_set().

Add lossiness reset by calling mlxsw_sp_hdroom_bufs_reset_lossiness().

Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 3f5e5d99251b..54aa1dca5076 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -797,6 +797,7 @@ static int mlxsw_sp_port_change_mtu(struct net_device *dev, int mtu)
 
 	hdroom = orig_hdroom;
 	hdroom.mtu = mtu;
+	mlxsw_sp_hdroom_bufs_reset_lossiness(&hdroom);
 	mlxsw_sp_hdroom_bufs_reset_sizes(mlxsw_sp_port, &hdroom);
 
 	err = mlxsw_sp_hdroom_configure(mlxsw_sp_port, &hdroom);
-- 
2.42.0.windows.2
Re: [PATCH] mlxsw: spectrum: Reset lossiness configuration when changing MTU
Posted by Petr Machata 8 months, 4 weeks ago
Wentao Liang <vulab@iscas.ac.cn> writes:

> The function mlxsw_sp_port_change_mtu() reset the buffer sizes but does
> not reset the lossiness configuration of the buffers. This could lead to
> inconsistent lossiness settings. A proper implementation can be found
> in mlxsw_sp_port_headroom_ets_set().
>
> Add lossiness reset by calling mlxsw_sp_hdroom_bufs_reset_lossiness().

Thanks for the patch.

Can you explain a little bit more about what issues not resetting
lossiness leads to?

mlxsw_sp_hdroom_bufs_reset_lossiness() changes buffer lossiness based on
lossiness of individual priorities, and priority-to-buffer mapping. It
needs to be called when either of these changes, such as in
mlxsw_sp_port_headroom_ets_set(), or when lossiness of a priority
changes, such as in mlxsw_sp_dcbnl_ieee_setpfc().

Since neither changes here, I would think that the call is just a NOP.

> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
> index 3f5e5d99251b..54aa1dca5076 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
> @@ -797,6 +797,7 @@ static int mlxsw_sp_port_change_mtu(struct net_device *dev, int mtu)
>  
>  	hdroom = orig_hdroom;
>  	hdroom.mtu = mtu;
> +	mlxsw_sp_hdroom_bufs_reset_lossiness(&hdroom);
>  	mlxsw_sp_hdroom_bufs_reset_sizes(mlxsw_sp_port, &hdroom);
>  
>  	err = mlxsw_sp_hdroom_configure(mlxsw_sp_port, &hdroom);