patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 19.11] net/nfp: fix disabling VLAN stripping
@ 2022-07-11  8:23 Niklas Söderlund
  2022-07-11  8:45 ` Christian Ehrhardt
  0 siblings, 1 reply; 2+ messages in thread
From: Niklas Söderlund @ 2022-07-11  8:23 UTC (permalink / raw)
  To: stable, christian.ehrhardt
  Cc: oss-drivers, Peng Zhang, Yong Xu, Chaoyong He, Niklas Söderlund

From: Peng Zhang <peng.zhang@corigine.com>

[ upstream commit 7988cdca98940faa80d3e030c1b9811bcdd4c67d ]

"vlan set strip off 0" can't work, due to the incorrect usage
of the mask, it just represent that the status is changed or not,
not represent offloaded or not, so that the driver send the
error control message to the nic.

Now, by first inspect the mask of things that changed, and then
change the requested state if VLAN stripping according the
requested offload status. So this change can fix this bug.

Fixes: d4a27a3 ("nfp: add basic features")
Cc: stable@dpdk.org

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Yong Xu <yong.xu@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
 drivers/net/nfp/nfp_net.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 46e1872927518ad7..f427fad4875fe4f6 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2373,22 +2373,25 @@ nfp_net_vlan_offload_set(struct rte_eth_dev *dev, int mask)
 {
 	uint32_t new_ctrl, update;
 	struct nfp_net_hw *hw;
+	struct rte_eth_conf *dev_conf;
 	int ret;
 
 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	new_ctrl = 0;
+	dev_conf = &dev->data->dev_conf;
+	new_ctrl = hw->ctrl;
 
-	/* Enable vlan strip if it is not configured yet */
-	if ((mask & ETH_VLAN_STRIP_OFFLOAD) &&
-	    !(hw->ctrl & NFP_NET_CFG_CTRL_RXVLAN))
-		new_ctrl = hw->ctrl | NFP_NET_CFG_CTRL_RXVLAN;
+	/*
+	 * Vlan stripping setting
+	 * Enable or disable VLAN stripping
+	 */
+	if (mask & ETH_VLAN_STRIP_MASK) {
+		if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
+			new_ctrl |= NFP_NET_CFG_CTRL_RXVLAN;
+		else
+			new_ctrl &= ~NFP_NET_CFG_CTRL_RXVLAN;
+	}
 
-	/* Disable vlan strip just if it is configured */
-	if (!(mask & ETH_VLAN_STRIP_OFFLOAD) &&
-	    (hw->ctrl & NFP_NET_CFG_CTRL_RXVLAN))
-		new_ctrl = hw->ctrl & ~NFP_NET_CFG_CTRL_RXVLAN;
-
-	if (new_ctrl == 0)
+	if (new_ctrl == hw->ctrl)
 		return 0;
 
 	update = NFP_NET_CFG_UPDATE_GEN;
-- 
2.36.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 19.11] net/nfp: fix disabling VLAN stripping
  2022-07-11  8:23 [PATCH 19.11] net/nfp: fix disabling VLAN stripping Niklas Söderlund
@ 2022-07-11  8:45 ` Christian Ehrhardt
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Ehrhardt @ 2022-07-11  8:45 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: stable, oss-drivers, Peng Zhang, Yong Xu, Chaoyong He

On Mon, Jul 11, 2022 at 10:27 AM Niklas Söderlund
<niklas.soderlund@corigine.com> wrote:
>
> From: Peng Zhang <peng.zhang@corigine.com>
>
> [ upstream commit 7988cdca98940faa80d3e030c1b9811bcdd4c67d ]

Thank you, applied

> "vlan set strip off 0" can't work, due to the incorrect usage
> of the mask, it just represent that the status is changed or not,
> not represent offloaded or not, so that the driver send the
> error control message to the nic.
>
> Now, by first inspect the mask of things that changed, and then
> change the requested state if VLAN stripping according the
> requested offload status. So this change can fix this bug.
>
> Fixes: d4a27a3 ("nfp: add basic features")
> Cc: stable@dpdk.org
>
> Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
> Signed-off-by: Yong Xu <yong.xu@corigine.com>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
> ---
>  drivers/net/nfp/nfp_net.c | 25 ++++++++++++++-----------
>  1 file changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
> index 46e1872927518ad7..f427fad4875fe4f6 100644
> --- a/drivers/net/nfp/nfp_net.c
> +++ b/drivers/net/nfp/nfp_net.c
> @@ -2373,22 +2373,25 @@ nfp_net_vlan_offload_set(struct rte_eth_dev *dev, int mask)
>  {
>         uint32_t new_ctrl, update;
>         struct nfp_net_hw *hw;
> +       struct rte_eth_conf *dev_conf;
>         int ret;
>
>         hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> -       new_ctrl = 0;
> +       dev_conf = &dev->data->dev_conf;
> +       new_ctrl = hw->ctrl;
>
> -       /* Enable vlan strip if it is not configured yet */
> -       if ((mask & ETH_VLAN_STRIP_OFFLOAD) &&
> -           !(hw->ctrl & NFP_NET_CFG_CTRL_RXVLAN))
> -               new_ctrl = hw->ctrl | NFP_NET_CFG_CTRL_RXVLAN;
> +       /*
> +        * Vlan stripping setting
> +        * Enable or disable VLAN stripping
> +        */
> +       if (mask & ETH_VLAN_STRIP_MASK) {
> +               if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
> +                       new_ctrl |= NFP_NET_CFG_CTRL_RXVLAN;
> +               else
> +                       new_ctrl &= ~NFP_NET_CFG_CTRL_RXVLAN;
> +       }
>
> -       /* Disable vlan strip just if it is configured */
> -       if (!(mask & ETH_VLAN_STRIP_OFFLOAD) &&
> -           (hw->ctrl & NFP_NET_CFG_CTRL_RXVLAN))
> -               new_ctrl = hw->ctrl & ~NFP_NET_CFG_CTRL_RXVLAN;
> -
> -       if (new_ctrl == 0)
> +       if (new_ctrl == hw->ctrl)
>                 return 0;
>
>         update = NFP_NET_CFG_UPDATE_GEN;
> --
> 2.36.1
>


-- 
Christian Ehrhardt
Senior Staff Engineer, Ubuntu Server
Canonical Ltd

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-11  8:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-11  8:23 [PATCH 19.11] net/nfp: fix disabling VLAN stripping Niklas Söderlund
2022-07-11  8:45 ` Christian Ehrhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).