[dpdk-dev] [PATCH 08/13] net/sfc: VLAN insertion is a datapath dependent feature

Andrew Rybchenko arybchenko at solarflare.com
Thu Mar 2 08:07:14 CET 2017


Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
---
 drivers/net/sfc/sfc_dp_tx.h  |  2 ++
 drivers/net/sfc/sfc_ethdev.c |  3 ++-
 drivers/net/sfc/sfc_tx.c     | 14 +++++++++++---
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/net/sfc/sfc_dp_tx.h b/drivers/net/sfc/sfc_dp_tx.h
index 4879db5..9f9948f 100644
--- a/drivers/net/sfc/sfc_dp_tx.h
+++ b/drivers/net/sfc/sfc_dp_tx.h
@@ -123,6 +123,8 @@ typedef void (sfc_dp_tx_qstop_t)(struct sfc_dp_txq *dp_txq,
 struct sfc_dp_tx {
 	struct sfc_dp			dp;
 
+	unsigned int			features;
+#define SFC_DP_TX_FEAT_VLAN_INSERT	0x1
 	sfc_dp_tx_qcreate_t		*qcreate;
 	sfc_dp_tx_qdestroy_t		*qdestroy;
 	sfc_dp_tx_qstart_t		*qstart;
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index c6db730..9cf8624 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -84,7 +84,8 @@
 		DEV_TX_OFFLOAD_TCP_CKSUM;
 
 	dev_info->default_txconf.txq_flags = ETH_TXQ_FLAGS_NOXSUMSCTP;
-	if (!encp->enc_hw_tx_insert_vlan_enabled)
+	if ((~sa->dp_tx->features & SFC_DP_TX_FEAT_VLAN_INSERT) ||
+	    !encp->enc_hw_tx_insert_vlan_enabled)
 		dev_info->default_txconf.txq_flags |= ETH_TXQ_FLAGS_NOVLANOFFL;
 	else
 		dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_VLAN_INSERT;
diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c
index 31bccac..e295454 100644
--- a/drivers/net/sfc/sfc_tx.c
+++ b/drivers/net/sfc/sfc_tx.c
@@ -82,9 +82,16 @@
 		rc = EINVAL;
 	}
 
-	if (!encp->enc_hw_tx_insert_vlan_enabled &&
-	    (flags & ETH_TXQ_FLAGS_NOVLANOFFL) == 0) {
-		sfc_err(sa, "VLAN offload is not supported");
+	if ((flags & ETH_TXQ_FLAGS_NOVLANOFFL) == 0) {
+		if (!encp->enc_hw_tx_insert_vlan_enabled) {
+			sfc_err(sa, "VLAN offload is not supported");
+			rc = EINVAL;
+		} else if (~sa->dp_tx->features & SFC_DP_TX_FEAT_VLAN_INSERT) {
+			sfc_err(sa,
+				"VLAN offload is not supported by %s datapath",
+				sa->dp_tx->dp.name);
+			rc = EINVAL;
+		}
 		rc = EINVAL;
 	}
 
@@ -903,6 +910,7 @@ struct sfc_dp_tx sfc_efx_tx = {
 		.type		= SFC_DP_TX,
 		.hw_fw_caps	= 0,
 	},
+	.features		= SFC_DP_TX_FEAT_VLAN_INSERT,
 	.qcreate		= sfc_efx_tx_qcreate,
 	.qdestroy		= sfc_efx_tx_qdestroy,
 	.qstart			= sfc_efx_tx_qstart,
-- 
1.8.2.3



More information about the dev mailing list