lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 19 Feb 2023 11:21:31 +0200
From:   Leon Romanovsky <leon@...nel.org>
To:     edward.cree@....com
Cc:     linux-net-drivers@....com, davem@...emloft.net, kuba@...nel.org,
        pabeni@...hat.com, edumazet@...gle.com,
        Edward Cree <ecree.xilinx@...il.com>, netdev@...r.kernel.org,
        habetsm.xilinx@...il.com
Subject: Re: [PATCH net-next] sfc: support offloading TC VLAN push/pop
 actions to the MAE

On Thu, Feb 16, 2023 at 04:04:42PM +0000, edward.cree@....com wrote:
> From: Edward Cree <ecree.xilinx@...il.com>
> 
> EF100 can pop and/or push up to two VLAN tags.
> 
> Signed-off-by: Edward Cree <ecree.xilinx@...il.com>
> ---
>  drivers/net/ethernet/sfc/mae.c  | 43 ++++++++++++++++++++++++++
>  drivers/net/ethernet/sfc/mcdi.h |  5 ++++
>  drivers/net/ethernet/sfc/tc.c   | 53 +++++++++++++++++++++++++++++++++
>  drivers/net/ethernet/sfc/tc.h   |  4 +++
>  4 files changed, 105 insertions(+)
> 
> diff --git a/drivers/net/ethernet/sfc/mae.c b/drivers/net/ethernet/sfc/mae.c
> index 6321fd393fc3..7ae5b22af624 100644
> --- a/drivers/net/ethernet/sfc/mae.c
> +++ b/drivers/net/ethernet/sfc/mae.c
> @@ -679,9 +679,40 @@ int efx_mae_alloc_action_set(struct efx_nic *efx, struct efx_tc_action_set *act)
>  {
>  	MCDI_DECLARE_BUF(outbuf, MC_CMD_MAE_ACTION_SET_ALLOC_OUT_LEN);
>  	MCDI_DECLARE_BUF(inbuf, MC_CMD_MAE_ACTION_SET_ALLOC_IN_LEN);
> +	unsigned char vlan_push, vlan_pop;
>  	size_t outlen;
>  	int rc;
>  
> +	/* Translate vlan actions from bitmask to count */
> +	switch (act->vlan_push) {
> +	case 0:
> +	case 1:
> +		vlan_push = act->vlan_push;
> +		break;
> +	case 2: /* can't happen */

There is no need in case here as "default" will catch.

> +	default:
> +		return -EINVAL;
> +	case 3:
> +		vlan_push = 2;
> +		break;
> +	}
> +	switch (act->vlan_pop) {
> +	case 0:
> +	case 1:
> +		vlan_pop = act->vlan_pop;
> +		break;
> +	case 2: /* can't happen */
> +	default:
> +		return -EINVAL;

Please rely switch-case semantics and don't put default in the middle.


> +	case 3:
> +		vlan_pop = 2;
> +		break;
> +	}

Thanks

Powered by blists - more mailing lists