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

Bruce Richardson
2026-01-13T15:20:02Z

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.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
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(-)

diff --git a/drivers/net/intel/common/tx.h b/drivers/net/intel/common/tx.h
index 753e3a2e9e..44270bf3e6 100644
--- a/drivers/net/intel/common/tx.h
+++ b/drivers/net/intel/common/tx.h
@@ -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.
*/
diff --git a/drivers/net/intel/common/tx_scalar_fns.h b/drivers/net/intel/common/tx_scalar_fns.h
index f85ca741a9..b284b80cbe 100644
--- a/drivers/net/intel/common/tx_scalar_fns.h
+++ b/drivers/net/intel/common/tx_scalar_fns.h
@@ -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));
diff --git a/drivers/net/intel/cpfl/cpfl_rxtx.c b/drivers/net/intel/cpfl/cpfl_rxtx.c
index a3127e7c97..6d8798a60f 100644
--- a/drivers/net/intel/cpfl/cpfl_rxtx.c
+++ b/drivers/net/intel/cpfl/cpfl_rxtx.c
@@ -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 {
diff --git a/drivers/net/intel/i40e/i40e_rxtx.c b/drivers/net/intel/i40e/i40e_rxtx.c
index ac53554234..185e45fb9a 100644
--- a/drivers/net/intel/i40e/i40e_rxtx.c
+++ b/drivers/net/intel/i40e/i40e_rxtx.c
@@ -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
diff --git a/drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c b/drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c
index cea4ee9863..374c713a94 100644
--- a/drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c
+++ b/drivers/net/intel/iavf/iavf_rxtx_vec_avx2.c
@@ -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;
}

diff --git a/drivers/net/intel/ice/ice_rxtx.c b/drivers/net/intel/ice/ice_rxtx.c
index ed82a84dc5..06f7e85c12 100644
--- a/drivers/net/intel/ice/ice_rxtx.c
+++ b/drivers/net/intel/ice/ice_rxtx.c
@@ -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;
diff --git a/drivers/net/intel/idpf/idpf_common_rxtx_avx512.c b/drivers/net/intel/idpf/idpf_common_rxtx_avx512.c
index 49ace35615..666ad1a4dd 100644
--- a/drivers/net/intel/idpf/idpf_common_rxtx_avx512.c
+++ b/drivers/net/intel/idpf/idpf_common_rxtx_avx512.c
@@ -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;
}
diff --git a/drivers/net/intel/ixgbe/ixgbe_rxtx_vec_common.c b/drivers/net/intel/ixgbe/ixgbe_rxtx_vec_common.c
index 63c7cb50d3..c42b8fc96b 100644
--- a/drivers/net/intel/ixgbe/ixgbe_rxtx_vec_common.c
+++ b/drivers/net/intel/ixgbe/ixgbe_rxtx_vec_common.c
@@ -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;
}
--
2.51.0