Subject: Re: [net 13/15] net/mlx5e: MACsec, remove replay window size limitation in offload path

From: Jakub Kicinski <[email-masked]>
Date: Mon, 28 Nov 2022 19:35:53 -0800

On Mon, 28 Nov 2022 15:42:19 -0800 Jacob Keller wrote:
> > index c19581f1f733..72f8be65fa90 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
> > @@ -229,22 +229,6 @@ static int macsec_set_replay_protection(struct mlx5_macsec_obj_attrs *attrs, voi
> >   	if (!attrs->replay_protect)
> >   		return 0;
> >   
> > -	switch (attrs->replay_window) {
> > -	case 256:
> > -		window_sz = MLX5_MACSEC_ASO_REPLAY_WIN_256BIT;
> > -		break;
> > -	case 128:
> > -		window_sz = MLX5_MACSEC_ASO_REPLAY_WIN_128BIT;
> > -		break;
> > -	case 64:
> > -		window_sz = MLX5_MACSEC_ASO_REPLAY_WIN_64BIT;
> > -		break;
> > -	case 32:
> > -		window_sz = MLX5_MACSEC_ASO_REPLAY_WIN_32BIT;
> > -		break;
> > -	default:
> > -		return -EINVAL;
> > -	}  
> 
> What sets window_sz now? Looking at the current code wouldn't this leave 
> window_sz uninitialized and this undefined behavior of MLX5_SET? Either 
> you should just forward in attrs->replay_window and remove window_sz 
> local or drop the MLX5_SET call for setting window size?

Damn it, this is a clang warning, I need to rescind the PR :/