Skip to contentSkip to conversation

combine multiple Intel scalar Tx paths

RFC PATCH Superseded Bruce Richardson 6 participants 274 messages Dec 19, 2025 – Feb 12 Network drivers Page 2 of 4

lore
Share & tools
lore
#56 lore raw

PATCH v2 25/36 net/intel: use separate array for desc status tracking

In reply to Bruce Richardson

Rather than writing a last_id for each individual descriptor, we can write one only for places where the "report status" (RS) bit is set, i.e. the descriptors which will be written back when done. The method used for marking what descriptors are free is also changed in the process, even if the last descriptor with the "done" bits set is past the expected point, we only track up to the expected point, and leave the rest to be counted as freed next time. This means that we always have the RS/DD bits set at fixed intervals, and we always track free slots in units of the same tx_free_thresh intervals.

---
 drivers/net/intel/common/tx.h             |  4 ++
 drivers/net/intel/common/tx_scalar_fns.h  | 62 ++++++++++-------------
 drivers/net/intel/i40e/i40e_rxtx.c        | 20 ++++++++
 drivers/net/intel/iavf/iavf_rxtx.c        | 19 +++++++
 drivers/net/intel/ice/ice_rxtx.c          | 20 ++++++++
 drivers/net/intel/idpf/idpf_common_rxtx.c |  7 +++
 drivers/net/intel/idpf/idpf_rxtx.c        | 13 +++++
 7 files changed, 111 insertions(+), 34 deletions(-)
drivers/net/intel/common/tx.h +4 -0
index 0d11daaab3..9b3f8385e6 100644
@@ -126,6 +126,8 @@ struct ci_tx_queue {
 		struct ci_tx_entry *sw_ring; /* virtual address of SW ring */
 		struct ci_tx_entry_vec *sw_ring_vec;
 	};
+	/* Scalar TX path: Array tracking last_id at each RS threshold boundary */
+	uint16_t *rs_last_id;
 	uint16_t nb_tx_desc;           /* number of TX descriptors */
 	uint16_t tx_tail; /* current value of tail register */
 	uint16_t nb_tx_used; /* number of TX desc used since RS bit set */
@@ -139,6 +141,8 @@ struct ci_tx_queue {
 	uint16_t tx_free_thresh;
 	/* Number of TX descriptors to use before RS bit is set. */
 	uint16_t tx_rs_thresh;
+	/* Scalar TX path: log2 of tx_rs_thresh for efficient bit operations */
+	uint8_t log2_rs_thresh;
 	uint16_t port_id;  /* Device port identifier. */
 	uint16_t queue_id; /* TX queue index. */
 	uint16_t reg_idx;
drivers/net/intel/common/tx_scalar_fns.h +28 -34

128 lines not on this page · raw message

drivers/net/intel/i40e/i40e_rxtx.c +20 -0
index 0ccd8e8b2a..68074333aa 100644
@@ -24,6 +24,7 @@
 #include <rte_ip.h>
 #include <rte_net.h>
 #include <rte_vect.h>
+#include <rte_bitops.h>
 
 #include "i40e_logs.h"
 #include "base/i40e_prototype.h"
@@ -2267,6 +2268,13 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev,
 			     (int)queue_idx);
 		return I40E_ERR_PARAM;
 	}
+	if (!rte_is_power_of_2(tx_rs_thresh)) {
+		PMD_INIT_LOG(ERR, "tx_rs_thresh must be a power of 2. (tx_rs_thresh=%u port=%d queue=%d)",
+			     (unsigned int)tx_rs_thresh,
+			     (int)dev->data->port_id,
+			     (int)queue_idx);
+		return I40E_ERR_PARAM;
+	}
 	if ((tx_rs_thresh > 1) && (tx_conf->tx_thresh.wthresh != 0)) {
 		PMD_INIT_LOG(ERR, "TX WTHRESH must be set to 0 if "
 			     "tx_rs_thresh is greater than 1. "
@@ -2308,6 +2316,7 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	txq->mz = tz;
 	txq->nb_tx_desc = nb_desc;
 	txq->tx_rs_thresh = tx_rs_thresh;
+	txq->log2_rs_thresh = rte_log2_u32(tx_rs_thresh);
 	txq->tx_free_thresh = tx_free_thresh;
 	txq->queue_id = queue_idx;
 	txq->reg_idx = reg_idx;
@@ -2331,6 +2340,16 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 
+	/* Allocate RS last_id tracking array */
+	uint16_t num_rs_buckets = nb_desc / tx_rs_thresh;
+	txq->rs_last_id = rte_zmalloc_socket(NULL, sizeof(txq->rs_last_id[0]) * num_rs_buckets,
+			RTE_CACHE_LINE_SIZE, socket_id);
+	if (txq->rs_last_id == NULL) {
+		i40e_tx_queue_release(txq);
+		PMD_DRV_LOG(ERR, "Failed to allocate memory for RS last_id array");
+		return -ENOMEM;
+	}
+
 	i40e_reset_tx_queue(txq);
 	txq->q_set = TRUE;
 
@@ -2376,6 +2395,7 @@ i40e_tx_queue_release(void *txq)
 
 	ci_txq_release_all_mbufs(q, false);
 	rte_free(q->sw_ring);
+	rte_free(q->rs_last_id);
 	rte_memzone_free(q->mz);
 	rte_free(q);
 }
drivers/net/intel/iavf/iavf_rxtx.c +19 -0
index 8810d5bb63..b78818c02b 100644
@@ -25,6 +25,7 @@
 #include <rte_ip.h>
 #include <rte_net.h>
 #include <rte_vect.h>
+#include <rte_bitops.h>
 #include <rte_vxlan.h>
 #include <rte_gtp.h>
 #include <rte_geneve.h>
@@ -208,6 +209,11 @@ check_tx_thresh(uint16_t nb_desc, uint16_t tx_rs_thresh,
 			     tx_rs_thresh, nb_desc);
 		return -EINVAL;
 	}
+	if (!rte_is_power_of_2(tx_rs_thresh)) {
+		PMD_INIT_LOG(ERR, "tx_rs_thresh must be a power of 2. (tx_rs_thresh=%u)",
+			     tx_rs_thresh);
+		return -EINVAL;
+	}
 
 	return 0;
 }
@@ -808,6 +814,7 @@ iavf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 
 	txq->nb_tx_desc = nb_desc;
 	txq->tx_rs_thresh = tx_rs_thresh;
+	txq->log2_rs_thresh = rte_log2_u32(tx_rs_thresh);
 	txq->tx_free_thresh = tx_free_thresh;
 	txq->queue_id = queue_idx;
 	txq->port_id = dev->data->port_id;
@@ -831,6 +838,17 @@ iavf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 
+	/* Allocate RS last_id tracking array */
+	uint16_t num_rs_buckets = nb_desc / tx_rs_thresh;
+	txq->rs_last_id = rte_zmalloc_socket(NULL, sizeof(txq->rs_last_id[0]) * num_rs_buckets,
+			RTE_CACHE_LINE_SIZE, socket_id);
+	if (txq->rs_last_id == NULL) {
+		PMD_INIT_LOG(ERR, "Failed to allocate memory for RS last_id array");
+		rte_free(txq->sw_ring);
+		rte_free(txq);
+		return -ENOMEM;
+	}
+
 	/* Allocate TX hardware ring descriptors. */
 	ring_size = sizeof(struct ci_tx_desc) * IAVF_MAX_RING_DESC;
 	ring_size = RTE_ALIGN(ring_size, IAVF_DMA_MEM_ALIGN);
@@ -1055,6 +1073,7 @@ iavf_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
 
 	ci_txq_release_all_mbufs(q, q->use_ctx);
 	rte_free(q->sw_ring);
+	rte_free(q->rs_last_id);
 	rte_memzone_free(q->mz);
 	rte_free(q);
 }
drivers/net/intel/ice/ice_rxtx.c +20 -0
index c67d6223b3..0c85f9a592 100644
@@ -5,6 +5,7 @@
 #include <ethdev_driver.h>
 #include <rte_net.h>
 #include <rte_vect.h>
+#include <rte_bitops.h>
 
 #include "ice_rxtx.h"
 #include "ice_rxtx_vec_common.h"
@@ -1579,6 +1580,13 @@ ice_tx_queue_setup(struct rte_eth_dev *dev,
 			     (int)queue_idx);
 		return -EINVAL;
 	}
+	if (!rte_is_power_of_2(tx_rs_thresh)) {
+		PMD_INIT_LOG(ERR, "tx_rs_thresh must be a power of 2. (tx_rs_thresh=%u port=%d queue=%d)",
+			     (unsigned int)tx_rs_thresh,
+			     (int)dev->data->port_id,
+			     (int)queue_idx);
+		return -EINVAL;
+	}
 	if (tx_rs_thresh > 1 && tx_conf->tx_thresh.wthresh != 0) {
 		PMD_INIT_LOG(ERR, "TX WTHRESH must be set to 0 if "
 			     "tx_rs_thresh is greater than 1. "
@@ -1621,6 +1629,7 @@ ice_tx_queue_setup(struct rte_eth_dev *dev,
 	txq->mz = tz;
 	txq->nb_tx_desc = nb_desc;
 	txq->tx_rs_thresh = tx_rs_thresh;
+	txq->log2_rs_thresh = rte_log2_u32(tx_rs_thresh);
 	txq->tx_free_thresh = tx_free_thresh;
 	txq->queue_id = queue_idx;
 
@@ -1645,6 +1654,16 @@ ice_tx_queue_setup(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 
+	/* Allocate RS last_id tracking array */
+	uint16_t num_rs_buckets = nb_desc / tx_rs_thresh;
+	txq->rs_last_id = rte_zmalloc_socket(NULL, sizeof(txq->rs_last_id[0]) * num_rs_buckets,
+			RTE_CACHE_LINE_SIZE, socket_id);
+	if (txq->rs_last_id == NULL) {
+		ice_tx_queue_release(txq);
+		PMD_INIT_LOG(ERR, "Failed to allocate memory for RS last_id array");
+		return -ENOMEM;
+	}
+
 	if (vsi->type == ICE_VSI_PF && (offloads & RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP)) {
 		if (hw->phy_model != ICE_PHY_E830) {
 			ice_tx_queue_release(txq);
@@ -1717,6 +1736,7 @@ ice_tx_queue_release(void *txq)
 
 	ci_txq_release_all_mbufs(q, false);
 	rte_free(q->sw_ring);
+	rte_free(q->rs_last_id);
 	if (q->tsq) {
 		rte_memzone_free(q->tsq->ts_mz);
 		rte_free(q->tsq);
drivers/net/intel/idpf/idpf_common_rxtx.c +7 -0
index 81bc45f6ef..1d123f6350 100644
@@ -5,6 +5,7 @@
 #include <eal_export.h>
 #include <rte_mbuf_dyn.h>
 #include <rte_errno.h>
+#include <rte_bitops.h>
 
 #include "idpf_common_rxtx.h"
 #include "idpf_common_device.h"
@@ -73,6 +74,11 @@ idpf_qc_tx_thresh_check(uint16_t nb_desc, uint16_t tx_rs_thresh,
 			tx_rs_thresh, nb_desc);
 		return -EINVAL;
 	}
+	if (!rte_is_power_of_2(tx_rs_thresh)) {
+		DRV_LOG(ERR, "tx_rs_thresh must be a power of 2. (tx_rs_thresh=%u)",
+			tx_rs_thresh);
+		return -EINVAL;
+	}
 
 	return 0;
 }
@@ -333,6 +339,7 @@ idpf_qc_tx_queue_release(void *txq)
 	}
 
 	ci_txq_release_all_mbufs(q, false);
+	rte_free(q->rs_last_id);
 	rte_free(q->sw_ring);
 	rte_memzone_free(q->mz);
 	rte_free(q);
drivers/net/intel/idpf/idpf_rxtx.c +13 -0
index e974eb44b0..5c2516f556 100644
@@ -437,6 +437,7 @@ idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 
 	txq->nb_tx_desc = nb_desc;
 	txq->tx_rs_thresh = tx_rs_thresh;
+	txq->log2_rs_thresh = rte_log2_u32(tx_rs_thresh);
 	txq->tx_free_thresh = tx_free_thresh;
 	txq->queue_id = vport->chunks_info.tx_start_qid + queue_idx;
 	txq->port_id = dev->data->port_id;
@@ -468,6 +469,15 @@ idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 		goto err_sw_ring_alloc;
 	}
 
+	txq->rs_last_id = rte_zmalloc_socket("idpf tx rs_last_id",
+			sizeof(txq->rs_last_id[0]) * (nb_desc >> txq->log2_rs_thresh),
+			RTE_CACHE_LINE_SIZE, socket_id);
+	if (txq->rs_last_id == NULL) {
+		PMD_INIT_LOG(ERR, "Failed to allocate memory for TX RS tracking");
+		ret = -ENOMEM;
+		goto err_rs_last_id_alloc;
+	}
+
 	if (!is_splitq) {
 		txq->ci_tx_ring = mz->addr;
 		idpf_qc_single_tx_queue_reset(txq);
@@ -490,6 +500,9 @@ idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	return 0;
 
 err_complq_setup:
+	rte_free(txq->rs_last_id);
+err_rs_last_id_alloc:
+	rte_free(txq->sw_ring);
 err_sw_ring_alloc:
 	idpf_dma_zone_release(mz);
 err_mz_reserve:
Signature · 1 line
2.51.0
#57 lore raw

PATCH v2 26/36 net/ixgbe: use separate array for desc status tracking

In reply to Bruce Richardson

Due to significant differences in the ixgbe transmit descriptors, the ixgbe driver does not use the common scalar Tx functionality. Update the driver directly so its use of the rs_last_id array matches that of the common Tx code.

---
 drivers/net/intel/ixgbe/ixgbe_rxtx.c | 86 +++++++++++++++-------------
 1 file changed, 47 insertions(+), 39 deletions(-)
drivers/net/intel/ixgbe/ixgbe_rxtx.c +47 -39
index a7583c178a..3eeec220fd 100644
@@ -43,6 +43,7 @@
 #include <rte_ip.h>
 #include <rte_net.h>
 #include <rte_vect.h>
+#include <rte_bitops.h>
 
 #include "ixgbe_logs.h"
 #include "base/ixgbe_api.h"
@@ -571,57 +572,35 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags)
 static inline int
 ixgbe_xmit_cleanup(struct ci_tx_queue *txq)
 {
-	struct ci_tx_entry *sw_ring = txq->sw_ring;
 	volatile union ixgbe_adv_tx_desc *txr = txq->ixgbe_tx_ring;
-	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
-	uint16_t nb_tx_desc = txq->nb_tx_desc;
-	uint16_t desc_to_clean_to;
-	uint16_t nb_tx_to_clean;
-	uint32_t status;
+	const uint16_t last_desc_cleaned = txq->last_desc_cleaned;
+	const uint16_t nb_tx_desc = txq->nb_tx_desc;
 
-	/* Determine the last descriptor needing to be cleaned */
-	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
-	if (desc_to_clean_to >= nb_tx_desc)
-		desc_to_clean_to = (uint16_t)(desc_to_clean_to - nb_tx_desc);
+	const uint16_t rs_idx = (last_desc_cleaned == nb_tx_desc - 1) ?
+			0 :
+			(last_desc_cleaned + 1) >> txq->log2_rs_thresh;
+	uint16_t desc_to_clean_to = (rs_idx << txq->log2_rs_thresh) + (txq->tx_rs_thresh - 1);
 
-	/* Check to make sure the last descriptor to clean is done */
-	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
-	status = txr[desc_to_clean_to].wb.status;
+	uint32_t status = txr[txq->rs_last_id[rs_idx]].wb.status;
 	if (!(status & rte_cpu_to_le_32(IXGBE_TXD_STAT_DD))) {
 		PMD_TX_LOG(DEBUG,
 			   "TX descriptor %4u is not done"
 			   "(port=%d queue=%d)",
-			   desc_to_clean_to,
+			   txq->rs_last_id[rs_idx],
 			   txq->port_id, txq->queue_id);
 		/* Failed to clean any descriptors, better luck next time */
 		return -(1);
 	}
 
-	/* Figure out how many descriptors will be cleaned */
-	if (last_desc_cleaned > desc_to_clean_to)
-		nb_tx_to_clean = (uint16_t)((nb_tx_desc - last_desc_cleaned) +
-							desc_to_clean_to);
-	else
-		nb_tx_to_clean = (uint16_t)(desc_to_clean_to -
-						last_desc_cleaned);
-
 	PMD_TX_LOG(DEBUG,
 		   "Cleaning %4u TX descriptors: %4u to %4u "
 		   "(port=%d queue=%d)",
-		   nb_tx_to_clean, last_desc_cleaned, desc_to_clean_to,
+		   txq->tx_rs_thresh, last_desc_cleaned, desc_to_clean_to,
 		   txq->port_id, txq->queue_id);
 
-	/*
-	 * The last descriptor to clean is done, so that means all the
-	 * descriptors from the last descriptor that was cleaned
-	 * up to the last descriptor with the RS bit set
-	 * are done. Only reset the threshold descriptor.
-	 */
-	txr[desc_to_clean_to].wb.status = 0;
-
 	/* Update the txq to reflect the last descriptor that was cleaned */
 	txq->last_desc_cleaned = desc_to_clean_to;
-	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + nb_tx_to_clean);
+	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + txq->tx_rs_thresh);
 
 	/* No Error */
 	return 0;
@@ -749,6 +728,9 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		if (tx_last >= txq->nb_tx_desc)
 			tx_last = (uint16_t) (tx_last - txq->nb_tx_desc);
 
+		/* Track the RS threshold bucket at packet start */
+		uint16_t pkt_rs_idx = (uint16_t)(tx_id >> txq->log2_rs_thresh);
+
 		PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u pktlen=%u"
 			   " tx_first=%u tx_last=%u",
 			   (unsigned) txq->port_id,
@@ -876,7 +858,6 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 					tx_offload,
 					rte_security_dynfield(tx_pkt));
 
-				txe->last_id = tx_last;
 				tx_id = txe->next_id;
 				txe = txn;
 			}
@@ -922,7 +903,6 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 				rte_cpu_to_le_32(cmd_type_len | slen);
 			txd->read.olinfo_status =
 				rte_cpu_to_le_32(olinfo_status);
-			txe->last_id = tx_last;
 			tx_id = txe->next_id;
 			txe = txn;
 			m_seg = m_seg->next;
@@ -935,8 +915,18 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		txq->nb_tx_used = (uint16_t)(txq->nb_tx_used + nb_used);
 		txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_used);
 
-		/* Set RS bit only on threshold packets' last descriptor */
-		if (txq->nb_tx_used >= txq->tx_rs_thresh) {
+		/*
+		 * Check if packet crosses into a new RS threshold bucket.
+		 * The RS bit is set on the last descriptor when we move from one bucket to another.
+		 * For example, with tx_rs_thresh=32 and a 5-descriptor packet using slots 30-34:
+		 *   - pkt_rs_idx = 30 >> 5 = 0 (started in bucket 0)
+		 *   - tx_last = 34, so 35 >> 5 = 1 (next packet is in bucket 1)
+		 *   - Since 0 != 1, set RS bit on descriptor 34, and record rs_last_id[0] = 34
+		 */
+		uint16_t next_rs_idx = ((tx_last + 1) >> txq->log2_rs_thresh);
+
+		if (next_rs_idx != pkt_rs_idx) {
+			/* Packet crossed into a new bucket - set RS bit on last descriptor */
 			PMD_TX_LOG(DEBUG,
 				   "Setting RS bit on TXD id="
 				   "%4u (port=%d queue=%d)",
@@ -944,9 +934,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 			cmd_type_len |= IXGBE_TXD_CMD_RS;
 
-			/* Update txq RS bit counters */
-			txq->nb_tx_used = 0;
-			txp = NULL;
+			/* Record the last descriptor ID for the bucket we're leaving */
+			txq->rs_last_id[pkt_rs_idx] = tx_last;
 		} else
 			txp = txd;
 
@@ -2521,6 +2510,7 @@ ixgbe_tx_queue_release(struct ci_tx_queue *txq)
 	if (txq != NULL && txq->ops != NULL) {
 		ci_txq_release_all_mbufs(txq, false);
 		txq->ops->free_swring(txq);
+		rte_free(txq->rs_last_id);
 		rte_memzone_free(txq->mz);
 		rte_free(txq);
 	}
@@ -2825,6 +2815,13 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
 			     (int)dev->data->port_id, (int)queue_idx);
 		return -(EINVAL);
 	}
+	if (!rte_is_power_of_2(tx_rs_thresh)) {
+		PMD_INIT_LOG(ERR, "tx_rs_thresh must be a power of 2. (tx_rs_thresh=%u port=%d queue=%d)",
+			     (unsigned int)tx_rs_thresh,
+			     (int)dev->data->port_id,
+			     (int)queue_idx);
+		return -(EINVAL);
+	}
 
 	/*
 	 * If rs_bit_thresh is greater than 1, then TX WTHRESH should be
@@ -2870,6 +2867,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	txq->mz = tz;
 	txq->nb_tx_desc = nb_desc;
 	txq->tx_rs_thresh = tx_rs_thresh;
+	txq->log2_rs_thresh = rte_log2_u32(tx_rs_thresh);
 	txq->tx_free_thresh = tx_free_thresh;
 	txq->pthresh = tx_conf->tx_thresh.pthresh;
 	txq->hthresh = tx_conf->tx_thresh.hthresh;
@@ -2911,6 +2909,16 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	PMD_INIT_LOG(DEBUG, "sw_ring=%p hw_ring=%p dma_addr=0x%"PRIx64,
 		     txq->sw_ring, txq->ixgbe_tx_ring, txq->tx_ring_dma);
 
+	/* Allocate RS last_id tracking array */
+	uint16_t num_rs_buckets = nb_desc / tx_rs_thresh;
+	txq->rs_last_id = rte_zmalloc_socket(NULL, sizeof(txq->rs_last_id[0]) * num_rs_buckets,
+			RTE_CACHE_LINE_SIZE, socket_id);
+	if (txq->rs_last_id == NULL) {
+		ixgbe_tx_queue_release(txq);
+		PMD_DRV_LOG(ERR, "Failed to allocate memory for RS last_id array");
+		return -ENOMEM;
+	}
+
 	/* set up vector or scalar TX function as appropriate */
 	ixgbe_set_tx_function(dev, txq);
 
Signature · 1 line
2.51.0
#58 lore raw

PATCH v2 27/36 net/intel: drop unused Tx queue used count

In reply to Bruce Richardson

Since drivers now track the setting of the RS bit based on fixed thresholds rather than after a fixed number of descriptors, we no longer need to track the number of descriptors used from one call to another. Therefore we can remove the tx_used value in the Tx queue structure.

This value was still being used inside the IDPF splitq scalar code, however, the ipdf driver-specific section of the Tx queue structure also had an rs_compl_count value that was only used for the vector code paths, so we can use it to replace the old tx_used value in the scalar path.

---
 drivers/net/intel/common/tx.h                   | 1 -
 drivers/net/intel/common/tx_scalar_fns.h        | 1 -
 drivers/net/intel/i40e/i40e_rxtx.c              | 1 -
 drivers/net/intel/iavf/iavf_rxtx.c              | 1 -
 drivers/net/intel/ice/ice_dcf_ethdev.c          | 1 -
 drivers/net/intel/ice/ice_rxtx.c                | 1 -
 drivers/net/intel/idpf/idpf_common_rxtx.c       | 8 +++-----
 drivers/net/intel/ixgbe/ixgbe_rxtx.c            | 8 --------
 drivers/net/intel/ixgbe/ixgbe_rxtx_vec_common.c | 1 -
 9 files changed, 3 insertions(+), 20 deletions(-)
drivers/net/intel/common/tx.h +0 -1
index 9b3f8385e6..3976766f06 100644
@@ -130,7 +130,6 @@ struct ci_tx_queue {
 	uint16_t *rs_last_id;
 	uint16_t nb_tx_desc;           /* number of TX descriptors */
 	uint16_t tx_tail; /* current value of tail register */
-	uint16_t nb_tx_used; /* number of TX desc used since RS bit set */
 	/* index to last TX descriptor to have been cleaned */
 	uint16_t last_desc_cleaned;
 	/* Total number of TX descriptors ready to be allocated. */
drivers/net/intel/common/tx_scalar_fns.h +0 -1
index 257772a73a..3a65797c5f 100644
@@ -406,7 +406,6 @@ ci_xmit_pkts(struct ci_tx_queue *txq,
 			m_seg = m_seg->next;
 		} while (m_seg);
 end_pkt:
-		txq->nb_tx_used = (uint16_t)(txq->nb_tx_used + nb_used);
 		txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_used);
 
 		/* Check if packet crosses into a new RS threshold bucket.
drivers/net/intel/i40e/i40e_rxtx.c +0 -1
index 68074333aa..812a9a7a83 100644
@@ -2630,7 +2630,6 @@ i40e_reset_tx_queue(struct ci_tx_queue *txq)
 	txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 	txq->tx_tail = 0;
-	txq->nb_tx_used = 0;
 
 	txq->last_desc_cleaned = (uint16_t)(txq->nb_tx_desc - 1);
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_desc - 1);
drivers/net/intel/iavf/iavf_rxtx.c +0 -1
index b78818c02b..5227227b5a 100644
@@ -302,7 +302,6 @@ reset_tx_queue(struct ci_tx_queue *txq)
 	}
 
 	txq->tx_tail = 0;
-	txq->nb_tx_used = 0;
 
 	txq->last_desc_cleaned = txq->nb_tx_desc - 1;
 	txq->nb_tx_free = txq->nb_tx_desc - 1;
drivers/net/intel/ice/ice_dcf_ethdev.c +0 -1
index 4ceecc15c6..02a23629d6 100644
@@ -414,7 +414,6 @@ reset_tx_queue(struct ci_tx_queue *txq)
 	}
 
 	txq->tx_tail = 0;
-	txq->nb_tx_used = 0;
 
 	txq->last_desc_cleaned = txq->nb_tx_desc - 1;
 	txq->nb_tx_free = txq->nb_tx_desc - 1;
drivers/net/intel/ice/ice_rxtx.c +0 -1
index 0c85f9a592..3c1e1d762e 100644
@@ -1130,7 +1130,6 @@ ice_reset_tx_queue(struct ci_tx_queue *txq)
 	txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 	txq->tx_tail = 0;
-	txq->nb_tx_used = 0;
 
 	txq->last_desc_cleaned = (uint16_t)(txq->nb_tx_desc - 1);
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_desc - 1);
drivers/net/intel/idpf/idpf_common_rxtx.c +3 -5
index 1d123f6350..b36e29c8d2 100644
@@ -224,7 +224,6 @@ idpf_qc_split_tx_descq_reset(struct ci_tx_queue *txq)
 	}
 
 	txq->tx_tail = 0;
-	txq->nb_tx_used = 0;
 
 	/* Use this as next to clean for split desc queue */
 	txq->last_desc_cleaned = 0;
@@ -284,7 +283,6 @@ idpf_qc_single_tx_queue_reset(struct ci_tx_queue *txq)
 	}
 
 	txq->tx_tail = 0;
-	txq->nb_tx_used = 0;
 
 	txq->last_desc_cleaned = txq->nb_tx_desc - 1;
 	txq->nb_tx_free = txq->nb_tx_desc - 1;
@@ -993,12 +991,12 @@ idpf_dp_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		txd->qw1.cmd_dtype |= IDPF_TXD_FLEX_FLOW_CMD_EOP;
 
 		txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_used);
-		txq->nb_tx_used = (uint16_t)(txq->nb_tx_used + nb_used);
+		txq->rs_compl_count += nb_used;
 
-		if (txq->nb_tx_used >= 32) {
+		if (txq->rs_compl_count >= 32) {
 			txd->qw1.cmd_dtype |= IDPF_TXD_FLEX_FLOW_CMD_RE;
 			/* Update txq RE bit counters */
-			txq->nb_tx_used = 0;
+			txq->rs_compl_count = 0;
 		}
 	}
 
drivers/net/intel/ixgbe/ixgbe_rxtx.c +0 -8
index 3eeec220fd..6b8ff20f61 100644
@@ -708,12 +708,6 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		 */
 		nb_used = (uint16_t)(tx_pkt->nb_segs + new_ctx);
 
-		if (txp != NULL &&
-				nb_used + txq->nb_tx_used >= txq->tx_rs_thresh)
-			/* set RS on the previous packet in the burst */
-			txp->read.cmd_type_len |=
-				rte_cpu_to_le_32(IXGBE_TXD_CMD_RS);
-
 		/*
 		 * The number of descriptors that must be allocated for a
 		 * packet is the number of segments of that packet, plus 1
@@ -912,7 +906,6 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		 * The last packet data descriptor needs End Of Packet (EOP)
 		 */
 		cmd_type_len |= IXGBE_TXD_CMD_EOP;
-		txq->nb_tx_used = (uint16_t)(txq->nb_tx_used + nb_used);
 		txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_used);
 
 		/*
@@ -2551,7 +2544,6 @@ ixgbe_reset_tx_queue(struct ci_tx_queue *txq)
 	txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 	txq->tx_tail = 0;
-	txq->nb_tx_used = 0;
 	/*
 	 * Always allow 1 descriptor to be un-allocated to avoid
 	 * a H/W race condition
drivers/net/intel/ixgbe/ixgbe_rxtx_vec_common.c +0 -1
index eb7c79eaf9..63c7cb50d3 100644
@@ -47,7 +47,6 @@ ixgbe_reset_tx_queue_vec(struct ci_tx_queue *txq)
 	txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 	txq->tx_tail = 0;
-	txq->nb_tx_used = 0;
 	/*
 	 * Always allow 1 descriptor to be un-allocated to avoid
 	 * a H/W race condition
Signature · 1 line
2.51.0
#59 lore raw

PATCH v2 28/36 net/intel: remove index for tracking end of packet

In reply to Bruce Richardson

The last_id value in each tx_sw_queue entry was no longer used in the datapath, remove it and its initialization. For the function releasing packets back, rather than relying on "last_id" to identify end of packet, instead check for the next pointer being NULL.

---
 drivers/net/intel/common/tx.h             | 1 -
 drivers/net/intel/i40e/i40e_rxtx.c        | 8 +++-----
 drivers/net/intel/iavf/iavf_rxtx.c        | 9 ++++-----
 drivers/net/intel/ice/ice_dcf_ethdev.c    | 1 -
 drivers/net/intel/ice/ice_rxtx.c          | 9 ++++-----
 drivers/net/intel/idpf/idpf_common_rxtx.c | 2 --
 drivers/net/intel/ixgbe/ixgbe_rxtx.c      | 9 ++++-----
 7 files changed, 15 insertions(+), 24 deletions(-)
drivers/net/intel/common/tx.h +0 -1
index 3976766f06..2d3626cbda 100644
@@ -104,7 +104,6 @@ struct ci_tx_queue;
 struct ci_tx_entry {
 	struct rte_mbuf *mbuf; /* mbuf associated with TX desc, if any. */
 	uint16_t next_id; /* Index of next descriptor in ring. */
-	uint16_t last_id; /* Index of last scattered descriptor. */
 };
 
 /**
drivers/net/intel/i40e/i40e_rxtx.c +3 -5
index 812a9a7a83..985d84c0f6 100644
@@ -2521,14 +2521,13 @@ i40e_tx_done_cleanup_full(struct ci_tx_queue *txq,
 			pkt_cnt < free_cnt &&
 			tx_id != tx_last; i++) {
 			if (swr_ring[tx_id].mbuf != NULL) {
-				rte_pktmbuf_free_seg(swr_ring[tx_id].mbuf);
-				swr_ring[tx_id].mbuf = NULL;
-
 				/*
 				 * last segment in the packet,
 				 * increment packet count
 				 */
-				pkt_cnt += (swr_ring[tx_id].last_id == tx_id);
+				pkt_cnt += (swr_ring[tx_id].mbuf->next == NULL) ? 1 : 0;
+				rte_pktmbuf_free_seg(swr_ring[tx_id].mbuf);
+				swr_ring[tx_id].mbuf = NULL;
 			}
 
 			tx_id = swr_ring[tx_id].next_id;
@@ -2621,7 +2620,6 @@ i40e_reset_tx_queue(struct ci_tx_queue *txq)
 		txd->cmd_type_offset_bsz =
 			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
-		txe[i].last_id = i;
 		txe[prev].next_id = i;
 		prev = i;
 	}
drivers/net/intel/iavf/iavf_rxtx.c +4 -5
index 5227227b5a..5a4fea03ac 100644
@@ -296,7 +296,6 @@ reset_tx_queue(struct ci_tx_queue *txq)
 		txq->ci_tx_ring[i].cmd_type_offset_bsz =
 			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
-		txe[i].last_id = i;
 		txe[prev].next_id = i;
 		prev = i;
 	}
@@ -3965,14 +3964,14 @@ iavf_tx_done_cleanup_full(struct ci_tx_queue *txq,
 	while (pkt_cnt < free_cnt) {
 		do {
 			if (swr_ring[tx_id].mbuf != NULL) {
-				rte_pktmbuf_free_seg(swr_ring[tx_id].mbuf);
-				swr_ring[tx_id].mbuf = NULL;
-
 				/*
 				 * last segment in the packet,
 				 * increment packet count
 				 */
-				pkt_cnt += (swr_ring[tx_id].last_id == tx_id);
+				pkt_cnt += (swr_ring[tx_id].mbuf->next == NULL) ? 1 : 0;
+				rte_pktmbuf_free_seg(swr_ring[tx_id].mbuf);
+				swr_ring[tx_id].mbuf = NULL;
+
 			}
 
 			tx_id = swr_ring[tx_id].next_id;
drivers/net/intel/ice/ice_dcf_ethdev.c +0 -1
index 02a23629d6..abd7875e7b 100644
@@ -408,7 +408,6 @@ reset_tx_queue(struct ci_tx_queue *txq)
 		txq->ci_tx_ring[i].cmd_type_offset_bsz =
 			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
-		txe[i].last_id = i;
 		txe[prev].next_id = i;
 		prev = i;
 	}
drivers/net/intel/ice/ice_rxtx.c +4 -5
index 3c1e1d762e..7261c07265 100644
@@ -1121,7 +1121,6 @@ ice_reset_tx_queue(struct ci_tx_queue *txq)
 		txd->cmd_type_offset_bsz =
 			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
-		txe[i].last_id = i;
 		txe[prev].next_id = i;
 		prev = i;
 	}
@@ -3186,14 +3185,14 @@ ice_tx_done_cleanup_full(struct ci_tx_queue *txq,
 			pkt_cnt < free_cnt &&
 			tx_id != tx_last; i++) {
 			if (swr_ring[tx_id].mbuf != NULL) {
-				rte_pktmbuf_free_seg(swr_ring[tx_id].mbuf);
-				swr_ring[tx_id].mbuf = NULL;
-
 				/*
 				 * last segment in the packet,
 				 * increment packet count
 				 */
-				pkt_cnt += (swr_ring[tx_id].last_id == tx_id);
+				pkt_cnt += swr_ring[tx_id].mbuf->next == NULL ? 1 : 0;
+				rte_pktmbuf_free_seg(swr_ring[tx_id].mbuf);
+				swr_ring[tx_id].mbuf = NULL;
+
 			}
 
 			tx_id = swr_ring[tx_id].next_id;
drivers/net/intel/idpf/idpf_common_rxtx.c +0 -2
index b36e29c8d2..781310e564 100644
@@ -218,7 +218,6 @@ idpf_qc_split_tx_descq_reset(struct ci_tx_queue *txq)
 	prev = (uint16_t)(txq->sw_nb_desc - 1);
 	for (i = 0; i < txq->sw_nb_desc; i++) {
 		txe[i].mbuf = NULL;
-		txe[i].last_id = i;
 		txe[prev].next_id = i;
 		prev = i;
 	}
@@ -277,7 +276,6 @@ idpf_qc_single_tx_queue_reset(struct ci_tx_queue *txq)
 		txq->ci_tx_ring[i].cmd_type_offset_bsz =
 			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
-		txe[i].last_id = i;
 		txe[prev].next_id = i;
 		prev = i;
 	}
drivers/net/intel/ixgbe/ixgbe_rxtx.c +4 -5
index 6b8ff20f61..5f4bee4f2f 100644
@@ -2407,14 +2407,14 @@ ixgbe_tx_done_cleanup_full(struct ci_tx_queue *txq, uint32_t free_cnt)
 			pkt_cnt < free_cnt &&
 			tx_id != tx_last; i++) {
 			if (swr_ring[tx_id].mbuf != NULL) {
-				rte_pktmbuf_free_seg(swr_ring[tx_id].mbuf);
-				swr_ring[tx_id].mbuf = NULL;
-
 				/*
 				 * last segment in the packet,
 				 * increment packet count
 				 */
-				pkt_cnt += (swr_ring[tx_id].last_id == tx_id);
+				pkt_cnt += swr_ring[tx_id].mbuf->next == NULL ? 1 : 0;
+				rte_pktmbuf_free_seg(swr_ring[tx_id].mbuf);
+				swr_ring[tx_id].mbuf = NULL;
+
 			}
 
 			tx_id = swr_ring[tx_id].next_id;
@@ -2535,7 +2535,6 @@ ixgbe_reset_tx_queue(struct ci_tx_queue *txq)
 
 		txd->wb.status = rte_cpu_to_le_32(IXGBE_TXD_STAT_DD);
 		txe[i].mbuf = NULL;
-		txe[i].last_id = i;
 		txe[prev].next_id = i;
 		prev = i;
 	}
Signature · 1 line
2.51.0
#60 lore raw

PATCH v2 29/36 net/intel: merge ring writes in simple Tx for ice and i40e

In reply to Bruce Richardson

The ice and i40e drivers have identical code for writing ring entries in the simple Tx path, so merge in the descriptor writing code.

---
 drivers/net/intel/common/tx.h                 |  6 ++
 drivers/net/intel/common/tx_scalar_fns.h      | 60 ++++++++++++++
 drivers/net/intel/i40e/i40e_rxtx.c            | 79 +------------------
 drivers/net/intel/i40e/i40e_rxtx.h            |  3 -
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |  4 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c   |  4 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c |  4 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |  4 +-
 drivers/net/intel/ice/ice_rxtx.c              | 69 +---------------
 drivers/net/intel/ice/ice_rxtx.h              |  2 -
 drivers/net/intel/ice/ice_rxtx_vec_avx2.c     |  4 +-
 drivers/net/intel/ice/ice_rxtx_vec_avx512.c   |  4 +-
 12 files changed, 86 insertions(+), 157 deletions(-)
drivers/net/intel/common/tx.h +6 -0
index 2d3626cbda..502b3f2032 100644
@@ -63,6 +63,12 @@ enum ci_tx_l2tag1_field {
 /* Common maximum data per TX descriptor */
 #define CI_MAX_DATA_PER_TXD     (CI_TXD_QW1_TX_BUF_SZ_M >> CI_TXD_QW1_TX_BUF_SZ_S)
 
+/* Common TX maximum burst size for chunked transmission in simple paths */
+#define CI_TX_MAX_BURST 32
+
+/* Common TX descriptor command flags for simple transmit */
+#define CI_TX_DESC_CMD_DEFAULT (CI_TX_DESC_CMD_ICRC | CI_TX_DESC_CMD_EOP)
+
 /* Checksum offload mask to identify packets requesting offload */
 #define CI_TX_CKSUM_OFFLOAD_MASK (RTE_MBUF_F_TX_IP_CKSUM |		 \
 				   RTE_MBUF_F_TX_L4_MASK |		 \
drivers/net/intel/common/tx_scalar_fns.h +60 -0

66 lines not on this page · raw message

drivers/net/intel/i40e/i40e_rxtx.c +4 -75

114 lines not on this page · raw message

drivers/net/intel/i40e/i40e_rxtx.h +0 -3
index 307ffa3049..0977342064 100644
@@ -47,9 +47,6 @@
 #define I40E_RX_DESC_EXT_STATUS_FLEXBL_MASK   0x03
 #define I40E_RX_DESC_EXT_STATUS_FLEXBL_FLEX   0x01
 
-#define I40E_TD_CMD (CI_TX_DESC_CMD_ICRC |\
-		     CI_TX_DESC_CMD_EOP)
-
 enum i40e_header_split_mode {
 	i40e_header_split_none = 0,
 	i40e_header_split_enabled = 1,
drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +2 -2
index 4c36748d94..68667bdc9b 100644
@@ -476,8 +476,8 @@ i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
-	uint64_t flags = I40E_TD_CMD;
-	uint64_t rs = CI_TX_DESC_CMD_RS | I40E_TD_CMD;
+	uint64_t flags = CI_TX_DESC_CMD_DEFAULT;
+	uint64_t rs = CI_TX_DESC_CMD_RS | CI_TX_DESC_CMD_DEFAULT;
 	int i;
 
 	if (txq->nb_tx_free < txq->tx_free_thresh)
drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +2 -2
index 502a1842c6..e1672c4371 100644
@@ -741,8 +741,8 @@ i40e_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
-	uint64_t flags = I40E_TD_CMD;
-	uint64_t rs = CI_TX_DESC_CMD_RS | I40E_TD_CMD;
+	uint64_t flags = CI_TX_DESC_CMD_DEFAULT;
+	uint64_t rs = CI_TX_DESC_CMD_RS | CI_TX_DESC_CMD_DEFAULT;
 
 	if (txq->nb_tx_free < txq->tx_free_thresh)
 		ci_tx_free_bufs_vec(txq, i40e_tx_desc_done, false);
drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c +2 -2
index d48ff9f51e..bceb95ad2d 100644
@@ -801,8 +801,8 @@ i40e_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
-	uint64_t flags = I40E_TD_CMD;
-	uint64_t rs = CI_TX_DESC_CMD_RS | I40E_TD_CMD;
+	uint64_t flags = CI_TX_DESC_CMD_DEFAULT;
+	uint64_t rs = CI_TX_DESC_CMD_RS | CI_TX_DESC_CMD_DEFAULT;
 
 	if (txq->nb_tx_free < txq->tx_free_thresh)
 		ci_tx_free_bufs_vec(txq, i40e_tx_desc_done, false);
drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +2 -2
index be4c64942e..debc9bda28 100644
@@ -626,8 +626,8 @@ i40e_xmit_fixed_burst_vec(void *__rte_restrict tx_queue,
 	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
-	uint64_t flags = I40E_TD_CMD;
-	uint64_t rs = CI_TX_DESC_CMD_RS | I40E_TD_CMD;
+	uint64_t flags = CI_TX_DESC_CMD_DEFAULT;
+	uint64_t rs = CI_TX_DESC_CMD_RS | CI_TX_DESC_CMD_DEFAULT;
 	int i;
 
 	if (txq->nb_tx_free < txq->tx_free_thresh)
drivers/net/intel/ice/ice_rxtx.c +4 -65

98 lines not on this page · raw message

drivers/net/intel/ice/ice_rxtx.h +0 -2
index cd5fa93d1c..ddcd012e8b 100644
@@ -46,8 +46,6 @@
 
 #define ICE_SUPPORT_CHAIN_NUM 5
 
-#define ICE_TD_CMD                      CI_TX_DESC_CMD_EOP
-
 #define ICE_VPMD_RX_BURST            CI_VPMD_RX_BURST
 #define ICE_VPMD_TX_BURST            32
 #define ICE_VPMD_RXQ_REARM_THRESH    CI_VPMD_RX_REARM_THRESH
drivers/net/intel/ice/ice_rxtx_vec_avx2.c +2 -2
index 2922671158..d03f2e5b36 100644
@@ -845,8 +845,8 @@ ice_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
-	uint64_t flags = ICE_TD_CMD;
-	uint64_t rs = CI_TX_DESC_CMD_RS | ICE_TD_CMD;
+	uint64_t flags = CI_TX_DESC_CMD_DEFAULT;
+	uint64_t rs = CI_TX_DESC_CMD_RS | CI_TX_DESC_CMD_DEFAULT;
 
 	/* cross rx_thresh boundary is not allowed */
 	nb_pkts = RTE_MIN(nb_pkts, txq->tx_rs_thresh);
drivers/net/intel/ice/ice_rxtx_vec_avx512.c +2 -2
index e64b6e227b..004c01054a 100644
@@ -909,8 +909,8 @@ ice_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
-	uint64_t flags = ICE_TD_CMD;
-	uint64_t rs = CI_TX_DESC_CMD_RS | ICE_TD_CMD;
+	uint64_t flags = CI_TX_DESC_CMD_DEFAULT;
+	uint64_t rs = CI_TX_DESC_CMD_RS | CI_TX_DESC_CMD_DEFAULT;
 
 	/* cross rx_thresh boundary is not allowed */
 	nb_pkts = RTE_MIN(nb_pkts, txq->tx_rs_thresh);
Signature · 1 line
2.51.0
#61 lore raw

PATCH v2 30/36 net/intel: consolidate ice and i40e buffer free function

In reply to Bruce Richardson

The buffer freeing function for the simple scalar Tx path is almost identical in both ice and i40e drivers, except that the i40e has batching for the FAST_FREE case. Consolidate both functions into a common one based off the better i40e version.

---
 drivers/net/intel/common/tx.h            |  3 ++
 drivers/net/intel/common/tx_scalar_fns.h | 55 ++++++++++++++++++++++
 drivers/net/intel/i40e/i40e_rxtx.c       | 58 +-----------------------
 drivers/net/intel/ice/ice_rxtx.c         | 40 +---------------
 4 files changed, 62 insertions(+), 94 deletions(-)
drivers/net/intel/common/tx.h +3 -0
index 502b3f2032..753e3a2e9e 100644
@@ -66,6 +66,9 @@ enum ci_tx_l2tag1_field {
 /* Common TX maximum burst size for chunked transmission in simple paths */
 #define CI_TX_MAX_BURST 32
 
+/* Common TX maximum free buffer size for batched bulk freeing */
+#define CI_TX_MAX_FREE_BUF_SZ 64
+
 /* Common TX descriptor command flags for simple transmit */
 #define CI_TX_DESC_CMD_DEFAULT (CI_TX_DESC_CMD_ICRC | CI_TX_DESC_CMD_EOP)
 
drivers/net/intel/common/tx_scalar_fns.h +55 -0

61 lines not on this page · raw message

drivers/net/intel/i40e/i40e_rxtx.c +2 -56

76 lines not on this page · raw message

drivers/net/intel/ice/ice_rxtx.c +2 -38
index 5e4391f120..468c039ab1 100644
@@ -3119,42 +3119,6 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	return ci_xmit_pkts(txq, tx_pkts, nb_pkts, CI_VLAN_IN_L2TAG1, get_context_desc, NULL, NULL);
 }
 
-static __rte_always_inline int
-ice_tx_free_bufs(struct ci_tx_queue *txq)
-{
-	struct ci_tx_entry *txep;
-	uint16_t i;
-
-	if ((txq->ci_tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
-	     rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) !=
-	    rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE))
-		return 0;
-
-	txep = &txq->sw_ring[txq->tx_next_dd - (txq->tx_rs_thresh - 1)];
-
-	for (i = 0; i < txq->tx_rs_thresh; i++)
-		rte_prefetch0((txep + i)->mbuf);
-
-	if (txq->offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) {
-		for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {
-			rte_mempool_put(txep->mbuf->pool, txep->mbuf);
-			txep->mbuf = NULL;
-		}
-	} else {
-		for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {
-			rte_pktmbuf_free_seg(txep->mbuf);
-			txep->mbuf = NULL;
-		}
-	}
-
-	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + txq->tx_rs_thresh);
-	txq->tx_next_dd = (uint16_t)(txq->tx_next_dd + txq->tx_rs_thresh);
-	if (txq->tx_next_dd >= txq->nb_tx_desc)
-		txq->tx_next_dd = (uint16_t)(txq->tx_rs_thresh - 1);
-
-	return txq->tx_rs_thresh;
-}
-
 static int
 ice_tx_done_cleanup_full(struct ci_tx_queue *txq,
 			uint32_t free_cnt)
@@ -3244,7 +3208,7 @@ ice_tx_done_cleanup_simple(struct ci_tx_queue *txq,
 		if (txq->nb_tx_desc - txq->nb_tx_free < txq->tx_rs_thresh)
 			break;
 
-		n = ice_tx_free_bufs(txq);
+		n = ci_tx_free_bufs(txq);
 
 		if (n == 0)
 			break;
@@ -3285,7 +3249,7 @@ tx_xmit_pkts(struct ci_tx_queue *txq,
 	 * descriptor, free the associated buffer.
 	 */
 	if (txq->nb_tx_free < txq->tx_free_thresh)
-		ice_tx_free_bufs(txq);
+		ci_tx_free_bufs(txq);
 
 	/* Use available descriptor only */
 	nb_pkts = (uint16_t)RTE_MIN(txq->nb_tx_free, nb_pkts);
Signature · 1 line
2.51.0
#62 lore raw

PATCH v2 31/36 net/intel: complete merging simple Tx paths

In reply to Bruce Richardson

Complete the deduplication/merger of the ice and i40e Tx simple scalar paths.

---
 drivers/net/intel/common/tx_scalar_fns.h | 87 ++++++++++++++++++++++++
 drivers/net/intel/i40e/i40e_rxtx.c       | 74 +-------------------
 drivers/net/intel/ice/ice_rxtx.c         | 74 +-------------------
 3 files changed, 89 insertions(+), 146 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +87 -0
index d472aa24e0..dcdec200ac 100644
@@ -127,6 +127,93 @@ ci_tx_free_bufs(struct ci_tx_queue *txq)
 	return txq->tx_rs_thresh;
 }
 
+/* Simple burst transmit for descriptor-based simple Tx path
+ *
+ * Transmits a burst of packets by filling hardware descriptors with mbuf
+ * data. Handles ring wrap-around and RS bit management. Performs descriptor
+ * cleanup when tx_free_thresh is reached.
+ *
+ * Returns: number of packets transmitted
+ */
+static inline uint16_t
+ci_xmit_burst_simple(struct ci_tx_queue *txq,
+		     struct rte_mbuf **tx_pkts,
+		     uint16_t nb_pkts)
+{
+	volatile struct ci_tx_desc *txr = txq->ci_tx_ring;
+	uint16_t n = 0;
+
+	/**
+	 * Begin scanning the H/W ring for done descriptors when the number
+	 * of available descriptors drops below tx_free_thresh. For each done
+	 * descriptor, free the associated buffer.
+	 */
+	if (txq->nb_tx_free < txq->tx_free_thresh)
+		ci_tx_free_bufs(txq);
+
+	/* Use available descriptor only */
+	nb_pkts = (uint16_t)RTE_MIN(txq->nb_tx_free, nb_pkts);
+	if (unlikely(!nb_pkts))
+		return 0;
+
+	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);
+	if ((txq->tx_tail + nb_pkts) > txq->nb_tx_desc) {
+		n = (uint16_t)(txq->nb_tx_desc - txq->tx_tail);
+		ci_tx_fill_hw_ring(txq, tx_pkts, n);
+		txr[txq->tx_next_rs].cmd_type_offset_bsz |=
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS) <<
+					  CI_TXD_QW1_CMD_S);
+		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
+		txq->tx_tail = 0;
+	}
+
+	/* Fill hardware descriptor ring with mbuf data */
+	ci_tx_fill_hw_ring(txq, tx_pkts + n, (uint16_t)(nb_pkts - n));
+	txq->tx_tail = (uint16_t)(txq->tx_tail + (nb_pkts - n));
+
+	/* Determine if RS bit needs to be set */
+	if (txq->tx_tail > txq->tx_next_rs) {
+		txr[txq->tx_next_rs].cmd_type_offset_bsz |=
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS) <<
+					  CI_TXD_QW1_CMD_S);
+		txq->tx_next_rs =
+			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
+		if (txq->tx_next_rs >= txq->nb_tx_desc)
+			txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
+	}
+
+	if (txq->tx_tail >= txq->nb_tx_desc)
+		txq->tx_tail = 0;
+
+	/* Update the tx tail register */
+	rte_write32_wc((uint32_t)txq->tx_tail, txq->qtx_tail);
+
+	return nb_pkts;
+}
+
+static __rte_always_inline uint16_t
+ci_xmit_pkts_simple(struct ci_tx_queue *txq,
+		     struct rte_mbuf **tx_pkts,
+		     uint16_t nb_pkts)
+{
+	uint16_t nb_tx = 0;
+
+	if (likely(nb_pkts <= CI_TX_MAX_BURST))
+		return ci_xmit_burst_simple(txq, tx_pkts, nb_pkts);
+
+	while (nb_pkts) {
+		uint16_t ret, num = RTE_MIN(nb_pkts, CI_TX_MAX_BURST);
+
+		ret = ci_xmit_burst_simple(txq, &tx_pkts[nb_tx], num);
+		nb_tx += ret;
+		nb_pkts -= ret;
+		if (ret < num)
+			break;
+	}
+
+	return nb_tx;
+}
+
 /*
  * Common transmit descriptor cleanup function for Intel drivers.
  * Used by ice, i40e, iavf, and idpf drivers.
drivers/net/intel/i40e/i40e_rxtx.c +1 -73

85 lines not on this page · raw message

drivers/net/intel/ice/ice_rxtx.c +1 -73

85 lines not on this page · raw message

Signature · 1 line
2.51.0
#63 lore raw

PATCH v2 32/36 net/intel: use non-volatile stores in simple Tx function

In reply to Bruce Richardson

The simple Tx code path can be reworked to use non-volatile stores - as is the case with the full-featured Tx path - by reusing the existing write_txd function (which just needs to be moved up in the header file). This gives a small performance boost.

---
 drivers/net/intel/common/tx_scalar_fns.h | 55 +++++++-----------------
 1 file changed, 16 insertions(+), 39 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +16 -39
index dcdec200ac..16f802e902 100644
@@ -12,35 +12,13 @@
 /* depends on common Tx definitions. */
 #include "tx.h"
 
-/* Populate 4 descriptors with data from 4 mbufs */
 static inline void
-ci_tx_fill_hw_ring_tx4(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkts)
+write_txd(volatile void *txd, uint64_t qw0, uint64_t qw1)
 {
-	uint64_t dma_addr;
-	uint32_t i;
-
-	for (i = 0; i < 4; i++, txdp++, pkts++) {
-		dma_addr = rte_mbuf_data_iova(*pkts);
-		txdp->buffer_addr = rte_cpu_to_le_64(dma_addr);
-		txdp->cmd_type_offset_bsz =
-			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DATA |
-				((uint64_t)CI_TX_DESC_CMD_DEFAULT << CI_TXD_QW1_CMD_S) |
-				((uint64_t)(*pkts)->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
-	}
-}
+	uint64_t *txd_qw =  __rte_assume_aligned(RTE_CAST_PTR(void *, txd), 16);
 
-/* Populate 1 descriptor with data from 1 mbuf */
-static inline void
-ci_tx_fill_hw_ring_tx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkts)
-{
-	uint64_t dma_addr;
-
-	dma_addr = rte_mbuf_data_iova(*pkts);
-	txdp->buffer_addr = rte_cpu_to_le_64(dma_addr);
-	txdp->cmd_type_offset_bsz =
-		rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DATA |
-			((uint64_t)CI_TX_DESC_CMD_DEFAULT << CI_TXD_QW1_CMD_S) |
-			((uint64_t)(*pkts)->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
+	txd_qw[0] = rte_cpu_to_le_64(qw0);
+	txd_qw[1] = rte_cpu_to_le_64(qw1);
 }
 
 /* Fill hardware descriptor ring with mbuf data */
@@ -60,14 +38,22 @@ ci_tx_fill_hw_ring(struct ci_tx_queue *txq, struct rte_mbuf **pkts,
 	for (i = 0; i < mainpart; i += N_PER_LOOP) {
 		for (j = 0; j < N_PER_LOOP; ++j)
 			(txep + i + j)->mbuf = *(pkts + i + j);
-		ci_tx_fill_hw_ring_tx4(txdp + i, pkts + i);
+		for (j = 0; j < N_PER_LOOP; ++j)
+			write_txd(txdp + i + j, rte_mbuf_data_iova(*(pkts + i + j)),
+				CI_TX_DESC_DTYPE_DATA |
+				((uint64_t)CI_TX_DESC_CMD_DEFAULT << CI_TXD_QW1_CMD_S) |
+				((uint64_t)(*(pkts + i + j))->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
 	}
 
 	if (unlikely(leftover > 0)) {
 		for (i = 0; i < leftover; ++i) {
-			(txep + mainpart + i)->mbuf = *(pkts + mainpart + i);
-			ci_tx_fill_hw_ring_tx1(txdp + mainpart + i,
-					       pkts + mainpart + i);
+			uint16_t idx = mainpart + i;
+			(txep + idx)->mbuf = *(pkts + idx);
+			write_txd(txdp + idx, rte_mbuf_data_iova(*(pkts + idx)),
+				CI_TX_DESC_DTYPE_DATA |
+				((uint64_t)CI_TX_DESC_CMD_DEFAULT << CI_TXD_QW1_CMD_S) |
+				((uint64_t)(*(pkts + idx))->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
+
 		}
 	}
 }
@@ -367,15 +353,6 @@ struct ci_timesstamp_queue_fns {
 	write_ts_tail_t write_ts_tail;
 };
 
-static inline void
-write_txd(volatile void *txd, uint64_t qw0, uint64_t qw1)
-{
-	uint64_t *txd_qw = __rte_assume_aligned(RTE_CAST_PTR(void *, txd), 16);
-
-	txd_qw[0] = rte_cpu_to_le_64(qw0);
-	txd_qw[1] = rte_cpu_to_le_64(qw1);
-}
-
 static inline uint16_t
 ci_xmit_pkts(struct ci_tx_queue *txq,
 	     struct rte_mbuf **tx_pkts,
Signature · 1 line
2.51.0
#64 lore raw

PATCH v2 33/36 net/intel: align scalar simple Tx path with vector logic

In reply to Bruce Richardson

The scalar simple Tx path has the same restrictions as the vector Tx path, so we can use the same logic flow in both, to try and ensure we get best performance from the scalar path.

---
 drivers/net/intel/common/tx_scalar_fns.h | 54 +++++++++++++++---------
 1 file changed, 34 insertions(+), 20 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +34 -20
index 16f802e902..f85ca741a9 100644
@@ -21,13 +21,11 @@ write_txd(volatile void *txd, uint64_t qw0, uint64_t qw1)
 	txd_qw[1] = rte_cpu_to_le_64(qw1);
 }
 
-/* Fill hardware descriptor ring with mbuf data */
+/* Fill hardware descriptor ring with mbuf data (simple path) */
 static inline void
-ci_tx_fill_hw_ring(struct ci_tx_queue *txq, struct rte_mbuf **pkts,
-		   uint16_t nb_pkts)
+ci_tx_fill_hw_ring_simple(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkts,
+			  uint16_t nb_pkts)
 {
-	volatile struct ci_tx_desc *txdp = &txq->ci_tx_ring[txq->tx_tail];
-	struct ci_tx_entry *txep = &txq->sw_ring[txq->tx_tail];
 	const int N_PER_LOOP = 4;
 	const int N_PER_LOOP_MASK = N_PER_LOOP - 1;
 	int mainpart, leftover;
@@ -36,8 +34,6 @@ ci_tx_fill_hw_ring(struct ci_tx_queue *txq, struct rte_mbuf **pkts,
 	mainpart = nb_pkts & ((uint32_t)~N_PER_LOOP_MASK);
 	leftover = nb_pkts & ((uint32_t)N_PER_LOOP_MASK);
 	for (i = 0; i < mainpart; i += N_PER_LOOP) {
-		for (j = 0; j < N_PER_LOOP; ++j)
-			(txep + i + j)->mbuf = *(pkts + i + j);
 		for (j = 0; j < N_PER_LOOP; ++j)
 			write_txd(txdp + i + j, rte_mbuf_data_iova(*(pkts + i + j)),
 				CI_TX_DESC_DTYPE_DATA |
@@ -48,12 +44,10 @@ ci_tx_fill_hw_ring(struct ci_tx_queue *txq, struct rte_mbuf **pkts,
 	if (unlikely(leftover > 0)) {
 		for (i = 0; i < leftover; ++i) {
 			uint16_t idx = mainpart + i;
-			(txep + idx)->mbuf = *(pkts + idx);
 			write_txd(txdp + idx, rte_mbuf_data_iova(*(pkts + idx)),
 				CI_TX_DESC_DTYPE_DATA |
 				((uint64_t)CI_TX_DESC_CMD_DEFAULT << CI_TXD_QW1_CMD_S) |
 				((uint64_t)(*(pkts + idx))->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
-
 		}
 	}
 }
@@ -127,6 +121,9 @@ ci_xmit_burst_simple(struct ci_tx_queue *txq,
 		     uint16_t nb_pkts)
 {
 	volatile struct ci_tx_desc *txr = txq->ci_tx_ring;
+	volatile struct ci_tx_desc *txdp;
+	struct ci_tx_entry *txep;
+	uint16_t tx_id;
 	uint16_t n = 0;
 
 	/**
@@ -142,23 +139,41 @@ ci_xmit_burst_simple(struct ci_tx_queue *txq,
 	if (unlikely(!nb_pkts))
 		return 0;
 
+	tx_id = txq->tx_tail;
+	txdp = &txr[tx_id];
+	txep = &txq->sw_ring[tx_id];
+
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);
-	if ((txq->tx_tail + nb_pkts) > txq->nb_tx_desc) {
-		n = (uint16_t)(txq->nb_tx_desc - txq->tx_tail);
-		ci_tx_fill_hw_ring(txq, tx_pkts, n);
+
+	if ((tx_id + nb_pkts) > txq->nb_tx_desc) {
+		n = (uint16_t)(txq->nb_tx_desc - tx_id);
+
+		/* Store mbufs in backlog */
+		ci_tx_backlog_entry(txep, tx_pkts, n);
+
+		/* Write descriptors to HW ring */
+		ci_tx_fill_hw_ring_simple(txdp, tx_pkts, n);
+
 		txr[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS) <<
 					  CI_TXD_QW1_CMD_S);
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
-		txq->tx_tail = 0;
+
+		tx_id = 0;
+		txdp = &txr[tx_id];
+		txep = &txq->sw_ring[tx_id];
 	}
 
-	/* Fill hardware descriptor ring with mbuf data */
-	ci_tx_fill_hw_ring(txq, tx_pkts + n, (uint16_t)(nb_pkts - n));
-	txq->tx_tail = (uint16_t)(txq->tx_tail + (nb_pkts - n));
+	/* Store remaining mbufs in backlog */
+	ci_tx_backlog_entry(txep, tx_pkts + n, (uint16_t)(nb_pkts - n));
+
+	/* Write remaining descriptors to HW ring */
+	ci_tx_fill_hw_ring_simple(txdp, tx_pkts + n, (uint16_t)(nb_pkts - n));
+
+	tx_id = (uint16_t)(tx_id + (nb_pkts - n));
 
 	/* Determine if RS bit needs to be set */
-	if (txq->tx_tail > txq->tx_next_rs) {
+	if (tx_id > txq->tx_next_rs) {
 		txr[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS) <<
 					  CI_TXD_QW1_CMD_S);
@@ -168,11 +183,10 @@ ci_xmit_burst_simple(struct ci_tx_queue *txq,
 			txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 	}
 
-	if (txq->tx_tail >= txq->nb_tx_desc)
-		txq->tx_tail = 0;
+	txq->tx_tail = tx_id;
 
 	/* Update the tx tail register */
-	rte_write32_wc((uint32_t)txq->tx_tail, txq->qtx_tail);
+	rte_write32_wc((uint32_t)tx_id, txq->qtx_tail);
 
 	return nb_pkts;
 }
Signature · 1 line
2.51.0
#65 lore raw

PATCH v2 34/36 net/intel: use vector SW ring entry for simple path

In reply to Bruce Richardson

The simple scalar Tx path does not need to use the full sw_entry structure that the full Tx path uses, so rename the flag for "vector_tx" to instead be "use_vec_entry" since its sole purpose is to flag the use of the smaller tx_entry_vec structure. Then set this flag for the simple Tx path, giving us a perf boost.

---
 drivers/net/intel/common/tx.h                    |  6 ++++--
 drivers/net/intel/common/tx_scalar_fns.h         | 14 +++++++-------
 drivers/net/intel/cpfl/cpfl_rxtx.c               |  4 ++--
 drivers/net/intel/i40e/i40e_rxtx.c               |  2 +-
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c      |  2 +-
 drivers/net/intel/ice/ice_rxtx.c                 |  2 +-
 drivers/net/intel/idpf/idpf_common_rxtx_avx512.c |  2 +-
 drivers/net/intel/ixgbe/ixgbe_rxtx_vec_common.c  |  2 +-
 8 files changed, 18 insertions(+), 16 deletions(-)
drivers/net/intel/common/tx.h +4 -2
index 753e3a2e9e..44270bf3e6 100644
@@ -160,7 +160,7 @@ struct ci_tx_queue {
 	rte_iova_t tx_ring_dma;        /* TX ring DMA address */
 	bool tx_deferred_start; /* don't start this queue in dev start */
 	bool q_set;             /* indicate if tx queue has been configured */
-	bool vector_tx;         /* port is using vector TX */
+	bool use_vec_entry;     /* use sw_ring_vec (true for vector and simple paths) */
 	union {                  /* the VSI this queue belongs to */
 		struct i40e_vsi *i40e_vsi;
 		struct iavf_vsi *iavf_vsi;
@@ -343,7 +343,8 @@ ci_txq_release_all_mbufs(struct ci_tx_queue *txq, bool use_ctx)
 	if (unlikely(!txq || !txq->sw_ring))
 		return;
 
-	if (!txq->vector_tx) {
+	if (!txq->use_vec_entry) {
+		/* Regular scalar path uses sw_ring with ci_tx_entry */
 		for (uint16_t i = 0; i < txq->nb_tx_desc; i++) {
 			if (txq->sw_ring[i].mbuf != NULL) {
 				rte_pktmbuf_free_seg(txq->sw_ring[i].mbuf);
@@ -354,6 +355,7 @@ ci_txq_release_all_mbufs(struct ci_tx_queue *txq, bool use_ctx)
 	}
 
 	/**
+	 *  Vector and simple paths use sw_ring_vec (ci_tx_entry_vec).
 	 *  vPMD tx will not set sw_ring's mbuf to NULL after free,
 	 *  so determining buffers to free is a little more complex.
 	 */
drivers/net/intel/common/tx_scalar_fns.h +7 -7
index f85ca741a9..b284b80cbe 100644
@@ -56,7 +56,7 @@ ci_tx_fill_hw_ring_simple(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pk
 static __rte_always_inline int
 ci_tx_free_bufs(struct ci_tx_queue *txq)
 {
-	struct ci_tx_entry *txep;
+	struct ci_tx_entry_vec *txep;
 	uint16_t tx_rs_thresh = txq->tx_rs_thresh;
 	uint16_t i = 0, j = 0;
 	struct rte_mbuf *free[CI_TX_MAX_FREE_BUF_SZ];
@@ -68,7 +68,7 @@ ci_tx_free_bufs(struct ci_tx_queue *txq)
 			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE))
 		return 0;
 
-	txep = &txq->sw_ring[txq->tx_next_dd - (tx_rs_thresh - 1)];
+	txep = &txq->sw_ring_vec[txq->tx_next_dd - (tx_rs_thresh - 1)];
 
 	for (i = 0; i < tx_rs_thresh; i++)
 		rte_prefetch0((txep + i)->mbuf);
@@ -122,7 +122,7 @@ ci_xmit_burst_simple(struct ci_tx_queue *txq,
 {
 	volatile struct ci_tx_desc *txr = txq->ci_tx_ring;
 	volatile struct ci_tx_desc *txdp;
-	struct ci_tx_entry *txep;
+	struct ci_tx_entry_vec *txep;
 	uint16_t tx_id;
 	uint16_t n = 0;
 
@@ -141,7 +141,7 @@ ci_xmit_burst_simple(struct ci_tx_queue *txq,
 
 	tx_id = txq->tx_tail;
 	txdp = &txr[tx_id];
-	txep = &txq->sw_ring[tx_id];
+	txep = &txq->sw_ring_vec[tx_id];
 
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);
 
@@ -149,7 +149,7 @@ ci_xmit_burst_simple(struct ci_tx_queue *txq,
 		n = (uint16_t)(txq->nb_tx_desc - tx_id);
 
 		/* Store mbufs in backlog */
-		ci_tx_backlog_entry(txep, tx_pkts, n);
+		ci_tx_backlog_entry_vec(txep, tx_pkts, n);
 
 		/* Write descriptors to HW ring */
 		ci_tx_fill_hw_ring_simple(txdp, tx_pkts, n);
@@ -161,11 +161,11 @@ ci_xmit_burst_simple(struct ci_tx_queue *txq,
 
 		tx_id = 0;
 		txdp = &txr[tx_id];
-		txep = &txq->sw_ring[tx_id];
+		txep = &txq->sw_ring_vec[tx_id];
 	}
 
 	/* Store remaining mbufs in backlog */
-	ci_tx_backlog_entry(txep, tx_pkts + n, (uint16_t)(nb_pkts - n));
+	ci_tx_backlog_entry_vec(txep, tx_pkts + n, (uint16_t)(nb_pkts - n));
 
 	/* Write remaining descriptors to HW ring */
 	ci_tx_fill_hw_ring_simple(txdp, tx_pkts + n, (uint16_t)(nb_pkts - n));
drivers/net/intel/cpfl/cpfl_rxtx.c +2 -2
index a3127e7c97..6d8798a60f 100644
@@ -328,7 +328,7 @@ cpfl_tx_queue_release(void *txq)
 		rte_free(q->complq);
 	}
 
-	ci_txq_release_all_mbufs(q, q->vector_tx);
+	ci_txq_release_all_mbufs(q, q->use_vec_entry);
 	rte_free(q->sw_ring);
 	rte_memzone_free(q->mz);
 	rte_free(cpfl_txq);
@@ -1335,7 +1335,7 @@ cpfl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 	}
 
 	txq = &cpfl_txq->base;
-	ci_txq_release_all_mbufs(txq, txq->vector_tx);
+	ci_txq_release_all_mbufs(txq, txq->use_vec_entry);
 	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SINGLE) {
 		idpf_qc_single_tx_queue_reset(txq);
 	} else {
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
index ac53554234..185e45fb9a 100644
@@ -1453,7 +1453,7 @@ i40e_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 		PMD_DRV_LOG(WARNING, "TX queue %u is deferred start",
 			    tx_queue_id);
 
-	txq->vector_tx = ad->tx_vec_allowed;
+	txq->use_vec_entry = ad->tx_vec_allowed || ad->tx_simple_allowed;
 
 	/*
 	 * tx_queue_id is queue id application refers to, while
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +1 -1
index cea4ee9863..374c713a94 100644
@@ -1803,7 +1803,7 @@ iavf_xmit_pkts_vec_avx2_offload(void *tx_queue, struct rte_mbuf **tx_pkts,
 int __rte_cold
 iavf_txq_vec_setup(struct ci_tx_queue *txq)
 {
-	txq->vector_tx = true;
+	txq->use_vec_entry = true;
 	return 0;
 }
 
drivers/net/intel/ice/ice_rxtx.c +1 -1
index ed82a84dc5..06f7e85c12 100644
@@ -882,7 +882,7 @@ ice_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 		}
 
 	/* record what kind of descriptor cleanup we need on teardown */
-	txq->vector_tx = ad->tx_vec_allowed;
+	txq->use_vec_entry = ad->tx_vec_allowed || ad->tx_simple_allowed;
 
 	if (txq->tsq != NULL && txq->tsq->ts_flag > 0) {
 		struct ice_aqc_set_txtime_qgrp *ts_elem;
drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +1 -1
index 49ace35615..666ad1a4dd 100644
@@ -1365,6 +1365,6 @@ idpf_qc_tx_vec_avx512_setup(struct ci_tx_queue *txq)
 	if (!txq)
 		return 0;
 
-	txq->vector_tx = true;
+	txq->use_vec_entry = true;
 	return 0;
 }
drivers/net/intel/ixgbe/ixgbe_rxtx_vec_common.c +1 -1
index 63c7cb50d3..c42b8fc96b 100644
@@ -111,7 +111,7 @@ ixgbe_txq_vec_setup(struct ci_tx_queue *txq)
 	/* leave the first one for overflow */
 	txq->sw_ring_vec = txq->sw_ring_vec + 1;
 	txq->ops = &vec_txq_ops;
-	txq->vector_tx = 1;
+	txq->use_vec_entry = true;
 
 	return 0;
 }
Signature · 1 line
2.51.0
#66 lore raw

PATCH v2 35/36 net/intel: use vector mbuf cleanup from simple scalar path

In reply to Bruce Richardson

Since the simple scalar path now uses the vector Tx entry struct, we can leverage the vector mbuf cleanup function from that path and avoid having a separate cleanup function for it.

---
 drivers/net/intel/common/tx_scalar_fns.h | 71 +++++-------------------
 drivers/net/intel/i40e/i40e_rxtx.c       |  2 +-
 drivers/net/intel/ice/ice_rxtx.c         |  2 +-
 3 files changed, 17 insertions(+), 58 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +15 -56
index b284b80cbe..ce3837a201 100644
@@ -21,6 +21,20 @@ write_txd(volatile void *txd, uint64_t qw0, uint64_t qw1)
 	txd_qw[1] = rte_cpu_to_le_64(qw1);
 }
 
+static __rte_always_inline int
+ci_tx_desc_done_simple(struct ci_tx_queue *txq, uint16_t idx)
+{
+	return (txq->ci_tx_ring[idx].cmd_type_offset_bsz & rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) ==
+			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
+}
+
+/* Free transmitted mbufs using vector-style cleanup */
+static __rte_always_inline int
+ci_tx_free_bufs_simple(struct ci_tx_queue *txq)
+{
+	return ci_tx_free_bufs_vec(txq, ci_tx_desc_done_simple, false);
+}
+
 /* Fill hardware descriptor ring with mbuf data (simple path) */
 static inline void
 ci_tx_fill_hw_ring_simple(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkts,
@@ -52,61 +66,6 @@ ci_tx_fill_hw_ring_simple(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pk
 	}
 }
 
-/* Free transmitted mbufs from descriptor ring with bulk freeing for Tx simple path */
-static __rte_always_inline int
-ci_tx_free_bufs(struct ci_tx_queue *txq)
-{
-	struct ci_tx_entry_vec *txep;
-	uint16_t tx_rs_thresh = txq->tx_rs_thresh;
-	uint16_t i = 0, j = 0;
-	struct rte_mbuf *free[CI_TX_MAX_FREE_BUF_SZ];
-	const uint16_t k = RTE_ALIGN_FLOOR(tx_rs_thresh, CI_TX_MAX_FREE_BUF_SZ);
-	const uint16_t m = tx_rs_thresh % CI_TX_MAX_FREE_BUF_SZ;
-
-	if ((txq->ci_tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
-			rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) !=
-			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE))
-		return 0;
-
-	txep = &txq->sw_ring_vec[txq->tx_next_dd - (tx_rs_thresh - 1)];
-
-	for (i = 0; i < tx_rs_thresh; i++)
-		rte_prefetch0((txep + i)->mbuf);
-
-	if (txq->offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) {
-		if (k) {
-			for (j = 0; j != k; j += CI_TX_MAX_FREE_BUF_SZ) {
-				for (i = 0; i < CI_TX_MAX_FREE_BUF_SZ; ++i, ++txep) {
-					free[i] = txep->mbuf;
-					txep->mbuf = NULL;
-				}
-				rte_mbuf_raw_free_bulk(free[0]->pool, free,
-						CI_TX_MAX_FREE_BUF_SZ);
-			}
-		}
-
-		if (m) {
-			for (i = 0; i < m; ++i, ++txep) {
-				free[i] = txep->mbuf;
-				txep->mbuf = NULL;
-			}
-			rte_mbuf_raw_free_bulk(free[0]->pool, free, m);
-		}
-	} else {
-		for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) {
-			rte_pktmbuf_free_seg(txep->mbuf);
-			txep->mbuf = NULL;
-		}
-	}
-
-	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + txq->tx_rs_thresh);
-	txq->tx_next_dd = (uint16_t)(txq->tx_next_dd + txq->tx_rs_thresh);
-	if (txq->tx_next_dd >= txq->nb_tx_desc)
-		txq->tx_next_dd = (uint16_t)(txq->tx_rs_thresh - 1);
-
-	return txq->tx_rs_thresh;
-}
-
 /* Simple burst transmit for descriptor-based simple Tx path
  *
  * Transmits a burst of packets by filling hardware descriptors with mbuf
@@ -132,7 +91,7 @@ ci_xmit_burst_simple(struct ci_tx_queue *txq,
 	 * descriptor, free the associated buffer.
 	 */
 	if (txq->nb_tx_free < txq->tx_free_thresh)
-		ci_tx_free_bufs(txq);
+		ci_tx_free_bufs_simple(txq);
 
 	/* Use available descriptor only */
 	nb_pkts = (uint16_t)RTE_MIN(txq->nb_tx_free, nb_pkts);
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
index 185e45fb9a..820a955158 100644
@@ -2367,7 +2367,7 @@ i40e_tx_done_cleanup_simple(struct ci_tx_queue *txq,
 		if (txq->nb_tx_desc - txq->nb_tx_free < txq->tx_rs_thresh)
 			break;
 
-		n = ci_tx_free_bufs(txq);
+		n = ci_tx_free_bufs_simple(txq);
 
 		if (n == 0)
 			break;
drivers/net/intel/ice/ice_rxtx.c +1 -1
index 06f7e85c12..be9d88dda6 100644
@@ -3208,7 +3208,7 @@ ice_tx_done_cleanup_simple(struct ci_tx_queue *txq,
 		if (txq->nb_tx_desc - txq->nb_tx_free < txq->tx_rs_thresh)
 			break;
 
-		n = ci_tx_free_bufs(txq);
+		n = ci_tx_free_bufs_simple(txq);
 
 		if (n == 0)
 			break;
Signature · 1 line
2.51.0
#67 lore raw

PATCH v2 36/36 net/idpf: enable simple Tx function

In reply to Bruce Richardson

The common "simple Tx" function - in some ways a scalar version of the vector Tx functions - can be used by the idpf driver as well as i40e and ice, so add support for it to the driver.

---
 drivers/net/intel/idpf/idpf_common_device.h |  2 ++
 drivers/net/intel/idpf/idpf_common_rxtx.c   | 19 +++++++++++++++
 drivers/net/intel/idpf/idpf_common_rxtx.h   |  3 +++
 drivers/net/intel/idpf/idpf_rxtx.c          | 26 ++++++++++++++++++++-
 4 files changed, 49 insertions(+), 1 deletion(-)
drivers/net/intel/idpf/idpf_common_device.h +2 -0
index 31915a03d4..527aa9b3dc 100644
@@ -78,6 +78,7 @@ enum idpf_rx_func_type {
 enum idpf_tx_func_type {
 	IDPF_TX_DEFAULT,
 	IDPF_TX_SINGLEQ,
+	IDPF_TX_SINGLEQ_SIMPLE,
 	IDPF_TX_SINGLEQ_AVX2,
 	IDPF_TX_AVX512,
 	IDPF_TX_SINGLEQ_AVX512,
@@ -100,6 +101,7 @@ struct idpf_adapter {
 
 	bool is_tx_singleq; /* true - single queue model, false - split queue model */
 	bool is_rx_singleq; /* true - single queue model, false - split queue model */
+	bool tx_simple_allowed; /* true if all queues support simple TX */
 
 	/* For timestamp */
 	uint64_t time_hw;
drivers/net/intel/idpf/idpf_common_rxtx.c +19 -0
index 781310e564..bf2e9363d4 100644
@@ -1348,6 +1348,15 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			idpf_set_tso_ctx, NULL, NULL);
 }
 
+RTE_EXPORT_INTERNAL_SYMBOL(idpf_dp_singleq_xmit_pkts_simple)
+uint16_t
+idpf_dp_singleq_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
+				   uint16_t nb_pkts)
+{
+	return ci_xmit_pkts_simple(tx_queue, tx_pkts, nb_pkts);
+}
+
+
 /* TX prep functions */
 RTE_EXPORT_INTERNAL_SYMBOL(idpf_dp_prep_pkts)
 uint16_t
@@ -1533,6 +1542,16 @@ const struct ci_tx_path_info idpf_tx_path_infos[] = {
 			.single_queue = true
 		}
 	},
+	[IDPF_TX_SINGLEQ_SIMPLE] = {
+		.pkt_burst = idpf_dp_singleq_xmit_pkts_simple,
+		.info = "Single Queue Scalar Simple",
+		.features = {
+			.tx_offloads = IDPF_TX_VECTOR_OFFLOADS,
+			.single_queue = true,
+			.simple_tx = true,
+		}
+	},
+
 #ifdef RTE_ARCH_X86
 	[IDPF_TX_SINGLEQ_AVX2] = {
 		.pkt_burst = idpf_dp_singleq_xmit_pkts_avx2,
drivers/net/intel/idpf/idpf_common_rxtx.h +3 -0
index fe7094d434..914cab0f25 100644
@@ -221,6 +221,9 @@ __rte_internal
 uint16_t idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 				   uint16_t nb_pkts);
 __rte_internal
+uint16_t idpf_dp_singleq_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
+				   uint16_t nb_pkts);
+__rte_internal
 uint16_t idpf_dp_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			   uint16_t nb_pkts);
 __rte_internal
drivers/net/intel/idpf/idpf_rxtx.c +25 -1
index 5c2516f556..a2bb4b766d 100644
@@ -497,6 +497,22 @@ idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	txq->q_set = true;
 	dev->data->tx_queues[queue_idx] = txq;
 
+	/* Set tx_simple_allowed flag based on queue configuration.
+	 * For queue 0: explicitly set the flag based on its configuration.
+	 * For other queues: only set to false if this queue cannot use simple_tx.
+	 */
+	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT)
+		goto out;
+
+	/* for first queue, default to true, disable later if any queue can't meet conditions */
+	if (queue_idx == 0)
+		adapter->tx_simple_allowed = true;
+
+	if ((txq->offloads != (txq->offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)) ||
+			txq->tx_rs_thresh < IDPF_VPMD_TX_MAX_BURST)
+		adapter->tx_simple_allowed = false;
+
+out:
 	return 0;
 
 err_complq_setup:
@@ -639,6 +655,7 @@ int
 idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *ad = vport->adapter;
 	struct ci_tx_queue *txq = dev->data->tx_queues[tx_queue_id];
 	int err = 0;
 
@@ -655,6 +672,12 @@ idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 		return err;
 	}
 
+	/* Record what kind of descriptor cleanup we need on teardown.
+	 * For single queue mode, vector or simple tx paths use vec entry format.
+	 */
+	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SINGLE)
+		txq->use_vec_entry = ad->tx_simple_allowed;
+
 	/* Ready to switch the queue on */
 	err = idpf_vc_queue_switch(vport, tx_queue_id, false, true,
 							VIRTCHNL2_QUEUE_TYPE_TX);
@@ -835,7 +858,8 @@ idpf_set_tx_function(struct rte_eth_dev *dev)
 	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)
+		.single_queue = (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SINGLE),
+		.simple_tx = ad->tx_simple_allowed
 	};
 
 	/* The primary process selects the tx path for all processes. */
Signature · 1 line
2.51.0
#68 lore raw
In reply to Bruce Richardson
Quoted 97 lines · On Tue, 13 Jan 2026 15:14:24 +0000 Bruce Richardson…

The scalar Tx paths, with support for offloads and multiple mbufs per packet, are almost identical across drivers ice, i40e, iavf and the single-queue mode of idpf. Therefore, we can do some rework to combine these code paths into a single function which is parameterized by compile-time constants, allowing code saving to give us a single path to optimize and maintain - apart from edge cases like IPSec support in iavf.

The ixgbe driver has a number of similarities too, which we take advantage of where we can, but the overall descriptor format is sufficiently different that its main scalar code path is kept separate.

Once merged, we can then optimize the drivers a bit to improve performance, and also easily extend some drivers to use additional paths for better performance, e.g. add the "simple scalar" path to IDPF driver for better performance on platforms without AVX.

V2:
- reworked the simple-scalar path as well as full scalar one
- added simple scalar path support to idpf driver
- small cleanups, e.g. issues flagged by checkpatch

Bruce Richardson (36):
net/intel: create common Tx descriptor structure net/intel: use common Tx ring structure net/intel: create common post-Tx cleanup function net/intel: consolidate definitions for Tx desc fields net/intel: create separate header for Tx scalar fns net/intel: add common fn to calculate needed descriptors net/ice: refactor context descriptor handling net/i40e: refactor context descriptor handling net/idpf: refactor context descriptor handling net/intel: consolidate checksum mask definition net/intel: create common checksum Tx offload function net/intel: create a common scalar Tx function net/i40e: use common scalar Tx function net/intel: add IPsec hooks to common Tx function net/intel: support configurable VLAN tag insertion on Tx net/iavf: use common scalar Tx function net/i40e: document requirement for QinQ support net/idpf: use common scalar Tx function net/intel: avoid writing the final pkt descriptor twice
eal: add macro for marking assumed alignment net/intel: write descriptors using non-volatile pointers net/intel: remove unnecessary flag clearing net/intel: mark mid-burst ring cleanup as unlikely net/intel: add special handling for single desc packets net/intel: use separate array for desc status tracking net/ixgbe: use separate array for desc status tracking net/intel: drop unused Tx queue used count net/intel: remove index for tracking end of packet net/intel: merge ring writes in simple Tx for ice and i40e net/intel: consolidate ice and i40e buffer free function net/intel: complete merging simple Tx paths net/intel: use non-volatile stores in simple Tx function net/intel: align scalar simple Tx path with vector logic net/intel: use vector SW ring entry for simple path net/intel: use vector mbuf cleanup from simple scalar path net/idpf: enable simple Tx function

 doc/guides/nics/i40e.rst                      |  18 +
 drivers/net/intel/common/tx.h                 | 116 ++-
 drivers/net/intel/common/tx_scalar_fns.h      | 595 ++++++++++++++
 drivers/net/intel/cpfl/cpfl_rxtx.c            |   8 +-
 drivers/net/intel/i40e/i40e_fdir.c            |  34 +-
 drivers/net/intel/i40e/i40e_rxtx.c            | 670 +++-------------
 drivers/net/intel/i40e/i40e_rxtx.h            |  16 -
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |  25 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c   |  36 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c |  52 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_common.h |   6 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |  25 +-
 drivers/net/intel/iavf/iavf_rxtx.c            | 642 ++++-----------
 drivers/net/intel/iavf/iavf_rxtx.h            |  30 +-
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   |  55 +-
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 104 +--
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h |  36 +-
 drivers/net/intel/ice/ice_dcf_ethdev.c        |  10 +-
 drivers/net/intel/ice/ice_rxtx.c              | 737 ++++--------------
 drivers/net/intel/ice/ice_rxtx.h              |  15 -
 drivers/net/intel/ice/ice_rxtx_vec_avx2.c     |  55 +-
 drivers/net/intel/ice/ice_rxtx_vec_avx512.c   |  53 +-
 drivers/net/intel/ice/ice_rxtx_vec_common.h   |  43 +-
 drivers/net/intel/idpf/idpf_common_device.h   |   2 +
 drivers/net/intel/idpf/idpf_common_rxtx.c     | 315 ++------
 drivers/net/intel/idpf/idpf_common_rxtx.h     |  24 +-
 .../net/intel/idpf/idpf_common_rxtx_avx2.c    |  53 +-
 .../net/intel/idpf/idpf_common_rxtx_avx512.c  |  55 +-
 drivers/net/intel/idpf/idpf_rxtx.c            |  43 +-
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |   6 +-
 drivers/net/intel/ixgbe/ixgbe_rxtx.c          | 103 ++-
 .../net/intel/ixgbe/ixgbe_rxtx_vec_common.c   |   3 +-
 lib/eal/include/rte_common.h                  |   6 +
 33 files changed, 1565 insertions(+), 2426 deletions(-)
 create mode 100644 drivers/net/intel/common/tx_scalar_fns.h
Quoted 2 lines

--
2.51.0

Looks ok to me, asked Claude for second opinion.

Its suggestion about long log message is overblown. Although, I would suggest being more succinct.

# DPDK Patch Review: Intel Tx Consolidation Series (v2)

**Series:** [PATCH v2 01-36/36] Intel Tx code consolidation **Author:** Bruce Richardson <[email protected]> **Patches Reviewed:** 36
**Review Date:** January 13, 2026

---

## Executive Summary

This is a substantial refactoring series that consolidates Tx (transmit) descriptor structures and functions across Intel network drivers (i40e, ice, iavf, idpf, ixgbe). The series is well-structured with clear commit messages and proper attribution. A few minor issues were identified.

| Severity | Count |
|----------|-------|
| Error    | 1     |
| Warning  | 4     |
| Info     | 2     |

---

## Errors (Must Fix)

### 1. Patch 17/36: Line exceeds 100 characters

**File:** drivers/net/intel/i40e/i40e_rxtx.c **Subject:** net/i40e: document requirement for QinQ support

```c
PMD_DRV_LOG(WARNING, "Double VLAN insertion may not work correctly without RTE_ETH_RX_OFFLOAD_VLAN_EXTEND set in Rx configuration.");
```

**Issue:** Line is 136 characters, exceeding the 100-character limit for source code.

**Suggested fix:** Split the log message:

```c
PMD_DRV_LOG(WARNING, "Double VLAN insertion may not work correctly "
		"without RTE_ETH_RX_OFFLOAD_VLAN_EXTEND set in Rx configuration.");
```

---

## Warnings (Should Fix)

### 2. Patch 14/36: Implicit pointer comparison

**File:** drivers/net/intel/common/tx_scalar_fns.h **Subject:** net/intel: add IPsec hooks to common Tx function

```c
md = RTE_MBUF_DYNFIELD(mbuf, txq->ipsec_crypto_pkt_md_offset,
			     struct iavf_ipsec_crypto_pkt_metadata *);
if (!md)
```

**Issue:** Pointer comparison uses !md instead of explicit md == NULL.

**Suggested fix:**

```c
if (md == NULL)
```

### 3. Patch 16/36: Implicit integer comparison

**File:** drivers/net/intel/iavf/iavf_rxtx.c **Subject:** net/iavf: use common scalar Tx function

```c
if (!iavf_calc_context_desc(mbuf, iavf_vlan_flag))
```

**Issue:** iavf_calc_context_desc() returns uint16_t. Comparison should be explicit.

**Suggested fix:**

```c
if (iavf_calc_context_desc(mbuf, iavf_vlan_flag) == 0)
```

### 4. Patches 19, 25, 26: Implicit integer comparison with rte_is_power_of_2()

**Multiple files across patches**

```c
if (!rte_is_power_of_2(tx_rs_thresh)) {
```

**Issue:** While rte_is_power_of_2() acts as a boolean predicate, it returns int. Strictly, the comparison should be explicit.

**Suggested fix:**

```c
if (rte_is_power_of_2(tx_rs_thresh) == 0) {
```

*Note: This is a borderline issue as the function is semantically boolean. May be acceptable.*

### 5. Patch 36/36: Double blank lines

**File:** drivers/net/intel/idpf/idpf_common_rxtx.c **Subject:** net/idpf: enable simple Tx function

```c
	return ci_xmit_pkts_simple(tx_queue, tx_pkts, nb_pkts);
}


/* TX prep functions */
```

**Issue:** Two consecutive blank lines after function definition.

**Suggested fix:** Remove one blank line.

---

## Info (Consider)

### 6. Patch 20/36: New EAL macro without release notes

**File:** lib/eal/include/rte_common.h **Subject:** eal: add macro for marking assumed alignment

The patch adds __rte_assume_aligned macro to EAL common header. While this is an internal optimization helper, significant EAL additions typically warrant a release note entry.

**Suggestion:** Consider adding a brief mention in release notes for the current release cycle.

### 7. Overall: No documentation for new internal APIs

The series adds new internal functions (e.g., idpf_dp_singleq_xmit_pkts_simple) marked with __rte_internal. While internal APIs don't require Doxygen, brief inline comments explaining their purpose would aid maintainability.

---

## Compliance Summary

### Commit Message Checklist

| Check | Status |
|-------|--------|
| Subject lines ≤60 characters | ✅ All pass (max: 51 chars) |
| Lowercase after colon | ✅ All pass |
| Correct component prefix | ✅ All pass (`net/intel:`, `net/i40e:`, `eal:`, etc.) |
| Imperative mood | ✅ All pass |
| No trailing period | ✅ All pass |
| Signed-off-by present | ✅ All 36 patches |
| Real name and valid email | ✅ Bruce Richardson <[email protected]> |
| Body wrapped at 75 chars | ✅ All pass |

### Code Style Checklist

| Check | Status |
|-------|--------|
| Lines ≤100 characters | ❌ 1 violation (Patch 17) |
| No trailing whitespace | ✅ Pass |
| `__rte_internal` alone on line | ✅ Correct usage |
| Explicit pointer comparisons | ⚠️ 1 violation (Patch 14) |
| Explicit integer comparisons | ⚠️ ~6 instances |
| No double blank lines | ⚠️ 1 violation (Patch 36) |
| No unnecessary void* casts | ✅ Pass |
| No forbidden tokens | ✅ Pass |

### Structure Checklist

| Check | Status |
|-------|--------|
| Each commit compiles independently | ✅ Appears correct |
| Code and docs updated together | ✅ Patch 17 adds docs with code |
| New internal APIs marked `__rte_internal` | ✅ Correct |
| Release notes updated | ⚠️ Consider for EAL changes |

---

## Technical Assessment

The series accomplishes significant code consolidation:

1. **Common Tx descriptor structure** (struct ci_tx_desc) unifies identical 16-byte descriptors across i40e, iavf, ice, and idpf drivers.

2. **Shared scalar Tx function** (ci_xmit_pkts()) reduces code duplication significantly.

3. **Simple Tx path** optimization enables scalar code to use the more efficient vector SW ring entry format.

4. **New EAL macro** (__rte_assume_aligned) provides portable way to mark pointer alignment assumptions for compiler optimization.

The refactoring maintains backward compatibility and should not introduce functional regressions.

---

## Recommendation

**Acceptable with minor revisions.** Address the Error and consider fixing the Warnings before merge.

---

*Review generated according to DPDK AGENTS.md guidelines*

#69 lore raw
In reply to Bruce Richardson
Quoted 88 lines · On Tue, 13 Jan 2026 15:14:24 +0000 Bruce Richardson…

The scalar Tx paths, with support for offloads and multiple mbufs per packet, are almost identical across drivers ice, i40e, iavf and the single-queue mode of idpf. Therefore, we can do some rework to combine these code paths into a single function which is parameterized by compile-time constants, allowing code saving to give us a single path to optimize and maintain - apart from edge cases like IPSec support in iavf.

The ixgbe driver has a number of similarities too, which we take advantage of where we can, but the overall descriptor format is sufficiently different that its main scalar code path is kept separate.

Once merged, we can then optimize the drivers a bit to improve performance, and also easily extend some drivers to use additional paths for better performance, e.g. add the "simple scalar" path to IDPF driver for better performance on platforms without AVX.

V2:
- reworked the simple-scalar path as well as full scalar one
- added simple scalar path support to idpf driver
- small cleanups, e.g. issues flagged by checkpatch

Bruce Richardson (36):
net/intel: create common Tx descriptor structure net/intel: use common Tx ring structure net/intel: create common post-Tx cleanup function net/intel: consolidate definitions for Tx desc fields net/intel: create separate header for Tx scalar fns net/intel: add common fn to calculate needed descriptors net/ice: refactor context descriptor handling net/i40e: refactor context descriptor handling net/idpf: refactor context descriptor handling net/intel: consolidate checksum mask definition net/intel: create common checksum Tx offload function net/intel: create a common scalar Tx function net/i40e: use common scalar Tx function net/intel: add IPsec hooks to common Tx function net/intel: support configurable VLAN tag insertion on Tx net/iavf: use common scalar Tx function net/i40e: document requirement for QinQ support net/idpf: use common scalar Tx function net/intel: avoid writing the final pkt descriptor twice
eal: add macro for marking assumed alignment net/intel: write descriptors using non-volatile pointers net/intel: remove unnecessary flag clearing net/intel: mark mid-burst ring cleanup as unlikely net/intel: add special handling for single desc packets net/intel: use separate array for desc status tracking net/ixgbe: use separate array for desc status tracking net/intel: drop unused Tx queue used count net/intel: remove index for tracking end of packet net/intel: merge ring writes in simple Tx for ice and i40e net/intel: consolidate ice and i40e buffer free function net/intel: complete merging simple Tx paths net/intel: use non-volatile stores in simple Tx function net/intel: align scalar simple Tx path with vector logic net/intel: use vector SW ring entry for simple path net/intel: use vector mbuf cleanup from simple scalar path net/idpf: enable simple Tx function

 doc/guides/nics/i40e.rst                      |  18 +
 drivers/net/intel/common/tx.h                 | 116 ++-
 drivers/net/intel/common/tx_scalar_fns.h      | 595 ++++++++++++++
 drivers/net/intel/cpfl/cpfl_rxtx.c            |   8 +-
 drivers/net/intel/i40e/i40e_fdir.c            |  34 +-
 drivers/net/intel/i40e/i40e_rxtx.c            | 670 +++-------------
 drivers/net/intel/i40e/i40e_rxtx.h            |  16 -
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |  25 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c   |  36 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c |  52 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_common.h |   6 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |  25 +-
 drivers/net/intel/iavf/iavf_rxtx.c            | 642 ++++-----------
 drivers/net/intel/iavf/iavf_rxtx.h            |  30 +-
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   |  55 +-
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 104 +--
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h |  36 +-
 drivers/net/intel/ice/ice_dcf_ethdev.c        |  10 +-
 drivers/net/intel/ice/ice_rxtx.c              | 737 ++++--------------
 drivers/net/intel/ice/ice_rxtx.h              |  15 -
 drivers/net/intel/ice/ice_rxtx_vec_avx2.c     |  55 +-
 drivers/net/intel/ice/ice_rxtx_vec_avx512.c   |  53 +-
 drivers/net/intel/ice/ice_rxtx_vec_common.h   |  43 +-
 drivers/net/intel/idpf/idpf_common_device.h   |   2 +
 drivers/net/intel/idpf/idpf_common_rxtx.c     | 315 ++------
 drivers/net/intel/idpf/idpf_common_rxtx.h     |  24 +-
 .../net/intel/idpf/idpf_common_rxtx_avx2.c    |  53 +-
Quoted 9 lines
 .../net/intel/idpf/idpf_common_rxtx_avx512.c  |  55 +-
 drivers/net/intel/idpf/idpf_rxtx.c            |  43 +-
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |   6 +-
 drivers/net/intel/ixgbe/ixgbe_rxtx.c          | 103 ++-
 .../net/intel/ixgbe/ixgbe_rxtx_vec_common.c   |   3 +-
 lib/eal/include/rte_common.h                  |   6 +
 33 files changed, 1565 insertions(+), 2426 deletions(-)
 create mode 100644 drivers/net/intel/common/tx_scalar_fns.h

Love to see common code and "fix it once"
It was too large for the batch scripts, but here is AI review. It sees only minor stuff which you could fix (or skip).

# DPDK Patch Review: Intel Tx Consolidation Series

**Series:** [PATCH v2 01-36/36] Intel Tx driver consolidation **Author:** Bruce Richardson <[email protected]> **Review Date:** 2026-01-22
**Review Against:** AGENTS.md (DPDK Code Review Guidelines)

---

## Executive Summary

This 36-patch series consolidates Tx descriptor handling across Intel network drivers (i40e, iavf, ice, idpf, ixgbe). Overall the patches are **well-structured** with proper code organization, but there are several **issues requiring attention** before merge.

| Severity | Count | Summary |
|----------|-------|---------|
| **Error** | 1 | Source code line exceeds 100 characters |
| **Warning** | 5 | Commit message style issues, double blank lines |
| **Info** | 2 | Minor style observations |

---

## Detailed Findings

### ERRORS (Must Fix)

#### 1. Source Code Line Length Violation
**Patch 17/36:** net/i40e: document requirement for QinQ support **Location:** drivers/net/intel/i40e/i40e_rxtx.c **Issue:** Line exceeds 100-character limit (135 characters)

```c
PMD_DRV_LOG(WARNING, "Double VLAN insertion may not work correctly without RTE_ETH_RX_OFFLOAD_VLAN_EXTEND set in Rx configuration.");
```

**Fix:** Split the log message across multiple lines or into multiple log calls:

```c
PMD_DRV_LOG(WARNING, "Double VLAN insertion may not work correctly "
            "without RTE_ETH_RX_OFFLOAD_VLAN_EXTEND in Rx config.");
```

---

### WARNINGS (Should Fix)

#### 2. Commit Body Starts with Lowercase
**Patches 08/36 and 09/36**

Per DPDK convention, commit message body should start with a capital letter.

| Patch | Current | Should Be |
|-------|---------|-----------|
| 08/36 `net/i40e: refactor context descriptor handling` | "move all context..." | "Move all context..." |
| 09/36 `net/idpf: refactor context descriptor handling` | "move all context..." | "Move all context..." |

---

#### 3. Double Blank Lines in Code
The following patches add consecutive blank lines, which is a minor style violation:

| Patch | Location | Line |
|-------|----------|------|
| 06/36 `net/intel: add common fn to calculate needed` | tx_scalar_fns.h | ~line 5093 |
| 07/36 `net/ice: refactor context descriptor handling` | ice_rxtx.c | ~line 5379 |
| 36/36 `net/idpf: enable simple Tx function` | idpf_common_rxtx.c | After `idpf_dp_singleq_xmit_pkts_simple()` |

**Example from Patch 36:**

```c
+uint16_t
+idpf_dp_singleq_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
+				   uint16_t nb_pkts)
+{
+	return ci_xmit_pkts_simple(tx_queue, tx_pkts, nb_pkts);
+}
+
+
+/* TX prep functions */   <-- Extra blank line above
```

---

#### 4. "TX" vs "Tx" in Comments
Multiple patches use "TX" in comments rather than the DPDK-preferred "Tx":

- Patch 04: /* Common TX Descriptor QW1 Field Definitions */
- Patch 06: /* Calculate the number of TX descriptors needed for each pkt */
- Patch 07: /* TX context descriptor based double VLAN insert */
- Patch 12: /* Setup TX Descriptor */
- And others...

While not strictly an error (comments aren't checked as strictly as commit messages), consistency with "Tx" is preferred per devtools/words-case.txt.

---

#### 5. EAL Macro Addition Without Release Notes **Patch 20/36:** eal: add macro for marking assumed alignment

Adds __rte_assume_aligned macro to lib/eal/include/rte_common.h. Consider adding a release notes entry for this new public macro, even though it's primarily for internal optimization use.

---

### INFO (Consider)

#### 6. Subject Line Truncation
**Patch 06/36:** Subject line net/intel: add common fn to calculate needed appears truncated (missing "descriptors").

While technically within the 60-char limit, the full meaning is lost. Consider:
- net/intel: add fn to calc needed descriptors (43 chars)
- Or keep two-line format in cover letter

---

#### 7. New Internal API Properly Tagged
**Patch 36/36** correctly adds __rte_internal tag for idpf_dp_singleq_xmit_pkts_simple() in the header file (not .c file). ✓

---

## Compliance Summary

### Commit Message Checks

| Check | Status |
|-------|--------|
| Subject ≤60 chars | ✓ All pass (35-51 chars) |
| Lowercase after prefix | ✓ All pass |
| No trailing period | ✓ All pass |
| Signed-off-by present | ✓ All 36 patches |
| Body ≤75 chars | ✓ All pass |
| Imperative mood | ✓ All pass |
| Correct prefix (net/intel, net/ice, etc.) | ✓ All pass |
| Body starts with capital | ✗ 2 failures (patches 8, 9) |

### Code Style Checks

| Check | Status |
|-------|--------|
| Lines ≤100 chars | ✗ 1 failure (patch 17) |
| No trailing whitespace | ✓ All pass |
| SPDX headers on new files | ✓ Pass (patch 5 new file) |
| `__rte_internal` in headers only | ✓ Pass |
| No double blank lines | ✗ 3 failures |
| Proper Tx/Rx capitalization | ⚠ Comments use "TX" |

### License Checks

| Check | Status |
|-------|--------|
| New file has SPDX | ✓ `tx_scalar_fns.h` has BSD-3-Clause |
| Copyright follows SPDX | ✓ Pass |
| Blank line before code | ✓ Pass |

---

## Files Changed Summary

- **22 files** modified in patch 1 alone
- **New file created:** drivers/net/intel/common/tx_scalar_fns.h
- **Drivers affected:** i40e, iavf, ice, idpf, cpfl, ixgbe
- **Documentation updated:** doc/guides/nics/i40e.rst (patch 17)

---

## Recommendations

1. **Critical:** Fix the 135-char line in patch 17 before merge
2. **Important:** Capitalize "Move" in patches 8 and 9 commit messages
3. **Minor:** Remove extra blank lines in patches 6, 7, and 36
4. **Optional:** Consider release notes entry for new EAL macro
5. **Optional:** Standardize comment style to use "Tx" instead of "TX"

---

## Verdict

**Conditional Accept** - Series is well-designed and the code consolidation is valuable. Fix the error (line length) and warnings (commit message capitalization, double blank lines) before merge.

#70 lore raw
Quoted 101 lines · Stephen Hemminger
Quoted 88 lines · On Tue, 13 Jan 2026 15:14:24 +0000 Bruce Richardson…

The scalar Tx paths, with support for offloads and multiple mbufs per packet, are almost identical across drivers ice, i40e, iavf and the single-queue mode of idpf. Therefore, we can do some rework to combine these code paths into a single function which is parameterized by compile-time constants, allowing code saving to give us a single path to optimize and maintain - apart from edge cases like IPSec support in iavf.

The ixgbe driver has a number of similarities too, which we take advantage of where we can, but the overall descriptor format is sufficiently different that its main scalar code path is kept separate.

Once merged, we can then optimize the drivers a bit to improve performance, and also easily extend some drivers to use additional paths for better performance, e.g. add the "simple scalar" path to IDPF driver for better performance on platforms without AVX.

V2:
- reworked the simple-scalar path as well as full scalar one
- added simple scalar path support to idpf driver
- small cleanups, e.g. issues flagged by checkpatch

Bruce Richardson (36):
net/intel: create common Tx descriptor structure net/intel: use common Tx ring structure net/intel: create common post-Tx cleanup function net/intel: consolidate definitions for Tx desc fields net/intel: create separate header for Tx scalar fns net/intel: add common fn to calculate needed descriptors net/ice: refactor context descriptor handling net/i40e: refactor context descriptor handling net/idpf: refactor context descriptor handling net/intel: consolidate checksum mask definition net/intel: create common checksum Tx offload function net/intel: create a common scalar Tx function net/i40e: use common scalar Tx function net/intel: add IPsec hooks to common Tx function net/intel: support configurable VLAN tag insertion on Tx net/iavf: use common scalar Tx function net/i40e: document requirement for QinQ support net/idpf: use common scalar Tx function net/intel: avoid writing the final pkt descriptor twice
eal: add macro for marking assumed alignment net/intel: write descriptors using non-volatile pointers net/intel: remove unnecessary flag clearing net/intel: mark mid-burst ring cleanup as unlikely net/intel: add special handling for single desc packets net/intel: use separate array for desc status tracking net/ixgbe: use separate array for desc status tracking net/intel: drop unused Tx queue used count net/intel: remove index for tracking end of packet net/intel: merge ring writes in simple Tx for ice and i40e net/intel: consolidate ice and i40e buffer free function net/intel: complete merging simple Tx paths net/intel: use non-volatile stores in simple Tx function net/intel: align scalar simple Tx path with vector logic net/intel: use vector SW ring entry for simple path net/intel: use vector mbuf cleanup from simple scalar path net/idpf: enable simple Tx function

 doc/guides/nics/i40e.rst                      |  18 +
 drivers/net/intel/common/tx.h                 | 116 ++-
 drivers/net/intel/common/tx_scalar_fns.h      | 595 ++++++++++++++
 drivers/net/intel/cpfl/cpfl_rxtx.c            |   8 +-
 drivers/net/intel/i40e/i40e_fdir.c            |  34 +-
 drivers/net/intel/i40e/i40e_rxtx.c            | 670 +++-------------
 drivers/net/intel/i40e/i40e_rxtx.h            |  16 -
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |  25 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c   |  36 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c |  52 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_common.h |   6 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |  25 +-
 drivers/net/intel/iavf/iavf_rxtx.c            | 642 ++++-----------
 drivers/net/intel/iavf/iavf_rxtx.h            |  30 +-
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   |  55 +-
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 104 +--
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h |  36 +-
 drivers/net/intel/ice/ice_dcf_ethdev.c        |  10 +-
 drivers/net/intel/ice/ice_rxtx.c              | 737 ++++--------------
 drivers/net/intel/ice/ice_rxtx.h              |  15 -
 drivers/net/intel/ice/ice_rxtx_vec_avx2.c     |  55 +-
 drivers/net/intel/ice/ice_rxtx_vec_avx512.c   |  53 +-
 drivers/net/intel/ice/ice_rxtx_vec_common.h   |  43 +-
 drivers/net/intel/idpf/idpf_common_device.h   |   2 +
 drivers/net/intel/idpf/idpf_common_rxtx.c     | 315 ++------
 drivers/net/intel/idpf/idpf_common_rxtx.h     |  24 +-
 .../net/intel/idpf/idpf_common_rxtx_avx2.c    |  53 +-
Quoted 9 lines
 .../net/intel/idpf/idpf_common_rxtx_avx512.c  |  55 +-
 drivers/net/intel/idpf/idpf_rxtx.c            |  43 +-
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |   6 +-
 drivers/net/intel/ixgbe/ixgbe_rxtx.c          | 103 ++-
 .../net/intel/ixgbe/ixgbe_rxtx_vec_common.c   |   3 +-
 lib/eal/include/rte_common.h                  |   6 +
 33 files changed, 1565 insertions(+), 2426 deletions(-)
 create mode 100644 drivers/net/intel/common/tx_scalar_fns.h
Quoted 6 lines

Love to see common code and "fix it once"
It was too large for the batch scripts, but here is AI review. It sees only minor stuff which you could fix (or skip).

Thanks for running the AI review.

Quoted 34 lines

# DPDK Patch Review: Intel Tx Consolidation Series

**Series:** [PATCH v2 01-36/36] Intel Tx driver consolidation **Author:** Bruce Richardson <[email protected]> **Review Date:** 2026-01-22
**Review Against:** AGENTS.md (DPDK Code Review Guidelines)

---

## Executive Summary

This 36-patch series consolidates Tx descriptor handling across Intel network drivers (i40e, iavf, ice, idpf, ixgbe). Overall the patches are **well-structured** with proper code organization, but there are several **issues requiring attention** before merge.

| Severity | Count | Summary |
|----------|-------|---------|
| **Error** | 1 | Source code line exceeds 100 characters |
| **Warning** | 5 | Commit message style issues, double blank lines |
| **Info** | 2 | Minor style observations |

---

## Detailed Findings

### ERRORS (Must Fix)

#### 1. Source Code Line Length Violation
**Patch 17/36:** net/i40e: document requirement for QinQ support **Location:** drivers/net/intel/i40e/i40e_rxtx.c **Issue:** Line exceeds 100-character limit (135 characters)

```c
PMD_DRV_LOG(WARNING, "Double VLAN insertion may not work correctly without RTE_ETH_RX_OFFLOAD_VLAN_EXTEND set in Rx configuration.");
```
Quoted 6 lines

**Fix:** Split the log message across multiple lines or into multiple log calls:

```c
PMD_DRV_LOG(WARNING, "Double VLAN insertion may not work correctly "
            "without RTE_ETH_RX_OFFLOAD_VLAN_EXTEND in Rx config.");
```

This is one where the AI guidelines need an update. We need to teach it that it's better to have a long line than to split error messages.

/Bruce

#71 lore raw

v3 cover combine multiple Intel scalar Tx paths

In reply to Bruce Richardson

The scalar Tx paths, with support for offloads and multiple mbufs per packet, are almost identical across drivers ice, i40e, iavf and the single-queue mode of idpf. Therefore, we can do some rework to combine these code paths into a single function which is parameterized by compile-time constants, allowing code saving to give us a single path to optimize and maintain - apart from edge cases like IPSec support in iavf.

The ixgbe driver has a number of similarities too, which we take advantage of where we can, but the overall descriptor format is sufficiently different that its main scalar code path is kept separate.

Once merged, we can then optimize the drivers a bit to improve performance, and also easily extend some drivers to use additional paths for better performance, e.g. add the "simple scalar" path to IDPF driver for better performance on platforms without AVX.

V3:
- rebase on top of latest next-net-intel tree
- fix issues with iavf and cpfl drivers seen in some testing

V2:
- reworked the simple-scalar path as well as full scalar one
- added simple scalar path support to idpf driver
- small cleanups, e.g. issues flagged by checkpatch

Bruce Richardson (36):
net/intel: create common Tx descriptor structure net/intel: use common Tx ring structure net/intel: create common post-Tx cleanup function net/intel: consolidate definitions for Tx desc fields net/intel: create separate header for Tx scalar fns net/intel: add common fn to calculate needed descriptors net/ice: refactor context descriptor handling net/i40e: refactor context descriptor handling net/idpf: refactor context descriptor handling net/intel: consolidate checksum mask definition net/intel: create common checksum Tx offload function net/intel: create a common scalar Tx function net/i40e: use common scalar Tx function net/intel: add IPsec hooks to common Tx function net/intel: support configurable VLAN tag insertion on Tx net/iavf: use common scalar Tx function net/i40e: document requirement for QinQ support net/idpf: use common scalar Tx function net/intel: avoid writing the final pkt descriptor twice
eal: add macro for marking assumed alignment net/intel: write descriptors using non-volatile pointers net/intel: remove unnecessary flag clearing net/intel: mark mid-burst ring cleanup as unlikely net/intel: add special handling for single desc packets net/intel: use separate array for desc status tracking net/ixgbe: use separate array for desc status tracking net/intel: drop unused Tx queue used count net/intel: remove index for tracking end of packet net/intel: merge ring writes in simple Tx for ice and i40e net/intel: consolidate ice and i40e buffer free function net/intel: complete merging simple Tx paths net/intel: use non-volatile stores in simple Tx function net/intel: align scalar simple Tx path with vector logic net/intel: use vector SW ring entry for simple path net/intel: use vector mbuf cleanup from simple scalar path net/idpf: enable simple Tx function

 doc/guides/nics/i40e.rst                      |  18 +
 drivers/net/intel/common/tx.h                 | 117 ++-
 drivers/net/intel/common/tx_scalar_fns.h      | 594 ++++++++++++++
 drivers/net/intel/cpfl/cpfl_rxtx.c            |  25 +-
 drivers/net/intel/i40e/i40e_fdir.c            |  34 +-
 drivers/net/intel/i40e/i40e_rxtx.c            | 673 +++-------------
 drivers/net/intel/i40e/i40e_rxtx.h            |  16 -
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |  25 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c   |  36 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c |  52 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_common.h |   6 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |  25 +-
 drivers/net/intel/iavf/iavf_rxtx.c            | 642 ++++-----------
 drivers/net/intel/iavf/iavf_rxtx.h            |  30 +-
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   |  55 +-
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 104 +--
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h |  36 +-
 drivers/net/intel/ice/ice_dcf_ethdev.c        |  10 +-
 drivers/net/intel/ice/ice_rxtx.c              | 740 ++++--------------
 drivers/net/intel/ice/ice_rxtx.h              |  15 -
 drivers/net/intel/ice/ice_rxtx_vec_avx2.c     |  55 +-
 drivers/net/intel/ice/ice_rxtx_vec_avx512.c   |  53 +-
 drivers/net/intel/ice/ice_rxtx_vec_common.h   |  43 +-
 drivers/net/intel/idpf/idpf_common_device.h   |   2 +
 drivers/net/intel/idpf/idpf_common_rxtx.c     | 314 ++------
 drivers/net/intel/idpf/idpf_common_rxtx.h     |  24 +-
 .../net/intel/idpf/idpf_common_rxtx_avx2.c    |  53 +-
 .../net/intel/idpf/idpf_common_rxtx_avx512.c  |  55 +-
 drivers/net/intel/idpf/idpf_rxtx.c            |  43 +-
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |   6 +-
 drivers/net/intel/ixgbe/ixgbe_rxtx.c          | 103 ++-
 .../net/intel/ixgbe/ixgbe_rxtx_vec_common.c   |   3 +-
 lib/eal/include/rte_common.h                  |   6 +
 33 files changed, 1577 insertions(+), 2436 deletions(-)
 create mode 100644 drivers/net/intel/common/tx_scalar_fns.h

--
2.51.0

#72 lore raw

PATCH v3 1/36 net/intel: create common Tx descriptor structure

The Tx descriptors used by the i40e, iavf, ice and idpf drivers are all identical 16-byte descriptors, so define a common struct for them. Since original struct definitions are in base code, leave them in place, but only use the new structs in DPDK code.

---
 drivers/net/intel/common/tx.h                 | 16 ++++++---
 drivers/net/intel/cpfl/cpfl_rxtx.c            |  2 +-
 drivers/net/intel/i40e/i40e_fdir.c            |  4 +--
 drivers/net/intel/i40e/i40e_rxtx.c            | 26 +++++++-------
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |  6 ++--
 drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c   |  6 ++--
 drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c |  6 ++--
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |  6 ++--
 drivers/net/intel/iavf/iavf_rxtx.c            | 16 ++++-----
 drivers/net/intel/iavf/iavf_rxtx.h            |  2 +-
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   |  6 ++--
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 12 +++----
 drivers/net/intel/ice/ice_dcf_ethdev.c        |  2 +-
 drivers/net/intel/ice/ice_rxtx.c              | 36 +++++++++----------
 drivers/net/intel/ice/ice_rxtx_vec_avx2.c     |  6 ++--
 drivers/net/intel/ice/ice_rxtx_vec_avx512.c   |  6 ++--
 drivers/net/intel/idpf/idpf_common_rxtx.c     | 20 +++++------
 drivers/net/intel/idpf/idpf_common_rxtx.h     |  2 +-
 .../net/intel/idpf/idpf_common_rxtx_avx2.c    |  8 ++---
 .../net/intel/idpf/idpf_common_rxtx_avx512.c  |  8 ++---
 drivers/net/intel/idpf/idpf_rxtx.c            |  2 +-
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |  2 +-
 22 files changed, 104 insertions(+), 96 deletions(-)
drivers/net/intel/common/tx.h +12 -4
index e295d83e3a..d7561a2bbb 100644
@@ -10,6 +10,14 @@
 #include <rte_ethdev.h>
 #include <rte_vect.h>
 
+/*
+ * Structure of a 16-byte Tx descriptor common across i40e, ice, iavf and idpf drivers
+ */
+struct ci_tx_desc {
+	uint64_t buffer_addr; /* Address of descriptor's data buf */
+	uint64_t cmd_type_offset_bsz;
+};
+
 /* forward declaration of the common intel (ci) queue structure */
 struct ci_tx_queue;
 
@@ -33,10 +41,10 @@ typedef void (*ice_tx_release_mbufs_t)(struct ci_tx_queue *txq);
 
 struct ci_tx_queue {
 	union { /* TX ring virtual address */
-		volatile struct i40e_tx_desc *i40e_tx_ring;
-		volatile struct iavf_tx_desc *iavf_tx_ring;
-		volatile struct ice_tx_desc *ice_tx_ring;
-		volatile struct idpf_base_tx_desc *idpf_tx_ring;
+		volatile struct ci_tx_desc *i40e_tx_ring;
+		volatile struct ci_tx_desc *iavf_tx_ring;
+		volatile struct ci_tx_desc *ice_tx_ring;
+		volatile struct ci_tx_desc *idpf_tx_ring;
 		volatile union ixgbe_adv_tx_desc *ixgbe_tx_ring;
 	};
 	volatile uint8_t *qtx_tail;               /* register address of tail */
drivers/net/intel/cpfl/cpfl_rxtx.c +1 -1
index d0438b5da0..78bc3e9b49 100644
@@ -131,7 +131,7 @@ cpfl_dma_zone_reserve(struct rte_eth_dev *dev, uint16_t queue_idx,
 			ring_size = RTE_ALIGN(len * sizeof(struct idpf_flex_tx_sched_desc),
 					      CPFL_DMA_MEM_ALIGN);
 		else
-			ring_size = RTE_ALIGN(len * sizeof(struct idpf_base_tx_desc),
+			ring_size = RTE_ALIGN(len * sizeof(struct ci_tx_desc),
 					      CPFL_DMA_MEM_ALIGN);
 		memcpy(ring_name, "cpfl Tx ring", sizeof("cpfl Tx ring"));
 		break;
drivers/net/intel/i40e/i40e_fdir.c +2 -2
index 55d18c5d4a..605df73c9e 100644
@@ -1377,7 +1377,7 @@ i40e_find_available_buffer(struct rte_eth_dev *dev)
 	 */
 	if (fdir_info->txq_available_buf_count <= 0) {
 		uint16_t tmp_tail;
-		volatile struct i40e_tx_desc *tmp_txdp;
+		volatile struct ci_tx_desc *tmp_txdp;
 
 		tmp_tail = txq->tx_tail;
 		tmp_txdp = &txq->i40e_tx_ring[tmp_tail + 1];
@@ -1628,7 +1628,7 @@ i40e_flow_fdir_filter_programming(struct i40e_pf *pf,
 	struct ci_tx_queue *txq = pf->fdir.txq;
 	struct ci_rx_queue *rxq = pf->fdir.rxq;
 	const struct i40e_fdir_action *fdir_action = &filter->action;
-	volatile struct i40e_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	volatile struct i40e_filter_program_desc *fdirdp;
 	uint32_t td_cmd;
 	uint16_t vsi_id;
drivers/net/intel/i40e/i40e_rxtx.c +13 -13
index 1c3586778c..92d49ccb79 100644
@@ -388,7 +388,7 @@ static inline int
 i40e_xmit_cleanup(struct ci_tx_queue *txq)
 {
 	struct ci_tx_entry *sw_ring = txq->sw_ring;
-	volatile struct i40e_tx_desc *txd = txq->i40e_tx_ring;
+	volatile struct ci_tx_desc *txd = txq->i40e_tx_ring;
 	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
 	uint16_t nb_tx_desc = txq->nb_tx_desc;
 	uint16_t desc_to_clean_to;
@@ -1092,8 +1092,8 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	struct ci_tx_queue *txq;
 	struct ci_tx_entry *sw_ring;
 	struct ci_tx_entry *txe, *txn;
-	volatile struct i40e_tx_desc *txd;
-	volatile struct i40e_tx_desc *txr;
+	volatile struct ci_tx_desc *txd;
+	volatile struct ci_tx_desc *txr;
 	struct rte_mbuf *tx_pkt;
 	struct rte_mbuf *m_seg;
 	uint32_t cd_tunneling_params;
@@ -1398,7 +1398,7 @@ i40e_tx_free_bufs(struct ci_tx_queue *txq)
 
 /* Populate 4 descriptors with data from 4 mbufs */
 static inline void
-tx4(volatile struct i40e_tx_desc *txdp, struct rte_mbuf **pkts)
+tx4(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkts)
 {
 	uint64_t dma_addr;
 	uint32_t i;
@@ -1414,7 +1414,7 @@ tx4(volatile struct i40e_tx_desc *txdp, struct rte_mbuf **pkts)
 
 /* Populate 1 descriptor with data from 1 mbuf */
 static inline void
-tx1(volatile struct i40e_tx_desc *txdp, struct rte_mbuf **pkts)
+tx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkts)
 {
 	uint64_t dma_addr;
 
@@ -1431,7 +1431,7 @@ i40e_tx_fill_hw_ring(struct ci_tx_queue *txq,
 		     struct rte_mbuf **pkts,
 		     uint16_t nb_pkts)
 {
-	volatile struct i40e_tx_desc *txdp = &txq->i40e_tx_ring[txq->tx_tail];
+	volatile struct ci_tx_desc *txdp = &txq->i40e_tx_ring[txq->tx_tail];
 	struct ci_tx_entry *txep = &txq->sw_ring[txq->tx_tail];
 	const int N_PER_LOOP = 4;
 	const int N_PER_LOOP_MASK = N_PER_LOOP - 1;
@@ -1459,7 +1459,7 @@ tx_xmit_pkts(struct ci_tx_queue *txq,
 	     struct rte_mbuf **tx_pkts,
 	     uint16_t nb_pkts)
 {
-	volatile struct i40e_tx_desc *txr = txq->i40e_tx_ring;
+	volatile struct ci_tx_desc *txr = txq->i40e_tx_ring;
 	uint16_t n = 0;
 
 	/**
@@ -2616,7 +2616,7 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	/* Allocate TX hardware ring descriptors. */
-	ring_size = sizeof(struct i40e_tx_desc) * I40E_MAX_RING_DESC;
+	ring_size = sizeof(struct ci_tx_desc) * I40E_MAX_RING_DESC;
 	ring_size = RTE_ALIGN(ring_size, I40E_DMA_MEM_ALIGN);
 	tz = rte_eth_dma_zone_reserve(dev, "i40e_tx_ring", queue_idx,
 			      ring_size, I40E_RING_BASE_ALIGN, socket_id);
@@ -2640,7 +2640,7 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	txq->tx_deferred_start = tx_conf->tx_deferred_start;
 
 	txq->tx_ring_dma = tz->iova;
-	txq->i40e_tx_ring = (struct i40e_tx_desc *)tz->addr;
+	txq->i40e_tx_ring = (struct ci_tx_desc *)tz->addr;
 
 	/* Allocate software ring */
 	txq->sw_ring =
@@ -2913,13 +2913,13 @@ i40e_reset_tx_queue(struct ci_tx_queue *txq)
 	}
 
 	txe = txq->sw_ring;
-	size = sizeof(struct i40e_tx_desc) * txq->nb_tx_desc;
+	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
 		((volatile char *)txq->i40e_tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		volatile struct i40e_tx_desc *txd = &txq->i40e_tx_ring[i];
+		volatile struct ci_tx_desc *txd = &txq->i40e_tx_ring[i];
 
 		txd->cmd_type_offset_bsz =
 			rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE);
@@ -3221,7 +3221,7 @@ i40e_fdir_setup_tx_resources(struct i40e_pf *pf)
 	}
 
 	/* Allocate TX hardware ring descriptors. */
-	ring_size = sizeof(struct i40e_tx_desc) * I40E_FDIR_NUM_TX_DESC;
+	ring_size = sizeof(struct ci_tx_desc) * I40E_FDIR_NUM_TX_DESC;
 	ring_size = RTE_ALIGN(ring_size, I40E_DMA_MEM_ALIGN);
 
 	tz = rte_eth_dma_zone_reserve(dev, "fdir_tx_ring",
@@ -3240,7 +3240,7 @@ i40e_fdir_setup_tx_resources(struct i40e_pf *pf)
 	txq->i40e_vsi = pf->fdir.fdir_vsi;
 
 	txq->tx_ring_dma = tz->iova;
-	txq->i40e_tx_ring = (struct i40e_tx_desc *)tz->addr;
+	txq->i40e_tx_ring = (struct ci_tx_desc *)tz->addr;
 
 	/*
 	 * don't need to allocate software ring and reset for the fdir
drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +3 -3
index bbb6d907cf..ef5b252898 100644
@@ -446,7 +446,7 @@ i40e_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 }
 
 static inline void
-vtx1(volatile struct i40e_tx_desc *txdp,
+vtx1(volatile struct ci_tx_desc *txdp,
 	struct rte_mbuf *pkt, uint64_t flags)
 {
 	uint64_t high_qw = (I40E_TX_DESC_DTYPE_DATA |
@@ -459,7 +459,7 @@ vtx1(volatile struct i40e_tx_desc *txdp,
 }
 
 static inline void
-vtx(volatile struct i40e_tx_desc *txdp,
+vtx(volatile struct ci_tx_desc *txdp,
 	struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
 	int i;
@@ -473,7 +473,7 @@ i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 			  uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct i40e_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = I40E_TD_CMD;
drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +3 -3
index 4e398b3140..137c1f9765 100644
@@ -681,7 +681,7 @@ i40e_recv_scattered_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 
 static inline void
-vtx1(volatile struct i40e_tx_desc *txdp,
+vtx1(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf *pkt, uint64_t flags)
 {
 	uint64_t high_qw = (I40E_TX_DESC_DTYPE_DATA |
@@ -694,7 +694,7 @@ vtx1(volatile struct i40e_tx_desc *txdp,
 }
 
 static inline void
-vtx(volatile struct i40e_tx_desc *txdp,
+vtx(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
 	const uint64_t hi_qw_tmpl = (I40E_TX_DESC_DTYPE_DATA |
@@ -739,7 +739,7 @@ i40e_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 			  uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct i40e_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = I40E_TD_CMD;
drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c +3 -3
index 571987d27a..6971488750 100644
@@ -750,7 +750,7 @@ i40e_recv_scattered_pkts_vec_avx512(void *rx_queue,
 }
 
 static inline void
-vtx1(volatile struct i40e_tx_desc *txdp, struct rte_mbuf *pkt, uint64_t flags)
+vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt, uint64_t flags)
 {
 	uint64_t high_qw = (I40E_TX_DESC_DTYPE_DATA |
 		((uint64_t)flags  << I40E_TXD_QW1_CMD_SHIFT) |
@@ -762,7 +762,7 @@ vtx1(volatile struct i40e_tx_desc *txdp, struct rte_mbuf *pkt, uint64_t flags)
 }
 
 static inline void
-vtx(volatile struct i40e_tx_desc *txdp,
+vtx(volatile struct ci_tx_desc *txdp,
 	struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
 	const uint64_t hi_qw_tmpl = (I40E_TX_DESC_DTYPE_DATA |
@@ -807,7 +807,7 @@ i40e_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 				 uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct i40e_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = I40E_TD_CMD;
drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +3 -3
index b5be0c1b59..6404b70c56 100644
@@ -597,7 +597,7 @@ i40e_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 }
 
 static inline void
-vtx1(volatile struct i40e_tx_desc *txdp,
+vtx1(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf *pkt, uint64_t flags)
 {
 	uint64_t high_qw = (I40E_TX_DESC_DTYPE_DATA |
@@ -609,7 +609,7 @@ vtx1(volatile struct i40e_tx_desc *txdp,
 }
 
 static inline void
-vtx(volatile struct i40e_tx_desc *txdp, struct rte_mbuf **pkt,
+vtx(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkt,
 		uint16_t nb_pkts,  uint64_t flags)
 {
 	int i;
@@ -623,7 +623,7 @@ i40e_xmit_fixed_burst_vec(void *__rte_restrict tx_queue,
 	struct rte_mbuf **__rte_restrict tx_pkts, uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct i40e_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = I40E_TD_CMD;
drivers/net/intel/iavf/iavf_rxtx.c +8 -8
index 4b763627bc..e4421a9932 100644
@@ -267,7 +267,7 @@ reset_tx_queue(struct ci_tx_queue *txq)
 	}
 
 	txe = txq->sw_ring;
-	size = sizeof(struct iavf_tx_desc) * txq->nb_tx_desc;
+	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
 		((volatile char *)txq->iavf_tx_ring)[i] = 0;
 
@@ -827,7 +827,7 @@ iavf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	/* Allocate TX hardware ring descriptors. */
-	ring_size = sizeof(struct iavf_tx_desc) * IAVF_MAX_RING_DESC;
+	ring_size = sizeof(struct ci_tx_desc) * IAVF_MAX_RING_DESC;
 	ring_size = RTE_ALIGN(ring_size, IAVF_DMA_MEM_ALIGN);
 	mz = rte_eth_dma_zone_reserve(dev, "iavf_tx_ring", queue_idx,
 				      ring_size, IAVF_RING_BASE_ALIGN,
@@ -839,7 +839,7 @@ iavf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 	txq->tx_ring_dma = mz->iova;
-	txq->iavf_tx_ring = (struct iavf_tx_desc *)mz->addr;
+	txq->iavf_tx_ring = (struct ci_tx_desc *)mz->addr;
 
 	txq->mz = mz;
 	reset_tx_queue(txq);
@@ -2333,7 +2333,7 @@ iavf_xmit_cleanup(struct ci_tx_queue *txq)
 	uint16_t desc_to_clean_to;
 	uint16_t nb_tx_to_clean;
 
-	volatile struct iavf_tx_desc *txd = txq->iavf_tx_ring;
+	volatile struct ci_tx_desc *txd = txq->iavf_tx_ring;
 
 	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
 	if (desc_to_clean_to >= nb_tx_desc)
@@ -2723,7 +2723,7 @@ iavf_calc_pkt_desc(struct rte_mbuf *tx_pkt)
 }
 
 static inline void
-iavf_fill_data_desc(volatile struct iavf_tx_desc *desc,
+iavf_fill_data_desc(volatile struct ci_tx_desc *desc,
 	uint64_t desc_template,	uint16_t buffsz,
 	uint64_t buffer_addr)
 {
@@ -2756,7 +2756,7 @@ uint16_t
 iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = tx_queue;
-	volatile struct iavf_tx_desc *txr = txq->iavf_tx_ring;
+	volatile struct ci_tx_desc *txr = txq->iavf_tx_ring;
 	struct ci_tx_entry *txe_ring = txq->sw_ring;
 	struct ci_tx_entry *txe, *txn;
 	struct rte_mbuf *mb, *mb_seg;
@@ -2774,7 +2774,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	txe = &txe_ring[desc_idx];
 
 	for (idx = 0; idx < nb_pkts; idx++) {
-		volatile struct iavf_tx_desc *ddesc;
+		volatile struct ci_tx_desc *ddesc;
 		struct iavf_ipsec_crypto_pkt_metadata *ipsec_md;
 
 		uint16_t nb_desc_ctx, nb_desc_ipsec;
@@ -2895,7 +2895,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		mb_seg = mb;
 
 		do {
-			ddesc = (volatile struct iavf_tx_desc *)
+			ddesc = (volatile struct ci_tx_desc *)
 					&txr[desc_idx];
 
 			txn = &txe_ring[txe->next_id];
drivers/net/intel/iavf/iavf_rxtx.h +1 -1
index e1f78dcde0..dd6d884fc1 100644
@@ -678,7 +678,7 @@ void iavf_dump_tx_descriptor(const struct ci_tx_queue *txq,
 			    const volatile void *desc, uint16_t tx_id)
 {
 	const char *name;
-	const volatile struct iavf_tx_desc *tx_desc = desc;
+	const volatile struct ci_tx_desc *tx_desc = desc;
 	enum iavf_tx_desc_dtype_value type;
 
 
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +3 -3
index e29958e0bc..5b62d51cf7 100644
@@ -1630,7 +1630,7 @@ iavf_recv_scattered_pkts_vec_avx2_flex_rxd_offload(void *rx_queue,
 
 
 static __rte_always_inline void
-iavf_vtx1(volatile struct iavf_tx_desc *txdp,
+iavf_vtx1(volatile struct ci_tx_desc *txdp,
 	  struct rte_mbuf *pkt, uint64_t flags, bool offload, uint8_t vlan_flag)
 {
 	uint64_t high_qw =
@@ -1646,7 +1646,7 @@ iavf_vtx1(volatile struct iavf_tx_desc *txdp,
 }
 
 static __rte_always_inline void
-iavf_vtx(volatile struct iavf_tx_desc *txdp,
+iavf_vtx(volatile struct ci_tx_desc *txdp,
 	 struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags, bool offload, uint8_t vlan_flag)
 {
 	const uint64_t hi_qw_tmpl = (IAVF_TX_DESC_DTYPE_DATA |
@@ -1713,7 +1713,7 @@ iavf_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 			       uint16_t nb_pkts, bool offload)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct iavf_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	/* bit2 is reserved and must be set to 1 according to Spec */
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +6 -6
index 7c0907b7cf..d79d96c7b7 100644
@@ -1840,7 +1840,7 @@ tx_backlog_entry_avx512(struct ci_tx_entry_vec *txep,
 }
 
 static __rte_always_inline void
-iavf_vtx1(volatile struct iavf_tx_desc *txdp,
+iavf_vtx1(volatile struct ci_tx_desc *txdp,
 	  struct rte_mbuf *pkt, uint64_t flags,
 	  bool offload, uint8_t vlan_flag)
 {
@@ -1859,7 +1859,7 @@ iavf_vtx1(volatile struct iavf_tx_desc *txdp,
 #define IAVF_TX_LEN_MASK 0xAA
 #define IAVF_TX_OFF_MASK 0x55
 static __rte_always_inline void
-iavf_vtx(volatile struct iavf_tx_desc *txdp,
+iavf_vtx(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags,
 		bool offload, uint8_t vlan_flag)
 {
@@ -2068,7 +2068,7 @@ iavf_fill_ctx_desc_tunnelling_field(volatile uint64_t *qw0,
 }
 
 static __rte_always_inline void
-ctx_vtx1(volatile struct iavf_tx_desc *txdp, struct rte_mbuf *pkt,
+ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt,
 		uint64_t flags, bool offload, uint8_t vlan_flag)
 {
 	uint64_t high_ctx_qw = IAVF_TX_DESC_DTYPE_CONTEXT;
@@ -2106,7 +2106,7 @@ ctx_vtx1(volatile struct iavf_tx_desc *txdp, struct rte_mbuf *pkt,
 }
 
 static __rte_always_inline void
-ctx_vtx(volatile struct iavf_tx_desc *txdp,
+ctx_vtx(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags,
 		bool offload, uint8_t vlan_flag)
 {
@@ -2203,7 +2203,7 @@ iavf_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 				 uint16_t nb_pkts, bool offload)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct iavf_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	/* bit2 is reserved and must be set to 1 according to Spec */
@@ -2271,7 +2271,7 @@ iavf_xmit_fixed_burst_vec_avx512_ctx(void *tx_queue, struct rte_mbuf **tx_pkts,
 				 uint16_t nb_pkts, bool offload)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct iavf_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, nb_mbuf, tx_id;
 	/* bit2 is reserved and must be set to 1 according to Spec */
drivers/net/intel/ice/ice_dcf_ethdev.c +1 -1
index 81da5a4656..ab1d499cef 100644
@@ -399,7 +399,7 @@ reset_tx_queue(struct ci_tx_queue *txq)
 	}
 
 	txe = txq->sw_ring;
-	size = sizeof(struct ice_tx_desc) * txq->nb_tx_desc;
+	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
 		((volatile char *)txq->ice_tx_ring)[i] = 0;
 
drivers/net/intel/ice/ice_rxtx.c +18 -18
index f3bc79423d..74b80e7df3 100644
@@ -1115,13 +1115,13 @@ ice_reset_tx_queue(struct ci_tx_queue *txq)
 	}
 
 	txe = txq->sw_ring;
-	size = sizeof(struct ice_tx_desc) * txq->nb_tx_desc;
+	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
 		((volatile char *)txq->ice_tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		volatile struct ice_tx_desc *txd = &txq->ice_tx_ring[i];
+		volatile struct ci_tx_desc *txd = &txq->ice_tx_ring[i];
 
 		txd->cmd_type_offset_bsz =
 			rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE);
@@ -1623,7 +1623,7 @@ ice_tx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	/* Allocate TX hardware ring descriptors. */
-	ring_size = sizeof(struct ice_tx_desc) * ICE_MAX_NUM_DESC_BY_MAC(hw);
+	ring_size = sizeof(struct ci_tx_desc) * ICE_MAX_NUM_DESC_BY_MAC(hw);
 	ring_size = RTE_ALIGN(ring_size, ICE_DMA_MEM_ALIGN);
 	tz = rte_eth_dma_zone_reserve(dev, "ice_tx_ring", queue_idx,
 				      ring_size, ICE_RING_BASE_ALIGN,
@@ -2619,7 +2619,7 @@ ice_fdir_setup_tx_resources(struct ice_pf *pf)
 	}
 
 	/* Allocate TX hardware ring descriptors. */
-	ring_size = sizeof(struct ice_tx_desc) * ICE_FDIR_NUM_TX_DESC;
+	ring_size = sizeof(struct ci_tx_desc) * ICE_FDIR_NUM_TX_DESC;
 	ring_size = RTE_ALIGN(ring_size, ICE_DMA_MEM_ALIGN);
 
 	tz = rte_eth_dma_zone_reserve(dev, "fdir_tx_ring",
@@ -2638,7 +2638,7 @@ ice_fdir_setup_tx_resources(struct ice_pf *pf)
 	txq->ice_vsi = pf->fdir.fdir_vsi;
 
 	txq->tx_ring_dma = tz->iova;
-	txq->ice_tx_ring = (struct ice_tx_desc *)tz->addr;
+	txq->ice_tx_ring = (struct ci_tx_desc *)tz->addr;
 	/*
 	 * don't need to allocate software ring and reset for the fdir
 	 * program queue just set the queue has been configured.
@@ -3027,7 +3027,7 @@ static inline int
 ice_xmit_cleanup(struct ci_tx_queue *txq)
 {
 	struct ci_tx_entry *sw_ring = txq->sw_ring;
-	volatile struct ice_tx_desc *txd = txq->ice_tx_ring;
+	volatile struct ci_tx_desc *txd = txq->ice_tx_ring;
 	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
 	uint16_t nb_tx_desc = txq->nb_tx_desc;
 	uint16_t desc_to_clean_to;
@@ -3148,8 +3148,8 @@ uint16_t
 ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq;
-	volatile struct ice_tx_desc *ice_tx_ring;
-	volatile struct ice_tx_desc *txd;
+	volatile struct ci_tx_desc *ice_tx_ring;
+	volatile struct ci_tx_desc *txd;
 	struct ci_tx_entry *sw_ring;
 	struct ci_tx_entry *txe, *txn;
 	struct rte_mbuf *tx_pkt;
@@ -3312,7 +3312,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 			while ((ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG)) &&
 				unlikely(slen > ICE_MAX_DATA_PER_TXD)) {
-				txd->buf_addr = rte_cpu_to_le_64(buf_dma_addr);
+				txd->buffer_addr = rte_cpu_to_le_64(buf_dma_addr);
 				txd->cmd_type_offset_bsz =
 				rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DATA |
 				((uint64_t)td_cmd << ICE_TXD_QW1_CMD_S) |
@@ -3331,7 +3331,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 				txn = &sw_ring[txe->next_id];
 			}
 
-			txd->buf_addr = rte_cpu_to_le_64(buf_dma_addr);
+			txd->buffer_addr = rte_cpu_to_le_64(buf_dma_addr);
 			txd->cmd_type_offset_bsz =
 				rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DATA |
 				((uint64_t)td_cmd << ICE_TXD_QW1_CMD_S) |
@@ -3563,14 +3563,14 @@ ice_tx_done_cleanup(void *txq, uint32_t free_cnt)
 
 /* Populate 4 descriptors with data from 4 mbufs */
 static inline void
-tx4(volatile struct ice_tx_desc *txdp, struct rte_mbuf **pkts)
+tx4(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkts)
 {
 	uint64_t dma_addr;
 	uint32_t i;
 
 	for (i = 0; i < 4; i++, txdp++, pkts++) {
 		dma_addr = rte_mbuf_data_iova(*pkts);
-		txdp->buf_addr = rte_cpu_to_le_64(dma_addr);
+		txdp->buffer_addr = rte_cpu_to_le_64(dma_addr);
 		txdp->cmd_type_offset_bsz =
 			ice_build_ctob((uint32_t)ICE_TD_CMD, 0,
 				       (*pkts)->data_len, 0);
@@ -3579,12 +3579,12 @@ tx4(volatile struct ice_tx_desc *txdp, struct rte_mbuf **pkts)
 
 /* Populate 1 descriptor with data from 1 mbuf */
 static inline void
-tx1(volatile struct ice_tx_desc *txdp, struct rte_mbuf **pkts)
+tx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkts)
 {
 	uint64_t dma_addr;
 
 	dma_addr = rte_mbuf_data_iova(*pkts);
-	txdp->buf_addr = rte_cpu_to_le_64(dma_addr);
+	txdp->buffer_addr = rte_cpu_to_le_64(dma_addr);
 	txdp->cmd_type_offset_bsz =
 		ice_build_ctob((uint32_t)ICE_TD_CMD, 0,
 			       (*pkts)->data_len, 0);
@@ -3594,7 +3594,7 @@ static inline void
 ice_tx_fill_hw_ring(struct ci_tx_queue *txq, struct rte_mbuf **pkts,
 		    uint16_t nb_pkts)
 {
-	volatile struct ice_tx_desc *txdp = &txq->ice_tx_ring[txq->tx_tail];
+	volatile struct ci_tx_desc *txdp = &txq->ice_tx_ring[txq->tx_tail];
 	struct ci_tx_entry *txep = &txq->sw_ring[txq->tx_tail];
 	const int N_PER_LOOP = 4;
 	const int N_PER_LOOP_MASK = N_PER_LOOP - 1;
@@ -3627,7 +3627,7 @@ tx_xmit_pkts(struct ci_tx_queue *txq,
 	     struct rte_mbuf **tx_pkts,
 	     uint16_t nb_pkts)
 {
-	volatile struct ice_tx_desc *txr = txq->ice_tx_ring;
+	volatile struct ci_tx_desc *txr = txq->ice_tx_ring;
 	uint16_t n = 0;
 
 	/**
@@ -4882,7 +4882,7 @@ ice_fdir_programming(struct ice_pf *pf, struct ice_fltr_desc *fdir_desc)
 	struct ci_tx_queue *txq = pf->fdir.txq;
 	struct ci_rx_queue *rxq = pf->fdir.rxq;
 	volatile struct ice_fltr_desc *fdirdp;
-	volatile struct ice_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	uint32_t td_cmd;
 	uint16_t i;
 
@@ -4892,7 +4892,7 @@ ice_fdir_programming(struct ice_pf *pf, struct ice_fltr_desc *fdir_desc)
 	fdirdp->dtype_cmd_vsi_fdid = fdir_desc->dtype_cmd_vsi_fdid;
 
 	txdp = &txq->ice_tx_ring[txq->tx_tail + 1];
-	txdp->buf_addr = rte_cpu_to_le_64(pf->fdir.dma_addr);
+	txdp->buffer_addr = rte_cpu_to_le_64(pf->fdir.dma_addr);
 	td_cmd = ICE_TX_DESC_CMD_EOP |
 		ICE_TX_DESC_CMD_RS  |
 		ICE_TX_DESC_CMD_DUMMY;
drivers/net/intel/ice/ice_rxtx_vec_avx2.c +3 -3
index 0ba1d557ca..bef7bb00ba 100644
@@ -774,7 +774,7 @@ ice_recv_scattered_pkts_vec_avx2_offload(void *rx_queue,
 }
 
 static __rte_always_inline void
-ice_vtx1(volatile struct ice_tx_desc *txdp,
+ice_vtx1(volatile struct ci_tx_desc *txdp,
 	 struct rte_mbuf *pkt, uint64_t flags, bool offload)
 {
 	uint64_t high_qw =
@@ -789,7 +789,7 @@ ice_vtx1(volatile struct ice_tx_desc *txdp,
 }
 
 static __rte_always_inline void
-ice_vtx(volatile struct ice_tx_desc *txdp,
+ice_vtx(volatile struct ci_tx_desc *txdp,
 	struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags, bool offload)
 {
 	const uint64_t hi_qw_tmpl = (ICE_TX_DESC_DTYPE_DATA |
@@ -852,7 +852,7 @@ ice_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 			      uint16_t nb_pkts, bool offload)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct ice_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = ICE_TD_CMD;
drivers/net/intel/ice/ice_rxtx_vec_avx512.c +3 -3
index 7c6fe82072..1f6bf5fc8e 100644
@@ -847,7 +847,7 @@ ice_recv_scattered_pkts_vec_avx512_offload(void *rx_queue,
 }
 
 static __rte_always_inline void
-ice_vtx1(volatile struct ice_tx_desc *txdp,
+ice_vtx1(volatile struct ci_tx_desc *txdp,
 	 struct rte_mbuf *pkt, uint64_t flags, bool do_offload)
 {
 	uint64_t high_qw =
@@ -863,7 +863,7 @@ ice_vtx1(volatile struct ice_tx_desc *txdp,
 }
 
 static __rte_always_inline void
-ice_vtx(volatile struct ice_tx_desc *txdp, struct rte_mbuf **pkt,
+ice_vtx(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkt,
 	uint16_t nb_pkts,  uint64_t flags, bool do_offload)
 {
 	const uint64_t hi_qw_tmpl = (ICE_TX_DESC_DTYPE_DATA |
@@ -916,7 +916,7 @@ ice_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 				uint16_t nb_pkts, bool do_offload)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct ice_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = ICE_TD_CMD;
drivers/net/intel/idpf/idpf_common_rxtx.c +10 -10
index 797ee515dd..be3c1ef216 100644
@@ -264,13 +264,13 @@ idpf_qc_single_tx_queue_reset(struct ci_tx_queue *txq)
 	}
 
 	txe = txq->sw_ring;
-	size = sizeof(struct idpf_base_tx_desc) * txq->nb_tx_desc;
+	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
 		((volatile char *)txq->idpf_tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		txq->idpf_tx_ring[i].qw1 =
+		txq->idpf_tx_ring[i].cmd_type_offset_bsz =
 			rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
 		txe[i].last_id = i;
@@ -1335,14 +1335,14 @@ idpf_xmit_cleanup(struct ci_tx_queue *txq)
 	uint16_t desc_to_clean_to;
 	uint16_t nb_tx_to_clean;
 
-	volatile struct idpf_base_tx_desc *txd = txq->idpf_tx_ring;
+	volatile struct ci_tx_desc *txd = txq->idpf_tx_ring;
 
 	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
 	if (desc_to_clean_to >= nb_tx_desc)
 		desc_to_clean_to = (uint16_t)(desc_to_clean_to - nb_tx_desc);
 
 	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
-	if ((txd[desc_to_clean_to].qw1 &
+	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &
 	     rte_cpu_to_le_64(IDPF_TXD_QW1_DTYPE_M)) !=
 	    rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE)) {
 		TX_LOG(DEBUG, "TX descriptor %4u is not done "
@@ -1358,7 +1358,7 @@ idpf_xmit_cleanup(struct ci_tx_queue *txq)
 		nb_tx_to_clean = (uint16_t)(desc_to_clean_to -
 					    last_desc_cleaned);
 
-	txd[desc_to_clean_to].qw1 = 0;
+	txd[desc_to_clean_to].cmd_type_offset_bsz = 0;
 
 	txq->last_desc_cleaned = desc_to_clean_to;
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + nb_tx_to_clean);
@@ -1372,8 +1372,8 @@ uint16_t
 idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			  uint16_t nb_pkts)
 {
-	volatile struct idpf_base_tx_desc *txd;
-	volatile struct idpf_base_tx_desc *txr;
+	volatile struct ci_tx_desc *txd;
+	volatile struct ci_tx_desc *txr;
 	union idpf_tx_offload tx_offload = {0};
 	struct ci_tx_entry *txe, *txn;
 	struct ci_tx_entry *sw_ring;
@@ -1491,8 +1491,8 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			/* Setup TX Descriptor */
 			slen = m_seg->data_len;
 			buf_dma_addr = rte_mbuf_data_iova(m_seg);
-			txd->buf_addr = rte_cpu_to_le_64(buf_dma_addr);
-			txd->qw1 = rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DATA |
+			txd->buffer_addr = rte_cpu_to_le_64(buf_dma_addr);
+			txd->cmd_type_offset_bsz = rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DATA |
 				((uint64_t)td_cmd  << IDPF_TXD_QW1_CMD_S) |
 				((uint64_t)td_offset << IDPF_TXD_QW1_OFFSET_S) |
 				((uint64_t)slen << IDPF_TXD_QW1_TX_BUF_SZ_S));
@@ -1519,7 +1519,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			txq->nb_tx_used = 0;
 		}
 
-		txd->qw1 |= rte_cpu_to_le_16(td_cmd << IDPF_TXD_QW1_CMD_S);
+		txd->cmd_type_offset_bsz |= rte_cpu_to_le_16(td_cmd << IDPF_TXD_QW1_CMD_S);
 	}
 
 end_of_tx:
drivers/net/intel/idpf/idpf_common_rxtx.h +1 -1
index 7c6ff5d047..2f2fa153b2 100644
@@ -182,7 +182,7 @@ union idpf_tx_offload {
 };
 
 union idpf_tx_desc {
-	struct idpf_base_tx_desc *tx_ring;
+	struct ci_tx_desc *tx_ring;
 	struct idpf_flex_tx_sched_desc *desc_ring;
 	struct idpf_splitq_tx_compl_desc *compl_ring;
 };
drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +4 -4
index 21c8f79254..5f5d538dcb 100644
@@ -483,7 +483,7 @@ idpf_dp_singleq_recv_pkts_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16
 }
 
 static inline void
-idpf_singleq_vtx1(volatile struct idpf_base_tx_desc *txdp,
+idpf_singleq_vtx1(volatile struct ci_tx_desc *txdp,
 		  struct rte_mbuf *pkt, uint64_t flags)
 {
 	uint64_t high_qw =
@@ -497,7 +497,7 @@ idpf_singleq_vtx1(volatile struct idpf_base_tx_desc *txdp,
 }
 
 static inline void
-idpf_singleq_vtx(volatile struct idpf_base_tx_desc *txdp,
+idpf_singleq_vtx(volatile struct ci_tx_desc *txdp,
 		 struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
 	const uint64_t hi_qw_tmpl = (IDPF_TX_DESC_DTYPE_DATA |
@@ -556,7 +556,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts
 				       uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct idpf_base_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = IDPF_TX_DESC_CMD_EOP;
@@ -604,7 +604,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->idpf_tx_ring[txq->tx_next_rs].qw1 |=
+		txq->idpf_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)IDPF_TX_DESC_CMD_RS) <<
 					 IDPF_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +4 -4
index bc2cadd738..c1ec3d1222 100644
@@ -1000,7 +1000,7 @@ idpf_dp_splitq_recv_pkts_avx512(void *rx_queue, struct rte_mbuf **rx_pkts,
 }
 
 static __rte_always_inline void
-idpf_singleq_vtx1(volatile struct idpf_base_tx_desc *txdp,
+idpf_singleq_vtx1(volatile struct ci_tx_desc *txdp,
 	  struct rte_mbuf *pkt, uint64_t flags)
 {
 	uint64_t high_qw =
@@ -1016,7 +1016,7 @@ idpf_singleq_vtx1(volatile struct idpf_base_tx_desc *txdp,
 #define IDPF_TX_LEN_MASK 0xAA
 #define IDPF_TX_OFF_MASK 0x55
 static __rte_always_inline void
-idpf_singleq_vtx(volatile struct idpf_base_tx_desc *txdp,
+idpf_singleq_vtx(volatile struct ci_tx_desc *txdp,
 	 struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
 	const uint64_t hi_qw_tmpl = (IDPF_TX_DESC_DTYPE_DATA  |
@@ -1072,7 +1072,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pk
 					 uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = tx_queue;
-	volatile struct idpf_base_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = IDPF_TX_DESC_CMD_EOP;
@@ -1123,7 +1123,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pk
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->idpf_tx_ring[txq->tx_next_rs].qw1 |=
+		txq->idpf_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)IDPF_TX_DESC_CMD_RS) <<
 					 IDPF_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
drivers/net/intel/idpf/idpf_rxtx.c +1 -1
index cee454244f..8aa44585fe 100644
@@ -72,7 +72,7 @@ idpf_dma_zone_reserve(struct rte_eth_dev *dev, uint16_t queue_idx,
 			ring_size = RTE_ALIGN(len * sizeof(struct idpf_flex_tx_sched_desc),
 					      IDPF_DMA_MEM_ALIGN);
 		else
-			ring_size = RTE_ALIGN(len * sizeof(struct idpf_base_tx_desc),
+			ring_size = RTE_ALIGN(len * sizeof(struct ci_tx_desc),
 					      IDPF_DMA_MEM_ALIGN);
 		rte_memcpy(ring_name, "idpf Tx ring", sizeof("idpf Tx ring"));
 		break;
drivers/net/intel/idpf/idpf_rxtx_vec_common.h +1 -1
index 425f0792a1..4702061484 100644
@@ -31,7 +31,7 @@ idpf_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
 	if (txq->complq != NULL)
 		return 1;
 
-	return (txq->idpf_tx_ring[idx].qw1 &
+	return (txq->idpf_tx_ring[idx].cmd_type_offset_bsz &
 			rte_cpu_to_le_64(IDPF_TXD_QW1_DTYPE_M)) ==
 				rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE);
 }
Signature · 1 line
2.51.0
Acked-by on v3 1/36
#73 lore raw

RE: [PATCH v3 01/36] net/intel: create common Tx descriptor structure

Quoted 8 lines

Subject: [PATCH v3 01/36] net/intel: create common Tx descriptor structure

The Tx descriptors used by the i40e, iavf, ice and idpf drivers are all identical 16-byte descriptors, so define a common struct for them. Since original struct definitions are in base code, leave them in place, but only use the new structs in DPDK code.

Quoted 1,032 lines
---
 drivers/net/intel/common/tx.h                 | 16 ++++++---
 drivers/net/intel/cpfl/cpfl_rxtx.c            |  2 +-
 drivers/net/intel/i40e/i40e_fdir.c            |  4 +--
 drivers/net/intel/i40e/i40e_rxtx.c            | 26 +++++++-------
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |  6 ++--
 drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c   |  6 ++--
 drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c |  6 ++--
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |  6 ++--
 drivers/net/intel/iavf/iavf_rxtx.c            | 16 ++++-----
 drivers/net/intel/iavf/iavf_rxtx.h            |  2 +-
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   |  6 ++--
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 12 +++----
 drivers/net/intel/ice/ice_dcf_ethdev.c        |  2 +-
 drivers/net/intel/ice/ice_rxtx.c              | 36 +++++++++----------
 drivers/net/intel/ice/ice_rxtx_vec_avx2.c     |  6 ++--
 drivers/net/intel/ice/ice_rxtx_vec_avx512.c   |  6 ++--
 drivers/net/intel/idpf/idpf_common_rxtx.c     | 20 +++++------
 drivers/net/intel/idpf/idpf_common_rxtx.h     |  2 +-
 .../net/intel/idpf/idpf_common_rxtx_avx2.c    |  8 ++---
 .../net/intel/idpf/idpf_common_rxtx_avx512.c  |  8 ++---
 drivers/net/intel/idpf/idpf_rxtx.c            |  2 +-
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |  2 +-
 22 files changed, 104 insertions(+), 96 deletions(-)
drivers/net/intel/common/tx.h +2 -0
index e295d83e3a..d7561a2bbb 100644
@@ -10,6 +10,14 @@
 #include <rte_ethdev.h>
 #include <rte_vect.h>
 
+/*
+ * Structure of a 16-byte Tx descriptor common across i40e, ice, iavf and idpf

drivers
+ */

drivers/net/intel/common/tx.h +9 -4
+struct ci_tx_desc {
+	uint64_t buffer_addr; /* Address of descriptor's data buf */
+	uint64_t cmd_type_offset_bsz;
+};
+
 /* forward declaration of the common intel (ci) queue structure */
 struct ci_tx_queue;
@@ -33,10 +41,10 @@ typedef void (*ice_tx_release_mbufs_t)(struct
 ci_tx_queue *txq);
 
 struct ci_tx_queue {
 	union { /* TX ring virtual address */
-		volatile struct i40e_tx_desc *i40e_tx_ring;
-		volatile struct iavf_tx_desc *iavf_tx_ring;
-		volatile struct ice_tx_desc *ice_tx_ring;
-		volatile struct idpf_base_tx_desc *idpf_tx_ring;
+		volatile struct ci_tx_desc *i40e_tx_ring;
+		volatile struct ci_tx_desc *iavf_tx_ring;
+		volatile struct ci_tx_desc *ice_tx_ring;
+		volatile struct ci_tx_desc *idpf_tx_ring;
 		volatile union ixgbe_adv_tx_desc *ixgbe_tx_ring;
 	};
drivers/net/intel/common/tx.h +0 -0
 	volatile uint8_t *qtx_tail;               /* register address of tail */
drivers/net/intel/cpfl/cpfl_rxtx.c +1 -1
index d0438b5da0..78bc3e9b49 100644
@@ -131,7 +131,7 @@ cpfl_dma_zone_reserve(struct rte_eth_dev *dev,
 uint16_t queue_idx,
 			ring_size = RTE_ALIGN(len * sizeof(struct
 idpf_flex_tx_sched_desc),
 					      CPFL_DMA_MEM_ALIGN);
 		else
-			ring_size = RTE_ALIGN(len * sizeof(struct
 idpf_base_tx_desc),
+			ring_size = RTE_ALIGN(len * sizeof(struct ci_tx_desc),
drivers/net/intel/cpfl/cpfl_rxtx.c +0 -0
 					      CPFL_DMA_MEM_ALIGN);
 		memcpy(ring_name, "cpfl Tx ring", sizeof("cpfl Tx ring"));
 		break;
drivers/net/intel/i40e/i40e_fdir.c +1 -1
index 55d18c5d4a..605df73c9e 100644
@@ -1377,7 +1377,7 @@ i40e_find_available_buffer(struct rte_eth_dev
 *dev)
 	 */
 	if (fdir_info->txq_available_buf_count <= 0) {
 		uint16_t tmp_tail;
-		volatile struct i40e_tx_desc *tmp_txdp;
+		volatile struct ci_tx_desc *tmp_txdp;
 
 		tmp_tail = txq->tx_tail;
drivers/net/intel/i40e/i40e_fdir.c +1 -1
 		tmp_txdp = &txq->i40e_tx_ring[tmp_tail + 1];
@@ -1628,7 +1628,7 @@ i40e_flow_fdir_filter_programming(struct i40e_pf
 *pf,
 	struct ci_tx_queue *txq = pf->fdir.txq;
 	struct ci_rx_queue *rxq = pf->fdir.rxq;
 	const struct i40e_fdir_action *fdir_action = &filter->action;
-	volatile struct i40e_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	volatile struct i40e_filter_program_desc *fdirdp;
 	uint32_t td_cmd;
drivers/net/intel/i40e/i40e_fdir.c +0 -0
 	uint16_t vsi_id;
drivers/net/intel/i40e/i40e_rxtx.c +3 -3
index 1c3586778c..92d49ccb79 100644
@@ -388,7 +388,7 @@ static inline int
 i40e_xmit_cleanup(struct ci_tx_queue *txq)
 {
 	struct ci_tx_entry *sw_ring = txq->sw_ring;
-	volatile struct i40e_tx_desc *txd = txq->i40e_tx_ring;
+	volatile struct ci_tx_desc *txd = txq->i40e_tx_ring;
 	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
 	uint16_t nb_tx_desc = txq->nb_tx_desc;
 	uint16_t desc_to_clean_to;
@@ -1092,8 +1092,8 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 	struct ci_tx_queue *txq;
 	struct ci_tx_entry *sw_ring;
 	struct ci_tx_entry *txe, *txn;
-	volatile struct i40e_tx_desc *txd;
-	volatile struct i40e_tx_desc *txr;
+	volatile struct ci_tx_desc *txd;
+	volatile struct ci_tx_desc *txr;
 	struct rte_mbuf *tx_pkt;
 	struct rte_mbuf *m_seg;
drivers/net/intel/i40e/i40e_rxtx.c +5 -5
 	uint32_t cd_tunneling_params;
@@ -1398,7 +1398,7 @@ i40e_tx_free_bufs(struct ci_tx_queue *txq)
 
 /* Populate 4 descriptors with data from 4 mbufs */
 static inline void
-tx4(volatile struct i40e_tx_desc *txdp, struct rte_mbuf **pkts)
+tx4(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkts)
 {
 	uint64_t dma_addr;
 	uint32_t i;
@@ -1414,7 +1414,7 @@ tx4(volatile struct i40e_tx_desc *txdp, struct
 rte_mbuf **pkts)
 
 /* Populate 1 descriptor with data from 1 mbuf */
 static inline void
-tx1(volatile struct i40e_tx_desc *txdp, struct rte_mbuf **pkts)
+tx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkts)
 {
 	uint64_t dma_addr;
@@ -1431,7 +1431,7 @@ i40e_tx_fill_hw_ring(struct ci_tx_queue *txq,
 		     struct rte_mbuf **pkts,
 		     uint16_t nb_pkts)
 {
-	volatile struct i40e_tx_desc *txdp = &txq->i40e_tx_ring[txq->tx_tail];
+	volatile struct ci_tx_desc *txdp = &txq->i40e_tx_ring[txq->tx_tail];
 	struct ci_tx_entry *txep = &txq->sw_ring[txq->tx_tail];
 	const int N_PER_LOOP = 4;
 	const int N_PER_LOOP_MASK = N_PER_LOOP - 1;
@@ -1459,7 +1459,7 @@ tx_xmit_pkts(struct ci_tx_queue *txq,
 	     struct rte_mbuf **tx_pkts,
 	     uint16_t nb_pkts)
 {
-	volatile struct i40e_tx_desc *txr = txq->i40e_tx_ring;
+	volatile struct ci_tx_desc *txr = txq->i40e_tx_ring;
 	uint16_t n = 0;
 
 	/**
@@ -2616,7 +2616,7 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev
 *dev,
 	}
 
 	/* Allocate TX hardware ring descriptors. */
-	ring_size = sizeof(struct i40e_tx_desc) * I40E_MAX_RING_DESC;
+	ring_size = sizeof(struct ci_tx_desc) * I40E_MAX_RING_DESC;
 	ring_size = RTE_ALIGN(ring_size, I40E_DMA_MEM_ALIGN);
 	tz = rte_eth_dma_zone_reserve(dev, "i40e_tx_ring", queue_idx,
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
 			      ring_size, I40E_RING_BASE_ALIGN, socket_id);
@@ -2640,7 +2640,7 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev
 *dev,
 	txq->tx_deferred_start = tx_conf->tx_deferred_start;
 
 	txq->tx_ring_dma = tz->iova;
-	txq->i40e_tx_ring = (struct i40e_tx_desc *)tz->addr;
+	txq->i40e_tx_ring = (struct ci_tx_desc *)tz->addr;
 
 	/* Allocate software ring */
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
 	txq->sw_ring =
@@ -2913,13 +2913,13 @@ i40e_reset_tx_queue(struct ci_tx_queue *txq)
 	}
 
 	txe = txq->sw_ring;
-	size = sizeof(struct i40e_tx_desc) * txq->nb_tx_desc;
+	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
 		((volatile char *)txq->i40e_tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		volatile struct i40e_tx_desc *txd = &txq->i40e_tx_ring[i];
+		volatile struct ci_tx_desc *txd = &txq->i40e_tx_ring[i];
 
 		txd->cmd_type_offset_bsz =
 
	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE);
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
@@ -3221,7 +3221,7 @@ i40e_fdir_setup_tx_resources(struct i40e_pf *pf)
 	}
 
 	/* Allocate TX hardware ring descriptors. */
-	ring_size = sizeof(struct i40e_tx_desc) * I40E_FDIR_NUM_TX_DESC;
+	ring_size = sizeof(struct ci_tx_desc) * I40E_FDIR_NUM_TX_DESC;
 	ring_size = RTE_ALIGN(ring_size, I40E_DMA_MEM_ALIGN);
 
 	tz = rte_eth_dma_zone_reserve(dev, "fdir_tx_ring",
@@ -3240,7 +3240,7 @@ i40e_fdir_setup_tx_resources(struct i40e_pf *pf)
 	txq->i40e_vsi = pf->fdir.fdir_vsi;
 
 	txq->tx_ring_dma = tz->iova;
-	txq->i40e_tx_ring = (struct i40e_tx_desc *)tz->addr;
+	txq->i40e_tx_ring = (struct ci_tx_desc *)tz->addr;
 
 	/*
 	 * don't need to allocate software ring and reset for the fdir
drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +1 -1
index bbb6d907cf..ef5b252898 100644
@@ -446,7 +446,7 @@ i40e_recv_scattered_pkts_vec(void *rx_queue, struct
 rte_mbuf **rx_pkts,
 }
 
 static inline void
-vtx1(volatile struct i40e_tx_desc *txdp,
+vtx1(volatile struct ci_tx_desc *txdp,
 	struct rte_mbuf *pkt, uint64_t flags)
 {
drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +2 -2
 	uint64_t high_qw = (I40E_TX_DESC_DTYPE_DATA |
@@ -459,7 +459,7 @@ vtx1(volatile struct i40e_tx_desc *txdp,
 }
 
 static inline void
-vtx(volatile struct i40e_tx_desc *txdp,
+vtx(volatile struct ci_tx_desc *txdp,
 	struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
 	int i;
@@ -473,7 +473,7 @@ i40e_xmit_fixed_burst_vec(void *tx_queue, struct
 rte_mbuf **tx_pkts,
 			  uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct i40e_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +0 -0
 	uint64_t flags = I40E_TD_CMD;
drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +1 -1
index 4e398b3140..137c1f9765 100644
@@ -681,7 +681,7 @@ i40e_recv_scattered_pkts_vec_avx2(void *rx_queue,
 struct rte_mbuf **rx_pkts,
 
 
 static inline void
-vtx1(volatile struct i40e_tx_desc *txdp,
+vtx1(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf *pkt, uint64_t flags)
 {
drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +2 -2
 	uint64_t high_qw = (I40E_TX_DESC_DTYPE_DATA |
@@ -694,7 +694,7 @@ vtx1(volatile struct i40e_tx_desc *txdp,
 }
 
 static inline void
-vtx(volatile struct i40e_tx_desc *txdp,
+vtx(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
 	const uint64_t hi_qw_tmpl = (I40E_TX_DESC_DTYPE_DATA |
@@ -739,7 +739,7 @@ i40e_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 			  uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct i40e_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +0 -0
 	uint64_t flags = I40E_TD_CMD;
drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c +1 -1
index 571987d27a..6971488750 100644
@@ -750,7 +750,7 @@ i40e_recv_scattered_pkts_vec_avx512(void
 *rx_queue,
 }
 
 static inline void
-vtx1(volatile struct i40e_tx_desc *txdp, struct rte_mbuf *pkt, uint64_t flags)
+vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt, uint64_t flags)
 {
 	uint64_t high_qw = (I40E_TX_DESC_DTYPE_DATA |
drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c +1 -1
 		((uint64_t)flags  << I40E_TXD_QW1_CMD_SHIFT) |
@@ -762,7 +762,7 @@ vtx1(volatile struct i40e_tx_desc *txdp, struct
 rte_mbuf *pkt, uint64_t flags)
 }
 
 static inline void
-vtx(volatile struct i40e_tx_desc *txdp,
+vtx(volatile struct ci_tx_desc *txdp,
 	struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c +1 -1
 	const uint64_t hi_qw_tmpl = (I40E_TX_DESC_DTYPE_DATA |
@@ -807,7 +807,7 @@ i40e_xmit_fixed_burst_vec_avx512(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 				 uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct i40e_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c +0 -0
 	uint64_t flags = I40E_TD_CMD;
drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +1 -1
index b5be0c1b59..6404b70c56 100644
@@ -597,7 +597,7 @@ i40e_recv_scattered_pkts_vec(void *rx_queue, struct
 rte_mbuf **rx_pkts,
 }
 
 static inline void
-vtx1(volatile struct i40e_tx_desc *txdp,
+vtx1(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf *pkt, uint64_t flags)
 {
drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +2 -2
 	uint64_t high_qw = (I40E_TX_DESC_DTYPE_DATA |
@@ -609,7 +609,7 @@ vtx1(volatile struct i40e_tx_desc *txdp,
 }
 
 static inline void
-vtx(volatile struct i40e_tx_desc *txdp, struct rte_mbuf **pkt,
+vtx(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkt,
 		uint16_t nb_pkts,  uint64_t flags)
 {
 	int i;
@@ -623,7 +623,7 @@ i40e_xmit_fixed_burst_vec(void *__rte_restrict
 tx_queue,
 	struct rte_mbuf **__rte_restrict tx_pkts, uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct i40e_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +0 -0
 	uint64_t flags = I40E_TD_CMD;
drivers/net/intel/iavf/iavf_rxtx.c +7 -7
index 4b763627bc..e4421a9932 100644
@@ -267,7 +267,7 @@ reset_tx_queue(struct ci_tx_queue *txq)
 	}
 
 	txe = txq->sw_ring;
-	size = sizeof(struct iavf_tx_desc) * txq->nb_tx_desc;
+	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
 		((volatile char *)txq->iavf_tx_ring)[i] = 0;
 
@@ -827,7 +827,7 @@ iavf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	/* Allocate TX hardware ring descriptors. */
-	ring_size = sizeof(struct iavf_tx_desc) * IAVF_MAX_RING_DESC;
+	ring_size = sizeof(struct ci_tx_desc) * IAVF_MAX_RING_DESC;
 	ring_size = RTE_ALIGN(ring_size, IAVF_DMA_MEM_ALIGN);
 	mz = rte_eth_dma_zone_reserve(dev, "iavf_tx_ring", queue_idx,
 				      ring_size, IAVF_RING_BASE_ALIGN,
@@ -839,7 +839,7 @@ iavf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 	txq->tx_ring_dma = mz->iova;
-	txq->iavf_tx_ring = (struct iavf_tx_desc *)mz->addr;
+	txq->iavf_tx_ring = (struct ci_tx_desc *)mz->addr;
 
 	txq->mz = mz;
 	reset_tx_queue(txq);
@@ -2333,7 +2333,7 @@ iavf_xmit_cleanup(struct ci_tx_queue *txq)
 	uint16_t desc_to_clean_to;
 	uint16_t nb_tx_to_clean;
 
-	volatile struct iavf_tx_desc *txd = txq->iavf_tx_ring;
+	volatile struct ci_tx_desc *txd = txq->iavf_tx_ring;
 
 	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
 	if (desc_to_clean_to >= nb_tx_desc)
@@ -2723,7 +2723,7 @@ iavf_calc_pkt_desc(struct rte_mbuf *tx_pkt)
 }
 
 static inline void
-iavf_fill_data_desc(volatile struct iavf_tx_desc *desc,
+iavf_fill_data_desc(volatile struct ci_tx_desc *desc,
 	uint64_t desc_template,	uint16_t buffsz,
 	uint64_t buffer_addr)
 {
@@ -2756,7 +2756,7 @@ uint16_t
 iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = tx_queue;
-	volatile struct iavf_tx_desc *txr = txq->iavf_tx_ring;
+	volatile struct ci_tx_desc *txr = txq->iavf_tx_ring;
 	struct ci_tx_entry *txe_ring = txq->sw_ring;
 	struct ci_tx_entry *txe, *txn;
 	struct rte_mbuf *mb, *mb_seg;
@@ -2774,7 +2774,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 	txe = &txe_ring[desc_idx];
 
 	for (idx = 0; idx < nb_pkts; idx++) {
-		volatile struct iavf_tx_desc *ddesc;
+		volatile struct ci_tx_desc *ddesc;
 		struct iavf_ipsec_crypto_pkt_metadata *ipsec_md;
 
drivers/net/intel/iavf/iavf_rxtx.c +1 -1
 		uint16_t nb_desc_ctx, nb_desc_ipsec;
@@ -2895,7 +2895,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 		mb_seg = mb;
 
 		do {
-			ddesc = (volatile struct iavf_tx_desc *)
+			ddesc = (volatile struct ci_tx_desc *)
 					&txr[desc_idx];
 
drivers/net/intel/iavf/iavf_rxtx.c +0 -0
 			txn = &txe_ring[txe->next_id];
drivers/net/intel/iavf/iavf_rxtx.h +1 -1
index e1f78dcde0..dd6d884fc1 100644
@@ -678,7 +678,7 @@ void iavf_dump_tx_descriptor(const struct
 ci_tx_queue *txq,
 			    const volatile void *desc, uint16_t tx_id)
 {
 	const char *name;
-	const volatile struct iavf_tx_desc *tx_desc = desc;
+	const volatile struct ci_tx_desc *tx_desc = desc;
 	enum iavf_tx_desc_dtype_value type;
 
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +1 -1
index e29958e0bc..5b62d51cf7 100644
@@ -1630,7 +1630,7 @@
 iavf_recv_scattered_pkts_vec_avx2_flex_rxd_offload(void *rx_queue,
 
 
 static __rte_always_inline void
-iavf_vtx1(volatile struct iavf_tx_desc *txdp,
+iavf_vtx1(volatile struct ci_tx_desc *txdp,
 	  struct rte_mbuf *pkt, uint64_t flags, bool offload, uint8_t vlan_flag)
 {
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +1 -1
 	uint64_t high_qw =
@@ -1646,7 +1646,7 @@ iavf_vtx1(volatile struct iavf_tx_desc *txdp,
 }
 
 static __rte_always_inline void
-iavf_vtx(volatile struct iavf_tx_desc *txdp,
+iavf_vtx(volatile struct ci_tx_desc *txdp,
 	 struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags, bool
 offload, uint8_t vlan_flag)
 {
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +1 -1
 	const uint64_t hi_qw_tmpl = (IAVF_TX_DESC_DTYPE_DATA |
@@ -1713,7 +1713,7 @@ iavf_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 			       uint16_t nb_pkts, bool offload)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct iavf_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +0 -0
 	/* bit2 is reserved and must be set to 1 according to Spec */
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +1 -1
index 7c0907b7cf..d79d96c7b7 100644
@@ -1840,7 +1840,7 @@ tx_backlog_entry_avx512(struct ci_tx_entry_vec
 *txep,
 }
 
 static __rte_always_inline void
-iavf_vtx1(volatile struct iavf_tx_desc *txdp,
+iavf_vtx1(volatile struct ci_tx_desc *txdp,
 	  struct rte_mbuf *pkt, uint64_t flags,
 	  bool offload, uint8_t vlan_flag)

{

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +2 -2
@@ -1859,7 +1859,7 @@ iavf_vtx1(volatile struct iavf_tx_desc *txdp,
 #define IAVF_TX_LEN_MASK 0xAA
 #define IAVF_TX_OFF_MASK 0x55
 static __rte_always_inline void
-iavf_vtx(volatile struct iavf_tx_desc *txdp,
+iavf_vtx(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags,
 		bool offload, uint8_t vlan_flag)
 {
@@ -2068,7 +2068,7 @@ iavf_fill_ctx_desc_tunnelling_field(volatile uint64_t
 *qw0,
 }
 
 static __rte_always_inline void
-ctx_vtx1(volatile struct iavf_tx_desc *txdp, struct rte_mbuf *pkt,
+ctx_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt,
 		uint64_t flags, bool offload, uint8_t vlan_flag)
 {
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +1 -1
 	uint64_t high_ctx_qw = IAVF_TX_DESC_DTYPE_CONTEXT;
@@ -2106,7 +2106,7 @@ ctx_vtx1(volatile struct iavf_tx_desc *txdp, struct
 rte_mbuf *pkt,
 }
 
 static __rte_always_inline void
-ctx_vtx(volatile struct iavf_tx_desc *txdp,
+ctx_vtx(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags,
 		bool offload, uint8_t vlan_flag)

{

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +1 -1
@@ -2203,7 +2203,7 @@ iavf_xmit_fixed_burst_vec_avx512(void
 *tx_queue, struct rte_mbuf **tx_pkts,
 				 uint16_t nb_pkts, bool offload)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct iavf_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +1 -1
 	/* bit2 is reserved and must be set to 1 according to Spec */
@@ -2271,7 +2271,7 @@ iavf_xmit_fixed_burst_vec_avx512_ctx(void
 *tx_queue, struct rte_mbuf **tx_pkts,
 				 uint16_t nb_pkts, bool offload)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct iavf_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, nb_mbuf, tx_id;
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -0
 	/* bit2 is reserved and must be set to 1 according to Spec */
drivers/net/intel/ice/ice_dcf_ethdev.c +1 -1
index 81da5a4656..ab1d499cef 100644
@@ -399,7 +399,7 @@ reset_tx_queue(struct ci_tx_queue *txq)
 	}
 
 	txe = txq->sw_ring;
-	size = sizeof(struct ice_tx_desc) * txq->nb_tx_desc;
+	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
 		((volatile char *)txq->ice_tx_ring)[i] = 0;
 
drivers/net/intel/ice/ice_rxtx.c +3 -3
index f3bc79423d..74b80e7df3 100644
@@ -1115,13 +1115,13 @@ ice_reset_tx_queue(struct ci_tx_queue *txq)
 	}
 
 	txe = txq->sw_ring;
-	size = sizeof(struct ice_tx_desc) * txq->nb_tx_desc;
+	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
 		((volatile char *)txq->ice_tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		volatile struct ice_tx_desc *txd = &txq->ice_tx_ring[i];
+		volatile struct ci_tx_desc *txd = &txq->ice_tx_ring[i];
 
 		txd->cmd_type_offset_bsz =
 			rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE);
@@ -1623,7 +1623,7 @@ ice_tx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	/* Allocate TX hardware ring descriptors. */
-	ring_size = sizeof(struct ice_tx_desc) *
 ICE_MAX_NUM_DESC_BY_MAC(hw);
+	ring_size = sizeof(struct ci_tx_desc) *
 ICE_MAX_NUM_DESC_BY_MAC(hw);
 	ring_size = RTE_ALIGN(ring_size, ICE_DMA_MEM_ALIGN);
drivers/net/intel/ice/ice_rxtx.c +5 -5
 	tz = rte_eth_dma_zone_reserve(dev, "ice_tx_ring", queue_idx,
 				      ring_size, ICE_RING_BASE_ALIGN,
@@ -2619,7 +2619,7 @@ ice_fdir_setup_tx_resources(struct ice_pf *pf)
 	}
 
 	/* Allocate TX hardware ring descriptors. */
-	ring_size = sizeof(struct ice_tx_desc) * ICE_FDIR_NUM_TX_DESC;
+	ring_size = sizeof(struct ci_tx_desc) * ICE_FDIR_NUM_TX_DESC;
 	ring_size = RTE_ALIGN(ring_size, ICE_DMA_MEM_ALIGN);
 
 	tz = rte_eth_dma_zone_reserve(dev, "fdir_tx_ring",
@@ -2638,7 +2638,7 @@ ice_fdir_setup_tx_resources(struct ice_pf *pf)
 	txq->ice_vsi = pf->fdir.fdir_vsi;
 
 	txq->tx_ring_dma = tz->iova;
-	txq->ice_tx_ring = (struct ice_tx_desc *)tz->addr;
+	txq->ice_tx_ring = (struct ci_tx_desc *)tz->addr;
 	/*
 	 * don't need to allocate software ring and reset for the fdir
 	 * program queue just set the queue has been configured.
@@ -3027,7 +3027,7 @@ static inline int
 ice_xmit_cleanup(struct ci_tx_queue *txq)
 {
 	struct ci_tx_entry *sw_ring = txq->sw_ring;
-	volatile struct ice_tx_desc *txd = txq->ice_tx_ring;
+	volatile struct ci_tx_desc *txd = txq->ice_tx_ring;
 	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
 	uint16_t nb_tx_desc = txq->nb_tx_desc;
 	uint16_t desc_to_clean_to;
@@ -3148,8 +3148,8 @@ uint16_t
 ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq;
-	volatile struct ice_tx_desc *ice_tx_ring;
-	volatile struct ice_tx_desc *txd;
+	volatile struct ci_tx_desc *ice_tx_ring;
+	volatile struct ci_tx_desc *txd;
 	struct ci_tx_entry *sw_ring;
 	struct ci_tx_entry *txe, *txn;
 	struct rte_mbuf *tx_pkt;
@@ -3312,7 +3312,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 
 			while ((ol_flags & (RTE_MBUF_F_TX_TCP_SEG |

RTE_MBUF_F_TX_UDP_SEG)) &&

drivers/net/intel/ice/ice_rxtx.c +0 -1
 				unlikely(slen > ICE_MAX_DATA_PER_TXD)) {
-				txd->buf_addr =

rte_cpu_to_le_64(buf_dma_addr);

drivers/net/intel/ice/ice_rxtx.c +1 -0
+				txd->buffer_addr =

rte_cpu_to_le_64(buf_dma_addr);

drivers/net/intel/ice/ice_rxtx.c +0 -0
 				txd->cmd_type_offset_bsz =
 				rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DATA

|
((uint64_t)td_cmd << ICE_TXD_QW1_CMD_S)
|

drivers/net/intel/ice/ice_rxtx.c +1 -1
@@ -3331,7 +3331,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 				txn = &sw_ring[txe->next_id];
 			}
 
-			txd->buf_addr = rte_cpu_to_le_64(buf_dma_addr);
+			txd->buffer_addr = rte_cpu_to_le_64(buf_dma_addr);
 			txd->cmd_type_offset_bsz =
 				rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DATA

|
((uint64_t)td_cmd << ICE_TXD_QW1_CMD_S)
|

drivers/net/intel/ice/ice_rxtx.c +2 -2
@@ -3563,14 +3563,14 @@ ice_tx_done_cleanup(void *txq, uint32_t
 free_cnt)
 
 /* Populate 4 descriptors with data from 4 mbufs */
 static inline void
-tx4(volatile struct ice_tx_desc *txdp, struct rte_mbuf **pkts)
+tx4(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkts)
 {
 	uint64_t dma_addr;
 	uint32_t i;
 
 	for (i = 0; i < 4; i++, txdp++, pkts++) {
 		dma_addr = rte_mbuf_data_iova(*pkts);
-		txdp->buf_addr = rte_cpu_to_le_64(dma_addr);
+		txdp->buffer_addr = rte_cpu_to_le_64(dma_addr);
 		txdp->cmd_type_offset_bsz =
 			ice_build_ctob((uint32_t)ICE_TD_CMD, 0,
drivers/net/intel/ice/ice_rxtx.c +2 -2
 				       (*pkts)->data_len, 0);
@@ -3579,12 +3579,12 @@ tx4(volatile struct ice_tx_desc *txdp, struct
 rte_mbuf **pkts)
 
 /* Populate 1 descriptor with data from 1 mbuf */
 static inline void
-tx1(volatile struct ice_tx_desc *txdp, struct rte_mbuf **pkts)
+tx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkts)
 {
 	uint64_t dma_addr;
 
 	dma_addr = rte_mbuf_data_iova(*pkts);
-	txdp->buf_addr = rte_cpu_to_le_64(dma_addr);
+	txdp->buffer_addr = rte_cpu_to_le_64(dma_addr);
 	txdp->cmd_type_offset_bsz =
 		ice_build_ctob((uint32_t)ICE_TD_CMD, 0,
drivers/net/intel/ice/ice_rxtx.c +4 -4
 			       (*pkts)->data_len, 0);
@@ -3594,7 +3594,7 @@ static inline void
 ice_tx_fill_hw_ring(struct ci_tx_queue *txq, struct rte_mbuf **pkts,
 		    uint16_t nb_pkts)
 {
-	volatile struct ice_tx_desc *txdp = &txq->ice_tx_ring[txq->tx_tail];
+	volatile struct ci_tx_desc *txdp = &txq->ice_tx_ring[txq->tx_tail];
 	struct ci_tx_entry *txep = &txq->sw_ring[txq->tx_tail];
 	const int N_PER_LOOP = 4;
 	const int N_PER_LOOP_MASK = N_PER_LOOP - 1;
@@ -3627,7 +3627,7 @@ tx_xmit_pkts(struct ci_tx_queue *txq,
 	     struct rte_mbuf **tx_pkts,
 	     uint16_t nb_pkts)
 {
-	volatile struct ice_tx_desc *txr = txq->ice_tx_ring;
+	volatile struct ci_tx_desc *txr = txq->ice_tx_ring;
 	uint16_t n = 0;
 
 	/**
@@ -4882,7 +4882,7 @@ ice_fdir_programming(struct ice_pf *pf, struct
 ice_fltr_desc *fdir_desc)
 	struct ci_tx_queue *txq = pf->fdir.txq;
 	struct ci_rx_queue *rxq = pf->fdir.rxq;
 	volatile struct ice_fltr_desc *fdirdp;
-	volatile struct ice_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	uint32_t td_cmd;
 	uint16_t i;
@@ -4892,7 +4892,7 @@ ice_fdir_programming(struct ice_pf *pf, struct
 ice_fltr_desc *fdir_desc)
 	fdirdp->dtype_cmd_vsi_fdid = fdir_desc->dtype_cmd_vsi_fdid;
 
 	txdp = &txq->ice_tx_ring[txq->tx_tail + 1];
-	txdp->buf_addr = rte_cpu_to_le_64(pf->fdir.dma_addr);
+	txdp->buffer_addr = rte_cpu_to_le_64(pf->fdir.dma_addr);
 	td_cmd = ICE_TX_DESC_CMD_EOP |
 		ICE_TX_DESC_CMD_RS  |
drivers/net/intel/ice/ice_rxtx.c +0 -0
 		ICE_TX_DESC_CMD_DUMMY;
drivers/net/intel/ice/ice_rxtx_vec_avx2.c +1 -1
index 0ba1d557ca..bef7bb00ba 100644
@@ -774,7 +774,7 @@ ice_recv_scattered_pkts_vec_avx2_offload(void
 *rx_queue,
 }
 
 static __rte_always_inline void
-ice_vtx1(volatile struct ice_tx_desc *txdp,
+ice_vtx1(volatile struct ci_tx_desc *txdp,
 	 struct rte_mbuf *pkt, uint64_t flags, bool offload)
 {
drivers/net/intel/ice/ice_rxtx_vec_avx2.c +2 -2
 	uint64_t high_qw =
@@ -789,7 +789,7 @@ ice_vtx1(volatile struct ice_tx_desc *txdp,
 }
 
 static __rte_always_inline void
-ice_vtx(volatile struct ice_tx_desc *txdp,
+ice_vtx(volatile struct ci_tx_desc *txdp,
 	struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags, bool offload)
 {
 	const uint64_t hi_qw_tmpl = (ICE_TX_DESC_DTYPE_DATA |
@@ -852,7 +852,7 @@ ice_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 			      uint16_t nb_pkts, bool offload)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct ice_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
drivers/net/intel/ice/ice_rxtx_vec_avx2.c +0 -0
 	uint64_t flags = ICE_TD_CMD;
drivers/net/intel/ice/ice_rxtx_vec_avx512.c +1 -1
index 7c6fe82072..1f6bf5fc8e 100644
@@ -847,7 +847,7 @@ ice_recv_scattered_pkts_vec_avx512_offload(void
 *rx_queue,
 }
 
 static __rte_always_inline void
-ice_vtx1(volatile struct ice_tx_desc *txdp,
+ice_vtx1(volatile struct ci_tx_desc *txdp,
 	 struct rte_mbuf *pkt, uint64_t flags, bool do_offload)
 {
drivers/net/intel/ice/ice_rxtx_vec_avx512.c +2 -2
 	uint64_t high_qw =
@@ -863,7 +863,7 @@ ice_vtx1(volatile struct ice_tx_desc *txdp,
 }
 
 static __rte_always_inline void
-ice_vtx(volatile struct ice_tx_desc *txdp, struct rte_mbuf **pkt,
+ice_vtx(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkt,
 	uint16_t nb_pkts,  uint64_t flags, bool do_offload)
 {
 	const uint64_t hi_qw_tmpl = (ICE_TX_DESC_DTYPE_DATA |
@@ -916,7 +916,7 @@ ice_xmit_fixed_burst_vec_avx512(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 				uint16_t nb_pkts, bool do_offload)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct ice_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
drivers/net/intel/ice/ice_rxtx_vec_avx512.c +0 -0
 	uint64_t flags = ICE_TD_CMD;
drivers/net/intel/idpf/idpf_common_rxtx.c +2 -2
index 797ee515dd..be3c1ef216 100644
@@ -264,13 +264,13 @@ idpf_qc_single_tx_queue_reset(struct ci_tx_queue
 *txq)
 	}
 
 	txe = txq->sw_ring;
-	size = sizeof(struct idpf_base_tx_desc) * txq->nb_tx_desc;
+	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
 		((volatile char *)txq->idpf_tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		txq->idpf_tx_ring[i].qw1 =
+		txq->idpf_tx_ring[i].cmd_type_offset_bsz =
 
 	rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE);
drivers/net/intel/idpf/idpf_common_rxtx.c +2 -2
 		txe[i].mbuf =  NULL;
 		txe[i].last_id = i;
@@ -1335,14 +1335,14 @@ idpf_xmit_cleanup(struct ci_tx_queue *txq)
 	uint16_t desc_to_clean_to;
 	uint16_t nb_tx_to_clean;
 
-	volatile struct idpf_base_tx_desc *txd = txq->idpf_tx_ring;
+	volatile struct ci_tx_desc *txd = txq->idpf_tx_ring;
 
 	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
 	if (desc_to_clean_to >= nb_tx_desc)
 		desc_to_clean_to = (uint16_t)(desc_to_clean_to -
 nb_tx_desc);
 
 	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
-	if ((txd[desc_to_clean_to].qw1 &
+	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &
 	     rte_cpu_to_le_64(IDPF_TXD_QW1_DTYPE_M)) !=
 	    rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE)) {
drivers/net/intel/idpf/idpf_common_rxtx.c +3 -5
 		TX_LOG(DEBUG, "TX descriptor %4u is not done "
@@ -1358,7 +1358,7 @@ idpf_xmit_cleanup(struct ci_tx_queue *txq)
 		nb_tx_to_clean = (uint16_t)(desc_to_clean_to -
 					    last_desc_cleaned);
 
-	txd[desc_to_clean_to].qw1 = 0;
+	txd[desc_to_clean_to].cmd_type_offset_bsz = 0;
 
 	txq->last_desc_cleaned = desc_to_clean_to;
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + nb_tx_to_clean);
@@ -1372,8 +1372,8 @@ uint16_t
 idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			  uint16_t nb_pkts)
 {
-	volatile struct idpf_base_tx_desc *txd;
-	volatile struct idpf_base_tx_desc *txr;
+	volatile struct ci_tx_desc *txd;
+	volatile struct ci_tx_desc *txr;
 	union idpf_tx_offload tx_offload = {0};
 	struct ci_tx_entry *txe, *txn;
 	struct ci_tx_entry *sw_ring;
@@ -1491,8 +1491,8 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct
 rte_mbuf **tx_pkts,
 			/* Setup TX Descriptor */
 			slen = m_seg->data_len;
 			buf_dma_addr = rte_mbuf_data_iova(m_seg);
-			txd->buf_addr = rte_cpu_to_le_64(buf_dma_addr);
-			txd->qw1 =

rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DATA |

drivers/net/intel/idpf/idpf_common_rxtx.c +2 -0
+			txd->buffer_addr = rte_cpu_to_le_64(buf_dma_addr);
+			txd->cmd_type_offset_bsz =

rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DATA |
((uint64_t)td_cmd <<
IDPF_TXD_QW1_CMD_S) |
((uint64_t)td_offset <<
IDPF_TXD_QW1_OFFSET_S) |
((uint64_t)slen <<
IDPF_TXD_QW1_TX_BUF_SZ_S));

drivers/net/intel/idpf/idpf_common_rxtx.c +1 -1
@@ -1519,7 +1519,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct
 rte_mbuf **tx_pkts,
 			txq->nb_tx_used = 0;
 		}
 
-		txd->qw1 |= rte_cpu_to_le_16(td_cmd <<
 IDPF_TXD_QW1_CMD_S);
+		txd->cmd_type_offset_bsz |= rte_cpu_to_le_16(td_cmd <<
 IDPF_TXD_QW1_CMD_S);
drivers/net/intel/idpf/idpf_common_rxtx.c +0 -0
 	}
 
 end_of_tx:
drivers/net/intel/idpf/idpf_common_rxtx.h +1 -1
index 7c6ff5d047..2f2fa153b2 100644
@@ -182,7 +182,7 @@ union idpf_tx_offload {
 };
 
 union idpf_tx_desc {
-	struct idpf_base_tx_desc *tx_ring;
+	struct ci_tx_desc *tx_ring;
 	struct idpf_flex_tx_sched_desc *desc_ring;
 	struct idpf_splitq_tx_compl_desc *compl_ring;
 };
drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +0 -0
index 21c8f79254..5f5d538dcb 100644
@@ -483,7 +483,7 @@ idpf_dp_singleq_recv_pkts_avx2(void *rx_queue,

struct rte_mbuf **rx_pkts, uint16
}

static inline void

drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +2 -2
-idpf_singleq_vtx1(volatile struct idpf_base_tx_desc *txdp,
+idpf_singleq_vtx1(volatile struct ci_tx_desc *txdp,
 		  struct rte_mbuf *pkt, uint64_t flags)
 {
 	uint64_t high_qw =
@@ -497,7 +497,7 @@ idpf_singleq_vtx1(volatile struct idpf_base_tx_desc
 *txdp,
 }
 
 static inline void
-idpf_singleq_vtx(volatile struct idpf_base_tx_desc *txdp,
+idpf_singleq_vtx(volatile struct ci_tx_desc *txdp,
 		 struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +1 -1
 	const uint64_t hi_qw_tmpl = (IDPF_TX_DESC_DTYPE_DATA |
@@ -556,7 +556,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx2(void
 *tx_queue, struct rte_mbuf **tx_pkts
 				       uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;
-	volatile struct idpf_base_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +1 -1
 	uint64_t flags = IDPF_TX_DESC_CMD_EOP;
@@ -604,7 +604,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx2(void
 *tx_queue, struct rte_mbuf **tx_pkts
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->idpf_tx_ring[txq->tx_next_rs].qw1 |=
+		txq->idpf_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 
 	rte_cpu_to_le_64(((uint64_t)IDPF_TX_DESC_CMD_RS) <<
drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +0 -0
 					 IDPF_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +1 -1
index bc2cadd738..c1ec3d1222 100644
@@ -1000,7 +1000,7 @@ idpf_dp_splitq_recv_pkts_avx512(void *rx_queue,
 struct rte_mbuf **rx_pkts,
 }
 
 static __rte_always_inline void
-idpf_singleq_vtx1(volatile struct idpf_base_tx_desc *txdp,
+idpf_singleq_vtx1(volatile struct ci_tx_desc *txdp,
 	  struct rte_mbuf *pkt, uint64_t flags)
 {
drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +1 -1
 	uint64_t high_qw =
@@ -1016,7 +1016,7 @@ idpf_singleq_vtx1(volatile struct idpf_base_tx_desc
 *txdp,
 #define IDPF_TX_LEN_MASK 0xAA
 #define IDPF_TX_OFF_MASK 0x55
 static __rte_always_inline void
-idpf_singleq_vtx(volatile struct idpf_base_tx_desc *txdp,
+idpf_singleq_vtx(volatile struct ci_tx_desc *txdp,
 	 struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +1 -1
 	const uint64_t hi_qw_tmpl = (IDPF_TX_DESC_DTYPE_DATA  |
@@ -1072,7 +1072,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void
 *tx_queue, struct rte_mbuf **tx_pk
 					 uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = tx_queue;
-	volatile struct idpf_base_tx_desc *txdp;
+	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +1 -1
 	uint64_t flags = IDPF_TX_DESC_CMD_EOP;
@@ -1123,7 +1123,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void
 *tx_queue, struct rte_mbuf **tx_pk
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->idpf_tx_ring[txq->tx_next_rs].qw1 |=
+		txq->idpf_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 
 	rte_cpu_to_le_64(((uint64_t)IDPF_TX_DESC_CMD_RS) <<
drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +0 -0
 					 IDPF_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
drivers/net/intel/idpf/idpf_rxtx.c +1 -1
index cee454244f..8aa44585fe 100644
@@ -72,7 +72,7 @@ idpf_dma_zone_reserve(struct rte_eth_dev *dev,
 uint16_t queue_idx,
 			ring_size = RTE_ALIGN(len * sizeof(struct
 idpf_flex_tx_sched_desc),
 					      IDPF_DMA_MEM_ALIGN);
 		else
-			ring_size = RTE_ALIGN(len * sizeof(struct
 idpf_base_tx_desc),
+			ring_size = RTE_ALIGN(len * sizeof(struct ci_tx_desc),
drivers/net/intel/idpf/idpf_rxtx.c +0 -0
 					      IDPF_DMA_MEM_ALIGN);
 		rte_memcpy(ring_name, "idpf Tx ring", sizeof("idpf Tx ring"));
 		break;
drivers/net/intel/idpf/idpf_rxtx_vec_common.h +1 -1
index 425f0792a1..4702061484 100644
@@ -31,7 +31,7 @@ idpf_tx_desc_done(struct ci_tx_queue *txq, uint16_t
 idx)
 	if (txq->complq != NULL)
 		return 1;
 
-	return (txq->idpf_tx_ring[idx].qw1 &
+	return (txq->idpf_tx_ring[idx].cmd_type_offset_bsz &
 			rte_cpu_to_le_64(IDPF_TXD_QW1_DTYPE_M)) ==
 
	rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE);

}
--
2.51.0

#74 lore raw

PATCH v3 2/36 net/intel: use common Tx ring structure

In reply to Bruce Richardson

Rather than having separate per-driver ring pointers in a union, since we now have a common descriptor type, we can merge all but the ixgbe pointer into one value.

---
 drivers/net/intel/common/tx.h                 |  5 +--
 drivers/net/intel/cpfl/cpfl_rxtx.c            |  2 +-
 drivers/net/intel/i40e/i40e_fdir.c            |  6 ++--
 drivers/net/intel/i40e/i40e_rxtx.c            | 22 ++++++------
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |  6 ++--
 drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c   |  6 ++--
 drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c |  6 ++--
 drivers/net/intel/i40e/i40e_rxtx_vec_common.h |  2 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |  6 ++--
 drivers/net/intel/iavf/iavf_rxtx.c            | 14 ++++----
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   |  6 ++--
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 12 +++----
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h |  2 +-
 drivers/net/intel/ice/ice_dcf_ethdev.c        |  4 +--
 drivers/net/intel/ice/ice_rxtx.c              | 34 +++++++++----------
 drivers/net/intel/ice/ice_rxtx_vec_avx2.c     |  6 ++--
 drivers/net/intel/ice/ice_rxtx_vec_avx512.c   |  6 ++--
 drivers/net/intel/ice/ice_rxtx_vec_common.h   |  2 +-
 drivers/net/intel/idpf/idpf_common_rxtx.c     |  8 ++---
 .../net/intel/idpf/idpf_common_rxtx_avx2.c    |  6 ++--
 .../net/intel/idpf/idpf_common_rxtx_avx512.c  |  6 ++--
 drivers/net/intel/idpf/idpf_rxtx.c            |  2 +-
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |  2 +-
 23 files changed, 84 insertions(+), 87 deletions(-)
drivers/net/intel/common/tx.h +1 -4
index d7561a2bbb..8cf63e59ab 100644
@@ -41,10 +41,7 @@ typedef void (*ice_tx_release_mbufs_t)(struct ci_tx_queue *txq);
 
 struct ci_tx_queue {
 	union { /* TX ring virtual address */
-		volatile struct ci_tx_desc *i40e_tx_ring;
-		volatile struct ci_tx_desc *iavf_tx_ring;
-		volatile struct ci_tx_desc *ice_tx_ring;
-		volatile struct ci_tx_desc *idpf_tx_ring;
+		volatile struct ci_tx_desc *ci_tx_ring;
 		volatile union ixgbe_adv_tx_desc *ixgbe_tx_ring;
 	};
 	volatile uint8_t *qtx_tail;               /* register address of tail */
drivers/net/intel/cpfl/cpfl_rxtx.c +1 -1
index 78bc3e9b49..bc5bec65f0 100644
@@ -606,7 +606,7 @@ cpfl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	}
 
 	if (!is_splitq) {
-		txq->idpf_tx_ring = mz->addr;
+		txq->ci_tx_ring = mz->addr;
 		idpf_qc_single_tx_queue_reset(txq);
 	} else {
 		txq->desc_ring = mz->addr;
drivers/net/intel/i40e/i40e_fdir.c +3 -3
index 605df73c9e..8a01aec0e2 100644
@@ -1380,7 +1380,7 @@ i40e_find_available_buffer(struct rte_eth_dev *dev)
 		volatile struct ci_tx_desc *tmp_txdp;
 
 		tmp_tail = txq->tx_tail;
-		tmp_txdp = &txq->i40e_tx_ring[tmp_tail + 1];
+		tmp_txdp = &txq->ci_tx_ring[tmp_tail + 1];
 
 		do {
 			if ((tmp_txdp->cmd_type_offset_bsz &
@@ -1637,7 +1637,7 @@ i40e_flow_fdir_filter_programming(struct i40e_pf *pf,
 
 	PMD_DRV_LOG(INFO, "filling filter programming descriptor.");
 	fdirdp = (volatile struct i40e_filter_program_desc *)
-				(&txq->i40e_tx_ring[txq->tx_tail]);
+				(&txq->ci_tx_ring[txq->tx_tail]);
 
 	fdirdp->qindex_flex_ptype_vsi =
 			rte_cpu_to_le_32((fdir_action->rx_queue <<
@@ -1707,7 +1707,7 @@ i40e_flow_fdir_filter_programming(struct i40e_pf *pf,
 	fdirdp->fd_id = rte_cpu_to_le_32(filter->soft_id);
 
 	PMD_DRV_LOG(INFO, "filling transmit descriptor.");
-	txdp = &txq->i40e_tx_ring[txq->tx_tail + 1];
+	txdp = &txq->ci_tx_ring[txq->tx_tail + 1];
 	txdp->buffer_addr = rte_cpu_to_le_64(pf->fdir.dma_addr[txq->tx_tail >> 1]);
 
 	td_cmd = I40E_TX_DESC_CMD_EOP |
drivers/net/intel/i40e/i40e_rxtx.c +11 -11
index 92d49ccb79..210fc0201e 100644
@@ -388,7 +388,7 @@ static inline int
 i40e_xmit_cleanup(struct ci_tx_queue *txq)
 {
 	struct ci_tx_entry *sw_ring = txq->sw_ring;
-	volatile struct ci_tx_desc *txd = txq->i40e_tx_ring;
+	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
 	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
 	uint16_t nb_tx_desc = txq->nb_tx_desc;
 	uint16_t desc_to_clean_to;
@@ -1112,7 +1112,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 	txq = tx_queue;
 	sw_ring = txq->sw_ring;
-	txr = txq->i40e_tx_ring;
+	txr = txq->ci_tx_ring;
 	tx_id = txq->tx_tail;
 	txe = &sw_ring[tx_id];
 
@@ -1347,7 +1347,7 @@ i40e_tx_free_bufs(struct ci_tx_queue *txq)
 	const uint16_t k = RTE_ALIGN_FLOOR(tx_rs_thresh, I40E_TX_MAX_FREE_BUF_SZ);
 	const uint16_t m = tx_rs_thresh % I40E_TX_MAX_FREE_BUF_SZ;
 
-	if ((txq->i40e_tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
+	if ((txq->ci_tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
 			rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=
 			rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
 		return 0;
@@ -1431,7 +1431,7 @@ i40e_tx_fill_hw_ring(struct ci_tx_queue *txq,
 		     struct rte_mbuf **pkts,
 		     uint16_t nb_pkts)
 {
-	volatile struct ci_tx_desc *txdp = &txq->i40e_tx_ring[txq->tx_tail];
+	volatile struct ci_tx_desc *txdp = &txq->ci_tx_ring[txq->tx_tail];
 	struct ci_tx_entry *txep = &txq->sw_ring[txq->tx_tail];
 	const int N_PER_LOOP = 4;
 	const int N_PER_LOOP_MASK = N_PER_LOOP - 1;
@@ -1459,7 +1459,7 @@ tx_xmit_pkts(struct ci_tx_queue *txq,
 	     struct rte_mbuf **tx_pkts,
 	     uint16_t nb_pkts)
 {
-	volatile struct ci_tx_desc *txr = txq->i40e_tx_ring;
+	volatile struct ci_tx_desc *txr = txq->ci_tx_ring;
 	uint16_t n = 0;
 
 	/**
@@ -2421,7 +2421,7 @@ i40e_dev_tx_descriptor_status(void *tx_queue, uint16_t offset)
 			desc -= txq->nb_tx_desc;
 	}
 
-	status = &txq->i40e_tx_ring[desc].cmd_type_offset_bsz;
+	status = &txq->ci_tx_ring[desc].cmd_type_offset_bsz;
 	mask = rte_le_to_cpu_64(I40E_TXD_QW1_DTYPE_MASK);
 	expect = rte_cpu_to_le_64(
 		I40E_TX_DESC_DTYPE_DESC_DONE << I40E_TXD_QW1_DTYPE_SHIFT);
@@ -2618,7 +2618,7 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	/* Allocate TX hardware ring descriptors. */
 	ring_size = sizeof(struct ci_tx_desc) * I40E_MAX_RING_DESC;
 	ring_size = RTE_ALIGN(ring_size, I40E_DMA_MEM_ALIGN);
-	tz = rte_eth_dma_zone_reserve(dev, "i40e_tx_ring", queue_idx,
+	tz = rte_eth_dma_zone_reserve(dev, "ci_tx_ring", queue_idx,
 			      ring_size, I40E_RING_BASE_ALIGN, socket_id);
 	if (!tz) {
 		i40e_tx_queue_release(txq);
@@ -2640,7 +2640,7 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	txq->tx_deferred_start = tx_conf->tx_deferred_start;
 
 	txq->tx_ring_dma = tz->iova;
-	txq->i40e_tx_ring = (struct ci_tx_desc *)tz->addr;
+	txq->ci_tx_ring = (struct ci_tx_desc *)tz->addr;
 
 	/* Allocate software ring */
 	txq->sw_ring =
@@ -2915,11 +2915,11 @@ i40e_reset_tx_queue(struct ci_tx_queue *txq)
 	txe = txq->sw_ring;
 	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
-		((volatile char *)txq->i40e_tx_ring)[i] = 0;
+		((volatile char *)txq->ci_tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		volatile struct ci_tx_desc *txd = &txq->i40e_tx_ring[i];
+		volatile struct ci_tx_desc *txd = &txq->ci_tx_ring[i];
 
 		txd->cmd_type_offset_bsz =
 			rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE);
@@ -3240,7 +3240,7 @@ i40e_fdir_setup_tx_resources(struct i40e_pf *pf)
 	txq->i40e_vsi = pf->fdir.fdir_vsi;
 
 	txq->tx_ring_dma = tz->iova;
-	txq->i40e_tx_ring = (struct ci_tx_desc *)tz->addr;
+	txq->ci_tx_ring = (struct ci_tx_desc *)tz->addr;
 
 	/*
 	 * don't need to allocate software ring and reset for the fdir
drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +3 -3
index ef5b252898..81e9e2bc0b 100644
@@ -489,7 +489,7 @@ i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 		return 0;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->i40e_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = &txq->sw_ring_vec[tx_id];
 
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);
@@ -509,7 +509,7 @@ i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = &txq->i40e_tx_ring[tx_id];
+		txdp = &txq->ci_tx_ring[tx_id];
 		txep = &txq->sw_ring_vec[tx_id];
 	}
 
@@ -519,7 +519,7 @@ i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->i40e_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
 						I40E_TXD_QW1_CMD_SHIFT);
 		txq->tx_next_rs =
drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +3 -3
index 137c1f9765..f054bd41bf 100644
@@ -753,7 +753,7 @@ i40e_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 		return 0;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->i40e_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = &txq->sw_ring_vec[tx_id];
 
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);
@@ -774,7 +774,7 @@ i40e_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = &txq->i40e_tx_ring[tx_id];
+		txdp = &txq->ci_tx_ring[tx_id];
 		txep = &txq->sw_ring_vec[tx_id];
 	}
 
@@ -784,7 +784,7 @@ i40e_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->i40e_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
 						I40E_TXD_QW1_CMD_SHIFT);
 		txq->tx_next_rs =
drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c +3 -3
index 6971488750..9a967faeee 100644
@@ -821,7 +821,7 @@ i40e_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 		return 0;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->i40e_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = (void *)txq->sw_ring;
 	txep += tx_id;
 
@@ -843,7 +843,7 @@ i40e_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = txq->i40e_tx_ring;
+		txdp = txq->ci_tx_ring;
 		txep = (void *)txq->sw_ring;
 	}
 
@@ -853,7 +853,7 @@ i40e_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->i40e_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
 						I40E_TXD_QW1_CMD_SHIFT);
 		txq->tx_next_rs =
drivers/net/intel/i40e/i40e_rxtx_vec_common.h +1 -1
index 14651f2f06..1fd7fc75bf 100644
@@ -15,7 +15,7 @@
 static inline int
 i40e_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
 {
-	return (txq->i40e_tx_ring[idx].cmd_type_offset_bsz &
+	return (txq->ci_tx_ring[idx].cmd_type_offset_bsz &
 			rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
 				rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE);
 }
drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +3 -3
index 6404b70c56..0b95152232 100644
@@ -638,7 +638,7 @@ i40e_xmit_fixed_burst_vec(void *__rte_restrict tx_queue,
 		return 0;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->i40e_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = &txq->sw_ring_vec[tx_id];
 
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);
@@ -658,7 +658,7 @@ i40e_xmit_fixed_burst_vec(void *__rte_restrict tx_queue,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = &txq->i40e_tx_ring[tx_id];
+		txdp = &txq->ci_tx_ring[tx_id];
 		txep = &txq->sw_ring_vec[tx_id];
 	}
 
@@ -668,7 +668,7 @@ i40e_xmit_fixed_burst_vec(void *__rte_restrict tx_queue,
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->i40e_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
 						I40E_TXD_QW1_CMD_SHIFT);
 		txq->tx_next_rs =
drivers/net/intel/iavf/iavf_rxtx.c +7 -7
index e4421a9932..807bc92a45 100644
@@ -269,11 +269,11 @@ reset_tx_queue(struct ci_tx_queue *txq)
 	txe = txq->sw_ring;
 	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
-		((volatile char *)txq->iavf_tx_ring)[i] = 0;
+		((volatile char *)txq->ci_tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		txq->iavf_tx_ring[i].cmd_type_offset_bsz =
+		txq->ci_tx_ring[i].cmd_type_offset_bsz =
 			rte_cpu_to_le_64(IAVF_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
 		txe[i].last_id = i;
@@ -829,7 +829,7 @@ iavf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	/* Allocate TX hardware ring descriptors. */
 	ring_size = sizeof(struct ci_tx_desc) * IAVF_MAX_RING_DESC;
 	ring_size = RTE_ALIGN(ring_size, IAVF_DMA_MEM_ALIGN);
-	mz = rte_eth_dma_zone_reserve(dev, "iavf_tx_ring", queue_idx,
+	mz = rte_eth_dma_zone_reserve(dev, "ci_tx_ring", queue_idx,
 				      ring_size, IAVF_RING_BASE_ALIGN,
 				      socket_id);
 	if (!mz) {
@@ -839,7 +839,7 @@ iavf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 	txq->tx_ring_dma = mz->iova;
-	txq->iavf_tx_ring = (struct ci_tx_desc *)mz->addr;
+	txq->ci_tx_ring = (struct ci_tx_desc *)mz->addr;
 
 	txq->mz = mz;
 	reset_tx_queue(txq);
@@ -2333,7 +2333,7 @@ iavf_xmit_cleanup(struct ci_tx_queue *txq)
 	uint16_t desc_to_clean_to;
 	uint16_t nb_tx_to_clean;
 
-	volatile struct ci_tx_desc *txd = txq->iavf_tx_ring;
+	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
 
 	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
 	if (desc_to_clean_to >= nb_tx_desc)
@@ -2756,7 +2756,7 @@ uint16_t
 iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = tx_queue;
-	volatile struct ci_tx_desc *txr = txq->iavf_tx_ring;
+	volatile struct ci_tx_desc *txr = txq->ci_tx_ring;
 	struct ci_tx_entry *txe_ring = txq->sw_ring;
 	struct ci_tx_entry *txe, *txn;
 	struct rte_mbuf *mb, *mb_seg;
@@ -4462,7 +4462,7 @@ iavf_dev_tx_desc_status(void *tx_queue, uint16_t offset)
 			desc -= txq->nb_tx_desc;
 	}
 
-	status = &txq->iavf_tx_ring[desc].cmd_type_offset_bsz;
+	status = &txq->ci_tx_ring[desc].cmd_type_offset_bsz;
 	mask = rte_le_to_cpu_64(IAVF_TXD_QW1_DTYPE_MASK);
 	expect = rte_cpu_to_le_64(
 		 IAVF_TX_DESC_DTYPE_DESC_DONE << IAVF_TXD_QW1_DTYPE_SHIFT);
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +3 -3
index 5b62d51cf7..89ce841b9e 100644
@@ -1729,7 +1729,7 @@ iavf_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 	nb_commit = nb_pkts;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->iavf_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = &txq->sw_ring_vec[tx_id];
 
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);
@@ -1750,7 +1750,7 @@ iavf_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = &txq->iavf_tx_ring[tx_id];
+		txdp = &txq->ci_tx_ring[tx_id];
 		txep = &txq->sw_ring_vec[tx_id];
 	}
 
@@ -1760,7 +1760,7 @@ iavf_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->iavf_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)IAVF_TX_DESC_CMD_RS) <<
 					 IAVF_TXD_QW1_CMD_SHIFT);
 		txq->tx_next_rs =
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +6 -6
index d79d96c7b7..ad1b0b90cd 100644
@@ -2219,7 +2219,7 @@ iavf_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 	nb_commit = nb_pkts;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->iavf_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = (void *)txq->sw_ring;
 	txep += tx_id;
 
@@ -2241,7 +2241,7 @@ iavf_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = &txq->iavf_tx_ring[tx_id];
+		txdp = &txq->ci_tx_ring[tx_id];
 		txep = (void *)txq->sw_ring;
 		txep += tx_id;
 	}
@@ -2252,7 +2252,7 @@ iavf_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->iavf_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)IAVF_TX_DESC_CMD_RS) <<
 					 IAVF_TXD_QW1_CMD_SHIFT);
 		txq->tx_next_rs =
@@ -2288,7 +2288,7 @@ iavf_xmit_fixed_burst_vec_avx512_ctx(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	nb_pkts = nb_commit >> 1;
 	tx_id = txq->tx_tail;
-	txdp = &txq->iavf_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = (void *)txq->sw_ring;
 	txep += (tx_id >> 1);
 
@@ -2309,7 +2309,7 @@ iavf_xmit_fixed_burst_vec_avx512_ctx(void *tx_queue, struct rte_mbuf **tx_pkts,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 		tx_id = 0;
 		/* avoid reach the end of ring */
-		txdp = txq->iavf_tx_ring;
+		txdp = txq->ci_tx_ring;
 		txep = (void *)txq->sw_ring;
 	}
 
@@ -2320,7 +2320,7 @@ iavf_xmit_fixed_burst_vec_avx512_ctx(void *tx_queue, struct rte_mbuf **tx_pkts,
 	tx_id = (uint16_t)(tx_id + nb_commit);
 
 	if (tx_id > txq->tx_next_rs) {
-		txq->iavf_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)IAVF_TX_DESC_CMD_RS) <<
 					 IAVF_TXD_QW1_CMD_SHIFT);
 		txq->tx_next_rs =
drivers/net/intel/iavf/iavf_rxtx_vec_common.h +1 -1
index f1ea57034f..1832b76f89 100644
@@ -14,7 +14,7 @@
 static inline int
 iavf_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
 {
-	return (txq->iavf_tx_ring[idx].cmd_type_offset_bsz &
+	return (txq->ci_tx_ring[idx].cmd_type_offset_bsz &
 			rte_cpu_to_le_64(IAVF_TXD_QW1_DTYPE_MASK)) ==
 				rte_cpu_to_le_64(IAVF_TX_DESC_DTYPE_DESC_DONE);
 }
drivers/net/intel/ice/ice_dcf_ethdev.c +2 -2
index ab1d499cef..5f537b4c12 100644
@@ -401,11 +401,11 @@ reset_tx_queue(struct ci_tx_queue *txq)
 	txe = txq->sw_ring;
 	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
-		((volatile char *)txq->ice_tx_ring)[i] = 0;
+		((volatile char *)txq->ci_tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		txq->ice_tx_ring[i].cmd_type_offset_bsz =
+		txq->ci_tx_ring[i].cmd_type_offset_bsz =
 			rte_cpu_to_le_64(IAVF_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
 		txe[i].last_id = i;
drivers/net/intel/ice/ice_rxtx.c +17 -17
index 74b80e7df3..e3ffbdb587 100644
@@ -1117,11 +1117,11 @@ ice_reset_tx_queue(struct ci_tx_queue *txq)
 	txe = txq->sw_ring;
 	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
-		((volatile char *)txq->ice_tx_ring)[i] = 0;
+		((volatile char *)txq->ci_tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		volatile struct ci_tx_desc *txd = &txq->ice_tx_ring[i];
+		volatile struct ci_tx_desc *txd = &txq->ci_tx_ring[i];
 
 		txd->cmd_type_offset_bsz =
 			rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE);
@@ -1625,7 +1625,7 @@ ice_tx_queue_setup(struct rte_eth_dev *dev,
 	/* Allocate TX hardware ring descriptors. */
 	ring_size = sizeof(struct ci_tx_desc) * ICE_MAX_NUM_DESC_BY_MAC(hw);
 	ring_size = RTE_ALIGN(ring_size, ICE_DMA_MEM_ALIGN);
-	tz = rte_eth_dma_zone_reserve(dev, "ice_tx_ring", queue_idx,
+	tz = rte_eth_dma_zone_reserve(dev, "ci_tx_ring", queue_idx,
 				      ring_size, ICE_RING_BASE_ALIGN,
 				      socket_id);
 	if (!tz) {
@@ -1649,7 +1649,7 @@ ice_tx_queue_setup(struct rte_eth_dev *dev,
 	txq->tx_deferred_start = tx_conf->tx_deferred_start;
 
 	txq->tx_ring_dma = tz->iova;
-	txq->ice_tx_ring = tz->addr;
+	txq->ci_tx_ring = tz->addr;
 
 	/* Allocate software ring */
 	txq->sw_ring =
@@ -2555,7 +2555,7 @@ ice_tx_descriptor_status(void *tx_queue, uint16_t offset)
 			desc -= txq->nb_tx_desc;
 	}
 
-	status = &txq->ice_tx_ring[desc].cmd_type_offset_bsz;
+	status = &txq->ci_tx_ring[desc].cmd_type_offset_bsz;
 	mask = rte_cpu_to_le_64(ICE_TXD_QW1_DTYPE_M);
 	expect = rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE <<
 				  ICE_TXD_QW1_DTYPE_S);
@@ -2638,7 +2638,7 @@ ice_fdir_setup_tx_resources(struct ice_pf *pf)
 	txq->ice_vsi = pf->fdir.fdir_vsi;
 
 	txq->tx_ring_dma = tz->iova;
-	txq->ice_tx_ring = (struct ci_tx_desc *)tz->addr;
+	txq->ci_tx_ring = (struct ci_tx_desc *)tz->addr;
 	/*
 	 * don't need to allocate software ring and reset for the fdir
 	 * program queue just set the queue has been configured.
@@ -3027,7 +3027,7 @@ static inline int
 ice_xmit_cleanup(struct ci_tx_queue *txq)
 {
 	struct ci_tx_entry *sw_ring = txq->sw_ring;
-	volatile struct ci_tx_desc *txd = txq->ice_tx_ring;
+	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
 	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
 	uint16_t nb_tx_desc = txq->nb_tx_desc;
 	uint16_t desc_to_clean_to;
@@ -3148,7 +3148,7 @@ uint16_t
 ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq;
-	volatile struct ci_tx_desc *ice_tx_ring;
+	volatile struct ci_tx_desc *ci_tx_ring;
 	volatile struct ci_tx_desc *txd;
 	struct ci_tx_entry *sw_ring;
 	struct ci_tx_entry *txe, *txn;
@@ -3171,7 +3171,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 	txq = tx_queue;
 	sw_ring = txq->sw_ring;
-	ice_tx_ring = txq->ice_tx_ring;
+	ci_tx_ring = txq->ci_tx_ring;
 	tx_id = txq->tx_tail;
 	txe = &sw_ring[tx_id];
 
@@ -3257,7 +3257,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 			/* Setup TX context descriptor if required */
 			volatile struct ice_tx_ctx_desc *ctx_txd =
 				(volatile struct ice_tx_ctx_desc *)
-					&ice_tx_ring[tx_id];
+					&ci_tx_ring[tx_id];
 			uint16_t cd_l2tag2 = 0;
 			uint64_t cd_type_cmd_tso_mss = ICE_TX_DESC_DTYPE_CTX;
 
@@ -3299,7 +3299,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		m_seg = tx_pkt;
 
 		do {
-			txd = &ice_tx_ring[tx_id];
+			txd = &ci_tx_ring[tx_id];
 			txn = &sw_ring[txe->next_id];
 
 			if (txe->mbuf)
@@ -3327,7 +3327,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 				txe->last_id = tx_last;
 				tx_id = txe->next_id;
 				txe = txn;
-				txd = &ice_tx_ring[tx_id];
+				txd = &ci_tx_ring[tx_id];
 				txn = &sw_ring[txe->next_id];
 			}
 
@@ -3410,7 +3410,7 @@ ice_tx_free_bufs(struct ci_tx_queue *txq)
 	struct ci_tx_entry *txep;
 	uint16_t i;
 
-	if ((txq->ice_tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
+	if ((txq->ci_tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
 	     rte_cpu_to_le_64(ICE_TXD_QW1_DTYPE_M)) !=
 	    rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE))
 		return 0;
@@ -3594,7 +3594,7 @@ static inline void
 ice_tx_fill_hw_ring(struct ci_tx_queue *txq, struct rte_mbuf **pkts,
 		    uint16_t nb_pkts)
 {
-	volatile struct ci_tx_desc *txdp = &txq->ice_tx_ring[txq->tx_tail];
+	volatile struct ci_tx_desc *txdp = &txq->ci_tx_ring[txq->tx_tail];
 	struct ci_tx_entry *txep = &txq->sw_ring[txq->tx_tail];
 	const int N_PER_LOOP = 4;
 	const int N_PER_LOOP_MASK = N_PER_LOOP - 1;
@@ -3627,7 +3627,7 @@ tx_xmit_pkts(struct ci_tx_queue *txq,
 	     struct rte_mbuf **tx_pkts,
 	     uint16_t nb_pkts)
 {
-	volatile struct ci_tx_desc *txr = txq->ice_tx_ring;
+	volatile struct ci_tx_desc *txr = txq->ci_tx_ring;
 	uint16_t n = 0;
 
 	/**
@@ -4887,11 +4887,11 @@ ice_fdir_programming(struct ice_pf *pf, struct ice_fltr_desc *fdir_desc)
 	uint16_t i;
 
 	fdirdp = (volatile struct ice_fltr_desc *)
-		(&txq->ice_tx_ring[txq->tx_tail]);
+		(&txq->ci_tx_ring[txq->tx_tail]);
 	fdirdp->qidx_compq_space_stat = fdir_desc->qidx_compq_space_stat;
 	fdirdp->dtype_cmd_vsi_fdid = fdir_desc->dtype_cmd_vsi_fdid;
 
-	txdp = &txq->ice_tx_ring[txq->tx_tail + 1];
+	txdp = &txq->ci_tx_ring[txq->tx_tail + 1];
 	txdp->buffer_addr = rte_cpu_to_le_64(pf->fdir.dma_addr);
 	td_cmd = ICE_TX_DESC_CMD_EOP |
 		ICE_TX_DESC_CMD_RS  |
drivers/net/intel/ice/ice_rxtx_vec_avx2.c +3 -3
index bef7bb00ba..0a1df0b2f6 100644
@@ -869,7 +869,7 @@ ice_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 		return 0;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->ice_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = &txq->sw_ring_vec[tx_id];
 
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);
@@ -890,7 +890,7 @@ ice_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = &txq->ice_tx_ring[tx_id];
+		txdp = &txq->ci_tx_ring[tx_id];
 		txep = &txq->sw_ring_vec[tx_id];
 	}
 
@@ -900,7 +900,7 @@ ice_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->ice_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)ICE_TX_DESC_CMD_RS) <<
 					 ICE_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
drivers/net/intel/ice/ice_rxtx_vec_avx512.c +3 -3
index 1f6bf5fc8e..d42f41461f 100644
@@ -933,7 +933,7 @@ ice_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 		return 0;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->ice_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = (void *)txq->sw_ring;
 	txep += tx_id;
 
@@ -955,7 +955,7 @@ ice_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = txq->ice_tx_ring;
+		txdp = txq->ci_tx_ring;
 		txep = (void *)txq->sw_ring;
 	}
 
@@ -965,7 +965,7 @@ ice_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->ice_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)ICE_TX_DESC_CMD_RS) <<
 					 ICE_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
drivers/net/intel/ice/ice_rxtx_vec_common.h +1 -1
index ff46a8fb49..8ba591e403 100644
@@ -11,7 +11,7 @@
 static inline int
 ice_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
 {
-	return (txq->ice_tx_ring[idx].cmd_type_offset_bsz &
+	return (txq->ci_tx_ring[idx].cmd_type_offset_bsz &
 			rte_cpu_to_le_64(ICE_TXD_QW1_DTYPE_M)) ==
 				rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE);
 }
drivers/net/intel/idpf/idpf_common_rxtx.c +4 -4
index be3c1ef216..51074bda3a 100644
@@ -266,11 +266,11 @@ idpf_qc_single_tx_queue_reset(struct ci_tx_queue *txq)
 	txe = txq->sw_ring;
 	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
-		((volatile char *)txq->idpf_tx_ring)[i] = 0;
+		((volatile char *)txq->ci_tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		txq->idpf_tx_ring[i].cmd_type_offset_bsz =
+		txq->ci_tx_ring[i].cmd_type_offset_bsz =
 			rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
 		txe[i].last_id = i;
@@ -1335,7 +1335,7 @@ idpf_xmit_cleanup(struct ci_tx_queue *txq)
 	uint16_t desc_to_clean_to;
 	uint16_t nb_tx_to_clean;
 
-	volatile struct ci_tx_desc *txd = txq->idpf_tx_ring;
+	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
 
 	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
 	if (desc_to_clean_to >= nb_tx_desc)
@@ -1398,7 +1398,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		return nb_tx;
 
 	sw_ring = txq->sw_ring;
-	txr = txq->idpf_tx_ring;
+	txr = txq->ci_tx_ring;
 	tx_id = txq->tx_tail;
 	txe = &sw_ring[tx_id];
 
drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +3 -3
index 5f5d538dcb..04efee3722 100644
@@ -573,7 +573,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts
 		return 0;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->idpf_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = &txq->sw_ring_vec[tx_id];
 
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);
@@ -594,7 +594,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = &txq->idpf_tx_ring[tx_id];
+		txdp = &txq->ci_tx_ring[tx_id];
 		txep = &txq->sw_ring_vec[tx_id];
 	}
 
@@ -604,7 +604,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->idpf_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)IDPF_TX_DESC_CMD_RS) <<
 					 IDPF_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +3 -3
index c1ec3d1222..d5e5a2ca5f 100644
@@ -1090,7 +1090,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pk
 		return 0;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->idpf_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = (void *)txq->sw_ring;
 	txep += tx_id;
 
@@ -1112,7 +1112,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pk
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = &txq->idpf_tx_ring[tx_id];
+		txdp = &txq->ci_tx_ring[tx_id];
 		txep = (void *)txq->sw_ring;
 		txep += tx_id;
 	}
@@ -1123,7 +1123,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pk
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->idpf_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)IDPF_TX_DESC_CMD_RS) <<
 					 IDPF_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
drivers/net/intel/idpf/idpf_rxtx.c +1 -1
index 8aa44585fe..0de54d9305 100644
@@ -481,7 +481,7 @@ idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	}
 
 	if (!is_splitq) {
-		txq->idpf_tx_ring = mz->addr;
+		txq->ci_tx_ring = mz->addr;
 		idpf_qc_single_tx_queue_reset(txq);
 	} else {
 		txq->desc_ring = mz->addr;
drivers/net/intel/idpf/idpf_rxtx_vec_common.h +1 -1
index 4702061484..b5e8574667 100644
@@ -31,7 +31,7 @@ idpf_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
 	if (txq->complq != NULL)
 		return 1;
 
-	return (txq->idpf_tx_ring[idx].cmd_type_offset_bsz &
+	return (txq->ci_tx_ring[idx].cmd_type_offset_bsz &
 			rte_cpu_to_le_64(IDPF_TXD_QW1_DTYPE_M)) ==
 				rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE);
 }
Signature · 1 line
2.51.0
Acked-by on v3 2/36
#75 lore raw

RE: [PATCH v3 02/36] net/intel: use common Tx ring structure

Quoted 7 lines

Subject: [PATCH v3 02/36] net/intel: use common Tx ring structure

Rather than having separate per-driver ring pointers in a union, since we now have a common descriptor type, we can merge all but the ixgbe pointer into one value.

Quoted 959 lines
---
 drivers/net/intel/common/tx.h                 |  5 +--
 drivers/net/intel/cpfl/cpfl_rxtx.c            |  2 +-
 drivers/net/intel/i40e/i40e_fdir.c            |  6 ++--
 drivers/net/intel/i40e/i40e_rxtx.c            | 22 ++++++------
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |  6 ++--
 drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c   |  6 ++--
 drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c |  6 ++--
 drivers/net/intel/i40e/i40e_rxtx_vec_common.h |  2 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |  6 ++--
 drivers/net/intel/iavf/iavf_rxtx.c            | 14 ++++----
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   |  6 ++--
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 12 +++----
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h |  2 +-
 drivers/net/intel/ice/ice_dcf_ethdev.c        |  4 +--
 drivers/net/intel/ice/ice_rxtx.c              | 34 +++++++++----------
 drivers/net/intel/ice/ice_rxtx_vec_avx2.c     |  6 ++--
 drivers/net/intel/ice/ice_rxtx_vec_avx512.c   |  6 ++--
 drivers/net/intel/ice/ice_rxtx_vec_common.h   |  2 +-
 drivers/net/intel/idpf/idpf_common_rxtx.c     |  8 ++---
 .../net/intel/idpf/idpf_common_rxtx_avx2.c    |  6 ++--
 .../net/intel/idpf/idpf_common_rxtx_avx512.c  |  6 ++--
 drivers/net/intel/idpf/idpf_rxtx.c            |  2 +-
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |  2 +-
 23 files changed, 84 insertions(+), 87 deletions(-)
drivers/net/intel/common/tx.h +1 -4
index d7561a2bbb..8cf63e59ab 100644
@@ -41,10 +41,7 @@ typedef void (*ice_tx_release_mbufs_t)(struct
 ci_tx_queue *txq);
 
 struct ci_tx_queue {
 	union { /* TX ring virtual address */
-		volatile struct ci_tx_desc *i40e_tx_ring;
-		volatile struct ci_tx_desc *iavf_tx_ring;
-		volatile struct ci_tx_desc *ice_tx_ring;
-		volatile struct ci_tx_desc *idpf_tx_ring;
+		volatile struct ci_tx_desc *ci_tx_ring;
 		volatile union ixgbe_adv_tx_desc *ixgbe_tx_ring;
 	};
drivers/net/intel/common/tx.h +0 -0
 	volatile uint8_t *qtx_tail;               /* register address of tail */
drivers/net/intel/cpfl/cpfl_rxtx.c +1 -1
index 78bc3e9b49..bc5bec65f0 100644
@@ -606,7 +606,7 @@ cpfl_tx_queue_setup(struct rte_eth_dev *dev,
 uint16_t queue_idx,
 	}
 
 	if (!is_splitq) {
-		txq->idpf_tx_ring = mz->addr;
+		txq->ci_tx_ring = mz->addr;
 		idpf_qc_single_tx_queue_reset(txq);
 	} else {
drivers/net/intel/cpfl/cpfl_rxtx.c +0 -0
 		txq->desc_ring = mz->addr;
drivers/net/intel/i40e/i40e_fdir.c +1 -1
index 605df73c9e..8a01aec0e2 100644
@@ -1380,7 +1380,7 @@ i40e_find_available_buffer(struct rte_eth_dev
 *dev)
 		volatile struct ci_tx_desc *tmp_txdp;
 
 		tmp_tail = txq->tx_tail;
-		tmp_txdp = &txq->i40e_tx_ring[tmp_tail + 1];
+		tmp_txdp = &txq->ci_tx_ring[tmp_tail + 1];
 
 		do {
drivers/net/intel/i40e/i40e_fdir.c +1 -1
 			if ((tmp_txdp->cmd_type_offset_bsz &
@@ -1637,7 +1637,7 @@ i40e_flow_fdir_filter_programming(struct i40e_pf
 *pf,
 
 	PMD_DRV_LOG(INFO, "filling filter programming descriptor.");
 	fdirdp = (volatile struct i40e_filter_program_desc *)
-				(&txq->i40e_tx_ring[txq->tx_tail]);
+				(&txq->ci_tx_ring[txq->tx_tail]);
 
 	fdirdp->qindex_flex_ptype_vsi =
drivers/net/intel/i40e/i40e_fdir.c +1 -1
 			rte_cpu_to_le_32((fdir_action->rx_queue <<
@@ -1707,7 +1707,7 @@ i40e_flow_fdir_filter_programming(struct i40e_pf
 *pf,
 	fdirdp->fd_id = rte_cpu_to_le_32(filter->soft_id);
 
 	PMD_DRV_LOG(INFO, "filling transmit descriptor.");
-	txdp = &txq->i40e_tx_ring[txq->tx_tail + 1];
+	txdp = &txq->ci_tx_ring[txq->tx_tail + 1];
 	txdp->buffer_addr = rte_cpu_to_le_64(pf->fdir.dma_addr[txq->tx_tail
 >> 1]);
drivers/net/intel/i40e/i40e_fdir.c +0 -0
 	td_cmd = I40E_TX_DESC_CMD_EOP |
drivers/net/intel/i40e/i40e_rxtx.c +3 -3
index 92d49ccb79..210fc0201e 100644
@@ -388,7 +388,7 @@ static inline int
 i40e_xmit_cleanup(struct ci_tx_queue *txq)
 {
 	struct ci_tx_entry *sw_ring = txq->sw_ring;
-	volatile struct ci_tx_desc *txd = txq->i40e_tx_ring;
+	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
 	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
 	uint16_t nb_tx_desc = txq->nb_tx_desc;
 	uint16_t desc_to_clean_to;
@@ -1112,7 +1112,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 
 	txq = tx_queue;
 	sw_ring = txq->sw_ring;
-	txr = txq->i40e_tx_ring;
+	txr = txq->ci_tx_ring;
 	tx_id = txq->tx_tail;
 	txe = &sw_ring[tx_id];
@@ -1347,7 +1347,7 @@ i40e_tx_free_bufs(struct ci_tx_queue *txq)
 	const uint16_t k = RTE_ALIGN_FLOOR(tx_rs_thresh,
 I40E_TX_MAX_FREE_BUF_SZ);
 	const uint16_t m = tx_rs_thresh % I40E_TX_MAX_FREE_BUF_SZ;
 
-	if ((txq->i40e_tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
+	if ((txq->ci_tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
 			rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=
 
	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
drivers/net/intel/i40e/i40e_rxtx.c +3 -3
 		return 0;
@@ -1431,7 +1431,7 @@ i40e_tx_fill_hw_ring(struct ci_tx_queue *txq,
 		     struct rte_mbuf **pkts,
 		     uint16_t nb_pkts)
 {
-	volatile struct ci_tx_desc *txdp = &txq->i40e_tx_ring[txq->tx_tail];
+	volatile struct ci_tx_desc *txdp = &txq->ci_tx_ring[txq->tx_tail];
 	struct ci_tx_entry *txep = &txq->sw_ring[txq->tx_tail];
 	const int N_PER_LOOP = 4;
 	const int N_PER_LOOP_MASK = N_PER_LOOP - 1;
@@ -1459,7 +1459,7 @@ tx_xmit_pkts(struct ci_tx_queue *txq,
 	     struct rte_mbuf **tx_pkts,
 	     uint16_t nb_pkts)
 {
-	volatile struct ci_tx_desc *txr = txq->i40e_tx_ring;
+	volatile struct ci_tx_desc *txr = txq->ci_tx_ring;
 	uint16_t n = 0;
 
 	/**
@@ -2421,7 +2421,7 @@ i40e_dev_tx_descriptor_status(void *tx_queue,
 uint16_t offset)
 			desc -= txq->nb_tx_desc;
 	}
 
-	status = &txq->i40e_tx_ring[desc].cmd_type_offset_bsz;
+	status = &txq->ci_tx_ring[desc].cmd_type_offset_bsz;
 	mask = rte_le_to_cpu_64(I40E_TXD_QW1_DTYPE_MASK);
 	expect = rte_cpu_to_le_64(

I40E_TX_DESC_DTYPE_DESC_DONE <<
I40E_TXD_QW1_DTYPE_SHIFT);

drivers/net/intel/i40e/i40e_rxtx.c +1 -1
@@ -2618,7 +2618,7 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev
 *dev,
 	/* Allocate TX hardware ring descriptors. */
 	ring_size = sizeof(struct ci_tx_desc) * I40E_MAX_RING_DESC;
 	ring_size = RTE_ALIGN(ring_size, I40E_DMA_MEM_ALIGN);
-	tz = rte_eth_dma_zone_reserve(dev, "i40e_tx_ring", queue_idx,
+	tz = rte_eth_dma_zone_reserve(dev, "ci_tx_ring", queue_idx,
 			      ring_size, I40E_RING_BASE_ALIGN, socket_id);
 	if (!tz) {
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
 		i40e_tx_queue_release(txq);
@@ -2640,7 +2640,7 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev
 *dev,
 	txq->tx_deferred_start = tx_conf->tx_deferred_start;
 
 	txq->tx_ring_dma = tz->iova;
-	txq->i40e_tx_ring = (struct ci_tx_desc *)tz->addr;
+	txq->ci_tx_ring = (struct ci_tx_desc *)tz->addr;
 
 	/* Allocate software ring */
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
 	txq->sw_ring =
@@ -2915,11 +2915,11 @@ i40e_reset_tx_queue(struct ci_tx_queue *txq)
 	txe = txq->sw_ring;
 	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
-		((volatile char *)txq->i40e_tx_ring)[i] = 0;
+		((volatile char *)txq->ci_tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		volatile struct ci_tx_desc *txd = &txq->i40e_tx_ring[i];
+		volatile struct ci_tx_desc *txd = &txq->ci_tx_ring[i];
 
 		txd->cmd_type_offset_bsz =
 
	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE);
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
@@ -3240,7 +3240,7 @@ i40e_fdir_setup_tx_resources(struct i40e_pf *pf)
 	txq->i40e_vsi = pf->fdir.fdir_vsi;
 
 	txq->tx_ring_dma = tz->iova;
-	txq->i40e_tx_ring = (struct ci_tx_desc *)tz->addr;
+	txq->ci_tx_ring = (struct ci_tx_desc *)tz->addr;
 
 	/*
 	 * don't need to allocate software ring and reset for the fdir
drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +1 -1
index ef5b252898..81e9e2bc0b 100644
@@ -489,7 +489,7 @@ i40e_xmit_fixed_burst_vec(void *tx_queue, struct
 rte_mbuf **tx_pkts,
 		return 0;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->i40e_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = &txq->sw_ring_vec[tx_id];
 
drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +2 -2
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);
@@ -509,7 +509,7 @@ i40e_xmit_fixed_burst_vec(void *tx_queue, struct
 rte_mbuf **tx_pkts,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = &txq->i40e_tx_ring[tx_id];
+		txdp = &txq->ci_tx_ring[tx_id];
 		txep = &txq->sw_ring_vec[tx_id];
 	}
@@ -519,7 +519,7 @@ i40e_xmit_fixed_burst_vec(void *tx_queue, struct
 rte_mbuf **tx_pkts,
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->i40e_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 
 	rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
	I40E_TXD_QW1_CMD_SHIFT);
drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +0 -0
 		txq->tx_next_rs =
drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +1 -1
index 137c1f9765..f054bd41bf 100644
@@ -753,7 +753,7 @@ i40e_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 		return 0;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->i40e_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = &txq->sw_ring_vec[tx_id];
 
drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +2 -2
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);
@@ -774,7 +774,7 @@ i40e_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = &txq->i40e_tx_ring[tx_id];
+		txdp = &txq->ci_tx_ring[tx_id];
 		txep = &txq->sw_ring_vec[tx_id];
 	}
@@ -784,7 +784,7 @@ i40e_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->i40e_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 
 	rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
	I40E_TXD_QW1_CMD_SHIFT);
drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +0 -0
 		txq->tx_next_rs =
drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c +3 -3
index 6971488750..9a967faeee 100644
@@ -821,7 +821,7 @@ i40e_xmit_fixed_burst_vec_avx512(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 		return 0;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->i40e_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = (void *)txq->sw_ring;
 	txep += tx_id;
@@ -843,7 +843,7 @@ i40e_xmit_fixed_burst_vec_avx512(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = txq->i40e_tx_ring;
+		txdp = txq->ci_tx_ring;
 		txep = (void *)txq->sw_ring;
 	}
@@ -853,7 +853,7 @@ i40e_xmit_fixed_burst_vec_avx512(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->i40e_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 
 	rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
	I40E_TXD_QW1_CMD_SHIFT);
drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c +0 -0
 		txq->tx_next_rs =
drivers/net/intel/i40e/i40e_rxtx_vec_common.h +1 -1
index 14651f2f06..1fd7fc75bf 100644
@@ -15,7 +15,7 @@
 static inline int
 i40e_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
 {
-	return (txq->i40e_tx_ring[idx].cmd_type_offset_bsz &
+	return (txq->ci_tx_ring[idx].cmd_type_offset_bsz &
 			rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
 
 	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE);

}

drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +1 -1
index 6404b70c56..0b95152232 100644
@@ -638,7 +638,7 @@ i40e_xmit_fixed_burst_vec(void *__rte_restrict
 tx_queue,
 		return 0;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->i40e_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = &txq->sw_ring_vec[tx_id];
 
drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +2 -2
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);
@@ -658,7 +658,7 @@ i40e_xmit_fixed_burst_vec(void *__rte_restrict
 tx_queue,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = &txq->i40e_tx_ring[tx_id];
+		txdp = &txq->ci_tx_ring[tx_id];
 		txep = &txq->sw_ring_vec[tx_id];
 	}
@@ -668,7 +668,7 @@ i40e_xmit_fixed_burst_vec(void *__rte_restrict
 tx_queue,
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->i40e_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 
 	rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
	I40E_TXD_QW1_CMD_SHIFT);
drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +0 -0
 		txq->tx_next_rs =
drivers/net/intel/iavf/iavf_rxtx.c +2 -2
index e4421a9932..807bc92a45 100644
@@ -269,11 +269,11 @@ reset_tx_queue(struct ci_tx_queue *txq)
 	txe = txq->sw_ring;
 	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
-		((volatile char *)txq->iavf_tx_ring)[i] = 0;
+		((volatile char *)txq->ci_tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		txq->iavf_tx_ring[i].cmd_type_offset_bsz =
+		txq->ci_tx_ring[i].cmd_type_offset_bsz =
 
 	rte_cpu_to_le_64(IAVF_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
drivers/net/intel/iavf/iavf_rxtx.c +5 -5
 		txe[i].last_id = i;
@@ -829,7 +829,7 @@ iavf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	/* Allocate TX hardware ring descriptors. */
 	ring_size = sizeof(struct ci_tx_desc) * IAVF_MAX_RING_DESC;
 	ring_size = RTE_ALIGN(ring_size, IAVF_DMA_MEM_ALIGN);
-	mz = rte_eth_dma_zone_reserve(dev, "iavf_tx_ring", queue_idx,
+	mz = rte_eth_dma_zone_reserve(dev, "ci_tx_ring", queue_idx,
 				      ring_size, IAVF_RING_BASE_ALIGN,
 				      socket_id);
 	if (!mz) {
@@ -839,7 +839,7 @@ iavf_dev_tx_queue_setup(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 	txq->tx_ring_dma = mz->iova;
-	txq->iavf_tx_ring = (struct ci_tx_desc *)mz->addr;
+	txq->ci_tx_ring = (struct ci_tx_desc *)mz->addr;
 
 	txq->mz = mz;
 	reset_tx_queue(txq);
@@ -2333,7 +2333,7 @@ iavf_xmit_cleanup(struct ci_tx_queue *txq)
 	uint16_t desc_to_clean_to;
 	uint16_t nb_tx_to_clean;
 
-	volatile struct ci_tx_desc *txd = txq->iavf_tx_ring;
+	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
 
 	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
 	if (desc_to_clean_to >= nb_tx_desc)
@@ -2756,7 +2756,7 @@ uint16_t
 iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq = tx_queue;
-	volatile struct ci_tx_desc *txr = txq->iavf_tx_ring;
+	volatile struct ci_tx_desc *txr = txq->ci_tx_ring;
 	struct ci_tx_entry *txe_ring = txq->sw_ring;
 	struct ci_tx_entry *txe, *txn;
 	struct rte_mbuf *mb, *mb_seg;
@@ -4462,7 +4462,7 @@ iavf_dev_tx_desc_status(void *tx_queue, uint16_t
 offset)
 			desc -= txq->nb_tx_desc;
 	}
 
-	status = &txq->iavf_tx_ring[desc].cmd_type_offset_bsz;
+	status = &txq->ci_tx_ring[desc].cmd_type_offset_bsz;
 	mask = rte_le_to_cpu_64(IAVF_TXD_QW1_DTYPE_MASK);
 	expect = rte_cpu_to_le_64(

IAVF_TX_DESC_DTYPE_DESC_DONE <<
IAVF_TXD_QW1_DTYPE_SHIFT);

drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +1 -1
index 5b62d51cf7..89ce841b9e 100644
@@ -1729,7 +1729,7 @@ iavf_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 	nb_commit = nb_pkts;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->iavf_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = &txq->sw_ring_vec[tx_id];
 
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +2 -2
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);
@@ -1750,7 +1750,7 @@ iavf_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = &txq->iavf_tx_ring[tx_id];
+		txdp = &txq->ci_tx_ring[tx_id];
 		txep = &txq->sw_ring_vec[tx_id];
 	}
@@ -1760,7 +1760,7 @@ iavf_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->iavf_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 
 	rte_cpu_to_le_64(((uint64_t)IAVF_TX_DESC_CMD_RS) <<
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +0 -0
 					 IAVF_TXD_QW1_CMD_SHIFT);
 		txq->tx_next_rs =
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +2 -2
index d79d96c7b7..ad1b0b90cd 100644
@@ -2219,7 +2219,7 @@ iavf_xmit_fixed_burst_vec_avx512(void
 *tx_queue, struct rte_mbuf **tx_pkts,
 	nb_commit = nb_pkts;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->iavf_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = (void *)txq->sw_ring;
 	txep += tx_id;
@@ -2241,7 +2241,7 @@ iavf_xmit_fixed_burst_vec_avx512(void
 *tx_queue, struct rte_mbuf **tx_pkts,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = &txq->iavf_tx_ring[tx_id];
+		txdp = &txq->ci_tx_ring[tx_id];
 		txep = (void *)txq->sw_ring;
 		txep += tx_id;
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +1 -1
 	}
@@ -2252,7 +2252,7 @@ iavf_xmit_fixed_burst_vec_avx512(void
 *tx_queue, struct rte_mbuf **tx_pkts,
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->iavf_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 
 	rte_cpu_to_le_64(((uint64_t)IAVF_TX_DESC_CMD_RS) <<
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +3 -3
 					 IAVF_TXD_QW1_CMD_SHIFT);
 		txq->tx_next_rs =
@@ -2288,7 +2288,7 @@ iavf_xmit_fixed_burst_vec_avx512_ctx(void
 *tx_queue, struct rte_mbuf **tx_pkts,
 
 	nb_pkts = nb_commit >> 1;
 	tx_id = txq->tx_tail;
-	txdp = &txq->iavf_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = (void *)txq->sw_ring;
 	txep += (tx_id >> 1);
@@ -2309,7 +2309,7 @@ iavf_xmit_fixed_burst_vec_avx512_ctx(void
 *tx_queue, struct rte_mbuf **tx_pkts,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 		tx_id = 0;
 		/* avoid reach the end of ring */
-		txdp = txq->iavf_tx_ring;
+		txdp = txq->ci_tx_ring;
 		txep = (void *)txq->sw_ring;
 	}
@@ -2320,7 +2320,7 @@ iavf_xmit_fixed_burst_vec_avx512_ctx(void
 *tx_queue, struct rte_mbuf **tx_pkts,
 	tx_id = (uint16_t)(tx_id + nb_commit);
 
 	if (tx_id > txq->tx_next_rs) {
-		txq->iavf_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 
 	rte_cpu_to_le_64(((uint64_t)IAVF_TX_DESC_CMD_RS) <<
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -0
 					 IAVF_TXD_QW1_CMD_SHIFT);
 		txq->tx_next_rs =
drivers/net/intel/iavf/iavf_rxtx_vec_common.h +1 -1
index f1ea57034f..1832b76f89 100644
@@ -14,7 +14,7 @@
 static inline int
 iavf_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
 {
-	return (txq->iavf_tx_ring[idx].cmd_type_offset_bsz &
+	return (txq->ci_tx_ring[idx].cmd_type_offset_bsz &
 			rte_cpu_to_le_64(IAVF_TXD_QW1_DTYPE_MASK)) ==
 
 	rte_cpu_to_le_64(IAVF_TX_DESC_DTYPE_DESC_DONE);

}

drivers/net/intel/ice/ice_dcf_ethdev.c +2 -2
index ab1d499cef..5f537b4c12 100644
@@ -401,11 +401,11 @@ reset_tx_queue(struct ci_tx_queue *txq)
 	txe = txq->sw_ring;
 	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
-		((volatile char *)txq->ice_tx_ring)[i] = 0;
+		((volatile char *)txq->ci_tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		txq->ice_tx_ring[i].cmd_type_offset_bsz =
+		txq->ci_tx_ring[i].cmd_type_offset_bsz =
 
 	rte_cpu_to_le_64(IAVF_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
drivers/net/intel/ice/ice_dcf_ethdev.c +0 -0
 		txe[i].last_id = i;
drivers/net/intel/ice/ice_rxtx.c +3 -3
index 74b80e7df3..e3ffbdb587 100644
@@ -1117,11 +1117,11 @@ ice_reset_tx_queue(struct ci_tx_queue *txq)
 	txe = txq->sw_ring;
 	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
-		((volatile char *)txq->ice_tx_ring)[i] = 0;
+		((volatile char *)txq->ci_tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		volatile struct ci_tx_desc *txd = &txq->ice_tx_ring[i];
+		volatile struct ci_tx_desc *txd = &txq->ci_tx_ring[i];
 
 		txd->cmd_type_offset_bsz =
 			rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE);
@@ -1625,7 +1625,7 @@ ice_tx_queue_setup(struct rte_eth_dev *dev,
 	/* Allocate TX hardware ring descriptors. */
 	ring_size = sizeof(struct ci_tx_desc) *
 ICE_MAX_NUM_DESC_BY_MAC(hw);
 	ring_size = RTE_ALIGN(ring_size, ICE_DMA_MEM_ALIGN);
-	tz = rte_eth_dma_zone_reserve(dev, "ice_tx_ring", queue_idx,
+	tz = rte_eth_dma_zone_reserve(dev, "ci_tx_ring", queue_idx,
 				      ring_size, ICE_RING_BASE_ALIGN,
 				      socket_id);
drivers/net/intel/ice/ice_rxtx.c +2 -2
 	if (!tz) {
@@ -1649,7 +1649,7 @@ ice_tx_queue_setup(struct rte_eth_dev *dev,
 	txq->tx_deferred_start = tx_conf->tx_deferred_start;
 
 	txq->tx_ring_dma = tz->iova;
-	txq->ice_tx_ring = tz->addr;
+	txq->ci_tx_ring = tz->addr;
 
 	/* Allocate software ring */
 	txq->sw_ring =
@@ -2555,7 +2555,7 @@ ice_tx_descriptor_status(void *tx_queue, uint16_t
 offset)
 			desc -= txq->nb_tx_desc;
 	}
 
-	status = &txq->ice_tx_ring[desc].cmd_type_offset_bsz;
+	status = &txq->ci_tx_ring[desc].cmd_type_offset_bsz;
 	mask = rte_cpu_to_le_64(ICE_TXD_QW1_DTYPE_M);
 	expect = rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE <<
drivers/net/intel/ice/ice_rxtx.c +5 -5
 				  ICE_TXD_QW1_DTYPE_S);
@@ -2638,7 +2638,7 @@ ice_fdir_setup_tx_resources(struct ice_pf *pf)
 	txq->ice_vsi = pf->fdir.fdir_vsi;
 
 	txq->tx_ring_dma = tz->iova;
-	txq->ice_tx_ring = (struct ci_tx_desc *)tz->addr;
+	txq->ci_tx_ring = (struct ci_tx_desc *)tz->addr;
 	/*
 	 * don't need to allocate software ring and reset for the fdir
 	 * program queue just set the queue has been configured.
@@ -3027,7 +3027,7 @@ static inline int
 ice_xmit_cleanup(struct ci_tx_queue *txq)
 {
 	struct ci_tx_entry *sw_ring = txq->sw_ring;
-	volatile struct ci_tx_desc *txd = txq->ice_tx_ring;
+	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
 	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
 	uint16_t nb_tx_desc = txq->nb_tx_desc;
 	uint16_t desc_to_clean_to;
@@ -3148,7 +3148,7 @@ uint16_t
 ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
 	struct ci_tx_queue *txq;
-	volatile struct ci_tx_desc *ice_tx_ring;
+	volatile struct ci_tx_desc *ci_tx_ring;
 	volatile struct ci_tx_desc *txd;
 	struct ci_tx_entry *sw_ring;
 	struct ci_tx_entry *txe, *txn;
@@ -3171,7 +3171,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 
 	txq = tx_queue;
 	sw_ring = txq->sw_ring;
-	ice_tx_ring = txq->ice_tx_ring;
+	ci_tx_ring = txq->ci_tx_ring;
 	tx_id = txq->tx_tail;
 	txe = &sw_ring[tx_id];
@@ -3257,7 +3257,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 			/* Setup TX context descriptor if required */
 			volatile struct ice_tx_ctx_desc *ctx_txd =
 				(volatile struct ice_tx_ctx_desc *)
-					&ice_tx_ring[tx_id];
+					&ci_tx_ring[tx_id];
 			uint16_t cd_l2tag2 = 0;
 			uint64_t cd_type_cmd_tso_mss =

ICE_TX_DESC_DTYPE_CTX;

drivers/net/intel/ice/ice_rxtx.c +1 -1
@@ -3299,7 +3299,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 		m_seg = tx_pkt;
 
 		do {
-			txd = &ice_tx_ring[tx_id];
+			txd = &ci_tx_ring[tx_id];
 			txn = &sw_ring[txe->next_id];
 
drivers/net/intel/ice/ice_rxtx.c +6 -6
 			if (txe->mbuf)
@@ -3327,7 +3327,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 				txe->last_id = tx_last;
 				tx_id = txe->next_id;
 				txe = txn;
-				txd = &ice_tx_ring[tx_id];
+				txd = &ci_tx_ring[tx_id];
 				txn = &sw_ring[txe->next_id];
 			}
@@ -3410,7 +3410,7 @@ ice_tx_free_bufs(struct ci_tx_queue *txq)
 	struct ci_tx_entry *txep;
 	uint16_t i;
 
-	if ((txq->ice_tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
+	if ((txq->ci_tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
 	     rte_cpu_to_le_64(ICE_TXD_QW1_DTYPE_M)) !=
 	    rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE))
 		return 0;
@@ -3594,7 +3594,7 @@ static inline void
 ice_tx_fill_hw_ring(struct ci_tx_queue *txq, struct rte_mbuf **pkts,
 		    uint16_t nb_pkts)
 {
-	volatile struct ci_tx_desc *txdp = &txq->ice_tx_ring[txq->tx_tail];
+	volatile struct ci_tx_desc *txdp = &txq->ci_tx_ring[txq->tx_tail];
 	struct ci_tx_entry *txep = &txq->sw_ring[txq->tx_tail];
 	const int N_PER_LOOP = 4;
 	const int N_PER_LOOP_MASK = N_PER_LOOP - 1;
@@ -3627,7 +3627,7 @@ tx_xmit_pkts(struct ci_tx_queue *txq,
 	     struct rte_mbuf **tx_pkts,
 	     uint16_t nb_pkts)
 {
-	volatile struct ci_tx_desc *txr = txq->ice_tx_ring;
+	volatile struct ci_tx_desc *txr = txq->ci_tx_ring;
 	uint16_t n = 0;
 
 	/**
@@ -4887,11 +4887,11 @@ ice_fdir_programming(struct ice_pf *pf, struct
 ice_fltr_desc *fdir_desc)
 	uint16_t i;
 
 	fdirdp = (volatile struct ice_fltr_desc *)
-		(&txq->ice_tx_ring[txq->tx_tail]);
+		(&txq->ci_tx_ring[txq->tx_tail]);
 	fdirdp->qidx_compq_space_stat = fdir_desc->qidx_compq_space_stat;
 	fdirdp->dtype_cmd_vsi_fdid = fdir_desc->dtype_cmd_vsi_fdid;
 
-	txdp = &txq->ice_tx_ring[txq->tx_tail + 1];
+	txdp = &txq->ci_tx_ring[txq->tx_tail + 1];
 	txdp->buffer_addr = rte_cpu_to_le_64(pf->fdir.dma_addr);
 	td_cmd = ICE_TX_DESC_CMD_EOP |
drivers/net/intel/ice/ice_rxtx.c +0 -0
 		ICE_TX_DESC_CMD_RS  |
drivers/net/intel/ice/ice_rxtx_vec_avx2.c +1 -1
index bef7bb00ba..0a1df0b2f6 100644
@@ -869,7 +869,7 @@ ice_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 		return 0;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->ice_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = &txq->sw_ring_vec[tx_id];
 
drivers/net/intel/ice/ice_rxtx_vec_avx2.c +2 -2
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);
@@ -890,7 +890,7 @@ ice_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = &txq->ice_tx_ring[tx_id];
+		txdp = &txq->ci_tx_ring[tx_id];
 		txep = &txq->sw_ring_vec[tx_id];
 	}
@@ -900,7 +900,7 @@ ice_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->ice_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)ICE_TX_DESC_CMD_RS)

<<

drivers/net/intel/ice/ice_rxtx_vec_avx2.c +0 -0
 					 ICE_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
drivers/net/intel/ice/ice_rxtx_vec_avx512.c +3 -3
index 1f6bf5fc8e..d42f41461f 100644
@@ -933,7 +933,7 @@ ice_xmit_fixed_burst_vec_avx512(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 		return 0;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->ice_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = (void *)txq->sw_ring;
 	txep += tx_id;
@@ -955,7 +955,7 @@ ice_xmit_fixed_burst_vec_avx512(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = txq->ice_tx_ring;
+		txdp = txq->ci_tx_ring;
 		txep = (void *)txq->sw_ring;
 	}
@@ -965,7 +965,7 @@ ice_xmit_fixed_burst_vec_avx512(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->ice_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 			rte_cpu_to_le_64(((uint64_t)ICE_TX_DESC_CMD_RS)

<<

drivers/net/intel/ice/ice_rxtx_vec_avx512.c +0 -0
 					 ICE_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
drivers/net/intel/ice/ice_rxtx_vec_common.h +1 -1
index ff46a8fb49..8ba591e403 100644
@@ -11,7 +11,7 @@
 static inline int
 ice_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
 {
-	return (txq->ice_tx_ring[idx].cmd_type_offset_bsz &
+	return (txq->ci_tx_ring[idx].cmd_type_offset_bsz &
 			rte_cpu_to_le_64(ICE_TXD_QW1_DTYPE_M)) ==
 
 	rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE);

}

drivers/net/intel/idpf/idpf_common_rxtx.c +2 -2
index be3c1ef216..51074bda3a 100644
@@ -266,11 +266,11 @@ idpf_qc_single_tx_queue_reset(struct ci_tx_queue
 *txq)
 	txe = txq->sw_ring;
 	size = sizeof(struct ci_tx_desc) * txq->nb_tx_desc;
 	for (i = 0; i < size; i++)
-		((volatile char *)txq->idpf_tx_ring)[i] = 0;
+		((volatile char *)txq->ci_tx_ring)[i] = 0;
 
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
-		txq->idpf_tx_ring[i].cmd_type_offset_bsz =
+		txq->ci_tx_ring[i].cmd_type_offset_bsz =
 
 	rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE);
drivers/net/intel/idpf/idpf_common_rxtx.c +2 -2
 		txe[i].mbuf =  NULL;
 		txe[i].last_id = i;
@@ -1335,7 +1335,7 @@ idpf_xmit_cleanup(struct ci_tx_queue *txq)
 	uint16_t desc_to_clean_to;
 	uint16_t nb_tx_to_clean;
 
-	volatile struct ci_tx_desc *txd = txq->idpf_tx_ring;
+	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
 
 	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
 	if (desc_to_clean_to >= nb_tx_desc)
@@ -1398,7 +1398,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct
 rte_mbuf **tx_pkts,
 		return nb_tx;
 
 	sw_ring = txq->sw_ring;
-	txr = txq->idpf_tx_ring;
+	txr = txq->ci_tx_ring;
 	tx_id = txq->tx_tail;
 	txe = &sw_ring[tx_id];
drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +1 -1
index 5f5d538dcb..04efee3722 100644
@@ -573,7 +573,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx2(void
 *tx_queue, struct rte_mbuf **tx_pkts
 		return 0;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->idpf_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = &txq->sw_ring_vec[tx_id];
 
drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +2 -2
 	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);
@@ -594,7 +594,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx2(void
 *tx_queue, struct rte_mbuf **tx_pkts
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = &txq->idpf_tx_ring[tx_id];
+		txdp = &txq->ci_tx_ring[tx_id];
 		txep = &txq->sw_ring_vec[tx_id];
 	}
@@ -604,7 +604,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx2(void
 *tx_queue, struct rte_mbuf **tx_pkts
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->idpf_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 
 	rte_cpu_to_le_64(((uint64_t)IDPF_TX_DESC_CMD_RS) <<
drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +0 -0
 					 IDPF_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +2 -2
index c1ec3d1222..d5e5a2ca5f 100644
@@ -1090,7 +1090,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void
 *tx_queue, struct rte_mbuf **tx_pk
 		return 0;
 
 	tx_id = txq->tx_tail;
-	txdp = &txq->idpf_tx_ring[tx_id];
+	txdp = &txq->ci_tx_ring[tx_id];
 	txep = (void *)txq->sw_ring;
 	txep += tx_id;
@@ -1112,7 +1112,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void
 *tx_queue, struct rte_mbuf **tx_pk
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 
 		/* avoid reach the end of ring */
-		txdp = &txq->idpf_tx_ring[tx_id];
+		txdp = &txq->ci_tx_ring[tx_id];
 		txep = (void *)txq->sw_ring;
 		txep += tx_id;
drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +1 -1
 	}
@@ -1123,7 +1123,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void
 *tx_queue, struct rte_mbuf **tx_pk
 
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
-		txq->idpf_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
+		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
 
 	rte_cpu_to_le_64(((uint64_t)IDPF_TX_DESC_CMD_RS) <<
drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +0 -0
 					 IDPF_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
drivers/net/intel/idpf/idpf_rxtx.c +1 -1
index 8aa44585fe..0de54d9305 100644
@@ -481,7 +481,7 @@ idpf_tx_queue_setup(struct rte_eth_dev *dev,
 uint16_t queue_idx,
 	}
 
 	if (!is_splitq) {
-		txq->idpf_tx_ring = mz->addr;
+		txq->ci_tx_ring = mz->addr;
 		idpf_qc_single_tx_queue_reset(txq);
 	} else {
drivers/net/intel/idpf/idpf_rxtx.c +0 -0
 		txq->desc_ring = mz->addr;
drivers/net/intel/idpf/idpf_rxtx_vec_common.h +1 -1
index 4702061484..b5e8574667 100644
@@ -31,7 +31,7 @@ idpf_tx_desc_done(struct ci_tx_queue *txq, uint16_t
 idx)
 	if (txq->complq != NULL)
 		return 1;
 
-	return (txq->idpf_tx_ring[idx].cmd_type_offset_bsz &
+	return (txq->ci_tx_ring[idx].cmd_type_offset_bsz &
 			rte_cpu_to_le_64(IDPF_TXD_QW1_DTYPE_M)) ==
 
	rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE);

}
--
2.51.0

#76 lore raw

PATCH v3 3/36 net/intel: create common post-Tx cleanup function

In reply to Bruce Richardson

The code used in ice, iavf, idpf and i40e for doing cleanup of mbufs after they had been transmitted was identical. Therefore deduplicate it by moving to common and remove the driver-specific versions.

---
 drivers/net/intel/common/tx.h             | 53 ++++++++++++++++++++
 drivers/net/intel/i40e/i40e_rxtx.c        | 49 ++----------------
 drivers/net/intel/iavf/iavf_rxtx.c        | 50 ++-----------------
 drivers/net/intel/ice/ice_rxtx.c          | 60 ++---------------------
 drivers/net/intel/idpf/idpf_common_rxtx.c | 46 ++---------------
 5 files changed, 71 insertions(+), 187 deletions(-)
drivers/net/intel/common/tx.h +53 -0
index 8cf63e59ab..a89412c195 100644
@@ -259,6 +259,59 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq, ci_desc_done_fn desc_done, bool ctx
 	return txq->tx_rs_thresh;
 }
 
+/*
+ * Common transmit descriptor cleanup function for Intel drivers.
+ * Used by ice, i40e, iavf, and idpf drivers.
+ *
+ * Returns:
+ *   0 on success
+ *  -1 if cleanup cannot proceed (descriptors not yet processed by HW)
+ */
+static __rte_always_inline int
+ci_tx_xmit_cleanup(struct ci_tx_queue *txq)
+{
+	struct ci_tx_entry *sw_ring = txq->sw_ring;
+	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
+	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
+	uint16_t nb_tx_desc = txq->nb_tx_desc;
+	uint16_t desc_to_clean_to;
+	uint16_t nb_tx_to_clean;
+
+	/* Determine the last descriptor needing to be cleaned */
+	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
+	if (desc_to_clean_to >= nb_tx_desc)
+		desc_to_clean_to = (uint16_t)(desc_to_clean_to - nb_tx_desc);
+
+	/* Check to make sure the last descriptor to clean is done */
+	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
+
+	/* Check if descriptor is done - all drivers use 0xF as done value in bits 3:0 */
+	if ((txd[desc_to_clean_to].cmd_type_offset_bsz & rte_cpu_to_le_64(0xFUL)) !=
+			rte_cpu_to_le_64(0xFUL)) {
+		/* Descriptor not yet processed by hardware */
+		return -1;
+	}
+
+	/* Figure out how many descriptors will be cleaned */
+	if (last_desc_cleaned > desc_to_clean_to)
+		nb_tx_to_clean = (uint16_t)((nb_tx_desc - last_desc_cleaned) + desc_to_clean_to);
+	else
+		nb_tx_to_clean = (uint16_t)(desc_to_clean_to - last_desc_cleaned);
+
+	/* The last descriptor to clean is done, so that means all the
+	 * descriptors from the last descriptor that was cleaned
+	 * up to the last descriptor with the RS bit set
+	 * are done. Only reset the threshold descriptor.
+	 */
+	txd[desc_to_clean_to].cmd_type_offset_bsz = 0;
+
+	/* Update the txq to reflect the last descriptor that was cleaned */
+	txq->last_desc_cleaned = desc_to_clean_to;
+	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + nb_tx_to_clean);
+
+	return 0;
+}
+
 static inline void
 ci_txq_release_all_mbufs(struct ci_tx_queue *txq, bool use_ctx)
 {
drivers/net/intel/i40e/i40e_rxtx.c +5 -44

85 lines not on this page · raw message

drivers/net/intel/iavf/iavf_rxtx.c +5 -45

86 lines not on this page · raw message

drivers/net/intel/ice/ice_rxtx.c +5 -55

96 lines not on this page · raw message

drivers/net/intel/idpf/idpf_common_rxtx.c +3 -43

70 lines not on this page · raw message

Signature · 1 line
2.51.0
#77 lore raw

RE: [PATCH v3 03/36] net/intel: create common post-Tx cleanup function

Quoted 57 lines

-----Original Message-----
From: Bruce Richardson <[email protected]>
Sent: Friday 30 January 2026 11:42
To: [email protected]
Cc: Richardson, Bruce <[email protected]>; Medvedkin, Vladimir <[email protected]>; Burakov, Anatoly <[email protected]>; Wu, Jingjing <[email protected]>; Shetty, Praveen <[email protected]>
Subject: [PATCH v3 03/36] net/intel: create common post-Tx cleanup function

The code used in ice, iavf, idpf and i40e for doing cleanup of mbufs after they had been transmitted was identical. Therefore deduplicate it by moving to common and remove the driver-specific versions.

---
 drivers/net/intel/common/tx.h             | 53 ++++++++++++++++++++
 drivers/net/intel/i40e/i40e_rxtx.c        | 49 ++----------------
 drivers/net/intel/iavf/iavf_rxtx.c        | 50 ++-----------------
 drivers/net/intel/ice/ice_rxtx.c          | 60 ++---------------------
 drivers/net/intel/idpf/idpf_common_rxtx.c | 46 ++---------------
 5 files changed, 71 insertions(+), 187 deletions(-)
drivers/net/intel/common/tx.h +0 -0
index 8cf63e59ab..a89412c195 100644
@@ -259,6 +259,59 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq,

ci_desc_done_fn desc_done, bool ctx

drivers/net/intel/common/tx.h +22 -0
 	return txq->tx_rs_thresh;
 }
 
+/*
+ * Common transmit descriptor cleanup function for Intel drivers.
+ * Used by ice, i40e, iavf, and idpf drivers.
+ *
+ * Returns:
+ *   0 on success
+ *  -1 if cleanup cannot proceed (descriptors not yet processed by HW)
+ */
+static __rte_always_inline int
+ci_tx_xmit_cleanup(struct ci_tx_queue *txq)
+{
+	struct ci_tx_entry *sw_ring = txq->sw_ring;
+	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
+	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
+	uint16_t nb_tx_desc = txq->nb_tx_desc;
+	uint16_t desc_to_clean_to;
+	uint16_t nb_tx_to_clean;
+
+	/* Determine the last descriptor needing to be cleaned */
+	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
+	if (desc_to_clean_to >= nb_tx_desc)
+		desc_to_clean_to = (uint16_t)(desc_to_clean_to -

nb_tx_desc);

drivers/net/intel/common/tx.h

Quoted 2 lines
drivers/net/intel/common/tx.h +2 -0
+
+	/* Check to make sure the last descriptor to clean is done */

This comment is similar to the next one. Maybe merge them?

Quoted 59 lines
drivers/net/intel/common/tx.h +3 -0
+	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
+
+	/* Check if descriptor is done - all drivers use 0xF as done value in bits

3:0 */

drivers/net/intel/common/tx.h +1 -0
+	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &

rte_cpu_to_le_64(0xFUL)) !=

drivers/net/intel/common/tx.h +11 -0
+			rte_cpu_to_le_64(0xFUL)) {
+		/* Descriptor not yet processed by hardware */
+		return -1;
+	}
+
+	/* Figure out how many descriptors will be cleaned */
+	if (last_desc_cleaned > desc_to_clean_to)
+		nb_tx_to_clean = (uint16_t)((nb_tx_desc - last_desc_cleaned)
+ desc_to_clean_to);
+	else
+		nb_tx_to_clean = (uint16_t)(desc_to_clean_to -

last_desc_cleaned);

drivers/net/intel/common/tx.h +15 -0
+
+	/* The last descriptor to clean is done, so that means all the
+	 * descriptors from the last descriptor that was cleaned
+	 * up to the last descriptor with the RS bit set
+	 * are done. Only reset the threshold descriptor.
+	 */
+	txd[desc_to_clean_to].cmd_type_offset_bsz = 0;
+
+	/* Update the txq to reflect the last descriptor that was cleaned */
+	txq->last_desc_cleaned = desc_to_clean_to;
+	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + nb_tx_to_clean);
+
+	return 0;
+}
+
 static inline void
 ci_txq_release_all_mbufs(struct ci_tx_queue *txq, bool use_ctx)
 {
drivers/net/intel/i40e/i40e_rxtx.c +0 -13
index 210fc0201e..2760e76e99 100644
@@ -384,45 +384,6 @@ i40e_build_ctob(uint32_t td_cmd,
 			((uint64_t)td_tag  <<
 I40E_TXD_QW1_L2TAG1_SHIFT));
 }
 
-static inline int
-i40e_xmit_cleanup(struct ci_tx_queue *txq)
-{
-	struct ci_tx_entry *sw_ring = txq->sw_ring;
-	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
-	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
-	uint16_t nb_tx_desc = txq->nb_tx_desc;
-	uint16_t desc_to_clean_to;
-	uint16_t nb_tx_to_clean;
-
-	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
-	if (desc_to_clean_to >= nb_tx_desc)
-		desc_to_clean_to = (uint16_t)(desc_to_clean_to -

drivers/net/intel/i40e/i40e_rxtx.c i40e_build_ctob(uint32_t td_cmd, · line 410

Quoted 10 lines
drivers/net/intel/i40e/i40e_rxtx.c +0 -8
 nb_tx_desc);
-
-	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
-	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &
-			rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=
-
 	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE)) {
-		PMD_TX_LOG(DEBUG, "TX descriptor %4u is not done "
-			   "(port=%d queue=%d)", desc_to_clean_to,
-			   txq->port_id, txq->queue_id);

These logs are lost in each of the drivers. I'm not sure if they're terribly helpful though so I think it's fine that they're dropped.

Quoted 365 lines
drivers/net/intel/i40e/i40e_rxtx.c +2 -19
-		return -1;
-	}
-
-	if (last_desc_cleaned > desc_to_clean_to)
-		nb_tx_to_clean = (uint16_t)((nb_tx_desc - last_desc_cleaned)
+
-							desc_to_clean_to);
-	else
-		nb_tx_to_clean = (uint16_t)(desc_to_clean_to -
-					last_desc_cleaned);
-
-	txd[desc_to_clean_to].cmd_type_offset_bsz = 0;
-
-	txq->last_desc_cleaned = desc_to_clean_to;
-	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + nb_tx_to_clean);
-
-	return 0;
-}
-
 static inline int
 #ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
 check_rx_burst_bulk_alloc_preconditions(struct ci_rx_queue *rxq)
@@ -1118,7 +1079,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 
 	/* Check if the descriptor ring needs to be cleaned. */
 	if (txq->nb_tx_free < txq->tx_free_thresh)
-		(void)i40e_xmit_cleanup(txq);
+		(void)ci_tx_xmit_cleanup(txq);
 
 	for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
 		td_cmd = 0;
@@ -1159,14 +1120,14 @@ i40e_xmit_pkts(void *tx_queue, struct
 rte_mbuf **tx_pkts, uint16_t nb_pkts)
 			tx_last = (uint16_t)(tx_last - txq->nb_tx_desc);
 
 		if (nb_used > txq->nb_tx_free) {
-			if (i40e_xmit_cleanup(txq) != 0) {
+			if (ci_tx_xmit_cleanup(txq) != 0) {
 				if (nb_tx == 0)
 					return 0;
 				goto end_of_tx;
 			}
 			if (unlikely(nb_used > txq->tx_rs_thresh)) {
 				while (nb_used > txq->nb_tx_free) {
-					if (i40e_xmit_cleanup(txq) != 0) {
+					if (ci_tx_xmit_cleanup(txq) != 0) {
 						if (nb_tx == 0)
 							return 0;
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
 						goto end_of_tx;
@@ -2808,7 +2769,7 @@ i40e_tx_done_cleanup_full(struct ci_tx_queue
 *txq,
 	tx_last = txq->tx_tail;
 	tx_id  = swr_ring[tx_last].next_id;
 
-	if (txq->nb_tx_free == 0 && i40e_xmit_cleanup(txq))
+	if (txq->nb_tx_free == 0 && ci_tx_xmit_cleanup(txq))
 		return 0;
 
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
 	nb_tx_to_clean = txq->nb_tx_free;
@@ -2842,7 +2803,7 @@ i40e_tx_done_cleanup_full(struct ci_tx_queue
 *txq,
 			break;
 
 		if (pkt_cnt < free_cnt) {
-			if (i40e_xmit_cleanup(txq))
+			if (ci_tx_xmit_cleanup(txq))
 				break;
 
drivers/net/intel/i40e/i40e_rxtx.c +0 -0
 			nb_tx_to_clean = txq->nb_tx_free - nb_tx_free_last;
drivers/net/intel/iavf/iavf_rxtx.c +2 -41
index 807bc92a45..560abfc1ef 100644
@@ -2324,46 +2324,6 @@ iavf_recv_pkts_bulk_alloc(void *rx_queue,
 	return nb_rx;
 }
 
-static inline int
-iavf_xmit_cleanup(struct ci_tx_queue *txq)
-{
-	struct ci_tx_entry *sw_ring = txq->sw_ring;
-	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
-	uint16_t nb_tx_desc = txq->nb_tx_desc;
-	uint16_t desc_to_clean_to;
-	uint16_t nb_tx_to_clean;
-
-	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
-
-	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
-	if (desc_to_clean_to >= nb_tx_desc)
-		desc_to_clean_to = (uint16_t)(desc_to_clean_to -
 nb_tx_desc);
-
-	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
-	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &
-			rte_cpu_to_le_64(IAVF_TXD_QW1_DTYPE_MASK)) !=
-
 	rte_cpu_to_le_64(IAVF_TX_DESC_DTYPE_DESC_DONE)) {
-		PMD_TX_LOG(DEBUG, "TX descriptor %4u is not done "
-			   "(port=%d queue=%d)", desc_to_clean_to,
-			   txq->port_id, txq->queue_id);
-		return -1;
-	}
-
-	if (last_desc_cleaned > desc_to_clean_to)
-		nb_tx_to_clean = (uint16_t)((nb_tx_desc - last_desc_cleaned)
+
-							desc_to_clean_to);
-	else
-		nb_tx_to_clean = (uint16_t)(desc_to_clean_to -
-					last_desc_cleaned);
-
-	txd[desc_to_clean_to].cmd_type_offset_bsz = 0;
-
-	txq->last_desc_cleaned = desc_to_clean_to;
-	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + nb_tx_to_clean);
-
-	return 0;
-}
-
 /* Check if the context descriptor is needed for TX offloading */
 static inline uint16_t
 iavf_calc_context_desc(struct rte_mbuf *mb, uint8_t vlan_flag)
@@ -2768,7 +2728,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 
 	/* Check if the descriptor ring needs to be cleaned. */
 	if (txq->nb_tx_free < txq->tx_free_thresh)
-		iavf_xmit_cleanup(txq);
+		ci_tx_xmit_cleanup(txq);
 
 	desc_idx = txq->tx_tail;
drivers/net/intel/iavf/iavf_rxtx.c +2 -2
 	txe = &txe_ring[desc_idx];
@@ -2823,14 +2783,14 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 			txq->port_id, txq->queue_id, desc_idx, desc_idx_last);
 
 		if (nb_desc_required > txq->nb_tx_free) {
-			if (iavf_xmit_cleanup(txq)) {
+			if (ci_tx_xmit_cleanup(txq)) {
 				if (idx == 0)
 					return 0;
 				goto end_of_tx;
 			}
 			if (unlikely(nb_desc_required > txq->tx_rs_thresh)) {
 				while (nb_desc_required > txq->nb_tx_free) {
-					if (iavf_xmit_cleanup(txq)) {
+					if (ci_tx_xmit_cleanup(txq)) {
 						if (idx == 0)
 							return 0;
drivers/net/intel/iavf/iavf_rxtx.c +2 -2
 						goto end_of_tx;
@@ -4300,7 +4260,7 @@ iavf_tx_done_cleanup_full(struct ci_tx_queue *txq,
 	tx_id = txq->tx_tail;
 	tx_last = tx_id;
 
-	if (txq->nb_tx_free == 0 && iavf_xmit_cleanup(txq))
+	if (txq->nb_tx_free == 0 && ci_tx_xmit_cleanup(txq))
 		return 0;
 
 	nb_tx_to_clean = txq->nb_tx_free;
@@ -4332,7 +4292,7 @@ iavf_tx_done_cleanup_full(struct ci_tx_queue *txq,
 			break;
 
 		if (pkt_cnt < free_cnt) {
-			if (iavf_xmit_cleanup(txq))
+			if (ci_tx_xmit_cleanup(txq))
 				break;
 
 			nb_tx_to_clean = txq->nb_tx_free - nb_tx_free_last;
drivers/net/intel/ice/ice_rxtx.c +2 -51
index e3ffbdb587..7a33e1e980 100644
@@ -3023,56 +3023,6 @@ ice_txd_enable_checksum(uint64_t ol_flags,
 	}
 }
 
-static inline int
-ice_xmit_cleanup(struct ci_tx_queue *txq)
-{
-	struct ci_tx_entry *sw_ring = txq->sw_ring;
-	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
-	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
-	uint16_t nb_tx_desc = txq->nb_tx_desc;
-	uint16_t desc_to_clean_to;
-	uint16_t nb_tx_to_clean;
-
-	/* Determine the last descriptor needing to be cleaned */
-	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
-	if (desc_to_clean_to >= nb_tx_desc)
-		desc_to_clean_to = (uint16_t)(desc_to_clean_to -
 nb_tx_desc);
-
-	/* Check to make sure the last descriptor to clean is done */
-	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
-	if (!(txd[desc_to_clean_to].cmd_type_offset_bsz &
-	    rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE))) {
-		PMD_TX_LOG(DEBUG, "TX descriptor %4u is not done "
-			   "(port=%d queue=%d) value=0x%"PRIx64,
-			   desc_to_clean_to,
-			   txq->port_id, txq->queue_id,
-			   txd[desc_to_clean_to].cmd_type_offset_bsz);
-		/* Failed to clean any descriptors */
-		return -1;
-	}
-
-	/* Figure out how many descriptors will be cleaned */
-	if (last_desc_cleaned > desc_to_clean_to)
-		nb_tx_to_clean = (uint16_t)((nb_tx_desc - last_desc_cleaned)
+
-					    desc_to_clean_to);
-	else
-		nb_tx_to_clean = (uint16_t)(desc_to_clean_to -
-					    last_desc_cleaned);
-
-	/* The last descriptor to clean is done, so that means all the
-	 * descriptors from the last descriptor that was cleaned
-	 * up to the last descriptor with the RS bit set
-	 * are done. Only reset the threshold descriptor.
-	 */
-	txd[desc_to_clean_to].cmd_type_offset_bsz = 0;
-
-	/* Update the txq to reflect the last descriptor that was cleaned */
-	txq->last_desc_cleaned = desc_to_clean_to;
-	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + nb_tx_to_clean);
-
-	return 0;
-}
-
 /* Construct the tx flags */
 static inline uint64_t
 ice_build_ctob(uint32_t td_cmd,
@@ -3180,7 +3130,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 
 	/* Check if the descriptor ring needs to be cleaned. */
 	if (txq->nb_tx_free < txq->tx_free_thresh)
-		(void)ice_xmit_cleanup(txq);
+		(void)ci_tx_xmit_cleanup(txq);
 
 	for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
drivers/net/intel/ice/ice_rxtx.c +2 -2
 		tx_pkt = *tx_pkts++;
@@ -3217,14 +3167,14 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 			tx_last = (uint16_t)(tx_last - txq->nb_tx_desc);
 
 		if (nb_used > txq->nb_tx_free) {
-			if (ice_xmit_cleanup(txq) != 0) {
+			if (ci_tx_xmit_cleanup(txq) != 0) {
 				if (nb_tx == 0)
 					return 0;
 				goto end_of_tx;
 			}
 			if (unlikely(nb_used > txq->tx_rs_thresh)) {
 				while (nb_used > txq->nb_tx_free) {
-					if (ice_xmit_cleanup(txq) != 0) {
+					if (ci_tx_xmit_cleanup(txq) != 0) {
 						if (nb_tx == 0)
 							return 0;
drivers/net/intel/ice/ice_rxtx.c +2 -2
 						goto end_of_tx;
@@ -3459,7 +3409,7 @@ ice_tx_done_cleanup_full(struct ci_tx_queue *txq,
 	tx_last = txq->tx_tail;
 	tx_id  = swr_ring[tx_last].next_id;
 
-	if (txq->nb_tx_free == 0 && ice_xmit_cleanup(txq))
+	if (txq->nb_tx_free == 0 && ci_tx_xmit_cleanup(txq))
 		return 0;
 
 	nb_tx_to_clean = txq->nb_tx_free;
@@ -3493,7 +3443,7 @@ ice_tx_done_cleanup_full(struct ci_tx_queue *txq,
 			break;
 
 		if (pkt_cnt < free_cnt) {
-			if (ice_xmit_cleanup(txq))
+			if (ci_tx_xmit_cleanup(txq))
 				break;
 
 			nb_tx_to_clean = txq->nb_tx_free - nb_tx_free_last;
drivers/net/intel/idpf/idpf_common_rxtx.c +2 -41
index 51074bda3a..23666539ab 100644
@@ -1326,46 +1326,6 @@ idpf_dp_singleq_recv_scatter_pkts(void
 *rx_queue, struct rte_mbuf **rx_pkts,
 	return nb_rx;
 }
 
-static inline int
-idpf_xmit_cleanup(struct ci_tx_queue *txq)
-{
-	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
-	struct ci_tx_entry *sw_ring = txq->sw_ring;
-	uint16_t nb_tx_desc = txq->nb_tx_desc;
-	uint16_t desc_to_clean_to;
-	uint16_t nb_tx_to_clean;
-
-	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
-
-	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
-	if (desc_to_clean_to >= nb_tx_desc)
-		desc_to_clean_to = (uint16_t)(desc_to_clean_to -
 nb_tx_desc);
-
-	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
-	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &
-	     rte_cpu_to_le_64(IDPF_TXD_QW1_DTYPE_M)) !=
-	    rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE)) {
-		TX_LOG(DEBUG, "TX descriptor %4u is not done "
-		       "(port=%d queue=%d)", desc_to_clean_to,
-		       txq->port_id, txq->queue_id);
-		return -1;
-	}
-
-	if (last_desc_cleaned > desc_to_clean_to)
-		nb_tx_to_clean = (uint16_t)((nb_tx_desc - last_desc_cleaned)
+
-					    desc_to_clean_to);
-	else
-		nb_tx_to_clean = (uint16_t)(desc_to_clean_to -
-					    last_desc_cleaned);
-
-	txd[desc_to_clean_to].cmd_type_offset_bsz = 0;
-
-	txq->last_desc_cleaned = desc_to_clean_to;
-	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + nb_tx_to_clean);
-
-	return 0;
-}
-
 /* TX function */
 RTE_EXPORT_INTERNAL_SYMBOL(idpf_dp_singleq_xmit_pkts)
 uint16_t
@@ -1404,7 +1364,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct
 rte_mbuf **tx_pkts,
 
 	/* Check if the descriptor ring needs to be cleaned. */
 	if (txq->nb_tx_free < txq->tx_free_thresh)
-		(void)idpf_xmit_cleanup(txq);
+		(void)ci_tx_xmit_cleanup(txq);
 
 	for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
drivers/net/intel/idpf/idpf_common_rxtx.c +2 -2
 		td_cmd = 0;
@@ -1437,14 +1397,14 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 		       txq->port_id, txq->queue_id, tx_id, tx_last);
 
 		if (nb_used > txq->nb_tx_free) {
-			if (idpf_xmit_cleanup(txq) != 0) {
+			if (ci_tx_xmit_cleanup(txq) != 0) {
 				if (nb_tx == 0)
 					return 0;
 				goto end_of_tx;
 			}
 			if (unlikely(nb_used > txq->tx_rs_thresh)) {
 				while (nb_used > txq->nb_tx_free) {
-					if (idpf_xmit_cleanup(txq) != 0) {
+					if (ci_tx_xmit_cleanup(txq) != 0) {
 						if (nb_tx == 0)
 							return 0;

goto end_of_tx;
--
2.51.0

#78 lore raw

Re: [PATCH v3 03/36] net/intel: create common post-Tx cleanup function

Quoted 53 lines · Ciara
Quoted 53 lines

-----Original Message-----
From: Bruce Richardson <[email protected]>
Sent: Friday 30 January 2026 11:42
To: [email protected]
Cc: Richardson, Bruce <[email protected]>; Medvedkin, Vladimir <[email protected]>; Burakov, Anatoly <[email protected]>; Wu, Jingjing <[email protected]>; Shetty, Praveen <[email protected]>
Subject: [PATCH v3 03/36] net/intel: create common post-Tx cleanup function

The code used in ice, iavf, idpf and i40e for doing cleanup of mbufs after they had been transmitted was identical. Therefore deduplicate it by moving to common and remove the driver-specific versions.

---
 drivers/net/intel/common/tx.h             | 53 ++++++++++++++++++++
 drivers/net/intel/i40e/i40e_rxtx.c        | 49 ++----------------
 drivers/net/intel/iavf/iavf_rxtx.c        | 50 ++-----------------
 drivers/net/intel/ice/ice_rxtx.c          | 60 ++---------------------
 drivers/net/intel/idpf/idpf_common_rxtx.c | 46 ++---------------
 5 files changed, 71 insertions(+), 187 deletions(-)
drivers/net/intel/common/tx.h +0 -0
index 8cf63e59ab..a89412c195 100644
@@ -259,6 +259,59 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq,

ci_desc_done_fn desc_done, bool ctx

drivers/net/intel/common/tx.h +19 -0
 	return txq->tx_rs_thresh;
 }
 
+/*
+ * Common transmit descriptor cleanup function for Intel drivers.
+ * Used by ice, i40e, iavf, and idpf drivers.
+ *
+ * Returns:
+ *   0 on success
+ *  -1 if cleanup cannot proceed (descriptors not yet processed by HW)
+ */
+static __rte_always_inline int
+ci_tx_xmit_cleanup(struct ci_tx_queue *txq)
+{
+	struct ci_tx_entry *sw_ring = txq->sw_ring;
+	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
+	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
+	uint16_t nb_tx_desc = txq->nb_tx_desc;
+	uint16_t desc_to_clean_to;
+	uint16_t nb_tx_to_clean;
+
+	/* Determine the last descriptor needing to be cleaned */
Quoted 9 lines

drivers/net/intel/common/tx.h

Quoted 6 lines
drivers/net/intel/common/tx.h +3 -0
+	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
+	if (desc_to_clean_to >= nb_tx_desc)
+		desc_to_clean_to = (uint16_t)(desc_to_clean_to -

nb_tx_desc);

drivers/net/intel/common/tx.h +2 -0
+
+	/* Check to make sure the last descriptor to clean is done */

This comment is similar to the next one. Maybe merge them?

Ack

Quoted 64 lines
Quoted 64 lines
drivers/net/intel/common/tx.h +3 -0
+	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
+
+	/* Check if descriptor is done - all drivers use 0xF as done value in bits

3:0 */

drivers/net/intel/common/tx.h +1 -0
+	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &

rte_cpu_to_le_64(0xFUL)) !=

drivers/net/intel/common/tx.h +11 -0
+			rte_cpu_to_le_64(0xFUL)) {
+		/* Descriptor not yet processed by hardware */
+		return -1;
+	}
+
+	/* Figure out how many descriptors will be cleaned */
+	if (last_desc_cleaned > desc_to_clean_to)
+		nb_tx_to_clean = (uint16_t)((nb_tx_desc - last_desc_cleaned)
+ desc_to_clean_to);
+	else
+		nb_tx_to_clean = (uint16_t)(desc_to_clean_to -

last_desc_cleaned);

drivers/net/intel/common/tx.h +15 -0
+
+	/* The last descriptor to clean is done, so that means all the
+	 * descriptors from the last descriptor that was cleaned
+	 * up to the last descriptor with the RS bit set
+	 * are done. Only reset the threshold descriptor.
+	 */
+	txd[desc_to_clean_to].cmd_type_offset_bsz = 0;
+
+	/* Update the txq to reflect the last descriptor that was cleaned */
+	txq->last_desc_cleaned = desc_to_clean_to;
+	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + nb_tx_to_clean);
+
+	return 0;
+}
+
 static inline void
 ci_txq_release_all_mbufs(struct ci_tx_queue *txq, bool use_ctx)
 {
drivers/net/intel/i40e/i40e_rxtx.c +0 -17
index 210fc0201e..2760e76e99 100644
@@ -384,45 +384,6 @@ i40e_build_ctob(uint32_t td_cmd,
 			((uint64_t)td_tag  <<
 I40E_TXD_QW1_L2TAG1_SHIFT));
 }
 
-static inline int
-i40e_xmit_cleanup(struct ci_tx_queue *txq)
-{
-	struct ci_tx_entry *sw_ring = txq->sw_ring;
-	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
-	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
-	uint16_t nb_tx_desc = txq->nb_tx_desc;
-	uint16_t desc_to_clean_to;
-	uint16_t nb_tx_to_clean;
-
-	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
-	if (desc_to_clean_to >= nb_tx_desc)
-		desc_to_clean_to = (uint16_t)(desc_to_clean_to -
 nb_tx_desc);
-
-	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
-	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &
-			rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=
Quoted 9 lines

drivers/net/intel/i40e/i40e_rxtx.c i40e_build_ctob(uint32_t td_cmd, · line 407

Quoted 5 lines
drivers/net/intel/i40e/i40e_rxtx.c +0 -4
-
 	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE)) {
-		PMD_TX_LOG(DEBUG, "TX descriptor %4u is not done "
-			   "(port=%d queue=%d)", desc_to_clean_to,
-			   txq->port_id, txq->queue_id);

These logs are lost in each of the drivers. I'm not sure if they're terribly helpful though so I think it's fine that they're dropped.

Yes, I don't think they are that helpful either. However, I was in discussion with Anatoly about how we might look to do logging from the common Intel code, so we may look to add them back in future if we see the need.

/Bruce

#79 lore raw

PATCH v3 4/36 net/intel: consolidate definitions for Tx desc fields

In reply to Bruce Richardson

The offsets of the various fields within the Tx descriptors are common for i40e, iavf, ice and idpf, so put a single set of defines in tx.h and use those throughout all drivers. (NOTE: there was a small difference in mask of CMD field between drivers depending on whether reserved fields or not were included. Those can be ignored as those bits are unused in the drivers for which they are reserved). Similarly, the various flag fields, such as End-of-packet (EOP) and Report-status (RS) are the same, as are offload definitions so consolidate them.

Original definitions are in base code, and are left in place because of that, but are unused.

---
 drivers/net/intel/common/tx.h                 |  64 +++++++-
 drivers/net/intel/i40e/i40e_fdir.c            |  24 +--
 drivers/net/intel/i40e/i40e_rxtx.c            |  92 ++++++------
 drivers/net/intel/i40e/i40e_rxtx.h            |  17 +--
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |  11 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c   |  22 ++-
 drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c |  38 ++---
 drivers/net/intel/i40e/i40e_rxtx_vec_common.h |   4 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |  11 +-
 drivers/net/intel/iavf/iavf_rxtx.c            |  68 +++++----
 drivers/net/intel/iavf/iavf_rxtx.h            |  20 +--
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   |  41 ++----
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c |  80 ++++------
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h |  34 ++---
 drivers/net/intel/ice/ice_dcf_ethdev.c        |   2 +-
 drivers/net/intel/ice/ice_rxtx.c              | 137 ++++++++----------
 drivers/net/intel/ice/ice_rxtx.h              |  15 +-
 drivers/net/intel/ice/ice_rxtx_vec_avx2.c     |  41 ++----
 drivers/net/intel/ice/ice_rxtx_vec_avx512.c   |  39 ++---
 drivers/net/intel/ice/ice_rxtx_vec_common.h   |  41 +++---
 drivers/net/intel/idpf/idpf_common_rxtx.c     |  22 +--
 drivers/net/intel/idpf/idpf_common_rxtx.h     |  12 --
 .../net/intel/idpf/idpf_common_rxtx_avx2.c    |  41 ++----
 .../net/intel/idpf/idpf_common_rxtx_avx512.c  |  41 ++----
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |   4 +-
 25 files changed, 408 insertions(+), 513 deletions(-)
drivers/net/intel/common/tx.h +62 -2
index a89412c195..03245d4fba 100644
@@ -10,6 +10,66 @@
 #include <rte_ethdev.h>
 #include <rte_vect.h>
 
+/* Common TX Descriptor QW1 Field Definitions */
+#define CI_TXD_QW1_DTYPE_S      0
+#define CI_TXD_QW1_DTYPE_M      (0xFUL << CI_TXD_QW1_DTYPE_S)
+#define CI_TXD_QW1_CMD_S        4
+#define CI_TXD_QW1_CMD_M        (0xFFFUL << CI_TXD_QW1_CMD_S)
+#define CI_TXD_QW1_OFFSET_S     16
+#define CI_TXD_QW1_OFFSET_M     (0x3FFFFULL << CI_TXD_QW1_OFFSET_S)
+#define CI_TXD_QW1_TX_BUF_SZ_S  34
+#define CI_TXD_QW1_TX_BUF_SZ_M  (0x3FFFULL << CI_TXD_QW1_TX_BUF_SZ_S)
+#define CI_TXD_QW1_L2TAG1_S     48
+#define CI_TXD_QW1_L2TAG1_M     (0xFFFFULL << CI_TXD_QW1_L2TAG1_S)
+
+/* Common Descriptor Types */
+#define CI_TX_DESC_DTYPE_DATA           0x0
+#define CI_TX_DESC_DTYPE_CTX            0x1
+#define CI_TX_DESC_DTYPE_DESC_DONE      0xF
+
+/* Common TX Descriptor Command Flags */
+#define CI_TX_DESC_CMD_EOP              0x0001
+#define CI_TX_DESC_CMD_RS               0x0002
+#define CI_TX_DESC_CMD_ICRC             0x0004
+#define CI_TX_DESC_CMD_IL2TAG1          0x0008
+#define CI_TX_DESC_CMD_DUMMY            0x0010
+#define CI_TX_DESC_CMD_IIPT_IPV6        0x0020
+#define CI_TX_DESC_CMD_IIPT_IPV4        0x0040
+#define CI_TX_DESC_CMD_IIPT_IPV4_CSUM   0x0060
+#define CI_TX_DESC_CMD_L4T_EOFT_TCP     0x0100
+#define CI_TX_DESC_CMD_L4T_EOFT_SCTP    0x0200
+#define CI_TX_DESC_CMD_L4T_EOFT_UDP     0x0300
+
+/* Common TX Context Descriptor Commands */
+#define CI_TX_CTX_DESC_TSO              0x01
+#define CI_TX_CTX_DESC_TSYN             0x02
+#define CI_TX_CTX_DESC_IL2TAG2          0x04
+
+/* Common TX Descriptor Length Field Shifts */
+#define CI_TX_DESC_LEN_MACLEN_S         0  /* 7 BITS */
+#define CI_TX_DESC_LEN_IPLEN_S          7  /* 7 BITS */
+#define CI_TX_DESC_LEN_L4_LEN_S         14 /* 4 BITS */
+
+/* Common maximum data per TX descriptor */
+#define CI_MAX_DATA_PER_TXD     (CI_TXD_QW1_TX_BUF_SZ_M >> CI_TXD_QW1_TX_BUF_SZ_S)
+
+/**
+ * Common TX offload union for Intel drivers.
+ * Supports both basic offloads (l2_len, l3_len, l4_len, tso_segsz) and
+ * extended offloads (outer_l2_len, outer_l3_len) for tunneling support.
+ */
+union ci_tx_offload {
+	uint64_t data;
+	struct {
+		uint64_t l2_len:7;        /**< L2 (MAC) Header Length. */
+		uint64_t l3_len:9;        /**< L3 (IP) Header Length. */
+		uint64_t l4_len:8;        /**< L4 Header Length. */
+		uint64_t tso_segsz:16;    /**< TCP TSO segment size */
+		uint64_t outer_l2_len:8;  /**< outer L2 Header Length */
+		uint64_t outer_l3_len:16; /**< outer L3 Header Length */
+	};
+};
+
 /*
  * Structure of a 16-byte Tx descriptor common across i40e, ice, iavf and idpf drivers
  */
@@ -286,8 +346,8 @@ ci_tx_xmit_cleanup(struct ci_tx_queue *txq)
 	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
 
 	/* Check if descriptor is done - all drivers use 0xF as done value in bits 3:0 */
-	if ((txd[desc_to_clean_to].cmd_type_offset_bsz & rte_cpu_to_le_64(0xFUL)) !=
-			rte_cpu_to_le_64(0xFUL)) {
+	if ((txd[desc_to_clean_to].cmd_type_offset_bsz & rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) !=
+			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE)) {
 		/* Descriptor not yet processed by hardware */
 		return -1;
 	}
drivers/net/intel/i40e/i40e_fdir.c +12 -12
index 8a01aec0e2..3b099d5a9e 100644
@@ -916,11 +916,11 @@ i40e_build_ctob(uint32_t td_cmd,
 		unsigned int size,
 		uint32_t td_tag)
 {
-	return rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DATA |
-			((uint64_t)td_cmd  << I40E_TXD_QW1_CMD_SHIFT) |
-			((uint64_t)td_offset << I40E_TXD_QW1_OFFSET_SHIFT) |
-			((uint64_t)size  << I40E_TXD_QW1_TX_BUF_SZ_SHIFT) |
-			((uint64_t)td_tag  << I40E_TXD_QW1_L2TAG1_SHIFT));
+	return rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DATA |
+			((uint64_t)td_cmd  << CI_TXD_QW1_CMD_S) |
+			((uint64_t)td_offset << CI_TXD_QW1_OFFSET_S) |
+			((uint64_t)size  << CI_TXD_QW1_TX_BUF_SZ_S) |
+			((uint64_t)td_tag  << CI_TXD_QW1_L2TAG1_S));
 }
 
 /*
@@ -1384,8 +1384,8 @@ i40e_find_available_buffer(struct rte_eth_dev *dev)
 
 		do {
 			if ((tmp_txdp->cmd_type_offset_bsz &
-					rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
-					rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
+					rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) ==
+					rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE))
 				fdir_info->txq_available_buf_count++;
 			else
 				break;
@@ -1710,9 +1710,9 @@ i40e_flow_fdir_filter_programming(struct i40e_pf *pf,
 	txdp = &txq->ci_tx_ring[txq->tx_tail + 1];
 	txdp->buffer_addr = rte_cpu_to_le_64(pf->fdir.dma_addr[txq->tx_tail >> 1]);
 
-	td_cmd = I40E_TX_DESC_CMD_EOP |
-		 I40E_TX_DESC_CMD_RS  |
-		 I40E_TX_DESC_CMD_DUMMY;
+	td_cmd = CI_TX_DESC_CMD_EOP |
+		 CI_TX_DESC_CMD_RS  |
+		 CI_TX_DESC_CMD_DUMMY;
 
 	txdp->cmd_type_offset_bsz =
 		i40e_build_ctob(td_cmd, 0, I40E_FDIR_PKT_LEN, 0);
@@ -1731,8 +1731,8 @@ i40e_flow_fdir_filter_programming(struct i40e_pf *pf,
 	if (wait_status) {
 		for (i = 0; i < I40E_FDIR_MAX_WAIT_US; i++) {
 			if ((txdp->cmd_type_offset_bsz &
-					rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
-					rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
+					rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) ==
+					rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE))
 				break;
 			rte_delay_us(1);
 		}
drivers/net/intel/i40e/i40e_rxtx.c +43 -49

245 lines not on this page · raw message

drivers/net/intel/i40e/i40e_rxtx.h +2 -15
index ed173d8f17..307ffa3049 100644
@@ -47,8 +47,8 @@
 #define I40E_RX_DESC_EXT_STATUS_FLEXBL_MASK   0x03
 #define I40E_RX_DESC_EXT_STATUS_FLEXBL_FLEX   0x01
 
-#define I40E_TD_CMD (I40E_TX_DESC_CMD_ICRC |\
-		     I40E_TX_DESC_CMD_EOP)
+#define I40E_TD_CMD (CI_TX_DESC_CMD_ICRC |\
+		     CI_TX_DESC_CMD_EOP)
 
 enum i40e_header_split_mode {
 	i40e_header_split_none = 0,
@@ -110,19 +110,6 @@ enum i40e_header_split_mode {
 
 #define I40E_TX_VECTOR_OFFLOADS RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE
 
-/** Offload features */
-union i40e_tx_offload {
-	uint64_t data;
-	struct {
-		uint64_t l2_len:7; /**< L2 (MAC) Header Length. */
-		uint64_t l3_len:9; /**< L3 (IP) Header Length. */
-		uint64_t l4_len:8; /**< L4 Header Length. */
-		uint64_t tso_segsz:16; /**< TCP TSO segment size */
-		uint64_t outer_l2_len:8; /**< outer L2 Header Length */
-		uint64_t outer_l3_len:16; /**< outer L3 Header Length */
-	};
-};
-
 int i40e_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int i40e_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int i40e_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +5 -6
index 81e9e2bc0b..4c36748d94 100644
@@ -449,9 +449,9 @@ static inline void
 vtx1(volatile struct ci_tx_desc *txdp,
 	struct rte_mbuf *pkt, uint64_t flags)
 {
-	uint64_t high_qw = (I40E_TX_DESC_DTYPE_DATA |
-		((uint64_t)flags  << I40E_TXD_QW1_CMD_SHIFT) |
-		((uint64_t)pkt->data_len << I40E_TXD_QW1_TX_BUF_SZ_SHIFT));
+	uint64_t high_qw = (CI_TX_DESC_DTYPE_DATA |
+		((uint64_t)flags << CI_TXD_QW1_CMD_S) |
+		((uint64_t)pkt->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
 
 	__vector unsigned long descriptor = (__vector unsigned long){
 		pkt->buf_iova + pkt->data_off, high_qw};
@@ -477,7 +477,7 @@ i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = I40E_TD_CMD;
-	uint64_t rs = I40E_TX_DESC_CMD_RS | I40E_TD_CMD;
+	uint64_t rs = CI_TX_DESC_CMD_RS | I40E_TD_CMD;
 	int i;
 
 	if (txq->nb_tx_free < txq->tx_free_thresh)
@@ -520,8 +520,7 @@ i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
 		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
-			rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
-						I40E_TXD_QW1_CMD_SHIFT);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS) << CI_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 	}
drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +10 -12
index f054bd41bf..502a1842c6 100644
@@ -684,9 +684,9 @@ static inline void
 vtx1(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf *pkt, uint64_t flags)
 {
-	uint64_t high_qw = (I40E_TX_DESC_DTYPE_DATA |
-			((uint64_t)flags  << I40E_TXD_QW1_CMD_SHIFT) |
-			((uint64_t)pkt->data_len << I40E_TXD_QW1_TX_BUF_SZ_SHIFT));
+	uint64_t high_qw = (CI_TX_DESC_DTYPE_DATA |
+			((uint64_t)flags << CI_TXD_QW1_CMD_S) |
+			((uint64_t)pkt->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
 
 	__m128i descriptor = _mm_set_epi64x(high_qw,
 				pkt->buf_iova + pkt->data_off);
@@ -697,8 +697,7 @@ static inline void
 vtx(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
-	const uint64_t hi_qw_tmpl = (I40E_TX_DESC_DTYPE_DATA |
-			((uint64_t)flags  << I40E_TXD_QW1_CMD_SHIFT));
+	const uint64_t hi_qw_tmpl = (CI_TX_DESC_DTYPE_DATA | (flags << CI_TXD_QW1_CMD_S));
 
 	/* if unaligned on 32-bit boundary, do one to align */
 	if (((uintptr_t)txdp & 0x1F) != 0 && nb_pkts != 0) {
@@ -709,13 +708,13 @@ vtx(volatile struct ci_tx_desc *txdp,
 	/* do two at a time while possible, in bursts */
 	for (; nb_pkts > 3; txdp += 4, pkt += 4, nb_pkts -= 4) {
 		uint64_t hi_qw3 = hi_qw_tmpl |
-				((uint64_t)pkt[3]->data_len << I40E_TXD_QW1_TX_BUF_SZ_SHIFT);
+				((uint64_t)pkt[3]->data_len << CI_TXD_QW1_TX_BUF_SZ_S);
 		uint64_t hi_qw2 = hi_qw_tmpl |
-				((uint64_t)pkt[2]->data_len << I40E_TXD_QW1_TX_BUF_SZ_SHIFT);
+				((uint64_t)pkt[2]->data_len << CI_TXD_QW1_TX_BUF_SZ_S);
 		uint64_t hi_qw1 = hi_qw_tmpl |
-				((uint64_t)pkt[1]->data_len << I40E_TXD_QW1_TX_BUF_SZ_SHIFT);
+				((uint64_t)pkt[1]->data_len << CI_TXD_QW1_TX_BUF_SZ_S);
 		uint64_t hi_qw0 = hi_qw_tmpl |
-				((uint64_t)pkt[0]->data_len << I40E_TXD_QW1_TX_BUF_SZ_SHIFT);
+				((uint64_t)pkt[0]->data_len << CI_TXD_QW1_TX_BUF_SZ_S);
 
 		__m256i desc2_3 = _mm256_set_epi64x(
 				hi_qw3, pkt[3]->buf_iova + pkt[3]->data_off,
@@ -743,7 +742,7 @@ i40e_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = I40E_TD_CMD;
-	uint64_t rs = I40E_TX_DESC_CMD_RS | I40E_TD_CMD;
+	uint64_t rs = CI_TX_DESC_CMD_RS | I40E_TD_CMD;
 
 	if (txq->nb_tx_free < txq->tx_free_thresh)
 		ci_tx_free_bufs_vec(txq, i40e_tx_desc_done, false);
@@ -785,8 +784,7 @@ i40e_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
 		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
-			rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
-						I40E_TXD_QW1_CMD_SHIFT);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS) << CI_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 	}
drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c +14 -24
index 9a967faeee..d48ff9f51e 100644
@@ -752,9 +752,9 @@ i40e_recv_scattered_pkts_vec_avx512(void *rx_queue,
 static inline void
 vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt, uint64_t flags)
 {
-	uint64_t high_qw = (I40E_TX_DESC_DTYPE_DATA |
-		((uint64_t)flags  << I40E_TXD_QW1_CMD_SHIFT) |
-		((uint64_t)pkt->data_len << I40E_TXD_QW1_TX_BUF_SZ_SHIFT));
+	uint64_t high_qw = (CI_TX_DESC_DTYPE_DATA |
+		((uint64_t)flags << CI_TXD_QW1_CMD_S) |
+		((uint64_t)pkt->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
 
 	__m128i descriptor = _mm_set_epi64x(high_qw,
 				pkt->buf_iova + pkt->data_off);
@@ -765,26 +765,17 @@ static inline void
 vtx(volatile struct ci_tx_desc *txdp,
 	struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
-	const uint64_t hi_qw_tmpl = (I40E_TX_DESC_DTYPE_DATA |
-			((uint64_t)flags  << I40E_TXD_QW1_CMD_SHIFT));
+	const uint64_t hi_qw_tmpl = (CI_TX_DESC_DTYPE_DATA | (flags << CI_TXD_QW1_CMD_S));
 
 	for (; nb_pkts > 3; txdp += 4, pkt += 4, nb_pkts -= 4) {
-		uint64_t hi_qw3 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[3]->data_len <<
-			 I40E_TXD_QW1_TX_BUF_SZ_SHIFT);
-		uint64_t hi_qw2 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[2]->data_len <<
-			 I40E_TXD_QW1_TX_BUF_SZ_SHIFT);
-		uint64_t hi_qw1 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[1]->data_len <<
-			 I40E_TXD_QW1_TX_BUF_SZ_SHIFT);
-		uint64_t hi_qw0 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[0]->data_len <<
-			 I40E_TXD_QW1_TX_BUF_SZ_SHIFT);
+		uint64_t hi_qw3 = hi_qw_tmpl |
+			((uint64_t)pkt[3]->data_len << CI_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw2 = hi_qw_tmpl |
+			((uint64_t)pkt[2]->data_len << CI_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw1 = hi_qw_tmpl |
+			((uint64_t)pkt[1]->data_len << CI_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw0 = hi_qw_tmpl |
+			((uint64_t)pkt[0]->data_len << CI_TXD_QW1_TX_BUF_SZ_S);
 
 		__m512i desc0_3 =
 			_mm512_set_epi64
@@ -811,7 +802,7 @@ i40e_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = I40E_TD_CMD;
-	uint64_t rs = I40E_TX_DESC_CMD_RS | I40E_TD_CMD;
+	uint64_t rs = CI_TX_DESC_CMD_RS | I40E_TD_CMD;
 
 	if (txq->nb_tx_free < txq->tx_free_thresh)
 		ci_tx_free_bufs_vec(txq, i40e_tx_desc_done, false);
@@ -854,8 +845,7 @@ i40e_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
 		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
-			rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
-						I40E_TXD_QW1_CMD_SHIFT);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS) << CI_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 	}
drivers/net/intel/i40e/i40e_rxtx_vec_common.h +2 -2
index 1fd7fc75bf..292a39501e 100644
@@ -16,8 +16,8 @@ static inline int
 i40e_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
 {
 	return (txq->ci_tx_ring[idx].cmd_type_offset_bsz &
-			rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
-				rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE);
+			rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) ==
+				rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 }
 
 static inline void
drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +5 -6
index 0b95152232..be4c64942e 100644
@@ -600,9 +600,9 @@ static inline void
 vtx1(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf *pkt, uint64_t flags)
 {
-	uint64_t high_qw = (I40E_TX_DESC_DTYPE_DATA |
-			((uint64_t)flags  << I40E_TXD_QW1_CMD_SHIFT) |
-			((uint64_t)pkt->data_len << I40E_TXD_QW1_TX_BUF_SZ_SHIFT));
+	uint64_t high_qw = (CI_TX_DESC_DTYPE_DATA |
+			((uint64_t)flags << CI_TXD_QW1_CMD_S) |
+			((uint64_t)pkt->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
 
 	uint64x2_t descriptor = {pkt->buf_iova + pkt->data_off, high_qw};
 	vst1q_u64(RTE_CAST_PTR(uint64_t *, txdp), descriptor);
@@ -627,7 +627,7 @@ i40e_xmit_fixed_burst_vec(void *__rte_restrict tx_queue,
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = I40E_TD_CMD;
-	uint64_t rs = I40E_TX_DESC_CMD_RS | I40E_TD_CMD;
+	uint64_t rs = CI_TX_DESC_CMD_RS | I40E_TD_CMD;
 	int i;
 
 	if (txq->nb_tx_free < txq->tx_free_thresh)
@@ -669,8 +669,7 @@ i40e_xmit_fixed_burst_vec(void *__rte_restrict tx_queue,
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
 		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
-			rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
-						I40E_TXD_QW1_CMD_SHIFT);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS) << CI_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 	}
drivers/net/intel/iavf/iavf_rxtx.c +33 -35

168 lines not on this page · raw message

drivers/net/intel/iavf/iavf_rxtx.h +2 -18
index dd6d884fc1..395d97b4ee 100644
@@ -162,10 +162,6 @@
 #define IAVF_TX_OFFLOAD_NOTSUP_MASK \
 		(RTE_MBUF_F_TX_OFFLOAD_MASK ^ IAVF_TX_OFFLOAD_MASK)
 
-/* HW requires that TX buffer size ranges from 1B up to (16K-1)B. */
-#define IAVF_MAX_DATA_PER_TXD \
-	(IAVF_TXD_QW1_TX_BUF_SZ_MASK >> IAVF_TXD_QW1_TX_BUF_SZ_SHIFT)
-
 #define IAVF_TX_LLDP_DYNFIELD "intel_pmd_dynfield_tx_lldp"
 #define IAVF_CHECK_TX_LLDP(m) \
 	((rte_pmd_iavf_tx_lldp_dynfield_offset > 0) && \
@@ -195,18 +191,6 @@ struct iavf_rx_queue_stats {
 	struct iavf_ipsec_crypto_stats ipsec_crypto;
 };
 
-/* Offload features */
-union iavf_tx_offload {
-	uint64_t data;
-	struct {
-		uint64_t l2_len:7; /* L2 (MAC) Header Length. */
-		uint64_t l3_len:9; /* L3 (IP) Header Length. */
-		uint64_t l4_len:8; /* L4 Header Length. */
-		uint64_t tso_segsz:16; /* TCP TSO segment size */
-		/* uint64_t unused : 24; */
-	};
-};
-
 /* Rx Flex Descriptor
  * RxDID Profile ID 16-21
  * Flex-field 0: RSS hash lower 16-bits
@@ -409,7 +393,7 @@ enum iavf_rx_flex_desc_ipsec_crypto_status {
 
 
 #define IAVF_TXD_DATA_QW1_DTYPE_SHIFT	(0)
-#define IAVF_TXD_DATA_QW1_DTYPE_MASK	(0xFUL << IAVF_TXD_QW1_DTYPE_SHIFT)
+#define IAVF_TXD_DATA_QW1_DTYPE_MASK	(0xFUL << CI_TXD_QW1_DTYPE_S)
 
 #define IAVF_TXD_DATA_QW1_CMD_SHIFT	(4)
 #define IAVF_TXD_DATA_QW1_CMD_MASK	(0x3FFUL << IAVF_TXD_DATA_QW1_CMD_SHIFT)
@@ -686,7 +670,7 @@ void iavf_dump_tx_descriptor(const struct ci_tx_queue *txq,
 		rte_le_to_cpu_64(tx_desc->cmd_type_offset_bsz &
 			rte_cpu_to_le_64(IAVF_TXD_DATA_QW1_DTYPE_MASK));
 	switch (type) {
-	case IAVF_TX_DESC_DTYPE_DATA:
+	case CI_TX_DESC_DTYPE_DATA:
 		name = "Tx_data_desc";
 		break;
 	case IAVF_TX_DESC_DTYPE_CONTEXT:
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +15 -26

77 lines not on this page · raw message

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +30 -50

171 lines not on this page · raw message

drivers/net/intel/iavf/iavf_rxtx_vec_common.h +16 -18
index 1832b76f89..1538a44892 100644
@@ -15,8 +15,8 @@ static inline int
 iavf_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
 {
 	return (txq->ci_tx_ring[idx].cmd_type_offset_bsz &
-			rte_cpu_to_le_64(IAVF_TXD_QW1_DTYPE_MASK)) ==
-				rte_cpu_to_le_64(IAVF_TX_DESC_DTYPE_DESC_DONE);
+			rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) ==
+				rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 }
 
 static inline void
@@ -147,26 +147,26 @@ iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt,
 	/* Set MACLEN */
 	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK)
 		td_offset |= (tx_pkt->outer_l2_len >> 1)
-			<< IAVF_TX_DESC_LENGTH_MACLEN_SHIFT;
+			<< CI_TX_DESC_LEN_MACLEN_S;
 	else
 		td_offset |= (tx_pkt->l2_len >> 1)
-			<< IAVF_TX_DESC_LENGTH_MACLEN_SHIFT;
+			<< CI_TX_DESC_LEN_MACLEN_S;
 
 	/* Enable L3 checksum offloads */
 	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
 		if (ol_flags & RTE_MBUF_F_TX_IPV4) {
-			td_cmd |= IAVF_TX_DESC_CMD_IIPT_IPV4_CSUM;
+			td_cmd |= CI_TX_DESC_CMD_IIPT_IPV4_CSUM;
 			td_offset |= (tx_pkt->l3_len >> 2) <<
-				     IAVF_TX_DESC_LENGTH_IPLEN_SHIFT;
+				     CI_TX_DESC_LEN_IPLEN_S;
 		}
 	} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
-		td_cmd |= IAVF_TX_DESC_CMD_IIPT_IPV4;
+		td_cmd |= CI_TX_DESC_CMD_IIPT_IPV4;
 		td_offset |= (tx_pkt->l3_len >> 2) <<
-			     IAVF_TX_DESC_LENGTH_IPLEN_SHIFT;
+			     CI_TX_DESC_LEN_IPLEN_S;
 	} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
-		td_cmd |= IAVF_TX_DESC_CMD_IIPT_IPV6;
+		td_cmd |= CI_TX_DESC_CMD_IIPT_IPV6;
 		td_offset |= (tx_pkt->l3_len >> 2) <<
-			     IAVF_TX_DESC_LENGTH_IPLEN_SHIFT;
+			     CI_TX_DESC_LEN_IPLEN_S;
 	}
 
 	/* Enable L4 checksum offloads */
@@ -190,7 +190,7 @@ iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt,
 		break;
 	}
 
-	*txd_hi |= ((uint64_t)td_offset) << IAVF_TXD_QW1_OFFSET_SHIFT;
+	*txd_hi |= ((uint64_t)td_offset) << CI_TXD_QW1_OFFSET_S;
 #endif
 
 #ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
@@ -198,17 +198,15 @@ iavf_txd_enable_offload(__rte_unused struct rte_mbuf *tx_pkt,
 		td_cmd |= IAVF_TX_DESC_CMD_IL2TAG1;
 		/* vlan_flag specifies outer tag location for QinQ. */
 		if (vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1)
-			*txd_hi |= ((uint64_t)tx_pkt->vlan_tci_outer <<
-					IAVF_TXD_QW1_L2TAG1_SHIFT);
+			*txd_hi |= ((uint64_t)tx_pkt->vlan_tci_outer << CI_TXD_QW1_L2TAG1_S);
 		else
-			*txd_hi |= ((uint64_t)tx_pkt->vlan_tci <<
-					IAVF_TXD_QW1_L2TAG1_SHIFT);
+			*txd_hi |= ((uint64_t)tx_pkt->vlan_tci << CI_TXD_QW1_L2TAG1_S);
 	} else if (ol_flags & RTE_MBUF_F_TX_VLAN && vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1) {
-		td_cmd |= IAVF_TX_DESC_CMD_IL2TAG1;
-		*txd_hi |= ((uint64_t)tx_pkt->vlan_tci << IAVF_TXD_QW1_L2TAG1_SHIFT);
+		td_cmd |= CI_TX_DESC_CMD_IL2TAG1;
+		*txd_hi |= ((uint64_t)tx_pkt->vlan_tci << CI_TXD_QW1_L2TAG1_S);
 	}
 #endif
 
-	*txd_hi |= ((uint64_t)td_cmd) << IAVF_TXD_QW1_CMD_SHIFT;
+	*txd_hi |= ((uint64_t)td_cmd) << CI_TXD_QW1_CMD_S;
 }
 #endif
drivers/net/intel/ice/ice_dcf_ethdev.c +1 -1
index 5f537b4c12..4ceecc15c6 100644
@@ -406,7 +406,7 @@ reset_tx_queue(struct ci_tx_queue *txq)
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
 		txq->ci_tx_ring[i].cmd_type_offset_bsz =
-			rte_cpu_to_le_64(IAVF_TX_DESC_DTYPE_DESC_DONE);
+			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
 		txe[i].last_id = i;
 		txe[prev].next_id = i;
drivers/net/intel/ice/ice_rxtx.c +63 -74

317 lines not on this page · raw message

drivers/net/intel/ice/ice_rxtx.h +1 -14
index c524e9f756..cd5fa93d1c 100644
@@ -46,7 +46,7 @@
 
 #define ICE_SUPPORT_CHAIN_NUM 5
 
-#define ICE_TD_CMD                      ICE_TX_DESC_CMD_EOP
+#define ICE_TD_CMD                      CI_TX_DESC_CMD_EOP
 
 #define ICE_VPMD_RX_BURST            CI_VPMD_RX_BURST
 #define ICE_VPMD_TX_BURST            32
@@ -169,19 +169,6 @@ struct ice_txtime {
 	const struct rte_memzone *ts_mz;
 };
 
-/* Offload features */
-union ice_tx_offload {
-	uint64_t data;
-	struct {
-		uint64_t l2_len:7; /* L2 (MAC) Header Length. */
-		uint64_t l3_len:9; /* L3 (IP) Header Length. */
-		uint64_t l4_len:8; /* L4 Header Length. */
-		uint64_t tso_segsz:16; /* TCP TSO segment size */
-		uint64_t outer_l2_len:8; /* outer L2 Header Length */
-		uint64_t outer_l3_len:16; /* outer L3 Header Length */
-	};
-};
-
 /* Rx Flex Descriptor for Comms Package Profile
  * RxDID Profile ID 22 (swap Hash and FlowID)
  * Flex-field 0: Flow ID lower 16-bits
drivers/net/intel/ice/ice_rxtx_vec_avx2.c +15 -26

78 lines not on this page · raw message

drivers/net/intel/ice/ice_rxtx_vec_avx512.c +14 -25
index d42f41461f..e64b6e227b 100644
@@ -850,10 +850,9 @@ static __rte_always_inline void
 ice_vtx1(volatile struct ci_tx_desc *txdp,
 	 struct rte_mbuf *pkt, uint64_t flags, bool do_offload)
 {
-	uint64_t high_qw =
-		(ICE_TX_DESC_DTYPE_DATA |
-		 ((uint64_t)flags  << ICE_TXD_QW1_CMD_S) |
-		 ((uint64_t)pkt->data_len << ICE_TXD_QW1_TX_BUF_SZ_S));
+	uint64_t high_qw = (CI_TX_DESC_DTYPE_DATA |
+		 ((uint64_t)flags << CI_TXD_QW1_CMD_S) |
+		 ((uint64_t)pkt->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
 
 	if (do_offload)
 		ice_txd_enable_offload(pkt, &high_qw);
@@ -866,32 +865,23 @@ static __rte_always_inline void
 ice_vtx(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkt,
 	uint16_t nb_pkts,  uint64_t flags, bool do_offload)
 {
-	const uint64_t hi_qw_tmpl = (ICE_TX_DESC_DTYPE_DATA |
-			((uint64_t)flags  << ICE_TXD_QW1_CMD_S));
+	const uint64_t hi_qw_tmpl = (CI_TX_DESC_DTYPE_DATA | (flags << CI_TXD_QW1_CMD_S));
 
 	for (; nb_pkts > 3; txdp += 4, pkt += 4, nb_pkts -= 4) {
-		uint64_t hi_qw3 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[3]->data_len <<
-			 ICE_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw3 = hi_qw_tmpl |
+			((uint64_t)pkt[3]->data_len << CI_TXD_QW1_TX_BUF_SZ_S);
 		if (do_offload)
 			ice_txd_enable_offload(pkt[3], &hi_qw3);
-		uint64_t hi_qw2 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[2]->data_len <<
-			 ICE_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw2 = hi_qw_tmpl |
+			((uint64_t)pkt[2]->data_len << CI_TXD_QW1_TX_BUF_SZ_S);
 		if (do_offload)
 			ice_txd_enable_offload(pkt[2], &hi_qw2);
-		uint64_t hi_qw1 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[1]->data_len <<
-			 ICE_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw1 = hi_qw_tmpl |
+			((uint64_t)pkt[1]->data_len << CI_TXD_QW1_TX_BUF_SZ_S);
 		if (do_offload)
 			ice_txd_enable_offload(pkt[1], &hi_qw1);
-		uint64_t hi_qw0 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[0]->data_len <<
-			 ICE_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw0 = hi_qw_tmpl |
+			((uint64_t)pkt[0]->data_len << CI_TXD_QW1_TX_BUF_SZ_S);
 		if (do_offload)
 			ice_txd_enable_offload(pkt[0], &hi_qw0);
 
@@ -920,7 +910,7 @@ ice_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = ICE_TD_CMD;
-	uint64_t rs = ICE_TX_DESC_CMD_RS | ICE_TD_CMD;
+	uint64_t rs = CI_TX_DESC_CMD_RS | ICE_TD_CMD;
 
 	/* cross rx_thresh boundary is not allowed */
 	nb_pkts = RTE_MIN(nb_pkts, txq->tx_rs_thresh);
@@ -966,8 +956,7 @@ ice_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
 		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
-			rte_cpu_to_le_64(((uint64_t)ICE_TX_DESC_CMD_RS) <<
-					 ICE_TXD_QW1_CMD_S);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS) << CI_TXD_QW1_CMD_S);
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 	}
drivers/net/intel/ice/ice_rxtx_vec_common.h +20 -21

81 lines not on this page · raw message

drivers/net/intel/idpf/idpf_common_rxtx.c +11 -11
index 23666539ab..587871b54a 100644
@@ -271,7 +271,7 @@ idpf_qc_single_tx_queue_reset(struct ci_tx_queue *txq)
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
 		txq->ci_tx_ring[i].cmd_type_offset_bsz =
-			rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE);
+			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
 		txe[i].last_id = i;
 		txe[prev].next_id = i;
@@ -849,7 +849,7 @@ idpf_calc_context_desc(uint64_t flags)
  */
 static inline void
 idpf_set_splitq_tso_ctx(struct rte_mbuf *mbuf,
-			union idpf_tx_offload tx_offload,
+			union ci_tx_offload tx_offload,
 			volatile union idpf_flex_tx_ctx_desc *ctx_desc)
 {
 	uint16_t cmd_dtype;
@@ -887,7 +887,7 @@ idpf_dp_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	volatile struct idpf_flex_tx_sched_desc *txr;
 	volatile struct idpf_flex_tx_sched_desc *txd;
 	struct ci_tx_entry *sw_ring;
-	union idpf_tx_offload tx_offload = {0};
+	union ci_tx_offload tx_offload = {0};
 	struct ci_tx_entry *txe, *txn;
 	uint16_t nb_used, tx_id, sw_id;
 	struct rte_mbuf *tx_pkt;
@@ -1334,7 +1334,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 {
 	volatile struct ci_tx_desc *txd;
 	volatile struct ci_tx_desc *txr;
-	union idpf_tx_offload tx_offload = {0};
+	union ci_tx_offload tx_offload = {0};
 	struct ci_tx_entry *txe, *txn;
 	struct ci_tx_entry *sw_ring;
 	struct ci_tx_queue *txq;
@@ -1452,10 +1452,10 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			slen = m_seg->data_len;
 			buf_dma_addr = rte_mbuf_data_iova(m_seg);
 			txd->buffer_addr = rte_cpu_to_le_64(buf_dma_addr);
-			txd->cmd_type_offset_bsz = rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DATA |
-				((uint64_t)td_cmd  << IDPF_TXD_QW1_CMD_S) |
-				((uint64_t)td_offset << IDPF_TXD_QW1_OFFSET_S) |
-				((uint64_t)slen << IDPF_TXD_QW1_TX_BUF_SZ_S));
+			txd->cmd_type_offset_bsz = rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DATA |
+				((uint64_t)td_cmd  << CI_TXD_QW1_CMD_S) |
+				((uint64_t)td_offset << CI_TXD_QW1_OFFSET_S) |
+				((uint64_t)slen << CI_TXD_QW1_TX_BUF_SZ_S));
 
 			txe->last_id = tx_last;
 			tx_id = txe->next_id;
@@ -1464,7 +1464,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		} while (m_seg);
 
 		/* The last packet data descriptor needs End Of Packet (EOP) */
-		td_cmd |= IDPF_TX_DESC_CMD_EOP;
+		td_cmd |= CI_TX_DESC_CMD_EOP;
 		txq->nb_tx_used = (uint16_t)(txq->nb_tx_used + nb_used);
 		txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_used);
 
@@ -1473,13 +1473,13 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			       "%4u (port=%d queue=%d)",
 			       tx_last, txq->port_id, txq->queue_id);
 
-			td_cmd |= IDPF_TX_DESC_CMD_RS;
+			td_cmd |= CI_TX_DESC_CMD_RS;
 
 			/* Update txq RS bit counters */
 			txq->nb_tx_used = 0;
 		}
 
-		txd->cmd_type_offset_bsz |= rte_cpu_to_le_16(td_cmd << IDPF_TXD_QW1_CMD_S);
+		txd->cmd_type_offset_bsz |= rte_cpu_to_le_16(td_cmd << CI_TXD_QW1_CMD_S);
 	}
 
 end_of_tx:
drivers/net/intel/idpf/idpf_common_rxtx.h +0 -12
index 2f2fa153b2..b88a87402d 100644
@@ -169,18 +169,6 @@ struct idpf_rx_queue {
 	uint32_t hw_register_set;
 };
 
-/* Offload features */
-union idpf_tx_offload {
-	uint64_t data;
-	struct {
-		uint64_t l2_len:7; /* L2 (MAC) Header Length. */
-		uint64_t l3_len:9; /* L3 (IP) Header Length. */
-		uint64_t l4_len:8; /* L4 Header Length. */
-		uint64_t tso_segsz:16; /* TCP TSO segment size */
-		/* uint64_t unused : 24; */
-	};
-};
-
 union idpf_tx_desc {
 	struct ci_tx_desc *tx_ring;
 	struct idpf_flex_tx_sched_desc *desc_ring;
drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +15 -26

71 lines not on this page · raw message

drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +15 -26

71 lines not on this page · raw message

drivers/net/intel/idpf/idpf_rxtx_vec_common.h +2 -2
index b5e8574667..a43d8f78e2 100644
@@ -32,8 +32,8 @@ idpf_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
 		return 1;
 
 	return (txq->ci_tx_ring[idx].cmd_type_offset_bsz &
-			rte_cpu_to_le_64(IDPF_TXD_QW1_DTYPE_M)) ==
-				rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE);
+			rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) ==
+				rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 }
 
 static inline int
Signature · 1 line
2.51.0
#80 lore raw

RE: [PATCH v3 04/36] net/intel: consolidate definitions for Tx desc fields

Quoted 58 lines

-----Original Message-----
From: Bruce Richardson <[email protected]>
Sent: Friday 30 January 2026 11:42
To: [email protected]
Cc: Richardson, Bruce <[email protected]>; Medvedkin, Vladimir <[email protected]>; Burakov, Anatoly <[email protected]>; Wu, Jingjing <[email protected]>; Shetty, Praveen <[email protected]>
Subject: [PATCH v3 04/36] net/intel: consolidate definitions for Tx desc fields

The offsets of the various fields within the Tx descriptors are common for i40e, iavf, ice and idpf, so put a single set of defines in tx.h and use those throughout all drivers. (NOTE: there was a small difference in mask of CMD field between drivers depending on whether reserved fields or not were included. Those can be ignored as those bits are unused in the drivers for which they are reserved). Similarly, the various flag fields, such as End-of-packet (EOP) and Report-status (RS) are the same, as are offload definitions so consolidate them.

Original definitions are in base code, and are left in place because of that, but are unused.

---
 drivers/net/intel/common/tx.h                 |  64 +++++++-
 drivers/net/intel/i40e/i40e_fdir.c            |  24 +--
 drivers/net/intel/i40e/i40e_rxtx.c            |  92 ++++++------
 drivers/net/intel/i40e/i40e_rxtx.h            |  17 +--
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |  11 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c   |  22 ++-
 drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c |  38 ++---
 drivers/net/intel/i40e/i40e_rxtx_vec_common.h |   4 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |  11 +-
 drivers/net/intel/iavf/iavf_rxtx.c            |  68 +++++----
 drivers/net/intel/iavf/iavf_rxtx.h            |  20 +--
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   |  41 ++----
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c |  80 ++++------
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h |  34 ++---
 drivers/net/intel/ice/ice_dcf_ethdev.c        |   2 +-
 drivers/net/intel/ice/ice_rxtx.c              | 137 ++++++++----------
 drivers/net/intel/ice/ice_rxtx.h              |  15 +-
 drivers/net/intel/ice/ice_rxtx_vec_avx2.c     |  41 ++----
 drivers/net/intel/ice/ice_rxtx_vec_avx512.c   |  39 ++---
 drivers/net/intel/ice/ice_rxtx_vec_common.h   |  41 +++---
 drivers/net/intel/idpf/idpf_common_rxtx.c     |  22 +--
 drivers/net/intel/idpf/idpf_common_rxtx.h     |  12 --
 .../net/intel/idpf/idpf_common_rxtx_avx2.c    |  41 ++----
 .../net/intel/idpf/idpf_common_rxtx_avx512.c  |  41 ++----
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |   4 +-
 25 files changed, 408 insertions(+), 513 deletions(-)
drivers/net/intel/common/tx.h +0 -0
index a89412c195..03245d4fba 100644

drivers/net/intel/common/tx.h line 17

Quoted 8 lines
drivers/net/intel/common/tx.h +5 -0
@@ -10,6 +10,66 @@
 #include <rte_ethdev.h>
 #include <rte_vect.h>
 
+/* Common TX Descriptor QW1 Field Definitions */
+#define CI_TXD_QW1_DTYPE_S      0
+#define CI_TXD_QW1_DTYPE_M      (0xFUL << CI_TXD_QW1_DTYPE_S)
+#define CI_TXD_QW1_CMD_S        4
+#define CI_TXD_QW1_CMD_M        (0xFFFUL << CI_TXD_QW1_CMD_S)

This define is unused in the series.

drivers/net/intel/common/tx.h line 27

Quoted 12 lines
drivers/net/intel/common/tx.h +10 -0
+#define CI_TXD_QW1_OFFSET_S     16
+#define CI_TXD_QW1_OFFSET_M     (0x3FFFFULL <<
 CI_TXD_QW1_OFFSET_S)
+#define CI_TXD_QW1_TX_BUF_SZ_S  34
+#define CI_TXD_QW1_TX_BUF_SZ_M  (0x3FFFULL <<
 CI_TXD_QW1_TX_BUF_SZ_S)
+#define CI_TXD_QW1_L2TAG1_S     48
+#define CI_TXD_QW1_L2TAG1_M     (0xFFFFULL << CI_TXD_QW1_L2TAG1_S)
+
+/* Common Descriptor Types */
+#define CI_TX_DESC_DTYPE_DATA           0x0
+#define CI_TX_DESC_DTYPE_CTX            0x1

This define is also unused, although there is scope to use it in patch 7 net/ice: refactor context descriptor handling

Quoted 54 lines
drivers/net/intel/common/tx.h +45 -0
+#define CI_TX_DESC_DTYPE_DESC_DONE      0xF
+
+/* Common TX Descriptor Command Flags */
+#define CI_TX_DESC_CMD_EOP              0x0001
+#define CI_TX_DESC_CMD_RS               0x0002
+#define CI_TX_DESC_CMD_ICRC             0x0004
+#define CI_TX_DESC_CMD_IL2TAG1          0x0008
+#define CI_TX_DESC_CMD_DUMMY            0x0010
+#define CI_TX_DESC_CMD_IIPT_IPV6        0x0020
+#define CI_TX_DESC_CMD_IIPT_IPV4        0x0040
+#define CI_TX_DESC_CMD_IIPT_IPV4_CSUM   0x0060
+#define CI_TX_DESC_CMD_L4T_EOFT_TCP     0x0100
+#define CI_TX_DESC_CMD_L4T_EOFT_SCTP    0x0200
+#define CI_TX_DESC_CMD_L4T_EOFT_UDP     0x0300
+
+/* Common TX Context Descriptor Commands */
+#define CI_TX_CTX_DESC_TSO              0x01
+#define CI_TX_CTX_DESC_TSYN             0x02
+#define CI_TX_CTX_DESC_IL2TAG2          0x04
+
+/* Common TX Descriptor Length Field Shifts */
+#define CI_TX_DESC_LEN_MACLEN_S         0  /* 7 BITS */
+#define CI_TX_DESC_LEN_IPLEN_S          7  /* 7 BITS */
+#define CI_TX_DESC_LEN_L4_LEN_S         14 /* 4 BITS */
+
+/* Common maximum data per TX descriptor */
+#define CI_MAX_DATA_PER_TXD     (CI_TXD_QW1_TX_BUF_SZ_M >>
 CI_TXD_QW1_TX_BUF_SZ_S)
+
+/**
+ * Common TX offload union for Intel drivers.
+ * Supports both basic offloads (l2_len, l3_len, l4_len, tso_segsz) and
+ * extended offloads (outer_l2_len, outer_l3_len) for tunneling support.
+ */
+union ci_tx_offload {
+	uint64_t data;
+	struct {
+		uint64_t l2_len:7;        /**< L2 (MAC) Header Length. */
+		uint64_t l3_len:9;        /**< L3 (IP) Header Length. */
+		uint64_t l4_len:8;        /**< L4 Header Length. */
+		uint64_t tso_segsz:16;    /**< TCP TSO segment size */
+		uint64_t outer_l2_len:8;  /**< outer L2 Header Length */
+		uint64_t outer_l3_len:16; /**< outer L3 Header Length */
+	};
+};
+

/*
* Structure of a 16-byte Tx descriptor common across i40e, ice, iavf and idpf
drivers
*/

drivers/net/intel/common/tx.h +0 -0
@@ -286,8 +346,8 @@ ci_tx_xmit_cleanup(struct ci_tx_queue *txq)
 	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
 
 	/* Check if descriptor is done - all drivers use 0xF as done value in bits
Quoted 1 line

3:0 */

I think this comment referencing 0xF is out of place now that we're not using 0xF rather CI_TX_DESC_DTYPE_DESC_DONE in the code below.

Quoted 2,440 lines
drivers/net/intel/common/tx.h +0 -1
-	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &

rte_cpu_to_le_64(0xFUL)) !=

drivers/net/intel/common/tx.h +1 -1
-			rte_cpu_to_le_64(0xFUL)) {
+	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &

rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) !=

drivers/net/intel/common/tx.h +1 -0
+			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE))

{

drivers/net/intel/common/tx.h +0 -0
 		/* Descriptor not yet processed by hardware */
 		return -1;
 	}
drivers/net/intel/i40e/i40e_fdir.c +0 -3
index 8a01aec0e2..3b099d5a9e 100644
@@ -916,11 +916,11 @@ i40e_build_ctob(uint32_t td_cmd,
 		unsigned int size,
 		uint32_t td_tag)
 {
-	return rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DATA |
-			((uint64_t)td_cmd  << I40E_TXD_QW1_CMD_SHIFT) |
-			((uint64_t)td_offset <<

I40E_TXD_QW1_OFFSET_SHIFT) |

drivers/net/intel/i40e/i40e_fdir.c +0 -1
-			((uint64_t)size  <<

I40E_TXD_QW1_TX_BUF_SZ_SHIFT) |

drivers/net/intel/i40e/i40e_fdir.c +0 -1
-			((uint64_t)td_tag  <<

I40E_TXD_QW1_L2TAG1_SHIFT));

drivers/net/intel/i40e/i40e_fdir.c +6 -2
+	return rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DATA |
+			((uint64_t)td_cmd  << CI_TXD_QW1_CMD_S) |
+			((uint64_t)td_offset << CI_TXD_QW1_OFFSET_S) |
+			((uint64_t)size  << CI_TXD_QW1_TX_BUF_SZ_S) |
+			((uint64_t)td_tag  << CI_TXD_QW1_L2TAG1_S));
 }
 
 /*
@@ -1384,8 +1384,8 @@ i40e_find_available_buffer(struct rte_eth_dev
 *dev)
 
 		do {
 			if ((tmp_txdp->cmd_type_offset_bsz &
-
 	rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
-
 	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
+
	rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) ==
+
	rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE))
drivers/net/intel/i40e/i40e_fdir.c +3 -3
 				fdir_info->txq_available_buf_count++;
 			else
 				break;
@@ -1710,9 +1710,9 @@ i40e_flow_fdir_filter_programming(struct i40e_pf
 *pf,
 	txdp = &txq->ci_tx_ring[txq->tx_tail + 1];
 	txdp->buffer_addr = rte_cpu_to_le_64(pf->fdir.dma_addr[txq->tx_tail
 >> 1]);
 
-	td_cmd = I40E_TX_DESC_CMD_EOP |
-		 I40E_TX_DESC_CMD_RS  |
-		 I40E_TX_DESC_CMD_DUMMY;
+	td_cmd = CI_TX_DESC_CMD_EOP |
+		 CI_TX_DESC_CMD_RS  |
+		 CI_TX_DESC_CMD_DUMMY;
 
drivers/net/intel/i40e/i40e_fdir.c +1 -2
 	txdp->cmd_type_offset_bsz =
 		i40e_build_ctob(td_cmd, 0, I40E_FDIR_PKT_LEN, 0);
@@ -1731,8 +1731,8 @@ i40e_flow_fdir_filter_programming(struct i40e_pf
 *pf,
 	if (wait_status) {
 		for (i = 0; i < I40E_FDIR_MAX_WAIT_US; i++) {
 			if ((txdp->cmd_type_offset_bsz &
-
 	rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
-
 	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
+
	rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) ==
+
	rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE))
drivers/net/intel/i40e/i40e_fdir.c +0 -0
 				break;
 			rte_delay_us(1);
 		}
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
index 2760e76e99..f96c5c7f1e 100644
@@ -45,7 +45,7 @@
 /* Base address of the HW descriptor ring should be 128B aligned. */
 #define I40E_RING_BASE_ALIGN	128
 
-#define I40E_TXD_CMD (I40E_TX_DESC_CMD_EOP |
 I40E_TX_DESC_CMD_RS)
+#define I40E_TXD_CMD (CI_TX_DESC_CMD_EOP | CI_TX_DESC_CMD_RS)
 
 #ifdef RTE_LIBRTE_IEEE1588

#define I40E_TX_IEEE1588_TMST RTE_MBUF_F_TX_IEEE1588_TMST

drivers/net/intel/i40e/i40e_rxtx.c +1 -1
@@ -260,7 +260,7 @@ i40e_rxd_build_fdir(volatile union ci_rx_desc *rxdp,
 struct rte_mbuf *mb)
 
 static inline void
 i40e_parse_tunneling_params(uint64_t ol_flags,
-			    union i40e_tx_offload tx_offload,
+			    union ci_tx_offload tx_offload,
 			    uint32_t *cd_tunneling)
 {
drivers/net/intel/i40e/i40e_rxtx.c +16 -19
 	/* EIPT: External (outer) IP header type */
@@ -319,51 +319,51 @@ static inline void
 i40e_txd_enable_checksum(uint64_t ol_flags,
 			uint32_t *td_cmd,
 			uint32_t *td_offset,
-			union i40e_tx_offload tx_offload)
+			union ci_tx_offload tx_offload)
 {
 	/* Set MACLEN */
 	if (!(ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK))
 		*td_offset |= (tx_offload.l2_len >> 1)
-			<< I40E_TX_DESC_LENGTH_MACLEN_SHIFT;
+			<< CI_TX_DESC_LEN_MACLEN_S;
 
 	/* Enable L3 checksum offloads */
 	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
-		*td_cmd |= I40E_TX_DESC_CMD_IIPT_IPV4_CSUM;
+		*td_cmd |= CI_TX_DESC_CMD_IIPT_IPV4_CSUM;
 		*td_offset |= (tx_offload.l3_len >> 2)
-				<< I40E_TX_DESC_LENGTH_IPLEN_SHIFT;
+				<< CI_TX_DESC_LEN_IPLEN_S;
 	} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
-		*td_cmd |= I40E_TX_DESC_CMD_IIPT_IPV4;
+		*td_cmd |= CI_TX_DESC_CMD_IIPT_IPV4;
 		*td_offset |= (tx_offload.l3_len >> 2)
-				<< I40E_TX_DESC_LENGTH_IPLEN_SHIFT;
+				<< CI_TX_DESC_LEN_IPLEN_S;
 	} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
-		*td_cmd |= I40E_TX_DESC_CMD_IIPT_IPV6;
+		*td_cmd |= CI_TX_DESC_CMD_IIPT_IPV6;
 		*td_offset |= (tx_offload.l3_len >> 2)
-				<< I40E_TX_DESC_LENGTH_IPLEN_SHIFT;
+				<< CI_TX_DESC_LEN_IPLEN_S;
 	}
 
 	if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
-		*td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_TCP;
+		*td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_TCP;
 		*td_offset |= (tx_offload.l4_len >> 2)
-			<< I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT;
+			<< CI_TX_DESC_LEN_L4_LEN_S;
 		return;
 	}
 
 	/* Enable L4 checksum offloads */
 	switch (ol_flags & RTE_MBUF_F_TX_L4_MASK) {
 	case RTE_MBUF_F_TX_TCP_CKSUM:
-		*td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_TCP;
+		*td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_TCP;
 		*td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) <<
-				I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT;
+				CI_TX_DESC_LEN_L4_LEN_S;
 		break;
 	case RTE_MBUF_F_TX_SCTP_CKSUM:
-		*td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_SCTP;
+		*td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_SCTP;
 		*td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) <<
-				I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT;
+				CI_TX_DESC_LEN_L4_LEN_S;
 		break;
 	case RTE_MBUF_F_TX_UDP_CKSUM:
-		*td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_UDP;
+		*td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_UDP;
 		*td_offset |= (sizeof(struct rte_udp_hdr) >> 2) <<
-				I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT;
+				CI_TX_DESC_LEN_L4_LEN_S;
 		break;
 	default:
 		break;
@@ -377,11 +377,11 @@ i40e_build_ctob(uint32_t td_cmd,
 		unsigned int size,
 		uint32_t td_tag)
 {
-	return rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DATA |
-			((uint64_t)td_cmd  << I40E_TXD_QW1_CMD_SHIFT) |
-			((uint64_t)td_offset <<

I40E_TXD_QW1_OFFSET_SHIFT) |

drivers/net/intel/i40e/i40e_rxtx.c +0 -1
-			((uint64_t)size  <<

I40E_TXD_QW1_TX_BUF_SZ_SHIFT) |

drivers/net/intel/i40e/i40e_rxtx.c +0 -1
-			((uint64_t)td_tag  <<

I40E_TXD_QW1_L2TAG1_SHIFT));

drivers/net/intel/i40e/i40e_rxtx.c +6 -4
+	return rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DATA |
+			((uint64_t)td_cmd  << CI_TXD_QW1_CMD_S) |
+			((uint64_t)td_offset << CI_TXD_QW1_OFFSET_S) |
+			((uint64_t)size  << CI_TXD_QW1_TX_BUF_SZ_S) |
+			((uint64_t)td_tag  << CI_TXD_QW1_L2TAG1_S));
 }
 
 static inline int
@@ -1004,7 +1004,7 @@ i40e_calc_context_desc(uint64_t flags)
 
 /* set i40e TSO context descriptor */
 static inline uint64_t
-i40e_set_tso_ctx(struct rte_mbuf *mbuf, union i40e_tx_offload tx_offload)
+i40e_set_tso_ctx(struct rte_mbuf *mbuf, union ci_tx_offload tx_offload)
 {
 	uint64_t ctx_desc = 0;
 	uint32_t cd_cmd, hdr_len, cd_tso_len;
@@ -1029,9 +1029,6 @@ i40e_set_tso_ctx(struct rte_mbuf *mbuf, union
 i40e_tx_offload tx_offload)
 	return ctx_desc;
 }
 
-/* HW requires that Tx buffer size ranges from 1B up to (16K-1)B. */
-#define I40E_MAX_DATA_PER_TXD \
-	(I40E_TXD_QW1_TX_BUF_SZ_MASK >>
 I40E_TXD_QW1_TX_BUF_SZ_SHIFT)
 /* Calculate the number of TX descriptors needed for each pkt */

static inline uint16_t
i40e_calc_pkt_desc(struct rte_mbuf *tx_pkt)

drivers/net/intel/i40e/i40e_rxtx.c +1 -1
@@ -1040,7 +1037,7 @@ i40e_calc_pkt_desc(struct rte_mbuf *tx_pkt)
 	uint16_t count = 0;
 
 	while (txd != NULL) {
-		count += DIV_ROUND_UP(txd->data_len,
 I40E_MAX_DATA_PER_TXD);
+		count += DIV_ROUND_UP(txd->data_len,
 CI_MAX_DATA_PER_TXD);
 		txd = txd->next;
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
 	}
@@ -1069,7 +1066,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 	uint16_t tx_last;
 	uint16_t slen;
 	uint64_t buf_dma_addr;
-	union i40e_tx_offload tx_offload = {0};
+	union ci_tx_offload tx_offload = {0};
 
 	txq = tx_queue;
drivers/net/intel/i40e/i40e_rxtx.c +3 -3
 	sw_ring = txq->sw_ring;
@@ -1138,18 +1135,18 @@ i40e_xmit_pkts(void *tx_queue, struct
 rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		/* Descriptor based VLAN insertion */
 		if (ol_flags & (RTE_MBUF_F_TX_VLAN |
 RTE_MBUF_F_TX_QINQ)) {
-			td_cmd |= I40E_TX_DESC_CMD_IL2TAG1;
+			td_cmd |= CI_TX_DESC_CMD_IL2TAG1;
 			td_tag = tx_pkt->vlan_tci;
 		}
 
 		/* Always enable CRC offload insertion */
-		td_cmd |= I40E_TX_DESC_CMD_ICRC;
+		td_cmd |= CI_TX_DESC_CMD_ICRC;
 
 		/* Fill in tunneling parameters if necessary */
 		cd_tunneling_params = 0;
 		if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
 			td_offset |= (tx_offload.outer_l2_len >> 1)
-					<<
 I40E_TX_DESC_LENGTH_MACLEN_SHIFT;
+					<< CI_TX_DESC_LEN_MACLEN_S;
drivers/net/intel/i40e/i40e_rxtx.c +4 -4
 			i40e_parse_tunneling_params(ol_flags, tx_offload,
 						    &cd_tunneling_params);
 		}
@@ -1229,16 +1226,16 @@ i40e_xmit_pkts(void *tx_queue, struct
 rte_mbuf **tx_pkts, uint16_t nb_pkts)
 			buf_dma_addr = rte_mbuf_data_iova(m_seg);
 
 			while ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) &&
-				unlikely(slen > I40E_MAX_DATA_PER_TXD)) {
+				unlikely(slen > CI_MAX_DATA_PER_TXD)) {
 				txd->buffer_addr =
 					rte_cpu_to_le_64(buf_dma_addr);
 				txd->cmd_type_offset_bsz =
 					i40e_build_ctob(td_cmd,
-					td_offset, I40E_MAX_DATA_PER_TXD,
+					td_offset, CI_MAX_DATA_PER_TXD,
 					td_tag);
 
-				buf_dma_addr += I40E_MAX_DATA_PER_TXD;
-				slen -= I40E_MAX_DATA_PER_TXD;
+				buf_dma_addr += CI_MAX_DATA_PER_TXD;
+				slen -= CI_MAX_DATA_PER_TXD;
 
 				txe->last_id = tx_last;
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
 				tx_id = txe->next_id;
@@ -1265,7 +1262,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 		} while (m_seg != NULL);
 
 		/* The last packet data descriptor needs End Of Packet (EOP)
 */
-		td_cmd |= I40E_TX_DESC_CMD_EOP;
+		td_cmd |= CI_TX_DESC_CMD_EOP;
 		txq->nb_tx_used = (uint16_t)(txq->nb_tx_used + nb_used);
drivers/net/intel/i40e/i40e_rxtx.c +2 -3
 		txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_used);
@@ -1275,15 +1272,14 @@ i40e_xmit_pkts(void *tx_queue, struct
 rte_mbuf **tx_pkts, uint16_t nb_pkts)
 				   "%4u (port=%d queue=%d)",
 				   tx_last, txq->port_id, txq->queue_id);
 
-			td_cmd |= I40E_TX_DESC_CMD_RS;
+			td_cmd |= CI_TX_DESC_CMD_RS;
 
 			/* Update txq RS bit counters */
 			txq->nb_tx_used = 0;
 		}
 
 		txd->cmd_type_offset_bsz |=
-			rte_cpu_to_le_64(((uint64_t)td_cmd) <<
-					I40E_TXD_QW1_CMD_SHIFT);
+			rte_cpu_to_le_64(((uint64_t)td_cmd) <<
 CI_TXD_QW1_CMD_S);
 	}

end_of_tx:

drivers/net/intel/i40e/i40e_rxtx.c +2 -2
@@ -1309,8 +1305,8 @@ i40e_tx_free_bufs(struct ci_tx_queue *txq)
 	const uint16_t m = tx_rs_thresh % I40E_TX_MAX_FREE_BUF_SZ;
 
 	if ((txq->ci_tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
-			rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=
-
 	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
+			rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) !=
+			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE))
 		return 0;
 
drivers/net/intel/i40e/i40e_rxtx.c +1 -2
 	txep = &txq->sw_ring[txq->tx_next_dd - (tx_rs_thresh - 1)];
@@ -1441,8 +1437,7 @@ tx_xmit_pkts(struct ci_tx_queue *txq,
 		n = (uint16_t)(txq->nb_tx_desc - txq->tx_tail);
 		i40e_tx_fill_hw_ring(txq, tx_pkts, n);
 		txr[txq->tx_next_rs].cmd_type_offset_bsz |=
-
 	rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
-
 	I40E_TXD_QW1_CMD_SHIFT);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS)
 << CI_TXD_QW1_CMD_S);
drivers/net/intel/i40e/i40e_rxtx.c +1 -2
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 		txq->tx_tail = 0;
 	}
@@ -1454,8 +1449,7 @@ tx_xmit_pkts(struct ci_tx_queue *txq,
 	/* Determine if RS bit needs to be set */
 	if (txq->tx_tail > txq->tx_next_rs) {
 		txr[txq->tx_next_rs].cmd_type_offset_bsz |=
-
 	rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
-
 	I40E_TXD_QW1_CMD_SHIFT);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS)
 << CI_TXD_QW1_CMD_S);
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 		if (txq->tx_next_rs >= txq->nb_tx_desc)
@@ -2383,9 +2377,9 @@ i40e_dev_tx_descriptor_status(void *tx_queue,
 uint16_t offset)
 	}
 
 	status = &txq->ci_tx_ring[desc].cmd_type_offset_bsz;
-	mask = rte_le_to_cpu_64(I40E_TXD_QW1_DTYPE_MASK);
+	mask = rte_le_to_cpu_64(CI_TXD_QW1_DTYPE_M);
 	expect = rte_cpu_to_le_64(
-		I40E_TX_DESC_DTYPE_DESC_DONE <<
 I40E_TXD_QW1_DTYPE_SHIFT);
+		CI_TX_DESC_DTYPE_DESC_DONE << CI_TXD_QW1_DTYPE_S);
 	if ((*status & mask) == expect)
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
 		return RTE_ETH_TX_DESC_DONE;
@@ -2883,7 +2877,7 @@ i40e_reset_tx_queue(struct ci_tx_queue *txq)
 		volatile struct ci_tx_desc *txd = &txq->ci_tx_ring[i];
 
 		txd->cmd_type_offset_bsz =
-
 	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE);
+			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
 		txe[i].last_id = i;
drivers/net/intel/i40e/i40e_rxtx.c +0 -0
 		txe[prev].next_id = i;
drivers/net/intel/i40e/i40e_rxtx.h +2 -2
index ed173d8f17..307ffa3049 100644
@@ -47,8 +47,8 @@
 #define I40E_RX_DESC_EXT_STATUS_FLEXBL_MASK   0x03
 #define I40E_RX_DESC_EXT_STATUS_FLEXBL_FLEX   0x01
 
-#define I40E_TD_CMD (I40E_TX_DESC_CMD_ICRC |\
-		     I40E_TX_DESC_CMD_EOP)
+#define I40E_TD_CMD (CI_TX_DESC_CMD_ICRC |\
+		     CI_TX_DESC_CMD_EOP)
 
 enum i40e_header_split_mode {
 	i40e_header_split_none = 0,
@@ -110,19 +110,6 @@ enum i40e_header_split_mode {
 
 #define I40E_TX_VECTOR_OFFLOADS

RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE

drivers/net/intel/i40e/i40e_rxtx.h +0 -13
-/** Offload features */
-union i40e_tx_offload {
-	uint64_t data;
-	struct {
-		uint64_t l2_len:7; /**< L2 (MAC) Header Length. */
-		uint64_t l3_len:9; /**< L3 (IP) Header Length. */
-		uint64_t l4_len:8; /**< L4 Header Length. */
-		uint64_t tso_segsz:16; /**< TCP TSO segment size */
-		uint64_t outer_l2_len:8; /**< outer L2 Header Length */
-		uint64_t outer_l3_len:16; /**< outer L3 Header Length */
-	};
-};
-
 int i40e_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int i40e_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int i40e_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +3 -3
index 81e9e2bc0b..4c36748d94 100644
@@ -449,9 +449,9 @@ static inline void
 vtx1(volatile struct ci_tx_desc *txdp,
 	struct rte_mbuf *pkt, uint64_t flags)
 {
-	uint64_t high_qw = (I40E_TX_DESC_DTYPE_DATA |
-		((uint64_t)flags  << I40E_TXD_QW1_CMD_SHIFT) |
-		((uint64_t)pkt->data_len <<
 I40E_TXD_QW1_TX_BUF_SZ_SHIFT));
+	uint64_t high_qw = (CI_TX_DESC_DTYPE_DATA |
+		((uint64_t)flags << CI_TXD_QW1_CMD_S) |
+		((uint64_t)pkt->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
 
 	__vector unsigned long descriptor = (__vector unsigned long){
drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +1 -1
 		pkt->buf_iova + pkt->data_off, high_qw};
@@ -477,7 +477,7 @@ i40e_xmit_fixed_burst_vec(void *tx_queue, struct
 rte_mbuf **tx_pkts,
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = I40E_TD_CMD;
-	uint64_t rs = I40E_TX_DESC_CMD_RS | I40E_TD_CMD;
+	uint64_t rs = CI_TX_DESC_CMD_RS | I40E_TD_CMD;
 	int i;
 
drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +1 -2
 	if (txq->nb_tx_free < txq->tx_free_thresh)
@@ -520,8 +520,7 @@ i40e_xmit_fixed_burst_vec(void *tx_queue, struct
 rte_mbuf **tx_pkts,
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
 		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
-
 	rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
-
 	I40E_TXD_QW1_CMD_SHIFT);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS)

<< CI_TXD_QW1_CMD_S);

drivers/net/intel/i40e/i40e_rxtx_vec_altivec.c +0 -0
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 	}
drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +3 -3
index f054bd41bf..502a1842c6 100644
@@ -684,9 +684,9 @@ static inline void
 vtx1(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf *pkt, uint64_t flags)
 {
-	uint64_t high_qw = (I40E_TX_DESC_DTYPE_DATA |
-			((uint64_t)flags  << I40E_TXD_QW1_CMD_SHIFT) |
-			((uint64_t)pkt->data_len <<
 I40E_TXD_QW1_TX_BUF_SZ_SHIFT));
+	uint64_t high_qw = (CI_TX_DESC_DTYPE_DATA |
+			((uint64_t)flags << CI_TXD_QW1_CMD_S) |
+			((uint64_t)pkt->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S));
 
drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +1 -2
 	__m128i descriptor = _mm_set_epi64x(high_qw,
 				pkt->buf_iova + pkt->data_off);
@@ -697,8 +697,7 @@ static inline void
 vtx(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
-	const uint64_t hi_qw_tmpl = (I40E_TX_DESC_DTYPE_DATA |
-			((uint64_t)flags  << I40E_TXD_QW1_CMD_SHIFT));
+	const uint64_t hi_qw_tmpl = (CI_TX_DESC_DTYPE_DATA | (flags <<
 CI_TXD_QW1_CMD_S));
 
 	/* if unaligned on 32-bit boundary, do one to align */
drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +3 -3
 	if (((uintptr_t)txdp & 0x1F) != 0 && nb_pkts != 0) {
@@ -709,13 +708,13 @@ vtx(volatile struct ci_tx_desc *txdp,
 	/* do two at a time while possible, in bursts */
 	for (; nb_pkts > 3; txdp += 4, pkt += 4, nb_pkts -= 4) {
 		uint64_t hi_qw3 = hi_qw_tmpl |
-				((uint64_t)pkt[3]->data_len <<
 I40E_TXD_QW1_TX_BUF_SZ_SHIFT);
+				((uint64_t)pkt[3]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
 		uint64_t hi_qw2 = hi_qw_tmpl |
-				((uint64_t)pkt[2]->data_len <<
 I40E_TXD_QW1_TX_BUF_SZ_SHIFT);
+				((uint64_t)pkt[2]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
 		uint64_t hi_qw1 = hi_qw_tmpl |
-				((uint64_t)pkt[1]->data_len <<
 I40E_TXD_QW1_TX_BUF_SZ_SHIFT);
+				((uint64_t)pkt[1]->data_len <<

CI_TXD_QW1_TX_BUF_SZ_S);

drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +0 -1
 		uint64_t hi_qw0 = hi_qw_tmpl |
-				((uint64_t)pkt[0]->data_len <<

I40E_TXD_QW1_TX_BUF_SZ_SHIFT);

drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +1 -0
+				((uint64_t)pkt[0]->data_len <<

CI_TXD_QW1_TX_BUF_SZ_S);

drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +1 -1
 		__m256i desc2_3 = _mm256_set_epi64x(
 				hi_qw3, pkt[3]->buf_iova + pkt[3]->data_off,
@@ -743,7 +742,7 @@ i40e_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = I40E_TD_CMD;
-	uint64_t rs = I40E_TX_DESC_CMD_RS | I40E_TD_CMD;
+	uint64_t rs = CI_TX_DESC_CMD_RS | I40E_TD_CMD;
 
 	if (txq->nb_tx_free < txq->tx_free_thresh)
drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +1 -2
 		ci_tx_free_bufs_vec(txq, i40e_tx_desc_done, false);
@@ -785,8 +784,7 @@ i40e_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
 		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
-
 	rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
-
 	I40E_TXD_QW1_CMD_SHIFT);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS)

<< CI_TXD_QW1_CMD_S);

drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c +0 -0
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 	}
drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c +3 -3
index 9a967faeee..d48ff9f51e 100644
@@ -752,9 +752,9 @@ i40e_recv_scattered_pkts_vec_avx512(void
 *rx_queue,
 static inline void
 vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt, uint64_t flags)
 {
-	uint64_t high_qw = (I40E_TX_DESC_DTYPE_DATA |
-		((uint64_t)flags  << I40E_TXD_QW1_CMD_SHIFT) |
-		((uint64_t)pkt->data_len <<
 I40E_TXD_QW1_TX_BUF_SZ_SHIFT));
+	uint64_t high_qw = (CI_TX_DESC_DTYPE_DATA |
+		((uint64_t)flags << CI_TXD_QW1_CMD_S) |
+		((uint64_t)pkt->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
 
drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c +7 -18
 	__m128i descriptor = _mm_set_epi64x(high_qw,
 				pkt->buf_iova + pkt->data_off);
@@ -765,26 +765,17 @@ static inline void
 vtx(volatile struct ci_tx_desc *txdp,
 	struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
-	const uint64_t hi_qw_tmpl = (I40E_TX_DESC_DTYPE_DATA |
-			((uint64_t)flags  << I40E_TXD_QW1_CMD_SHIFT));
+	const uint64_t hi_qw_tmpl = (CI_TX_DESC_DTYPE_DATA | (flags <<
 CI_TXD_QW1_CMD_S));
 
 	for (; nb_pkts > 3; txdp += 4, pkt += 4, nb_pkts -= 4) {
-		uint64_t hi_qw3 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[3]->data_len <<
-			 I40E_TXD_QW1_TX_BUF_SZ_SHIFT);
-		uint64_t hi_qw2 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[2]->data_len <<
-			 I40E_TXD_QW1_TX_BUF_SZ_SHIFT);
-		uint64_t hi_qw1 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[1]->data_len <<
-			 I40E_TXD_QW1_TX_BUF_SZ_SHIFT);
-		uint64_t hi_qw0 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[0]->data_len <<
-			 I40E_TXD_QW1_TX_BUF_SZ_SHIFT);
+		uint64_t hi_qw3 = hi_qw_tmpl |
+			((uint64_t)pkt[3]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw2 = hi_qw_tmpl |
+			((uint64_t)pkt[2]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw1 = hi_qw_tmpl |
+			((uint64_t)pkt[1]->data_len <<

CI_TXD_QW1_TX_BUF_SZ_S);

drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c +2 -0
+		uint64_t hi_qw0 = hi_qw_tmpl |
+			((uint64_t)pkt[0]->data_len <<

CI_TXD_QW1_TX_BUF_SZ_S);

drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c +1 -1
 		__m512i desc0_3 =
 			_mm512_set_epi64
@@ -811,7 +802,7 @@ i40e_xmit_fixed_burst_vec_avx512(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = I40E_TD_CMD;
-	uint64_t rs = I40E_TX_DESC_CMD_RS | I40E_TD_CMD;
+	uint64_t rs = CI_TX_DESC_CMD_RS | I40E_TD_CMD;
 
 	if (txq->nb_tx_free < txq->tx_free_thresh)
drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c +1 -2
 		ci_tx_free_bufs_vec(txq, i40e_tx_desc_done, false);
@@ -854,8 +845,7 @@ i40e_xmit_fixed_burst_vec_avx512(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
 		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
-
 	rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
-
 	I40E_TXD_QW1_CMD_SHIFT);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS)

<< CI_TXD_QW1_CMD_S);

drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c +0 -0
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 	}
drivers/net/intel/i40e/i40e_rxtx_vec_common.h +2 -2
index 1fd7fc75bf..292a39501e 100644
@@ -16,8 +16,8 @@ static inline int
 i40e_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
 {
 	return (txq->ci_tx_ring[idx].cmd_type_offset_bsz &
-			rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
-
 	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE);
+			rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) ==
+
 	rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 }

static inline void

drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +3 -3
index 0b95152232..be4c64942e 100644
@@ -600,9 +600,9 @@ static inline void
 vtx1(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf *pkt, uint64_t flags)
 {
-	uint64_t high_qw = (I40E_TX_DESC_DTYPE_DATA |
-			((uint64_t)flags  << I40E_TXD_QW1_CMD_SHIFT) |
-			((uint64_t)pkt->data_len <<
 I40E_TXD_QW1_TX_BUF_SZ_SHIFT));
+	uint64_t high_qw = (CI_TX_DESC_DTYPE_DATA |
+			((uint64_t)flags << CI_TXD_QW1_CMD_S) |
+			((uint64_t)pkt->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S));
 
drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +1 -1
 	uint64x2_t descriptor = {pkt->buf_iova + pkt->data_off, high_qw};
 	vst1q_u64(RTE_CAST_PTR(uint64_t *, txdp), descriptor);
@@ -627,7 +627,7 @@ i40e_xmit_fixed_burst_vec(void *__rte_restrict
 tx_queue,
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = I40E_TD_CMD;
-	uint64_t rs = I40E_TX_DESC_CMD_RS | I40E_TD_CMD;
+	uint64_t rs = CI_TX_DESC_CMD_RS | I40E_TD_CMD;
 	int i;
 
drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +1 -2
 	if (txq->nb_tx_free < txq->tx_free_thresh)
@@ -669,8 +669,7 @@ i40e_xmit_fixed_burst_vec(void *__rte_restrict
 tx_queue,
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
 		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
-
 	rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) <<
-
 	I40E_TXD_QW1_CMD_SHIFT);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS)

<< CI_TXD_QW1_CMD_S);

drivers/net/intel/i40e/i40e_rxtx_vec_neon.c +0 -0
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 	}
drivers/net/intel/iavf/iavf_rxtx.c +1 -1
index 560abfc1ef..947b6c24d2 100644
@@ -274,7 +274,7 @@ reset_tx_queue(struct ci_tx_queue *txq)
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
 		txq->ci_tx_ring[i].cmd_type_offset_bsz =
-
 	rte_cpu_to_le_64(IAVF_TX_DESC_DTYPE_DESC_DONE);
+			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
 		txe[i].last_id = i;
drivers/net/intel/iavf/iavf_rxtx.c +1 -1
 		txe[prev].next_id = i;
@@ -2351,12 +2351,12 @@ iavf_fill_ctx_desc_cmd_field(volatile uint64_t
 *field, struct rte_mbuf *m,
 
 	/* TSO enabled */
 	if (m->ol_flags & (RTE_MBUF_F_TX_TCP_SEG |
 RTE_MBUF_F_TX_UDP_SEG))
-		cmd = IAVF_TX_CTX_DESC_TSO <<
 IAVF_TXD_CTX_QW1_CMD_SHIFT;
+		cmd = CI_TX_CTX_DESC_TSO <<
 IAVF_TXD_CTX_QW1_CMD_SHIFT;
 
 	if ((m->ol_flags & RTE_MBUF_F_TX_VLAN &&
 			vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2)

||

drivers/net/intel/iavf/iavf_rxtx.c +4 -4
 			m->ol_flags & RTE_MBUF_F_TX_QINQ) {
-		cmd |= IAVF_TX_CTX_DESC_IL2TAG2
+		cmd |= CI_TX_CTX_DESC_IL2TAG2
 			<< IAVF_TXD_CTX_QW1_CMD_SHIFT;
 	}
@@ -2577,20 +2577,20 @@ iavf_build_data_desc_cmd_offset_fields(volatile
 uint64_t *qw1,
 	uint64_t offset = 0;
 	uint64_t l2tag1 = 0;
 
-	*qw1 = IAVF_TX_DESC_DTYPE_DATA;
+	*qw1 = CI_TX_DESC_DTYPE_DATA;
 
-	command = (uint64_t)IAVF_TX_DESC_CMD_ICRC;
+	command = (uint64_t)CI_TX_DESC_CMD_ICRC;
 
 	/* Descriptor based VLAN insertion */
 	if ((vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1) &&
 			m->ol_flags & RTE_MBUF_F_TX_VLAN) {
-		command |= (uint64_t)IAVF_TX_DESC_CMD_IL2TAG1;
+		command |= (uint64_t)CI_TX_DESC_CMD_IL2TAG1;
 		l2tag1 |= m->vlan_tci;
 	}
 
 	/* Descriptor based QinQ insertion. vlan_flag specifies outer tag

location. */

drivers/net/intel/iavf/iavf_rxtx.c +1 -1
 	if (m->ol_flags & RTE_MBUF_F_TX_QINQ) {
-		command |= (uint64_t)IAVF_TX_DESC_CMD_IL2TAG1;
+		command |= (uint64_t)CI_TX_DESC_CMD_IL2TAG1;
 		l2tag1 = vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1

? m->vlan_tci_outer :
m-

Quoted 1 line

vlan_tci;

drivers/net/intel/iavf/iavf_rxtx.c +11 -11
 	}
@@ -2603,32 +2603,32 @@ iavf_build_data_desc_cmd_offset_fields(volatile
 uint64_t *qw1,
 	if (m->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK &&
 			!(m->ol_flags & RTE_MBUF_F_TX_SEC_OFFLOAD))
 		offset |= (m->outer_l2_len >> 1)
-			<< IAVF_TX_DESC_LENGTH_MACLEN_SHIFT;
+			<< CI_TX_DESC_LEN_MACLEN_S;
 	else
 		offset |= (m->l2_len >> 1)
-			<< IAVF_TX_DESC_LENGTH_MACLEN_SHIFT;
+			<< CI_TX_DESC_LEN_MACLEN_S;
 
 	/* Enable L3 checksum offloading inner */
 	if (m->ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
 		if (m->ol_flags & RTE_MBUF_F_TX_IPV4) {
-			command |= IAVF_TX_DESC_CMD_IIPT_IPV4_CSUM;
-			offset |= (m->l3_len >> 2) <<
 IAVF_TX_DESC_LENGTH_IPLEN_SHIFT;
+			command |= CI_TX_DESC_CMD_IIPT_IPV4_CSUM;
+			offset |= (m->l3_len >> 2) <<
 CI_TX_DESC_LEN_IPLEN_S;
 		}
 	} else if (m->ol_flags & RTE_MBUF_F_TX_IPV4) {
-		command |= IAVF_TX_DESC_CMD_IIPT_IPV4;
-		offset |= (m->l3_len >> 2) <<
 IAVF_TX_DESC_LENGTH_IPLEN_SHIFT;
+		command |= CI_TX_DESC_CMD_IIPT_IPV4;
+		offset |= (m->l3_len >> 2) << CI_TX_DESC_LEN_IPLEN_S;
 	} else if (m->ol_flags & RTE_MBUF_F_TX_IPV6) {
-		command |= IAVF_TX_DESC_CMD_IIPT_IPV6;
-		offset |= (m->l3_len >> 2) <<
 IAVF_TX_DESC_LENGTH_IPLEN_SHIFT;
+		command |= CI_TX_DESC_CMD_IIPT_IPV6;
+		offset |= (m->l3_len >> 2) << CI_TX_DESC_LEN_IPLEN_S;
 	}
 
 	if (m->ol_flags & (RTE_MBUF_F_TX_TCP_SEG |
 RTE_MBUF_F_TX_UDP_SEG)) {
 		if (m->ol_flags & RTE_MBUF_F_TX_TCP_SEG)
-			command |= IAVF_TX_DESC_CMD_L4T_EOFT_TCP;
+			command |= CI_TX_DESC_CMD_L4T_EOFT_TCP;
 		else
-			command |= IAVF_TX_DESC_CMD_L4T_EOFT_UDP;
+			command |= CI_TX_DESC_CMD_L4T_EOFT_UDP;
 		offset |= (m->l4_len >> 2) <<
-			      IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT;
+			      CI_TX_DESC_LEN_L4_LEN_S;
 
 		*qw1 = rte_cpu_to_le_64((((uint64_t)command <<
 			IAVF_TXD_DATA_QW1_CMD_SHIFT) &

IAVF_TXD_DATA_QW1_CMD_MASK) |

drivers/net/intel/iavf/iavf_rxtx.c +7 -8
@@ -2642,19 +2642,19 @@ iavf_build_data_desc_cmd_offset_fields(volatile
 uint64_t *qw1,
 	/* Enable L4 checksum offloads */
 	switch (m->ol_flags & RTE_MBUF_F_TX_L4_MASK) {
 	case RTE_MBUF_F_TX_TCP_CKSUM:
-		command |= IAVF_TX_DESC_CMD_L4T_EOFT_TCP;
+		command |= CI_TX_DESC_CMD_L4T_EOFT_TCP;
 		offset |= (sizeof(struct rte_tcp_hdr) >> 2) <<
-				IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT;
+				CI_TX_DESC_LEN_L4_LEN_S;
 		break;
 	case RTE_MBUF_F_TX_SCTP_CKSUM:
-		command |= IAVF_TX_DESC_CMD_L4T_EOFT_SCTP;
+		command |= CI_TX_DESC_CMD_L4T_EOFT_SCTP;
 		offset |= (sizeof(struct rte_sctp_hdr) >> 2) <<
-				IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT;
+				CI_TX_DESC_LEN_L4_LEN_S;
 		break;
 	case RTE_MBUF_F_TX_UDP_CKSUM:
-		command |= IAVF_TX_DESC_CMD_L4T_EOFT_UDP;
+		command |= CI_TX_DESC_CMD_L4T_EOFT_UDP;
 		offset |= (sizeof(struct rte_udp_hdr) >> 2) <<
-				IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT;
+				CI_TX_DESC_LEN_L4_LEN_S;
 		break;
 	}
@@ -2674,8 +2674,7 @@ iavf_calc_pkt_desc(struct rte_mbuf *tx_pkt)
 	uint16_t count = 0;
 
 	while (txd != NULL) {
-		count += (txd->data_len + IAVF_MAX_DATA_PER_TXD - 1) /
-			IAVF_MAX_DATA_PER_TXD;
+		count += (txd->data_len + CI_MAX_DATA_PER_TXD - 1) /
 CI_MAX_DATA_PER_TXD;
 		txd = txd->next;
 	}
@@ -2881,14 +2880,14 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 			buf_dma_addr = rte_mbuf_data_iova(mb_seg);
 			while ((mb_seg->ol_flags &

(RTE_MBUF_F_TX_TCP_SEG |

drivers/net/intel/iavf/iavf_rxtx.c +0 -1
 					RTE_MBUF_F_TX_UDP_SEG)) &&
-					unlikely(slen >

IAVF_MAX_DATA_PER_TXD)) {

drivers/net/intel/iavf/iavf_rxtx.c +1 -0
+					unlikely(slen >

CI_MAX_DATA_PER_TXD)) {

drivers/net/intel/iavf/iavf_rxtx.c +0 -1
 				iavf_fill_data_desc(ddesc, ddesc_template,
-					IAVF_MAX_DATA_PER_TXD,

buf_dma_addr);

drivers/net/intel/iavf/iavf_rxtx.c +1 -0
+					CI_MAX_DATA_PER_TXD,

buf_dma_addr);

drivers/net/intel/iavf/iavf_rxtx.c +0 -1
 				IAVF_DUMP_TX_DESC(txq, ddesc, desc_idx);
 
-				buf_dma_addr +=

IAVF_MAX_DATA_PER_TXD;

drivers/net/intel/iavf/iavf_rxtx.c +3 -2
-				slen -= IAVF_MAX_DATA_PER_TXD;
+				buf_dma_addr += CI_MAX_DATA_PER_TXD;
+				slen -= CI_MAX_DATA_PER_TXD;
 
 				txe->last_id = desc_idx_last;
 				desc_idx = txe->next_id;
@@ -2909,7 +2908,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 		} while (mb_seg);
 
 		/* The last packet data descriptor needs End Of Packet (EOP)
 */
-		ddesc_cmd = IAVF_TX_DESC_CMD_EOP;
+		ddesc_cmd = CI_TX_DESC_CMD_EOP;
 

txq->nb_tx_used = (uint16_t)(txq->nb_tx_used +
nb_desc_required);
txq->nb_tx_free = (uint16_t)(txq->nb_tx_free -
nb_desc_required);

drivers/net/intel/iavf/iavf_rxtx.c +1 -1
@@ -2919,7 +2918,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 				   "%4u (port=%d queue=%d)",
 				   desc_idx_last, txq->port_id, txq->queue_id);
 
-			ddesc_cmd |= IAVF_TX_DESC_CMD_RS;
+			ddesc_cmd |= CI_TX_DESC_CMD_RS;
 
 			/* Update txq RS bit counters */
drivers/net/intel/iavf/iavf_rxtx.c +2 -3
 			txq->nb_tx_used = 0;
@@ -4423,9 +4422,8 @@ iavf_dev_tx_desc_status(void *tx_queue, uint16_t
 offset)
 	}
 
 	status = &txq->ci_tx_ring[desc].cmd_type_offset_bsz;
-	mask = rte_le_to_cpu_64(IAVF_TXD_QW1_DTYPE_MASK);
-	expect = rte_cpu_to_le_64(
-		 IAVF_TX_DESC_DTYPE_DESC_DONE <<
 IAVF_TXD_QW1_DTYPE_SHIFT);
+	mask = rte_le_to_cpu_64(CI_TXD_QW1_DTYPE_M);
+	expect = rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE <<
 CI_TXD_QW1_DTYPE_S);
drivers/net/intel/iavf/iavf_rxtx.c +0 -0
 	if ((*status & mask) == expect)
 		return RTE_ETH_TX_DESC_DONE;
drivers/net/intel/iavf/iavf_rxtx.h +0 -4
index dd6d884fc1..395d97b4ee 100644
@@ -162,10 +162,6 @@
 #define IAVF_TX_OFFLOAD_NOTSUP_MASK \
 		(RTE_MBUF_F_TX_OFFLOAD_MASK ^
 IAVF_TX_OFFLOAD_MASK)
 
-/* HW requires that TX buffer size ranges from 1B up to (16K-1)B. */
-#define IAVF_MAX_DATA_PER_TXD \
-	(IAVF_TXD_QW1_TX_BUF_SZ_MASK >>
 IAVF_TXD_QW1_TX_BUF_SZ_SHIFT)
-
 #define IAVF_TX_LLDP_DYNFIELD "intel_pmd_dynfield_tx_lldp"

#define IAVF_CHECK_TX_LLDP(m) \

drivers/net/intel/iavf/iavf_rxtx.h +1 -13
 	((rte_pmd_iavf_tx_lldp_dynfield_offset > 0) && \
@@ -195,18 +191,6 @@ struct iavf_rx_queue_stats {
 	struct iavf_ipsec_crypto_stats ipsec_crypto;
 };
 
-/* Offload features */
-union iavf_tx_offload {
-	uint64_t data;
-	struct {
-		uint64_t l2_len:7; /* L2 (MAC) Header Length. */
-		uint64_t l3_len:9; /* L3 (IP) Header Length. */
-		uint64_t l4_len:8; /* L4 Header Length. */
-		uint64_t tso_segsz:16; /* TCP TSO segment size */
-		/* uint64_t unused : 24; */
-	};
-};
-
 /* Rx Flex Descriptor
  * RxDID Profile ID 16-21
  * Flex-field 0: RSS hash lower 16-bits
@@ -409,7 +393,7 @@ enum iavf_rx_flex_desc_ipsec_crypto_status {
 
 
 #define IAVF_TXD_DATA_QW1_DTYPE_SHIFT	(0)
-#define IAVF_TXD_DATA_QW1_DTYPE_MASK	(0xFUL <<
 IAVF_TXD_QW1_DTYPE_SHIFT)
+#define IAVF_TXD_DATA_QW1_DTYPE_MASK	(0xFUL <<
 CI_TXD_QW1_DTYPE_S)
 

#define IAVF_TXD_DATA_QW1_CMD_SHIFT (4)
#define IAVF_TXD_DATA_QW1_CMD_MASK (0x3FFUL <<
IAVF_TXD_DATA_QW1_CMD_SHIFT)

drivers/net/intel/iavf/iavf_rxtx.h +1 -1
@@ -686,7 +670,7 @@ void iavf_dump_tx_descriptor(const struct
 ci_tx_queue *txq,
 		rte_le_to_cpu_64(tx_desc->cmd_type_offset_bsz &
 
 	rte_cpu_to_le_64(IAVF_TXD_DATA_QW1_DTYPE_MASK));
 	switch (type) {
-	case IAVF_TX_DESC_DTYPE_DATA:
+	case CI_TX_DESC_DTYPE_DATA:
 		name = "Tx_data_desc";
drivers/net/intel/iavf/iavf_rxtx.h +0 -0
 		break;
 	case IAVF_TX_DESC_DTYPE_CONTEXT:
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +4 -6
index 89ce841b9e..cea4ee9863 100644
@@ -1633,10 +1633,9 @@ static __rte_always_inline void
 iavf_vtx1(volatile struct ci_tx_desc *txdp,
 	  struct rte_mbuf *pkt, uint64_t flags, bool offload, uint8_t vlan_flag)
 {
-	uint64_t high_qw =
-		(IAVF_TX_DESC_DTYPE_DATA |
-		 ((uint64_t)flags  << IAVF_TXD_QW1_CMD_SHIFT) |
-		 ((uint64_t)pkt->data_len <<
 IAVF_TXD_QW1_TX_BUF_SZ_SHIFT));
+	uint64_t high_qw = (CI_TX_DESC_DTYPE_DATA |
+		 ((uint64_t)flags << CI_TXD_QW1_CMD_S) |
+		 ((uint64_t)pkt->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
 	if (offload)
 		iavf_txd_enable_offload(pkt, &high_qw, vlan_flag);
@@ -1649,8 +1648,7 @@ static __rte_always_inline void
 iavf_vtx(volatile struct ci_tx_desc *txdp,
 	 struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags, bool
 offload, uint8_t vlan_flag)
 {
-	const uint64_t hi_qw_tmpl = (IAVF_TX_DESC_DTYPE_DATA |
-			((uint64_t)flags  << IAVF_TXD_QW1_CMD_SHIFT));
+	const uint64_t hi_qw_tmpl = (CI_TX_DESC_DTYPE_DATA | (flags <<
 CI_TXD_QW1_CMD_S));
 
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +8 -16
 	/* if unaligned on 32-bit boundary, do one to align */
 	if (((uintptr_t)txdp & 0x1F) != 0 && nb_pkts != 0) {
@@ -1660,28 +1658,20 @@ iavf_vtx(volatile struct ci_tx_desc *txdp,
 
 	/* do two at a time while possible, in bursts */
 	for (; nb_pkts > 3; txdp += 4, pkt += 4, nb_pkts -= 4) {
-		uint64_t hi_qw3 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[3]->data_len <<
-			 IAVF_TXD_QW1_TX_BUF_SZ_SHIFT);
+		uint64_t hi_qw3 = hi_qw_tmpl |
+			((uint64_t)pkt[3]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
 		if (offload)
 			iavf_txd_enable_offload(pkt[3], &hi_qw3, vlan_flag);
-		uint64_t hi_qw2 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[2]->data_len <<
-			 IAVF_TXD_QW1_TX_BUF_SZ_SHIFT);
+		uint64_t hi_qw2 = hi_qw_tmpl |
+			((uint64_t)pkt[2]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
 		if (offload)
 			iavf_txd_enable_offload(pkt[2], &hi_qw2, vlan_flag);
-		uint64_t hi_qw1 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[1]->data_len <<
-			 IAVF_TXD_QW1_TX_BUF_SZ_SHIFT);
+		uint64_t hi_qw1 = hi_qw_tmpl |
+			((uint64_t)pkt[1]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
 		if (offload)
 			iavf_txd_enable_offload(pkt[1], &hi_qw1, vlan_flag);
-		uint64_t hi_qw0 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[0]->data_len <<
-			 IAVF_TXD_QW1_TX_BUF_SZ_SHIFT);
+		uint64_t hi_qw0 = hi_qw_tmpl |
+			((uint64_t)pkt[0]->data_len <<

CI_TXD_QW1_TX_BUF_SZ_S);

drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +2 -2
 		if (offload)
 			iavf_txd_enable_offload(pkt[0], &hi_qw0, vlan_flag);
@@ -1717,8 +1707,8 @@ iavf_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	/* bit2 is reserved and must be set to 1 according to Spec */
-	uint64_t flags = IAVF_TX_DESC_CMD_EOP |
 IAVF_TX_DESC_CMD_ICRC;
-	uint64_t rs = IAVF_TX_DESC_CMD_RS | flags;
+	uint64_t flags = CI_TX_DESC_CMD_EOP | CI_TX_DESC_CMD_ICRC;
+	uint64_t rs = CI_TX_DESC_CMD_RS | flags;
 
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +1 -2
 	if (txq->nb_tx_free < txq->tx_free_thresh)
 		ci_tx_free_bufs_vec(txq, iavf_tx_desc_done, false);
@@ -1761,8 +1751,7 @@ iavf_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
 		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
-
 	rte_cpu_to_le_64(((uint64_t)IAVF_TX_DESC_CMD_RS) <<
-					 IAVF_TXD_QW1_CMD_SHIFT);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS)
 << CI_TXD_QW1_CMD_S);
drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c +0 -0
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 	}
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +4 -6
index ad1b0b90cd..01477fd501 100644
@@ -1844,10 +1844,9 @@ iavf_vtx1(volatile struct ci_tx_desc *txdp,
 	  struct rte_mbuf *pkt, uint64_t flags,
 	  bool offload, uint8_t vlan_flag)
 {
-	uint64_t high_qw =
-		(IAVF_TX_DESC_DTYPE_DATA |
-		 ((uint64_t)flags  << IAVF_TXD_QW1_CMD_SHIFT) |
-		 ((uint64_t)pkt->data_len <<
 IAVF_TXD_QW1_TX_BUF_SZ_SHIFT));
+	uint64_t high_qw = (CI_TX_DESC_DTYPE_DATA |
+		 ((uint64_t)flags << CI_TXD_QW1_CMD_S) |
+		 ((uint64_t)pkt->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
 	if (offload)
 		iavf_txd_enable_offload(pkt, &high_qw, vlan_flag);
@@ -1863,8 +1862,7 @@ iavf_vtx(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags,
 		bool offload, uint8_t vlan_flag)
 {
-	const uint64_t hi_qw_tmpl = (IAVF_TX_DESC_DTYPE_DATA |
-			((uint64_t)flags  << IAVF_TXD_QW1_CMD_SHIFT));
+	const uint64_t hi_qw_tmpl = (CI_TX_DESC_DTYPE_DATA | (flags <<
 CI_TXD_QW1_CMD_S));
 
 	/* if unaligned on 32-bit boundary, do one to align */
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +8 -16
 	if (((uintptr_t)txdp & 0x1F) != 0 && nb_pkts != 0) {
@@ -1874,22 +1872,14 @@ iavf_vtx(volatile struct ci_tx_desc *txdp,
 
 	/* do 4 at a time while possible, in bursts */
 	for (; nb_pkts > 3; txdp += 4, pkt += 4, nb_pkts -= 4) {
-		uint64_t hi_qw3 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[3]->data_len <<
-			 IAVF_TXD_QW1_TX_BUF_SZ_SHIFT);
-		uint64_t hi_qw2 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[2]->data_len <<
-			 IAVF_TXD_QW1_TX_BUF_SZ_SHIFT);
-		uint64_t hi_qw1 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[1]->data_len <<
-			 IAVF_TXD_QW1_TX_BUF_SZ_SHIFT);
-		uint64_t hi_qw0 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[0]->data_len <<
-			 IAVF_TXD_QW1_TX_BUF_SZ_SHIFT);
+		uint64_t hi_qw3 = hi_qw_tmpl |
+			((uint64_t)pkt[3]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw2 = hi_qw_tmpl |
+			((uint64_t)pkt[2]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw1 = hi_qw_tmpl |
+			((uint64_t)pkt[1]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw0 = hi_qw_tmpl |
+			((uint64_t)pkt[0]->data_len <<

CI_TXD_QW1_TX_BUF_SZ_S);

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -2
 		if (offload) {
 			iavf_txd_enable_offload(pkt[3], &hi_qw3, vlan_flag);
 			iavf_txd_enable_offload(pkt[2], &hi_qw2, vlan_flag);
@@ -2093,9 +2083,9 @@ ctx_vtx1(volatile struct ci_tx_desc *txdp, struct
 rte_mbuf *pkt,
 	if (IAVF_CHECK_TX_LLDP(pkt))
 		high_ctx_qw |= IAVF_TX_CTX_DESC_SWTCH_UPLINK
 			<< IAVF_TXD_CTX_QW1_CMD_SHIFT;
-	uint64_t high_data_qw = (IAVF_TX_DESC_DTYPE_DATA |
-				((uint64_t)flags  <<

IAVF_TXD_QW1_CMD_SHIFT) |

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -1
-				((uint64_t)pkt->data_len <<

IAVF_TXD_QW1_TX_BUF_SZ_SHIFT));

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +3 -0
+	uint64_t high_data_qw = (CI_TX_DESC_DTYPE_DATA |
+				((uint64_t)flags << CI_TXD_QW1_CMD_S) |
+				((uint64_t)pkt->data_len <<

CI_TXD_QW1_TX_BUF_SZ_S));

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +1 -2
 	if (offload)
 		iavf_txd_enable_offload(pkt, &high_data_qw, vlan_flag);
@@ -2110,8 +2100,7 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 		struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags,
 		bool offload, uint8_t vlan_flag)
 {
-	uint64_t hi_data_qw_tmpl = (IAVF_TX_DESC_DTYPE_DATA |
-					((uint64_t)flags  <<
 IAVF_TXD_QW1_CMD_SHIFT));
+	uint64_t hi_data_qw_tmpl = (CI_TX_DESC_DTYPE_DATA | (flags <<
 CI_TXD_QW1_CMD_S));
 
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +2 -4
 	/* if unaligned on 32-bit boundary, do one to align */
 	if (((uintptr_t)txdp & 0x1F) != 0 && nb_pkts != 0) {
@@ -2128,11 +2117,9 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 		uint64_t hi_data_qw0 = 0;
 
 		hi_data_qw1 = hi_data_qw_tmpl |
-				((uint64_t)pkt[1]->data_len <<
-					IAVF_TXD_QW1_TX_BUF_SZ_SHIFT);
+				((uint64_t)pkt[1]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
 		hi_data_qw0 = hi_data_qw_tmpl |
-				((uint64_t)pkt[0]->data_len <<
-					IAVF_TXD_QW1_TX_BUF_SZ_SHIFT);
+				((uint64_t)pkt[0]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
 

#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -0
 		if (offload) {
@@ -2140,13 +2127,11 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 				uint64_t qinq_tag = vlan_flag &

IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ?

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -1
 					(uint64_t)pkt[1]->vlan_tci :
 					(uint64_t)pkt[1]->vlan_tci_outer;
-				hi_ctx_qw1 |= IAVF_TX_CTX_DESC_IL2TAG2

<<
-

	IAVF_TXD_CTX_QW1_CMD_SHIFT;
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +1 -0
+				hi_ctx_qw1 |= CI_TX_CTX_DESC_IL2TAG2 <<

CI_TXD_QW1_CMD_S;
low_ctx_qw1 |= qinq_tag <<
IAVF_TXD_CTX_QW0_L2TAG2_PARAM;
} else if (pkt[1]->ol_flags & RTE_MBUF_F_TX_VLAN
&&
vlan_flag &
IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2) {

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -2
-				hi_ctx_qw1 |=
-					IAVF_TX_CTX_DESC_IL2TAG2 <<

IAVF_TXD_CTX_QW1_CMD_SHIFT;

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +1 -0
+				hi_ctx_qw1 |= IAVF_TX_CTX_DESC_IL2TAG2

<< CI_TXD_QW1_CMD_S;

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -0
 				low_ctx_qw1 |=
 					(uint64_t)pkt[1]->vlan_tci <<

IAVF_TXD_CTX_QW0_L2TAG2_PARAM;

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +1 -1
 			}
@@ -2154,7 +2139,7 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 #endif
 		if (IAVF_CHECK_TX_LLDP(pkt[1]))
 			hi_ctx_qw1 |= IAVF_TX_CTX_DESC_SWTCH_UPLINK
-				<< IAVF_TXD_CTX_QW1_CMD_SHIFT;
+				<< CI_TXD_QW1_CMD_S;
 
 #ifdef IAVF_TX_VLAN_QINQ_OFFLOAD
 		if (offload) {
@@ -2162,21 +2147,18 @@ ctx_vtx(volatile struct ci_tx_desc *txdp,
 				uint64_t qinq_tag = vlan_flag &

IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ?

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -1
 					(uint64_t)pkt[0]->vlan_tci :
 					(uint64_t)pkt[0]->vlan_tci_outer;
-				hi_ctx_qw0 |= IAVF_TX_CTX_DESC_IL2TAG2

<<
-

	IAVF_TXD_CTX_QW1_CMD_SHIFT;
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +1 -0
+				hi_ctx_qw0 |= IAVF_TX_CTX_DESC_IL2TAG2

<< CI_TXD_QW1_CMD_S;
low_ctx_qw0 |= qinq_tag <<
IAVF_TXD_CTX_QW0_L2TAG2_PARAM;
} else if (pkt[0]->ol_flags & RTE_MBUF_F_TX_VLAN
&&
vlan_flag &
IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2) {

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -2
-				hi_ctx_qw0 |=
-					IAVF_TX_CTX_DESC_IL2TAG2 <<

IAVF_TXD_CTX_QW1_CMD_SHIFT;

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +1 -0
+				hi_ctx_qw0 |= IAVF_TX_CTX_DESC_IL2TAG2

<< CI_TXD_QW1_CMD_S;

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -0
 				low_ctx_qw0 |=
 					(uint64_t)pkt[0]->vlan_tci <<

IAVF_TXD_CTX_QW0_L2TAG2_PARAM;

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +1 -2
 			}
 		}
 #endif
 		if (IAVF_CHECK_TX_LLDP(pkt[0]))
-			hi_ctx_qw0 |= IAVF_TX_CTX_DESC_SWTCH_UPLINK
-				<< IAVF_TXD_CTX_QW1_CMD_SHIFT;
+			hi_ctx_qw0 |= IAVF_TX_CTX_DESC_SWTCH_UPLINK

<< CI_TXD_QW1_CMD_S;

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -0
 		if (offload) {
 			iavf_txd_enable_offload(pkt[1], &hi_data_qw1,

vlan_flag);

drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +2 -2
@@ -2207,8 +2189,8 @@ iavf_xmit_fixed_burst_vec_avx512(void
 *tx_queue, struct rte_mbuf **tx_pkts,
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	/* bit2 is reserved and must be set to 1 according to Spec */
-	uint64_t flags = IAVF_TX_DESC_CMD_EOP |
 IAVF_TX_DESC_CMD_ICRC;
-	uint64_t rs = IAVF_TX_DESC_CMD_RS | flags;
+	uint64_t flags = CI_TX_DESC_CMD_EOP | CI_TX_DESC_CMD_ICRC;
+	uint64_t rs = CI_TX_DESC_CMD_RS | flags;
 
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +1 -2
 	if (txq->nb_tx_free < txq->tx_free_thresh)
 		ci_tx_free_bufs_vec(txq, iavf_tx_desc_done, false);
@@ -2253,8 +2235,7 @@ iavf_xmit_fixed_burst_vec_avx512(void
 *tx_queue, struct rte_mbuf **tx_pkts,
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
 		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
-
 	rte_cpu_to_le_64(((uint64_t)IAVF_TX_DESC_CMD_RS) <<
-					 IAVF_TXD_QW1_CMD_SHIFT);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS)
 << CI_TXD_QW1_CMD_S);
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +2 -2
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 	}
@@ -2275,8 +2256,8 @@ iavf_xmit_fixed_burst_vec_avx512_ctx(void
 *tx_queue, struct rte_mbuf **tx_pkts,
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, nb_mbuf, tx_id;
 	/* bit2 is reserved and must be set to 1 according to Spec */
-	uint64_t flags = IAVF_TX_DESC_CMD_EOP |
 IAVF_TX_DESC_CMD_ICRC;
-	uint64_t rs = IAVF_TX_DESC_CMD_RS | flags;
+	uint64_t flags = CI_TX_DESC_CMD_EOP | CI_TX_DESC_CMD_ICRC;
+	uint64_t rs = CI_TX_DESC_CMD_RS | flags;
 
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +1 -2
 	if (txq->nb_tx_free < txq->tx_free_thresh)
 		ci_tx_free_bufs_vec(txq, iavf_tx_desc_done, true);
@@ -2321,8 +2302,7 @@ iavf_xmit_fixed_burst_vec_avx512_ctx(void
 *tx_queue, struct rte_mbuf **tx_pkts,
 
 	if (tx_id > txq->tx_next_rs) {
 		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
-
 	rte_cpu_to_le_64(((uint64_t)IAVF_TX_DESC_CMD_RS) <<
-					 IAVF_TXD_QW1_CMD_SHIFT);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS)
 << CI_TXD_QW1_CMD_S);
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c +0 -0
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 	}
drivers/net/intel/iavf/iavf_rxtx_vec_common.h +2 -2
index 1832b76f89..1538a44892 100644
@@ -15,8 +15,8 @@ static inline int
 iavf_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
 {
 	return (txq->ci_tx_ring[idx].cmd_type_offset_bsz &
-			rte_cpu_to_le_64(IAVF_TXD_QW1_DTYPE_MASK)) ==
-
 	rte_cpu_to_le_64(IAVF_TX_DESC_DTYPE_DESC_DONE);
+			rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) ==
+
 	rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 }

static inline void

drivers/net/intel/iavf/iavf_rxtx_vec_common.h +8 -8
@@ -147,26 +147,26 @@ iavf_txd_enable_offload(__rte_unused struct
 rte_mbuf *tx_pkt,
 	/* Set MACLEN */
 	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK)
 		td_offset |= (tx_pkt->outer_l2_len >> 1)
-			<< IAVF_TX_DESC_LENGTH_MACLEN_SHIFT;
+			<< CI_TX_DESC_LEN_MACLEN_S;
 	else
 		td_offset |= (tx_pkt->l2_len >> 1)
-			<< IAVF_TX_DESC_LENGTH_MACLEN_SHIFT;
+			<< CI_TX_DESC_LEN_MACLEN_S;
 
 	/* Enable L3 checksum offloads */
 	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
 		if (ol_flags & RTE_MBUF_F_TX_IPV4) {
-			td_cmd |= IAVF_TX_DESC_CMD_IIPT_IPV4_CSUM;
+			td_cmd |= CI_TX_DESC_CMD_IIPT_IPV4_CSUM;
 			td_offset |= (tx_pkt->l3_len >> 2) <<
-				     IAVF_TX_DESC_LENGTH_IPLEN_SHIFT;
+				     CI_TX_DESC_LEN_IPLEN_S;
 		}
 	} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
-		td_cmd |= IAVF_TX_DESC_CMD_IIPT_IPV4;
+		td_cmd |= CI_TX_DESC_CMD_IIPT_IPV4;
 		td_offset |= (tx_pkt->l3_len >> 2) <<
-			     IAVF_TX_DESC_LENGTH_IPLEN_SHIFT;
+			     CI_TX_DESC_LEN_IPLEN_S;
 	} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
-		td_cmd |= IAVF_TX_DESC_CMD_IIPT_IPV6;
+		td_cmd |= CI_TX_DESC_CMD_IIPT_IPV6;
 		td_offset |= (tx_pkt->l3_len >> 2) <<
-			     IAVF_TX_DESC_LENGTH_IPLEN_SHIFT;
+			     CI_TX_DESC_LEN_IPLEN_S;
 	}
 
drivers/net/intel/iavf/iavf_rxtx_vec_common.h +1 -1
 	/* Enable L4 checksum offloads */
@@ -190,7 +190,7 @@ iavf_txd_enable_offload(__rte_unused struct
 rte_mbuf *tx_pkt,
 		break;
 	}
 
-	*txd_hi |= ((uint64_t)td_offset) << IAVF_TXD_QW1_OFFSET_SHIFT;
+	*txd_hi |= ((uint64_t)td_offset) << CI_TXD_QW1_OFFSET_S;
 #endif
 

#ifdef IAVF_TX_VLAN_QINQ_OFFLOAD

drivers/net/intel/iavf/iavf_rxtx_vec_common.h +4 -6
@@ -198,17 +198,15 @@ iavf_txd_enable_offload(__rte_unused struct
 rte_mbuf *tx_pkt,
 		td_cmd |= IAVF_TX_DESC_CMD_IL2TAG1;
 		/* vlan_flag specifies outer tag location for QinQ. */
 		if (vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1)
-			*txd_hi |= ((uint64_t)tx_pkt->vlan_tci_outer <<
-					IAVF_TXD_QW1_L2TAG1_SHIFT);
+			*txd_hi |= ((uint64_t)tx_pkt->vlan_tci_outer <<
 CI_TXD_QW1_L2TAG1_S);
 		else
-			*txd_hi |= ((uint64_t)tx_pkt->vlan_tci <<
-					IAVF_TXD_QW1_L2TAG1_SHIFT);
+			*txd_hi |= ((uint64_t)tx_pkt->vlan_tci <<
 CI_TXD_QW1_L2TAG1_S);
 	} else if (ol_flags & RTE_MBUF_F_TX_VLAN && vlan_flag &
 IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1) {
-		td_cmd |= IAVF_TX_DESC_CMD_IL2TAG1;
-		*txd_hi |= ((uint64_t)tx_pkt->vlan_tci <<
 IAVF_TXD_QW1_L2TAG1_SHIFT);
+		td_cmd |= CI_TX_DESC_CMD_IL2TAG1;
+		*txd_hi |= ((uint64_t)tx_pkt->vlan_tci <<
 CI_TXD_QW1_L2TAG1_S);
drivers/net/intel/iavf/iavf_rxtx_vec_common.h +1 -1
 	}
 #endif
 
-	*txd_hi |= ((uint64_t)td_cmd) << IAVF_TXD_QW1_CMD_SHIFT;
+	*txd_hi |= ((uint64_t)td_cmd) << CI_TXD_QW1_CMD_S;
 }
 #endif
drivers/net/intel/ice/ice_dcf_ethdev.c +1 -1
index 5f537b4c12..4ceecc15c6 100644
@@ -406,7 +406,7 @@ reset_tx_queue(struct ci_tx_queue *txq)
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
 		txq->ci_tx_ring[i].cmd_type_offset_bsz =
-
 	rte_cpu_to_le_64(IAVF_TX_DESC_DTYPE_DESC_DONE);
+			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
 		txe[i].last_id = i;
drivers/net/intel/ice/ice_dcf_ethdev.c +0 -0
 		txe[prev].next_id = i;
drivers/net/intel/ice/ice_rxtx.c +3 -4
index 7a33e1e980..52bbf95967 100644
@@ -1124,7 +1124,7 @@ ice_reset_tx_queue(struct ci_tx_queue *txq)
 		volatile struct ci_tx_desc *txd = &txq->ci_tx_ring[i];
 
 		txd->cmd_type_offset_bsz =
-			rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE);
+			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
 		txe[i].last_id = i;
 		txe[prev].next_id = i;
@@ -2556,9 +2556,8 @@ ice_tx_descriptor_status(void *tx_queue, uint16_t
 offset)
 	}
 
 	status = &txq->ci_tx_ring[desc].cmd_type_offset_bsz;
-	mask = rte_cpu_to_le_64(ICE_TXD_QW1_DTYPE_M);
-	expect = rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE <<
-				  ICE_TXD_QW1_DTYPE_S);
+	mask = rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M);
+	expect = rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE <<
 CI_TXD_QW1_DTYPE_S);
 	if ((*status & mask) == expect)
drivers/net/intel/ice/ice_rxtx.c +19 -21
 		return RTE_ETH_TX_DESC_DONE;
@@ -2904,7 +2903,7 @@ ice_recv_pkts(void *rx_queue,
 
 static inline void
 ice_parse_tunneling_params(uint64_t ol_flags,
-			    union ice_tx_offload tx_offload,
+			    union ci_tx_offload tx_offload,
 			    uint32_t *cd_tunneling)
 {
 	/* EIPT: External (outer) IP header type */
@@ -2965,58 +2964,58 @@ static inline void
 ice_txd_enable_checksum(uint64_t ol_flags,
 			uint32_t *td_cmd,
 			uint32_t *td_offset,
-			union ice_tx_offload tx_offload)
+			union ci_tx_offload tx_offload)
 {
 	/* Set MACLEN */
 	if (!(ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK))
 		*td_offset |= (tx_offload.l2_len >> 1)
-			<< ICE_TX_DESC_LEN_MACLEN_S;
+			<< CI_TX_DESC_LEN_MACLEN_S;
 
 	/* Enable L3 checksum offloads */
 	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
-		*td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
+		*td_cmd |= CI_TX_DESC_CMD_IIPT_IPV4_CSUM;
 		*td_offset |= (tx_offload.l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
+			CI_TX_DESC_LEN_IPLEN_S;
 	} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
-		*td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
+		*td_cmd |= CI_TX_DESC_CMD_IIPT_IPV4;
 		*td_offset |= (tx_offload.l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
+			CI_TX_DESC_LEN_IPLEN_S;
 	} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
-		*td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
+		*td_cmd |= CI_TX_DESC_CMD_IIPT_IPV6;
 		*td_offset |= (tx_offload.l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
+			CI_TX_DESC_LEN_IPLEN_S;
 	}
 
 	if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
-		*td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_TCP;
+		*td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_TCP;
 		*td_offset |= (tx_offload.l4_len >> 2) <<
-			      ICE_TX_DESC_LEN_L4_LEN_S;
+			      CI_TX_DESC_LEN_L4_LEN_S;
 		return;
 	}
 
 	if (ol_flags & RTE_MBUF_F_TX_UDP_SEG) {
-		*td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_UDP;
+		*td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_UDP;
 		*td_offset |= (tx_offload.l4_len >> 2) <<
-			      ICE_TX_DESC_LEN_L4_LEN_S;
+			      CI_TX_DESC_LEN_L4_LEN_S;
 		return;
 	}
 
 	/* Enable L4 checksum offloads */
 	switch (ol_flags & RTE_MBUF_F_TX_L4_MASK) {
 	case RTE_MBUF_F_TX_TCP_CKSUM:
-		*td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_TCP;
+		*td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_TCP;
 		*td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) <<
-			      ICE_TX_DESC_LEN_L4_LEN_S;
+			      CI_TX_DESC_LEN_L4_LEN_S;
 		break;
 	case RTE_MBUF_F_TX_SCTP_CKSUM:
-		*td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_SCTP;
+		*td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_SCTP;
 		*td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) <<
-			      ICE_TX_DESC_LEN_L4_LEN_S;
+			      CI_TX_DESC_LEN_L4_LEN_S;
 		break;
 	case RTE_MBUF_F_TX_UDP_CKSUM:
-		*td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_UDP;
+		*td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_UDP;
 		*td_offset |= (sizeof(struct rte_udp_hdr) >> 2) <<
-			      ICE_TX_DESC_LEN_L4_LEN_S;
+			      CI_TX_DESC_LEN_L4_LEN_S;
 		break;
 	default:
 		break;
@@ -3030,11 +3029,11 @@ ice_build_ctob(uint32_t td_cmd,
 	       uint16_t size,
 	       uint32_t td_tag)
 {
-	return rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DATA |
-				((uint64_t)td_cmd << ICE_TXD_QW1_CMD_S)

|

drivers/net/intel/ice/ice_rxtx.c +0 -1
-				((uint64_t)td_offset <<

ICE_TXD_QW1_OFFSET_S) |

drivers/net/intel/ice/ice_rxtx.c +0 -1
-				((uint64_t)size <<

ICE_TXD_QW1_TX_BUF_SZ_S) |

drivers/net/intel/ice/ice_rxtx.c +0 -1
-				((uint64_t)td_tag <<

ICE_TXD_QW1_L2TAG1_S));

drivers/net/intel/ice/ice_rxtx.c +2 -0
+	return rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DATA |
+				((uint64_t)td_cmd << CI_TXD_QW1_CMD_S)

|

drivers/net/intel/ice/ice_rxtx.c +1 -0
+				((uint64_t)td_offset <<

CI_TXD_QW1_OFFSET_S) |

drivers/net/intel/ice/ice_rxtx.c +1 -0
+				((uint64_t)size <<

CI_TXD_QW1_TX_BUF_SZ_S) |

drivers/net/intel/ice/ice_rxtx.c +1 -0
+				((uint64_t)td_tag <<

CI_TXD_QW1_L2TAG1_S));
}

/* Check if the context descriptor is needed for TX offloading */

drivers/net/intel/ice/ice_rxtx.c +3 -6
@@ -3053,7 +3052,7 @@ ice_calc_context_desc(uint64_t flags)
 
 /* set ice TSO context descriptor */
 static inline uint64_t
-ice_set_tso_ctx(struct rte_mbuf *mbuf, union ice_tx_offload tx_offload)
+ice_set_tso_ctx(struct rte_mbuf *mbuf, union ci_tx_offload tx_offload)
 {
 	uint64_t ctx_desc = 0;
 	uint32_t cd_cmd, hdr_len, cd_tso_len;
@@ -3067,18 +3066,15 @@ ice_set_tso_ctx(struct rte_mbuf *mbuf, union
 ice_tx_offload tx_offload)
 	hdr_len += (mbuf->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) ?
 		   tx_offload.outer_l2_len + tx_offload.outer_l3_len : 0;
 
-	cd_cmd = ICE_TX_CTX_DESC_TSO;
+	cd_cmd = CI_TX_CTX_DESC_TSO;
 	cd_tso_len = mbuf->pkt_len - hdr_len;
-	ctx_desc |= ((uint64_t)cd_cmd << ICE_TXD_CTX_QW1_CMD_S) |
+	ctx_desc |= ((uint64_t)cd_cmd << CI_TXD_QW1_CMD_S) |
 		    ((uint64_t)cd_tso_len << ICE_TXD_CTX_QW1_TSO_LEN_S) |
 		    ((uint64_t)mbuf->tso_segsz <<
 ICE_TXD_CTX_QW1_MSS_S);
 
 	return ctx_desc;
 }
 
-/* HW requires that TX buffer size ranges from 1B up to (16K-1)B. */
-#define ICE_MAX_DATA_PER_TXD \
-	(ICE_TXD_QW1_TX_BUF_SZ_M >> ICE_TXD_QW1_TX_BUF_SZ_S)
 /* Calculate the number of TX descriptors needed for each pkt */

static inline uint16_t
ice_calc_pkt_desc(struct rte_mbuf *tx_pkt)

drivers/net/intel/ice/ice_rxtx.c +1 -1
@@ -3087,7 +3083,7 @@ ice_calc_pkt_desc(struct rte_mbuf *tx_pkt)
 	uint16_t count = 0;
 
 	while (txd != NULL) {
-		count += DIV_ROUND_UP(txd->data_len,
 ICE_MAX_DATA_PER_TXD);
+		count += DIV_ROUND_UP(txd->data_len,
 CI_MAX_DATA_PER_TXD);
 		txd = txd->next;
drivers/net/intel/ice/ice_rxtx.c +1 -1
 	}
@@ -3117,7 +3113,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 	uint16_t slen;
 	uint64_t buf_dma_addr;
 	uint64_t ol_flags;
-	union ice_tx_offload tx_offload = {0};
+	union ci_tx_offload tx_offload = {0};
 
 	txq = tx_queue;
drivers/net/intel/ice/ice_rxtx.c +1 -1
 	sw_ring = txq->sw_ring;
@@ -3185,7 +3181,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 
 		/* Descriptor based VLAN insertion */
 		if (ol_flags & (RTE_MBUF_F_TX_VLAN |
 RTE_MBUF_F_TX_QINQ)) {
-			td_cmd |= ICE_TX_DESC_CMD_IL2TAG1;
+			td_cmd |= CI_TX_DESC_CMD_IL2TAG1;
 			td_tag = tx_pkt->vlan_tci;
drivers/net/intel/ice/ice_rxtx.c +1 -1
 		}
@@ -3193,7 +3189,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 		cd_tunneling_params = 0;
 		if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
 			td_offset |= (tx_offload.outer_l2_len >> 1)
-				<< ICE_TX_DESC_LEN_MACLEN_S;
+				<< CI_TX_DESC_LEN_MACLEN_S;
 			ice_parse_tunneling_params(ol_flags, tx_offload,
 						   &cd_tunneling_params);
drivers/net/intel/ice/ice_rxtx.c +0 -1
 		}
@@ -3223,8 +3219,8 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 					ice_set_tso_ctx(tx_pkt, tx_offload);
 			else if (ol_flags & RTE_MBUF_F_TX_IEEE1588_TMST)
 				cd_type_cmd_tso_mss |=
-					((uint64_t)ICE_TX_CTX_DESC_TSYN

<<

drivers/net/intel/ice/ice_rxtx.c +2 -1
-					ICE_TXD_CTX_QW1_CMD_S) |
+					((uint64_t)CI_TX_CTX_DESC_TSYN <<
+					CI_TXD_QW1_CMD_S) |
 					 (((uint64_t)txq->ice_vsi->adapter-
Quoted 1 line

ptp_tx_index <<

ICE_TXD_CTX_QW1_TSYN_S) &
ICE_TXD_CTX_QW1_TSYN_M);

drivers/net/intel/ice/ice_rxtx.c +1 -2
@@ -3235,8 +3231,8 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 			if (ol_flags & RTE_MBUF_F_TX_QINQ) {
 				cd_l2tag2 = tx_pkt->vlan_tci_outer;
 				cd_type_cmd_tso_mss |=
-
 	((uint64_t)ICE_TX_CTX_DESC_IL2TAG2 <<
-					 ICE_TXD_CTX_QW1_CMD_S);
+					((uint64_t)CI_TX_CTX_DESC_IL2TAG2

<<

drivers/net/intel/ice/ice_rxtx.c +1 -0
+					 CI_TXD_QW1_CMD_S);
 			}
 			ctx_txd->l2tag2 = rte_cpu_to_le_16(cd_l2tag2);
 			ctx_txd->qw1 =
@@ -3261,18 +3257,16 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 			buf_dma_addr = rte_mbuf_data_iova(m_seg);
 
 			while ((ol_flags & (RTE_MBUF_F_TX_TCP_SEG |

RTE_MBUF_F_TX_UDP_SEG)) &&

drivers/net/intel/ice/ice_rxtx.c +1 -1
-				unlikely(slen > ICE_MAX_DATA_PER_TXD)) {
+					unlikely(slen >

CI_MAX_DATA_PER_TXD)) {
txd->buffer_addr =
rte_cpu_to_le_64(buf_dma_addr);

drivers/net/intel/ice/ice_rxtx.c +0 -2
-				txd->cmd_type_offset_bsz =
-				rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DATA

|

drivers/net/intel/ice/ice_rxtx.c +0 -1
-				((uint64_t)td_cmd << ICE_TXD_QW1_CMD_S)

|

drivers/net/intel/ice/ice_rxtx.c +0 -1
-				((uint64_t)td_offset <<

ICE_TXD_QW1_OFFSET_S) |

drivers/net/intel/ice/ice_rxtx.c +0 -3
-				((uint64_t)ICE_MAX_DATA_PER_TXD <<
-				 ICE_TXD_QW1_TX_BUF_SZ_S) |
-				((uint64_t)td_tag <<

ICE_TXD_QW1_L2TAG1_S));

drivers/net/intel/ice/ice_rxtx.c +1 -0
+				txd->cmd_type_offset_bsz =

rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DATA |

drivers/net/intel/ice/ice_rxtx.c +1 -0
+					((uint64_t)td_cmd <<

CI_TXD_QW1_CMD_S) |

drivers/net/intel/ice/ice_rxtx.c +1 -0
+					((uint64_t)td_offset <<

CI_TXD_QW1_OFFSET_S) |

drivers/net/intel/ice/ice_rxtx.c +1 -0
+					((uint64_t)CI_MAX_DATA_PER_TXD

<< CI_TXD_QW1_TX_BUF_SZ_S) |

drivers/net/intel/ice/ice_rxtx.c +1 -0
+					((uint64_t)td_tag <<

CI_TXD_QW1_L2TAG1_S));

drivers/net/intel/ice/ice_rxtx.c +2 -4
-				buf_dma_addr += ICE_MAX_DATA_PER_TXD;
-				slen -= ICE_MAX_DATA_PER_TXD;
+				buf_dma_addr += CI_MAX_DATA_PER_TXD;
+				slen -= CI_MAX_DATA_PER_TXD;
 
 				txe->last_id = tx_last;
 				tx_id = txe->next_id;
@@ -3282,12 +3276,11 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 			}
 
 			txd->buffer_addr = rte_cpu_to_le_64(buf_dma_addr);
-			txd->cmd_type_offset_bsz =
-				rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DATA

|

drivers/net/intel/ice/ice_rxtx.c +0 -1
-				((uint64_t)td_cmd << ICE_TXD_QW1_CMD_S)

|

drivers/net/intel/ice/ice_rxtx.c +0 -1
-				((uint64_t)td_offset <<

ICE_TXD_QW1_OFFSET_S) |

drivers/net/intel/ice/ice_rxtx.c +0 -1
-				((uint64_t)slen <<

ICE_TXD_QW1_TX_BUF_SZ_S) |

drivers/net/intel/ice/ice_rxtx.c +0 -1
-				((uint64_t)td_tag <<

ICE_TXD_QW1_L2TAG1_S));

drivers/net/intel/ice/ice_rxtx.c +1 -0
+			txd->cmd_type_offset_bsz =

rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DATA |

drivers/net/intel/ice/ice_rxtx.c +1 -0
+				((uint64_t)td_cmd << CI_TXD_QW1_CMD_S)

|

drivers/net/intel/ice/ice_rxtx.c +1 -0
+				((uint64_t)td_offset <<

CI_TXD_QW1_OFFSET_S) |

drivers/net/intel/ice/ice_rxtx.c +1 -0
+				((uint64_t)slen <<

CI_TXD_QW1_TX_BUF_SZ_S) |

drivers/net/intel/ice/ice_rxtx.c +1 -0
+				((uint64_t)td_tag <<

CI_TXD_QW1_L2TAG1_S));

drivers/net/intel/ice/ice_rxtx.c +3 -4
 			txe->last_id = tx_last;
 			tx_id = txe->next_id;
@@ -3296,7 +3289,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 		} while (m_seg);
 
 		/* fill the last descriptor with End of Packet (EOP) bit */
-		td_cmd |= ICE_TX_DESC_CMD_EOP;
+		td_cmd |= CI_TX_DESC_CMD_EOP;
 		txq->nb_tx_used = (uint16_t)(txq->nb_tx_used + nb_used);
 		txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_used);
@@ -3307,14 +3300,13 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 				   "%4u (port=%d queue=%d)",
 				   tx_last, txq->port_id, txq->queue_id);
 
-			td_cmd |= ICE_TX_DESC_CMD_RS;
+			td_cmd |= CI_TX_DESC_CMD_RS;
 
 			/* Update txq RS bit counters */
 			txq->nb_tx_used = 0;
 		}
 		txd->cmd_type_offset_bsz |=
-			rte_cpu_to_le_64(((uint64_t)td_cmd) <<
-					 ICE_TXD_QW1_CMD_S);
+			rte_cpu_to_le_64(((uint64_t)td_cmd) <<
 CI_TXD_QW1_CMD_S);
 
drivers/net/intel/ice/ice_rxtx.c +2 -3
 		if (txq->tsq != NULL && txq->tsq->ts_flag > 0) {
 			uint64_t txtime = *RTE_MBUF_DYNFIELD(tx_pkt,
@@ -3361,8 +3353,8 @@ ice_tx_free_bufs(struct ci_tx_queue *txq)
 	uint16_t i;
 
 	if ((txq->ci_tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
-	     rte_cpu_to_le_64(ICE_TXD_QW1_DTYPE_M)) !=
-	    rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE))
+	     rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) !=
+	    rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE))
 		return 0;
 
 	txep = &txq->sw_ring[txq->tx_next_dd - (txq->tx_rs_thresh - 1)];
@@ -3598,8 +3590,7 @@ tx_xmit_pkts(struct ci_tx_queue *txq,
 		n = (uint16_t)(txq->nb_tx_desc - txq->tx_tail);
 		ice_tx_fill_hw_ring(txq, tx_pkts, n);
 		txr[txq->tx_next_rs].cmd_type_offset_bsz |=
-			rte_cpu_to_le_64(((uint64_t)ICE_TX_DESC_CMD_RS)

<<

drivers/net/intel/ice/ice_rxtx.c +1 -1
-					 ICE_TXD_QW1_CMD_S);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS)

<< CI_TXD_QW1_CMD_S);

drivers/net/intel/ice/ice_rxtx.c +0 -1
 		txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 		txq->tx_tail = 0;
 	}
@@ -3611,8 +3602,7 @@ tx_xmit_pkts(struct ci_tx_queue *txq,
 	/* Determine if RS bit needs to be set */
 	if (txq->tx_tail > txq->tx_next_rs) {
 		txr[txq->tx_next_rs].cmd_type_offset_bsz |=
-			rte_cpu_to_le_64(((uint64_t)ICE_TX_DESC_CMD_RS)

<<

drivers/net/intel/ice/ice_rxtx.c +1 -1
-					 ICE_TXD_QW1_CMD_S);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS)

<< CI_TXD_QW1_CMD_S);

drivers/net/intel/ice/ice_rxtx.c +3 -3
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 		if (txq->tx_next_rs >= txq->nb_tx_desc)
@@ -4843,9 +4833,9 @@ ice_fdir_programming(struct ice_pf *pf, struct
 ice_fltr_desc *fdir_desc)
 
 	txdp = &txq->ci_tx_ring[txq->tx_tail + 1];
 	txdp->buffer_addr = rte_cpu_to_le_64(pf->fdir.dma_addr);
-	td_cmd = ICE_TX_DESC_CMD_EOP |
-		ICE_TX_DESC_CMD_RS  |
-		ICE_TX_DESC_CMD_DUMMY;
+	td_cmd = CI_TX_DESC_CMD_EOP |
+		CI_TX_DESC_CMD_RS  |
+		CI_TX_DESC_CMD_DUMMY;
 
 	txdp->cmd_type_offset_bsz =
drivers/net/intel/ice/ice_rxtx.c +1 -3
 		ice_build_ctob(td_cmd, 0, ICE_FDIR_PKT_LEN, 0);
@@ -4856,9 +4846,8 @@ ice_fdir_programming(struct ice_pf *pf, struct
 ice_fltr_desc *fdir_desc)
 	/* Update the tx tail register */
 	ICE_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail);
 	for (i = 0; i < ICE_FDIR_MAX_WAIT_US; i++) {
-		if ((txdp->cmd_type_offset_bsz &
-		     rte_cpu_to_le_64(ICE_TXD_QW1_DTYPE_M)) ==
-		    rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE))
+		if ((txdp->cmd_type_offset_bsz &

rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) ==

drivers/net/intel/ice/ice_rxtx.c +1 -0
+		    rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE))
 			break;
 		rte_delay_us(1);
 	}
drivers/net/intel/ice/ice_rxtx.h +1 -14
index c524e9f756..cd5fa93d1c 100644
@@ -46,7 +46,7 @@
 
 #define ICE_SUPPORT_CHAIN_NUM 5
 
-#define ICE_TD_CMD                      ICE_TX_DESC_CMD_EOP
+#define ICE_TD_CMD                      CI_TX_DESC_CMD_EOP
 
 #define ICE_VPMD_RX_BURST            CI_VPMD_RX_BURST
 #define ICE_VPMD_TX_BURST            32
@@ -169,19 +169,6 @@ struct ice_txtime {
 	const struct rte_memzone *ts_mz;
 };
 
-/* Offload features */
-union ice_tx_offload {
-	uint64_t data;
-	struct {
-		uint64_t l2_len:7; /* L2 (MAC) Header Length. */
-		uint64_t l3_len:9; /* L3 (IP) Header Length. */
-		uint64_t l4_len:8; /* L4 Header Length. */
-		uint64_t tso_segsz:16; /* TCP TSO segment size */
-		uint64_t outer_l2_len:8; /* outer L2 Header Length */
-		uint64_t outer_l3_len:16; /* outer L3 Header Length */
-	};
-};
-
 /* Rx Flex Descriptor for Comms Package Profile
  * RxDID Profile ID 22 (swap Hash and FlowID)
  * Flex-field 0: Flow ID lower 16-bits
drivers/net/intel/ice/ice_rxtx_vec_avx2.c +4 -6
index 0a1df0b2f6..2922671158 100644
@@ -777,10 +777,9 @@ static __rte_always_inline void
 ice_vtx1(volatile struct ci_tx_desc *txdp,
 	 struct rte_mbuf *pkt, uint64_t flags, bool offload)
 {
-	uint64_t high_qw =
-		(ICE_TX_DESC_DTYPE_DATA |
-		 ((uint64_t)flags  << ICE_TXD_QW1_CMD_S) |
-		 ((uint64_t)pkt->data_len << ICE_TXD_QW1_TX_BUF_SZ_S));
+	uint64_t high_qw = (CI_TX_DESC_DTYPE_DATA |
+		 ((uint64_t)flags << CI_TXD_QW1_CMD_S) |
+		 ((uint64_t)pkt->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
 	if (offload)
 		ice_txd_enable_offload(pkt, &high_qw);
 
@@ -792,8 +791,7 @@ static __rte_always_inline void
 ice_vtx(volatile struct ci_tx_desc *txdp,
 	struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags, bool offload)
 {
-	const uint64_t hi_qw_tmpl = (ICE_TX_DESC_DTYPE_DATA |
-			((uint64_t)flags  << ICE_TXD_QW1_CMD_S));
+	const uint64_t hi_qw_tmpl = (CI_TX_DESC_DTYPE_DATA | (flags <<
 CI_TXD_QW1_CMD_S));
 
 	/* if unaligned on 32-bit boundary, do one to align */
drivers/net/intel/ice/ice_rxtx_vec_avx2.c +9 -17
 	if (((uintptr_t)txdp & 0x1F) != 0 && nb_pkts != 0) {
@@ -801,30 +799,22 @@ ice_vtx(volatile struct ci_tx_desc *txdp,
 		nb_pkts--, txdp++, pkt++;
 	}
 
-	/* do two at a time while possible, in bursts */
+	/* do four at a time while possible, in bursts */
 	for (; nb_pkts > 3; txdp += 4, pkt += 4, nb_pkts -= 4) {
-		uint64_t hi_qw3 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[3]->data_len <<
-			 ICE_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw3 = hi_qw_tmpl |
+			((uint64_t)pkt[3]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
 		if (offload)
 			ice_txd_enable_offload(pkt[3], &hi_qw3);
-		uint64_t hi_qw2 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[2]->data_len <<
-			 ICE_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw2 = hi_qw_tmpl |
+			((uint64_t)pkt[2]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
 		if (offload)
 			ice_txd_enable_offload(pkt[2], &hi_qw2);
-		uint64_t hi_qw1 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[1]->data_len <<
-			 ICE_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw1 = hi_qw_tmpl |
+			((uint64_t)pkt[1]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
 		if (offload)
 			ice_txd_enable_offload(pkt[1], &hi_qw1);
-		uint64_t hi_qw0 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[0]->data_len <<
-			 ICE_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw0 = hi_qw_tmpl |
+			((uint64_t)pkt[0]->data_len <<

CI_TXD_QW1_TX_BUF_SZ_S);

drivers/net/intel/ice/ice_rxtx_vec_avx2.c +1 -1
 		if (offload)
 			ice_txd_enable_offload(pkt[0], &hi_qw0);
@@ -856,7 +846,7 @@ ice_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = ICE_TD_CMD;
-	uint64_t rs = ICE_TX_DESC_CMD_RS | ICE_TD_CMD;
+	uint64_t rs = CI_TX_DESC_CMD_RS | ICE_TD_CMD;
 
 	/* cross rx_thresh boundary is not allowed */
drivers/net/intel/ice/ice_rxtx_vec_avx2.c +0 -1
 	nb_pkts = RTE_MIN(nb_pkts, txq->tx_rs_thresh);
@@ -901,8 +891,7 @@ ice_xmit_fixed_burst_vec_avx2(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
 		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
-			rte_cpu_to_le_64(((uint64_t)ICE_TX_DESC_CMD_RS)

<<

drivers/net/intel/ice/ice_rxtx_vec_avx2.c +1 -1
-					 ICE_TXD_QW1_CMD_S);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS)

<< CI_TXD_QW1_CMD_S);

drivers/net/intel/ice/ice_rxtx_vec_avx2.c +0 -0
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 	}
drivers/net/intel/ice/ice_rxtx_vec_avx512.c +12 -22
index d42f41461f..e64b6e227b 100644
@@ -850,10 +850,9 @@ static __rte_always_inline void
 ice_vtx1(volatile struct ci_tx_desc *txdp,
 	 struct rte_mbuf *pkt, uint64_t flags, bool do_offload)
 {
-	uint64_t high_qw =
-		(ICE_TX_DESC_DTYPE_DATA |
-		 ((uint64_t)flags  << ICE_TXD_QW1_CMD_S) |
-		 ((uint64_t)pkt->data_len << ICE_TXD_QW1_TX_BUF_SZ_S));
+	uint64_t high_qw = (CI_TX_DESC_DTYPE_DATA |
+		 ((uint64_t)flags << CI_TXD_QW1_CMD_S) |
+		 ((uint64_t)pkt->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
 
 	if (do_offload)
 		ice_txd_enable_offload(pkt, &high_qw);
@@ -866,32 +865,23 @@ static __rte_always_inline void
 ice_vtx(volatile struct ci_tx_desc *txdp, struct rte_mbuf **pkt,
 	uint16_t nb_pkts,  uint64_t flags, bool do_offload)
 {
-	const uint64_t hi_qw_tmpl = (ICE_TX_DESC_DTYPE_DATA |
-			((uint64_t)flags  << ICE_TXD_QW1_CMD_S));
+	const uint64_t hi_qw_tmpl = (CI_TX_DESC_DTYPE_DATA | (flags <<
 CI_TXD_QW1_CMD_S));
 
 	for (; nb_pkts > 3; txdp += 4, pkt += 4, nb_pkts -= 4) {
-		uint64_t hi_qw3 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[3]->data_len <<
-			 ICE_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw3 = hi_qw_tmpl |
+			((uint64_t)pkt[3]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
 		if (do_offload)
 			ice_txd_enable_offload(pkt[3], &hi_qw3);
-		uint64_t hi_qw2 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[2]->data_len <<
-			 ICE_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw2 = hi_qw_tmpl |
+			((uint64_t)pkt[2]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
 		if (do_offload)
 			ice_txd_enable_offload(pkt[2], &hi_qw2);
-		uint64_t hi_qw1 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[1]->data_len <<
-			 ICE_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw1 = hi_qw_tmpl |
+			((uint64_t)pkt[1]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
 		if (do_offload)
 			ice_txd_enable_offload(pkt[1], &hi_qw1);
-		uint64_t hi_qw0 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[0]->data_len <<
-			 ICE_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw0 = hi_qw_tmpl |
+			((uint64_t)pkt[0]->data_len <<

CI_TXD_QW1_TX_BUF_SZ_S);

drivers/net/intel/ice/ice_rxtx_vec_avx512.c +1 -1
 		if (do_offload)
 			ice_txd_enable_offload(pkt[0], &hi_qw0);
@@ -920,7 +910,7 @@ ice_xmit_fixed_burst_vec_avx512(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
 	uint64_t flags = ICE_TD_CMD;
-	uint64_t rs = ICE_TX_DESC_CMD_RS | ICE_TD_CMD;
+	uint64_t rs = CI_TX_DESC_CMD_RS | ICE_TD_CMD;
 
 	/* cross rx_thresh boundary is not allowed */
drivers/net/intel/ice/ice_rxtx_vec_avx512.c +0 -1
 	nb_pkts = RTE_MIN(nb_pkts, txq->tx_rs_thresh);
@@ -966,8 +956,7 @@ ice_xmit_fixed_burst_vec_avx512(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
 		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
-			rte_cpu_to_le_64(((uint64_t)ICE_TX_DESC_CMD_RS)

<<

drivers/net/intel/ice/ice_rxtx_vec_avx512.c +1 -1
-					 ICE_TXD_QW1_CMD_S);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS)

<< CI_TXD_QW1_CMD_S);

drivers/net/intel/ice/ice_rxtx_vec_avx512.c +0 -0
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 	}
drivers/net/intel/ice/ice_rxtx_vec_common.h +2 -2
index 8ba591e403..1d83a087cc 100644
@@ -12,8 +12,8 @@ static inline int
 ice_tx_desc_done(struct ci_tx_queue *txq, uint16_t idx)
 {
 	return (txq->ci_tx_ring[idx].cmd_type_offset_bsz &
-			rte_cpu_to_le_64(ICE_TXD_QW1_DTYPE_M)) ==
-
 	rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE);
+			rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) ==
+
 	rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 }

static inline void

drivers/net/intel/ice/ice_rxtx_vec_common.h +18 -19
@@ -124,53 +124,52 @@ ice_txd_enable_offload(struct rte_mbuf *tx_pkt,
 	/* Tx Checksum Offload */
 	/* SET MACLEN */
 	td_offset |= (tx_pkt->l2_len >> 1) <<
-		ICE_TX_DESC_LEN_MACLEN_S;
+		CI_TX_DESC_LEN_MACLEN_S;
 
 	/* Enable L3 checksum offload */
 	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
-		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
+		td_cmd |= CI_TX_DESC_CMD_IIPT_IPV4_CSUM;
 		td_offset |= (tx_pkt->l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
+			CI_TX_DESC_LEN_IPLEN_S;
 	} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
-		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
+		td_cmd |= CI_TX_DESC_CMD_IIPT_IPV4;
 		td_offset |= (tx_pkt->l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
+			CI_TX_DESC_LEN_IPLEN_S;
 	} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
-		td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
+		td_cmd |= CI_TX_DESC_CMD_IIPT_IPV6;
 		td_offset |= (tx_pkt->l3_len >> 2) <<
-			ICE_TX_DESC_LEN_IPLEN_S;
+			CI_TX_DESC_LEN_IPLEN_S;
 	}
 
 	/* Enable L4 checksum offloads */
 	switch (ol_flags & RTE_MBUF_F_TX_L4_MASK) {
 	case RTE_MBUF_F_TX_TCP_CKSUM:
-		td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_TCP;
+		td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_TCP;
 		td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) <<
-			ICE_TX_DESC_LEN_L4_LEN_S;
+			CI_TX_DESC_LEN_L4_LEN_S;
 		break;
 	case RTE_MBUF_F_TX_SCTP_CKSUM:
-		td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_SCTP;
+		td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_SCTP;
 		td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) <<
-			ICE_TX_DESC_LEN_L4_LEN_S;
+			CI_TX_DESC_LEN_L4_LEN_S;
 		break;
 	case RTE_MBUF_F_TX_UDP_CKSUM:
-		td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_UDP;
+		td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_UDP;
 		td_offset |= (sizeof(struct rte_udp_hdr) >> 2) <<
-			ICE_TX_DESC_LEN_L4_LEN_S;
+			CI_TX_DESC_LEN_L4_LEN_S;
 		break;
 	default:
 		break;
 	}
 
-	*txd_hi |= ((uint64_t)td_offset) << ICE_TXD_QW1_OFFSET_S;
+	*txd_hi |= ((uint64_t)td_offset) << CI_TXD_QW1_OFFSET_S;
 
-	/* Tx VLAN insertion Offload */
+	/* Tx VLAN/QINQ insertion Offload */
 	if (ol_flags & RTE_MBUF_F_TX_VLAN) {
-		td_cmd |= ICE_TX_DESC_CMD_IL2TAG1;
-		*txd_hi |= ((uint64_t)tx_pkt->vlan_tci <<
-				ICE_TXD_QW1_L2TAG1_S);
+		td_cmd |= CI_TX_DESC_CMD_IL2TAG1;
+		*txd_hi |= ((uint64_t)tx_pkt->vlan_tci <<
 CI_TXD_QW1_L2TAG1_S);
 	}
 
-	*txd_hi |= ((uint64_t)td_cmd) << ICE_TXD_QW1_CMD_S;
+	*txd_hi |= ((uint64_t)td_cmd) << CI_TXD_QW1_CMD_S;
 }

#endif

drivers/net/intel/idpf/idpf_common_rxtx.c +1 -1
index 23666539ab..587871b54a 100644
@@ -271,7 +271,7 @@ idpf_qc_single_tx_queue_reset(struct ci_tx_queue
 *txq)
 	prev = (uint16_t)(txq->nb_tx_desc - 1);
 	for (i = 0; i < txq->nb_tx_desc; i++) {
 		txq->ci_tx_ring[i].cmd_type_offset_bsz =
-
 	rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE);
+			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);
 		txe[i].mbuf =  NULL;
drivers/net/intel/idpf/idpf_common_rxtx.c +2 -2
 		txe[i].last_id = i;
 		txe[prev].next_id = i;
@@ -849,7 +849,7 @@ idpf_calc_context_desc(uint64_t flags)
  */
 static inline void
 idpf_set_splitq_tso_ctx(struct rte_mbuf *mbuf,
-			union idpf_tx_offload tx_offload,
+			union ci_tx_offload tx_offload,
 			volatile union idpf_flex_tx_ctx_desc *ctx_desc)
 {
 	uint16_t cmd_dtype;
@@ -887,7 +887,7 @@ idpf_dp_splitq_xmit_pkts(void *tx_queue, struct
 rte_mbuf **tx_pkts,
 	volatile struct idpf_flex_tx_sched_desc *txr;
 	volatile struct idpf_flex_tx_sched_desc *txd;
 	struct ci_tx_entry *sw_ring;
-	union idpf_tx_offload tx_offload = {0};
+	union ci_tx_offload tx_offload = {0};
 	struct ci_tx_entry *txe, *txn;
 	uint16_t nb_used, tx_id, sw_id;
drivers/net/intel/idpf/idpf_common_rxtx.c +1 -1
 	struct rte_mbuf *tx_pkt;
@@ -1334,7 +1334,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct
 rte_mbuf **tx_pkts,
 {
 	volatile struct ci_tx_desc *txd;
 	volatile struct ci_tx_desc *txr;
-	union idpf_tx_offload tx_offload = {0};
+	union ci_tx_offload tx_offload = {0};
 	struct ci_tx_entry *txe, *txn;
 	struct ci_tx_entry *sw_ring;
drivers/net/intel/idpf/idpf_common_rxtx.c +0 -1
 	struct ci_tx_queue *txq;
@@ -1452,10 +1452,10 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 			slen = m_seg->data_len;
 			buf_dma_addr = rte_mbuf_data_iova(m_seg);
 			txd->buffer_addr = rte_cpu_to_le_64(buf_dma_addr);
-			txd->cmd_type_offset_bsz =

rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DATA |

drivers/net/intel/idpf/idpf_common_rxtx.c +0 -1
-				((uint64_t)td_cmd  <<

IDPF_TXD_QW1_CMD_S) |

drivers/net/intel/idpf/idpf_common_rxtx.c +0 -1
-				((uint64_t)td_offset <<

IDPF_TXD_QW1_OFFSET_S) |

drivers/net/intel/idpf/idpf_common_rxtx.c +0 -1
-				((uint64_t)slen <<

IDPF_TXD_QW1_TX_BUF_SZ_S));

drivers/net/intel/idpf/idpf_common_rxtx.c +1 -0
+			txd->cmd_type_offset_bsz =

rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DATA |

drivers/net/intel/idpf/idpf_common_rxtx.c +1 -0
+				((uint64_t)td_cmd  << CI_TXD_QW1_CMD_S)

|

drivers/net/intel/idpf/idpf_common_rxtx.c +1 -0
+				((uint64_t)td_offset <<

CI_TXD_QW1_OFFSET_S) |

drivers/net/intel/idpf/idpf_common_rxtx.c +1 -0
+				((uint64_t)slen <<

CI_TXD_QW1_TX_BUF_SZ_S));

drivers/net/intel/idpf/idpf_common_rxtx.c +1 -1
 			txe->last_id = tx_last;
 			tx_id = txe->next_id;
@@ -1464,7 +1464,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct
 rte_mbuf **tx_pkts,
 		} while (m_seg);
 
 		/* The last packet data descriptor needs End Of Packet (EOP)
 */
-		td_cmd |= IDPF_TX_DESC_CMD_EOP;
+		td_cmd |= CI_TX_DESC_CMD_EOP;
 		txq->nb_tx_used = (uint16_t)(txq->nb_tx_used + nb_used);
drivers/net/intel/idpf/idpf_common_rxtx.c +2 -2
 		txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_used);
@@ -1473,13 +1473,13 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 			       "%4u (port=%d queue=%d)",
 			       tx_last, txq->port_id, txq->queue_id);
 
-			td_cmd |= IDPF_TX_DESC_CMD_RS;
+			td_cmd |= CI_TX_DESC_CMD_RS;
 
 			/* Update txq RS bit counters */
 			txq->nb_tx_used = 0;
 		}
 
-		txd->cmd_type_offset_bsz |= rte_cpu_to_le_16(td_cmd <<
 IDPF_TXD_QW1_CMD_S);
+		txd->cmd_type_offset_bsz |= rte_cpu_to_le_16(td_cmd <<
 CI_TXD_QW1_CMD_S);
drivers/net/intel/idpf/idpf_common_rxtx.c +0 -0
 	}
 
 end_of_tx:
drivers/net/intel/idpf/idpf_common_rxtx.h +0 -12
index 2f2fa153b2..b88a87402d 100644
@@ -169,18 +169,6 @@ struct idpf_rx_queue {
 	uint32_t hw_register_set;
 };
 
-/* Offload features */
-union idpf_tx_offload {
-	uint64_t data;
-	struct {
-		uint64_t l2_len:7; /* L2 (MAC) Header Length. */
-		uint64_t l3_len:9; /* L3 (IP) Header Length. */
-		uint64_t l4_len:8; /* L4 Header Length. */
-		uint64_t tso_segsz:16; /* TCP TSO segment size */
-		/* uint64_t unused : 24; */
-	};
-};
-
 union idpf_tx_desc {
 	struct ci_tx_desc *tx_ring;
 	struct idpf_flex_tx_sched_desc *desc_ring;
drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +4 -6
index 04efee3722..411b171b97 100644
@@ -486,10 +486,9 @@ static inline void
 idpf_singleq_vtx1(volatile struct ci_tx_desc *txdp,
 		  struct rte_mbuf *pkt, uint64_t flags)
 {
-	uint64_t high_qw =
-		(IDPF_TX_DESC_DTYPE_DATA |
-		 ((uint64_t)flags  << IDPF_TXD_QW1_CMD_S) |
-		 ((uint64_t)pkt->data_len << IDPF_TXD_QW1_TX_BUF_SZ_S));
+	uint64_t high_qw = (CI_TX_DESC_DTYPE_DATA |
+		 ((uint64_t)flags << CI_TXD_QW1_CMD_S) |
+		 ((uint64_t)pkt->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
 
 	__m128i descriptor = _mm_set_epi64x(high_qw,
 				pkt->buf_iova + pkt->data_off);
@@ -500,8 +499,7 @@ static inline void
 idpf_singleq_vtx(volatile struct ci_tx_desc *txdp,
 		 struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
-	const uint64_t hi_qw_tmpl = (IDPF_TX_DESC_DTYPE_DATA |
-			((uint64_t)flags  << IDPF_TXD_QW1_CMD_S));
+	const uint64_t hi_qw_tmpl = (CI_TX_DESC_DTYPE_DATA | (flags <<
 CI_TXD_QW1_CMD_S));
 
 	/* if unaligned on 32-bit boundary, do one to align */
drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +8 -16
 	if (((uintptr_t)txdp & 0x1F) != 0 && nb_pkts != 0) {
@@ -511,22 +509,14 @@ idpf_singleq_vtx(volatile struct ci_tx_desc *txdp,
 
 	/* do two at a time while possible, in bursts */
 	for (; nb_pkts > 3; txdp += 4, pkt += 4, nb_pkts -= 4) {
-		uint64_t hi_qw3 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[3]->data_len <<
-			 IDPF_TXD_QW1_TX_BUF_SZ_S);
-		uint64_t hi_qw2 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[2]->data_len <<
-			 IDPF_TXD_QW1_TX_BUF_SZ_S);
-		uint64_t hi_qw1 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[1]->data_len <<
-			 IDPF_TXD_QW1_TX_BUF_SZ_S);
-		uint64_t hi_qw0 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[0]->data_len <<
-			 IDPF_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw3 = hi_qw_tmpl |
+			((uint64_t)pkt[3]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw2 = hi_qw_tmpl |
+			((uint64_t)pkt[2]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw1 = hi_qw_tmpl |
+			((uint64_t)pkt[1]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw0 = hi_qw_tmpl |
+			((uint64_t)pkt[0]->data_len <<

CI_TXD_QW1_TX_BUF_SZ_S);

drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +2 -2
 		__m256i desc2_3 =
 			_mm256_set_epi64x
@@ -559,8 +549,8 @@ idpf_singleq_xmit_fixed_burst_vec_avx2(void
 *tx_queue, struct rte_mbuf **tx_pkts
 	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
-	uint64_t flags = IDPF_TX_DESC_CMD_EOP;
-	uint64_t rs = IDPF_TX_DESC_CMD_RS | flags;
+	uint64_t flags = CI_TX_DESC_CMD_EOP;
+	uint64_t rs = CI_TX_DESC_CMD_RS | flags;
 
 	/* cross rx_thresh boundary is not allowed */
drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +1 -2
 	nb_pkts = RTE_MIN(nb_pkts, txq->tx_rs_thresh);
@@ -605,8 +595,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx2(void
 *tx_queue, struct rte_mbuf **tx_pkts
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
 		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
-
 	rte_cpu_to_le_64(((uint64_t)IDPF_TX_DESC_CMD_RS) <<
-					 IDPF_TXD_QW1_CMD_S);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS)
 << CI_TXD_QW1_CMD_S);
drivers/net/intel/idpf/idpf_common_rxtx_avx2.c +0 -0
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 	}
drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +4 -6
index d5e5a2ca5f..49ace35615 100644
@@ -1003,10 +1003,9 @@ static __rte_always_inline void
 idpf_singleq_vtx1(volatile struct ci_tx_desc *txdp,
 	  struct rte_mbuf *pkt, uint64_t flags)
 {
-	uint64_t high_qw =
-		(IDPF_TX_DESC_DTYPE_DATA |
-		 ((uint64_t)flags  << IDPF_TXD_QW1_CMD_S) |
-		 ((uint64_t)pkt->data_len << IDPF_TXD_QW1_TX_BUF_SZ_S));
+	uint64_t high_qw = (CI_TX_DESC_DTYPE_DATA |
+		 ((uint64_t)flags << CI_TXD_QW1_CMD_S) |
+		 ((uint64_t)pkt->data_len << CI_TXD_QW1_TX_BUF_SZ_S));
 
 	__m128i descriptor = _mm_set_epi64x(high_qw,
 					    pkt->buf_iova + pkt->data_off);
@@ -1019,8 +1018,7 @@ static __rte_always_inline void
 idpf_singleq_vtx(volatile struct ci_tx_desc *txdp,
 	 struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
 {
-	const uint64_t hi_qw_tmpl = (IDPF_TX_DESC_DTYPE_DATA  |
-			((uint64_t)flags  << IDPF_TXD_QW1_CMD_S));
+	const uint64_t hi_qw_tmpl = (CI_TX_DESC_DTYPE_DATA  | (flags <<
 CI_TXD_QW1_CMD_S));
 
 	/* if unaligned on 32-bit boundary, do one to align */
drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +8 -16
 	if (((uintptr_t)txdp & 0x1F) != 0 && nb_pkts != 0) {
@@ -1030,22 +1028,14 @@ idpf_singleq_vtx(volatile struct ci_tx_desc *txdp,
 
 	/* do 4 at a time while possible, in bursts */
 	for (; nb_pkts > 3; txdp += 4, pkt += 4, nb_pkts -= 4) {
-		uint64_t hi_qw3 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[3]->data_len <<
-			 IDPF_TXD_QW1_TX_BUF_SZ_S);
-		uint64_t hi_qw2 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[2]->data_len <<
-			 IDPF_TXD_QW1_TX_BUF_SZ_S);
-		uint64_t hi_qw1 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[1]->data_len <<
-			 IDPF_TXD_QW1_TX_BUF_SZ_S);
-		uint64_t hi_qw0 =
-			hi_qw_tmpl |
-			((uint64_t)pkt[0]->data_len <<
-			 IDPF_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw3 = hi_qw_tmpl |
+			((uint64_t)pkt[3]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw2 = hi_qw_tmpl |
+			((uint64_t)pkt[2]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw1 = hi_qw_tmpl |
+			((uint64_t)pkt[1]->data_len <<
 CI_TXD_QW1_TX_BUF_SZ_S);
+		uint64_t hi_qw0 = hi_qw_tmpl |
+			((uint64_t)pkt[0]->data_len <<

CI_TXD_QW1_TX_BUF_SZ_S);

drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +2 -2
 		__m512i desc0_3 =
 			_mm512_set_epi64
@@ -1075,8 +1065,8 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void
 *tx_queue, struct rte_mbuf **tx_pk
 	volatile struct ci_tx_desc *txdp;
 	struct ci_tx_entry_vec *txep;
 	uint16_t n, nb_commit, tx_id;
-	uint64_t flags = IDPF_TX_DESC_CMD_EOP;
-	uint64_t rs = IDPF_TX_DESC_CMD_RS | flags;
+	uint64_t flags = CI_TX_DESC_CMD_EOP;
+	uint64_t rs = CI_TX_DESC_CMD_RS | flags;
 
 	/* cross rx_thresh boundary is not allowed */
drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +1 -2
 	nb_pkts = RTE_MIN(nb_pkts, txq->tx_rs_thresh);
@@ -1124,8 +1114,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void
 *tx_queue, struct rte_mbuf **tx_pk
 	tx_id = (uint16_t)(tx_id + nb_commit);
 	if (tx_id > txq->tx_next_rs) {
 		txq->ci_tx_ring[txq->tx_next_rs].cmd_type_offset_bsz |=
-
 	rte_cpu_to_le_64(((uint64_t)IDPF_TX_DESC_CMD_RS) <<
-					 IDPF_TXD_QW1_CMD_S);
+			rte_cpu_to_le_64(((uint64_t)CI_TX_DESC_CMD_RS)
 << CI_TXD_QW1_CMD_S);
drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +0 -0
 		txq->tx_next_rs =
 			(uint16_t)(txq->tx_next_rs + txq->tx_rs_thresh);
 	}
drivers/net/intel/idpf/idpf_rxtx_vec_common.h +2 -2
index b5e8574667..a43d8f78e2 100644
@@ -32,8 +32,8 @@ idpf_tx_desc_done(struct ci_tx_queue *txq, uint16_t
 idx)
 		return 1;
 
 	return (txq->ci_tx_ring[idx].cmd_type_offset_bsz &
-			rte_cpu_to_le_64(IDPF_TXD_QW1_DTYPE_M)) ==
-
 	rte_cpu_to_le_64(IDPF_TX_DESC_DTYPE_DESC_DONE);
+			rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) ==
+
 	rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE);

}

static inline int
--
2.51.0

#81 lore raw

Re: [PATCH v3 04/36] net/intel: consolidate definitions for Tx desc fields

Quoted 61 lines · Ciara
Quoted 61 lines

-----Original Message-----
From: Bruce Richardson <[email protected]>
Sent: Friday 30 January 2026 11:42
To: [email protected]
Cc: Richardson, Bruce <[email protected]>; Medvedkin, Vladimir <[email protected]>; Burakov, Anatoly <[email protected]>; Wu, Jingjing <[email protected]>; Shetty, Praveen <[email protected]>
Subject: [PATCH v3 04/36] net/intel: consolidate definitions for Tx desc fields

The offsets of the various fields within the Tx descriptors are common for i40e, iavf, ice and idpf, so put a single set of defines in tx.h and use those throughout all drivers. (NOTE: there was a small difference in mask of CMD field between drivers depending on whether reserved fields or not were included. Those can be ignored as those bits are unused in the drivers for which they are reserved). Similarly, the various flag fields, such as End-of-packet (EOP) and Report-status (RS) are the same, as are offload definitions so consolidate them.

Original definitions are in base code, and are left in place because of that, but are unused.

---
 drivers/net/intel/common/tx.h                 |  64 +++++++-
 drivers/net/intel/i40e/i40e_fdir.c            |  24 +--
 drivers/net/intel/i40e/i40e_rxtx.c            |  92 ++++++------
 drivers/net/intel/i40e/i40e_rxtx.h            |  17 +--
 .../net/intel/i40e/i40e_rxtx_vec_altivec.c    |  11 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c   |  22 ++-
 drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c |  38 ++---
 drivers/net/intel/i40e/i40e_rxtx_vec_common.h |   4 +-
 drivers/net/intel/i40e/i40e_rxtx_vec_neon.c   |  11 +-
 drivers/net/intel/iavf/iavf_rxtx.c            |  68 +++++----
 drivers/net/intel/iavf/iavf_rxtx.h            |  20 +--
 drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c   |  41 ++----
 drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c |  80 ++++------
 drivers/net/intel/iavf/iavf_rxtx_vec_common.h |  34 ++---
 drivers/net/intel/ice/ice_dcf_ethdev.c        |   2 +-
 drivers/net/intel/ice/ice_rxtx.c              | 137 ++++++++----------
 drivers/net/intel/ice/ice_rxtx.h              |  15 +-
 drivers/net/intel/ice/ice_rxtx_vec_avx2.c     |  41 ++----
 drivers/net/intel/ice/ice_rxtx_vec_avx512.c   |  39 ++---
 drivers/net/intel/ice/ice_rxtx_vec_common.h   |  41 +++---
 drivers/net/intel/idpf/idpf_common_rxtx.c     |  22 +--
 drivers/net/intel/idpf/idpf_common_rxtx.h     |  12 --
 .../net/intel/idpf/idpf_common_rxtx_avx2.c    |  41 ++----
 .../net/intel/idpf/idpf_common_rxtx_avx512.c  |  41 ++----
 drivers/net/intel/idpf/idpf_rxtx_vec_common.h |   4 +-
 25 files changed, 408 insertions(+), 513 deletions(-)
drivers/net/intel/common/tx.h +0 -0
index a89412c195..03245d4fba 100644
@@ -10,6 +10,66 @@
 #include <rte_ethdev.h>
 #include <rte_vect.h>
 
Quoted 8 lines

drivers/net/intel/common/tx.h line 17

Quoted 5 lines
drivers/net/intel/common/tx.h +5 -0
+/* Common TX Descriptor QW1 Field Definitions */
+#define CI_TXD_QW1_DTYPE_S      0
+#define CI_TXD_QW1_DTYPE_M      (0xFUL << CI_TXD_QW1_DTYPE_S)
+#define CI_TXD_QW1_CMD_S        4
+#define CI_TXD_QW1_CMD_M        (0xFFFUL << CI_TXD_QW1_CMD_S)

This define is unused in the series.

I think I'll keep it in for completeness. The definitions all seem to go in shift-value and mask-value pairs.

Quoted 7 lines
Quoted 7 lines
drivers/net/intel/common/tx.h +5 -0
+#define CI_TXD_QW1_OFFSET_S     16
+#define CI_TXD_QW1_OFFSET_M     (0x3FFFFULL <<
 CI_TXD_QW1_OFFSET_S)
+#define CI_TXD_QW1_TX_BUF_SZ_S  34
+#define CI_TXD_QW1_TX_BUF_SZ_M  (0x3FFFULL <<
 CI_TXD_QW1_TX_BUF_SZ_S)
+#define CI_TXD_QW1_L2TAG1_S     48
Quoted 9 lines

drivers/net/intel/common/tx.h line 27

Quoted 5 lines
drivers/net/intel/common/tx.h +5 -0
+#define CI_TXD_QW1_L2TAG1_M     (0xFFFFULL << CI_TXD_QW1_L2TAG1_S)
+
+/* Common Descriptor Types */
+#define CI_TX_DESC_DTYPE_DATA           0x0
+#define CI_TX_DESC_DTYPE_CTX            0x1

This define is also unused, although there is scope to use it in patch 7 net/ice: refactor context descriptor handling

Will investigate. Again, even if unused, I think it is good to keep for completeness.

Quoted 53 lines
Quoted 53 lines
drivers/net/intel/common/tx.h +45 -0
+#define CI_TX_DESC_DTYPE_DESC_DONE      0xF
+
+/* Common TX Descriptor Command Flags */
+#define CI_TX_DESC_CMD_EOP              0x0001
+#define CI_TX_DESC_CMD_RS               0x0002
+#define CI_TX_DESC_CMD_ICRC             0x0004
+#define CI_TX_DESC_CMD_IL2TAG1          0x0008
+#define CI_TX_DESC_CMD_DUMMY            0x0010
+#define CI_TX_DESC_CMD_IIPT_IPV6        0x0020
+#define CI_TX_DESC_CMD_IIPT_IPV4        0x0040
+#define CI_TX_DESC_CMD_IIPT_IPV4_CSUM   0x0060
+#define CI_TX_DESC_CMD_L4T_EOFT_TCP     0x0100
+#define CI_TX_DESC_CMD_L4T_EOFT_SCTP    0x0200
+#define CI_TX_DESC_CMD_L4T_EOFT_UDP     0x0300
+
+/* Common TX Context Descriptor Commands */
+#define CI_TX_CTX_DESC_TSO              0x01
+#define CI_TX_CTX_DESC_TSYN             0x02
+#define CI_TX_CTX_DESC_IL2TAG2          0x04
+
+/* Common TX Descriptor Length Field Shifts */
+#define CI_TX_DESC_LEN_MACLEN_S         0  /* 7 BITS */
+#define CI_TX_DESC_LEN_IPLEN_S          7  /* 7 BITS */
+#define CI_TX_DESC_LEN_L4_LEN_S         14 /* 4 BITS */
+
+/* Common maximum data per TX descriptor */
+#define CI_MAX_DATA_PER_TXD     (CI_TXD_QW1_TX_BUF_SZ_M >>
 CI_TXD_QW1_TX_BUF_SZ_S)
+
+/**
+ * Common TX offload union for Intel drivers.
+ * Supports both basic offloads (l2_len, l3_len, l4_len, tso_segsz) and
+ * extended offloads (outer_l2_len, outer_l3_len) for tunneling support.
+ */
+union ci_tx_offload {
+	uint64_t data;
+	struct {
+		uint64_t l2_len:7;        /**< L2 (MAC) Header Length. */
+		uint64_t l3_len:9;        /**< L3 (IP) Header Length. */
+		uint64_t l4_len:8;        /**< L4 Header Length. */
+		uint64_t tso_segsz:16;    /**< TCP TSO segment size */
+		uint64_t outer_l2_len:8;  /**< outer L2 Header Length */
+		uint64_t outer_l3_len:16; /**< outer L3 Header Length */
+	};
+};
+

/*
* Structure of a 16-byte Tx descriptor common across i40e, ice, iavf and idpf
drivers
*/

drivers/net/intel/common/tx.h +0 -0
@@ -286,8 +346,8 @@ ci_tx_xmit_cleanup(struct ci_tx_queue *txq)
 	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
 
Quoted 6 lines
Quoted 2 lines
drivers/net/intel/common/tx.h +0 -0
 	/* Check if descriptor is done - all drivers use 0xF as done value in bits

3:0 */

I think this comment referencing 0xF is out of place now that we're not using 0xF rather CI_TX_DESC_DTYPE_DESC_DONE in the code below.

Ack. Will look to update.

/Bruce

#82 lore raw

PATCH v3 5/36 net/intel: create separate header for Tx scalar fns

In reply to Bruce Richardson

Rather than having all Tx code in the one file, which could start getting rather long, move the scalar datapath functions to a new header file.

---
 drivers/net/intel/common/tx.h            | 58 ++------------------
 drivers/net/intel/common/tx_scalar_fns.h | 67 ++++++++++++++++++++++++
 2 files changed, 72 insertions(+), 53 deletions(-)
 create mode 100644 drivers/net/intel/common/tx_scalar_fns.h
drivers/net/intel/common/tx.h +5 -53
index 03245d4fba..01e42303b4 100644
@@ -319,59 +319,6 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq, ci_desc_done_fn desc_done, bool ctx
 	return txq->tx_rs_thresh;
 }
 
-/*
- * Common transmit descriptor cleanup function for Intel drivers.
- * Used by ice, i40e, iavf, and idpf drivers.
- *
- * Returns:
- *   0 on success
- *  -1 if cleanup cannot proceed (descriptors not yet processed by HW)
- */
-static __rte_always_inline int
-ci_tx_xmit_cleanup(struct ci_tx_queue *txq)
-{
-	struct ci_tx_entry *sw_ring = txq->sw_ring;
-	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
-	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
-	uint16_t nb_tx_desc = txq->nb_tx_desc;
-	uint16_t desc_to_clean_to;
-	uint16_t nb_tx_to_clean;
-
-	/* Determine the last descriptor needing to be cleaned */
-	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
-	if (desc_to_clean_to >= nb_tx_desc)
-		desc_to_clean_to = (uint16_t)(desc_to_clean_to - nb_tx_desc);
-
-	/* Check to make sure the last descriptor to clean is done */
-	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
-
-	/* Check if descriptor is done - all drivers use 0xF as done value in bits 3:0 */
-	if ((txd[desc_to_clean_to].cmd_type_offset_bsz & rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) !=
-			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE)) {
-		/* Descriptor not yet processed by hardware */
-		return -1;
-	}
-
-	/* Figure out how many descriptors will be cleaned */
-	if (last_desc_cleaned > desc_to_clean_to)
-		nb_tx_to_clean = (uint16_t)((nb_tx_desc - last_desc_cleaned) + desc_to_clean_to);
-	else
-		nb_tx_to_clean = (uint16_t)(desc_to_clean_to - last_desc_cleaned);
-
-	/* The last descriptor to clean is done, so that means all the
-	 * descriptors from the last descriptor that was cleaned
-	 * up to the last descriptor with the RS bit set
-	 * are done. Only reset the threshold descriptor.
-	 */
-	txd[desc_to_clean_to].cmd_type_offset_bsz = 0;
-
-	/* Update the txq to reflect the last descriptor that was cleaned */
-	txq->last_desc_cleaned = desc_to_clean_to;
-	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + nb_tx_to_clean);
-
-	return 0;
-}
-
 static inline void
 ci_txq_release_all_mbufs(struct ci_tx_queue *txq, bool use_ctx)
 {
@@ -490,4 +437,9 @@ ci_tx_path_select(const struct ci_tx_path_features *req_features,
 	return idx;
 }
 
+/* include the scalar functions at the end, so they can use the common definitions.
+ * This is done so drivers can use all functions just by including tx.h
+ */
+#include "tx_scalar_fns.h"
+
 #endif /* _COMMON_INTEL_TX_H_ */
drivers/net/intel/common/tx_scalar_fns.h new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
2.51.0
#83 lore raw

RE: [PATCH v3 05/36] net/intel: create separate header for Tx scalar fns

Quoted 6 lines

Subject: [PATCH v3 05/36] net/intel: create separate header for Tx scalar fns

Rather than having all Tx code in the one file, which could start getting rather long, move the scalar datapath functions to a new header file.

Quoted 7 lines
---
 drivers/net/intel/common/tx.h            | 58 ++------------------
 drivers/net/intel/common/tx_scalar_fns.h | 67
++++++++++++++++++++++++
 2 files changed, 72 insertions(+), 53 deletions(-)
 create mode 100644 drivers/net/intel/common/tx_scalar_fns.h

Why not create the file when ci_tx_xmit_cleanup was first introduced? I prefer the naming tx_scalar.h but keep tx_scalar_fns.h if you feel it's better.

Quoted 91 lines
drivers/net/intel/common/tx.h +0 -0
index 03245d4fba..01e42303b4 100644
@@ -319,59 +319,6 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq,

ci_desc_done_fn desc_done, bool ctx

drivers/net/intel/common/tx.h +0 -22
 	return txq->tx_rs_thresh;
 }
 
-/*
- * Common transmit descriptor cleanup function for Intel drivers.
- * Used by ice, i40e, iavf, and idpf drivers.
- *
- * Returns:
- *   0 on success
- *  -1 if cleanup cannot proceed (descriptors not yet processed by HW)
- */
-static __rte_always_inline int
-ci_tx_xmit_cleanup(struct ci_tx_queue *txq)
-{
-	struct ci_tx_entry *sw_ring = txq->sw_ring;
-	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
-	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
-	uint16_t nb_tx_desc = txq->nb_tx_desc;
-	uint16_t desc_to_clean_to;
-	uint16_t nb_tx_to_clean;
-
-	/* Determine the last descriptor needing to be cleaned */
-	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
-	if (desc_to_clean_to >= nb_tx_desc)
-		desc_to_clean_to = (uint16_t)(desc_to_clean_to -

nb_tx_desc);

drivers/net/intel/common/tx.h +0 -5
-
-	/* Check to make sure the last descriptor to clean is done */
-	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
-
-	/* Check if descriptor is done - all drivers use 0xF as done value in bits

3:0 */

drivers/net/intel/common/tx.h +0 -1
-	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &

rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) !=

drivers/net/intel/common/tx.h +0 -1
-			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE))

{

drivers/net/intel/common/tx.h +1 -9
-		/* Descriptor not yet processed by hardware */
-		return -1;
-	}
-
-	/* Figure out how many descriptors will be cleaned */
-	if (last_desc_cleaned > desc_to_clean_to)
-		nb_tx_to_clean = (uint16_t)((nb_tx_desc - last_desc_cleaned)
+ desc_to_clean_to);
-	else
-		nb_tx_to_clean = (uint16_t)(desc_to_clean_to -

last_desc_cleaned);

drivers/net/intel/common/tx.h +1 -15
-
-	/* The last descriptor to clean is done, so that means all the
-	 * descriptors from the last descriptor that was cleaned
-	 * up to the last descriptor with the RS bit set
-	 * are done. Only reset the threshold descriptor.
-	 */
-	txd[desc_to_clean_to].cmd_type_offset_bsz = 0;
-
-	/* Update the txq to reflect the last descriptor that was cleaned */
-	txq->last_desc_cleaned = desc_to_clean_to;
-	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + nb_tx_to_clean);
-
-	return 0;
-}
-
 static inline void
 ci_txq_release_all_mbufs(struct ci_tx_queue *txq, bool use_ctx)
 {
@@ -490,4 +437,9 @@ ci_tx_path_select(const struct ci_tx_path_features
 *req_features,
 	return idx;
 }
 
+/* include the scalar functions at the end, so they can use the common

definitions.
+ * This is done so drivers can use all functions just by including tx.h
+ */

drivers/net/intel/common/tx.h +2 -0
+#include "tx_scalar_fns.h"
+
 #endif /* _COMMON_INTEL_TX_H_ */
drivers/net/intel/common/tx_scalar_fns.h new file +0 -0
new file mode 100644
index 0000000000..c79210d084

drivers/net/intel/common/tx_scalar_fns.h line 2

Quoted 2 lines
drivers/net/intel/common/tx_scalar_fns.h new file +2 -0
@@ -0,0 +1,67 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2025 Intel Corporation

Should this be 2026?

Quoted 4 lines
drivers/net/intel/common/tx_scalar_fns.h new file +4 -0
+ */
+
+#ifndef _COMMON_INTEL_TX_SCALAR_FNS_H_
+#define _COMMON_INTEL_TX_SCALAR_FNS_H_

drivers/net/intel/common/tx_scalar_fns.h line 16

Quoted 10 lines
drivers/net/intel/common/tx_scalar_fns.h new file +10 -0
+
+#include <stdint.h>
+#include <rte_byteorder.h>
+
+/* depends on common Tx definitions. */
+#include "tx.h"
+
+/*
+ * Common transmit descriptor cleanup function for Intel drivers.
+ * Used by ice, i40e, iavf, and idpf drivers.

Do we need to call out the driver names in the comment? If a new driver were to adopt this function they would need to patch this file too to update the comment.

Quoted 59 lines
drivers/net/intel/common/tx_scalar_fns.h new file +19 -0
+ *
+ * Returns:
+ *   0 on success
+ *  -1 if cleanup cannot proceed (descriptors not yet processed by HW)
+ */
+static __rte_always_inline int
+ci_tx_xmit_cleanup(struct ci_tx_queue *txq)
+{
+	struct ci_tx_entry *sw_ring = txq->sw_ring;
+	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
+	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
+	uint16_t nb_tx_desc = txq->nb_tx_desc;
+	uint16_t desc_to_clean_to;
+	uint16_t nb_tx_to_clean;
+
+	/* Determine the last descriptor needing to be cleaned */
+	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
+	if (desc_to_clean_to >= nb_tx_desc)
+		desc_to_clean_to = (uint16_t)(desc_to_clean_to -

nb_tx_desc);

drivers/net/intel/common/tx_scalar_fns.h new file +5 -0
+
+	/* Check to make sure the last descriptor to clean is done */
+	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
+
+	/* Check if descriptor is done - all drivers use 0xF as done value in bits

3:0 */

drivers/net/intel/common/tx_scalar_fns.h new file +1 -0
+	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &

rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) !=

drivers/net/intel/common/tx_scalar_fns.h new file +1 -0
+			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE))

{

drivers/net/intel/common/tx_scalar_fns.h new file +10 -0
+		/* Descriptor not yet processed by hardware */
+		return -1;
+	}
+
+	/* Figure out how many descriptors will be cleaned */
+	if (last_desc_cleaned > desc_to_clean_to)
+		nb_tx_to_clean = (uint16_t)((nb_tx_desc - last_desc_cleaned)
+ desc_to_clean_to);
+	else
+		nb_tx_to_clean = (uint16_t)(desc_to_clean_to -

last_desc_cleaned);

drivers/net/intel/common/tx_scalar_fns.h new file +16 -1
+
+	/* The last descriptor to clean is done, so that means all the
+	 * descriptors from the last descriptor that was cleaned
+	 * up to the last descriptor with the RS bit set
+	 * are done. Only reset the threshold descriptor.
+	 */
+	txd[desc_to_clean_to].cmd_type_offset_bsz = 0;
+
+	/* Update the txq to reflect the last descriptor that was cleaned */
+	txq->last_desc_cleaned = desc_to_clean_to;
+	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + nb_tx_to_clean);
+
+	return 0;
+}
+
+#endif /* _COMMON_INTEL_TX_SCALAR_FNS_H_ */
--

2.51.0

#84 lore raw

Re: [PATCH v3 05/36] net/intel: create separate header for Tx scalar fns

Quoted 14 lines · Ciara
Quoted 6 lines

Subject: [PATCH v3 05/36] net/intel: create separate header for Tx scalar fns

Rather than having all Tx code in the one file, which could start getting rather long, move the scalar datapath functions to a new header file.

Quoted 7 lines
---
 drivers/net/intel/common/tx.h            | 58 ++------------------
 drivers/net/intel/common/tx_scalar_fns.h | 67
++++++++++++++++++++++++
 2 files changed, 72 insertions(+), 53 deletions(-)
 create mode 100644 drivers/net/intel/common/tx_scalar_fns.h
Quoted 3 lines

Why not create the file when ci_tx_xmit_cleanup was first introduced? I prefer the naming tx_scalar.h but keep tx_scalar_fns.h if you feel it's better.

Not pushed about the name, so happy with your suggestion. I'll try and create this file back in patch 3 - some heavy rebasing will be necessary!

Quoted 87 lines
Quoted 87 lines
drivers/net/intel/common/tx.h +0 -0
index 03245d4fba..01e42303b4 100644
@@ -319,59 +319,6 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq,

ci_desc_done_fn desc_done, bool ctx

drivers/net/intel/common/tx.h +0 -22
 	return txq->tx_rs_thresh;
 }
 
-/*
- * Common transmit descriptor cleanup function for Intel drivers.
- * Used by ice, i40e, iavf, and idpf drivers.
- *
- * Returns:
- *   0 on success
- *  -1 if cleanup cannot proceed (descriptors not yet processed by HW)
- */
-static __rte_always_inline int
-ci_tx_xmit_cleanup(struct ci_tx_queue *txq)
-{
-	struct ci_tx_entry *sw_ring = txq->sw_ring;
-	volatile struct ci_tx_desc *txd = txq->ci_tx_ring;
-	uint16_t last_desc_cleaned = txq->last_desc_cleaned;
-	uint16_t nb_tx_desc = txq->nb_tx_desc;
-	uint16_t desc_to_clean_to;
-	uint16_t nb_tx_to_clean;
-
-	/* Determine the last descriptor needing to be cleaned */
-	desc_to_clean_to = (uint16_t)(last_desc_cleaned + txq->tx_rs_thresh);
-	if (desc_to_clean_to >= nb_tx_desc)
-		desc_to_clean_to = (uint16_t)(desc_to_clean_to -

nb_tx_desc);

drivers/net/intel/common/tx.h +0 -5
-
-	/* Check to make sure the last descriptor to clean is done */
-	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
-
-	/* Check if descriptor is done - all drivers use 0xF as done value in bits

3:0 */

drivers/net/intel/common/tx.h +0 -1
-	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &

rte_cpu_to_le_64(CI_TXD_QW1_DTYPE_M)) !=

drivers/net/intel/common/tx.h +0 -1
-			rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DESC_DONE))

{

drivers/net/intel/common/tx.h +1 -9
-		/* Descriptor not yet processed by hardware */
-		return -1;
-	}
-
-	/* Figure out how many descriptors will be cleaned */
-	if (last_desc_cleaned > desc_to_clean_to)
-		nb_tx_to_clean = (uint16_t)((nb_tx_desc - last_desc_cleaned)
+ desc_to_clean_to);
-	else
-		nb_tx_to_clean = (uint16_t)(desc_to_clean_to -

last_desc_cleaned);

drivers/net/intel/common/tx.h +1 -15
-
-	/* The last descriptor to clean is done, so that means all the
-	 * descriptors from the last descriptor that was cleaned
-	 * up to the last descriptor with the RS bit set
-	 * are done. Only reset the threshold descriptor.
-	 */
-	txd[desc_to_clean_to].cmd_type_offset_bsz = 0;
-
-	/* Update the txq to reflect the last descriptor that was cleaned */
-	txq->last_desc_cleaned = desc_to_clean_to;
-	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + nb_tx_to_clean);
-
-	return 0;
-}
-
 static inline void
 ci_txq_release_all_mbufs(struct ci_tx_queue *txq, bool use_ctx)
 {
@@ -490,4 +437,9 @@ ci_tx_path_select(const struct ci_tx_path_features
 *req_features,
 	return idx;
 }
 
+/* include the scalar functions at the end, so they can use the common

definitions.
+ * This is done so drivers can use all functions just by including tx.h
+ */

drivers/net/intel/common/tx.h +2 -0
+#include "tx_scalar_fns.h"
+
 #endif /* _COMMON_INTEL_TX_H_ */
drivers/net/intel/common/tx_scalar_fns.h new file +0 -0
new file mode 100644
Quoted 9 lines

drivers/net/intel/common/tx_scalar_fns.h line 2

Quoted 6 lines

index 0000000000..c79210d084

drivers/net/intel/common/tx_scalar_fns.h new file +2 -0
@@ -0,0 +1,67 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2025 Intel Corporation

Should this be 2026?

Code was written in 2025 and actually submitted upstream for the first time in December 2025, so I think this is correct as-is. [Open to correction]

Quoted 10 lines
Quoted 10 lines
drivers/net/intel/common/tx_scalar_fns.h new file +10 -0
+ */
+
+#ifndef _COMMON_INTEL_TX_SCALAR_FNS_H_
+#define _COMMON_INTEL_TX_SCALAR_FNS_H_
+
+#include <stdint.h>
+#include <rte_byteorder.h>
+
+/* depends on common Tx definitions. */
+#include "tx.h"
Quoted 9 lines

drivers/net/intel/common/tx_scalar_fns.h line 16

Quoted 4 lines
drivers/net/intel/common/tx_scalar_fns.h new file +4 -0
+
+/*
+ * Common transmit descriptor cleanup function for Intel drivers.
+ * Used by ice, i40e, iavf, and idpf drivers.

Do we need to call out the driver names in the comment? If a new driver were to adopt this function they would need to patch this file too to update the comment.

Good point, I'll try and generalize

/Bruce

#85 lore raw

PATCH v3 6/36 net/intel: add common fn to calculate needed descriptors

In reply to Bruce Richardson

Multiple drivers used the same logic to calculate how many Tx data descriptors were needed. Move that calculation to common code. In the process of updating drivers, fix idpf driver calculation for the TSO case.

---
 drivers/net/intel/common/tx_scalar_fns.h  | 21 +++++++++++++++++++++
 drivers/net/intel/i40e/i40e_rxtx.c        | 18 +-----------------
 drivers/net/intel/iavf/iavf_rxtx.c        | 17 +----------------
 drivers/net/intel/ice/ice_rxtx.c          | 18 +-----------------
 drivers/net/intel/idpf/idpf_common_rxtx.c | 21 +++++++++++++++++----
 5 files changed, 41 insertions(+), 54 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +21 -0
index c79210d084..f894cea616 100644
@@ -64,4 +64,25 @@ ci_tx_xmit_cleanup(struct ci_tx_queue *txq)
 	return 0;
 }
 
+static inline uint16_t
+ci_div_roundup16(uint16_t x, uint16_t y)
+{
+	return (uint16_t)((x + y - 1) / y);
+}
+
+/* Calculate the number of TX descriptors needed for each pkt */
+static inline uint16_t
+ci_calc_pkt_desc(const struct rte_mbuf *tx_pkt)
+{
+	uint16_t count = 0;
+
+	while (tx_pkt != NULL) {
+		count += ci_div_roundup16(tx_pkt->data_len, CI_MAX_DATA_PER_TXD);
+		tx_pkt = tx_pkt->next;
+	}
+
+	return count;
+}
+
+
 #endif /* _COMMON_INTEL_TX_SCALAR_FNS_H_ */
drivers/net/intel/i40e/i40e_rxtx.c +1 -17
index f96c5c7f1e..b75306931a 100644
@@ -1029,21 +1029,6 @@ i40e_set_tso_ctx(struct rte_mbuf *mbuf, union ci_tx_offload tx_offload)
 	return ctx_desc;
 }
 
-/* Calculate the number of TX descriptors needed for each pkt */
-static inline uint16_t
-i40e_calc_pkt_desc(struct rte_mbuf *tx_pkt)
-{
-	struct rte_mbuf *txd = tx_pkt;
-	uint16_t count = 0;
-
-	while (txd != NULL) {
-		count += DIV_ROUND_UP(txd->data_len, CI_MAX_DATA_PER_TXD);
-		txd = txd->next;
-	}
-
-	return count;
-}
-
 uint16_t
 i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
@@ -1106,8 +1091,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		 * per tx desc.
 		 */
 		if (ol_flags & RTE_MBUF_F_TX_TCP_SEG)
-			nb_used = (uint16_t)(i40e_calc_pkt_desc(tx_pkt) +
-					     nb_ctx);
+			nb_used = (uint16_t)(ci_calc_pkt_desc(tx_pkt) + nb_ctx);
 		else
 			nb_used = (uint16_t)(tx_pkt->nb_segs + nb_ctx);
 		tx_last = (uint16_t)(tx_id + nb_used - 1);
drivers/net/intel/iavf/iavf_rxtx.c +1 -16
index 947b6c24d2..885d9309cc 100644
@@ -2666,21 +2666,6 @@ iavf_build_data_desc_cmd_offset_fields(volatile uint64_t *qw1,
 		((uint64_t)l2tag1 << IAVF_TXD_DATA_QW1_L2TAG1_SHIFT));
 }
 
-/* Calculate the number of TX descriptors needed for each pkt */
-static inline uint16_t
-iavf_calc_pkt_desc(struct rte_mbuf *tx_pkt)
-{
-	struct rte_mbuf *txd = tx_pkt;
-	uint16_t count = 0;
-
-	while (txd != NULL) {
-		count += (txd->data_len + CI_MAX_DATA_PER_TXD - 1) / CI_MAX_DATA_PER_TXD;
-		txd = txd->next;
-	}
-
-	return count;
-}
-
 static inline void
 iavf_fill_data_desc(volatile struct ci_tx_desc *desc,
 	uint64_t desc_template,	uint16_t buffsz,
@@ -2766,7 +2751,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		 * per tx desc.
 		 */
 		if (mb->ol_flags & RTE_MBUF_F_TX_TCP_SEG)
-			nb_desc_required = iavf_calc_pkt_desc(mb) + nb_desc_ctx + nb_desc_ipsec;
+			nb_desc_required = ci_calc_pkt_desc(mb) + nb_desc_ctx + nb_desc_ipsec;
 		else
 			nb_desc_required = nb_desc_data + nb_desc_ctx + nb_desc_ipsec;
 
drivers/net/intel/ice/ice_rxtx.c +1 -17
index 52bbf95967..2a53b614b2 100644
@@ -3075,21 +3075,6 @@ ice_set_tso_ctx(struct rte_mbuf *mbuf, union ci_tx_offload tx_offload)
 	return ctx_desc;
 }
 
-/* Calculate the number of TX descriptors needed for each pkt */
-static inline uint16_t
-ice_calc_pkt_desc(struct rte_mbuf *tx_pkt)
-{
-	struct rte_mbuf *txd = tx_pkt;
-	uint16_t count = 0;
-
-	while (txd != NULL) {
-		count += DIV_ROUND_UP(txd->data_len, CI_MAX_DATA_PER_TXD);
-		txd = txd->next;
-	}
-
-	return count;
-}
-
 uint16_t
 ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
@@ -3152,8 +3137,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		 * per tx desc.
 		 */
 		if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG))
-			nb_used = (uint16_t)(ice_calc_pkt_desc(tx_pkt) +
-					     nb_ctx);
+			nb_used = (uint16_t)(ci_calc_pkt_desc(tx_pkt) + nb_ctx);
 		else
 			nb_used = (uint16_t)(tx_pkt->nb_segs + nb_ctx);
 		tx_last = (uint16_t)(tx_id + nb_used - 1);
drivers/net/intel/idpf/idpf_common_rxtx.c +17 -4
index 587871b54a..11d6848430 100644
@@ -934,7 +934,16 @@ idpf_dp_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		tx_offload.tso_segsz = tx_pkt->tso_segsz;
 		/* Calculate the number of context descriptors needed. */
 		nb_ctx = idpf_calc_context_desc(ol_flags);
-		nb_used = tx_pkt->nb_segs + nb_ctx;
+
+		/* Calculate the number of TX descriptors needed for
+		 * each packet. For TSO packets, use ci_calc_pkt_desc as
+		 * the mbuf data size might exceed max data size that hw allows
+		 * per tx desc.
+		 */
+		if (ol_flags & RTE_MBUF_F_TX_TCP_SEG)
+			nb_used = ci_calc_pkt_desc(tx_pkt) + nb_ctx;
+		else
+			nb_used = tx_pkt->nb_segs + nb_ctx;
 
 		if (ol_flags & IDPF_TX_CKSUM_OFFLOAD_MASK)
 			cmd_dtype = IDPF_TXD_FLEX_FLOW_CMD_CS_EN;
@@ -1382,10 +1391,14 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		nb_ctx = idpf_calc_context_desc(ol_flags);
 
 		/* The number of descriptors that must be allocated for
-		 * a packet equals to the number of the segments of that
-		 * packet plus 1 context descriptor if needed.
+		 * a packet. For TSO packets, use ci_calc_pkt_desc as
+		 * the mbuf data size might exceed max data size that hw allows
+		 * per tx desc.
 		 */
-		nb_used = (uint16_t)(tx_pkt->nb_segs + nb_ctx);
+		if (ol_flags & RTE_MBUF_F_TX_TCP_SEG)
+			nb_used = (uint16_t)(ci_calc_pkt_desc(tx_pkt) + nb_ctx);
+		else
+			nb_used = (uint16_t)(tx_pkt->nb_segs + nb_ctx);
 		tx_last = (uint16_t)(tx_id + nb_used - 1);
 
 		/* Circular ring */
Signature · 1 line
2.51.0
#86 lore raw

RE: [PATCH v3 06/36] net/intel: add common fn to calculate needed descriptors

Quoted 7 lines

Subject: [PATCH v3 06/36] net/intel: add common fn to calculate needed descriptors

Multiple drivers used the same logic to calculate how many Tx data descriptors were needed. Move that calculation to common code. In the process of updating drivers, fix idpf driver calculation for the TSO case.

Should this fix be split out into a separate patch with a Fixes tag?

Quoted 215 lines
---
 drivers/net/intel/common/tx_scalar_fns.h  | 21 +++++++++++++++++++++
 drivers/net/intel/i40e/i40e_rxtx.c        | 18 +-----------------
 drivers/net/intel/iavf/iavf_rxtx.c        | 17 +----------------
 drivers/net/intel/ice/ice_rxtx.c          | 18 +-----------------
 drivers/net/intel/idpf/idpf_common_rxtx.c | 21 +++++++++++++++++----
 5 files changed, 41 insertions(+), 54 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +21 -0
index c79210d084..f894cea616 100644
@@ -64,4 +64,25 @@ ci_tx_xmit_cleanup(struct ci_tx_queue *txq)
 	return 0;
 }
 
+static inline uint16_t
+ci_div_roundup16(uint16_t x, uint16_t y)
+{
+	return (uint16_t)((x + y - 1) / y);
+}
+
+/* Calculate the number of TX descriptors needed for each pkt */
+static inline uint16_t
+ci_calc_pkt_desc(const struct rte_mbuf *tx_pkt)
+{
+	uint16_t count = 0;
+
+	while (tx_pkt != NULL) {
+		count += ci_div_roundup16(tx_pkt->data_len,
 CI_MAX_DATA_PER_TXD);
+		tx_pkt = tx_pkt->next;
+	}
+
+	return count;
+}
+
+

#endif /* _COMMON_INTEL_TX_SCALAR_FNS_H_ */

drivers/net/intel/i40e/i40e_rxtx.c +0 -15
index f96c5c7f1e..b75306931a 100644
@@ -1029,21 +1029,6 @@ i40e_set_tso_ctx(struct rte_mbuf *mbuf, union
 ci_tx_offload tx_offload)
 	return ctx_desc;
 }
 
-/* Calculate the number of TX descriptors needed for each pkt */
-static inline uint16_t
-i40e_calc_pkt_desc(struct rte_mbuf *tx_pkt)
-{
-	struct rte_mbuf *txd = tx_pkt;
-	uint16_t count = 0;
-
-	while (txd != NULL) {
-		count += DIV_ROUND_UP(txd->data_len,
 CI_MAX_DATA_PER_TXD);
-		txd = txd->next;
-	}
-
-	return count;
-}
-
 uint16_t

i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t
nb_pkts)
{

drivers/net/intel/i40e/i40e_rxtx.c +1 -2
@@ -1106,8 +1091,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 		 * per tx desc.
 		 */
 		if (ol_flags & RTE_MBUF_F_TX_TCP_SEG)
-			nb_used = (uint16_t)(i40e_calc_pkt_desc(tx_pkt) +
-					     nb_ctx);
+			nb_used = (uint16_t)(ci_calc_pkt_desc(tx_pkt) +
 nb_ctx);
 		else
drivers/net/intel/i40e/i40e_rxtx.c +0 -0
 			nb_used = (uint16_t)(tx_pkt->nb_segs + nb_ctx);
 		tx_last = (uint16_t)(tx_id + nb_used - 1);
drivers/net/intel/iavf/iavf_rxtx.c +0 -15
index 947b6c24d2..885d9309cc 100644
@@ -2666,21 +2666,6 @@ iavf_build_data_desc_cmd_offset_fields(volatile
 uint64_t *qw1,
 		((uint64_t)l2tag1 << IAVF_TXD_DATA_QW1_L2TAG1_SHIFT));
 }
 
-/* Calculate the number of TX descriptors needed for each pkt */
-static inline uint16_t
-iavf_calc_pkt_desc(struct rte_mbuf *tx_pkt)
-{
-	struct rte_mbuf *txd = tx_pkt;
-	uint16_t count = 0;
-
-	while (txd != NULL) {
-		count += (txd->data_len + CI_MAX_DATA_PER_TXD - 1) /
 CI_MAX_DATA_PER_TXD;
-		txd = txd->next;
-	}
-
-	return count;
-}
-
 static inline void

iavf_fill_data_desc(volatile struct ci_tx_desc *desc,

drivers/net/intel/iavf/iavf_rxtx.c +1 -1
 	uint64_t desc_template,	uint16_t buffsz,
@@ -2766,7 +2751,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 		 * per tx desc.
 		 */
 		if (mb->ol_flags & RTE_MBUF_F_TX_TCP_SEG)
-			nb_desc_required = iavf_calc_pkt_desc(mb) +
 nb_desc_ctx + nb_desc_ipsec;
+			nb_desc_required = ci_calc_pkt_desc(mb) +
 nb_desc_ctx + nb_desc_ipsec;
drivers/net/intel/iavf/iavf_rxtx.c +0 -0
 		else
 			nb_desc_required = nb_desc_data + nb_desc_ctx +

nb_desc_ipsec;

drivers/net/intel/ice/ice_rxtx.c +0 -15
index 52bbf95967..2a53b614b2 100644
@@ -3075,21 +3075,6 @@ ice_set_tso_ctx(struct rte_mbuf *mbuf, union
 ci_tx_offload tx_offload)
 	return ctx_desc;
 }
 
-/* Calculate the number of TX descriptors needed for each pkt */
-static inline uint16_t
-ice_calc_pkt_desc(struct rte_mbuf *tx_pkt)
-{
-	struct rte_mbuf *txd = tx_pkt;
-	uint16_t count = 0;
-
-	while (txd != NULL) {
-		count += DIV_ROUND_UP(txd->data_len,
 CI_MAX_DATA_PER_TXD);
-		txd = txd->next;
-	}
-
-	return count;
-}
-
 uint16_t

ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) {

drivers/net/intel/ice/ice_rxtx.c +1 -2
@@ -3152,8 +3137,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 		 * per tx desc.
 		 */
 		if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG |
 RTE_MBUF_F_TX_UDP_SEG))
-			nb_used = (uint16_t)(ice_calc_pkt_desc(tx_pkt) +
-					     nb_ctx);
+			nb_used = (uint16_t)(ci_calc_pkt_desc(tx_pkt) +
 nb_ctx);
drivers/net/intel/ice/ice_rxtx.c +0 -0
 		else
 			nb_used = (uint16_t)(tx_pkt->nb_segs + nb_ctx);
 		tx_last = (uint16_t)(tx_id + nb_used - 1);
drivers/net/intel/idpf/idpf_common_rxtx.c +4 -1
index 587871b54a..11d6848430 100644
@@ -934,7 +934,16 @@ idpf_dp_splitq_xmit_pkts(void *tx_queue, struct
 rte_mbuf **tx_pkts,
 		tx_offload.tso_segsz = tx_pkt->tso_segsz;
 		/* Calculate the number of context descriptors needed. */
 		nb_ctx = idpf_calc_context_desc(ol_flags);
-		nb_used = tx_pkt->nb_segs + nb_ctx;
+
+		/* Calculate the number of TX descriptors needed for
+		 * each packet. For TSO packets, use ci_calc_pkt_desc as
+		 * the mbuf data size might exceed max data size that hw

allows

drivers/net/intel/idpf/idpf_common_rxtx.c +8 -2
+		 * per tx desc.
+		 */
+		if (ol_flags & RTE_MBUF_F_TX_TCP_SEG)
+			nb_used = ci_calc_pkt_desc(tx_pkt) + nb_ctx;
+		else
+			nb_used = tx_pkt->nb_segs + nb_ctx;
 
 		if (ol_flags & IDPF_TX_CKSUM_OFFLOAD_MASK)
 			cmd_dtype = IDPF_TXD_FLEX_FLOW_CMD_CS_EN;
@@ -1382,10 +1391,14 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue,
 struct rte_mbuf **tx_pkts,
 		nb_ctx = idpf_calc_context_desc(ol_flags);
 
 		/* The number of descriptors that must be allocated for
-		 * a packet equals to the number of the segments of that
-		 * packet plus 1 context descriptor if needed.
+		 * a packet. For TSO packets, use ci_calc_pkt_desc as
+		 * the mbuf data size might exceed max data size that hw

allows

drivers/net/intel/idpf/idpf_common_rxtx.c +3 -1
+		 * per tx desc.
 		 */
-		nb_used = (uint16_t)(tx_pkt->nb_segs + nb_ctx);
+		if (ol_flags & RTE_MBUF_F_TX_TCP_SEG)
+			nb_used = (uint16_t)(ci_calc_pkt_desc(tx_pkt) +

nb_ctx);

drivers/net/intel/idpf/idpf_common_rxtx.c +2 -1
+		else
+			nb_used = (uint16_t)(tx_pkt->nb_segs + nb_ctx);
 		tx_last = (uint16_t)(tx_id + nb_used - 1);
 
 		/* Circular ring */
--

2.51.0

#87 lore raw

Re: [PATCH v3 06/36] net/intel: add common fn to calculate needed descriptors

Quoted 10 lines · Ciara
Quoted 7 lines

Subject: [PATCH v3 06/36] net/intel: add common fn to calculate needed descriptors

Multiple drivers used the same logic to calculate how many Tx data descriptors were needed. Move that calculation to common code. In the process of updating drivers, fix idpf driver calculation for the TSO case.

Should this fix be split out into a separate patch with a Fixes tag?

I think it would need a separate independent fix for backporting.

/Bruce

#88 lore raw

PATCH v3 7/36 net/ice: refactor context descriptor handling

In reply to Bruce Richardson

Create a single function to manage all context descriptor handling, which returns either 0 or 1 depending on whether a descriptor is needed or not, as well as returning directly the descriptor contents if relevant.

---
 drivers/net/intel/ice/ice_rxtx.c | 104 +++++++++++++++++--------------
 1 file changed, 57 insertions(+), 47 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +57 -47
index 2a53b614b2..cc442fed75 100644
@@ -2966,10 +2966,6 @@ ice_txd_enable_checksum(uint64_t ol_flags,
 			uint32_t *td_offset,
 			union ci_tx_offload tx_offload)
 {
-	/* Set MACLEN */
-	if (!(ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK))
-		*td_offset |= (tx_offload.l2_len >> 1)
-			<< CI_TX_DESC_LEN_MACLEN_S;
 
 	/* Enable L3 checksum offloads */
 	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
@@ -3052,7 +3048,7 @@ ice_calc_context_desc(uint64_t flags)
 
 /* set ice TSO context descriptor */
 static inline uint64_t
-ice_set_tso_ctx(struct rte_mbuf *mbuf, union ci_tx_offload tx_offload)
+ice_set_tso_ctx(uint64_t ol_flags, const struct rte_mbuf *mbuf, union ci_tx_offload tx_offload)
 {
 	uint64_t ctx_desc = 0;
 	uint32_t cd_cmd, hdr_len, cd_tso_len;
@@ -3063,7 +3059,7 @@ ice_set_tso_ctx(struct rte_mbuf *mbuf, union ci_tx_offload tx_offload)
 	}
 
 	hdr_len = tx_offload.l2_len + tx_offload.l3_len + tx_offload.l4_len;
-	hdr_len += (mbuf->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) ?
+	hdr_len += (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) ?
 		   tx_offload.outer_l2_len + tx_offload.outer_l3_len : 0;
 
 	cd_cmd = CI_TX_CTX_DESC_TSO;
@@ -3075,6 +3071,49 @@ ice_set_tso_ctx(struct rte_mbuf *mbuf, union ci_tx_offload tx_offload)
 	return ctx_desc;
 }
 
+/* compute a context descriptor if one is necessary based on the ol_flags
+ *
+ * Returns 0 if no descriptor is necessary.
+ * Returns 1 if one is necessary and the contents of the descriptor are returned
+ *   in the values pointed to by qw0 and qw1. td_offset may also be modified.
+ */
+static __rte_always_inline uint16_t
+get_context_desc(uint64_t ol_flags, const struct rte_mbuf *tx_pkt,
+	const union ci_tx_offload *tx_offload, const struct ci_tx_queue *txq,
+	uint64_t *qw0, uint64_t *qw1)
+{
+	uint16_t cd_l2tag2 = 0;
+	uint64_t cd_type_cmd_tso_mss = ICE_TX_DESC_DTYPE_CTX;
+	uint32_t cd_tunneling_params = 0;
+	uint64_t ptp_tx_index = txq->ice_vsi->adapter->ptp_tx_index;
+
+	if (ice_calc_context_desc(ol_flags) == 0)
+		return 0;
+
+	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK)
+		ice_parse_tunneling_params(ol_flags, *tx_offload, &cd_tunneling_params);
+
+	if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG))
+		cd_type_cmd_tso_mss |= ice_set_tso_ctx(ol_flags, tx_pkt, *tx_offload);
+	else if (ol_flags & RTE_MBUF_F_TX_IEEE1588_TMST)
+		cd_type_cmd_tso_mss |=
+			((uint64_t)CI_TX_CTX_DESC_TSYN << CI_TXD_QW1_CMD_S) |
+			((ptp_tx_index << ICE_TXD_CTX_QW1_TSYN_S) & ICE_TXD_CTX_QW1_TSYN_M);
+
+
+	/* TX context descriptor based double VLAN insert */
+	if (ol_flags & RTE_MBUF_F_TX_QINQ) {
+		cd_l2tag2 = tx_pkt->vlan_tci_outer;
+		cd_type_cmd_tso_mss |= ((uint64_t)CI_TX_CTX_DESC_IL2TAG2 << CI_TXD_QW1_CMD_S);
+	}
+
+	*qw0 = rte_cpu_to_le_32(cd_tunneling_params) |
+		((uint64_t)rte_cpu_to_le_16(cd_l2tag2) << 32);
+	*qw1 = rte_cpu_to_le_64(cd_type_cmd_tso_mss);
+
+	return 1;
+}
+
 uint16_t
 ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
@@ -3085,7 +3124,6 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	struct ci_tx_entry *txe, *txn;
 	struct rte_mbuf *tx_pkt;
 	struct rte_mbuf *m_seg;
-	uint32_t cd_tunneling_params;
 	uint16_t tx_id;
 	uint16_t ts_id = -1;
 	uint16_t nb_tx;
@@ -3096,6 +3134,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	uint32_t td_tag = 0;
 	uint16_t tx_last;
 	uint16_t slen;
+	uint16_t l2_len;
 	uint64_t buf_dma_addr;
 	uint64_t ol_flags;
 	union ci_tx_offload tx_offload = {0};
@@ -3114,20 +3153,25 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		(void)ci_tx_xmit_cleanup(txq);
 
 	for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
+		uint64_t cd_qw0, cd_qw1;
 		tx_pkt = *tx_pkts++;
 
+		ol_flags = tx_pkt->ol_flags;
 		td_cmd = 0;
 		td_tag = 0;
-		td_offset = 0;
-		ol_flags = tx_pkt->ol_flags;
+		l2_len = ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK ?
+				tx_pkt->outer_l2_len : tx_pkt->l2_len;
+		td_offset = (l2_len >> 1) << CI_TX_DESC_LEN_MACLEN_S;
+
 		tx_offload.l2_len = tx_pkt->l2_len;
 		tx_offload.l3_len = tx_pkt->l3_len;
 		tx_offload.outer_l2_len = tx_pkt->outer_l2_len;
 		tx_offload.outer_l3_len = tx_pkt->outer_l3_len;
 		tx_offload.l4_len = tx_pkt->l4_len;
 		tx_offload.tso_segsz = tx_pkt->tso_segsz;
+
 		/* Calculate the number of context descriptors needed. */
-		nb_ctx = ice_calc_context_desc(ol_flags);
+		nb_ctx = get_context_desc(ol_flags, tx_pkt, &tx_offload, txq, &cd_qw0, &cd_qw1);
 
 		/* The number of descriptors that must be allocated for
 		 * a packet equals to the number of the segments of that
@@ -3169,15 +3213,6 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 			td_tag = tx_pkt->vlan_tci;
 		}
 
-		/* Fill in tunneling parameters if necessary */
-		cd_tunneling_params = 0;
-		if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
-			td_offset |= (tx_offload.outer_l2_len >> 1)
-				<< CI_TX_DESC_LEN_MACLEN_S;
-			ice_parse_tunneling_params(ol_flags, tx_offload,
-						   &cd_tunneling_params);
-		}
-
 		/* Enable checksum offloading */
 		if (ol_flags & ICE_TX_CKSUM_OFFLOAD_MASK)
 			ice_txd_enable_checksum(ol_flags, &td_cmd,
@@ -3185,11 +3220,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		if (nb_ctx) {
 			/* Setup TX context descriptor if required */
-			volatile struct ice_tx_ctx_desc *ctx_txd =
-				(volatile struct ice_tx_ctx_desc *)
-					&ci_tx_ring[tx_id];
-			uint16_t cd_l2tag2 = 0;
-			uint64_t cd_type_cmd_tso_mss = ICE_TX_DESC_DTYPE_CTX;
+			uint64_t *ctx_txd = RTE_CAST_PTR(uint64_t *, &ci_tx_ring[tx_id]);
 
 			txn = &sw_ring[txe->next_id];
 			RTE_MBUF_PREFETCH_TO_FREE(txn->mbuf);
@@ -3198,29 +3229,8 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 				txe->mbuf = NULL;
 			}
 
-			if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG))
-				cd_type_cmd_tso_mss |=
-					ice_set_tso_ctx(tx_pkt, tx_offload);
-			else if (ol_flags & RTE_MBUF_F_TX_IEEE1588_TMST)
-				cd_type_cmd_tso_mss |=
-					((uint64_t)CI_TX_CTX_DESC_TSYN <<
-					CI_TXD_QW1_CMD_S) |
-					 (((uint64_t)txq->ice_vsi->adapter->ptp_tx_index <<
-					 ICE_TXD_CTX_QW1_TSYN_S) & ICE_TXD_CTX_QW1_TSYN_M);
-
-			ctx_txd->tunneling_params =
-				rte_cpu_to_le_32(cd_tunneling_params);
-
-			/* TX context descriptor based double VLAN insert */
-			if (ol_flags & RTE_MBUF_F_TX_QINQ) {
-				cd_l2tag2 = tx_pkt->vlan_tci_outer;
-				cd_type_cmd_tso_mss |=
-					((uint64_t)CI_TX_CTX_DESC_IL2TAG2 <<
-					 CI_TXD_QW1_CMD_S);
-			}
-			ctx_txd->l2tag2 = rte_cpu_to_le_16(cd_l2tag2);
-			ctx_txd->qw1 =
-				rte_cpu_to_le_64(cd_type_cmd_tso_mss);
+			ctx_txd[0] = cd_qw0;
+			ctx_txd[1] = cd_qw1;
 
 			txe->last_id = tx_last;
 			tx_id = txe->next_id;
Signature · 1 line
2.51.0
#89 lore raw

RE: [PATCH v3 07/36] net/ice: refactor context descriptor handling

Quoted 56 lines

Subject: [PATCH v3 07/36] net/ice: refactor context descriptor handling

Create a single function to manage all context descriptor handling, which returns either 0 or 1 depending on whether a descriptor is needed or not, as well as returning directly the descriptor contents if relevant.

---
 drivers/net/intel/ice/ice_rxtx.c | 104 +++++++++++++++++--------------
 1 file changed, 57 insertions(+), 47 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +1 -5
index 2a53b614b2..cc442fed75 100644
@@ -2966,10 +2966,6 @@ ice_txd_enable_checksum(uint64_t ol_flags,
 			uint32_t *td_offset,
 			union ci_tx_offload tx_offload)
 {
-	/* Set MACLEN */
-	if (!(ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK))
-		*td_offset |= (tx_offload.l2_len >> 1)
-			<< CI_TX_DESC_LEN_MACLEN_S;
 
 	/* Enable L3 checksum offloads */
 	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
@@ -3052,7 +3048,7 @@ ice_calc_context_desc(uint64_t flags)
 
 /* set ice TSO context descriptor */
 static inline uint64_t
-ice_set_tso_ctx(struct rte_mbuf *mbuf, union ci_tx_offload tx_offload)
+ice_set_tso_ctx(uint64_t ol_flags, const struct rte_mbuf *mbuf, union
 ci_tx_offload tx_offload)
 {
 	uint64_t ctx_desc = 0;
drivers/net/intel/ice/ice_rxtx.c +1 -1
 	uint32_t cd_cmd, hdr_len, cd_tso_len;
@@ -3063,7 +3059,7 @@ ice_set_tso_ctx(struct rte_mbuf *mbuf, union
 ci_tx_offload tx_offload)
 	}
 
 	hdr_len = tx_offload.l2_len + tx_offload.l3_len + tx_offload.l4_len;
-	hdr_len += (mbuf->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) ?
+	hdr_len += (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) ?
 		   tx_offload.outer_l2_len + tx_offload.outer_l3_len : 0;
 
drivers/net/intel/ice/ice_rxtx.c +4 -0
 	cd_cmd = CI_TX_CTX_DESC_TSO;
@@ -3075,6 +3071,49 @@ ice_set_tso_ctx(struct rte_mbuf *mbuf, union
 ci_tx_offload tx_offload)
 	return ctx_desc;
 }
 
+/* compute a context descriptor if one is necessary based on the ol_flags
+ *
+ * Returns 0 if no descriptor is necessary.
+ * Returns 1 if one is necessary and the contents of the descriptor are
Quoted 2 lines

returned
+ * in the values pointed to by qw0 and qw1. td_offset may also be modified.

Regarding the comment above, "td_offset" is not a variable in this function, I assume the comment is obsolete.

Quoted 168 lines

+ */

drivers/net/intel/ice/ice_rxtx.c +15 -0
+static __rte_always_inline uint16_t
+get_context_desc(uint64_t ol_flags, const struct rte_mbuf *tx_pkt,
+	const union ci_tx_offload *tx_offload, const struct ci_tx_queue *txq,
+	uint64_t *qw0, uint64_t *qw1)
+{
+	uint16_t cd_l2tag2 = 0;
+	uint64_t cd_type_cmd_tso_mss = ICE_TX_DESC_DTYPE_CTX;
+	uint32_t cd_tunneling_params = 0;
+	uint64_t ptp_tx_index = txq->ice_vsi->adapter->ptp_tx_index;
+
+	if (ice_calc_context_desc(ol_flags) == 0)
+		return 0;
+
+	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK)
+		ice_parse_tunneling_params(ol_flags, *tx_offload,

&cd_tunneling_params);

drivers/net/intel/ice/ice_rxtx.c +2 -0
+
+	if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG |

RTE_MBUF_F_TX_UDP_SEG))

drivers/net/intel/ice/ice_rxtx.c +1 -0
+		cd_type_cmd_tso_mss |= ice_set_tso_ctx(ol_flags, tx_pkt,

*tx_offload);

drivers/net/intel/ice/ice_rxtx.c +3 -0
+	else if (ol_flags & RTE_MBUF_F_TX_IEEE1588_TMST)
+		cd_type_cmd_tso_mss |=
+			((uint64_t)CI_TX_CTX_DESC_TSYN <<

CI_TXD_QW1_CMD_S) |

drivers/net/intel/ice/ice_rxtx.c +1 -0
+			((ptp_tx_index << ICE_TXD_CTX_QW1_TSYN_S) &

ICE_TXD_CTX_QW1_TSYN_M);

drivers/net/intel/ice/ice_rxtx.c +6 -0
+
+
+	/* TX context descriptor based double VLAN insert */
+	if (ol_flags & RTE_MBUF_F_TX_QINQ) {
+		cd_l2tag2 = tx_pkt->vlan_tci_outer;
+		cd_type_cmd_tso_mss |=

((uint64_t)CI_TX_CTX_DESC_IL2TAG2 << CI_TXD_QW1_CMD_S);

drivers/net/intel/ice/ice_rxtx.c +9 -1
+	}
+
+	*qw0 = rte_cpu_to_le_32(cd_tunneling_params) |
+		((uint64_t)rte_cpu_to_le_16(cd_l2tag2) << 32);
+	*qw1 = rte_cpu_to_le_64(cd_type_cmd_tso_mss);
+
+	return 1;
+}
+
 uint16_t
 ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
@@ -3085,7 +3124,6 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 	struct ci_tx_entry *txe, *txn;
 	struct rte_mbuf *tx_pkt;
 	struct rte_mbuf *m_seg;
-	uint32_t cd_tunneling_params;
 	uint16_t tx_id;
 	uint16_t ts_id = -1;
drivers/net/intel/ice/ice_rxtx.c +1 -0
 	uint16_t nb_tx;
@@ -3096,6 +3134,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 	uint32_t td_tag = 0;
 	uint16_t tx_last;
 	uint16_t slen;
+	uint16_t l2_len;
 	uint64_t buf_dma_addr;
 	uint64_t ol_flags;
drivers/net/intel/ice/ice_rxtx.c +8 -3
 	union ci_tx_offload tx_offload = {0};
@@ -3114,20 +3153,25 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 		(void)ci_tx_xmit_cleanup(txq);
 
 	for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
+		uint64_t cd_qw0, cd_qw1;
 		tx_pkt = *tx_pkts++;
 
+		ol_flags = tx_pkt->ol_flags;
 		td_cmd = 0;
 		td_tag = 0;
-		td_offset = 0;
-		ol_flags = tx_pkt->ol_flags;
+		l2_len = ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK ?
+				tx_pkt->outer_l2_len : tx_pkt->l2_len;
+		td_offset = (l2_len >> 1) << CI_TX_DESC_LEN_MACLEN_S;
+
 		tx_offload.l2_len = tx_pkt->l2_len;
 		tx_offload.l3_len = tx_pkt->l3_len;
 		tx_offload.outer_l2_len = tx_pkt->outer_l2_len;
 		tx_offload.outer_l3_len = tx_pkt->outer_l3_len;
 		tx_offload.l4_len = tx_pkt->l4_len;
 		tx_offload.tso_segsz = tx_pkt->tso_segsz;
+
 		/* Calculate the number of context descriptors needed. */
-		nb_ctx = ice_calc_context_desc(ol_flags);
+		nb_ctx = get_context_desc(ol_flags, tx_pkt, &tx_offload, txq,
 &cd_qw0, &cd_qw1);
 
drivers/net/intel/ice/ice_rxtx.c +0 -9
 		/* The number of descriptors that must be allocated for
 		 * a packet equals to the number of the segments of that
@@ -3169,15 +3213,6 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 			td_tag = tx_pkt->vlan_tci;
 		}
 
-		/* Fill in tunneling parameters if necessary */
-		cd_tunneling_params = 0;
-		if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
-			td_offset |= (tx_offload.outer_l2_len >> 1)
-				<< CI_TX_DESC_LEN_MACLEN_S;
-			ice_parse_tunneling_params(ol_flags, tx_offload,
-						   &cd_tunneling_params);
-		}
-
 		/* Enable checksum offloading */
 		if (ol_flags & ICE_TX_CKSUM_OFFLOAD_MASK)
drivers/net/intel/ice/ice_rxtx.c +1 -5
 			ice_txd_enable_checksum(ol_flags, &td_cmd,
@@ -3185,11 +3220,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 
 		if (nb_ctx) {
 			/* Setup TX context descriptor if required */
-			volatile struct ice_tx_ctx_desc *ctx_txd =
-				(volatile struct ice_tx_ctx_desc *)
-					&ci_tx_ring[tx_id];
-			uint16_t cd_l2tag2 = 0;
-			uint64_t cd_type_cmd_tso_mss =
 ICE_TX_DESC_DTYPE_CTX;
+			uint64_t *ctx_txd = RTE_CAST_PTR(uint64_t *,
 &ci_tx_ring[tx_id]);
drivers/net/intel/ice/ice_rxtx.c +0 -8
 			txn = &sw_ring[txe->next_id];
 			RTE_MBUF_PREFETCH_TO_FREE(txn->mbuf);
@@ -3198,29 +3229,8 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 				txe->mbuf = NULL;
 			}
 
-			if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG |
 RTE_MBUF_F_TX_UDP_SEG))
-				cd_type_cmd_tso_mss |=
-					ice_set_tso_ctx(tx_pkt, tx_offload);
-			else if (ol_flags & RTE_MBUF_F_TX_IEEE1588_TMST)
-				cd_type_cmd_tso_mss |=
-					((uint64_t)CI_TX_CTX_DESC_TSYN <<
-					CI_TXD_QW1_CMD_S) |
-					 (((uint64_t)txq->ice_vsi->adapter-
Quoted 1 line

ptp_tx_index <<

drivers/net/intel/ice/ice_rxtx.c +0 -1
-					 ICE_TXD_CTX_QW1_TSYN_S) &

ICE_TXD_CTX_QW1_TSYN_M);

drivers/net/intel/ice/ice_rxtx.c +0 -9
-
-			ctx_txd->tunneling_params =
-				rte_cpu_to_le_32(cd_tunneling_params);
-
-			/* TX context descriptor based double VLAN insert */
-			if (ol_flags & RTE_MBUF_F_TX_QINQ) {
-				cd_l2tag2 = tx_pkt->vlan_tci_outer;
-				cd_type_cmd_tso_mss |=
-					((uint64_t)CI_TX_CTX_DESC_IL2TAG2

<<

drivers/net/intel/ice/ice_rxtx.c +2 -6
-					 CI_TXD_QW1_CMD_S);
-			}
-			ctx_txd->l2tag2 = rte_cpu_to_le_16(cd_l2tag2);
-			ctx_txd->qw1 =
-				rte_cpu_to_le_64(cd_type_cmd_tso_mss);
+			ctx_txd[0] = cd_qw0;
+			ctx_txd[1] = cd_qw1;
 
 			txe->last_id = tx_last;
 			tx_id = txe->next_id;
--

2.51.0

#90 lore raw

Re: [PATCH v3 07/36] net/ice: refactor context descriptor handling

Quoted 52 lines · Ciara
Quoted 52 lines

Subject: [PATCH v3 07/36] net/ice: refactor context descriptor handling

Create a single function to manage all context descriptor handling, which returns either 0 or 1 depending on whether a descriptor is needed or not, as well as returning directly the descriptor contents if relevant.

---
 drivers/net/intel/ice/ice_rxtx.c | 104 +++++++++++++++++--------------
 1 file changed, 57 insertions(+), 47 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +1 -5
index 2a53b614b2..cc442fed75 100644
@@ -2966,10 +2966,6 @@ ice_txd_enable_checksum(uint64_t ol_flags,
 			uint32_t *td_offset,
 			union ci_tx_offload tx_offload)
 {
-	/* Set MACLEN */
-	if (!(ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK))
-		*td_offset |= (tx_offload.l2_len >> 1)
-			<< CI_TX_DESC_LEN_MACLEN_S;
 
 	/* Enable L3 checksum offloads */
 	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
@@ -3052,7 +3048,7 @@ ice_calc_context_desc(uint64_t flags)
 
 /* set ice TSO context descriptor */
 static inline uint64_t
-ice_set_tso_ctx(struct rte_mbuf *mbuf, union ci_tx_offload tx_offload)
+ice_set_tso_ctx(uint64_t ol_flags, const struct rte_mbuf *mbuf, union
 ci_tx_offload tx_offload)
 {
 	uint64_t ctx_desc = 0;
drivers/net/intel/ice/ice_rxtx.c +1 -1
 	uint32_t cd_cmd, hdr_len, cd_tso_len;
@@ -3063,7 +3059,7 @@ ice_set_tso_ctx(struct rte_mbuf *mbuf, union
 ci_tx_offload tx_offload)
 	}
 
 	hdr_len = tx_offload.l2_len + tx_offload.l3_len + tx_offload.l4_len;
-	hdr_len += (mbuf->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) ?
+	hdr_len += (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) ?
 		   tx_offload.outer_l2_len + tx_offload.outer_l3_len : 0;
 
drivers/net/intel/ice/ice_rxtx.c +0 -0
 	cd_cmd = CI_TX_CTX_DESC_TSO;
@@ -3075,6 +3071,49 @@ ice_set_tso_ctx(struct rte_mbuf *mbuf, union
 ci_tx_offload tx_offload)
 	return ctx_desc;
 }
 
Quoted 10 lines
Quoted 6 lines
drivers/net/intel/ice/ice_rxtx.c +4 -0
+/* compute a context descriptor if one is necessary based on the ol_flags
+ *
+ * Returns 0 if no descriptor is necessary.
+ * Returns 1 if one is necessary and the contents of the descriptor are

returned
+ * in the values pointed to by qw0 and qw1. td_offset may also be modified.

Regarding the comment above, "td_offset" is not a variable in this function, I assume the comment is obsolete.

Yes, it was a parameter previously. Will fix

/Bruce

#91 lore raw

PATCH v3 8/36 net/i40e: refactor context descriptor handling

In reply to Bruce Richardson

move all context descriptor handling to a single function, as with the ice driver, and use the same function signature as that driver.

---
 drivers/net/intel/i40e/i40e_rxtx.c | 123 +++++++++++++++--------------
 1 file changed, 63 insertions(+), 60 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +63 -60
index b75306931a..183b70c63f 100644
@@ -321,11 +321,6 @@ i40e_txd_enable_checksum(uint64_t ol_flags,
 			uint32_t *td_offset,
 			union ci_tx_offload tx_offload)
 {
-	/* Set MACLEN */
-	if (!(ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK))
-		*td_offset |= (tx_offload.l2_len >> 1)
-			<< CI_TX_DESC_LEN_MACLEN_S;
-
 	/* Enable L3 checksum offloads */
 	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
 		*td_cmd |= CI_TX_DESC_CMD_IIPT_IPV4_CSUM;
@@ -1004,7 +999,7 @@ i40e_calc_context_desc(uint64_t flags)
 
 /* set i40e TSO context descriptor */
 static inline uint64_t
-i40e_set_tso_ctx(struct rte_mbuf *mbuf, union ci_tx_offload tx_offload)
+i40e_set_tso_ctx(uint64_t ol_flags, const struct rte_mbuf *mbuf, union ci_tx_offload tx_offload)
 {
 	uint64_t ctx_desc = 0;
 	uint32_t cd_cmd, hdr_len, cd_tso_len;
@@ -1015,7 +1010,7 @@ i40e_set_tso_ctx(struct rte_mbuf *mbuf, union ci_tx_offload tx_offload)
 	}
 
 	hdr_len = tx_offload.l2_len + tx_offload.l3_len + tx_offload.l4_len;
-	hdr_len += (mbuf->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) ?
+	hdr_len += (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) ?
 		   tx_offload.outer_l2_len + tx_offload.outer_l3_len : 0;
 
 	cd_cmd = I40E_TX_CTX_DESC_TSO;
@@ -1029,6 +1024,52 @@ i40e_set_tso_ctx(struct rte_mbuf *mbuf, union ci_tx_offload tx_offload)
 	return ctx_desc;
 }
 
+/* compute a context descriptor if one is necessary based on the ol_flags
+ *
+ * Returns 0 if no descriptor is necessary.
+ * Returns 1 if one is necessary and the contents of the descriptor are returned
+ *   in the values pointed to by qw0 and qw1. td_offset may also be modified.
+ */
+static __rte_always_inline uint16_t
+get_context_desc(uint64_t ol_flags, const struct rte_mbuf *tx_pkt,
+		 const union ci_tx_offload *tx_offload,
+		 const struct ci_tx_queue *txq __rte_unused,
+		 uint64_t *qw0, uint64_t *qw1)
+{
+	uint16_t cd_l2tag2 = 0;
+	uint64_t cd_type_cmd_tso_mss = I40E_TX_DESC_DTYPE_CONTEXT;
+	uint32_t cd_tunneling_params = 0;
+
+	if (i40e_calc_context_desc(ol_flags) == 0)
+		return 0;
+
+	if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK)
+		i40e_parse_tunneling_params(ol_flags, *tx_offload, &cd_tunneling_params);
+
+	if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
+		cd_type_cmd_tso_mss |= i40e_set_tso_ctx(ol_flags, tx_pkt, *tx_offload);
+	} else {
+#ifdef RTE_LIBRTE_IEEE1588
+		if (ol_flags & RTE_MBUF_F_TX_IEEE1588_TMST)
+			cd_type_cmd_tso_mss |=
+				((uint64_t)I40E_TX_CTX_DESC_TSYN << I40E_TXD_CTX_QW1_CMD_SHIFT);
+#endif
+	}
+
+	/* TX context descriptor based double VLAN insert */
+	if (ol_flags & RTE_MBUF_F_TX_QINQ) {
+		cd_l2tag2 = tx_pkt->vlan_tci_outer;
+		cd_type_cmd_tso_mss |=
+				((uint64_t)I40E_TX_CTX_DESC_IL2TAG2 << I40E_TXD_CTX_QW1_CMD_SHIFT);
+	}
+
+	*qw0 = rte_cpu_to_le_32(cd_tunneling_params) |
+		((uint64_t)rte_cpu_to_le_16(cd_l2tag2) << 32);
+	*qw1 = rte_cpu_to_le_64(cd_type_cmd_tso_mss);
+
+	return 1;
+}
+
 uint16_t
 i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
@@ -1039,7 +1080,6 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	volatile struct ci_tx_desc *txr;
 	struct rte_mbuf *tx_pkt;
 	struct rte_mbuf *m_seg;
-	uint32_t cd_tunneling_params;
 	uint16_t tx_id;
 	uint16_t nb_tx;
 	uint32_t td_cmd;
@@ -1050,6 +1090,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	uint16_t nb_ctx;
 	uint16_t tx_last;
 	uint16_t slen;
+	uint16_t l2_len;
 	uint64_t buf_dma_addr;
 	union ci_tx_offload tx_offload = {0};
 
@@ -1064,14 +1105,15 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		(void)ci_tx_xmit_cleanup(txq);
 
 	for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
-		td_cmd = 0;
-		td_tag = 0;
-		td_offset = 0;
-
 		tx_pkt = *tx_pkts++;
 		RTE_MBUF_PREFETCH_TO_FREE(txe->mbuf);
 
 		ol_flags = tx_pkt->ol_flags;
+		td_cmd = 0;
+		td_tag = 0;
+		l2_len = ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK ?
+				tx_pkt->outer_l2_len : tx_pkt->l2_len;
+		td_offset = (l2_len >> 1) << CI_TX_DESC_LEN_MACLEN_S;
 		tx_offload.l2_len = tx_pkt->l2_len;
 		tx_offload.l3_len = tx_pkt->l3_len;
 		tx_offload.outer_l2_len = tx_pkt->outer_l2_len;
@@ -1080,7 +1122,9 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		tx_offload.tso_segsz = tx_pkt->tso_segsz;
 
 		/* Calculate the number of context descriptors needed. */
-		nb_ctx = i40e_calc_context_desc(ol_flags);
+		uint64_t cd_qw0 = 0, cd_qw1 = 0;
+		nb_ctx = get_context_desc(ol_flags, tx_pkt, &tx_offload, txq,
+				&cd_qw0, &cd_qw1);
 
 		/**
 		 * The number of descriptors that must be allocated for
@@ -1126,14 +1170,6 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		/* Always enable CRC offload insertion */
 		td_cmd |= CI_TX_DESC_CMD_ICRC;
 
-		/* Fill in tunneling parameters if necessary */
-		cd_tunneling_params = 0;
-		if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
-			td_offset |= (tx_offload.outer_l2_len >> 1)
-					<< CI_TX_DESC_LEN_MACLEN_S;
-			i40e_parse_tunneling_params(ol_flags, tx_offload,
-						    &cd_tunneling_params);
-		}
 		/* Enable checksum offloading */
 		if (ol_flags & I40E_TX_CKSUM_OFFLOAD_MASK)
 			i40e_txd_enable_checksum(ol_flags, &td_cmd,
@@ -1141,12 +1177,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		if (nb_ctx) {
 			/* Setup TX context descriptor if required */
-			volatile struct i40e_tx_context_desc *ctx_txd =
-				(volatile struct i40e_tx_context_desc *)\
-							&txr[tx_id];
-			uint16_t cd_l2tag2 = 0;
-			uint64_t cd_type_cmd_tso_mss =
-				I40E_TX_DESC_DTYPE_CONTEXT;
+			uint64_t *desc = RTE_CAST_PTR(uint64_t *, &txr[tx_id]);
 
 			txn = &sw_ring[txe->next_id];
 			RTE_MBUF_PREFETCH_TO_FREE(txn->mbuf);
@@ -1155,41 +1186,13 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 				txe->mbuf = NULL;
 			}
 
-			/* TSO enabled means no timestamp */
-			if (ol_flags & RTE_MBUF_F_TX_TCP_SEG)
-				cd_type_cmd_tso_mss |=
-					i40e_set_tso_ctx(tx_pkt, tx_offload);
-			else {
-#ifdef RTE_LIBRTE_IEEE1588
-				if (ol_flags & RTE_MBUF_F_TX_IEEE1588_TMST)
-					cd_type_cmd_tso_mss |=
-						((uint64_t)I40E_TX_CTX_DESC_TSYN <<
-						 I40E_TXD_CTX_QW1_CMD_SHIFT);
-#endif
-			}
-
-			ctx_txd->tunneling_params =
-				rte_cpu_to_le_32(cd_tunneling_params);
-			if (ol_flags & RTE_MBUF_F_TX_QINQ) {
-				cd_l2tag2 = tx_pkt->vlan_tci_outer;
-				cd_type_cmd_tso_mss |=
-					((uint64_t)I40E_TX_CTX_DESC_IL2TAG2 <<
-						I40E_TXD_CTX_QW1_CMD_SHIFT);
-			}
-			ctx_txd->l2tag2 = rte_cpu_to_le_16(cd_l2tag2);
-			ctx_txd->type_cmd_tso_mss =
-				rte_cpu_to_le_64(cd_type_cmd_tso_mss);
+			desc[0] = cd_qw0;
+			desc[1] = cd_qw1;
 
 			PMD_TX_LOG(DEBUG, "mbuf: %p, TCD[%u]: "
-				"tunneling_params: %#x; "
-				"l2tag2: %#hx; "
-				"rsvd: %#hx; "
-				"type_cmd_tso_mss: %#"PRIx64";",
-				tx_pkt, tx_id,
-				ctx_txd->tunneling_params,
-				ctx_txd->l2tag2,
-				ctx_txd->rsvd,
-				ctx_txd->type_cmd_tso_mss);
+				"qw0: %#"PRIx64"; "
+				"qw1: %#"PRIx64";",
+				tx_pkt, tx_id, cd_qw0, cd_qw1);
 
 			txe->last_id = tx_last;
 			tx_id = txe->next_id;
Signature · 1 line
2.51.0
#92 lore raw

RE: [PATCH v3 08/36] net/i40e: refactor context descriptor handling

Quoted 3 lines

Subject: [PATCH v3 08/36] net/i40e: refactor context descriptor handling

move all context descriptor handling to a single function, as with the

Nit: capitalise

Quoted 53 lines

ice driver, and use the same function signature as that driver.

---
 drivers/net/intel/i40e/i40e_rxtx.c | 123 +++++++++++++++--------------
 1 file changed, 63 insertions(+), 60 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +1 -6
index b75306931a..183b70c63f 100644
@@ -321,11 +321,6 @@ i40e_txd_enable_checksum(uint64_t ol_flags,
 			uint32_t *td_offset,
 			union ci_tx_offload tx_offload)
 {
-	/* Set MACLEN */
-	if (!(ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK))
-		*td_offset |= (tx_offload.l2_len >> 1)
-			<< CI_TX_DESC_LEN_MACLEN_S;
-
 	/* Enable L3 checksum offloads */
 	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
 		*td_cmd |= CI_TX_DESC_CMD_IIPT_IPV4_CSUM;
@@ -1004,7 +999,7 @@ i40e_calc_context_desc(uint64_t flags)
 
 /* set i40e TSO context descriptor */
 static inline uint64_t
-i40e_set_tso_ctx(struct rte_mbuf *mbuf, union ci_tx_offload tx_offload)
+i40e_set_tso_ctx(uint64_t ol_flags, const struct rte_mbuf *mbuf, union
 ci_tx_offload tx_offload)
 {
 	uint64_t ctx_desc = 0;
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
 	uint32_t cd_cmd, hdr_len, cd_tso_len;
@@ -1015,7 +1010,7 @@ i40e_set_tso_ctx(struct rte_mbuf *mbuf, union
 ci_tx_offload tx_offload)
 	}
 
 	hdr_len = tx_offload.l2_len + tx_offload.l3_len + tx_offload.l4_len;
-	hdr_len += (mbuf->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) ?
+	hdr_len += (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) ?
 		   tx_offload.outer_l2_len + tx_offload.outer_l3_len : 0;
 
drivers/net/intel/i40e/i40e_rxtx.c +4 -0
 	cd_cmd = I40E_TX_CTX_DESC_TSO;
@@ -1029,6 +1024,52 @@ i40e_set_tso_ctx(struct rte_mbuf *mbuf, union
 ci_tx_offload tx_offload)
 	return ctx_desc;
 }
 
+/* compute a context descriptor if one is necessary based on the ol_flags
+ *
+ * Returns 0 if no descriptor is necessary.
+ * Returns 1 if one is necessary and the contents of the descriptor are
Quoted 2 lines

returned
+ * in the values pointed to by qw0 and qw1. td_offset may also be modified.

Same comment as previous patch re td_offset comment

drivers/net/intel/i40e/i40e_rxtx.c i40e_set_tso_ctx(struct rte_mbuf *mbuf, union ci_tx_offload tx_offload) · line 1040

Quoted 9 lines

+ */

drivers/net/intel/i40e/i40e_rxtx.c +8 -0
+static __rte_always_inline uint16_t
+get_context_desc(uint64_t ol_flags, const struct rte_mbuf *tx_pkt,
+		 const union ci_tx_offload *tx_offload,
+		 const struct ci_tx_queue *txq __rte_unused,
+		 uint64_t *qw0, uint64_t *qw1)
+{
+	uint16_t cd_l2tag2 = 0;
+	uint64_t cd_type_cmd_tso_mss = I40E_TX_DESC_DTYPE_CONTEXT;

CI_TX_DESC_DTYPE_CTX could now be used

Quoted 2 lines
drivers/net/intel/i40e/i40e_rxtx.c +2 -0
+	uint32_t cd_tunneling_params = 0;
+
#93 lore raw

PATCH v3 9/36 net/idpf: refactor context descriptor handling

In reply to Bruce Richardson

move all context descriptor handling to a single function, as with the ice driver.

---
 drivers/net/intel/idpf/idpf_common_rxtx.c | 61 +++++++++++------------
 1 file changed, 28 insertions(+), 33 deletions(-)
drivers/net/intel/idpf/idpf_common_rxtx.c +28 -33
index 11d6848430..9219ad9047 100644
@@ -845,37 +845,36 @@ idpf_calc_context_desc(uint64_t flags)
 	return 0;
 }
 
-/* set TSO context descriptor
+/* set TSO context descriptor, returns 0 if no context needed, 1 if context set
  */
-static inline void
-idpf_set_splitq_tso_ctx(struct rte_mbuf *mbuf,
+static inline uint16_t
+idpf_set_tso_ctx(uint64_t ol_flags, struct rte_mbuf *mbuf,
 			union ci_tx_offload tx_offload,
-			volatile union idpf_flex_tx_ctx_desc *ctx_desc)
+			uint64_t *qw0, uint64_t *qw1)
 {
-	uint16_t cmd_dtype;
+	uint16_t cmd_dtype = IDPF_TX_DESC_DTYPE_FLEX_TSO_CTX | IDPF_TX_FLEX_CTX_DESC_CMD_TSO;
+	uint16_t tso_segsz = mbuf->tso_segsz;
 	uint32_t tso_len;
 	uint8_t hdr_len;
 
+	if (idpf_calc_context_desc(ol_flags) == 0)
+		return 0;
+
+	/* TSO context descriptor setup */
 	if (tx_offload.l4_len == 0) {
 		TX_LOG(DEBUG, "L4 length set to 0");
-		return;
+		return 0;
 	}
 
-	hdr_len = tx_offload.l2_len +
-		tx_offload.l3_len +
-		tx_offload.l4_len;
-	cmd_dtype = IDPF_TX_DESC_DTYPE_FLEX_TSO_CTX |
-		IDPF_TX_FLEX_CTX_DESC_CMD_TSO;
+	hdr_len = tx_offload.l2_len + tx_offload.l3_len + tx_offload.l4_len;
 	tso_len = mbuf->pkt_len - hdr_len;
 
-	ctx_desc->tso.qw1.cmd_dtype = rte_cpu_to_le_16(cmd_dtype);
-	ctx_desc->tso.qw0.hdr_len = hdr_len;
-	ctx_desc->tso.qw0.mss_rt =
-		rte_cpu_to_le_16((uint16_t)mbuf->tso_segsz &
-				 IDPF_TXD_FLEX_CTX_MSS_RT_M);
-	ctx_desc->tso.qw0.flex_tlen =
-		rte_cpu_to_le_32(tso_len &
-				 IDPF_TXD_FLEX_CTX_MSS_RT_M);
+	*qw0 = rte_cpu_to_le_32(tso_len & IDPF_TXD_FLEX_CTX_MSS_RT_M) |
+	       ((uint64_t)rte_cpu_to_le_16(tso_segsz & IDPF_TXD_FLEX_CTX_MSS_RT_M) << 32) |
+	       ((uint64_t)hdr_len << 48);
+	*qw1 = rte_cpu_to_le_16(cmd_dtype);
+
+	return 1;
 }
 
 RTE_EXPORT_INTERNAL_SYMBOL(idpf_dp_splitq_xmit_pkts)
@@ -933,7 +932,8 @@ idpf_dp_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		tx_offload.l4_len = tx_pkt->l4_len;
 		tx_offload.tso_segsz = tx_pkt->tso_segsz;
 		/* Calculate the number of context descriptors needed. */
-		nb_ctx = idpf_calc_context_desc(ol_flags);
+		uint64_t cd_qw0, cd_qw1;
+		nb_ctx = idpf_set_tso_ctx(ol_flags, tx_pkt, tx_offload, &cd_qw0, &cd_qw1);
 
 		/* Calculate the number of TX descriptors needed for
 		 * each packet. For TSO packets, use ci_calc_pkt_desc as
@@ -950,12 +950,10 @@ idpf_dp_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 		/* context descriptor */
 		if (nb_ctx != 0) {
-			volatile union idpf_flex_tx_ctx_desc *ctx_desc =
-				(volatile union idpf_flex_tx_ctx_desc *)&txr[tx_id];
+			uint64_t *ctx_desc = RTE_CAST_PTR(uint64_t *, &txr[tx_id]);
 
-			if ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) != 0)
-				idpf_set_splitq_tso_ctx(tx_pkt, tx_offload,
-							ctx_desc);
+			ctx_desc[0] = cd_qw0;
+			ctx_desc[1] = cd_qw1;
 
 			tx_id++;
 			if (tx_id == txq->nb_tx_desc)
@@ -1388,7 +1386,8 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		tx_offload.l4_len = tx_pkt->l4_len;
 		tx_offload.tso_segsz = tx_pkt->tso_segsz;
 		/* Calculate the number of context descriptors needed. */
-		nb_ctx = idpf_calc_context_desc(ol_flags);
+		uint64_t cd_qw0, cd_qw1;
+		nb_ctx = idpf_set_tso_ctx(ol_flags, tx_pkt, tx_offload, &cd_qw0, &cd_qw1);
 
 		/* The number of descriptors that must be allocated for
 		 * a packet. For TSO packets, use ci_calc_pkt_desc as
@@ -1431,9 +1430,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 		if (nb_ctx != 0) {
 			/* Setup TX context descriptor if required */
-			volatile union idpf_flex_tx_ctx_desc *ctx_txd =
-				(volatile union idpf_flex_tx_ctx_desc *)
-				&txr[tx_id];
+			uint64_t *ctx_txd = RTE_CAST_PTR(uint64_t *, &txr[tx_id]);
 
 			txn = &sw_ring[txe->next_id];
 			RTE_MBUF_PREFETCH_TO_FREE(txn->mbuf);
@@ -1442,10 +1439,8 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 				txe->mbuf = NULL;
 			}
 
-			/* TSO enabled */
-			if ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) != 0)
-				idpf_set_splitq_tso_ctx(tx_pkt, tx_offload,
-							ctx_txd);
+			ctx_txd[0] = cd_qw0;
+			ctx_txd[1] = cd_qw1;
 
 			txe->last_id = tx_last;
 			tx_id = txe->next_id;
Signature · 1 line
2.51.0
#95 lore raw

PATCH v3 10/36 net/intel: consolidate checksum mask definition

In reply to Bruce Richardson

Create a common definition for checksum masks across iavf, idpf, i40e and ice drivers.

---
 drivers/net/intel/common/tx.h             | 8 ++++++++
 drivers/net/intel/i40e/i40e_rxtx.c        | 7 +------
 drivers/net/intel/iavf/iavf_rxtx.c        | 2 +-
 drivers/net/intel/iavf/iavf_rxtx.h        | 8 --------
 drivers/net/intel/ice/ice_rxtx.c          | 8 +-------
 drivers/net/intel/idpf/idpf_common_rxtx.c | 4 ++--
 drivers/net/intel/idpf/idpf_common_rxtx.h | 7 +------
 7 files changed, 14 insertions(+), 30 deletions(-)
drivers/net/intel/common/tx.h +8 -0
index 01e42303b4..928fad1df5 100644
@@ -53,6 +53,14 @@
 /* Common maximum data per TX descriptor */
 #define CI_MAX_DATA_PER_TXD     (CI_TXD_QW1_TX_BUF_SZ_M >> CI_TXD_QW1_TX_BUF_SZ_S)
 
+/* Checksum offload mask to identify packets requesting offload */
+#define CI_TX_CKSUM_OFFLOAD_MASK (RTE_MBUF_F_TX_IP_CKSUM |		 \
+				   RTE_MBUF_F_TX_L4_MASK |		 \
+				   RTE_MBUF_F_TX_TCP_SEG |		 \
+				   RTE_MBUF_F_TX_UDP_SEG |		 \
+				   RTE_MBUF_F_TX_OUTER_IP_CKSUM |	 \
+				   RTE_MBUF_F_TX_OUTER_UDP_CKSUM)
+
 /**
  * Common TX offload union for Intel drivers.
  * Supports both basic offloads (l2_len, l3_len, l4_len, tso_segsz) and
drivers/net/intel/i40e/i40e_rxtx.c +1 -6
index 183b70c63f..a5349990f3 100644
@@ -53,11 +53,6 @@
 #define I40E_TX_IEEE1588_TMST 0
 #endif
 
-#define I40E_TX_CKSUM_OFFLOAD_MASK (RTE_MBUF_F_TX_IP_CKSUM |		 \
-		RTE_MBUF_F_TX_L4_MASK |		 \
-		RTE_MBUF_F_TX_TCP_SEG |		 \
-		RTE_MBUF_F_TX_OUTER_IP_CKSUM)
-
 #define I40E_TX_OFFLOAD_MASK (RTE_MBUF_F_TX_OUTER_IPV4 |	\
 		RTE_MBUF_F_TX_OUTER_IPV6 |	\
 		RTE_MBUF_F_TX_IPV4 |		\
@@ -1171,7 +1166,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		td_cmd |= CI_TX_DESC_CMD_ICRC;
 
 		/* Enable checksum offloading */
-		if (ol_flags & I40E_TX_CKSUM_OFFLOAD_MASK)
+		if (ol_flags & CI_TX_CKSUM_OFFLOAD_MASK)
 			i40e_txd_enable_checksum(ol_flags, &td_cmd,
 						 &td_offset, tx_offload);
 
drivers/net/intel/iavf/iavf_rxtx.c +1 -1
index 885d9309cc..3dbcfd5355 100644
@@ -2596,7 +2596,7 @@ iavf_build_data_desc_cmd_offset_fields(volatile uint64_t *qw1,
 	}
 
 	if ((m->ol_flags &
-	    (IAVF_TX_CKSUM_OFFLOAD_MASK | RTE_MBUF_F_TX_SEC_OFFLOAD)) == 0)
+	    (CI_TX_CKSUM_OFFLOAD_MASK | RTE_MBUF_F_TX_SEC_OFFLOAD)) == 0)
 		goto skip_cksum;
 
 	/* Set MACLEN */
drivers/net/intel/iavf/iavf_rxtx.h +0 -8
index 395d97b4ee..cca5c25119 100644
@@ -136,14 +136,6 @@
 
 #define IAVF_TX_MIN_PKT_LEN 17
 
-#define IAVF_TX_CKSUM_OFFLOAD_MASK (		 \
-		RTE_MBUF_F_TX_IP_CKSUM |		 \
-		RTE_MBUF_F_TX_L4_MASK |		 \
-		RTE_MBUF_F_TX_TCP_SEG |          \
-		RTE_MBUF_F_TX_UDP_SEG |          \
-		RTE_MBUF_F_TX_OUTER_IP_CKSUM |   \
-		RTE_MBUF_F_TX_OUTER_UDP_CKSUM)
-
 #define IAVF_TX_OFFLOAD_MASK (  \
 		RTE_MBUF_F_TX_OUTER_IPV6 |		 \
 		RTE_MBUF_F_TX_OUTER_IPV4 |		 \
drivers/net/intel/ice/ice_rxtx.c +1 -7
index cc442fed75..99751bceb7 100644
@@ -13,12 +13,6 @@
 #include "../common/rx_vec_x86.h"
 #endif
 
-#define ICE_TX_CKSUM_OFFLOAD_MASK (RTE_MBUF_F_TX_IP_CKSUM |		 \
-		RTE_MBUF_F_TX_L4_MASK |		 \
-		RTE_MBUF_F_TX_TCP_SEG |		 \
-		RTE_MBUF_F_TX_UDP_SEG |		 \
-		RTE_MBUF_F_TX_OUTER_IP_CKSUM)
-
 /**
  * The mbuf dynamic field pointer for protocol extraction metadata.
  */
@@ -3214,7 +3208,7 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		}
 
 		/* Enable checksum offloading */
-		if (ol_flags & ICE_TX_CKSUM_OFFLOAD_MASK)
+		if (ol_flags & CI_TX_CKSUM_OFFLOAD_MASK)
 			ice_txd_enable_checksum(ol_flags, &td_cmd,
 						&td_offset, tx_offload);
 
drivers/net/intel/idpf/idpf_common_rxtx.c +2 -2
index 9219ad9047..b34d545a0a 100644
@@ -945,7 +945,7 @@ idpf_dp_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		else
 			nb_used = tx_pkt->nb_segs + nb_ctx;
 
-		if (ol_flags & IDPF_TX_CKSUM_OFFLOAD_MASK)
+		if (ol_flags & CI_TX_CKSUM_OFFLOAD_MASK)
 			cmd_dtype = IDPF_TXD_FLEX_FLOW_CMD_CS_EN;
 
 		/* context descriptor */
@@ -1425,7 +1425,7 @@ idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			}
 		}
 
-		if (ol_flags & IDPF_TX_CKSUM_OFFLOAD_MASK)
+		if (ol_flags & CI_TX_CKSUM_OFFLOAD_MASK)
 			td_cmd |= IDPF_TX_FLEX_DESC_CMD_CS_EN;
 
 		if (nb_ctx != 0) {
drivers/net/intel/idpf/idpf_common_rxtx.h +1 -6
index b88a87402d..fe7094d434 100644
@@ -39,13 +39,8 @@
 #define IDPF_RLAN_CTX_DBUF_S	7
 #define IDPF_RX_MAX_DATA_BUF_SIZE	(16 * 1024 - 128)
 
-#define IDPF_TX_CKSUM_OFFLOAD_MASK (		\
-		RTE_MBUF_F_TX_IP_CKSUM |	\
-		RTE_MBUF_F_TX_L4_MASK |		\
-		RTE_MBUF_F_TX_TCP_SEG)
-
 #define IDPF_TX_OFFLOAD_MASK (			\
-		IDPF_TX_CKSUM_OFFLOAD_MASK |	\
+		CI_TX_CKSUM_OFFLOAD_MASK |	\
 		RTE_MBUF_F_TX_IPV4 |		\
 		RTE_MBUF_F_TX_IPV6)
 
Signature · 1 line
2.51.0
#96 lore raw

RE: [PATCH v3 10/36] net/intel: consolidate checksum mask definition

Quoted 36 lines

Subject: [PATCH v3 10/36] net/intel: consolidate checksum mask definition

Create a common definition for checksum masks across iavf, idpf, i40e and ice drivers.

---
 drivers/net/intel/common/tx.h             | 8 ++++++++
 drivers/net/intel/i40e/i40e_rxtx.c        | 7 +------
 drivers/net/intel/iavf/iavf_rxtx.c        | 2 +-
 drivers/net/intel/iavf/iavf_rxtx.h        | 8 --------
 drivers/net/intel/ice/ice_rxtx.c          | 8 +-------
 drivers/net/intel/idpf/idpf_common_rxtx.c | 4 ++--
 drivers/net/intel/idpf/idpf_common_rxtx.h | 7 +------
 7 files changed, 14 insertions(+), 30 deletions(-)
drivers/net/intel/common/tx.h +8 -0
index 01e42303b4..928fad1df5 100644
@@ -53,6 +53,14 @@
 /* Common maximum data per TX descriptor */
 #define CI_MAX_DATA_PER_TXD     (CI_TXD_QW1_TX_BUF_SZ_M >>
 CI_TXD_QW1_TX_BUF_SZ_S)
 
+/* Checksum offload mask to identify packets requesting offload */
+#define CI_TX_CKSUM_OFFLOAD_MASK (RTE_MBUF_F_TX_IP_CKSUM |
 		 \
+				   RTE_MBUF_F_TX_L4_MASK |		 \
+				   RTE_MBUF_F_TX_TCP_SEG |		 \
+				   RTE_MBUF_F_TX_UDP_SEG |		 \
+				   RTE_MBUF_F_TX_OUTER_IP_CKSUM |
 	 \
+				   RTE_MBUF_F_TX_OUTER_UDP_CKSUM)
+

/**

<snip>

Quoted 7 lines
drivers/net/intel/idpf/idpf_common_rxtx.h +0 -0
index b88a87402d..fe7094d434 100644
@@ -39,13 +39,8 @@
 #define IDPF_RLAN_CTX_DBUF_S	7

drivers/net/intel/idpf/idpf_common_rxtx.h line 43

Quoted 10 lines
drivers/net/intel/idpf/idpf_common_rxtx.h +1 -6
 #define IDPF_RX_MAX_DATA_BUF_SIZE	(16 * 1024 - 128)
 
-#define IDPF_TX_CKSUM_OFFLOAD_MASK (		\
-		RTE_MBUF_F_TX_IP_CKSUM |	\
-		RTE_MBUF_F_TX_L4_MASK |		\
-		RTE_MBUF_F_TX_TCP_SEG)
-
 #define IDPF_TX_OFFLOAD_MASK (			\
-		IDPF_TX_CKSUM_OFFLOAD_MASK |	\
+		CI_TX_CKSUM_OFFLOAD_MASK |	\

With this change should the features in idpf.ini be updated to include Inner L3/L4 checksum?
And IDPF_TX_SCALAR_OFFLOADS update to include RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM

Quoted 5 lines
drivers/net/intel/idpf/idpf_common_rxtx.h +0 -1
 		RTE_MBUF_F_TX_IPV4 |		\
 		RTE_MBUF_F_TX_IPV6)
 
--

2.51.0

#97 lore raw

Re: [PATCH v3 10/36] net/intel: consolidate checksum mask definition

Quoted 49 lines · Ciara
Quoted 36 lines

Subject: [PATCH v3 10/36] net/intel: consolidate checksum mask definition

Create a common definition for checksum masks across iavf, idpf, i40e and ice drivers.

---
 drivers/net/intel/common/tx.h             | 8 ++++++++
 drivers/net/intel/i40e/i40e_rxtx.c        | 7 +------
 drivers/net/intel/iavf/iavf_rxtx.c        | 2 +-
 drivers/net/intel/iavf/iavf_rxtx.h        | 8 --------
 drivers/net/intel/ice/ice_rxtx.c          | 8 +-------
 drivers/net/intel/idpf/idpf_common_rxtx.c | 4 ++--
 drivers/net/intel/idpf/idpf_common_rxtx.h | 7 +------
 7 files changed, 14 insertions(+), 30 deletions(-)
drivers/net/intel/common/tx.h +8 -0
index 01e42303b4..928fad1df5 100644
@@ -53,6 +53,14 @@
 /* Common maximum data per TX descriptor */
 #define CI_MAX_DATA_PER_TXD     (CI_TXD_QW1_TX_BUF_SZ_M >>
 CI_TXD_QW1_TX_BUF_SZ_S)
 
+/* Checksum offload mask to identify packets requesting offload */
+#define CI_TX_CKSUM_OFFLOAD_MASK (RTE_MBUF_F_TX_IP_CKSUM |
 		 \
+				   RTE_MBUF_F_TX_L4_MASK |		 \
+				   RTE_MBUF_F_TX_TCP_SEG |		 \
+				   RTE_MBUF_F_TX_UDP_SEG |		 \
+				   RTE_MBUF_F_TX_OUTER_IP_CKSUM |
 	 \
+				   RTE_MBUF_F_TX_OUTER_UDP_CKSUM)
+

/**

<snip>

Quoted 9 lines
drivers/net/intel/idpf/idpf_common_rxtx.h +0 -0
index b88a87402d..fe7094d434 100644
@@ -39,13 +39,8 @@
 #define IDPF_RLAN_CTX_DBUF_S	7
 #define IDPF_RX_MAX_DATA_BUF_SIZE	(16 * 1024 - 128)
 
Quoted 15 lines

drivers/net/intel/idpf/idpf_common_rxtx.h line 43

Quoted 8 lines
drivers/net/intel/idpf/idpf_common_rxtx.h +1 -6
-#define IDPF_TX_CKSUM_OFFLOAD_MASK (		\
-		RTE_MBUF_F_TX_IP_CKSUM |	\
-		RTE_MBUF_F_TX_L4_MASK |		\
-		RTE_MBUF_F_TX_TCP_SEG)
-
 #define IDPF_TX_OFFLOAD_MASK (			\
-		IDPF_TX_CKSUM_OFFLOAD_MASK |	\
+		CI_TX_CKSUM_OFFLOAD_MASK |	\

With this change should the features in idpf.ini be updated to include Inner L3/L4 checksum?
And IDPF_TX_SCALAR_OFFLOADS update to include RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM

I didn't add it because I hadn't tested it, but since it's using the same code as other drivers it's probably safe enough to add, I suppose.

/Bruce

#98 lore raw

Re: [PATCH v3 10/36] net/intel: consolidate checksum mask definition

Quoted 66 lines · Bruce Richardson
Quoted 49 lines · Ciara
Quoted 36 lines

Subject: [PATCH v3 10/36] net/intel: consolidate checksum mask definition

Create a common definition for checksum masks across iavf, idpf, i40e and ice drivers.

---
 drivers/net/intel/common/tx.h             | 8 ++++++++
 drivers/net/intel/i40e/i40e_rxtx.c        | 7 +------
 drivers/net/intel/iavf/iavf_rxtx.c        | 2 +-
 drivers/net/intel/iavf/iavf_rxtx.h        | 8 --------
 drivers/net/intel/ice/ice_rxtx.c          | 8 +-------
 drivers/net/intel/idpf/idpf_common_rxtx.c | 4 ++--
 drivers/net/intel/idpf/idpf_common_rxtx.h | 7 +------
 7 files changed, 14 insertions(+), 30 deletions(-)
drivers/net/intel/common/tx.h +8 -0
index 01e42303b4..928fad1df5 100644
@@ -53,6 +53,14 @@
 /* Common maximum data per TX descriptor */
 #define CI_MAX_DATA_PER_TXD     (CI_TXD_QW1_TX_BUF_SZ_M >>
 CI_TXD_QW1_TX_BUF_SZ_S)
 
+/* Checksum offload mask to identify packets requesting offload */
+#define CI_TX_CKSUM_OFFLOAD_MASK (RTE_MBUF_F_TX_IP_CKSUM |
 		 \
+				   RTE_MBUF_F_TX_L4_MASK |		 \
+				   RTE_MBUF_F_TX_TCP_SEG |		 \
+				   RTE_MBUF_F_TX_UDP_SEG |		 \
+				   RTE_MBUF_F_TX_OUTER_IP_CKSUM |
 	 \
+				   RTE_MBUF_F_TX_OUTER_UDP_CKSUM)
+

/**

<snip>

Quoted 9 lines
drivers/net/intel/idpf/idpf_common_rxtx.h +0 -0
index b88a87402d..fe7094d434 100644
@@ -39,13 +39,8 @@
 #define IDPF_RLAN_CTX_DBUF_S	7
 #define IDPF_RX_MAX_DATA_BUF_SIZE	(16 * 1024 - 128)
 
Quoted 15 lines

drivers/net/intel/idpf/idpf_common_rxtx.h line 43

Quoted 8 lines
drivers/net/intel/idpf/idpf_common_rxtx.h +1 -6
-#define IDPF_TX_CKSUM_OFFLOAD_MASK (		\
-		RTE_MBUF_F_TX_IP_CKSUM |	\
-		RTE_MBUF_F_TX_L4_MASK |		\
-		RTE_MBUF_F_TX_TCP_SEG)
-
 #define IDPF_TX_OFFLOAD_MASK (			\
-		IDPF_TX_CKSUM_OFFLOAD_MASK |	\
+		CI_TX_CKSUM_OFFLOAD_MASK |	\

With this change should the features in idpf.ini be updated to include Inner L3/L4 checksum?
And IDPF_TX_SCALAR_OFFLOADS update to include RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM

Quoted 3 lines

I didn't add it because I hadn't tested it, but since it's using the same code as other drivers it's probably safe enough to add, I suppose.

Changed my mind here, as I am doing the rework on this set. Leaving this as-is for now until I get to validate it.

/Bruce

#99 lore raw

PATCH v3 11/36 net/intel: create common checksum Tx offload function

In reply to Bruce Richardson

Since i40e and ice have the same checksum offload logic, merge their functions into one. Future rework should enable this to be used by more drivers also.

---
 drivers/net/intel/common/tx_scalar_fns.h | 58 +++++++++++++++++++++++
 drivers/net/intel/i40e/i40e_rxtx.c       | 52 +-------------------
 drivers/net/intel/ice/ice_rxtx.c         | 60 +-----------------------
 3 files changed, 60 insertions(+), 110 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +58 -0
index f894cea616..f88ca7f25a 100644
@@ -64,6 +64,64 @@ ci_tx_xmit_cleanup(struct ci_tx_queue *txq)
 	return 0;
 }
 
+/* Common checksum enable function for Intel drivers (ice, i40e, etc.) */
+static inline void
+ci_txd_enable_checksum(uint64_t ol_flags,
+		       uint32_t *td_cmd,
+		       uint32_t *td_offset,
+		       union ci_tx_offload tx_offload)
+{
+	/* Enable L3 checksum offloads */
+	if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
+		*td_cmd |= CI_TX_DESC_CMD_IIPT_IPV4_CSUM;
+		*td_offset |= (tx_offload.l3_len >> 2) <<
+			CI_TX_DESC_LEN_IPLEN_S;
+	} else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
+		*td_cmd |= CI_TX_DESC_CMD_IIPT_IPV4;
+		*td_offset |= (tx_offload.l3_len >> 2) <<
+			CI_TX_DESC_LEN_IPLEN_S;
+	} else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
+		*td_cmd |= CI_TX_DESC_CMD_IIPT_IPV6;
+		*td_offset |= (tx_offload.l3_len >> 2) <<
+			CI_TX_DESC_LEN_IPLEN_S;
+	}
+
+	if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
+		*td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_TCP;
+		*td_offset |= (tx_offload.l4_len >> 2) <<
+			      CI_TX_DESC_LEN_L4_LEN_S;
+		return;
+	}
+
+	if (ol_flags & RTE_MBUF_F_TX_UDP_SEG) {
+		*td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_UDP;
+		*td_offset |= (tx_offload.l4_len >> 2) <<
+			      CI_TX_DESC_LEN_L4_LEN_S;
+		return;
+	}
+
+	/* Enable L4 checksum offloads */
+	switch (ol_flags & RTE_MBUF_F_TX_L4_MASK) {
+	case RTE_MBUF_F_TX_TCP_CKSUM:
+		*td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_TCP;
+		*td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) <<
+			      CI_TX_DESC_LEN_L4_LEN_S;
+		break;
+	case RTE_MBUF_F_TX_SCTP_CKSUM:
+		*td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_SCTP;
+		*td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) <<
+			      CI_TX_DESC_LEN_L4_LEN_S;
+		break;
+	case RTE_MBUF_F_TX_UDP_CKSUM:
+		*td_cmd |= CI_TX_DESC_CMD_L4T_EOFT_UDP;
+		*td_offset |= (sizeof(struct rte_udp_hdr) >> 2) <<
+			      CI_TX_DESC_LEN_L4_LEN_S;
+		break;
+	default:
+		break;
+	}
+}
+
 static inline uint16_t
 ci_div_roundup16(uint16_t x, uint16_t y)
 {
drivers/net/intel/i40e/i40e_rxtx.c +1 -51

64 lines not on this page · raw message

drivers/net/intel/ice/ice_rxtx.c +1 -59

72 lines not on this page · raw message

Signature · 1 line
2.51.0
#100 lore raw

RE: [PATCH v3 11/36] net/intel: create common checksum Tx offload function

Quoted 15 lines

Subject: [PATCH v3 11/36] net/intel: create common checksum Tx offload function

Since i40e and ice have the same checksum offload logic, merge their functions into one. Future rework should enable this to be used by more drivers also.

---
 drivers/net/intel/common/tx_scalar_fns.h | 58
+++++++++++++++++++++++
 drivers/net/intel/i40e/i40e_rxtx.c       | 52 +-------------------
 drivers/net/intel/ice/ice_rxtx.c         | 60 +-----------------------
 3 files changed, 60 insertions(+), 110 deletions(-)

<snip>

drivers/net/intel/i40e/i40e_rxtx.c i40e_xmit_pkts(void *tx_queue, struct rte_mbuf · line 1122

Quoted 12 lines
drivers/net/intel/i40e/i40e_rxtx.c +1 -2
-
 /* Construct the tx flags */
 static inline uint64_t
 i40e_build_ctob(uint32_t td_cmd,
@@ -1167,7 +1117,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 
 		/* Enable checksum offloading */
 		if (ol_flags & CI_TX_CKSUM_OFFLOAD_MASK)
-			i40e_txd_enable_checksum(ol_flags, &td_cmd,
+			ci_txd_enable_checksum(ol_flags, &td_cmd,
 						 &td_offset, tx_offload);

Now that it uses the common function which handles RTE_MBUF_F_TX_UDP_SEG this means the scalar path now supports the offload RTE_ETH_TX_OFFLOAD_UDP_TSO so I think it should be added to the I40E_TX_SCALAR_OFFLOADS. It seems to be missing from the device capabilities too. Same for ice.

#101 lore raw

Re: [PATCH v3 11/36] net/intel: create common checksum Tx offload function

Quoted 25 lines · Ciara
Quoted 15 lines

Subject: [PATCH v3 11/36] net/intel: create common checksum Tx offload function

Since i40e and ice have the same checksum offload logic, merge their functions into one. Future rework should enable this to be used by more drivers also.

---
 drivers/net/intel/common/tx_scalar_fns.h | 58
+++++++++++++++++++++++
 drivers/net/intel/i40e/i40e_rxtx.c       | 52 +-------------------
 drivers/net/intel/ice/ice_rxtx.c         | 60 +-----------------------
 3 files changed, 60 insertions(+), 110 deletions(-)

<snip>

Quoted 7 lines
drivers/net/intel/i40e/i40e_rxtx.c +0 -1
-
 /* Construct the tx flags */
 static inline uint64_t
 i40e_build_ctob(uint32_t td_cmd,
@@ -1167,7 +1117,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts, uint16_t nb_pkts)
 
Quoted 12 lines

drivers/net/intel/i40e/i40e_rxtx.c i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) · line 1121

Quoted 5 lines
drivers/net/intel/i40e/i40e_rxtx.c +1 -1
 		/* Enable checksum offloading */
 		if (ol_flags & CI_TX_CKSUM_OFFLOAD_MASK)
-			i40e_txd_enable_checksum(ol_flags, &td_cmd,
+			ci_txd_enable_checksum(ol_flags, &td_cmd,
 						 &td_offset, tx_offload);

Now that it uses the common function which handles RTE_MBUF_F_TX_UDP_SEG this means the scalar path now supports the offload RTE_ETH_TX_OFFLOAD_UDP_TSO so I think it should be added to the I40E_TX_SCALAR_OFFLOADS. It seems to be missing from the device capabilities too. Same for ice.

Ack.

#102 lore raw

PATCH v3 12/36 net/intel: create a common scalar Tx function

In reply to Bruce Richardson

Given the similarities between the transmit functions across various Intel drivers, make a start on consolidating them by moving the ice Tx function into common, for reuse by other drivers.

---
 drivers/net/intel/common/tx_scalar_fns.h | 218 ++++++++++++++++++
 drivers/net/intel/ice/ice_rxtx.c         | 270 +++++------------------
 2 files changed, 270 insertions(+), 218 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +218 -0
index f88ca7f25a..6d01c14283 100644
@@ -6,6 +6,7 @@
 #define _COMMON_INTEL_TX_SCALAR_FNS_H_
 
 #include <stdint.h>
+#include <rte_io.h>
 #include <rte_byteorder.h>
 
 /* depends on common Tx definitions. */
@@ -142,5 +143,222 @@ ci_calc_pkt_desc(const struct rte_mbuf *tx_pkt)
 	return count;
 }
 
+typedef uint16_t (*ci_get_ctx_desc_fn)(uint64_t ol_flags, const struct rte_mbuf *mbuf,
+		const union ci_tx_offload *tx_offload, const struct ci_tx_queue *txq,
+		uint64_t *qw0, uint64_t *qw1);
+
+/* gets current timestamp tail index */
+typedef uint16_t (*get_ts_tail_t)(struct ci_tx_queue *txq);
+/* writes a timestamp descriptor and returns new tail index */
+typedef uint16_t (*write_ts_desc_t)(struct ci_tx_queue *txq, struct rte_mbuf *mbuf,
+		uint16_t tx_id, uint16_t ts_id);
+/* writes a timestamp tail index - doorbell */
+typedef void (*write_ts_tail_t)(struct ci_tx_queue *txq, uint16_t ts_id);
+
+struct ci_timesstamp_queue_fns {
+	get_ts_tail_t get_ts_tail;
+	write_ts_desc_t write_ts_desc;
+	write_ts_tail_t write_ts_tail;
+};
+
+static inline uint16_t
+ci_xmit_pkts(struct ci_tx_queue *txq,
+	     struct rte_mbuf **tx_pkts,
+	     uint16_t nb_pkts,
+	     ci_get_ctx_desc_fn get_ctx_desc,
+	     const struct ci_timesstamp_queue_fns *ts_fns)
+{
+	volatile struct ci_tx_desc *ci_tx_ring;
+	volatile struct ci_tx_desc *txd;
+	struct ci_tx_entry *sw_ring;
+	struct ci_tx_entry *txe, *txn;
+	struct rte_mbuf *tx_pkt;
+	struct rte_mbuf *m_seg;
+	uint16_t tx_id;
+	uint16_t ts_id = -1;
+	uint16_t nb_tx;
+	uint16_t nb_used;
+	uint16_t nb_ctx;
+	uint32_t td_cmd = 0;
+	uint32_t td_offset = 0;
+	uint32_t td_tag = 0;
+	uint16_t tx_last;
+	uint16_t slen;
+	uint16_t l2_len;
+	uint64_t buf_dma_addr;
+	uint64_t ol_flags;
+	union ci_tx_offload tx_offload = {0};
+
+	sw_ring = txq->sw_ring;
+	ci_tx_ring = txq->ci_tx_ring;
+	tx_id = txq->tx_tail;
+	txe = &sw_ring[tx_id];
+
+	if (ts_fns != NULL)
+		ts_id = ts_fns->get_ts_tail(txq);
+
+	/* Check if the descriptor ring needs to be cleaned. */
+	if (txq->nb_tx_free < txq->tx_free_thresh)
+		(void)ci_tx_xmit_cleanup(txq);
+
+	for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
+		uint64_t cd_qw0, cd_qw1;
+		tx_pkt = *tx_pkts++;
+
+		ol_flags = tx_pkt->ol_flags;
+		td_cmd = CI_TX_DESC_CMD_ICRC;
+		td_tag = 0;
+		l2_len = ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK ?
+				tx_pkt->outer_l2_len : tx_pkt->l2_len;
+		td_offset = (l2_len >> 1) << CI_TX_DESC_LEN_MACLEN_S;
+
+
+		tx_offload.l2_len = tx_pkt->l2_len;
+		tx_offload.l3_len = tx_pkt->l3_len;
+		tx_offload.outer_l2_len = tx_pkt->outer_l2_len;
+		tx_offload.outer_l3_len = tx_pkt->outer_l3_len;
+		tx_offload.l4_len = tx_pkt->l4_len;
+		tx_offload.tso_segsz = tx_pkt->tso_segsz;
+
+		/* Calculate the number of context descriptors needed. */
+		nb_ctx = get_ctx_desc(ol_flags, tx_pkt, &tx_offload, txq, &cd_qw0, &cd_qw1);
+
+		/* The number of descriptors that must be allocated for
+		 * a packet equals to the number of the segments of that
+		 * packet plus the number of context descriptor if needed.
+		 * Recalculate the needed tx descs when TSO enabled in case
+		 * the mbuf data size exceeds max data size that hw allows
+		 * per tx desc.
+		 */
+		if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG))
+			nb_used = (uint16_t)(ci_calc_pkt_desc(tx_pkt) + nb_ctx);
+		else
+			nb_used = (uint16_t)(tx_pkt->nb_segs + nb_ctx);
+		tx_last = (uint16_t)(tx_id + nb_used - 1);
+
+		/* Circular ring */
+		if (tx_last >= txq->nb_tx_desc)
+			tx_last = (uint16_t)(tx_last - txq->nb_tx_desc);
+
+		if (nb_used > txq->nb_tx_free) {
+			if (ci_tx_xmit_cleanup(txq) != 0) {
+				if (nb_tx == 0)
+					return 0;
+				goto end_of_tx;
+			}
+			if (unlikely(nb_used > txq->tx_rs_thresh)) {
+				while (nb_used > txq->nb_tx_free) {
+					if (ci_tx_xmit_cleanup(txq) != 0) {
+						if (nb_tx == 0)
+							return 0;
+						goto end_of_tx;
+					}
+				}
+			}
+		}
+
+		/* Descriptor based VLAN insertion */
+		if (ol_flags & (RTE_MBUF_F_TX_VLAN | RTE_MBUF_F_TX_QINQ)) {
+			td_cmd |= CI_TX_DESC_CMD_IL2TAG1;
+			td_tag = tx_pkt->vlan_tci;
+		}
+
+		/* Enable checksum offloading */
+		if (ol_flags & CI_TX_CKSUM_OFFLOAD_MASK)
+			ci_txd_enable_checksum(ol_flags, &td_cmd,
+						&td_offset, tx_offload);
+
+		if (nb_ctx) {
+			/* Setup TX context descriptor if required */
+			uint64_t *ctx_txd = RTE_CAST_PTR(uint64_t *, &ci_tx_ring[tx_id]);
+
+			txn = &sw_ring[txe->next_id];
+			RTE_MBUF_PREFETCH_TO_FREE(txn->mbuf);
+			if (txe->mbuf) {
+				rte_pktmbuf_free_seg(txe->mbuf);
+				txe->mbuf = NULL;
+			}
+
+			ctx_txd[0] = cd_qw0;
+			ctx_txd[1] = cd_qw1;
+
+			txe->last_id = tx_last;
+			tx_id = txe->next_id;
+			txe = txn;
+		}
+		m_seg = tx_pkt;
+
+		do {
+			txd = &ci_tx_ring[tx_id];
+			txn = &sw_ring[txe->next_id];
+
+			if (txe->mbuf)
+				rte_pktmbuf_free_seg(txe->mbuf);
+			txe->mbuf = m_seg;
+
+			/* Setup TX Descriptor */
+			slen = m_seg->data_len;
+			buf_dma_addr = rte_mbuf_data_iova(m_seg);
+
+			while ((ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG)) &&
+					unlikely(slen > CI_MAX_DATA_PER_TXD)) {
+				txd->buffer_addr = rte_cpu_to_le_64(buf_dma_addr);
+				txd->cmd_type_offset_bsz = rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DATA |
+					((uint64_t)td_cmd << CI_TXD_QW1_CMD_S) |
+					((uint64_t)td_offset << CI_TXD_QW1_OFFSET_S) |
+					((uint64_t)CI_MAX_DATA_PER_TXD << CI_TXD_QW1_TX_BUF_SZ_S) |
+					((uint64_t)td_tag << CI_TXD_QW1_L2TAG1_S));
+
+				buf_dma_addr += CI_MAX_DATA_PER_TXD;
+				slen -= CI_MAX_DATA_PER_TXD;
+
+				txe->last_id = tx_last;
+				tx_id = txe->next_id;
+				txe = txn;
+				txd = &ci_tx_ring[tx_id];
+				txn = &sw_ring[txe->next_id];
+			}
+
+			txd->buffer_addr = rte_cpu_to_le_64(buf_dma_addr);
+			txd->cmd_type_offset_bsz = rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DATA |
+				((uint64_t)td_cmd << CI_TXD_QW1_CMD_S) |
+				((uint64_t)td_offset << CI_TXD_QW1_OFFSET_S) |
+				((uint64_t)slen << CI_TXD_QW1_TX_BUF_SZ_S) |
+				((uint64_t)td_tag << CI_TXD_QW1_L2TAG1_S));
+
+			txe->last_id = tx_last;
+			tx_id = txe->next_id;
+			txe = txn;
+			m_seg = m_seg->next;
+		} while (m_seg);
+
+		/* fill the last descriptor with End of Packet (EOP) bit */
+		td_cmd |= CI_TX_DESC_CMD_EOP;
+		txq->nb_tx_used = (uint16_t)(txq->nb_tx_used + nb_used);
+		txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_used);
+
+		/* set RS bit on the last descriptor of one packet */
+		if (txq->nb_tx_used >= txq->tx_rs_thresh) {
+			td_cmd |= CI_TX_DESC_CMD_RS;
+
+			/* Update txq RS bit counters */
+			txq->nb_tx_used = 0;
+		}
+		txd->cmd_type_offset_bsz |=
+				rte_cpu_to_le_64(((uint64_t)td_cmd) << CI_TXD_QW1_CMD_S);
+
+		if (ts_fns != NULL)
+			ts_id = ts_fns->write_ts_desc(txq, tx_pkt, tx_id, ts_id);
+	}
+end_of_tx:
+	/* update Tail register */
+	if (ts_fns != NULL)
+		ts_fns->write_ts_tail(txq, ts_id);
+	else
+		rte_write32_wc(tx_id, txq->qtx_tail);
+	txq->tx_tail = tx_id;
+
+	return nb_tx;
+}
 
 #endif /* _COMMON_INTEL_TX_SCALAR_FNS_H_ */
drivers/net/intel/ice/ice_rxtx.c +52 -218

282 lines not on this page · raw message

Signature · 1 line
2.51.0
#103 lore raw

RE: [PATCH v3 12/36] net/intel: create a common scalar Tx function

Quoted 17 lines

Subject: [PATCH v3 12/36] net/intel: create a common scalar Tx function

Given the similarities between the transmit functions across various Intel drivers, make a start on consolidating them by moving the ice Tx function into common, for reuse by other drivers.

---
 drivers/net/intel/common/tx_scalar_fns.h | 218 ++++++++++++++++++
 drivers/net/intel/ice/ice_rxtx.c         | 270 +++++------------------
 2 files changed, 270 insertions(+), 218 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +0 -0
index f88ca7f25a..6d01c14283 100644

<snip>

drivers/net/intel/common/tx_scalar_fns.h ci_calc_pkt_desc(const struct rte_mbuf *tx_pkt) · line 158

Quoted 3 lines
drivers/net/intel/common/tx_scalar_fns.h +3 -0
+typedef void (*write_ts_tail_t)(struct ci_tx_queue *txq, uint16_t ts_id);
+
+struct ci_timesstamp_queue_fns {

typo: timesstamp

Quoted 41 lines
drivers/net/intel/common/tx_scalar_fns.h +41 -0
+	get_ts_tail_t get_ts_tail;
+	write_ts_desc_t write_ts_desc;
+	write_ts_tail_t write_ts_tail;
+};
+
+static inline uint16_t
+ci_xmit_pkts(struct ci_tx_queue *txq,
+	     struct rte_mbuf **tx_pkts,
+	     uint16_t nb_pkts,
+	     ci_get_ctx_desc_fn get_ctx_desc,
+	     const struct ci_timesstamp_queue_fns *ts_fns)
+{
+	volatile struct ci_tx_desc *ci_tx_ring;
+	volatile struct ci_tx_desc *txd;
+	struct ci_tx_entry *sw_ring;
+	struct ci_tx_entry *txe, *txn;
+	struct rte_mbuf *tx_pkt;
+	struct rte_mbuf *m_seg;
+	uint16_t tx_id;
+	uint16_t ts_id = -1;
+	uint16_t nb_tx;
+	uint16_t nb_used;
+	uint16_t nb_ctx;
+	uint32_t td_cmd = 0;
+	uint32_t td_offset = 0;
+	uint32_t td_tag = 0;
+	uint16_t tx_last;
+	uint16_t slen;
+	uint16_t l2_len;
+	uint64_t buf_dma_addr;
+	uint64_t ol_flags;
+	union ci_tx_offload tx_offload = {0};
+
+	sw_ring = txq->sw_ring;
+	ci_tx_ring = txq->ci_tx_ring;
+	tx_id = txq->tx_tail;
+	txe = &sw_ring[tx_id];
+
+	if (ts_fns != NULL)
+		ts_id = ts_fns->get_ts_tail(txq);
+

drivers/net/intel/common/tx_scalar_fns.h ci_calc_pkt_desc(const struct rte_mbuf *tx_pkt) · line 209

Quoted 10 lines
drivers/net/intel/common/tx_scalar_fns.h +10 -0
+	/* Check if the descriptor ring needs to be cleaned. */
+	if (txq->nb_tx_free < txq->tx_free_thresh)
+		(void)ci_tx_xmit_cleanup(txq);
+
+	for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
+		uint64_t cd_qw0, cd_qw1;
+		tx_pkt = *tx_pkts++;
+
+		ol_flags = tx_pkt->ol_flags;
+		td_cmd = CI_TX_DESC_CMD_ICRC;

Why change this initialisation from 0 in the ice code to this value in the common code?

Quoted 7 lines
drivers/net/intel/common/tx_scalar_fns.h +7 -0
+		td_tag = 0;
+		l2_len = ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK ?
+				tx_pkt->outer_l2_len : tx_pkt->l2_len;
+		td_offset = (l2_len >> 1) << CI_TX_DESC_LEN_MACLEN_S;
+
+
+		tx_offload.l2_len = tx_pkt->l2_len;
#104 lore raw

Re: [PATCH v3 12/36] net/intel: create a common scalar Tx function

Quoted 71 lines · Ciara
Quoted 17 lines

Subject: [PATCH v3 12/36] net/intel: create a common scalar Tx function

Given the similarities between the transmit functions across various Intel drivers, make a start on consolidating them by moving the ice Tx function into common, for reuse by other drivers.

---
 drivers/net/intel/common/tx_scalar_fns.h | 218 ++++++++++++++++++
 drivers/net/intel/ice/ice_rxtx.c         | 270 +++++------------------
 2 files changed, 270 insertions(+), 218 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +0 -0
index f88ca7f25a..6d01c14283 100644

<snip>

drivers/net/intel/common/tx_scalar_fns.h ci_calc_pkt_desc(const struct rte_mbuf *tx_pkt) · line 158

Quoted 3 lines
drivers/net/intel/common/tx_scalar_fns.h +3 -0
+typedef void (*write_ts_tail_t)(struct ci_tx_queue *txq, uint16_t ts_id);
+
+struct ci_timesstamp_queue_fns {

typo: timesstamp

Quoted 45 lines
drivers/net/intel/common/tx_scalar_fns.h +45 -0
+	get_ts_tail_t get_ts_tail;
+	write_ts_desc_t write_ts_desc;
+	write_ts_tail_t write_ts_tail;
+};
+
+static inline uint16_t
+ci_xmit_pkts(struct ci_tx_queue *txq,
+	     struct rte_mbuf **tx_pkts,
+	     uint16_t nb_pkts,
+	     ci_get_ctx_desc_fn get_ctx_desc,
+	     const struct ci_timesstamp_queue_fns *ts_fns)
+{
+	volatile struct ci_tx_desc *ci_tx_ring;
+	volatile struct ci_tx_desc *txd;
+	struct ci_tx_entry *sw_ring;
+	struct ci_tx_entry *txe, *txn;
+	struct rte_mbuf *tx_pkt;
+	struct rte_mbuf *m_seg;
+	uint16_t tx_id;
+	uint16_t ts_id = -1;
+	uint16_t nb_tx;
+	uint16_t nb_used;
+	uint16_t nb_ctx;
+	uint32_t td_cmd = 0;
+	uint32_t td_offset = 0;
+	uint32_t td_tag = 0;
+	uint16_t tx_last;
+	uint16_t slen;
+	uint16_t l2_len;
+	uint64_t buf_dma_addr;
+	uint64_t ol_flags;
+	union ci_tx_offload tx_offload = {0};
+
+	sw_ring = txq->sw_ring;
+	ci_tx_ring = txq->ci_tx_ring;
+	tx_id = txq->tx_tail;
+	txe = &sw_ring[tx_id];
+
+	if (ts_fns != NULL)
+		ts_id = ts_fns->get_ts_tail(txq);
+
+	/* Check if the descriptor ring needs to be cleaned. */
+	if (txq->nb_tx_free < txq->tx_free_thresh)
+		(void)ci_tx_xmit_cleanup(txq);
+
Quoted 9 lines

drivers/net/intel/common/tx_scalar_fns.h ci_calc_pkt_desc(const struct rte_mbuf *tx_pkt) · line 209

Quoted 6 lines
drivers/net/intel/common/tx_scalar_fns.h +6 -0
+	for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
+		uint64_t cd_qw0, cd_qw1;
+		tx_pkt = *tx_pkts++;
+
+		ol_flags = tx_pkt->ol_flags;
+		td_cmd = CI_TX_DESC_CMD_ICRC;

Why change this initialisation from 0 in the ice code to this value in the common code?

The spec specifies that this bit is reserved and should be set to 1.