[PATCH] net/nfp: fix the issue about set the vlan strip offload off

Niklas Söderlund niklas.soderlund at corigine.com
Mon May 23 23:16:52 CEST 2022


Hi Peng,

Thanks for your work.

On 2022-04-19 10:38:57 +0200, Peng Zhang wrote:
> When set the vlan_strip_offload off, it doesn't work.
> Because we can't update the msg in the nic.
> 
> This patch will fix this error.
> 
> Fixes: d4a27a3b092a ("nfp: add basic features")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Peng Zhang <peng.zhang at corigine.com>
> Signed-off-by: Yong Xu <yong.xu at corigine.com>
> Signed-off-by: Chaoyong He <chaoyong.he at corigine.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund at corigine.com>

> ---
>  drivers/net/nfp/nfp_common.c | 21 ++++++++++-----------
>  1 file changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
> index b26770dbfb..ab4cfda389 100644
> --- a/drivers/net/nfp/nfp_common.c
> +++ b/drivers/net/nfp/nfp_common.c
> @@ -968,19 +968,18 @@ nfp_net_vlan_offload_set(struct rte_eth_dev *dev, int mask)
>  	int ret;
>  
>  	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> -	new_ctrl = 0;
> +	new_ctrl = hw->ctrl;
>  
> -	/* Enable vlan strip if it is not configured yet */
> -	if ((mask & RTE_ETH_VLAN_STRIP_OFFLOAD) &&
> -	    !(hw->ctrl & NFP_NET_CFG_CTRL_RXVLAN))
> -		new_ctrl = hw->ctrl | NFP_NET_CFG_CTRL_RXVLAN;
> -
> -	/* Disable vlan strip just if it is configured */
> -	if (!(mask & RTE_ETH_VLAN_STRIP_OFFLOAD) &&
> -	    (hw->ctrl & NFP_NET_CFG_CTRL_RXVLAN))
> -		new_ctrl = hw->ctrl & ~NFP_NET_CFG_CTRL_RXVLAN;
> +	if (mask & RTE_ETH_VLAN_STRIP_OFFLOAD) {
> +		/* Disable vlan strip just if it is configured */
> +		if (hw->ctrl & NFP_NET_CFG_CTRL_RXVLAN)
> +			new_ctrl = new_ctrl & ~NFP_NET_CFG_CTRL_RXVLAN;
> +		/* Enable vlan strip if it is not configured yet */
> +		else
> +			new_ctrl = new_ctrl | NFP_NET_CFG_CTRL_RXVLAN;
> +	}
>  
> -	if (new_ctrl == 0)
> +	if (new_ctrl == hw->ctrl)
>  		return 0;
>  
>  	update = NFP_NET_CFG_UPDATE_GEN;
> -- 
> 2.27.0
> 

-- 
Kind Regards,
Niklas Söderlund


More information about the stable mailing list