Skip to contentSkip to conversation

net/intel: tx path selection simplification

PATCH Superseded Ciara Loftus 2 participants 51 messages Dec 9, 2025 – Dec 12, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

cover net/intel: tx path selection simplification

This series aims to simplify the process of selecting a Tx burst function for the Intel drivers i40e, iavf, ice, idpf and cpfl by:
1. enforcing the same tx burst function for both primary and secondary processes.
2. using a common function for selecting the tx burst function based on maximum SIMD width, function features (context descriptor, single queue, etc.) and requested tx offloads.

Some fixes are made to errors in the documentation that became evident while implementing the new selection infratructure in each driver.

Ciara Loftus (13):
net/intel: introduce infrastructure for Tx path selection net/ice: use same Tx path across processes net/ice: use common Tx path selection infrastructure net/iavf: use same Tx path across processes net/iavf: use common Tx path selection infrastructure net/i40e: use same Tx path across processes net/i40e: use common Tx path selection infrastructure net/idpf: use common Tx path selection infrastructure net/cpfl: use common Tx path selection infrastructure
docs: fix TSO and checksum offload feature status in ice doc
docs: fix TSO feature status in iavf driver documentation
docs: fix inline crypto feature status in iavf driver doc
docs: fix TSO feature status in i40e driver documentation

 doc/guides/nics/features/i40e.ini             |   2 +-
 doc/guides/nics/features/iavf.ini             |   4 +-
 doc/guides/nics/features/ice.ini              |   6 +-
 drivers/net/intel/common/tx.h                 | 100 ++++++++
 drivers/net/intel/cpfl/cpfl_rxtx.c            | 114 +++------
 drivers/net/intel/cpfl/cpfl_rxtx_vec_common.h |  10 -
 drivers/net/intel/i40e/i40e_ethdev.h          |  13 +-
 drivers/net/intel/i40e/i40e_rxtx.c            | 186 ++++++++------
 drivers/net/intel/i40e/i40e_rxtx.h            |  20 +-
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |   6 -
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |   6 -
 drivers/net/intel/i40e/i40e_rxtx_vec_sse.c    |   6 -
 drivers/net/intel/iavf/iavf.h                 |   2 -
 drivers/net/intel/iavf/iavf_ethdev.c          |   9 +-
 drivers/net/intel/iavf/iavf_rxtx.c            | 241 +++++++++---------
 drivers/net/intel/iavf/iavf_rxtx.h            |  46 ++--
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h |  39 +--
 drivers/net/intel/ice/ice_ethdev.c            |   1 +
 drivers/net/intel/ice/ice_ethdev.h            |  12 +-
 drivers/net/intel/ice/ice_rxtx.c              | 201 +++++++--------
 drivers/net/intel/ice/ice_rxtx.h              |  30 ++-
 drivers/net/intel/ice/ice_rxtx_vec_common.h   |  35 +--
 drivers/net/intel/ice/ice_rxtx_vec_sse.c      |   6 -
 drivers/net/intel/idpf/idpf_common_device.h   |  10 +
 drivers/net/intel/idpf/idpf_common_rxtx.c     |  49 ++++
 drivers/net/intel/idpf/idpf_common_rxtx.h     |  12 +
 drivers/net/intel/idpf/idpf_rxtx.c            | 112 +++-----
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |  10 -
 28 files changed, 664 insertions(+), 624 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/13 net/intel: introduce infrastructure for Tx path selection

The code for determining which Tx path to select during initialisation has become complicated in many intel drivers due to the amount of different paths and features available within each path. This commit aims to simplify and genericize the path selection logic.

The following information about each Tx burst function is stored and used by the new common function to select the appropriate Tx path:
- Tx Offloads
- SIMD bitwidth

The implementation is based off the Rx path selection infrastructure introduced in a previous commit.

---
 drivers/net/intel/common/tx.h | 71 +++++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)
drivers/net/intel/common/tx.h +71 -0
index 5af64a4cfe..c6c1904ba3 100644
@@ -8,6 +8,7 @@
 #include <stdint.h>
 #include <rte_mbuf.h>
 #include <rte_ethdev.h>
+#include <rte_vect.h>
 
 /* forward declaration of the common intel (ci) queue structure */
 struct ci_tx_queue;
@@ -117,6 +118,17 @@ struct ci_tx_queue {
 	};
 };
 
+struct ci_tx_path_features {
+	uint32_t tx_offloads;
+	enum rte_vect_max_simd simd_width;
+};
+
+struct ci_tx_path_info {
+	eth_tx_burst_t pkt_burst;
+	const char *info;
+	struct ci_tx_path_features features;
+};
+
 static __rte_always_inline void
 ci_tx_backlog_entry(struct ci_tx_entry *txep, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
@@ -262,4 +274,63 @@ ci_txq_release_all_mbufs(struct ci_tx_queue *txq, bool use_ctx)
 	memset(txq->sw_ring_vec, 0, sizeof(txq->sw_ring_vec[0]) * nb_desc);
 }
 
+/**
+ * Select the best matching Tx path based on features
+ *
+ * @param req_features
+ *   The requested features for the Tx path
+ * @param infos
+ *   Array of information about the available Tx paths
+ * @param num_paths
+ *   Number of available paths in the infos array
+ * @param default_path
+ *   Index of the default path to use if no suitable path is found
+ *
+ * @return
+ *   The packet burst function index that best matches the requested features,
+ *   or default_path if no suitable path is found
+ */
+static inline int
+ci_tx_path_select(struct ci_tx_path_features req_features,
+			const struct ci_tx_path_info *infos,
+			int num_paths,
+			int default_path)
+{
+	int i, idx = default_path;
+	const struct ci_tx_path_features *chosen_path_features = NULL;
+
+	for (i = 0; i < num_paths; i++) {
+		const struct ci_tx_path_features *path_features = &infos[i].features;
+
+		/* Ensure the path supports the requested TX offloads. */
+		if ((path_features->tx_offloads & req_features.tx_offloads) !=
+				req_features.tx_offloads)
+			continue;
+
+		/* Ensure the path's SIMD width is compatible with the requested width. */
+		if (path_features->simd_width > req_features.simd_width)
+			continue;
+
+		/* Do not select the path if it is less suitable than the chosen path. */
+		if (chosen_path_features != NULL) {
+			/* Do not select paths with lower SIMD width than the chosen path. */
+			if (path_features->simd_width < chosen_path_features->simd_width)
+				continue;
+			/* Do not select paths with more offloads enabled than the chosen path if
+			 * the SIMD widths are the same.
+			 */
+			if (path_features->simd_width == chosen_path_features->simd_width &&
+					rte_popcount32(path_features->tx_offloads) >
+					rte_popcount32(chosen_path_features->tx_offloads))
+				continue;
+		}
+
+		/* Finally, select the path since it has met all the requirements. */
+		idx = i;
+		chosen_path_features = &infos[idx].features;
+	}
+
+	return idx;
+}
+
 #endif /* _COMMON_INTEL_TX_H_ */
Signature · 1 line
2.43.0
Acked-by on v1 1/13
#2 lore raw

Re: [PATCH 01/13] net/intel: introduce infrastructure for Tx path selection

Quoted 10 lines · Ciara Loftus

The code for determining which Tx path to select during initialisation has become complicated in many intel drivers due to the amount of different paths and features available within each path. This commit aims to simplify and genericize the path selection logic.

The following information about each Tx burst function is stored and used by the new common function to select the appropriate Tx path:
- Tx Offloads
- SIMD bitwidth

Quoted 4 lines

The implementation is based off the Rx path selection infrastructure introduced in a previous commit.

Generally looks good, a few minor suggestions inline below.

Quoted 46 lines
---
 drivers/net/intel/common/tx.h | 71 +++++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)
drivers/net/intel/common/tx.h +20 -0
index 5af64a4cfe..c6c1904ba3 100644
@@ -8,6 +8,7 @@
 #include <stdint.h>
 #include <rte_mbuf.h>
 #include <rte_ethdev.h>
+#include <rte_vect.h>
 
 /* forward declaration of the common intel (ci) queue structure */
 struct ci_tx_queue;
@@ -117,6 +118,17 @@ struct ci_tx_queue {
 	};
 };
 
+struct ci_tx_path_features {
+	uint32_t tx_offloads;
+	enum rte_vect_max_simd simd_width;
+};
+
+struct ci_tx_path_info {
+	eth_tx_burst_t pkt_burst;
+	const char *info;
+	struct ci_tx_path_features features;
+};
+
 static __rte_always_inline void
 ci_tx_backlog_entry(struct ci_tx_entry *txep, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
@@ -262,4 +274,63 @@ ci_txq_release_all_mbufs(struct ci_tx_queue *txq, bool use_ctx)
 	memset(txq->sw_ring_vec, 0, sizeof(txq->sw_ring_vec[0]) * nb_desc);
 }
 
+/**
+ * Select the best matching Tx path based on features
+ *
+ * @param req_features
+ *   The requested features for the Tx path
+ * @param infos
+ *   Array of information about the available Tx paths
+ * @param num_paths

drivers/net/intel/common/tx.h ci_txq_release_all_mbufs(struct ci_tx_queue *txq, bool use_ctx) · line 294

Quoted 10 lines
drivers/net/intel/common/tx.h +10 -0
+ *   Number of available paths in the infos array
+ * @param default_path
+ *   Index of the default path to use if no suitable path is found
+ *
+ * @return
+ *   The packet burst function index that best matches the requested features,
+ *   or default_path if no suitable path is found
+ */
+static inline int
+ci_tx_path_select(struct ci_tx_path_features req_features,

Is there a reason we are passing this by value, rather than as a const pointer?

drivers/net/intel/common/tx.h ci_txq_release_all_mbufs(struct ci_tx_queue *txq, bool use_ctx) · line 296

Quoted 2 lines
drivers/net/intel/common/tx.h +2 -0
+			const struct ci_tx_path_info *infos,
+			int num_paths,

Minor nit: general the size of arrays should be of type "size_t", which matches the value got from sizeof, and hence RTE_DIM. Since we don't need to support negative sized arrays, an unsigned type is better generally.

drivers/net/intel/common/tx.h ci_txq_release_all_mbufs(struct ci_tx_queue *txq, bool use_ctx) · line 302

Quoted 6 lines
drivers/net/intel/common/tx.h +6 -0
+			int default_path)
+{
+	int i, idx = default_path;
+	const struct ci_tx_path_features *chosen_path_features = NULL;
+
+	for (i = 0; i < num_paths; i++) {

If num_paths is size_t, "i" should be an unsigned value to match. I'd also to prefer that "i" also be defined inside the "for" statement, since its unneeded outside of it.

Quoted 37 lines
drivers/net/intel/common/tx.h +33 -0
+		const struct ci_tx_path_features *path_features = &infos[i].features;
+
+		/* Ensure the path supports the requested TX offloads. */
+		if ((path_features->tx_offloads & req_features.tx_offloads) !=
+				req_features.tx_offloads)
+			continue;
+
+		/* Ensure the path's SIMD width is compatible with the requested width. */
+		if (path_features->simd_width > req_features.simd_width)
+			continue;
+
+		/* Do not select the path if it is less suitable than the chosen path. */
+		if (chosen_path_features != NULL) {
+			/* Do not select paths with lower SIMD width than the chosen path. */
+			if (path_features->simd_width < chosen_path_features->simd_width)
+				continue;
+			/* Do not select paths with more offloads enabled than the chosen path if
+			 * the SIMD widths are the same.
+			 */
+			if (path_features->simd_width == chosen_path_features->simd_width &&
+					rte_popcount32(path_features->tx_offloads) >
+					rte_popcount32(chosen_path_features->tx_offloads))
+				continue;
+		}
+
+		/* Finally, select the path since it has met all the requirements. */
+		idx = i;
+		chosen_path_features = &infos[idx].features;
+	}
+
+	return idx;
+}
+
 #endif /* _COMMON_INTEL_TX_H_ */
Signature · 1 line
2.43.0
#3 lore raw

PATCH 2/13 net/ice: use same Tx path across processes

In reply to Ciara Loftus

In the interest of simplicity, let the primary process select the Tx path to be used by all processes using the given device.

The many logs which report individual Tx path selections have been consolidated into one single log.

---
 drivers/net/intel/ice/ice_ethdev.c |   1 +
 drivers/net/intel/ice/ice_ethdev.h |  12 ++-
 drivers/net/intel/ice/ice_rxtx.c   | 139 ++++++++++++++++-------------
 3 files changed, 87 insertions(+), 65 deletions(-)
drivers/net/intel/ice/ice_ethdev.c +1 -0
index c721d135f5..a805e78d03 100644
@@ -3900,6 +3900,7 @@ ice_dev_configure(struct rte_eth_dev *dev)
 	ad->tx_simple_allowed = true;
 
 	ad->rx_func_type = ICE_RX_DEFAULT;
+	ad->tx_func_type = ICE_TX_DEFAULT;
 
 	if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
 		dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
drivers/net/intel/ice/ice_ethdev.h +11 -1
index 72ed65f13b..0b8af339d1 100644
@@ -208,6 +208,16 @@ enum ice_rx_func_type {
 	ICE_RX_AVX512_SCATTERED_OFFLOAD,
 };
 
+enum ice_tx_func_type {
+	ICE_TX_DEFAULT,
+	ICE_TX_SIMPLE,
+	ICE_TX_SSE,
+	ICE_TX_AVX2,
+	ICE_TX_AVX2_OFFLOAD,
+	ICE_TX_AVX512,
+	ICE_TX_AVX512_OFFLOAD,
+};
+
 struct ice_adapter;
 
 /**
@@ -658,6 +668,7 @@ struct ice_adapter {
 	bool tx_vec_allowed;
 	bool tx_simple_allowed;
 	enum ice_rx_func_type rx_func_type;
+	enum ice_tx_func_type tx_func_type;
 	/* ptype mapping table */
 	alignas(RTE_CACHE_LINE_MIN_SIZE) uint32_t ptype_tbl[ICE_MAX_PKT_TYPE];
 	bool is_safe_mode;
@@ -679,7 +690,6 @@ struct ice_adapter {
 	/* Set bit if the engine is disabled */
 	unsigned long disabled_engine_mask;
 	struct ice_parser *psr;
-	enum rte_vect_max_simd tx_simd_width;
 	bool rx_vec_offload_support;
 };
 
drivers/net/intel/ice/ice_rxtx.c +75 -64

179 lines not on this page · raw message

Signature · 1 line
2.43.0
#4 lore raw

Re: [PATCH 02/13] net/ice: use same Tx path across processes

Quoted 47 lines · Ciara Loftus

In the interest of simplicity, let the primary process select the Tx path to be used by all processes using the given device.

The many logs which report individual Tx path selections have been consolidated into one single log.

---
 drivers/net/intel/ice/ice_ethdev.c |   1 +
 drivers/net/intel/ice/ice_ethdev.h |  12 ++-
 drivers/net/intel/ice/ice_rxtx.c   | 139 ++++++++++++++++-------------
 3 files changed, 87 insertions(+), 65 deletions(-)
drivers/net/intel/ice/ice_ethdev.c +1 -0
index c721d135f5..a805e78d03 100644
@@ -3900,6 +3900,7 @@ ice_dev_configure(struct rte_eth_dev *dev)
 	ad->tx_simple_allowed = true;
 
 	ad->rx_func_type = ICE_RX_DEFAULT;
+	ad->tx_func_type = ICE_TX_DEFAULT;
 
 	if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
 		dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
drivers/net/intel/ice/ice_ethdev.h +10 -0
index 72ed65f13b..0b8af339d1 100644
@@ -208,6 +208,16 @@ enum ice_rx_func_type {
 	ICE_RX_AVX512_SCATTERED_OFFLOAD,
 };
 
+enum ice_tx_func_type {
+	ICE_TX_DEFAULT,
+	ICE_TX_SIMPLE,
+	ICE_TX_SSE,
+	ICE_TX_AVX2,
+	ICE_TX_AVX2_OFFLOAD,
+	ICE_TX_AVX512,
+	ICE_TX_AVX512_OFFLOAD,
+};
+
 struct ice_adapter;
 
 /**

drivers/net/intel/ice/ice_ethdev.h struct ice_adapter { · line 668

Quoted 1 line
drivers/net/intel/ice/ice_ethdev.h +0 -0
@@ -658,6 +668,7 @@ struct ice_adapter {
 	bool tx_vec_allowed;

Can tx_vec_allowed by dropped at this point?

Quoted 181 lines
drivers/net/intel/ice/ice_ethdev.h +1 -1
 	bool tx_simple_allowed;
 	enum ice_rx_func_type rx_func_type;
+	enum ice_tx_func_type tx_func_type;
 	/* ptype mapping table */
 	alignas(RTE_CACHE_LINE_MIN_SIZE) uint32_t ptype_tbl[ICE_MAX_PKT_TYPE];
 	bool is_safe_mode;
@@ -679,7 +690,6 @@ struct ice_adapter {
 	/* Set bit if the engine is disabled */
 	unsigned long disabled_engine_mask;
 	struct ice_parser *psr;
-	enum rte_vect_max_simd tx_simd_width;
 	bool rx_vec_offload_support;
 };
 
drivers/net/intel/ice/ice_rxtx.c +69 -54
index 74db0fbec9..f05ca83e5b 100644
@@ -4091,6 +4091,44 @@ ice_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	return i;
 }
 
+static const struct {
+	eth_tx_burst_t pkt_burst;
+	const char *info;
+} ice_tx_burst_infos[] = {
+	[ICE_TX_DEFAULT] = {
+		.pkt_burst = ice_xmit_pkts,
+		.info = "Scalar"
+	},
+	[ICE_TX_SIMPLE] = {
+		.pkt_burst = ice_xmit_pkts_simple,
+		.info = "Scalar Simple"
+	},
+#ifdef RTE_ARCH_X86
+	[ICE_TX_SSE] = {
+		.pkt_burst = ice_xmit_pkts_vec,
+		.info = "Vector SSE"
+	},
+	[ICE_TX_AVX2] = {
+		.pkt_burst = ice_xmit_pkts_vec_avx2,
+		.info = "Vector AVX2"
+	},
+	[ICE_TX_AVX2_OFFLOAD] = {
+		.pkt_burst = ice_xmit_pkts_vec_avx2_offload,
+		.info = "Offload Vector AVX2"
+	},
+#ifdef CC_AVX512_SUPPORT
+	[ICE_TX_AVX512] = {
+		.pkt_burst = ice_xmit_pkts_vec_avx512,
+		.info = "Vector AVX512"
+	},
+	[ICE_TX_AVX512_OFFLOAD] = {
+		.pkt_burst = ice_xmit_pkts_vec_avx512_offload,
+		.info = "Offload Vector AVX512"
+	},
+#endif
+#endif
+};
+
 void __rte_cold
 ice_set_tx_function(struct rte_eth_dev *dev)
 {
@@ -4101,74 +4139,58 @@ ice_set_tx_function(struct rte_eth_dev *dev)
 	struct ci_tx_queue *txq;
 	int i;
 	int tx_check_ret = -1;
+	enum rte_vect_max_simd tx_simd_width = RTE_VECT_SIMD_DISABLED;
 
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
-		ad->tx_simd_width = RTE_VECT_SIMD_DISABLED;
-		tx_check_ret = ice_tx_vec_dev_check(dev);
-		ad->tx_simd_width = ice_get_max_simd_bitwidth();
-		if (tx_check_ret >= 0 &&
-		    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
-			ad->tx_vec_allowed = true;
-
-			if (ad->tx_simd_width < RTE_VECT_SIMD_256 &&
-				tx_check_ret == ICE_VECTOR_OFFLOAD_PATH)
-				ad->tx_vec_allowed = false;
-
-			if (ad->tx_vec_allowed) {
-				for (i = 0; i < dev->data->nb_tx_queues; i++) {
-					txq = dev->data->tx_queues[i];
-					if (txq && ice_txq_vec_setup(txq)) {
-						ad->tx_vec_allowed = false;
-						break;
-					}
+	/* The primary process selects the tx path for all processes. */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		goto out;
+
+	tx_check_ret = ice_tx_vec_dev_check(dev);
+	tx_simd_width = ice_get_max_simd_bitwidth();
+	if (tx_check_ret >= 0 &&
+		rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
+		ad->tx_vec_allowed = true;
+
+		if (tx_simd_width < RTE_VECT_SIMD_256 &&
+			tx_check_ret == ICE_VECTOR_OFFLOAD_PATH)
+			ad->tx_vec_allowed = false;
+
+		if (ad->tx_vec_allowed) {
+			for (i = 0; i < dev->data->nb_tx_queues; i++) {
+				txq = dev->data->tx_queues[i];
+				if (txq && ice_txq_vec_setup(txq)) {
+					ad->tx_vec_allowed = false;
+					break;
 				}
 			}
-		} else {
-			ad->tx_vec_allowed = false;
 		}
+	} else {
+		ad->tx_vec_allowed = false;
 	}
 
 	if (ad->tx_vec_allowed) {
 		dev->tx_pkt_prepare = rte_eth_tx_pkt_prepare_dummy;
-		if (ad->tx_simd_width == RTE_VECT_SIMD_512) {
+		if (tx_simd_width == RTE_VECT_SIMD_512) {
 #ifdef CC_AVX512_SUPPORT
 			if (tx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
-				PMD_DRV_LOG(NOTICE,
-					    "Using AVX512 OFFLOAD Vector Tx (port %d).",
-					    dev->data->port_id);
-				dev->tx_pkt_burst =
-					ice_xmit_pkts_vec_avx512_offload;
+				ad->tx_func_type = ICE_TX_AVX512_OFFLOAD;
 				dev->tx_pkt_prepare = ice_prep_pkts;
 			} else {
-				PMD_DRV_LOG(NOTICE,
-					    "Using AVX512 Vector Tx (port %d).",
-					    dev->data->port_id);
-				dev->tx_pkt_burst = ice_xmit_pkts_vec_avx512;
+				ad->tx_func_type = ICE_TX_AVX512;
 			}
 #endif
 		} else {
 			if (tx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
-				PMD_DRV_LOG(NOTICE,
-					    "Using AVX2 OFFLOAD Vector Tx (port %d).",
-					    dev->data->port_id);
-				dev->tx_pkt_burst =
-					ice_xmit_pkts_vec_avx2_offload;
+				ad->tx_func_type = ICE_TX_AVX2_OFFLOAD;
 				dev->tx_pkt_prepare = ice_prep_pkts;
 			} else {
-				PMD_DRV_LOG(DEBUG, "Using %sVector Tx (port %d).",
-					    ad->tx_simd_width == RTE_VECT_SIMD_256 ? "avx2 " : "",
-					    dev->data->port_id);
-				dev->tx_pkt_burst = ad->tx_simd_width == RTE_VECT_SIMD_256 ?
-						    ice_xmit_pkts_vec_avx2 :
-						    ice_xmit_pkts_vec;
+				ad->tx_func_type = tx_simd_width == RTE_VECT_SIMD_256 ?
+						    ICE_TX_AVX2 :
+						    ICE_TX_SSE;
 			}
 		}
 
-		if (mbuf_check) {
-			ad->tx_pkt_burst = dev->tx_pkt_burst;
-			dev->tx_pkt_burst = ice_xmit_pkts_check;
-		}
-		return;
+		goto out;
 	}
 #endif
 
@@ -4186,24 +4208,13 @@ ice_set_tx_function(struct rte_eth_dev *dev)
 		ad->tx_pkt_burst = dev->tx_pkt_burst;
 		dev->tx_pkt_burst = ice_xmit_pkts_check;
 	}
-}
 
-static const struct {
-	eth_tx_burst_t pkt_burst;
-	const char *info;
-} ice_tx_burst_infos[] = {
-	{ ice_xmit_pkts_simple,   "Scalar Simple" },
-	{ ice_xmit_pkts,          "Scalar" },

drivers/net/intel/ice/ice_rxtx.c ice_set_tx_function(struct rte_eth_dev *dev) · line 4206

Quoted 10 lines
drivers/net/intel/ice/ice_rxtx.c +0 -10
-#ifdef RTE_ARCH_X86
-#ifdef CC_AVX512_SUPPORT
-	{ ice_xmit_pkts_vec_avx512, "Vector AVX512" },
-	{ ice_xmit_pkts_vec_avx512_offload, "Offload Vector AVX512" },
-#endif
-	{ ice_xmit_pkts_vec_avx2,         "Vector AVX2" },
-	{ ice_xmit_pkts_vec_avx2_offload, "Offload Vector AVX2" },
-	{ ice_xmit_pkts_vec,              "Vector SSE" },
-#endif
-};

Looking at the code with this patch applied, I think there may be an issue with the scalar case in this version. At line 4197 we have a block which assigns a value to tx_pkt_burst and tx_burst_prepare, but does not assign a value to the tx_func_type values. That means when it falls through into the "out" section, the function point for pkt_burst get overwritten.

Quoted 12 lines
drivers/net/intel/ice/ice_rxtx.c +6 -0
+out:
+	dev->tx_pkt_burst = mbuf_check ? ice_xmit_pkts_check :
+					 ice_tx_burst_infos[ad->tx_func_type].pkt_burst;
+	PMD_DRV_LOG(NOTICE, "Using %s (port %d).",
+		ice_tx_burst_infos[ad->tx_func_type].info, dev->data->port_id);
+}
 
 int
 ice_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
Signature · 1 line
2.43.0
#5 lore raw

RE: [PATCH 02/13] net/ice: use same Tx path across processes

Quoted 51 lines · Ciara Loftus
Quoted 6 lines

In the interest of simplicity, let the primary process select the Tx path to be used by all processes using the given device.

The many logs which report individual Tx path selections have been consolidated into one single log.

Review

Quoted 8 lines
---
 drivers/net/intel/ice/ice_ethdev.c |   1 +
 drivers/net/intel/ice/ice_ethdev.h |  12 ++-
 drivers/net/intel/ice/ice_rxtx.c   | 139 ++++++++++++++++-------------
 3 files changed, 87 insertions(+), 65 deletions(-)
(quoted diff) +0 -0

b/drivers/net/intel/ice/ice_ethdev.c

drivers/net/intel/ice/ice_ethdev.c ice_dev_configure(struct rte_eth_dev *dev) · line 3905

Quoted 10 lines

index c721d135f5..a805e78d03 100644

drivers/net/intel/ice/ice_ethdev.c +1 -0
@@ -3900,6 +3900,7 @@ ice_dev_configure(struct rte_eth_dev *dev)
 	ad->tx_simple_allowed = true;
 
 	ad->rx_func_type = ICE_RX_DEFAULT;
+	ad->tx_func_type = ICE_TX_DEFAULT;
 
 	if (dev->data->dev_conf.rxmode.mq_mode &

RTE_ETH_MQ_RX_RSS_FLAG)

drivers/net/intel/ice/ice_ethdev.c ice_dev_configure(struct rte_eth_dev *dev) · line 3906

Quoted 1 line
drivers/net/intel/ice/ice_ethdev.c +0 -0
 		dev->data->dev_conf.rxmode.offloads |=

RTE_ETH_RX_OFFLOAD_RSS_HASH;

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/net/intel/ice/ice_ethdev.h

Quoted 19 lines

index 72ed65f13b..0b8af339d1 100644

drivers/net/intel/ice/ice_ethdev.h +10 -0
@@ -208,6 +208,16 @@ enum ice_rx_func_type {
 	ICE_RX_AVX512_SCATTERED_OFFLOAD,
 };
 
+enum ice_tx_func_type {
+	ICE_TX_DEFAULT,
+	ICE_TX_SIMPLE,
+	ICE_TX_SSE,
+	ICE_TX_AVX2,
+	ICE_TX_AVX2_OFFLOAD,
+	ICE_TX_AVX512,
+	ICE_TX_AVX512_OFFLOAD,
+};
+
 struct ice_adapter;
 
Quoted 5 lines

drivers/net/intel/ice/ice_ethdev.h struct ice_adapter { · line 668

Quoted 3 lines
drivers/net/intel/ice/ice_ethdev.h +0 -0
 /**
@@ -658,6 +668,7 @@ struct ice_adapter {
 	bool tx_vec_allowed;

Can tx_vec_allowed by dropped at this point?

In this driver I don't think so, as it's used during ice_tx_done_cleanup() to select the appropriate cleanup function. If we were to remove it we would need to evaluate something like the following every time instead of using the bool:

ice_tx_path_infos[ad->tx_func_type].features.simd_width >= RTE_VECT_SIMD_128

Quoted 205 lines

drivers/net/intel/ice/ice_ethdev.h struct ice_adapter {

Quoted 6 lines
drivers/net/intel/ice/ice_ethdev.h +1 -0
 	bool tx_simple_allowed;
 	enum ice_rx_func_type rx_func_type;
+	enum ice_tx_func_type tx_func_type;
 	/* ptype mapping table */
 	alignas(RTE_CACHE_LINE_MIN_SIZE) uint32_t

ptype_tbl[ICE_MAX_PKT_TYPE];

drivers/net/intel/ice/ice_rxtx.c ice_prep_pkts(void *tx_queue, struct rte_mbuf

Quoted 14 lines
drivers/net/intel/ice/ice_ethdev.h +0 -1
 	bool is_safe_mode;
@@ -679,7 +690,6 @@ struct ice_adapter {
 	/* Set bit if the engine is disabled */
 	unsigned long disabled_engine_mask;
 	struct ice_parser *psr;
-	enum rte_vect_max_simd tx_simd_width;
 	bool rx_vec_offload_support;
 };
 
drivers/net/intel/ice/ice_rxtx.c +0 -0
index 74db0fbec9..f05ca83e5b 100644
@@ -4091,6 +4091,44 @@ ice_prep_pkts(void *tx_queue, struct rte_mbuf

**tx_pkts,

Quoted 45 lines
drivers/net/intel/ice/ice_rxtx.c +38 -0
 	return i;
 }
 
+static const struct {
+	eth_tx_burst_t pkt_burst;
+	const char *info;
+} ice_tx_burst_infos[] = {
+	[ICE_TX_DEFAULT] = {
+		.pkt_burst = ice_xmit_pkts,
+		.info = "Scalar"
+	},
+	[ICE_TX_SIMPLE] = {
+		.pkt_burst = ice_xmit_pkts_simple,
+		.info = "Scalar Simple"
+	},
+#ifdef RTE_ARCH_X86
+	[ICE_TX_SSE] = {
+		.pkt_burst = ice_xmit_pkts_vec,
+		.info = "Vector SSE"
+	},
+	[ICE_TX_AVX2] = {
+		.pkt_burst = ice_xmit_pkts_vec_avx2,
+		.info = "Vector AVX2"
+	},
+	[ICE_TX_AVX2_OFFLOAD] = {
+		.pkt_burst = ice_xmit_pkts_vec_avx2_offload,
+		.info = "Offload Vector AVX2"
+	},
+#ifdef CC_AVX512_SUPPORT
+	[ICE_TX_AVX512] = {
+		.pkt_burst = ice_xmit_pkts_vec_avx512,
+		.info = "Vector AVX512"
+	},
+	[ICE_TX_AVX512_OFFLOAD] = {
+		.pkt_burst = ice_xmit_pkts_vec_avx512_offload,
+		.info = "Offload Vector AVX512"
+	},
+#endif
+#endif
+};
+
 void __rte_cold
 ice_set_tx_function(struct rte_eth_dev *dev)
 {

drivers/net/intel/ice/ice_rxtx.c ice_set_tx_function(struct rte_eth_dev *dev) · line 4142

Quoted 4 lines
drivers/net/intel/ice/ice_rxtx.c +1 -0
@@ -4101,74 +4139,58 @@ ice_set_tx_function(struct rte_eth_dev *dev)
 	struct ci_tx_queue *txq;
 	int i;
 	int tx_check_ret = -1;
+	enum rte_vect_max_simd tx_simd_width =

RTE_VECT_SIMD_DISABLED;

drivers/net/intel/ice/ice_rxtx.c ice_set_tx_function(struct rte_eth_dev *dev)

Quoted 7 lines
drivers/net/intel/ice/ice_rxtx.c +0 -6
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
-		ad->tx_simd_width = RTE_VECT_SIMD_DISABLED;
-		tx_check_ret = ice_tx_vec_dev_check(dev);
-		ad->tx_simd_width = ice_get_max_simd_bitwidth();
-		if (tx_check_ret >= 0 &&
-		    rte_vect_get_max_simd_bitwidth() >=

RTE_VECT_SIMD_128) {

drivers/net/intel/ice/ice_rxtx.c ice_set_tx_function(struct rte_eth_dev *dev)

Quoted 4 lines
drivers/net/intel/ice/ice_rxtx.c +0 -4
-			ad->tx_vec_allowed = true;
-
-			if (ad->tx_simd_width < RTE_VECT_SIMD_256 &&
-				tx_check_ret ==

ICE_VECTOR_OFFLOAD_PATH)

Quoted 7 lines
drivers/net/intel/ice/ice_rxtx.c +0 -7
-				ad->tx_vec_allowed = false;
-
-			if (ad->tx_vec_allowed) {
-				for (i = 0; i < dev->data->nb_tx_queues; i++) {
-					txq = dev->data->tx_queues[i];
-					if (txq && ice_txq_vec_setup(txq)) {
-						ad->tx_vec_allowed = false;

drivers/net/intel/ice/ice_rxtx.c ice_set_tx_function(struct rte_eth_dev *dev)

Quoted 10 lines
drivers/net/intel/ice/ice_rxtx.c +8 -2
-						break;
-					}
+	/* The primary process selects the tx path for all processes. */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		goto out;
+
+	tx_check_ret = ice_tx_vec_dev_check(dev);
+	tx_simd_width = ice_get_max_simd_bitwidth();
+	if (tx_check_ret >= 0 &&
+		rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128)

{

Quoted 19 lines
drivers/net/intel/ice/ice_rxtx.c +14 -2
+		ad->tx_vec_allowed = true;
+
+		if (tx_simd_width < RTE_VECT_SIMD_256 &&
+			tx_check_ret == ICE_VECTOR_OFFLOAD_PATH)
+			ad->tx_vec_allowed = false;
+
+		if (ad->tx_vec_allowed) {
+			for (i = 0; i < dev->data->nb_tx_queues; i++) {
+				txq = dev->data->tx_queues[i];
+				if (txq && ice_txq_vec_setup(txq)) {
+					ad->tx_vec_allowed = false;
+					break;
 				}
 			}
-		} else {
-			ad->tx_vec_allowed = false;
 		}
+	} else {
+		ad->tx_vec_allowed = false;

drivers/net/intel/ice/ice_rxtx.c ice_set_tx_function(struct rte_eth_dev *dev)

Quoted 10 lines
drivers/net/intel/ice/ice_rxtx.c +1 -3
 	}
 
 	if (ad->tx_vec_allowed) {
 		dev->tx_pkt_prepare = rte_eth_tx_pkt_prepare_dummy;
-		if (ad->tx_simd_width == RTE_VECT_SIMD_512) {
+		if (tx_simd_width == RTE_VECT_SIMD_512) {
 #ifdef CC_AVX512_SUPPORT
 			if (tx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
-				PMD_DRV_LOG(NOTICE,
-					    "Using AVX512 OFFLOAD Vector Tx

(port %d).",

drivers/net/intel/ice/ice_rxtx.c ice_set_tx_function(struct rte_eth_dev *dev)

Quoted 4 lines
drivers/net/intel/ice/ice_rxtx.c +1 -3
-					    dev->data->port_id);
-				dev->tx_pkt_burst =
-					ice_xmit_pkts_vec_avx512_offload;
+				ad->tx_func_type =

ICE_TX_AVX512_OFFLOAD;

drivers/net/intel/ice/ice_rxtx.c ice_set_tx_function(struct rte_eth_dev *dev)

Quoted 4 lines
drivers/net/intel/ice/ice_rxtx.c +0 -2
 				dev->tx_pkt_prepare = ice_prep_pkts;
 			} else {
-				PMD_DRV_LOG(NOTICE,
-					    "Using AVX512 Vector Tx (port

%d).",

drivers/net/intel/ice/ice_rxtx.c ice_set_tx_function(struct rte_eth_dev *dev) · line 4145

Quoted 2 lines
drivers/net/intel/ice/ice_rxtx.c +0 -2
-					    dev->data->port_id);
-				dev->tx_pkt_burst =

ice_xmit_pkts_vec_avx512;

drivers/net/intel/ice/ice_rxtx.c ice_set_tx_function(struct rte_eth_dev *dev)

Quoted 7 lines
drivers/net/intel/ice/ice_rxtx.c +1 -2
+				ad->tx_func_type = ICE_TX_AVX512;
 			}
 #endif
 		} else {
 			if (tx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
-				PMD_DRV_LOG(NOTICE,
-					    "Using AVX2 OFFLOAD Vector Tx

(port %d).",

drivers/net/intel/ice/ice_rxtx.c ice_set_tx_function(struct rte_eth_dev *dev)

Quoted 7 lines
drivers/net/intel/ice/ice_rxtx.c +1 -4
-					    dev->data->port_id);
-				dev->tx_pkt_burst =
-					ice_xmit_pkts_vec_avx2_offload;
+				ad->tx_func_type = ICE_TX_AVX2_OFFLOAD;
 				dev->tx_pkt_prepare = ice_prep_pkts;
 			} else {
-				PMD_DRV_LOG(DEBUG, "Using %sVector Tx

(port %d).",

drivers/net/intel/ice/ice_rxtx.c ice_set_tx_function(struct rte_eth_dev *dev) · line 4158

Quoted 1 line
drivers/net/intel/ice/ice_rxtx.c +0 -1
-					    ad->tx_simd_width ==

RTE_VECT_SIMD_256 ? "avx2 " : "",

drivers/net/intel/ice/ice_rxtx.c ice_set_tx_function(struct rte_eth_dev *dev) · line 4160

Quoted 2 lines
drivers/net/intel/ice/ice_rxtx.c +0 -2
-					    dev->data->port_id);
-				dev->tx_pkt_burst = ad->tx_simd_width ==

RTE_VECT_SIMD_256 ?

drivers/net/intel/ice/ice_rxtx.c ice_set_tx_function(struct rte_eth_dev *dev)

Quoted 3 lines
drivers/net/intel/ice/ice_rxtx.c +1 -2
-						    ice_xmit_pkts_vec_avx2 :
-						    ice_xmit_pkts_vec;
+				ad->tx_func_type = tx_simd_width ==

RTE_VECT_SIMD_256 ?

Quoted 34 lines
drivers/net/intel/ice/ice_rxtx.c +3 -20
+						    ICE_TX_AVX2 :
+						    ICE_TX_SSE;
 			}
 		}
 
-		if (mbuf_check) {
-			ad->tx_pkt_burst = dev->tx_pkt_burst;
-			dev->tx_pkt_burst = ice_xmit_pkts_check;
-		}
-		return;
+		goto out;
 	}
 #endif
 
@@ -4186,24 +4208,13 @@ ice_set_tx_function(struct rte_eth_dev *dev)
 		ad->tx_pkt_burst = dev->tx_pkt_burst;
 		dev->tx_pkt_burst = ice_xmit_pkts_check;
 	}
-}
 
-static const struct {
-	eth_tx_burst_t pkt_burst;
-	const char *info;
-} ice_tx_burst_infos[] = {
-	{ ice_xmit_pkts_simple,   "Scalar Simple" },
-	{ ice_xmit_pkts,          "Scalar" },
-#ifdef RTE_ARCH_X86
-#ifdef CC_AVX512_SUPPORT
-	{ ice_xmit_pkts_vec_avx512, "Vector AVX512" },
-	{ ice_xmit_pkts_vec_avx512_offload, "Offload Vector AVX512" },
-#endif
-	{ ice_xmit_pkts_vec_avx2,         "Vector AVX2" },
-	{ ice_xmit_pkts_vec_avx2_offload, "Offload Vector AVX2" },
-	{ ice_xmit_pkts_vec,              "Vector SSE" },
Quoted 8 lines

drivers/net/intel/ice/ice_rxtx.c ice_set_tx_function(struct rte_eth_dev *dev) · line 4206

Quoted 2 lines
drivers/net/intel/ice/ice_rxtx.c +0 -2
-#endif
-};

Looking at the code with this patch applied, I think there may be an issue with the scalar case in this version. At line 4197 we have a block which assigns a value to tx_pkt_burst and tx_burst_prepare, but does not assign a value to the tx_func_type values. That means when it falls through into the "out" section, the function point for pkt_burst get overwritten.

This should be fixed in the v2.

Quoted 16 lines
Quoted 10 lines
drivers/net/intel/ice/ice_rxtx.c +6 -0
+out:
+	dev->tx_pkt_burst = mbuf_check ? ice_xmit_pkts_check :
+					 ice_tx_burst_infos[ad-
 tx_func_type].pkt_burst;
+	PMD_DRV_LOG(NOTICE, "Using %s (port %d).",
+		ice_tx_burst_infos[ad->tx_func_type].info, dev->data-
 port_id);
+}
 
Quoted 2 lines

int
ice_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t

queue_id,

Quoted 3 lines

--
2.43.0

#6 lore raw

PATCH 3/13 net/ice: use common Tx path selection infrastructure

In reply to Ciara Loftus

Replace the existing complicated logic with the use of the common function. Introduce a new feature "simple tx" to the common infrastructure which represents whether or not a simplified transmit path may be selected for the device.

---
 drivers/net/intel/common/tx.h               |  10 ++
 drivers/net/intel/ice/ice_rxtx.c            | 142 +++++++++-----------
 drivers/net/intel/ice/ice_rxtx.h            |  30 ++++-
 drivers/net/intel/ice/ice_rxtx_vec_common.h |  35 +----
 drivers/net/intel/ice/ice_rxtx_vec_sse.c    |   6 -
 5 files changed, 103 insertions(+), 120 deletions(-)
drivers/net/intel/common/tx.h +10 -0
index c6c1904ba3..3480c5e07c 100644
@@ -118,15 +118,21 @@ struct ci_tx_queue {
 	};
 };
 
+struct ci_tx_path_features_extra {
+	bool simple_tx;
+};
+
 struct ci_tx_path_features {
 	uint32_t tx_offloads;
 	enum rte_vect_max_simd simd_width;
+	struct ci_tx_path_features_extra extra;
 };
 
 struct ci_tx_path_info {
 	eth_tx_burst_t pkt_burst;
 	const char *info;
 	struct ci_tx_path_features features;
+	eth_tx_prep_t pkt_prep;
 };
 
 static __rte_always_inline void
@@ -302,6 +308,10 @@ ci_tx_path_select(struct ci_tx_path_features req_features,
 	for (i = 0; i < num_paths; i++) {
 		const struct ci_tx_path_features *path_features = &infos[i].features;
 
+		/* Do not use a simple tx path if not requested. */
+		if (path_features->extra.simple_tx && !req_features.extra.simple_tx)
+			continue;
+
 		/* Ensure the path supports the requested TX offloads. */
 		if ((path_features->tx_offloads & req_features.tx_offloads) !=
 				req_features.tx_offloads)
drivers/net/intel/ice/ice_rxtx.c +62 -80

196 lines not on this page · raw message

drivers/net/intel/ice/ice_rxtx.h +29 -1
index 141a62a7da..d7e8c1b0c4 100644
@@ -108,6 +108,35 @@
 		RTE_ETH_RX_OFFLOAD_VLAN_FILTER |\
 		RTE_ETH_RX_OFFLOAD_RSS_HASH)
 
+/* basic scalar path */
+#define ICE_TX_SCALAR_OFFLOADS (		\
+	RTE_ETH_TX_OFFLOAD_VLAN_INSERT |	\
+	RTE_ETH_TX_OFFLOAD_TCP_TSO |		\
+	RTE_ETH_TX_OFFLOAD_MULTI_SEGS |		\
+	RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE |	\
+	RTE_ETH_TX_OFFLOAD_QINQ_INSERT |	\
+	RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_UDP_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_TCP_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |	\
+	RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM |	\
+	RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |	\
+	RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO |	\
+	RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO |	\
+	RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO |	\
+	RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP)
+/* basic vector path */
+#define ICE_TX_VECTOR_OFFLOADS RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE
+/* vector offload paths */
+#define ICE_TX_VECTOR_OFFLOAD_OFFLOADS (	\
+	ICE_TX_VECTOR_OFFLOADS |		\
+	RTE_ETH_TX_OFFLOAD_VLAN_INSERT |	\
+	RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_UDP_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_TCP_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_SCTP_CKSUM)
+
 /* Max header size can be 2K - 64 bytes */
 #define ICE_RX_HDR_BUF_SIZE    (2048 - 64)
 
@@ -249,7 +278,6 @@ void ice_select_rxd_to_pkt_fields_handler(struct ci_rx_queue *rxq,
 int ice_rx_vec_dev_check(struct rte_eth_dev *dev);
 int ice_tx_vec_dev_check(struct rte_eth_dev *dev);
 int ice_rxq_vec_setup(struct ci_rx_queue *rxq);
-int ice_txq_vec_setup(struct ci_tx_queue *txq);
 uint16_t ice_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 			   uint16_t nb_pkts);
 uint16_t ice_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
drivers/net/intel/ice/ice_rxtx_vec_common.h +2 -33
index 39581cb7ae..ff46a8fb49 100644
@@ -51,28 +51,6 @@ _ice_rx_queue_release_mbufs_vec(struct ci_rx_queue *rxq)
 	memset(rxq->sw_ring, 0, sizeof(rxq->sw_ring[0]) * rxq->nb_rx_desc);
 }
 
-#define ICE_TX_NO_VECTOR_FLAGS (			\
-		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |		\
-		RTE_ETH_TX_OFFLOAD_QINQ_INSERT |	\
-		RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |	\
-		RTE_ETH_TX_OFFLOAD_TCP_TSO |	\
-		RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |    \
-		RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO |    \
-		RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO |    \
-		RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO |    \
-		RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM |	\
-		RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP)
-
-#define ICE_TX_VECTOR_OFFLOAD (				\
-		RTE_ETH_TX_OFFLOAD_VLAN_INSERT |		\
-		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_TCP_CKSUM)
-
-#define ICE_VECTOR_PATH		0
-#define ICE_VECTOR_OFFLOAD_PATH	1
-
 static inline int
 ice_rx_vec_queue_default(struct ci_rx_queue *rxq)
 {
@@ -98,13 +76,7 @@ ice_tx_vec_queue_default(struct ci_tx_queue *txq)
 	    txq->tx_rs_thresh > ICE_TX_MAX_FREE_BUF_SZ)
 		return -1;
 
-	if (txq->offloads & ICE_TX_NO_VECTOR_FLAGS)
-		return -1;
-
-	if (txq->offloads & ICE_TX_VECTOR_OFFLOAD)
-		return ICE_VECTOR_OFFLOAD_PATH;
-
-	return ICE_VECTOR_PATH;
+	return 0;
 }
 
 static inline int
@@ -130,18 +102,15 @@ ice_tx_vec_dev_check_default(struct rte_eth_dev *dev)
 	int i;
 	struct ci_tx_queue *txq;
 	int ret = 0;
-	int result = 0;
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
 		txq = dev->data->tx_queues[i];
 		ret = ice_tx_vec_queue_default(txq);
 		if (ret < 0)
 			return -1;
-		if (ret == ICE_VECTOR_OFFLOAD_PATH)
-			result = ret;
 	}
 
-	return result;
+	return ret;
 }
 
 static inline void
drivers/net/intel/ice/ice_rxtx_vec_sse.c +0 -6
index 1545bc3b6e..4fc1b7e881 100644
@@ -718,12 +718,6 @@ ice_rxq_vec_setup(struct ci_rx_queue *rxq)
 	return 0;
 }
 
-int __rte_cold
-ice_txq_vec_setup(struct ci_tx_queue *txq __rte_unused)
-{
-	return 0;
-}
-
 int __rte_cold
 ice_rx_vec_dev_check(struct rte_eth_dev *dev)
 {
Signature · 1 line
2.43.0
#7 lore raw

Re: [PATCH 03/13] net/ice: use common Tx path selection infrastructure

Quoted 20 lines · Ciara Loftus

Replace the existing complicated logic with the use of the common function. Introduce a new feature "simple tx" to the common infrastructure which represents whether or not a simplified transmit path may be selected for the device.

---
 drivers/net/intel/common/tx.h               |  10 ++
 drivers/net/intel/ice/ice_rxtx.c            | 142 +++++++++-----------
 drivers/net/intel/ice/ice_rxtx.h            |  30 ++++-
 drivers/net/intel/ice/ice_rxtx_vec_common.h |  35 +----
 drivers/net/intel/ice/ice_rxtx_vec_sse.c    |   6 -
 5 files changed, 103 insertions(+), 120 deletions(-)
drivers/net/intel/common/tx.h +0 -0
index c6c1904ba3..3480c5e07c 100644
@@ -118,15 +118,21 @@ struct ci_tx_queue {
 	};

drivers/net/intel/common/tx.h struct ci_tx_queue { · line 128

Quoted 10 lines
drivers/net/intel/common/tx.h +5 -0
 };
 
+struct ci_tx_path_features_extra {
+	bool simple_tx;
+};
+
 struct ci_tx_path_features {
 	uint32_t tx_offloads;
 	enum rte_vect_max_simd simd_width;
+	struct ci_tx_path_features_extra extra;

Two thoughts on this - do we really need a substructure here rather than just adding the flags directly to the path_features structure? Secondly, should this addition not be included in patch 1, which adds the rest of the support for the tx path selection logic? I don't see a reason to put half the infrastructure there and the rest here.

drivers/net/intel/common/tx.h struct ci_tx_queue { · line 136

Quoted 8 lines
drivers/net/intel/common/tx.h +1 -0
 };
 
 struct ci_tx_path_info {
 	eth_tx_burst_t pkt_burst;
 	const char *info;
 	struct ci_tx_path_features features;
+	eth_tx_prep_t pkt_prep;
 };

Similar comment here - should the pkt_prep function not be in place from the first patch?

Quoted 131 lines
drivers/net/intel/common/tx.h +4 -0
 static __rte_always_inline void
@@ -302,6 +308,10 @@ ci_tx_path_select(struct ci_tx_path_features req_features,
 	for (i = 0; i < num_paths; i++) {
 		const struct ci_tx_path_features *path_features = &infos[i].features;
 
+		/* Do not use a simple tx path if not requested. */
+		if (path_features->extra.simple_tx && !req_features.extra.simple_tx)
+			continue;
+
 		/* Ensure the path supports the requested TX offloads. */
 		if ((path_features->tx_offloads & req_features.tx_offloads) !=
 				req_features.tx_offloads)
drivers/net/intel/ice/ice_rxtx.c +47 -28
index f05ca83e5b..ca9cdc9618 100644
@@ -4091,39 +4091,70 @@ ice_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	return i;
 }
 
-static const struct {
-	eth_tx_burst_t pkt_burst;
-	const char *info;
-} ice_tx_burst_infos[] = {
+static const struct ci_tx_path_info ice_tx_path_infos[] = {
 	[ICE_TX_DEFAULT] = {
 		.pkt_burst = ice_xmit_pkts,
-		.info = "Scalar"
+		.info = "Scalar",
+		.features = {
+			.tx_offloads = ICE_TX_SCALAR_OFFLOADS
+		},
+		.pkt_prep = ice_prep_pkts
 	},
 	[ICE_TX_SIMPLE] = {
 		.pkt_burst = ice_xmit_pkts_simple,
-		.info = "Scalar Simple"
+		.info = "Scalar Simple",
+		.features = {
+			.tx_offloads = ICE_TX_SCALAR_OFFLOADS,
+			.extra.simple_tx = true
+		},
+		.pkt_prep = rte_eth_tx_pkt_prepare_dummy
 	},
 #ifdef RTE_ARCH_X86
 	[ICE_TX_SSE] = {
 		.pkt_burst = ice_xmit_pkts_vec,
-		.info = "Vector SSE"
+		.info = "Vector SSE",
+		.features = {
+			.tx_offloads = ICE_TX_VECTOR_OFFLOADS,
+			.simd_width = RTE_VECT_SIMD_128
+		},
+		.pkt_prep = rte_eth_tx_pkt_prepare_dummy
 	},
 	[ICE_TX_AVX2] = {
 		.pkt_burst = ice_xmit_pkts_vec_avx2,
-		.info = "Vector AVX2"
+		.info = "Vector AVX2",
+		.features = {
+			.tx_offloads = ICE_TX_VECTOR_OFFLOADS,
+			.simd_width = RTE_VECT_SIMD_256
+		},
+		.pkt_prep = rte_eth_tx_pkt_prepare_dummy
 	},
 	[ICE_TX_AVX2_OFFLOAD] = {
 		.pkt_burst = ice_xmit_pkts_vec_avx2_offload,
-		.info = "Offload Vector AVX2"
+		.info = "Offload Vector AVX2",
+		.features = {
+			.tx_offloads = ICE_TX_VECTOR_OFFLOAD_OFFLOADS,
+			.simd_width = RTE_VECT_SIMD_256
+		},
+		.pkt_prep = ice_prep_pkts
 	},
 #ifdef CC_AVX512_SUPPORT
 	[ICE_TX_AVX512] = {
 		.pkt_burst = ice_xmit_pkts_vec_avx512,
-		.info = "Vector AVX512"
+		.info = "Vector AVX512",
+		.features = {
+			.tx_offloads = ICE_TX_VECTOR_OFFLOADS,
+			.simd_width = RTE_VECT_SIMD_512
+		},
+		.pkt_prep = rte_eth_tx_pkt_prepare_dummy
 	},
 	[ICE_TX_AVX512_OFFLOAD] = {
 		.pkt_burst = ice_xmit_pkts_vec_avx512_offload,
-		.info = "Offload Vector AVX512"
+		.info = "Offload Vector AVX512",
+		.features = {
+			.tx_offloads = ICE_TX_VECTOR_OFFLOAD_OFFLOADS,
+			.simd_width = RTE_VECT_SIMD_512
+		},
+		.pkt_prep = ice_prep_pkts
 	},
 #endif
 #endif
@@ -4135,85 +4166,36 @@ ice_set_tx_function(struct rte_eth_dev *dev)
 	struct ice_adapter *ad =
 		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	int mbuf_check = ad->devargs.mbuf_check;
-#ifdef RTE_ARCH_X86
-	struct ci_tx_queue *txq;
-	int i;
-	int tx_check_ret = -1;
-	enum rte_vect_max_simd tx_simd_width = RTE_VECT_SIMD_DISABLED;
+	struct ci_tx_path_features req_features = {
+		.tx_offloads = dev->data->dev_conf.txmode.offloads,
+		.simd_width = RTE_VECT_SIMD_DISABLED,
+	};
 
 	/* The primary process selects the tx path for all processes. */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		goto out;
 
-	tx_check_ret = ice_tx_vec_dev_check(dev);
-	tx_simd_width = ice_get_max_simd_bitwidth();
-	if (tx_check_ret >= 0 &&
-		rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
-		ad->tx_vec_allowed = true;
-
-		if (tx_simd_width < RTE_VECT_SIMD_256 &&
-			tx_check_ret == ICE_VECTOR_OFFLOAD_PATH)
-			ad->tx_vec_allowed = false;
+	req_features.extra.simple_tx = ad->tx_simple_allowed;
 
-		if (ad->tx_vec_allowed) {
-			for (i = 0; i < dev->data->nb_tx_queues; i++) {
-				txq = dev->data->tx_queues[i];

drivers/net/intel/ice/ice_rxtx.c ice_set_tx_function(struct rte_eth_dev *dev) · line 4170

Quoted 10 lines
drivers/net/intel/ice/ice_rxtx.c +0 -10
-				if (txq && ice_txq_vec_setup(txq)) {
-					ad->tx_vec_allowed = false;
-					break;
-				}
-			}
-		}
-	} else {
-		ad->tx_vec_allowed = false;
-	}
-

This code being removed was reworked in the previous patch. Do you think it would be as simple to merge this patch with the previous one, rather than adjusting the code twice?

#8 lore raw

Re: [PATCH 03/13] net/ice: use common Tx path selection infrastructure

Quoted 23 lines · Bruce Richardson
Quoted 22 lines · Ciara Loftus

Replace the existing complicated logic with the use of the common function. Introduce a new feature "simple tx" to the common infrastructure which represents whether or not a simplified transmit path may be selected for the device.

---
 drivers/net/intel/common/tx.h               |  10 ++
 drivers/net/intel/ice/ice_rxtx.c            | 142 +++++++++-----------
 drivers/net/intel/ice/ice_rxtx.h            |  30 ++++-
 drivers/net/intel/ice/ice_rxtx_vec_common.h |  35 +----
 drivers/net/intel/ice/ice_rxtx_vec_sse.c    |   6 -
 5 files changed, 103 insertions(+), 120 deletions(-)
drivers/net/intel/common/tx.h +0 -0
index c6c1904ba3..3480c5e07c 100644
@@ -118,15 +118,21 @@ struct ci_tx_queue {
 	};
 };
 
Quoted 15 lines

drivers/net/intel/common/tx.h struct ci_tx_queue { · line 128

Quoted 8 lines
drivers/net/intel/common/tx.h +5 -0
+struct ci_tx_path_features_extra {
+	bool simple_tx;
+};
+
 struct ci_tx_path_features {
 	uint32_t tx_offloads;
 	enum rte_vect_max_simd simd_width;
+	struct ci_tx_path_features_extra extra;

Two thoughts on this - do we really need a substructure here rather than just adding the flags directly to the path_features structure? Secondly, should this addition not be included in patch 1, which adds the rest of the support for the tx path selection logic? I don't see a reason to put half the infrastructure there and the rest here.

Just as follow-up here. I see there are more extra features added in later drivers, but those (AFAIK) are pretty much limited to the drivers adding them. Multiple drivers have simple scalar paths so I think this could be part of the base infrastructure in patch one, while the others can stay with their individual drivers.

/Bruce

#9 lore raw

PATCH 4/13 net/iavf: use same Tx path across processes

In reply to Ciara Loftus

In the interest of simplicity, let the primary process select the Tx path to be used by all processes using the given device.

The many logs which report individual Tx path selections have been consolidated into one single log.

---
 drivers/net/intel/iavf/iavf_ethdev.c |  5 +-
 drivers/net/intel/iavf/iavf_rxtx.c   | 90 ++++++++++------------------
 2 files changed, 34 insertions(+), 61 deletions(-)
drivers/net/intel/iavf/iavf_ethdev.c +3 -2
index 15e49fe248..ab65e99f68 100644
@@ -671,6 +671,8 @@ iavf_dev_configure(struct rte_eth_dev *dev)
 	 */
 	ad->tx_vec_allowed = true;
 
+	ad->tx_func_type = IAVF_TX_DEFAULT;
+
 	if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
 		dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
 
@@ -2795,8 +2797,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
 	eth_dev->tx_pkt_prepare = &iavf_prep_pkts;
 
 	/* For secondary processes, we don't initialise any further as primary
-	 * has already done this work. Only check if we need a different RX
-	 * and TX function.
+	 * has already done this work.
 	 */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
 		iavf_set_rx_function(eth_dev);
drivers/net/intel/iavf/iavf_rxtx.c +31 -59

124 lines not on this page · raw message

Signature · 1 line
2.43.0
#10 lore raw

PATCH 5/13 net/iavf: use common Tx path selection infrastructure

In reply to Ciara Loftus

Replace the existing complicated logic with the use of the common function. Introduce two new features "disabled" and "context desc" to the common infrastructure which represents whether or not the path is disabled, or if it uses a context descriptor.

---
 drivers/net/intel/common/tx.h                 |  14 ++
 drivers/net/intel/iavf/iavf.h                 |   2 -
 drivers/net/intel/iavf/iavf_ethdev.c          |   4 -
 drivers/net/intel/iavf/iavf_rxtx.c            | 193 ++++++++++--------
 drivers/net/intel/iavf/iavf_rxtx.h            |  46 +++--
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h |  39 +---
 6 files changed, 153 insertions(+), 145 deletions(-)
drivers/net/intel/common/tx.h +14 -0
index 3480c5e07c..5d965a86c9 100644
@@ -120,6 +120,8 @@ struct ci_tx_queue {
 
 struct ci_tx_path_features_extra {
 	bool simple_tx;
+	bool ctx_desc;
+	bool disabled;
 };
 
 struct ci_tx_path_features {
@@ -308,6 +310,10 @@ ci_tx_path_select(struct ci_tx_path_features req_features,
 	for (i = 0; i < num_paths; i++) {
 		const struct ci_tx_path_features *path_features = &infos[i].features;
 
+		/* Do not select a disabled tx path. */
+		if (path_features->extra.disabled)
+			continue;
+
 		/* Do not use a simple tx path if not requested. */
 		if (path_features->extra.simple_tx && !req_features.extra.simple_tx)
 			continue;
@@ -321,6 +327,10 @@ ci_tx_path_select(struct ci_tx_path_features req_features,
 		if (path_features->simd_width > req_features.simd_width)
 			continue;
 
+		/* If a context descriptor is requested, ensure the path supports it. */
+		if (!path_features->extra.ctx_desc && req_features.extra.ctx_desc)
+			continue;
+
 		/* Do not select the path if it is less suitable than the chosen path. */
 		if (chosen_path_features != NULL) {
 			/* Do not select paths with lower SIMD width than the chosen path. */
@@ -333,6 +343,10 @@ ci_tx_path_select(struct ci_tx_path_features req_features,
 					rte_popcount32(path_features->tx_offloads) >
 					rte_popcount32(chosen_path_features->tx_offloads))
 				continue;
+
+			/* Don't use a context descriptor unless necessary */
+			if (path_features->extra.ctx_desc && !chosen_path_features->extra.ctx_desc)
+				continue;
 		}
 
 		/* Finally, select the path since it has met all the requirements. */
drivers/net/intel/iavf/iavf.h +0 -2
index d78582e05c..921bf0a607 100644
@@ -375,8 +375,6 @@ struct iavf_adapter {
 	struct iavf_security_ctx *security_ctx;
 
 	bool rx_bulk_alloc_allowed;
-	/* For vector PMD */
-	bool tx_vec_allowed;
 	alignas(RTE_CACHE_LINE_MIN_SIZE) uint32_t ptype_tbl[IAVF_MAX_PKT_TYPE];
 	bool stopped;
 	bool closed;
drivers/net/intel/iavf/iavf_ethdev.c +0 -4
index ab65e99f68..bf1186c20f 100644
@@ -666,10 +666,6 @@ iavf_dev_configure(struct rte_eth_dev *dev)
 		return -EIO;
 
 	ad->rx_bulk_alloc_allowed = true;
-	/* Initialize to TRUE. If any of Rx queues doesn't meet the
-	 * vector Rx/Tx preconditions, it will be reset.
-	 */
-	ad->tx_vec_allowed = true;
 
 	ad->tx_func_type = IAVF_TX_DEFAULT;
 
drivers/net/intel/iavf/iavf_rxtx.c +105 -88

265 lines not on this page · raw message

drivers/net/intel/iavf/iavf_rxtx.h +31 -15

53 lines not on this page · raw message

drivers/net/intel/iavf/iavf_rxtx_vec_common.h +3 -36
index 66f65b46e9..f1ea57034f 100644
@@ -73,8 +73,6 @@ iavf_rx_vec_queue_default(struct ci_rx_queue *rxq)
 static inline int
 iavf_tx_vec_queue_default(struct ci_tx_queue *txq)
 {
-	bool vlan_offload = false, vlan_needs_ctx = false;
-
 	if (!txq)
 		return -1;
 
@@ -82,35 +80,7 @@ iavf_tx_vec_queue_default(struct ci_tx_queue *txq)
 	    txq->tx_rs_thresh > IAVF_VPMD_TX_MAX_FREE_BUF)
 		return -1;
 
-	if (txq->offloads & IAVF_TX_NO_VECTOR_FLAGS)
-		return -1;
-
-	if (rte_pmd_iavf_tx_lldp_dynfield_offset > 0) {
-		txq->use_ctx = 1;
-		return IAVF_VECTOR_CTX_PATH;
-	}
-
-	/* Vlan tci needs to be inserted via ctx desc, if the vlan_flag is L2TAG2. */
-	if (txq->offloads & RTE_ETH_TX_OFFLOAD_VLAN_INSERT) {
-		vlan_offload = true;
-		if (txq->vlan_flag == IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2)
-			vlan_needs_ctx = true;
-	}
-
-	/**
-	 * Tunneling parameters and other fields need be configured in ctx desc
-	 * if the outer checksum offload is enabled.
-	 */
-	if (txq->offloads & (IAVF_TX_VECTOR_OFFLOAD | IAVF_TX_VECTOR_OFFLOAD_CTX) || vlan_offload) {
-		if (txq->offloads & IAVF_TX_VECTOR_OFFLOAD_CTX || vlan_needs_ctx) {
-			txq->use_ctx = 1;
-			return IAVF_VECTOR_CTX_OFFLOAD_PATH;
-		} else {
-			return IAVF_VECTOR_OFFLOAD_PATH;
-		}
-	} else {
-		return IAVF_VECTOR_PATH;
-	}
+	return 0;
 }
 
 static inline int
@@ -137,19 +107,16 @@ iavf_tx_vec_dev_check_default(struct rte_eth_dev *dev)
 	int i;
 	struct ci_tx_queue *txq;
 	int ret;
-	int result = 0;
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
 		txq = dev->data->tx_queues[i];
 		ret = iavf_tx_vec_queue_default(txq);
 
 		if (ret < 0)
-			return -1;
-		if (ret > result)
-			result = ret;
+			break;
 	}
 
-	return result;
+	return ret;
 }
 
 /******************************************************************************
Signature · 1 line
2.43.0
#11 lore raw

PATCH 6/13 net/i40e: use same Tx path across processes

In reply to Ciara Loftus

In the interest of simplicity, let the primary process select the Tx path to be used by all processes using the given device.

The many logs which report individual Tx path selections have been consolidated into one single log.

---
 drivers/net/intel/i40e/i40e_ethdev.h |  11 +++
 drivers/net/intel/i40e/i40e_rxtx.c   | 118 +++++++++++++++------------
 2 files changed, 76 insertions(+), 53 deletions(-)
drivers/net/intel/i40e/i40e_ethdev.h +11 -0
index 3fca089d6c..9a89f94f0e 100644
@@ -1243,6 +1243,16 @@ enum i40e_rx_func_type {
 	I40E_RX_ALTIVEC_SCATTERED,
 };
 
+enum i40e_tx_func_type {
+	I40E_TX_DEFAULT,
+	I40E_TX_SCALAR_SIMPLE,
+	I40E_TX_SSE,
+	I40E_TX_AVX2,
+	I40E_TX_AVX512,
+	I40E_TX_NEON,
+	I40E_TX_ALTIVEC,
+};
+
 /*
  * Structure to store private data for each PF/VF instance.
  */
@@ -1260,6 +1270,7 @@ struct i40e_adapter {
 	bool tx_vec_allowed;
 
 	enum i40e_rx_func_type rx_func_type;
+	enum i40e_tx_func_type tx_func_type;
 
 	uint64_t mbuf_check; /* mbuf check flags. */
 	uint16_t max_pkt_len; /* Maximum packet length */
drivers/net/intel/i40e/i40e_rxtx.c +65 -53

156 lines not on this page · raw message

Signature · 1 line
2.43.0
#12 lore raw

PATCH 7/13 net/i40e: use common Tx path selection infrastructure

In reply to Ciara Loftus

Replace the existing complicated logic with the use of the common function.

---
 drivers/net/intel/i40e/i40e_ethdev.h          |   2 -
 drivers/net/intel/i40e/i40e_rxtx.c            | 112 +++++++++---------
 drivers/net/intel/i40e/i40e_rxtx.h            |  20 +++-
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |   6 -
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |   6 -
 drivers/net/intel/i40e/i40e_rxtx_vec_sse.c    |   6 -
 6 files changed, 78 insertions(+), 74 deletions(-)
drivers/net/intel/i40e/i40e_ethdev.h +0 -2
index 9a89f94f0e..8a86e26858 100644
@@ -1290,8 +1290,6 @@ struct i40e_adapter {
 
 	/* For RSS reta table update */
 	uint8_t rss_reta_updated;
-
-	enum rte_vect_max_simd tx_simd_width;
 };
 
 /**
drivers/net/intel/i40e/i40e_rxtx.c +59 -53

183 lines not on this page · raw message

drivers/net/intel/i40e/i40e_rxtx.h +19 -1
index b5a901794f..ed173d8f17 100644
@@ -91,6 +91,25 @@ enum i40e_header_split_mode {
 		RTE_ETH_RX_OFFLOAD_VLAN_FILTER |	\
 		RTE_ETH_RX_OFFLOAD_RSS_HASH)
 
+#define I40E_TX_SCALAR_OFFLOADS (			\
+		RTE_ETH_TX_OFFLOAD_VLAN_INSERT |	\
+		RTE_ETH_TX_OFFLOAD_QINQ_INSERT |	\
+		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
+		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |		\
+		RTE_ETH_TX_OFFLOAD_TCP_CKSUM |		\
+		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |		\
+		RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_TCP_TSO |		\
+		RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |	\
+		RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO |	\
+		RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO |	\
+		RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO |	\
+		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |		\
+		RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
+
+#define I40E_TX_VECTOR_OFFLOADS RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE
+
 /** Offload features */
 union i40e_tx_offload {
 	uint64_t data;
@@ -165,7 +184,6 @@ uint16_t i40e_recv_scattered_pkts_vec(void *rx_queue,
 				      uint16_t nb_pkts);
 int i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);
 int i40e_rxq_vec_setup(struct ci_rx_queue *rxq);
-int i40e_txq_vec_setup(struct ci_tx_queue *txq);
 void i40e_rx_queue_release_mbufs_vec(struct ci_rx_queue *rxq);
 uint16_t i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 				   uint16_t nb_pkts);
drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +0 -6
index 87a57e7520..bbb6d907cf 100644
@@ -547,12 +547,6 @@ i40e_rxq_vec_setup(struct ci_rx_queue *rxq)
 	return 0;
 }
 
-int __rte_cold
-i40e_txq_vec_setup(struct ci_tx_queue __rte_unused * txq)
-{
-	return 0;
-}
-
 int __rte_cold
 i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev)
 {
drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +0 -6
index c9098e4c1a..b5be0c1b59 100644
@@ -697,12 +697,6 @@ i40e_rxq_vec_setup(struct ci_rx_queue *rxq)
 	return 0;
 }
 
-int __rte_cold
-i40e_txq_vec_setup(struct ci_tx_queue *txq __rte_unused)
-{
-	return 0;
-}
-
 int __rte_cold
 i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev)
 {
drivers/net/intel/i40e/i40e_rxtx_vec_sse.c +0 -6
index c035408dcc..c209135890 100644
@@ -704,12 +704,6 @@ i40e_rxq_vec_setup(struct ci_rx_queue *rxq)
 	return 0;
 }
 
-int __rte_cold
-i40e_txq_vec_setup(struct ci_tx_queue *txq __rte_unused)
-{
-	return 0;
-}
-
 int __rte_cold
 i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev)
 {
Signature · 1 line
2.43.0
#13 lore raw

PATCH 8/13 net/idpf: use common Tx path selection infrastructure

In reply to Ciara Loftus

Replace the existing complicated logic with the use of the common function. Introduce a new feature "single queue" to the common infrastructure which represents whether single or split queue mode is used in the given path.

---
 drivers/net/intel/common/tx.h                 |   5 +
 drivers/net/intel/idpf/idpf_common_device.h   |  10 ++
 drivers/net/intel/idpf/idpf_common_rxtx.c     |  49 ++++++++
 drivers/net/intel/idpf/idpf_common_rxtx.h     |  12 ++
 drivers/net/intel/idpf/idpf_rxtx.c            | 112 +++++-------------
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |  10 --
 6 files changed, 107 insertions(+), 91 deletions(-)
drivers/net/intel/common/tx.h +5 -0
index 5d965a86c9..32cee09e8f 100644
@@ -122,6 +122,7 @@ struct ci_tx_path_features_extra {
 	bool simple_tx;
 	bool ctx_desc;
 	bool disabled;
+	bool single_queue;
 };
 
 struct ci_tx_path_features {
@@ -318,6 +319,10 @@ ci_tx_path_select(struct ci_tx_path_features req_features,
 		if (path_features->extra.simple_tx && !req_features.extra.simple_tx)
 			continue;
 
+		/* If requested, ensure the path supports single queue TX. */
+		if (path_features->extra.single_queue != req_features.extra.single_queue)
+			continue;
+
 		/* Ensure the path supports the requested TX offloads. */
 		if ((path_features->tx_offloads & req_features.tx_offloads) !=
 				req_features.tx_offloads)
drivers/net/intel/idpf/idpf_common_device.h +10 -0
index c32dcfbb12..eff04a83eb 100644
@@ -75,6 +75,15 @@ enum idpf_rx_func_type {
 	IDPF_RX_MAX
 };
 
+enum idpf_tx_func_type {
+	IDPF_TX_DEFAULT,
+	IDPF_TX_SINGLEQ,
+	IDPF_TX_SINGLEQ_AVX2,
+	IDPF_TX_AVX512,
+	IDPF_TX_SINGLEQ_AVX512,
+	IDPF_TX_MAX
+};
+
 struct idpf_adapter {
 	struct idpf_hw hw;
 	struct virtchnl2_version_info virtchnl_version;
@@ -92,6 +101,7 @@ struct idpf_adapter {
 	uint64_t time_hw;
 
 	enum idpf_rx_func_type rx_func_type;
+	enum idpf_tx_func_type tx_func_type;
 };
 
 struct idpf_chunks_info {
drivers/net/intel/idpf/idpf_common_rxtx.c +49 -0

52 lines not on this page · raw message

drivers/net/intel/idpf/idpf_common_rxtx.h +12 -0
index 3bc3323af4..7c6ff5d047 100644
@@ -106,6 +106,17 @@
 		RTE_ETH_RX_OFFLOAD_SCATTER)
 #define IDPF_RX_VECTOR_OFFLOADS 0
 
+#define IDPF_TX_SCALAR_OFFLOADS (		\
+		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_TCP_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_TCP_TSO |	\
+		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |	\
+		RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
+
+#define IDPF_TX_VECTOR_OFFLOADS RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE
+
 struct idpf_rx_stats {
 	RTE_ATOMIC(uint64_t) mbuf_alloc_failed;
 };
@@ -264,5 +275,6 @@ uint16_t idpf_dp_singleq_xmit_pkts_avx2(void *tx_queue,
 					uint16_t nb_pkts);
 
 extern const struct ci_rx_path_info idpf_rx_path_infos[IDPF_RX_MAX];
+extern const struct ci_tx_path_info idpf_tx_path_infos[IDPF_TX_MAX];
 
 #endif /* _IDPF_COMMON_RXTX_H_ */
drivers/net/intel/idpf/idpf_rxtx.c +31 -81

128 lines not on this page · raw message

drivers/net/intel/idpf/idpf_rxtx_vec_common.h +0 -10
index ecdf2f0e23..425f0792a1 100644
@@ -23,13 +23,6 @@
 		RTE_ETH_RX_OFFLOAD_TCP_CKSUM |	\
 		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |	\
 		RTE_ETH_RX_OFFLOAD_TIMESTAMP)
-#define IDPF_TX_NO_VECTOR_FLAGS (		\
-		RTE_ETH_TX_OFFLOAD_TCP_TSO |	\
-		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |	\
-		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |	\
-		RTE_ETH_TX_OFFLOAD_TCP_CKSUM)
 
 static inline int
 idpf_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
@@ -74,9 +67,6 @@ idpf_tx_vec_queue_default(struct ci_tx_queue *txq)
 	    (txq->tx_rs_thresh & 3) != 0)
 		return IDPF_SCALAR_PATH;
 
-	if ((txq->offloads & IDPF_TX_NO_VECTOR_FLAGS) != 0)
-		return IDPF_SCALAR_PATH;
-
 	return IDPF_VECTOR_PATH;
 }
 
Signature · 1 line
2.43.0
#14 lore raw

PATCH 9/13 net/cpfl: use common Tx path selection infrastructure

In reply to Ciara Loftus

Replace the existing complicated logic with the use of the common function.

---
 drivers/net/intel/cpfl/cpfl_rxtx.c            | 114 +++++-------------
 drivers/net/intel/cpfl/cpfl_rxtx_vec_common.h |  10 --
 2 files changed, 32 insertions(+), 92 deletions(-)
drivers/net/intel/cpfl/cpfl_rxtx.c +32 -82
index 453ec975d5..2bf66159b5 100644
@@ -1462,97 +1462,47 @@ cpfl_set_tx_function(struct rte_eth_dev *dev)
 	struct cpfl_vport *cpfl_vport = dev->data->dev_private;
 	struct idpf_vport *vport = &cpfl_vport->base;
 #ifdef RTE_ARCH_X86
-	enum rte_vect_max_simd tx_simd_width = RTE_VECT_SIMD_DISABLED;
 #ifdef CC_AVX512_SUPPORT
-	struct cpfl_tx_queue *cpfl_txq;
+	struct ci_tx_queue *txq;
 	int i;
 #endif /* CC_AVX512_SUPPORT */
-
-	if (cpfl_tx_vec_dev_check_default(dev) == CPFL_VECTOR_PATH &&
-	    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
-		vport->tx_vec_allowed = true;
-		tx_simd_width = cpfl_get_max_simd_bitwidth();
-#ifdef CC_AVX512_SUPPORT
-		if (tx_simd_width == RTE_VECT_SIMD_512) {
-			for (i = 0; i < dev->data->nb_tx_queues; i++) {
-				cpfl_txq = dev->data->tx_queues[i];
-				idpf_qc_tx_vec_avx512_setup(&cpfl_txq->base);
-			}
-		}
-#else
-		PMD_DRV_LOG(NOTICE,
-			    "AVX512 is not supported in build env");
-#endif /* CC_AVX512_SUPPORT */
-	} else {
-		vport->tx_vec_allowed = false;
-	}
 #endif /* RTE_ARCH_X86 */
+	struct idpf_adapter *ad = vport->adapter;
+	struct ci_tx_path_features req_features = {
+		.tx_offloads = dev->data->dev_conf.txmode.offloads,
+		.simd_width = RTE_VECT_SIMD_DISABLED,
+		.extra.single_queue = (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SINGLE)
+	};
 
 #ifdef RTE_ARCH_X86
-	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
-		if (vport->tx_vec_allowed) {
+	if (cpfl_tx_vec_dev_check_default(dev) == CPFL_VECTOR_PATH)
+		req_features.simd_width = cpfl_get_max_simd_bitwidth();
+#endif
+
+	ad->tx_func_type = ci_tx_path_select(req_features,
+					&idpf_tx_path_infos[0],
+					IDPF_TX_MAX,
+					IDPF_TX_DEFAULT);
+
+	dev->tx_pkt_burst = idpf_tx_path_infos[ad->tx_func_type].pkt_burst;
+	dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+	PMD_DRV_LOG(NOTICE, "Using %s Tx (port %d).",
+			idpf_tx_path_infos[ad->tx_func_type].info, dev->data->port_id);
+
+#ifdef RTE_ARCH_X86
+	if (idpf_tx_path_infos[ad->tx_func_type].features.simd_width >= RTE_VECT_SIMD_256 &&
+			idpf_tx_path_infos[ad->tx_func_type].features.extra.single_queue) {
 #ifdef CC_AVX512_SUPPORT
-			if (tx_simd_width == RTE_VECT_SIMD_512) {
-				PMD_DRV_LOG(NOTICE,
-					    "Using Split AVX512 Vector Tx (port %d).",
-					    dev->data->port_id);
-				dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts_avx512;
-				dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-				return;
-			}
-#endif /* CC_AVX512_SUPPORT */
+		for (i = 0; i < dev->data->nb_tx_queues; i++) {
+			txq = dev->data->tx_queues[i];
+			if (txq == NULL)
+				continue;
+			if (idpf_tx_path_infos[ad->tx_func_type].features.simd_width ==
+					RTE_VECT_SIMD_512)
+				idpf_qc_tx_vec_avx512_setup(txq);
 		}
-		PMD_DRV_LOG(NOTICE,
-			    "Using Split Scalar Tx (port %d).",
-			    dev->data->port_id);
-		dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts;
-		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-	} else {
-		if (vport->tx_vec_allowed) {
-#ifdef CC_AVX512_SUPPORT
-			if (tx_simd_width == RTE_VECT_SIMD_512) {
-				for (i = 0; i < dev->data->nb_tx_queues; i++) {
-					cpfl_txq = dev->data->tx_queues[i];
-					if (cpfl_txq == NULL)
-						continue;
-					idpf_qc_tx_vec_avx512_setup(&cpfl_txq->base);
-				}
-				PMD_DRV_LOG(NOTICE,
-					    "Using Single AVX512 Vector Tx (port %d).",
-					    dev->data->port_id);
-				dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts_avx512;
-				dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-				return;
-			}
 #endif /* CC_AVX512_SUPPORT */
-			if (tx_simd_width == RTE_VECT_SIMD_256) {
-				PMD_DRV_LOG(NOTICE,
-						"Using Single AVX2 Vector Tx (port %d).",
-						dev->data->port_id);
-				dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts_avx2;
-				dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-				return;
-			}
-		}
-		PMD_DRV_LOG(NOTICE,
-			    "Using Single Scalar Tx (port %d).",
-			    dev->data->port_id);
-		dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts;
-		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-	}
-#else
-	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
-		PMD_DRV_LOG(NOTICE,
-			    "Using Split Scalar Tx (port %d).",
-			    dev->data->port_id);
-		dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts;
-		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-	} else {
-		PMD_DRV_LOG(NOTICE,
-			    "Using Single Scalar Tx (port %d).",
-			    dev->data->port_id);
-		dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts;
-		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+		vport->tx_vec_allowed = true;
 	}
 #endif /* RTE_ARCH_X86 */
 }
drivers/net/intel/cpfl/cpfl_rxtx_vec_common.h +0 -10
index 525ca9a6e0..f0daa1eb30 100644
@@ -23,13 +23,6 @@
 		RTE_ETH_RX_OFFLOAD_TCP_CKSUM |	\
 		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |	\
 		RTE_ETH_RX_OFFLOAD_TIMESTAMP)
-#define CPFL_TX_NO_VECTOR_FLAGS (		\
-		RTE_ETH_TX_OFFLOAD_TCP_TSO |	\
-		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |	\
-		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |	\
-		RTE_ETH_TX_OFFLOAD_TCP_CKSUM)
 
 static inline int
 cpfl_rx_vec_queue_default(struct idpf_rx_queue *rxq)
@@ -62,9 +55,6 @@ cpfl_tx_vec_queue_default(struct ci_tx_queue *txq)
 	    (txq->tx_rs_thresh & 3) != 0)
 		return CPFL_SCALAR_PATH;
 
-	if ((txq->offloads & CPFL_TX_NO_VECTOR_FLAGS) != 0)
-		return CPFL_SCALAR_PATH;
-
 	return CPFL_VECTOR_PATH;
 }
 
Signature · 1 line
2.43.0
#15 lore raw

PATCH 10/13 docs: fix TSO and checksum offload feature status in ice doc

In reply to Ciara Loftus

TSO is only supported on the scalar path so change its status to partially supported. L3 and L4 checksum offload are enabled on scalar and vector paths so change their statuses from partial to supported.

Fixes f88de4694d94 ("net/ice: support Tx SSE vector")
---
 doc/guides/nics/features/ice.ini | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
doc/guides/nics/features/ice.ini +3 -3
index e9796c1eab..893d09e9ec 100644
@@ -21,7 +21,7 @@ Power mgmt address monitor = Y
 MTU update           = Y
 Buffer split on Rx   = P
 Scattered Rx         = Y
-TSO                  = Y
+TSO                  = P
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 DCB                  = Y
@@ -34,8 +34,8 @@ Traffic manager      = Y
 CRC offload          = Y
 VLAN offload         = Y
 QinQ offload         = P
-L3 checksum offload  = P
-L4 checksum offload  = P
+L3 checksum offload  = Y
+L4 checksum offload  = Y
 Timestamp offload    = P
 Inner L3 checksum    = P
 Inner L4 checksum    = P
Signature · 1 line
2.43.0
Acked-by on v1 10/13
#16 lore raw

Re: [PATCH 10/13] docs: fix TSO and checksum offload feature status in ice doc

Quoted 9 lines · Ciara Loftus

TSO is only supported on the scalar path so change its status to partially supported. L3 and L4 checksum offload are enabled on scalar and vector paths so change their statuses from partial to supported.

Fixes f88de4694d94 ("net/ice: support Tx SSE vector")

---

I still think we need a better solution for items only supported on scalar paths, but until then let's keep the current scheme.

Quoted 30 lines
 doc/guides/nics/features/ice.ini | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
doc/guides/nics/features/ice.ini +3 -3
index e9796c1eab..893d09e9ec 100644
@@ -21,7 +21,7 @@ Power mgmt address monitor = Y
 MTU update           = Y
 Buffer split on Rx   = P
 Scattered Rx         = Y
-TSO                  = Y
+TSO                  = P
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 DCB                  = Y
@@ -34,8 +34,8 @@ Traffic manager      = Y
 CRC offload          = Y
 VLAN offload         = Y
 QinQ offload         = P
-L3 checksum offload  = P
-L4 checksum offload  = P
+L3 checksum offload  = Y
+L4 checksum offload  = Y
 Timestamp offload    = P
 Inner L3 checksum    = P
 Inner L4 checksum    = P
Signature · 1 line
2.43.0
#17 lore raw

PATCH 11/13 docs: fix TSO feature status in iavf driver documentation

In reply to Ciara Loftus

TSO is only supported on the scalar path so change the status to partially supported.

Fixes 319c421f3890 ("net/avf: enable SSE Rx Tx")
---
 doc/guides/nics/features/iavf.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/guides/nics/features/iavf.ini +1 -1
index 7695e3ff7c..6c9e97594f 100644
@@ -17,7 +17,7 @@ Burst mode info      = Y
 Power mgmt address monitor = Y
 MTU update           = Y
 Scattered Rx         = Y
-TSO                  = Y
+TSO                  = P
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
Signature · 1 line
2.43.0
Acked-by on v1 11/13
#18 lore raw

Re: [PATCH 11/13] docs: fix TSO feature status in iavf driver documentation

Quoted 8 lines · Ciara Loftus

TSO is only supported on the scalar path so change the status to partially supported.

Fixes 319c421f3890 ("net/avf: enable SSE Rx Tx")

---

Quoted 19 lines
 doc/guides/nics/features/iavf.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/guides/nics/features/iavf.ini +1 -1
index 7695e3ff7c..6c9e97594f 100644
@@ -17,7 +17,7 @@ Burst mode info      = Y
 Power mgmt address monitor = Y
 MTU update           = Y
 Scattered Rx         = Y
-TSO                  = Y
+TSO                  = P
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
Signature · 1 line
2.43.0
#19 lore raw

PATCH 12/13 docs: fix inline crypto feature status in iavf driver doc

In reply to Ciara Loftus

inline crypto is only supported on the scalar path so change its status to partially supported.

Fixes 6bc987ecb860 ("net/iavf: support IPsec inline crypto")
---
 doc/guides/nics/features/iavf.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/guides/nics/features/iavf.ini +1 -1
index 6c9e97594f..0ba6f7dfd7 100644
@@ -27,7 +27,7 @@ RSS key update       = Y
 RSS reta update      = Y
 VLAN filter          = Y
 Traffic manager      = Y
-Inline crypto        = Y
+Inline crypto        = P
 CRC offload          = Y
 VLAN offload         = P
 QinQ offload         = P
Signature · 1 line
2.43.0
Acked-by on v1 12/13
#20 lore raw

Re: [PATCH 12/13] docs: fix inline crypto feature status in iavf driver doc

Quoted 7 lines · Ciara Loftus

inline crypto is only supported on the scalar path so change its status to partially supported.

Fixes 6bc987ecb860 ("net/iavf: support IPsec inline crypto")
Quoted 20 lines
---
 doc/guides/nics/features/iavf.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/guides/nics/features/iavf.ini +1 -1
index 6c9e97594f..0ba6f7dfd7 100644
@@ -27,7 +27,7 @@ RSS key update       = Y
 RSS reta update      = Y
 VLAN filter          = Y
 Traffic manager      = Y
-Inline crypto        = Y
+Inline crypto        = P
 CRC offload          = Y
 VLAN offload         = P
 QinQ offload         = P
Signature · 1 line
2.43.0
#21 lore raw

PATCH 13/13 docs: fix TSO feature status in i40e driver documentation

In reply to Ciara Loftus

TSO is only supported on the scalar path so change the status to partially supported.

Fixes 9ed94e5bb04e ("i40e: add vector Rx")
---
 doc/guides/nics/features/i40e.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/guides/nics/features/i40e.ini +1 -1
index 4610444ace..fb00b69830 100644
@@ -16,7 +16,7 @@ Runtime Tx queue setup = Y
 Burst mode info      = Y
 Power mgmt address monitor = Y
 Scattered Rx         = Y
-TSO                  = Y
+TSO                  = P
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
Signature · 1 line
2.43.0
Acked-by on v1 13/13
#22 lore raw

Re: [PATCH 13/13] docs: fix TSO feature status in i40e driver documentation

Quoted 8 lines · Ciara Loftus

TSO is only supported on the scalar path so change the status to partially supported.

Fixes 9ed94e5bb04e ("i40e: add vector Rx")

---

Quoted 19 lines
 doc/guides/nics/features/i40e.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/guides/nics/features/i40e.ini +1 -1
index 4610444ace..fb00b69830 100644
@@ -16,7 +16,7 @@ Runtime Tx queue setup = Y
 Burst mode info      = Y
 Power mgmt address monitor = Y
 Scattered Rx         = Y
-TSO                  = Y
+TSO                  = P
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
Signature · 1 line
2.43.0
#23 lore raw

v2 cover net/intel: tx path selection simplification

In reply to Ciara Loftus

This series aims to simplify the process of selecting a Tx burst function for the Intel drivers i40e, iavf, ice, idpf and cpfl by:
1. enforcing the same tx burst function for both primary and secondary processes.
2. using a common function for selecting the tx burst function based on maximum SIMD width, function features (context descriptor, single queue, etc.) and requested tx offloads.

Some fixes are made to errors in the documentation that became evident while implementing the new selection infratructure in each driver.

v2:
* Consolidated the patches that enforce primary/secondary path selection alignment and the introduction of the infrastructure per driver.
* Introduce the "simple tx" feature in patch 1 rather than later.
* Changed some types and arrangements of structs in tx.h
* Fixed some issues relating to mbuf_check and tx_pkt_prepare
* Use the same path in primary and secondary for idpf and cpfl as well.

Ciara Loftus (10):
net/intel: introduce infrastructure for Tx path selection net/ice: use common Tx path selection infrastructure net/iavf: use common Tx path selection infrastructure net/i40e: use common Tx path selection infrastructure net/idpf: use common Tx path selection infrastructure net/cpfl: use common Tx path selection infrastructure
docs: fix TSO and checksum offload feature status in ice doc
docs: fix TSO feature status in iavf driver documentation
docs: fix inline crypto feature status in iavf driver doc
docs: fix TSO feature status in i40e driver documentation

 doc/guides/nics/features/i40e.ini             |   2 +-
 doc/guides/nics/features/iavf.ini             |   4 +-
 doc/guides/nics/features/ice.ini              |   6 +-
 drivers/net/intel/common/tx.h                 |  96 +++++++
 drivers/net/intel/cpfl/cpfl_rxtx.c            | 120 +++------
 drivers/net/intel/cpfl/cpfl_rxtx_vec_common.h |  10 -
 drivers/net/intel/i40e/i40e_ethdev.h          |  14 +-
 drivers/net/intel/i40e/i40e_rxtx.c            | 190 +++++++-------
 drivers/net/intel/i40e/i40e_rxtx.h            |  20 +-
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |   6 -
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |   6 -
 drivers/net/intel/i40e/i40e_rxtx_vec_sse.c    |   6 -
 drivers/net/intel/iavf/iavf.h                 |   2 -
 drivers/net/intel/iavf/iavf_ethdev.c          |   9 +-
 drivers/net/intel/iavf/iavf_rxtx.c            | 240 +++++++++---------
 drivers/net/intel/iavf/iavf_rxtx.h            |  46 ++--
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h |  39 +--
 drivers/net/intel/ice/ice_ethdev.c            |   1 +
 drivers/net/intel/ice/ice_ethdev.h            |  14 +-
 drivers/net/intel/ice/ice_rxtx.c              | 204 ++++++++-------
 drivers/net/intel/ice/ice_rxtx.h              |  30 ++-
 drivers/net/intel/ice/ice_rxtx_vec_common.h   |  35 +--
 drivers/net/intel/ice/ice_rxtx_vec_sse.c      |   6 -
 drivers/net/intel/idpf/idpf_common_device.h   |  12 +-
 drivers/net/intel/idpf/idpf_common_rxtx.c     |  49 ++++
 drivers/net/intel/idpf/idpf_common_rxtx.h     |  12 +
 drivers/net/intel/idpf/idpf_rxtx.c            | 118 +++------
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |  10 -
 28 files changed, 675 insertions(+), 632 deletions(-)
Signature · 1 line
2.43.0
#24 lore raw

PATCH v2 1/10 net/intel: introduce infrastructure for Tx path selection

The code for determining which Tx path to select during initialisation has become complicated in many intel drivers due to the amount of different paths and features available within each path. This commit aims to simplify and genericize the path selection logic.

The following information about each Tx burst function is stored and used by the new common function to select the appropriate Tx path:
- Tx Offloads
- SIMD bitwidth
- "Simple" Tx

The implementation is based off the Rx path selection infrastructure introduced in a previous commit.

---
v2:
* Change req_features to pointer instead of passing by value
* Change num_paths from int to size_t
* Change i from int to unsigned int and define it inside the for statement.
* Remove ci_tx_path_features_extra substructure
* Add simple tx feature in this patch rather in a later patch when it is first used by a driver.

---
 drivers/net/intel/common/tx.h | 77 +++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
drivers/net/intel/common/tx.h +77 -0
index 5af64a4cfe..04d9aa8473 100644
@@ -8,6 +8,7 @@
 #include <stdint.h>
 #include <rte_mbuf.h>
 #include <rte_ethdev.h>
+#include <rte_vect.h>
 
 /* forward declaration of the common intel (ci) queue structure */
 struct ci_tx_queue;
@@ -117,6 +118,19 @@ struct ci_tx_queue {
 	};
 };
 
+struct ci_tx_path_features {
+	uint32_t tx_offloads;
+	enum rte_vect_max_simd simd_width;
+	bool simple_tx;
+};
+
+struct ci_tx_path_info {
+	eth_tx_burst_t pkt_burst;
+	const char *info;
+	struct ci_tx_path_features features;
+	eth_tx_prep_t pkt_prep;
+};
+
 static __rte_always_inline void
 ci_tx_backlog_entry(struct ci_tx_entry *txep, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
@@ -262,4 +276,67 @@ ci_txq_release_all_mbufs(struct ci_tx_queue *txq, bool use_ctx)
 	memset(txq->sw_ring_vec, 0, sizeof(txq->sw_ring_vec[0]) * nb_desc);
 }
 
+/**
+ * Select the best matching Tx path based on features
+ *
+ * @param req_features
+ *   The requested features for the Tx path
+ * @param infos
+ *   Array of information about the available Tx paths
+ * @param num_paths
+ *   Number of available paths in the infos array
+ * @param default_path
+ *   Index of the default path to use if no suitable path is found
+ *
+ * @return
+ *   The packet burst function index that best matches the requested features,
+ *   or default_path if no suitable path is found
+ */
+static inline int
+ci_tx_path_select(const struct ci_tx_path_features *req_features,
+			const struct ci_tx_path_info *infos,
+			size_t num_paths,
+			int default_path)
+{
+	int idx = default_path;
+	const struct ci_tx_path_features *chosen_path_features = NULL;
+
+	for (unsigned int i = 0; i < num_paths; i++) {
+		const struct ci_tx_path_features *path_features = &infos[i].features;
+
+		/* Do not use a simple tx path if not requested. */
+		if (path_features->simple_tx && !req_features->simple_tx)
+			continue;
+
+		/* Ensure the path supports the requested TX offloads. */
+		if ((path_features->tx_offloads & req_features->tx_offloads) !=
+				req_features->tx_offloads)
+			continue;
+
+		/* Ensure the path's SIMD width is compatible with the requested width. */
+		if (path_features->simd_width > req_features->simd_width)
+			continue;
+
+		/* Do not select the path if it is less suitable than the chosen path. */
+		if (chosen_path_features != NULL) {
+			/* Do not select paths with lower SIMD width than the chosen path. */
+			if (path_features->simd_width < chosen_path_features->simd_width)
+				continue;
+			/* Do not select paths with more offloads enabled than the chosen path if
+			 * the SIMD widths are the same.
+			 */
+			if (path_features->simd_width == chosen_path_features->simd_width &&
+					rte_popcount32(path_features->tx_offloads) >
+					rte_popcount32(chosen_path_features->tx_offloads))
+				continue;
+		}
+
+		/* Finally, select the path since it has met all the requirements. */
+		idx = i;
+		chosen_path_features = &infos[idx].features;
+	}
+
+	return idx;
+}
+
 #endif /* _COMMON_INTEL_TX_H_ */
Signature · 1 line
2.43.0
#25 lore raw

PATCH v2 2/10 net/ice: use common Tx path selection infrastructure

In reply to Ciara Loftus

Replace the existing complicated logic with the use of the common function. Also let the primary process select the Tx path to be used by all processes using the given device.

---
v2:
* Fixed mbuf_check function
* Merged the patch which consolidates path selection among process types with the introduction of the new infrastructure.

---
 drivers/net/intel/ice/ice_ethdev.c          |   1 +
 drivers/net/intel/ice/ice_ethdev.h          |  14 +-
 drivers/net/intel/ice/ice_rxtx.c            | 204 ++++++++++----------
 drivers/net/intel/ice/ice_rxtx.h            |  30 ++-
 drivers/net/intel/ice/ice_rxtx_vec_common.h |  35 +---
 drivers/net/intel/ice/ice_rxtx_vec_sse.c    |   6 -
 6 files changed, 142 insertions(+), 148 deletions(-)
drivers/net/intel/ice/ice_ethdev.c +1 -0
index c721d135f5..a805e78d03 100644
@@ -3900,6 +3900,7 @@ ice_dev_configure(struct rte_eth_dev *dev)
 	ad->tx_simple_allowed = true;
 
 	ad->rx_func_type = ICE_RX_DEFAULT;
+	ad->tx_func_type = ICE_TX_DEFAULT;
 
 	if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
 		dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
drivers/net/intel/ice/ice_ethdev.h +11 -3
index 72ed65f13b..7fa2db1bd2 100644
@@ -208,6 +208,16 @@ enum ice_rx_func_type {
 	ICE_RX_AVX512_SCATTERED_OFFLOAD,
 };
 
+enum ice_tx_func_type {
+	ICE_TX_DEFAULT,
+	ICE_TX_SIMPLE,
+	ICE_TX_SSE,
+	ICE_TX_AVX2,
+	ICE_TX_AVX2_OFFLOAD,
+	ICE_TX_AVX512,
+	ICE_TX_AVX512_OFFLOAD,
+};
+
 struct ice_adapter;
 
 /**
@@ -658,14 +668,13 @@ struct ice_adapter {
 	bool tx_vec_allowed;
 	bool tx_simple_allowed;
 	enum ice_rx_func_type rx_func_type;
+	enum ice_tx_func_type tx_func_type;
 	/* ptype mapping table */
 	alignas(RTE_CACHE_LINE_MIN_SIZE) uint32_t ptype_tbl[ICE_MAX_PKT_TYPE];
 	bool is_safe_mode;
 	struct ice_devargs devargs;
 	enum ice_pkg_type active_pkg_type; /* loaded ddp package type */
 	uint16_t fdir_ref_cnt;
-	/* For vector PMD */
-	eth_rx_burst_t tx_pkt_burst;
 	/* For PTP */
 	uint8_t ptp_tx_block;
 	uint8_t ptp_tx_index;
@@ -679,7 +688,6 @@ struct ice_adapter {
 	/* Set bit if the engine is disabled */
 	unsigned long disabled_engine_mask;
 	struct ice_parser *psr;
-	enum rte_vect_max_simd tx_simd_width;
 	bool rx_vec_offload_support;
 };
 
drivers/net/intel/ice/ice_rxtx.c +99 -105

241 lines not on this page · raw message

drivers/net/intel/ice/ice_rxtx.h +29 -1
index 141a62a7da..d7e8c1b0c4 100644
@@ -108,6 +108,35 @@
 		RTE_ETH_RX_OFFLOAD_VLAN_FILTER |\
 		RTE_ETH_RX_OFFLOAD_RSS_HASH)
 
+/* basic scalar path */
+#define ICE_TX_SCALAR_OFFLOADS (		\
+	RTE_ETH_TX_OFFLOAD_VLAN_INSERT |	\
+	RTE_ETH_TX_OFFLOAD_TCP_TSO |		\
+	RTE_ETH_TX_OFFLOAD_MULTI_SEGS |		\
+	RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE |	\
+	RTE_ETH_TX_OFFLOAD_QINQ_INSERT |	\
+	RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_UDP_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_TCP_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |	\
+	RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM |	\
+	RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |	\
+	RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO |	\
+	RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO |	\
+	RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO |	\
+	RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP)
+/* basic vector path */
+#define ICE_TX_VECTOR_OFFLOADS RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE
+/* vector offload paths */
+#define ICE_TX_VECTOR_OFFLOAD_OFFLOADS (	\
+	ICE_TX_VECTOR_OFFLOADS |		\
+	RTE_ETH_TX_OFFLOAD_VLAN_INSERT |	\
+	RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_UDP_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_TCP_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_SCTP_CKSUM)
+
 /* Max header size can be 2K - 64 bytes */
 #define ICE_RX_HDR_BUF_SIZE    (2048 - 64)
 
@@ -249,7 +278,6 @@ void ice_select_rxd_to_pkt_fields_handler(struct ci_rx_queue *rxq,
 int ice_rx_vec_dev_check(struct rte_eth_dev *dev);
 int ice_tx_vec_dev_check(struct rte_eth_dev *dev);
 int ice_rxq_vec_setup(struct ci_rx_queue *rxq);
-int ice_txq_vec_setup(struct ci_tx_queue *txq);
 uint16_t ice_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 			   uint16_t nb_pkts);
 uint16_t ice_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
drivers/net/intel/ice/ice_rxtx_vec_common.h +2 -33
index 39581cb7ae..ff46a8fb49 100644
@@ -51,28 +51,6 @@ _ice_rx_queue_release_mbufs_vec(struct ci_rx_queue *rxq)
 	memset(rxq->sw_ring, 0, sizeof(rxq->sw_ring[0]) * rxq->nb_rx_desc);
 }
 
-#define ICE_TX_NO_VECTOR_FLAGS (			\
-		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |		\
-		RTE_ETH_TX_OFFLOAD_QINQ_INSERT |	\
-		RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |	\
-		RTE_ETH_TX_OFFLOAD_TCP_TSO |	\
-		RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |    \
-		RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO |    \
-		RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO |    \
-		RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO |    \
-		RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM |	\
-		RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP)
-
-#define ICE_TX_VECTOR_OFFLOAD (				\
-		RTE_ETH_TX_OFFLOAD_VLAN_INSERT |		\
-		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_TCP_CKSUM)
-
-#define ICE_VECTOR_PATH		0
-#define ICE_VECTOR_OFFLOAD_PATH	1
-
 static inline int
 ice_rx_vec_queue_default(struct ci_rx_queue *rxq)
 {
@@ -98,13 +76,7 @@ ice_tx_vec_queue_default(struct ci_tx_queue *txq)
 	    txq->tx_rs_thresh > ICE_TX_MAX_FREE_BUF_SZ)
 		return -1;
 
-	if (txq->offloads & ICE_TX_NO_VECTOR_FLAGS)
-		return -1;
-
-	if (txq->offloads & ICE_TX_VECTOR_OFFLOAD)
-		return ICE_VECTOR_OFFLOAD_PATH;
-
-	return ICE_VECTOR_PATH;
+	return 0;
 }
 
 static inline int
@@ -130,18 +102,15 @@ ice_tx_vec_dev_check_default(struct rte_eth_dev *dev)
 	int i;
 	struct ci_tx_queue *txq;
 	int ret = 0;
-	int result = 0;
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
 		txq = dev->data->tx_queues[i];
 		ret = ice_tx_vec_queue_default(txq);
 		if (ret < 0)
 			return -1;
-		if (ret == ICE_VECTOR_OFFLOAD_PATH)
-			result = ret;
 	}
 
-	return result;
+	return ret;
 }
 
 static inline void
drivers/net/intel/ice/ice_rxtx_vec_sse.c +0 -6
index 1545bc3b6e..4fc1b7e881 100644
@@ -718,12 +718,6 @@ ice_rxq_vec_setup(struct ci_rx_queue *rxq)
 	return 0;
 }
 
-int __rte_cold
-ice_txq_vec_setup(struct ci_tx_queue *txq __rte_unused)
-{
-	return 0;
-}
-
 int __rte_cold
 ice_rx_vec_dev_check(struct rte_eth_dev *dev)
 {
Signature · 1 line
2.43.0
#26 lore raw

PATCH v2 3/10 net/iavf: use common Tx path selection infrastructure

In reply to Ciara Loftus

Replace the existing complicated logic with the use of the common function. Let the primary process select the Tx path to be used by all processes using the given device.

Introduce two new features "disabled" and "context desc" to the common infrastructure which represents whether or not the path is disabled, or if it uses a context descriptor.

---
v2:
* Merged the patch which consolidates path selection among process types with the introduction of the new infrastructure.

---
 drivers/net/intel/common/tx.h                 |  14 +
 drivers/net/intel/iavf/iavf.h                 |   2 -
 drivers/net/intel/iavf/iavf_ethdev.c          |   9 +-
 drivers/net/intel/iavf/iavf_rxtx.c            | 240 +++++++++---------
 drivers/net/intel/iavf/iavf_rxtx.h            |  46 ++--
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h |  39 +--
 6 files changed, 166 insertions(+), 184 deletions(-)
drivers/net/intel/common/tx.h +14 -0
index 04d9aa8473..60b1bd642a 100644
@@ -122,6 +122,8 @@ struct ci_tx_path_features {
 	uint32_t tx_offloads;
 	enum rte_vect_max_simd simd_width;
 	bool simple_tx;
+	bool ctx_desc;
+	bool disabled;
 };
 
 struct ci_tx_path_info {
@@ -304,10 +306,18 @@ ci_tx_path_select(const struct ci_tx_path_features *req_features,
 	for (unsigned int i = 0; i < num_paths; i++) {
 		const struct ci_tx_path_features *path_features = &infos[i].features;
 
+		/* Do not select a disabled tx path. */
+		if (path_features->disabled)
+			continue;
+
 		/* Do not use a simple tx path if not requested. */
 		if (path_features->simple_tx && !req_features->simple_tx)
 			continue;
 
+		/* If a context descriptor is requested, ensure the path supports it. */
+		if (!path_features->ctx_desc && req_features->ctx_desc)
+			continue;
+
 		/* Ensure the path supports the requested TX offloads. */
 		if ((path_features->tx_offloads & req_features->tx_offloads) !=
 				req_features->tx_offloads)
@@ -329,6 +339,10 @@ ci_tx_path_select(const struct ci_tx_path_features *req_features,
 					rte_popcount32(path_features->tx_offloads) >
 					rte_popcount32(chosen_path_features->tx_offloads))
 				continue;
+
+			/* Don't use a context descriptor unless necessary */
+			if (path_features->ctx_desc && !chosen_path_features->ctx_desc)
+				continue;
 		}
 
 		/* Finally, select the path since it has met all the requirements. */
drivers/net/intel/iavf/iavf.h +0 -2
index d78582e05c..921bf0a607 100644
@@ -375,8 +375,6 @@ struct iavf_adapter {
 	struct iavf_security_ctx *security_ctx;
 
 	bool rx_bulk_alloc_allowed;
-	/* For vector PMD */
-	bool tx_vec_allowed;
 	alignas(RTE_CACHE_LINE_MIN_SIZE) uint32_t ptype_tbl[IAVF_MAX_PKT_TYPE];
 	bool stopped;
 	bool closed;
drivers/net/intel/iavf/iavf_ethdev.c +3 -6
index 15e49fe248..bf1186c20f 100644
@@ -666,10 +666,8 @@ iavf_dev_configure(struct rte_eth_dev *dev)
 		return -EIO;
 
 	ad->rx_bulk_alloc_allowed = true;
-	/* Initialize to TRUE. If any of Rx queues doesn't meet the
-	 * vector Rx/Tx preconditions, it will be reset.
-	 */
-	ad->tx_vec_allowed = true;
+
+	ad->tx_func_type = IAVF_TX_DEFAULT;
 
 	if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
 		dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
@@ -2795,8 +2793,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
 	eth_dev->tx_pkt_prepare = &iavf_prep_pkts;
 
 	/* For secondary processes, we don't initialise any further as primary
-	 * has already done this work. Only check if we need a different RX
-	 * and TX function.
+	 * has already done this work.
 	 */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
 		iavf_set_rx_function(eth_dev);
drivers/net/intel/iavf/iavf_rxtx.c +115 -125

305 lines not on this page · raw message

drivers/net/intel/iavf/iavf_rxtx.h +31 -15

53 lines not on this page · raw message

drivers/net/intel/iavf/iavf_rxtx_vec_common.h +3 -36
index 66f65b46e9..f1ea57034f 100644
@@ -73,8 +73,6 @@ iavf_rx_vec_queue_default(struct ci_rx_queue *rxq)
 static inline int
 iavf_tx_vec_queue_default(struct ci_tx_queue *txq)
 {
-	bool vlan_offload = false, vlan_needs_ctx = false;
-
 	if (!txq)
 		return -1;
 
@@ -82,35 +80,7 @@ iavf_tx_vec_queue_default(struct ci_tx_queue *txq)
 	    txq->tx_rs_thresh > IAVF_VPMD_TX_MAX_FREE_BUF)
 		return -1;
 
-	if (txq->offloads & IAVF_TX_NO_VECTOR_FLAGS)
-		return -1;
-
-	if (rte_pmd_iavf_tx_lldp_dynfield_offset > 0) {
-		txq->use_ctx = 1;
-		return IAVF_VECTOR_CTX_PATH;
-	}
-
-	/* Vlan tci needs to be inserted via ctx desc, if the vlan_flag is L2TAG2. */
-	if (txq->offloads & RTE_ETH_TX_OFFLOAD_VLAN_INSERT) {
-		vlan_offload = true;
-		if (txq->vlan_flag == IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2)
-			vlan_needs_ctx = true;
-	}
-
-	/**
-	 * Tunneling parameters and other fields need be configured in ctx desc
-	 * if the outer checksum offload is enabled.
-	 */
-	if (txq->offloads & (IAVF_TX_VECTOR_OFFLOAD | IAVF_TX_VECTOR_OFFLOAD_CTX) || vlan_offload) {
-		if (txq->offloads & IAVF_TX_VECTOR_OFFLOAD_CTX || vlan_needs_ctx) {
-			txq->use_ctx = 1;
-			return IAVF_VECTOR_CTX_OFFLOAD_PATH;
-		} else {
-			return IAVF_VECTOR_OFFLOAD_PATH;
-		}
-	} else {
-		return IAVF_VECTOR_PATH;
-	}
+	return 0;
 }
 
 static inline int
@@ -137,19 +107,16 @@ iavf_tx_vec_dev_check_default(struct rte_eth_dev *dev)
 	int i;
 	struct ci_tx_queue *txq;
 	int ret;
-	int result = 0;
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
 		txq = dev->data->tx_queues[i];
 		ret = iavf_tx_vec_queue_default(txq);
 
 		if (ret < 0)
-			return -1;
-		if (ret > result)
-			result = ret;
+			break;
 	}
 
-	return result;
+	return ret;
 }
 
 /******************************************************************************
Signature · 1 line
2.43.0
#27 lore raw

PATCH v2 4/10 net/i40e: use common Tx path selection infrastructure

In reply to Ciara Loftus

Replace the existing complicated logic with the use of the common function. Let the primary process select the Tx path to be used by all processes using the given device.

---
v2:
* Merged the patch which consolidates path selection among process types with the introduction of the new infrastructure.
* Fixed mbuf_check logic
* Fixed assignment of pkt_prepare function

---
 drivers/net/intel/i40e/i40e_ethdev.h          |  14 +-
 drivers/net/intel/i40e/i40e_rxtx.c            | 190 ++++++++++--------
 drivers/net/intel/i40e/i40e_rxtx.h            |  20 +-
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |   6 -
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |   6 -
 drivers/net/intel/i40e/i40e_rxtx_vec_sse.c    |   6 -
 6 files changed, 135 insertions(+), 107 deletions(-)
drivers/net/intel/i40e/i40e_ethdev.h +11 -3
index 3fca089d6c..1fe504d0cd 100644
@@ -1243,6 +1243,16 @@ enum i40e_rx_func_type {
 	I40E_RX_ALTIVEC_SCATTERED,
 };
 
+enum i40e_tx_func_type {
+	I40E_TX_DEFAULT,
+	I40E_TX_SCALAR_SIMPLE,
+	I40E_TX_SSE,
+	I40E_TX_AVX2,
+	I40E_TX_AVX512,
+	I40E_TX_NEON,
+	I40E_TX_ALTIVEC,
+};
+
 /*
  * Structure to store private data for each PF/VF instance.
  */
@@ -1260,10 +1270,10 @@ struct i40e_adapter {
 	bool tx_vec_allowed;
 
 	enum i40e_rx_func_type rx_func_type;
+	enum i40e_tx_func_type tx_func_type;
 
 	uint64_t mbuf_check; /* mbuf check flags. */
 	uint16_t max_pkt_len; /* Maximum packet length */
-	eth_tx_burst_t tx_pkt_burst;
 
 	/* For PTP */
 	struct rte_timecounter systime_tc;
@@ -1279,8 +1289,6 @@ struct i40e_adapter {
 
 	/* For RSS reta table update */
 	uint8_t rss_reta_updated;
-
-	enum rte_vect_max_simd tx_simd_width;
 };
 
 /**
drivers/net/intel/i40e/i40e_rxtx.c +105 -85

235 lines not on this page · raw message

drivers/net/intel/i40e/i40e_rxtx.h +19 -1
index b5a901794f..ed173d8f17 100644
@@ -91,6 +91,25 @@ enum i40e_header_split_mode {
 		RTE_ETH_RX_OFFLOAD_VLAN_FILTER |	\
 		RTE_ETH_RX_OFFLOAD_RSS_HASH)
 
+#define I40E_TX_SCALAR_OFFLOADS (			\
+		RTE_ETH_TX_OFFLOAD_VLAN_INSERT |	\
+		RTE_ETH_TX_OFFLOAD_QINQ_INSERT |	\
+		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
+		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |		\
+		RTE_ETH_TX_OFFLOAD_TCP_CKSUM |		\
+		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |		\
+		RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_TCP_TSO |		\
+		RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |	\
+		RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO |	\
+		RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO |	\
+		RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO |	\
+		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |		\
+		RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
+
+#define I40E_TX_VECTOR_OFFLOADS RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE
+
 /** Offload features */
 union i40e_tx_offload {
 	uint64_t data;
@@ -165,7 +184,6 @@ uint16_t i40e_recv_scattered_pkts_vec(void *rx_queue,
 				      uint16_t nb_pkts);
 int i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);
 int i40e_rxq_vec_setup(struct ci_rx_queue *rxq);
-int i40e_txq_vec_setup(struct ci_tx_queue *txq);
 void i40e_rx_queue_release_mbufs_vec(struct ci_rx_queue *rxq);
 uint16_t i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 				   uint16_t nb_pkts);
drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +0 -6
index 87a57e7520..bbb6d907cf 100644
@@ -547,12 +547,6 @@ i40e_rxq_vec_setup(struct ci_rx_queue *rxq)
 	return 0;
 }
 
-int __rte_cold
-i40e_txq_vec_setup(struct ci_tx_queue __rte_unused * txq)
-{
-	return 0;
-}
-
 int __rte_cold
 i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev)
 {
drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +0 -6
index c9098e4c1a..b5be0c1b59 100644
@@ -697,12 +697,6 @@ i40e_rxq_vec_setup(struct ci_rx_queue *rxq)
 	return 0;
 }
 
-int __rte_cold
-i40e_txq_vec_setup(struct ci_tx_queue *txq __rte_unused)
-{
-	return 0;
-}
-
 int __rte_cold
 i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev)
 {
drivers/net/intel/i40e/i40e_rxtx_vec_sse.c +0 -6
index c035408dcc..c209135890 100644
@@ -704,12 +704,6 @@ i40e_rxq_vec_setup(struct ci_rx_queue *rxq)
 	return 0;
 }
 
-int __rte_cold
-i40e_txq_vec_setup(struct ci_tx_queue *txq __rte_unused)
-{
-	return 0;
-}
-
 int __rte_cold
 i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev)
 {
Signature · 1 line
2.43.0
#28 lore raw

PATCH v2 5/10 net/idpf: use common Tx path selection infrastructure

In reply to Ciara Loftus

Replace the existing complicated logic with the use of the common function. Let the primary process select the Tx path to be used by all processes using the given device.

Introduce a new feature "single queue" to the common infrastructure which represents whether single or split queue mode is used in the given path.

---
v2:
* removed unnecessary tx_vec_allowed

---
 drivers/net/intel/common/tx.h                 |   5 +
 drivers/net/intel/idpf/idpf_common_device.h   |  10 ++
 drivers/net/intel/idpf/idpf_common_rxtx.c     |  49 ++++++++
 drivers/net/intel/idpf/idpf_common_rxtx.h     |  12 ++
 drivers/net/intel/idpf/idpf_rxtx.c            | 118 ++++++------------
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |  10 --
 6 files changed, 112 insertions(+), 92 deletions(-)
drivers/net/intel/common/tx.h +5 -0
index 60b1bd642a..24fcfbe225 100644
@@ -124,6 +124,7 @@ struct ci_tx_path_features {
 	bool simple_tx;
 	bool ctx_desc;
 	bool disabled;
+	bool single_queue;
 };
 
 struct ci_tx_path_info {
@@ -318,6 +319,10 @@ ci_tx_path_select(const struct ci_tx_path_features *req_features,
 		if (!path_features->ctx_desc && req_features->ctx_desc)
 			continue;
 
+		/* If requested, ensure the path supports single queue TX. */
+		if (path_features->single_queue != req_features->single_queue)
+			continue;
+
 		/* Ensure the path supports the requested TX offloads. */
 		if ((path_features->tx_offloads & req_features->tx_offloads) !=
 				req_features->tx_offloads)
drivers/net/intel/idpf/idpf_common_device.h +10 -0
index c32dcfbb12..eff04a83eb 100644
@@ -75,6 +75,15 @@ enum idpf_rx_func_type {
 	IDPF_RX_MAX
 };
 
+enum idpf_tx_func_type {
+	IDPF_TX_DEFAULT,
+	IDPF_TX_SINGLEQ,
+	IDPF_TX_SINGLEQ_AVX2,
+	IDPF_TX_AVX512,
+	IDPF_TX_SINGLEQ_AVX512,
+	IDPF_TX_MAX
+};
+
 struct idpf_adapter {
 	struct idpf_hw hw;
 	struct virtchnl2_version_info virtchnl_version;
@@ -92,6 +101,7 @@ struct idpf_adapter {
 	uint64_t time_hw;
 
 	enum idpf_rx_func_type rx_func_type;
+	enum idpf_tx_func_type tx_func_type;
 };
 
 struct idpf_chunks_info {
drivers/net/intel/idpf/idpf_common_rxtx.c +49 -0

52 lines not on this page · raw message

drivers/net/intel/idpf/idpf_common_rxtx.h +12 -0
index 3bc3323af4..7c6ff5d047 100644
@@ -106,6 +106,17 @@
 		RTE_ETH_RX_OFFLOAD_SCATTER)
 #define IDPF_RX_VECTOR_OFFLOADS 0
 
+#define IDPF_TX_SCALAR_OFFLOADS (		\
+		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_TCP_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_TCP_TSO |	\
+		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |	\
+		RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
+
+#define IDPF_TX_VECTOR_OFFLOADS RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE
+
 struct idpf_rx_stats {
 	RTE_ATOMIC(uint64_t) mbuf_alloc_failed;
 };
@@ -264,5 +275,6 @@ uint16_t idpf_dp_singleq_xmit_pkts_avx2(void *tx_queue,
 					uint16_t nb_pkts);
 
 extern const struct ci_rx_path_info idpf_rx_path_infos[IDPF_RX_MAX];
+extern const struct ci_tx_path_info idpf_tx_path_infos[IDPF_TX_MAX];
 
 #endif /* _IDPF_COMMON_RXTX_H_ */
drivers/net/intel/idpf/idpf_rxtx.c +36 -82

133 lines not on this page · raw message

drivers/net/intel/idpf/idpf_rxtx_vec_common.h +0 -10
index ecdf2f0e23..425f0792a1 100644
@@ -23,13 +23,6 @@
 		RTE_ETH_RX_OFFLOAD_TCP_CKSUM |	\
 		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |	\
 		RTE_ETH_RX_OFFLOAD_TIMESTAMP)
-#define IDPF_TX_NO_VECTOR_FLAGS (		\
-		RTE_ETH_TX_OFFLOAD_TCP_TSO |	\
-		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |	\
-		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |	\
-		RTE_ETH_TX_OFFLOAD_TCP_CKSUM)
 
 static inline int
 idpf_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
@@ -74,9 +67,6 @@ idpf_tx_vec_queue_default(struct ci_tx_queue *txq)
 	    (txq->tx_rs_thresh & 3) != 0)
 		return IDPF_SCALAR_PATH;
 
-	if ((txq->offloads & IDPF_TX_NO_VECTOR_FLAGS) != 0)
-		return IDPF_SCALAR_PATH;
-
 	return IDPF_VECTOR_PATH;
 }
 
Signature · 1 line
2.43.0
#29 lore raw

PATCH v2 6/10 net/cpfl: use common Tx path selection infrastructure

In reply to Ciara Loftus

Replace the existing complicated logic with the use of the common function. Let the primary process select the Tx path to be used by all processes using the given device.

---
v2:
* removed unnecessary tx_vec_allowed

---
 drivers/net/intel/cpfl/cpfl_rxtx.c            | 120 ++++++------------
 drivers/net/intel/cpfl/cpfl_rxtx_vec_common.h |  10 --
 drivers/net/intel/idpf/idpf_common_device.h   |   2 -
 3 files changed, 37 insertions(+), 95 deletions(-)
drivers/net/intel/cpfl/cpfl_rxtx.c +37 -83
index 453ec975d5..b6bf4094f1 100644
@@ -1462,97 +1462,51 @@ cpfl_set_tx_function(struct rte_eth_dev *dev)
 	struct cpfl_vport *cpfl_vport = dev->data->dev_private;
 	struct idpf_vport *vport = &cpfl_vport->base;
 #ifdef RTE_ARCH_X86
-	enum rte_vect_max_simd tx_simd_width = RTE_VECT_SIMD_DISABLED;
 #ifdef CC_AVX512_SUPPORT
-	struct cpfl_tx_queue *cpfl_txq;
+	struct ci_tx_queue *txq;
 	int i;
 #endif /* CC_AVX512_SUPPORT */
-
-	if (cpfl_tx_vec_dev_check_default(dev) == CPFL_VECTOR_PATH &&
-	    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
-		vport->tx_vec_allowed = true;
-		tx_simd_width = cpfl_get_max_simd_bitwidth();
-#ifdef CC_AVX512_SUPPORT
-		if (tx_simd_width == RTE_VECT_SIMD_512) {
-			for (i = 0; i < dev->data->nb_tx_queues; i++) {
-				cpfl_txq = dev->data->tx_queues[i];
-				idpf_qc_tx_vec_avx512_setup(&cpfl_txq->base);
-			}
-		}
-#else
-		PMD_DRV_LOG(NOTICE,
-			    "AVX512 is not supported in build env");
-#endif /* CC_AVX512_SUPPORT */
-	} else {
-		vport->tx_vec_allowed = false;
-	}
 #endif /* RTE_ARCH_X86 */
+	struct idpf_adapter *ad = vport->adapter;
+	struct ci_tx_path_features req_features = {
+		.tx_offloads = dev->data->dev_conf.txmode.offloads,
+		.simd_width = RTE_VECT_SIMD_DISABLED,
+		.single_queue = (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SINGLE)
+	};
+
+	/* The primary process selects the tx path for all processes. */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		goto out;
+
+#ifdef RTE_ARCH_X86
+	if (cpfl_tx_vec_dev_check_default(dev) == CPFL_VECTOR_PATH)
+		req_features.simd_width = cpfl_get_max_simd_bitwidth();
+#endif
+
+	ad->tx_func_type = ci_tx_path_select(&req_features,
+					&idpf_tx_path_infos[0],
+					IDPF_TX_MAX,
+					IDPF_TX_DEFAULT);
+
+out:
+	dev->tx_pkt_burst = idpf_tx_path_infos[ad->tx_func_type].pkt_burst;
+	dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+	PMD_DRV_LOG(NOTICE, "Using %s Tx (port %d).",
+			idpf_tx_path_infos[ad->tx_func_type].info, dev->data->port_id);
 
 #ifdef RTE_ARCH_X86
-	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
-		if (vport->tx_vec_allowed) {
-#ifdef CC_AVX512_SUPPORT
-			if (tx_simd_width == RTE_VECT_SIMD_512) {
-				PMD_DRV_LOG(NOTICE,
-					    "Using Split AVX512 Vector Tx (port %d).",
-					    dev->data->port_id);
-				dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts_avx512;
-				dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-				return;
-			}
-#endif /* CC_AVX512_SUPPORT */
-		}
-		PMD_DRV_LOG(NOTICE,
-			    "Using Split Scalar Tx (port %d).",
-			    dev->data->port_id);
-		dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts;
-		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-	} else {
-		if (vport->tx_vec_allowed) {
 #ifdef CC_AVX512_SUPPORT
-			if (tx_simd_width == RTE_VECT_SIMD_512) {
-				for (i = 0; i < dev->data->nb_tx_queues; i++) {
-					cpfl_txq = dev->data->tx_queues[i];
-					if (cpfl_txq == NULL)
-						continue;
-					idpf_qc_tx_vec_avx512_setup(&cpfl_txq->base);
-				}
-				PMD_DRV_LOG(NOTICE,
-					    "Using Single AVX512 Vector Tx (port %d).",
-					    dev->data->port_id);
-				dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts_avx512;
-				dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-				return;
-			}
-#endif /* CC_AVX512_SUPPORT */
-			if (tx_simd_width == RTE_VECT_SIMD_256) {
-				PMD_DRV_LOG(NOTICE,
-						"Using Single AVX2 Vector Tx (port %d).",
-						dev->data->port_id);
-				dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts_avx2;
-				dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-				return;
-			}
+	if (idpf_tx_path_infos[ad->tx_func_type].features.simd_width >= RTE_VECT_SIMD_256 &&
+			idpf_tx_path_infos[ad->tx_func_type].features.single_queue) {
+		for (i = 0; i < dev->data->nb_tx_queues; i++) {
+			txq = dev->data->tx_queues[i];
+			if (txq == NULL)
+				continue;
+			if (idpf_tx_path_infos[ad->tx_func_type].features.simd_width ==
+					RTE_VECT_SIMD_512)
+				idpf_qc_tx_vec_avx512_setup(txq);
 		}
-		PMD_DRV_LOG(NOTICE,
-			    "Using Single Scalar Tx (port %d).",
-			    dev->data->port_id);
-		dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts;
-		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-	}
-#else
-	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
-		PMD_DRV_LOG(NOTICE,
-			    "Using Split Scalar Tx (port %d).",
-			    dev->data->port_id);
-		dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts;
-		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-	} else {
-		PMD_DRV_LOG(NOTICE,
-			    "Using Single Scalar Tx (port %d).",
-			    dev->data->port_id);
-		dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts;
-		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
 	}
+#endif /* CC_AVX512_SUPPORT */
 #endif /* RTE_ARCH_X86 */
 }
drivers/net/intel/cpfl/cpfl_rxtx_vec_common.h +0 -10
index 525ca9a6e0..f0daa1eb30 100644
@@ -23,13 +23,6 @@
 		RTE_ETH_RX_OFFLOAD_TCP_CKSUM |	\
 		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |	\
 		RTE_ETH_RX_OFFLOAD_TIMESTAMP)
-#define CPFL_TX_NO_VECTOR_FLAGS (		\
-		RTE_ETH_TX_OFFLOAD_TCP_TSO |	\
-		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |	\
-		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |	\
-		RTE_ETH_TX_OFFLOAD_TCP_CKSUM)
 
 static inline int
 cpfl_rx_vec_queue_default(struct idpf_rx_queue *rxq)
@@ -62,9 +55,6 @@ cpfl_tx_vec_queue_default(struct ci_tx_queue *txq)
 	    (txq->tx_rs_thresh & 3) != 0)
 		return CPFL_SCALAR_PATH;
 
-	if ((txq->offloads & CPFL_TX_NO_VECTOR_FLAGS) != 0)
-		return CPFL_SCALAR_PATH;
-
 	return CPFL_VECTOR_PATH;
 }
 
drivers/net/intel/idpf/idpf_common_device.h +0 -2
index eff04a83eb..b31ae0bd5f 100644
@@ -164,8 +164,6 @@ struct idpf_vport {
 
 	uint16_t devarg_id;
 
-	bool tx_vec_allowed;
-
 	struct virtchnl2_vport_stats eth_stats_offset;
 
 	/* Event from ipf */
Signature · 1 line
2.43.0
#30 lore raw

PATCH v2 7/10 docs: fix TSO and checksum offload feature status in ice doc

In reply to Ciara Loftus

TSO is only supported on the scalar path so change its status to partially supported. L3 and L4 checksum offload are enabled on scalar and vector paths so change their statuses from partial to supported.

Fixes f88de4694d94 ("net/ice: support Tx SSE vector")
---
 doc/guides/nics/features/ice.ini | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
doc/guides/nics/features/ice.ini +3 -3
index e9796c1eab..893d09e9ec 100644
@@ -21,7 +21,7 @@ Power mgmt address monitor = Y
 MTU update           = Y
 Buffer split on Rx   = P
 Scattered Rx         = Y
-TSO                  = Y
+TSO                  = P
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 DCB                  = Y
@@ -34,8 +34,8 @@ Traffic manager      = Y
 CRC offload          = Y
 VLAN offload         = Y
 QinQ offload         = P
-L3 checksum offload  = P
-L4 checksum offload  = P
+L3 checksum offload  = Y
+L4 checksum offload  = Y
 Timestamp offload    = P
 Inner L3 checksum    = P
 Inner L4 checksum    = P
Signature · 1 line
2.43.0
#31 lore raw

PATCH v2 8/10 docs: fix TSO feature status in iavf driver documentation

In reply to Ciara Loftus

TSO is only supported on the scalar path so change the status to partially supported.

Fixes 319c421f3890 ("net/avf: enable SSE Rx Tx")
---
 doc/guides/nics/features/iavf.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/guides/nics/features/iavf.ini +1 -1
index 7695e3ff7c..6c9e97594f 100644
@@ -17,7 +17,7 @@ Burst mode info      = Y
 Power mgmt address monitor = Y
 MTU update           = Y
 Scattered Rx         = Y
-TSO                  = Y
+TSO                  = P
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
Signature · 1 line
2.43.0
#32 lore raw

PATCH v2 9/10 docs: fix inline crypto feature status in iavf driver doc

In reply to Ciara Loftus

inline crypto is only supported on the scalar path so change its status to partially supported.

Fixes 6bc987ecb860 ("net/iavf: support IPsec inline crypto")
---
 doc/guides/nics/features/iavf.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/guides/nics/features/iavf.ini +1 -1
index 6c9e97594f..0ba6f7dfd7 100644
@@ -27,7 +27,7 @@ RSS key update       = Y
 RSS reta update      = Y
 VLAN filter          = Y
 Traffic manager      = Y
-Inline crypto        = Y
+Inline crypto        = P
 CRC offload          = Y
 VLAN offload         = P
 QinQ offload         = P
Signature · 1 line
2.43.0
#33 lore raw

PATCH v2 10/10 docs: fix TSO feature status in i40e driver documentation

In reply to Ciara Loftus

TSO is only supported on the scalar path so change the status to partially supported.

Fixes 9ed94e5bb04e ("i40e: add vector Rx")
---
 doc/guides/nics/features/i40e.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/guides/nics/features/i40e.ini +1 -1
index 4610444ace..fb00b69830 100644
@@ -16,7 +16,7 @@ Runtime Tx queue setup = Y
 Burst mode info      = Y
 Power mgmt address monitor = Y
 Scattered Rx         = Y
-TSO                  = Y
+TSO                  = P
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
Signature · 1 line
2.43.0
#34 lore raw

v3 cover net/intel: tx path selection simplification

In reply to Ciara Loftus

This series aims to simplify the process of selecting a Tx burst function for the Intel drivers i40e, iavf, ice, idpf and cpfl by:
1. enforcing the same tx burst function for both primary and secondary processes.
2. using a common function for selecting the tx burst function based on maximum SIMD width, function features (context descriptor, single queue, etc.) and requested tx offloads.

Some fixes are made to errors in the documentation that became evident while implementing the new selection infratructure in each driver.

v3:
* Fixed cross compile issue in iavf patch.

v2:
* Consolidated the patches that enforce primary/secondary path selection alignment and the introduction of the infrastructure per driver.
* Introduce the "simple tx" feature in patch 1 rather than later.
* Changed some types and arrangements of structs in tx.h
* Fixed some issues relating to mbuf_check and tx_pkt_prepare
* Use the same path in primary and secondary for idpf and cpfl as well.

Ciara Loftus (10):
net/intel: introduce infrastructure for Tx path selection net/ice: use common Tx path selection infrastructure net/iavf: use common Tx path selection infrastructure net/i40e: use common Tx path selection infrastructure net/idpf: use common Tx path selection infrastructure net/cpfl: use common Tx path selection infrastructure
docs: fix TSO and checksum offload feature status in ice doc
docs: fix TSO feature status in iavf driver documentation
docs: fix inline crypto feature status in iavf driver doc
docs: fix TSO feature status in i40e driver documentation

 doc/guides/nics/features/i40e.ini             |   2 +-
 doc/guides/nics/features/iavf.ini             |   4 +-
 doc/guides/nics/features/ice.ini              |   6 +-
 drivers/net/intel/common/tx.h                 |  96 +++++++
 drivers/net/intel/cpfl/cpfl_rxtx.c            | 120 +++------
 drivers/net/intel/cpfl/cpfl_rxtx_vec_common.h |  10 -
 drivers/net/intel/i40e/i40e_ethdev.h          |  14 +-
 drivers/net/intel/i40e/i40e_rxtx.c            | 190 +++++++-------
 drivers/net/intel/i40e/i40e_rxtx.h            |  20 +-
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |   6 -
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |   6 -
 drivers/net/intel/i40e/i40e_rxtx_vec_sse.c    |   6 -
 drivers/net/intel/iavf/iavf.h                 |   2 -
 drivers/net/intel/iavf/iavf_ethdev.c          |   9 +-
 drivers/net/intel/iavf/iavf_rxtx.c            | 240 +++++++++---------
 drivers/net/intel/iavf/iavf_rxtx.h            |  46 ++--
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h |  39 +--
 drivers/net/intel/ice/ice_ethdev.c            |   1 +
 drivers/net/intel/ice/ice_ethdev.h            |  14 +-
 drivers/net/intel/ice/ice_rxtx.c              | 204 ++++++++-------
 drivers/net/intel/ice/ice_rxtx.h              |  30 ++-
 drivers/net/intel/ice/ice_rxtx_vec_common.h   |  35 +--
 drivers/net/intel/ice/ice_rxtx_vec_sse.c      |   6 -
 drivers/net/intel/idpf/idpf_common_device.h   |  12 +-
 drivers/net/intel/idpf/idpf_common_rxtx.c     |  49 ++++
 drivers/net/intel/idpf/idpf_common_rxtx.h     |  12 +
 drivers/net/intel/idpf/idpf_rxtx.c            | 118 +++------
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |  10 -
 28 files changed, 677 insertions(+), 630 deletions(-)
Signature · 1 line
2.43.0
#35 lore raw

PATCH v3 1/10 net/intel: introduce infrastructure for Tx path selection

The code for determining which Tx path to select during initialisation has become complicated in many intel drivers due to the amount of different paths and features available within each path. This commit aims to simplify and genericize the path selection logic.

The following information about each Tx burst function is stored and used by the new common function to select the appropriate Tx path:
- Tx Offloads
- SIMD bitwidth
- "Simple" Tx

The implementation is based off the Rx path selection infrastructure introduced in a previous commit.

---
v2:
* Change req_features to pointer instead of passing by value
* Change num_paths from int to size_t
* Change i from int to unsigned int and define it inside the for statement.
* Remove ci_tx_path_features_extra substructure
* Add simple tx feature in this patch rather in a later patch when it is first used by a driver.

---
 drivers/net/intel/common/tx.h | 77 +++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
drivers/net/intel/common/tx.h +77 -0
index 5af64a4cfe..04d9aa8473 100644
@@ -8,6 +8,7 @@
 #include <stdint.h>
 #include <rte_mbuf.h>
 #include <rte_ethdev.h>
+#include <rte_vect.h>
 
 /* forward declaration of the common intel (ci) queue structure */
 struct ci_tx_queue;
@@ -117,6 +118,19 @@ struct ci_tx_queue {
 	};
 };
 
+struct ci_tx_path_features {
+	uint32_t tx_offloads;
+	enum rte_vect_max_simd simd_width;
+	bool simple_tx;
+};
+
+struct ci_tx_path_info {
+	eth_tx_burst_t pkt_burst;
+	const char *info;
+	struct ci_tx_path_features features;
+	eth_tx_prep_t pkt_prep;
+};
+
 static __rte_always_inline void
 ci_tx_backlog_entry(struct ci_tx_entry *txep, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
@@ -262,4 +276,67 @@ ci_txq_release_all_mbufs(struct ci_tx_queue *txq, bool use_ctx)
 	memset(txq->sw_ring_vec, 0, sizeof(txq->sw_ring_vec[0]) * nb_desc);
 }
 
+/**
+ * Select the best matching Tx path based on features
+ *
+ * @param req_features
+ *   The requested features for the Tx path
+ * @param infos
+ *   Array of information about the available Tx paths
+ * @param num_paths
+ *   Number of available paths in the infos array
+ * @param default_path
+ *   Index of the default path to use if no suitable path is found
+ *
+ * @return
+ *   The packet burst function index that best matches the requested features,
+ *   or default_path if no suitable path is found
+ */
+static inline int
+ci_tx_path_select(const struct ci_tx_path_features *req_features,
+			const struct ci_tx_path_info *infos,
+			size_t num_paths,
+			int default_path)
+{
+	int idx = default_path;
+	const struct ci_tx_path_features *chosen_path_features = NULL;
+
+	for (unsigned int i = 0; i < num_paths; i++) {
+		const struct ci_tx_path_features *path_features = &infos[i].features;
+
+		/* Do not use a simple tx path if not requested. */
+		if (path_features->simple_tx && !req_features->simple_tx)
+			continue;
+
+		/* Ensure the path supports the requested TX offloads. */
+		if ((path_features->tx_offloads & req_features->tx_offloads) !=
+				req_features->tx_offloads)
+			continue;
+
+		/* Ensure the path's SIMD width is compatible with the requested width. */
+		if (path_features->simd_width > req_features->simd_width)
+			continue;
+
+		/* Do not select the path if it is less suitable than the chosen path. */
+		if (chosen_path_features != NULL) {
+			/* Do not select paths with lower SIMD width than the chosen path. */
+			if (path_features->simd_width < chosen_path_features->simd_width)
+				continue;
+			/* Do not select paths with more offloads enabled than the chosen path if
+			 * the SIMD widths are the same.
+			 */
+			if (path_features->simd_width == chosen_path_features->simd_width &&
+					rte_popcount32(path_features->tx_offloads) >
+					rte_popcount32(chosen_path_features->tx_offloads))
+				continue;
+		}
+
+		/* Finally, select the path since it has met all the requirements. */
+		idx = i;
+		chosen_path_features = &infos[idx].features;
+	}
+
+	return idx;
+}
+
 #endif /* _COMMON_INTEL_TX_H_ */
Signature · 1 line
2.43.0
#36 lore raw

PATCH v3 2/10 net/ice: use common Tx path selection infrastructure

In reply to Ciara Loftus

Replace the existing complicated logic with the use of the common function. Also let the primary process select the Tx path to be used by all processes using the given device.

---
v2:
* Fixed mbuf_check function
* Merged the patch which consolidates path selection among process types with the introduction of the new infrastructure.

---
 drivers/net/intel/ice/ice_ethdev.c          |   1 +
 drivers/net/intel/ice/ice_ethdev.h          |  14 +-
 drivers/net/intel/ice/ice_rxtx.c            | 204 ++++++++++----------
 drivers/net/intel/ice/ice_rxtx.h            |  30 ++-
 drivers/net/intel/ice/ice_rxtx_vec_common.h |  35 +---
 drivers/net/intel/ice/ice_rxtx_vec_sse.c    |   6 -
 6 files changed, 142 insertions(+), 148 deletions(-)
drivers/net/intel/ice/ice_ethdev.c +1 -0
index c721d135f5..a805e78d03 100644
@@ -3900,6 +3900,7 @@ ice_dev_configure(struct rte_eth_dev *dev)
 	ad->tx_simple_allowed = true;
 
 	ad->rx_func_type = ICE_RX_DEFAULT;
+	ad->tx_func_type = ICE_TX_DEFAULT;
 
 	if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
 		dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
drivers/net/intel/ice/ice_ethdev.h +11 -3
index 72ed65f13b..7fa2db1bd2 100644
@@ -208,6 +208,16 @@ enum ice_rx_func_type {
 	ICE_RX_AVX512_SCATTERED_OFFLOAD,
 };
 
+enum ice_tx_func_type {
+	ICE_TX_DEFAULT,
+	ICE_TX_SIMPLE,
+	ICE_TX_SSE,
+	ICE_TX_AVX2,
+	ICE_TX_AVX2_OFFLOAD,
+	ICE_TX_AVX512,
+	ICE_TX_AVX512_OFFLOAD,
+};
+
 struct ice_adapter;
 
 /**
@@ -658,14 +668,13 @@ struct ice_adapter {
 	bool tx_vec_allowed;
 	bool tx_simple_allowed;
 	enum ice_rx_func_type rx_func_type;
+	enum ice_tx_func_type tx_func_type;
 	/* ptype mapping table */
 	alignas(RTE_CACHE_LINE_MIN_SIZE) uint32_t ptype_tbl[ICE_MAX_PKT_TYPE];
 	bool is_safe_mode;
 	struct ice_devargs devargs;
 	enum ice_pkg_type active_pkg_type; /* loaded ddp package type */
 	uint16_t fdir_ref_cnt;
-	/* For vector PMD */
-	eth_rx_burst_t tx_pkt_burst;
 	/* For PTP */
 	uint8_t ptp_tx_block;
 	uint8_t ptp_tx_index;
@@ -679,7 +688,6 @@ struct ice_adapter {
 	/* Set bit if the engine is disabled */
 	unsigned long disabled_engine_mask;
 	struct ice_parser *psr;
-	enum rte_vect_max_simd tx_simd_width;
 	bool rx_vec_offload_support;
 };
 
drivers/net/intel/ice/ice_rxtx.c +99 -105

241 lines not on this page · raw message

drivers/net/intel/ice/ice_rxtx.h +29 -1
index 141a62a7da..d7e8c1b0c4 100644
@@ -108,6 +108,35 @@
 		RTE_ETH_RX_OFFLOAD_VLAN_FILTER |\
 		RTE_ETH_RX_OFFLOAD_RSS_HASH)
 
+/* basic scalar path */
+#define ICE_TX_SCALAR_OFFLOADS (		\
+	RTE_ETH_TX_OFFLOAD_VLAN_INSERT |	\
+	RTE_ETH_TX_OFFLOAD_TCP_TSO |		\
+	RTE_ETH_TX_OFFLOAD_MULTI_SEGS |		\
+	RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE |	\
+	RTE_ETH_TX_OFFLOAD_QINQ_INSERT |	\
+	RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_UDP_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_TCP_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |	\
+	RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM |	\
+	RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |	\
+	RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO |	\
+	RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO |	\
+	RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO |	\
+	RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP)
+/* basic vector path */
+#define ICE_TX_VECTOR_OFFLOADS RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE
+/* vector offload paths */
+#define ICE_TX_VECTOR_OFFLOAD_OFFLOADS (	\
+	ICE_TX_VECTOR_OFFLOADS |		\
+	RTE_ETH_TX_OFFLOAD_VLAN_INSERT |	\
+	RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_UDP_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_TCP_CKSUM |		\
+	RTE_ETH_TX_OFFLOAD_SCTP_CKSUM)
+
 /* Max header size can be 2K - 64 bytes */
 #define ICE_RX_HDR_BUF_SIZE    (2048 - 64)
 
@@ -249,7 +278,6 @@ void ice_select_rxd_to_pkt_fields_handler(struct ci_rx_queue *rxq,
 int ice_rx_vec_dev_check(struct rte_eth_dev *dev);
 int ice_tx_vec_dev_check(struct rte_eth_dev *dev);
 int ice_rxq_vec_setup(struct ci_rx_queue *rxq);
-int ice_txq_vec_setup(struct ci_tx_queue *txq);
 uint16_t ice_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 			   uint16_t nb_pkts);
 uint16_t ice_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
drivers/net/intel/ice/ice_rxtx_vec_common.h +2 -33
index 39581cb7ae..ff46a8fb49 100644
@@ -51,28 +51,6 @@ _ice_rx_queue_release_mbufs_vec(struct ci_rx_queue *rxq)
 	memset(rxq->sw_ring, 0, sizeof(rxq->sw_ring[0]) * rxq->nb_rx_desc);
 }
 
-#define ICE_TX_NO_VECTOR_FLAGS (			\
-		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |		\
-		RTE_ETH_TX_OFFLOAD_QINQ_INSERT |	\
-		RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |	\
-		RTE_ETH_TX_OFFLOAD_TCP_TSO |	\
-		RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |    \
-		RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO |    \
-		RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO |    \
-		RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO |    \
-		RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM |	\
-		RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP)
-
-#define ICE_TX_VECTOR_OFFLOAD (				\
-		RTE_ETH_TX_OFFLOAD_VLAN_INSERT |		\
-		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_TCP_CKSUM)
-
-#define ICE_VECTOR_PATH		0
-#define ICE_VECTOR_OFFLOAD_PATH	1
-
 static inline int
 ice_rx_vec_queue_default(struct ci_rx_queue *rxq)
 {
@@ -98,13 +76,7 @@ ice_tx_vec_queue_default(struct ci_tx_queue *txq)
 	    txq->tx_rs_thresh > ICE_TX_MAX_FREE_BUF_SZ)
 		return -1;
 
-	if (txq->offloads & ICE_TX_NO_VECTOR_FLAGS)
-		return -1;
-
-	if (txq->offloads & ICE_TX_VECTOR_OFFLOAD)
-		return ICE_VECTOR_OFFLOAD_PATH;
-
-	return ICE_VECTOR_PATH;
+	return 0;
 }
 
 static inline int
@@ -130,18 +102,15 @@ ice_tx_vec_dev_check_default(struct rte_eth_dev *dev)
 	int i;
 	struct ci_tx_queue *txq;
 	int ret = 0;
-	int result = 0;
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
 		txq = dev->data->tx_queues[i];
 		ret = ice_tx_vec_queue_default(txq);
 		if (ret < 0)
 			return -1;
-		if (ret == ICE_VECTOR_OFFLOAD_PATH)
-			result = ret;
 	}
 
-	return result;
+	return ret;
 }
 
 static inline void
drivers/net/intel/ice/ice_rxtx_vec_sse.c +0 -6
index 1545bc3b6e..4fc1b7e881 100644
@@ -718,12 +718,6 @@ ice_rxq_vec_setup(struct ci_rx_queue *rxq)
 	return 0;
 }
 
-int __rte_cold
-ice_txq_vec_setup(struct ci_tx_queue *txq __rte_unused)
-{
-	return 0;
-}
-
 int __rte_cold
 ice_rx_vec_dev_check(struct rte_eth_dev *dev)
 {
Signature · 1 line
2.43.0
#38 lore raw

PATCH v3 3/10 net/iavf: use common Tx path selection infrastructure

In reply to Ciara Loftus

Replace the existing complicated logic with the use of the common function. Let the primary process select the Tx path to be used by all processes using the given device.

Introduce two new features "disabled" and "context desc" to the common infrastructure which represents whether or not the path is disabled, or if it uses a context descriptor.

---
v3:
* Fixed cross compile issue

v2:
* Merged the patch which consolidates path selection among process types with the introduction of the new infrastructure.

---
 drivers/net/intel/common/tx.h                 |  14 +
 drivers/net/intel/iavf/iavf.h                 |   2 -
 drivers/net/intel/iavf/iavf_ethdev.c          |   9 +-
 drivers/net/intel/iavf/iavf_rxtx.c            | 240 +++++++++---------
 drivers/net/intel/iavf/iavf_rxtx.h            |  46 ++--
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h |  39 +--
 6 files changed, 168 insertions(+), 182 deletions(-)
drivers/net/intel/common/tx.h +14 -0
index 04d9aa8473..60b1bd642a 100644
@@ -122,6 +122,8 @@ struct ci_tx_path_features {
 	uint32_t tx_offloads;
 	enum rte_vect_max_simd simd_width;
 	bool simple_tx;
+	bool ctx_desc;
+	bool disabled;
 };
 
 struct ci_tx_path_info {
@@ -304,10 +306,18 @@ ci_tx_path_select(const struct ci_tx_path_features *req_features,
 	for (unsigned int i = 0; i < num_paths; i++) {
 		const struct ci_tx_path_features *path_features = &infos[i].features;
 
+		/* Do not select a disabled tx path. */
+		if (path_features->disabled)
+			continue;
+
 		/* Do not use a simple tx path if not requested. */
 		if (path_features->simple_tx && !req_features->simple_tx)
 			continue;
 
+		/* If a context descriptor is requested, ensure the path supports it. */
+		if (!path_features->ctx_desc && req_features->ctx_desc)
+			continue;
+
 		/* Ensure the path supports the requested TX offloads. */
 		if ((path_features->tx_offloads & req_features->tx_offloads) !=
 				req_features->tx_offloads)
@@ -329,6 +339,10 @@ ci_tx_path_select(const struct ci_tx_path_features *req_features,
 					rte_popcount32(path_features->tx_offloads) >
 					rte_popcount32(chosen_path_features->tx_offloads))
 				continue;
+
+			/* Don't use a context descriptor unless necessary */
+			if (path_features->ctx_desc && !chosen_path_features->ctx_desc)
+				continue;
 		}
 
 		/* Finally, select the path since it has met all the requirements. */
drivers/net/intel/iavf/iavf.h +0 -2
index d78582e05c..921bf0a607 100644
@@ -375,8 +375,6 @@ struct iavf_adapter {
 	struct iavf_security_ctx *security_ctx;
 
 	bool rx_bulk_alloc_allowed;
-	/* For vector PMD */
-	bool tx_vec_allowed;
 	alignas(RTE_CACHE_LINE_MIN_SIZE) uint32_t ptype_tbl[IAVF_MAX_PKT_TYPE];
 	bool stopped;
 	bool closed;
drivers/net/intel/iavf/iavf_ethdev.c +3 -6
index 15e49fe248..bf1186c20f 100644
@@ -666,10 +666,8 @@ iavf_dev_configure(struct rte_eth_dev *dev)
 		return -EIO;
 
 	ad->rx_bulk_alloc_allowed = true;
-	/* Initialize to TRUE. If any of Rx queues doesn't meet the
-	 * vector Rx/Tx preconditions, it will be reset.
-	 */
-	ad->tx_vec_allowed = true;
+
+	ad->tx_func_type = IAVF_TX_DEFAULT;
 
 	if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
 		dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
@@ -2795,8 +2793,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
 	eth_dev->tx_pkt_prepare = &iavf_prep_pkts;
 
 	/* For secondary processes, we don't initialise any further as primary
-	 * has already done this work. Only check if we need a different RX
-	 * and TX function.
+	 * has already done this work.
 	 */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
 		iavf_set_rx_function(eth_dev);
drivers/net/intel/iavf/iavf_rxtx.c +117 -123

307 lines not on this page · raw message

drivers/net/intel/iavf/iavf_rxtx.h +31 -15

53 lines not on this page · raw message

drivers/net/intel/iavf/iavf_rxtx_vec_common.h +3 -36
index 66f65b46e9..f1ea57034f 100644
@@ -73,8 +73,6 @@ iavf_rx_vec_queue_default(struct ci_rx_queue *rxq)
 static inline int
 iavf_tx_vec_queue_default(struct ci_tx_queue *txq)
 {
-	bool vlan_offload = false, vlan_needs_ctx = false;
-
 	if (!txq)
 		return -1;
 
@@ -82,35 +80,7 @@ iavf_tx_vec_queue_default(struct ci_tx_queue *txq)
 	    txq->tx_rs_thresh > IAVF_VPMD_TX_MAX_FREE_BUF)
 		return -1;
 
-	if (txq->offloads & IAVF_TX_NO_VECTOR_FLAGS)
-		return -1;
-
-	if (rte_pmd_iavf_tx_lldp_dynfield_offset > 0) {
-		txq->use_ctx = 1;
-		return IAVF_VECTOR_CTX_PATH;
-	}
-
-	/* Vlan tci needs to be inserted via ctx desc, if the vlan_flag is L2TAG2. */
-	if (txq->offloads & RTE_ETH_TX_OFFLOAD_VLAN_INSERT) {
-		vlan_offload = true;
-		if (txq->vlan_flag == IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2)
-			vlan_needs_ctx = true;
-	}
-
-	/**
-	 * Tunneling parameters and other fields need be configured in ctx desc
-	 * if the outer checksum offload is enabled.
-	 */
-	if (txq->offloads & (IAVF_TX_VECTOR_OFFLOAD | IAVF_TX_VECTOR_OFFLOAD_CTX) || vlan_offload) {
-		if (txq->offloads & IAVF_TX_VECTOR_OFFLOAD_CTX || vlan_needs_ctx) {
-			txq->use_ctx = 1;
-			return IAVF_VECTOR_CTX_OFFLOAD_PATH;
-		} else {
-			return IAVF_VECTOR_OFFLOAD_PATH;
-		}
-	} else {
-		return IAVF_VECTOR_PATH;
-	}
+	return 0;
 }
 
 static inline int
@@ -137,19 +107,16 @@ iavf_tx_vec_dev_check_default(struct rte_eth_dev *dev)
 	int i;
 	struct ci_tx_queue *txq;
 	int ret;
-	int result = 0;
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
 		txq = dev->data->tx_queues[i];
 		ret = iavf_tx_vec_queue_default(txq);
 
 		if (ret < 0)
-			return -1;
-		if (ret > result)
-			result = ret;
+			break;
 	}
 
-	return result;
+	return ret;
 }
 
 /******************************************************************************
Signature · 1 line
2.43.0
Acked-by on v3 3/10
#39 lore raw

Re: [PATCH v3 03/10] net/iavf: use common Tx path selection infrastructure

Quoted 10 lines · Ciara Loftus

Replace the existing complicated logic with the use of the common function. Let the primary process select the Tx path to be used by all processes using the given device.

Introduce two new features "disabled" and "context desc" to the common infrastructure which represents whether or not the path is disabled, or if it uses a context descriptor.

---

#40 lore raw

PATCH v3 4/10 net/i40e: use common Tx path selection infrastructure

In reply to Ciara Loftus

Replace the existing complicated logic with the use of the common function. Let the primary process select the Tx path to be used by all processes using the given device.

---
v2:
* Merged the patch which consolidates path selection among process types with the introduction of the new infrastructure.
* Fixed mbuf_check logic
* Fixed assignment of pkt_prepare function

---
 drivers/net/intel/i40e/i40e_ethdev.h          |  14 +-
 drivers/net/intel/i40e/i40e_rxtx.c            | 190 ++++++++++--------
 drivers/net/intel/i40e/i40e_rxtx.h            |  20 +-
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |   6 -
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |   6 -
 drivers/net/intel/i40e/i40e_rxtx_vec_sse.c    |   6 -
 6 files changed, 135 insertions(+), 107 deletions(-)
drivers/net/intel/i40e/i40e_ethdev.h +11 -3
index 3fca089d6c..1fe504d0cd 100644
@@ -1243,6 +1243,16 @@ enum i40e_rx_func_type {
 	I40E_RX_ALTIVEC_SCATTERED,
 };
 
+enum i40e_tx_func_type {
+	I40E_TX_DEFAULT,
+	I40E_TX_SCALAR_SIMPLE,
+	I40E_TX_SSE,
+	I40E_TX_AVX2,
+	I40E_TX_AVX512,
+	I40E_TX_NEON,
+	I40E_TX_ALTIVEC,
+};
+
 /*
  * Structure to store private data for each PF/VF instance.
  */
@@ -1260,10 +1270,10 @@ struct i40e_adapter {
 	bool tx_vec_allowed;
 
 	enum i40e_rx_func_type rx_func_type;
+	enum i40e_tx_func_type tx_func_type;
 
 	uint64_t mbuf_check; /* mbuf check flags. */
 	uint16_t max_pkt_len; /* Maximum packet length */
-	eth_tx_burst_t tx_pkt_burst;
 
 	/* For PTP */
 	struct rte_timecounter systime_tc;
@@ -1279,8 +1289,6 @@ struct i40e_adapter {
 
 	/* For RSS reta table update */
 	uint8_t rss_reta_updated;
-
-	enum rte_vect_max_simd tx_simd_width;
 };
 
 /**
drivers/net/intel/i40e/i40e_rxtx.c +105 -85

235 lines not on this page · raw message

drivers/net/intel/i40e/i40e_rxtx.h +19 -1
index b5a901794f..ed173d8f17 100644
@@ -91,6 +91,25 @@ enum i40e_header_split_mode {
 		RTE_ETH_RX_OFFLOAD_VLAN_FILTER |	\
 		RTE_ETH_RX_OFFLOAD_RSS_HASH)
 
+#define I40E_TX_SCALAR_OFFLOADS (			\
+		RTE_ETH_TX_OFFLOAD_VLAN_INSERT |	\
+		RTE_ETH_TX_OFFLOAD_QINQ_INSERT |	\
+		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
+		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |		\
+		RTE_ETH_TX_OFFLOAD_TCP_CKSUM |		\
+		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |		\
+		RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_TCP_TSO |		\
+		RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO |	\
+		RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO |	\
+		RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO |	\
+		RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO |	\
+		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |		\
+		RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
+
+#define I40E_TX_VECTOR_OFFLOADS RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE
+
 /** Offload features */
 union i40e_tx_offload {
 	uint64_t data;
@@ -165,7 +184,6 @@ uint16_t i40e_recv_scattered_pkts_vec(void *rx_queue,
 				      uint16_t nb_pkts);
 int i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);
 int i40e_rxq_vec_setup(struct ci_rx_queue *rxq);
-int i40e_txq_vec_setup(struct ci_tx_queue *txq);
 void i40e_rx_queue_release_mbufs_vec(struct ci_rx_queue *rxq);
 uint16_t i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 				   uint16_t nb_pkts);
drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +0 -6
index 87a57e7520..bbb6d907cf 100644
@@ -547,12 +547,6 @@ i40e_rxq_vec_setup(struct ci_rx_queue *rxq)
 	return 0;
 }
 
-int __rte_cold
-i40e_txq_vec_setup(struct ci_tx_queue __rte_unused * txq)
-{
-	return 0;
-}
-
 int __rte_cold
 i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev)
 {
drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +0 -6
index c9098e4c1a..b5be0c1b59 100644
@@ -697,12 +697,6 @@ i40e_rxq_vec_setup(struct ci_rx_queue *rxq)
 	return 0;
 }
 
-int __rte_cold
-i40e_txq_vec_setup(struct ci_tx_queue *txq __rte_unused)
-{
-	return 0;
-}
-
 int __rte_cold
 i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev)
 {
drivers/net/intel/i40e/i40e_rxtx_vec_sse.c +0 -6
index c035408dcc..c209135890 100644
@@ -704,12 +704,6 @@ i40e_rxq_vec_setup(struct ci_rx_queue *rxq)
 	return 0;
 }
 
-int __rte_cold
-i40e_txq_vec_setup(struct ci_tx_queue *txq __rte_unused)
-{
-	return 0;
-}
-
 int __rte_cold
 i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev)
 {
Signature · 1 line
2.43.0
#42 lore raw

PATCH v3 5/10 net/idpf: use common Tx path selection infrastructure

In reply to Ciara Loftus

Replace the existing complicated logic with the use of the common function. Let the primary process select the Tx path to be used by all processes using the given device.

Introduce a new feature "single queue" to the common infrastructure which represents whether single or split queue mode is used in the given path.

---
v2:
* removed unnecessary tx_vec_allowed

---
 drivers/net/intel/common/tx.h                 |   5 +
 drivers/net/intel/idpf/idpf_common_device.h   |  10 ++
 drivers/net/intel/idpf/idpf_common_rxtx.c     |  49 ++++++++
 drivers/net/intel/idpf/idpf_common_rxtx.h     |  12 ++
 drivers/net/intel/idpf/idpf_rxtx.c            | 118 ++++++------------
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |  10 --
 6 files changed, 112 insertions(+), 92 deletions(-)
drivers/net/intel/common/tx.h +5 -0
index 60b1bd642a..24fcfbe225 100644
@@ -124,6 +124,7 @@ struct ci_tx_path_features {
 	bool simple_tx;
 	bool ctx_desc;
 	bool disabled;
+	bool single_queue;
 };
 
 struct ci_tx_path_info {
@@ -318,6 +319,10 @@ ci_tx_path_select(const struct ci_tx_path_features *req_features,
 		if (!path_features->ctx_desc && req_features->ctx_desc)
 			continue;
 
+		/* If requested, ensure the path supports single queue TX. */
+		if (path_features->single_queue != req_features->single_queue)
+			continue;
+
 		/* Ensure the path supports the requested TX offloads. */
 		if ((path_features->tx_offloads & req_features->tx_offloads) !=
 				req_features->tx_offloads)
drivers/net/intel/idpf/idpf_common_device.h +10 -0
index c32dcfbb12..eff04a83eb 100644
@@ -75,6 +75,15 @@ enum idpf_rx_func_type {
 	IDPF_RX_MAX
 };
 
+enum idpf_tx_func_type {
+	IDPF_TX_DEFAULT,
+	IDPF_TX_SINGLEQ,
+	IDPF_TX_SINGLEQ_AVX2,
+	IDPF_TX_AVX512,
+	IDPF_TX_SINGLEQ_AVX512,
+	IDPF_TX_MAX
+};
+
 struct idpf_adapter {
 	struct idpf_hw hw;
 	struct virtchnl2_version_info virtchnl_version;
@@ -92,6 +101,7 @@ struct idpf_adapter {
 	uint64_t time_hw;
 
 	enum idpf_rx_func_type rx_func_type;
+	enum idpf_tx_func_type tx_func_type;
 };
 
 struct idpf_chunks_info {
drivers/net/intel/idpf/idpf_common_rxtx.c +49 -0

52 lines not on this page · raw message

drivers/net/intel/idpf/idpf_common_rxtx.h +12 -0
index 3bc3323af4..7c6ff5d047 100644
@@ -106,6 +106,17 @@
 		RTE_ETH_RX_OFFLOAD_SCATTER)
 #define IDPF_RX_VECTOR_OFFLOADS 0
 
+#define IDPF_TX_SCALAR_OFFLOADS (		\
+		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_TCP_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |	\
+		RTE_ETH_TX_OFFLOAD_TCP_TSO |	\
+		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |	\
+		RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
+
+#define IDPF_TX_VECTOR_OFFLOADS RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE
+
 struct idpf_rx_stats {
 	RTE_ATOMIC(uint64_t) mbuf_alloc_failed;
 };
@@ -264,5 +275,6 @@ uint16_t idpf_dp_singleq_xmit_pkts_avx2(void *tx_queue,
 					uint16_t nb_pkts);
 
 extern const struct ci_rx_path_info idpf_rx_path_infos[IDPF_RX_MAX];
+extern const struct ci_tx_path_info idpf_tx_path_infos[IDPF_TX_MAX];
 
 #endif /* _IDPF_COMMON_RXTX_H_ */
drivers/net/intel/idpf/idpf_rxtx.c +36 -82

133 lines not on this page · raw message

drivers/net/intel/idpf/idpf_rxtx_vec_common.h +0 -10
index ecdf2f0e23..425f0792a1 100644
@@ -23,13 +23,6 @@
 		RTE_ETH_RX_OFFLOAD_TCP_CKSUM |	\
 		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |	\
 		RTE_ETH_RX_OFFLOAD_TIMESTAMP)
-#define IDPF_TX_NO_VECTOR_FLAGS (		\
-		RTE_ETH_TX_OFFLOAD_TCP_TSO |	\
-		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |	\
-		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |	\
-		RTE_ETH_TX_OFFLOAD_TCP_CKSUM)
 
 static inline int
 idpf_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
@@ -74,9 +67,6 @@ idpf_tx_vec_queue_default(struct ci_tx_queue *txq)
 	    (txq->tx_rs_thresh & 3) != 0)
 		return IDPF_SCALAR_PATH;
 
-	if ((txq->offloads & IDPF_TX_NO_VECTOR_FLAGS) != 0)
-		return IDPF_SCALAR_PATH;
-
 	return IDPF_VECTOR_PATH;
 }
 
Signature · 1 line
2.43.0
Acked-by on v3 5/10
#43 lore raw

Re: [PATCH v3 05/10] net/idpf: use common Tx path selection infrastructure

Quoted 9 lines · Ciara Loftus

Replace the existing complicated logic with the use of the common function. Let the primary process select the Tx path to be used by all processes using the given device.

Introduce a new feature "single queue" to the common infrastructure which represents whether single or split queue mode is used in the given path.

Quoted 40 lines

---
v2:
* removed unnecessary tx_vec_allowed

---
 drivers/net/intel/common/tx.h                 |   5 +
 drivers/net/intel/idpf/idpf_common_device.h   |  10 ++
 drivers/net/intel/idpf/idpf_common_rxtx.c     |  49 ++++++++
 drivers/net/intel/idpf/idpf_common_rxtx.h     |  12 ++
 drivers/net/intel/idpf/idpf_rxtx.c            | 118 ++++++------------
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |  10 --
 6 files changed, 112 insertions(+), 92 deletions(-)
drivers/net/intel/common/tx.h +5 -0
index 60b1bd642a..24fcfbe225 100644
@@ -124,6 +124,7 @@ struct ci_tx_path_features {
 	bool simple_tx;
 	bool ctx_desc;
 	bool disabled;
+	bool single_queue;
 };
 
 struct ci_tx_path_info {
@@ -318,6 +319,10 @@ ci_tx_path_select(const struct ci_tx_path_features *req_features,
 		if (!path_features->ctx_desc && req_features->ctx_desc)
 			continue;
 
+		/* If requested, ensure the path supports single queue TX. */
+		if (path_features->single_queue != req_features->single_queue)
+			continue;
+
 		/* Ensure the path supports the requested TX offloads. */
 		if ((path_features->tx_offloads & req_features->tx_offloads) !=
 				req_features->tx_offloads)
drivers/net/intel/idpf/idpf_common_device.h +0 -0
index c32dcfbb12..eff04a83eb 100644

drivers/net/intel/idpf/idpf_common_device.h enum idpf_rx_func_type { · line 84

Quoted 10 lines
drivers/net/intel/idpf/idpf_common_device.h +7 -0
@@ -75,6 +75,15 @@ enum idpf_rx_func_type {
 	IDPF_RX_MAX
 };
 
+enum idpf_tx_func_type {
+	IDPF_TX_DEFAULT,
+	IDPF_TX_SINGLEQ,
+	IDPF_TX_SINGLEQ_AVX2,
+	IDPF_TX_AVX512,
+	IDPF_TX_SINGLEQ_AVX512,
+	IDPF_TX_MAX

Following up offline with Ciara about the need for this MAX value - it's necessary due to the fact that the function type array needs to be shared with the cpfl driver, but array definition itself is in an idpf C file, so cpfl cannot use RTE_DIM to find the size.
Will add a comment to explain this a little, on apply.

#44 lore raw

PATCH v3 6/10 net/cpfl: use common Tx path selection infrastructure

In reply to Ciara Loftus

Replace the existing complicated logic with the use of the common function. Let the primary process select the Tx path to be used by all processes using the given device.

---
v2:
* removed unnecessary tx_vec_allowed

---
 drivers/net/intel/cpfl/cpfl_rxtx.c            | 120 ++++++------------
 drivers/net/intel/cpfl/cpfl_rxtx_vec_common.h |  10 --
 drivers/net/intel/idpf/idpf_common_device.h   |   2 -
 3 files changed, 37 insertions(+), 95 deletions(-)
drivers/net/intel/cpfl/cpfl_rxtx.c +37 -83
index 453ec975d5..b6bf4094f1 100644
@@ -1462,97 +1462,51 @@ cpfl_set_tx_function(struct rte_eth_dev *dev)
 	struct cpfl_vport *cpfl_vport = dev->data->dev_private;
 	struct idpf_vport *vport = &cpfl_vport->base;
 #ifdef RTE_ARCH_X86
-	enum rte_vect_max_simd tx_simd_width = RTE_VECT_SIMD_DISABLED;
 #ifdef CC_AVX512_SUPPORT
-	struct cpfl_tx_queue *cpfl_txq;
+	struct ci_tx_queue *txq;
 	int i;
 #endif /* CC_AVX512_SUPPORT */
-
-	if (cpfl_tx_vec_dev_check_default(dev) == CPFL_VECTOR_PATH &&
-	    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
-		vport->tx_vec_allowed = true;
-		tx_simd_width = cpfl_get_max_simd_bitwidth();
-#ifdef CC_AVX512_SUPPORT
-		if (tx_simd_width == RTE_VECT_SIMD_512) {
-			for (i = 0; i < dev->data->nb_tx_queues; i++) {
-				cpfl_txq = dev->data->tx_queues[i];
-				idpf_qc_tx_vec_avx512_setup(&cpfl_txq->base);
-			}
-		}
-#else
-		PMD_DRV_LOG(NOTICE,
-			    "AVX512 is not supported in build env");
-#endif /* CC_AVX512_SUPPORT */
-	} else {
-		vport->tx_vec_allowed = false;
-	}
 #endif /* RTE_ARCH_X86 */
+	struct idpf_adapter *ad = vport->adapter;
+	struct ci_tx_path_features req_features = {
+		.tx_offloads = dev->data->dev_conf.txmode.offloads,
+		.simd_width = RTE_VECT_SIMD_DISABLED,
+		.single_queue = (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SINGLE)
+	};
+
+	/* The primary process selects the tx path for all processes. */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		goto out;
+
+#ifdef RTE_ARCH_X86
+	if (cpfl_tx_vec_dev_check_default(dev) == CPFL_VECTOR_PATH)
+		req_features.simd_width = cpfl_get_max_simd_bitwidth();
+#endif
+
+	ad->tx_func_type = ci_tx_path_select(&req_features,
+					&idpf_tx_path_infos[0],
+					IDPF_TX_MAX,
+					IDPF_TX_DEFAULT);
+
+out:
+	dev->tx_pkt_burst = idpf_tx_path_infos[ad->tx_func_type].pkt_burst;
+	dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+	PMD_DRV_LOG(NOTICE, "Using %s Tx (port %d).",
+			idpf_tx_path_infos[ad->tx_func_type].info, dev->data->port_id);
 
 #ifdef RTE_ARCH_X86
-	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
-		if (vport->tx_vec_allowed) {
-#ifdef CC_AVX512_SUPPORT
-			if (tx_simd_width == RTE_VECT_SIMD_512) {
-				PMD_DRV_LOG(NOTICE,
-					    "Using Split AVX512 Vector Tx (port %d).",
-					    dev->data->port_id);
-				dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts_avx512;
-				dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-				return;
-			}
-#endif /* CC_AVX512_SUPPORT */
-		}
-		PMD_DRV_LOG(NOTICE,
-			    "Using Split Scalar Tx (port %d).",
-			    dev->data->port_id);
-		dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts;
-		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-	} else {
-		if (vport->tx_vec_allowed) {
 #ifdef CC_AVX512_SUPPORT
-			if (tx_simd_width == RTE_VECT_SIMD_512) {
-				for (i = 0; i < dev->data->nb_tx_queues; i++) {
-					cpfl_txq = dev->data->tx_queues[i];
-					if (cpfl_txq == NULL)
-						continue;
-					idpf_qc_tx_vec_avx512_setup(&cpfl_txq->base);
-				}
-				PMD_DRV_LOG(NOTICE,
-					    "Using Single AVX512 Vector Tx (port %d).",
-					    dev->data->port_id);
-				dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts_avx512;
-				dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-				return;
-			}
-#endif /* CC_AVX512_SUPPORT */
-			if (tx_simd_width == RTE_VECT_SIMD_256) {
-				PMD_DRV_LOG(NOTICE,
-						"Using Single AVX2 Vector Tx (port %d).",
-						dev->data->port_id);
-				dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts_avx2;
-				dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-				return;
-			}
+	if (idpf_tx_path_infos[ad->tx_func_type].features.simd_width >= RTE_VECT_SIMD_256 &&
+			idpf_tx_path_infos[ad->tx_func_type].features.single_queue) {
+		for (i = 0; i < dev->data->nb_tx_queues; i++) {
+			txq = dev->data->tx_queues[i];
+			if (txq == NULL)
+				continue;
+			if (idpf_tx_path_infos[ad->tx_func_type].features.simd_width ==
+					RTE_VECT_SIMD_512)
+				idpf_qc_tx_vec_avx512_setup(txq);
 		}
-		PMD_DRV_LOG(NOTICE,
-			    "Using Single Scalar Tx (port %d).",
-			    dev->data->port_id);
-		dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts;
-		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-	}
-#else
-	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
-		PMD_DRV_LOG(NOTICE,
-			    "Using Split Scalar Tx (port %d).",
-			    dev->data->port_id);
-		dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts;
-		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
-	} else {
-		PMD_DRV_LOG(NOTICE,
-			    "Using Single Scalar Tx (port %d).",
-			    dev->data->port_id);
-		dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts;
-		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
 	}
+#endif /* CC_AVX512_SUPPORT */
 #endif /* RTE_ARCH_X86 */
 }
drivers/net/intel/cpfl/cpfl_rxtx_vec_common.h +0 -10
index 525ca9a6e0..f0daa1eb30 100644
@@ -23,13 +23,6 @@
 		RTE_ETH_RX_OFFLOAD_TCP_CKSUM |	\
 		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM |	\
 		RTE_ETH_RX_OFFLOAD_TIMESTAMP)
-#define CPFL_TX_NO_VECTOR_FLAGS (		\
-		RTE_ETH_TX_OFFLOAD_TCP_TSO |	\
-		RTE_ETH_TX_OFFLOAD_MULTI_SEGS |	\
-		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM |		\
-		RTE_ETH_TX_OFFLOAD_UDP_CKSUM |	\
-		RTE_ETH_TX_OFFLOAD_TCP_CKSUM)
 
 static inline int
 cpfl_rx_vec_queue_default(struct idpf_rx_queue *rxq)
@@ -62,9 +55,6 @@ cpfl_tx_vec_queue_default(struct ci_tx_queue *txq)
 	    (txq->tx_rs_thresh & 3) != 0)
 		return CPFL_SCALAR_PATH;
 
-	if ((txq->offloads & CPFL_TX_NO_VECTOR_FLAGS) != 0)
-		return CPFL_SCALAR_PATH;
-
 	return CPFL_VECTOR_PATH;
 }
 
drivers/net/intel/idpf/idpf_common_device.h +0 -2
index eff04a83eb..b31ae0bd5f 100644
@@ -164,8 +164,6 @@ struct idpf_vport {
 
 	uint16_t devarg_id;
 
-	bool tx_vec_allowed;
-
 	struct virtchnl2_vport_stats eth_stats_offset;
 
 	/* Event from ipf */
Signature · 1 line
2.43.0
Acked-by on v3 6/10
#45 lore raw

Re: [PATCH v3 06/10] net/cpfl: use common Tx path selection infrastructure

Quoted 5 lines · Ciara Loftus

Replace the existing complicated logic with the use of the common function. Let the primary process select the Tx path to be used by all processes using the given device.

Quoted 9 lines

---
v2:
* removed unnecessary tx_vec_allowed

---
 drivers/net/intel/cpfl/cpfl_rxtx.c            | 120 ++++++------------
 drivers/net/intel/cpfl/cpfl_rxtx_vec_common.h |  10 --
 drivers/net/intel/idpf/idpf_common_device.h   |   2 -
 3 files changed, 37 insertions(+), 95 deletions(-)
#46 lore raw

PATCH v3 7/10 docs: fix TSO and checksum offload feature status in ice doc

In reply to Ciara Loftus

TSO is only supported on the scalar path so change its status to partially supported. L3 and L4 checksum offload are enabled on scalar and vector paths so change their statuses from partial to supported.

Fixes f88de4694d94 ("net/ice: support Tx SSE vector")
---
 doc/guides/nics/features/ice.ini | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
doc/guides/nics/features/ice.ini +3 -3
index e9796c1eab..893d09e9ec 100644
@@ -21,7 +21,7 @@ Power mgmt address monitor = Y
 MTU update           = Y
 Buffer split on Rx   = P
 Scattered Rx         = Y
-TSO                  = Y
+TSO                  = P
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 DCB                  = Y
@@ -34,8 +34,8 @@ Traffic manager      = Y
 CRC offload          = Y
 VLAN offload         = Y
 QinQ offload         = P
-L3 checksum offload  = P
-L4 checksum offload  = P
+L3 checksum offload  = Y
+L4 checksum offload  = Y
 Timestamp offload    = P
 Inner L3 checksum    = P
 Inner L4 checksum    = P
Signature · 1 line
2.43.0
#47 lore raw

PATCH v3 8/10 docs: fix TSO feature status in iavf driver documentation

In reply to Ciara Loftus

TSO is only supported on the scalar path so change the status to partially supported.

Fixes 319c421f3890 ("net/avf: enable SSE Rx Tx")
---
 doc/guides/nics/features/iavf.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/guides/nics/features/iavf.ini +1 -1
index 7695e3ff7c..6c9e97594f 100644
@@ -17,7 +17,7 @@ Burst mode info      = Y
 Power mgmt address monitor = Y
 MTU update           = Y
 Scattered Rx         = Y
-TSO                  = Y
+TSO                  = P
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
Signature · 1 line
2.43.0
#48 lore raw

PATCH v3 9/10 docs: fix inline crypto feature status in iavf driver doc

In reply to Ciara Loftus

inline crypto is only supported on the scalar path so change its status to partially supported.

Fixes 6bc987ecb860 ("net/iavf: support IPsec inline crypto")
---
 doc/guides/nics/features/iavf.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/guides/nics/features/iavf.ini +1 -1
index 6c9e97594f..0ba6f7dfd7 100644
@@ -27,7 +27,7 @@ RSS key update       = Y
 RSS reta update      = Y
 VLAN filter          = Y
 Traffic manager      = Y
-Inline crypto        = Y
+Inline crypto        = P
 CRC offload          = Y
 VLAN offload         = P
 QinQ offload         = P
Signature · 1 line
2.43.0
#49 lore raw

PATCH v3 10/10 docs: fix TSO feature status in i40e driver documentation

In reply to Ciara Loftus

TSO is only supported on the scalar path so change the status to partially supported.

Fixes 9ed94e5bb04e ("i40e: add vector Rx")
---
 doc/guides/nics/features/i40e.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/guides/nics/features/i40e.ini +1 -1
index 4610444ace..fb00b69830 100644
@@ -16,7 +16,7 @@ Runtime Tx queue setup = Y
 Burst mode info      = Y
 Power mgmt address monitor = Y
 Scattered Rx         = Y
-TSO                  = Y
+TSO                  = P
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
Signature · 1 line
2.43.0
#50 lore raw
In reply to Ciara Loftus
Quoted 8 lines · Ciara Loftus

This series aims to simplify the process of selecting a Tx burst function for the Intel drivers i40e, iavf, ice, idpf and cpfl by:
1. enforcing the same tx burst function for both primary and secondary processes.
2. using a common function for selecting the tx burst function based on maximum SIMD width, function features (context descriptor, single queue, etc.) and requested tx offloads.

Quoted 6 lines

Some fixes are made to errors in the documentation that became evident while implementing the new selection infratructure in each driver.

v3:
* Fixed cross compile issue in iavf patch.

Series applied to dpdk-next-net-intel.

Thanks,
/Bruce