[v6,1/4] common/sfc_efx/base: report VLAN stripping capability

Message ID 20230622113104.261556-2-artemii.morozov@arknetworks.am (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series net/sfc: support VLAN stripping offload |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Artemii Morozov June 22, 2023, 11:31 a.m. UTC
  These changes are necessary in order to add support for stripping
VLAN tags in the future.

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_nic.c  | 6 ++++++
 drivers/common/sfc_efx/base/efx.h       | 1 +
 drivers/common/sfc_efx/base/siena_nic.c | 1 +
 3 files changed, 8 insertions(+)
  

Comments

Andrew Rybchenko June 22, 2023, 11:46 a.m. UTC | #1
On 6/22/23 14:31, Artemii Morozov wrote:
> These changes are necessary in order to add support for stripping
> VLAN tags in the future.
> 
> Signed-off-by: Artemii Morozov <artemii.morozov@arknetworks.am>
> Reviewed-by: Ivan Malov <ivan.malov@arknetworks.am>
> Reviewed-by: Andy Moreton <amoreton@xilinx.com>

Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
  

Patch

diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c
index e1709d1200..070f4d08b5 100644
--- a/drivers/common/sfc_efx/base/ef10_nic.c
+++ b/drivers/common/sfc_efx/base/ef10_nic.c
@@ -1146,6 +1146,12 @@  ef10_get_datapath_caps(
 	else
 		encp->enc_hw_tx_insert_vlan_enabled = B_FALSE;
 
+	/* Check if firmware supports VLAN stripping. */
+	if (CAP_FLAGS1(req, RX_VLAN_STRIPPING))
+		encp->enc_rx_vlan_stripping_supported = B_TRUE;
+	else
+		encp->enc_rx_vlan_stripping_supported = B_FALSE;
+
 	/* Check if the firmware supports RX event batching */
 	if (CAP_FLAGS1(req, RX_BATCHING))
 		encp->enc_rx_batching_enabled = B_TRUE;
diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h
index 10c412bcd7..9a29583ecb 100644
--- a/drivers/common/sfc_efx/base/efx.h
+++ b/drivers/common/sfc_efx/base/efx.h
@@ -1616,6 +1616,7 @@  typedef struct efx_nic_cfg_s {
 	/* Number of TSO contexts on the NIC (FATSOv2) */
 	uint32_t		enc_fw_assisted_tso_v2_n_contexts;
 	boolean_t		enc_hw_tx_insert_vlan_enabled;
+	boolean_t		enc_rx_vlan_stripping_supported;
 	/* Number of PFs on the NIC */
 	uint32_t		enc_hw_pf_count;
 	/* Datapath firmware vadapter/vport/vswitch support */
diff --git a/drivers/common/sfc_efx/base/siena_nic.c b/drivers/common/sfc_efx/base/siena_nic.c
index 9f14faf271..4b7f7cbb87 100644
--- a/drivers/common/sfc_efx/base/siena_nic.c
+++ b/drivers/common/sfc_efx/base/siena_nic.c
@@ -179,6 +179,7 @@  siena_board_cfg(
 	    (encp->enc_rxq_limit * EFX_RXQ_DC_NDESCS(EFX_RXQ_DC_SIZE));
 
 	encp->enc_hw_tx_insert_vlan_enabled = B_FALSE;
+	encp->enc_rx_vlan_stripping_supported = B_FALSE;
 	encp->enc_fw_assisted_tso_enabled = B_FALSE;
 	encp->enc_fw_assisted_tso_v2_enabled = B_FALSE;
 	encp->enc_fw_assisted_tso_v2_n_contexts = 0;