All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/ice: fix vlan stripping in double VLAN mode
@ 2024-03-27 18:44 Vladimir Medvedkin
  2024-03-28 11:16 ` David Marchand
  2024-04-04 10:43 ` Bruce Richardson
  0 siblings, 2 replies; 4+ messages in thread
From: Vladimir Medvedkin @ 2024-03-27 18:44 UTC (permalink / raw)
  To: dev; +Cc: david.marchand, carlosmn, mingjinx.ye, stable

The ICE hardware can operate in two modes - single vlan mode
or double vlan mode. Depending on the operating mode the hardware
handles vlan header with single vlan tag differently.
When double vlan enabled, a packet with a single VLAN is treated
as a packet with outer VLAN only. Otherwise, a single VLAN in a
packet is treated as inner VLAN.

This patch fixes the logic of how vlan stripping is programmed.

Bugzilla ID: 1402

Fixes: de5da9d16430 ("net/ice: support double VLAN")
Cc: mingjinx.ye@intel.com
Cc: stable@dpdk.org

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 45 +++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 87385d2649..205c5f5f43 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -3826,7 +3826,10 @@ ice_dev_start(struct rte_eth_dev *dev)
 	ice_set_tx_function(dev);
 
 	mask = RTE_ETH_VLAN_STRIP_MASK | RTE_ETH_VLAN_FILTER_MASK |
-			RTE_ETH_VLAN_EXTEND_MASK | RTE_ETH_QINQ_STRIP_MASK;
+			RTE_ETH_VLAN_EXTEND_MASK;
+	if (ice_is_dvm_ena(hw))
+		mask |= RTE_ETH_QINQ_STRIP_MASK;
+
 	ret = ice_vlan_offload_set(dev, mask);
 	if (ret) {
 		PMD_INIT_LOG(ERR, "Unable to set VLAN offload");
@@ -4896,19 +4899,35 @@ ice_vlan_offload_set(struct rte_eth_dev *dev, int mask)
 			ice_vsi_config_vlan_filter(vsi, false);
 	}
 
-	if (mask & RTE_ETH_VLAN_STRIP_MASK) {
-		if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP)
-			ice_vsi_config_vlan_stripping(vsi, true);
-		else
-			ice_vsi_config_vlan_stripping(vsi, false);
-	}
+	struct ice_hw *hw = ICE_VSI_TO_HW(vsi);
+	if (!ice_is_dvm_ena(hw)) {
+		if (mask & RTE_ETH_VLAN_STRIP_MASK) {
+			if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP)
+				ice_vsi_config_vlan_stripping(vsi, true);
+			else
+				ice_vsi_config_vlan_stripping(vsi, false);
+		}
 
-	if (mask & RTE_ETH_QINQ_STRIP_MASK) {
-		/* Enable or disable outer VLAN stripping */
-		if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_QINQ_STRIP)
-			ice_vsi_config_outer_vlan_stripping(vsi, true);
-		else
-			ice_vsi_config_outer_vlan_stripping(vsi, false);
+		if (mask & RTE_ETH_QINQ_STRIP_MASK) {
+			PMD_DRV_LOG(ERR, "Single VLAN mode (SVM) does not support qinq");
+			return -ENOTSUP;
+		}
+	} else {
+		if ((mask & RTE_ETH_VLAN_STRIP_MASK) |
+				(mask & RTE_ETH_QINQ_STRIP_MASK)) {
+			if (rxmode->offloads & (RTE_ETH_RX_OFFLOAD_VLAN_STRIP |
+						RTE_ETH_RX_OFFLOAD_QINQ_STRIP))
+				ice_vsi_config_outer_vlan_stripping(vsi, true);
+			else
+				ice_vsi_config_outer_vlan_stripping(vsi, false);
+		}
+
+		if (mask & RTE_ETH_QINQ_STRIP_MASK) {
+			if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_QINQ_STRIP)
+				ice_vsi_config_vlan_stripping(vsi, true);
+			else
+				ice_vsi_config_vlan_stripping(vsi, false);
+		}
 	}
 
 	return 0;
-- 
2.34.1


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

* Re: [PATCH] net/ice: fix vlan stripping in double VLAN mode
  2024-03-27 18:44 [PATCH] net/ice: fix vlan stripping in double VLAN mode Vladimir Medvedkin
@ 2024-03-28 11:16 ` David Marchand
  2024-04-03 14:03   ` RES: " Carlos de Souza Moraes Neto
  2024-04-04 10:43 ` Bruce Richardson
  1 sibling, 1 reply; 4+ messages in thread
From: David Marchand @ 2024-03-28 11:16 UTC (permalink / raw)
  To: Vladimir Medvedkin; +Cc: dev, carlosmn, mingjinx.ye, stable

On Wed, Mar 27, 2024 at 7:44 PM Vladimir Medvedkin
<vladimir.medvedkin@intel.com> wrote:
>
> The ICE hardware can operate in two modes - single vlan mode
> or double vlan mode. Depending on the operating mode the hardware
> handles vlan header with single vlan tag differently.
> When double vlan enabled, a packet with a single VLAN is treated
> as a packet with outer VLAN only. Otherwise, a single VLAN in a
> packet is treated as inner VLAN.
>
> This patch fixes the logic of how vlan stripping is programmed.
>
> Bugzilla ID: 1402

Nit: no need for an empty line here, the Bugzilla ID: tag goes with
the Fixes: and Cc: block.

>
> Fixes: de5da9d16430 ("net/ice: support double VLAN")
> Cc: mingjinx.ye@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>

Thanks Vladimir.
It looks to fix the issue I observed.
I'll let Carlos confirm the fix is good for him too.


-- 
David Marchand


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

* RES: [PATCH] net/ice: fix vlan stripping in double VLAN mode
  2024-03-28 11:16 ` David Marchand
@ 2024-04-03 14:03   ` Carlos de Souza Moraes Neto
  0 siblings, 0 replies; 4+ messages in thread
From: Carlos de Souza Moraes Neto @ 2024-04-03 14:03 UTC (permalink / raw)
  To: David Marchand, Vladimir Medvedkin; +Cc: dev, mingjinx.ye, stable

Hi David,

I verified using testpmd and my application and worked fine.
Thank you for your help,

Sincerely
Carlos Moraes.

-----Mensagem original-----
De: David Marchand <david.marchand@redhat.com> 
Enviada em: quinta-feira, 28 de março de 2024 08:16
Para: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Cc: dev@dpdk.org; Carlos de Souza Moraes Neto <carlosmn@weg.net>; mingjinx.ye@intel.com; stable@dpdk.org
Assunto: Re: [PATCH] net/ice: fix vlan stripping in double VLAN mode

ATENÇÃO:  Esta mensagem é de REMETENTE EXTERNO - Tenha cuidado ao abrir links e anexos.
*** NOVO *** NÃO digite sua SENHA WEG quando solicitada por E-MAIL EXTERNO


On Wed, Mar 27, 2024 at 7:44 PM Vladimir Medvedkin <vladimir.medvedkin@intel.com> wrote:
>
> The ICE hardware can operate in two modes - single vlan mode or double 
> vlan mode. Depending on the operating mode the hardware handles vlan 
> header with single vlan tag differently.
> When double vlan enabled, a packet with a single VLAN is treated as a 
> packet with outer VLAN only. Otherwise, a single VLAN in a packet is 
> treated as inner VLAN.
>
> This patch fixes the logic of how vlan stripping is programmed.
>
> Bugzilla ID: 1402

Nit: no need for an empty line here, the Bugzilla ID: tag goes with the Fixes: and Cc: block.

>
> Fixes: de5da9d16430 ("net/ice: support double VLAN")
> Cc: mingjinx.ye@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>

Thanks Vladimir.
It looks to fix the issue I observed.
I'll let Carlos confirm the fix is good for him too.


--
David Marchand


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

* Re: [PATCH] net/ice: fix vlan stripping in double VLAN mode
  2024-03-27 18:44 [PATCH] net/ice: fix vlan stripping in double VLAN mode Vladimir Medvedkin
  2024-03-28 11:16 ` David Marchand
@ 2024-04-04 10:43 ` Bruce Richardson
  1 sibling, 0 replies; 4+ messages in thread
From: Bruce Richardson @ 2024-04-04 10:43 UTC (permalink / raw)
  To: Vladimir Medvedkin; +Cc: dev, david.marchand, carlosmn, mingjinx.ye, stable

On Wed, Mar 27, 2024 at 06:44:13PM +0000, Vladimir Medvedkin wrote:
> The ICE hardware can operate in two modes - single vlan mode
> or double vlan mode. Depending on the operating mode the hardware
> handles vlan header with single vlan tag differently.
> When double vlan enabled, a packet with a single VLAN is treated
> as a packet with outer VLAN only. Otherwise, a single VLAN in a
> packet is treated as inner VLAN.
> 
> This patch fixes the logic of how vlan stripping is programmed.
> 
> Bugzilla ID: 1402
> 
> Fixes: de5da9d16430 ("net/ice: support double VLAN")
> Cc: mingjinx.ye@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Patch applied to dpdk-next-net-intel.
Thanks,
/Bruce

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

end of thread, other threads:[~2024-04-04 10:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-27 18:44 [PATCH] net/ice: fix vlan stripping in double VLAN mode Vladimir Medvedkin
2024-03-28 11:16 ` David Marchand
2024-04-03 14:03   ` RES: " Carlos de Souza Moraes Neto
2024-04-04 10:43 ` Bruce Richardson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.