DPDK patches and discussions
 help / color / mirror / Atom feed
From: Artemii Morozov <artemii.morozov@arknetworks.am>
To: dev@dpdk.org
Cc: Ivan Malov <ivan.malov@arknetworks.am>,
	Viacheslav Galaktionov <viacheslav.galaktionov@arknetworks.am>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Andy Moreton <amoreton@xilinx.com>
Subject: [PATCH v7 3/4] common/sfc_efx/base: add support to enable VLAN stripping
Date: Thu, 22 Jun 2023 19:11:22 +0400	[thread overview]
Message-ID: <20230622151123.275873-4-artemii.morozov@arknetworks.am> (raw)
In-Reply-To: <20230622151123.275873-1-artemii.morozov@arknetworks.am>

To enable VLAN stripping, two conditions must be met:
the corresponding flag must be set and the appropriate
Rx prefix should be requested.
VLAN stripping is supported on EF100.

Signed-off-by: Artemii Morozov <artemii.morozov@arknetworks.am>
Reviewed-by: Ivan Malov <ivan.malov@arknetworks.am>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/common/sfc_efx/base/ef10_filter.c |  6 ++++
 drivers/common/sfc_efx/base/efx.h         | 12 +++++++
 drivers/common/sfc_efx/base/efx_impl.h    |  1 +
 drivers/common/sfc_efx/base/efx_port.c    | 39 +++++++++++++++++++++++
 drivers/common/sfc_efx/base/efx_rx.c      | 14 ++++++++
 drivers/common/sfc_efx/base/rhead_rx.c    |  3 ++
 drivers/common/sfc_efx/version.map        |  1 +
 7 files changed, 76 insertions(+)

diff --git a/drivers/common/sfc_efx/base/ef10_filter.c b/drivers/common/sfc_efx/base/ef10_filter.c
index 278502fb61..3e6dd2e35c 100644
--- a/drivers/common/sfc_efx/base/ef10_filter.c
+++ b/drivers/common/sfc_efx/base/ef10_filter.c
@@ -171,6 +171,7 @@ efx_mcdi_filter_op_add(
 	EFX_MCDI_DECLARE_BUF(payload, MC_CMD_FILTER_OP_V3_IN_LEN,
 		MC_CMD_FILTER_OP_EXT_OUT_LEN);
 	efx_filter_match_flags_t match_flags;
+	efx_port_t *epp = &(enp->en_port);
 	uint32_t port_id;
 	efx_rc_t rc;
 
@@ -338,6 +339,11 @@ efx_mcdi_filter_op_add(
 		    FILTER_OP_V3_IN_MATCH_SET_FLAG, 1);
 	}
 
+	if (epp->ep_vlan_strip) {
+		MCDI_IN_SET_DWORD_FIELD(req, FILTER_OP_V3_IN_MATCH_ACTION_FLAGS,
+		    FILTER_OP_V3_IN_MATCH_STRIP_VLAN, 1);
+	}
+
 	efx_mcdi_execute(enp, &req);
 
 	if (req.emr_rc != 0) {
diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h
index 7fcf48f5e1..77f855bfb0 100644
--- a/drivers/common/sfc_efx/base/efx.h
+++ b/drivers/common/sfc_efx/base/efx.h
@@ -1158,6 +1158,12 @@ efx_port_poll(
 	__in		efx_nic_t *enp,
 	__out_opt	efx_link_mode_t	*link_modep);
 
+LIBEFX_API
+extern	__checkReturn	efx_rc_t
+efx_port_vlan_strip_set(
+	__in		efx_nic_t *enp,
+	__in		boolean_t enabled);
+
 LIBEFX_API
 extern		void
 efx_port_fini(
@@ -3117,6 +3123,12 @@ typedef enum efx_rxq_type_e {
  * Request user flag field in the Rx prefix of a queue.
  */
 #define	EFX_RXQ_FLAG_USER_FLAG		0x20
+/*
+ * Request VLAN TCI field in the Rx prefix. The flag just
+ * controls delivery of the stripped VLAN TCI if VLAN stripping
+ * is enabled and done.
+ */
+#define	EFX_RXQ_FLAG_VLAN_STRIPPED_TCI		0x40
 
 LIBEFX_API
 extern	__checkReturn	efx_rc_t
diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h
index 91ba187c73..78cc056576 100644
--- a/drivers/common/sfc_efx/base/efx_impl.h
+++ b/drivers/common/sfc_efx/base/efx_impl.h
@@ -371,6 +371,7 @@ typedef struct efx_port_s {
 	uint32_t		ep_phy_cap_mask;
 	boolean_t		ep_mac_drain;
 	boolean_t		ep_include_fcs;
+	boolean_t		ep_vlan_strip;
 #if EFSYS_OPT_BIST
 	efx_bist_type_t		ep_current_bist;
 #endif
diff --git a/drivers/common/sfc_efx/base/efx_port.c b/drivers/common/sfc_efx/base/efx_port.c
index a5f982e335..e5a9fa6c53 100644
--- a/drivers/common/sfc_efx/base/efx_port.c
+++ b/drivers/common/sfc_efx/base/efx_port.c
@@ -204,6 +204,45 @@ efx_loopback_type_name(
 
 #endif	/* EFSYS_OPT_LOOPBACK */
 
+	__checkReturn	efx_rc_t
+efx_port_vlan_strip_set(
+	__in		efx_nic_t *enp,
+	__in		boolean_t enabled)
+{
+	efx_port_t *epp = &(enp->en_port);
+	efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
+	uint32_t filters_count = 0;
+	efx_rc_t rc;
+
+	EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+
+	if (enabled && !encp->enc_rx_vlan_stripping_supported) {
+		rc = ENOTSUP;
+		goto fail1;
+	}
+
+	if ((rc = efx_filter_get_count(enp, &filters_count)) != 0)
+		goto fail2;
+
+	if (filters_count != 0) {
+		rc = EINVAL;
+		goto fail3;
+	}
+
+	epp->ep_vlan_strip = enabled;
+
+	return (0);
+
+fail3:
+	EFSYS_PROBE(fail3);
+fail2:
+	EFSYS_PROBE(fail2);
+fail1:
+	EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+	return (rc);
+}
+
 			void
 efx_port_fini(
 	__in		efx_nic_t *enp)
diff --git a/drivers/common/sfc_efx/base/efx_rx.c b/drivers/common/sfc_efx/base/efx_rx.c
index 68f42f5cac..b3d9e14c67 100644
--- a/drivers/common/sfc_efx/base/efx_rx.c
+++ b/drivers/common/sfc_efx/base/efx_rx.c
@@ -941,11 +941,25 @@ efx_rx_qcreate_internal(
 			goto fail5;
 	}
 
+	if (flags & EFX_RXQ_FLAG_VLAN_STRIPPED_TCI) {
+		const efx_rx_prefix_layout_t *erplp = &erp->er_prefix_layout;
+		const efx_rx_prefix_field_info_t *vlan_tci_field;
+
+		vlan_tci_field =
+		    &erplp->erpl_fields[EFX_RX_PREFIX_FIELD_VLAN_STRIP_TCI];
+		if (vlan_tci_field->erpfi_width_bits == 0) {
+			rc = ENOTSUP;
+			goto fail6;
+		}
+	}
+
 	enp->en_rx_qcount++;
 	*erpp = erp;
 
 	return (0);
 
+fail6:
+	EFSYS_PROBE(fail6);
 fail5:
 	EFSYS_PROBE(fail5);
 
diff --git a/drivers/common/sfc_efx/base/rhead_rx.c b/drivers/common/sfc_efx/base/rhead_rx.c
index d0ac5c02f8..a86551f646 100644
--- a/drivers/common/sfc_efx/base/rhead_rx.c
+++ b/drivers/common/sfc_efx/base/rhead_rx.c
@@ -640,6 +640,9 @@ rhead_rx_qcreate(
 	if (flags & EFX_RXQ_FLAG_USER_FLAG)
 		fields_mask |= 1U << EFX_RX_PREFIX_FIELD_USER_FLAG;
 
+	if (flags & EFX_RXQ_FLAG_VLAN_STRIPPED_TCI)
+		fields_mask |= 1U << EFX_RX_PREFIX_FIELD_VLAN_STRIP_TCI;
+
 	/*
 	 * LENGTH is required in EF100 host interface, as receive events
 	 * do not include the packet length.
diff --git a/drivers/common/sfc_efx/version.map b/drivers/common/sfc_efx/version.map
index 01113bffa7..40c97ad2b4 100644
--- a/drivers/common/sfc_efx/version.map
+++ b/drivers/common/sfc_efx/version.map
@@ -211,6 +211,7 @@ INTERNAL {
 	efx_port_init;
 	efx_port_loopback_set;
 	efx_port_poll;
+	efx_port_vlan_strip_set;
 
 	efx_pseudo_hdr_hash_get;
 	efx_pseudo_hdr_pkt_length_get;
-- 
2.34.1


  parent reply	other threads:[~2023-06-22 15:12 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31 13:41 [PATCH 0/3] net/sfc: support VLAN stripping offload Artemii Morozov
2023-05-31 13:41 ` [PATCH 1/3] common/sfc_efx/base: report VLAN stripping capability Artemii Morozov
2023-06-01  8:12   ` [PATCH v2 0/3] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-01  8:12     ` [PATCH v2 1/3] common/sfc_efx/base: report VLAN stripping capability Artemii Morozov
2023-06-01 14:35       ` [PATCH v3 0/3] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-01 14:35         ` [PATCH v3 1/3] common/sfc_efx/base: report VLAN stripping capability Artemii Morozov
2023-06-01 14:35         ` [PATCH v3 2/3] common/sfc_efx/base: add support to enable VLAN stripping Artemii Morozov
2023-06-01 14:35         ` [PATCH v3 3/3] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-01  8:12     ` [PATCH v2 2/3] common/sfc_efx/base: add support to enable VLAN stripping Artemii Morozov
2023-06-01  8:12     ` [PATCH v2 3/3] net/sfc: support VLAN stripping offload Artemii Morozov
2023-05-31 13:41 ` [PATCH 2/3] common/sfc_efx/base: add support to enable VLAN stripping Artemii Morozov
2023-05-31 13:41 ` [PATCH 3/3] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-01 15:30 ` [PATCH v4 0/3] " Artemii Morozov
2023-06-01 15:30   ` [PATCH v4 1/3] common/sfc_efx/base: report VLAN stripping capability Artemii Morozov
2023-06-02  7:22     ` Andrew Rybchenko
2023-06-01 15:30   ` [PATCH v4 2/3] common/sfc_efx/base: add support to enable VLAN stripping Artemii Morozov
2023-06-02  8:32     ` Andrew Rybchenko
2023-06-08 11:16       ` Artemii Morozov
2023-06-08 12:37         ` Andrew Rybchenko
2023-06-01 15:30   ` [PATCH v4 3/3] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-02  8:46     ` Andrew Rybchenko
2023-06-13 15:12 ` [PATCH v5 0/3] " Artemii Morozov
2023-06-13 15:12   ` [PATCH v5 1/3] common/sfc_efx/base: report VLAN stripping capability Artemii Morozov
2023-06-19  9:43     ` Andrew Rybchenko
2023-06-13 15:12   ` [PATCH v5 2/3] common/sfc_efx/base: add support to enable VLAN stripping Artemii Morozov
2023-06-19 10:28     ` Andrew Rybchenko
2023-06-20  9:55       ` Artemii Morozov
2023-06-20 11:50         ` Andrew Rybchenko
2023-06-20 13:10           ` Artemii Morozov
2023-06-20 13:53             ` Andrew Rybchenko
2023-06-13 15:12   ` [PATCH v5 3/3] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-19 10:36     ` Andrew Rybchenko
2023-06-22 11:31 ` [PATCH v6 0/4] " Artemii Morozov
2023-06-22 11:31   ` [PATCH v6 1/4] common/sfc_efx/base: report VLAN stripping capability Artemii Morozov
2023-06-22 11:46     ` Andrew Rybchenko
2023-06-22 11:31   ` [PATCH v6 2/4] common/sfc_efx/base: add API to get installed filters count Artemii Morozov
2023-06-22 11:51     ` Andrew Rybchenko
2023-06-22 11:31   ` [PATCH v6 3/4] common/sfc_efx/base: add support to enable VLAN stripping Artemii Morozov
2023-06-22 11:54     ` Andrew Rybchenko
2023-06-22 11:31   ` [PATCH v6 4/4] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-22 12:07     ` Andrew Rybchenko
2023-06-22 15:11 ` [PATCH v7 0/4] " Artemii Morozov
2023-06-22 15:11   ` [PATCH v7 1/4] common/sfc_efx/base: report VLAN stripping capability Artemii Morozov
2023-06-22 15:11   ` [PATCH v7 2/4] common/sfc_efx/base: add API to get installed filters count Artemii Morozov
2023-06-22 15:42     ` Andrew Rybchenko
2023-06-22 15:11   ` Artemii Morozov [this message]
2023-06-22 15:40     ` [PATCH v7 3/4] common/sfc_efx/base: add support to enable VLAN stripping Andrew Rybchenko
2023-06-22 15:11   ` [PATCH v7 4/4] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-22 15:41     ` Andrew Rybchenko
2023-06-22 16:05     ` Ferruh Yigit
2023-06-23  5:47 ` [PATCH v8 0/4] " Artemii Morozov
2023-06-23  5:47   ` [PATCH v8 1/4] common/sfc_efx/base: report VLAN stripping capability Artemii Morozov
2023-06-23  5:47   ` [PATCH v8 2/4] common/sfc_efx/base: add API to get installed filters count Artemii Morozov
2023-06-23  7:24     ` Ivan Malov
2023-06-23  5:47   ` [PATCH v8 3/4] common/sfc_efx/base: add support to enable VLAN stripping Artemii Morozov
2023-06-23  5:47   ` [PATCH v8 4/4] net/sfc: support VLAN stripping offload Artemii Morozov
2023-06-23 12:35   ` [PATCH v8 0/4] " Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230622151123.275873-4-artemii.morozov@arknetworks.am \
    --to=artemii.morozov@arknetworks.am \
    --cc=amoreton@xilinx.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ivan.malov@arknetworks.am \
    --cc=viacheslav.galaktionov@arknetworks.am \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).