combine multiple Intel scalar Tx paths
cover combine multiple Intel scalar Tx paths
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.
Bruce Richardson (27):
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 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
doc/guides/nics/i40e.rst | 18 + drivers/net/intel/common/tx.h | 101 ++- drivers/net/intel/common/tx_scalar_fns.h | 441 ++++++++++++ drivers/net/intel/cpfl/cpfl_rxtx.c | 4 +- drivers/net/intel/i40e/i40e_fdir.c | 34 +- drivers/net/intel/i40e/i40e_rxtx.c | 500 +++----------- drivers/net/intel/i40e/i40e_rxtx.h | 17 +- .../net/intel/i40e/i40e_rxtx_vec_altivec.c | 23 +- drivers/net/intel/i40e/i40e_rxtx_vec_avx2.c | 34 +- drivers/net/intel/i40e/i40e_rxtx_vec_avx512.c | 50 +- drivers/net/intel/i40e/i40e_rxtx_vec_common.h | 6 +- drivers/net/intel/i40e/i40e_rxtx_vec_neon.c | 23 +- drivers/net/intel/i40e/i40e_rxtx_vec_sse.c | 23 +- 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 | 53 +- drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c | 104 ++- drivers/net/intel/iavf/iavf_rxtx_vec_common.h | 36 +- drivers/net/intel/iavf/iavf_rxtx_vec_sse.c | 27 +- drivers/net/intel/ice/ice_dcf_ethdev.c | 10 +- drivers/net/intel/ice/ice_rxtx.c | 590 +++++----------- drivers/net/intel/ice/ice_rxtx.h | 15 +- drivers/net/intel/ice/ice_rxtx_vec_avx2.c | 53 +- drivers/net/intel/ice/ice_rxtx_vec_avx512.c | 51 +- drivers/net/intel/ice/ice_rxtx_vec_common.h | 43 +- drivers/net/intel/ice/ice_rxtx_vec_sse.c | 24 +- drivers/net/intel/idpf/idpf_common_rxtx.c | 298 ++------ drivers/net/intel/idpf/idpf_common_rxtx.h | 21 +- .../net/intel/idpf/idpf_common_rxtx_avx2.c | 53 +- .../net/intel/idpf/idpf_common_rxtx_avx512.c | 53 +- drivers/net/intel/idpf/idpf_rxtx.c | 17 +- 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 | 1 - 34 files changed, 1394 insertions(+), 2110 deletions(-) create mode 100644 drivers/net/intel/common/tx_scalar_fns.h
--
2.51.0
RFC PATCH 1/27 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/i40e/i40e_rxtx_vec_sse.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/iavf/iavf_rxtx_vec_sse.c | 6 ++-- 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/ice/ice_rxtx_vec_sse.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 +- 25 files changed, 113 insertions(+), 105 deletions(-)
drivers/net/intel/common/tx.h +12 -4
@@ -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
@@ -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
@@ -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
@@ -384,7 +384,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;
@@ -1088,8 +1088,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;
@@ -1389,7 +1389,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;
@@ -1405,7 +1405,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;
@@ -1422,7 +1422,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 ;
@@ -1450,7 +1450,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 ;/**
@@ -2604,7 +2604,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);
@@ -2626,7 +2626,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 =
@@ -2899,13 +2899,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 );
@@ -3207,7 +3207,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",
@@ -3226,7 +3226,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
@@ -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
@@ -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
@@ -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
@@ -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/i40e/i40e_rxtx_vec_sse.c +3 -3
@@ -604,7 +604,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 |
@@ -617,7 +617,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;
@@ -631,7 +631,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/iavf/iavf_rxtx.c +8 -8
@@ -277,7 +277,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 ;
@@ -828,7 +828,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,
@@ -840,7 +840,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);
@@ -2334,7 +2334,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)
@@ -2724,7 +2724,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) {
@@ -2757,7 +2757,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;
@@ -2775,7 +2775,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;
@@ -2896,7 +2896,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
@@ -681,7 +681,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
@@ -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
@@ -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/iavf/iavf_rxtx_vec_sse.c +3 -3
@@ -1242,7 +1242,7 @@ iavf_recv_scattered_pkts_vec_flex_rxd(void *rx_queue, }static inline void -vtx1 (volatile struct iavf_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 = (IAVF_TX_DESC_DTYPE_DATA |
@@ -1256,7 +1256,7 @@ vtx1(volatile struct iavf_tx_desc *txdp, struct rte_mbuf *pkt, uint64_t flags) }static inline void -iavf_vtx (volatile struct iavf_tx_desc *txdp,struct rte_mbuf **pkt, +iavf_vtx (volatile struct ci_tx_desc *txdp,struct rte_mbuf **pkt,uint16_t nb_pkts,uint64_t flags) {int i;
@@ -1270,7 +1270,7 @@ iavf_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 iavf_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 =IAVF_TX_DESC_CMD_EOP |0x04 ;/* bit 2 must be set */
drivers/net/intel/ice/ice_dcf_ethdev.c +1 -1
@@ -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
@@ -1111,13 +1111,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 );
@@ -1609,7 +1609,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,
@@ -2611,7 +2611,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",
@@ -2630,7 +2630,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.
@@ -3019,7 +3019,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;
@@ -3140,8 +3140,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;
@@ -3304,7 +3304,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) |
@@ -3323,7 +3323,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) |
@@ -3544,14 +3544,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 );
@@ -3560,12 +3560,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 );
@@ -3575,7 +3575,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 ;
@@ -3608,7 +3608,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 ;/**
@@ -4891,7 +4891,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;
@@ -4901,7 +4901,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
@@ -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
@@ -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/ice/ice_rxtx_vec_sse.c +3 -3
@@ -596,7 +596,7 @@ ice_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, }static inline void -ice_vtx1 (volatile struct ice_tx_desc *txdp,struct rte_mbuf *pkt, +ice_vtx1 (volatile struct ci_tx_desc *txdp,struct rte_mbuf *pkt,uint64_t flags) { uint64_t high_qw =
@@ -609,7 +609,7 @@ ice_vtx1(volatile struct ice_tx_desc *txdp, struct rte_mbuf *pkt, }static 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) {int i;
@@ -623,7 +623,7 @@ ice_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 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
RFC PATCH 2/27 net/intel: use common tx ring structure
In reply to Bruce RichardsonRather 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/i40e/i40e_rxtx_vec_sse.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/iavf/iavf_rxtx_vec_sse.c | 6 ++-- 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/ice/ice_rxtx_vec_sse.c | 6 ++-- 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 +- 26 files changed, 93 insertions(+), 96 deletions(-)
drivers/net/intel/common/tx.h +1 -4
@@ -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
@@ -594,7 +594,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
@@ -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
@@ -384,7 +384,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;
@@ -1108,7 +1108,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];
@@ -1343,7 +1343,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 ;
@@ -1422,7 +1422,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 ;
@@ -1450,7 +1450,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 ;/**
@@ -2409,7 +2409,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 );
@@ -2606,7 +2606,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);
@@ -2626,7 +2626,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 =
@@ -2901,11 +2901,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 );
@@ -3226,7 +3226,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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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/i40e/i40e_rxtx_vec_sse.c +3 -3
@@ -646,7 +646,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);
@@ -666,7 +666,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]; }
@@ -676,7 +676,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/iavf/iavf_rxtx.c +7 -7
@@ -279,11 +279,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;
@@ -830,7 +830,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) {
@@ -840,7 +840,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);
@@ -2334,7 +2334,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)
@@ -2757,7 +2757,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;
@@ -4504,7 +4504,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
@@ -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
@@ -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
@@ -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/iavf/iavf_rxtx_vec_sse.c +3 -3
@@ -1286,7 +1286,7 @@ iavf_xmit_fixed_burst_vec(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);
@@ -1306,7 +1306,7 @@ iavf_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->iavf_tx_ring[tx_id]; + txdp = &txq->ci_tx_ring[tx_id]; txep = &txq->sw_ring_vec[tx_id]; }
@@ -1316,7 +1316,7 @@ iavf_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->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/ice/ice_dcf_ethdev.c +2 -2
@@ -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
@@ -1113,11 +1113,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 );
@@ -1611,7 +1611,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) {
@@ -1633,7 +1633,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 =
@@ -2547,7 +2547,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 );
@@ -2630,7 +2630,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.
@@ -3019,7 +3019,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;
@@ -3140,7 +3140,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;
@@ -3163,7 +3163,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];
@@ -3249,7 +3249,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 ;
@@ -3291,7 +3291,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)
@@ -3319,7 +3319,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]; }
@@ -3402,7 +3402,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 ;
@@ -3575,7 +3575,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 ;
@@ -3608,7 +3608,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 ;/**
@@ -4896,11 +4896,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
@@ -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
@@ -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
@@ -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/ice/ice_rxtx_vec_sse.c +3 -3
@@ -642,7 +642,7 @@ ice_xmit_fixed_burst_vec(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);
@@ -662,7 +662,7 @@ ice_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->ice_tx_ring[tx_id]; + txdp = &txq->ci_tx_ring[tx_id]; txep = &txq->sw_ring_vec[tx_id]; }
@@ -672,7 +672,7 @@ ice_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->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/idpf/idpf_common_rxtx.c +4 -4
@@ -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
@@ -573,7 +573,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pktsreturn 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
@@ -1090,7 +1090,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkreturn 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
@@ -469,7 +469,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
@@ -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
RFC PATCH 3/27 net/intel: create common post-Tx cleanup function
In reply to Bruce RichardsonThe 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
@@ -249,6 +249,59 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq, ci_desc_done_fn desc_done, bool ctxreturn 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
RFC PATCH 4/27 net/intel: consolidate definitions for Tx desc fields
In reply to Bruce RichardsonThe 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/i40e/i40e_rxtx_vec_sse.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/iavf/iavf_rxtx_vec_sse.c | 15 +- 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/ice/ice_rxtx_vec_sse.c | 12 +- 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 +- 28 files changed, 424 insertions(+), 535 deletions(-)
drivers/net/intel/common/tx.h +62 -2
@@ -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 */
@@ -276,8 +336,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
@@ -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
@@ -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
@@ -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
@@ -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 | ((uint64_t)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
@@ -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 | ((uint64_t)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
@@ -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
@@ -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/i40e/i40e_rxtx_vec_sse.c +5 -6
@@ -607,9 +607,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);
@@ -635,7 +635,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)
@@ -677,8 +677,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/iavf/iavf_rxtx.c +33 -35
168 lines not on this page · raw message
drivers/net/intel/iavf/iavf_rxtx.h +2 -18
@@ -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
@@ -410,7 +394,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)
@@ -689,7 +673,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
@@ -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/iavf/iavf_rxtx_vec_sse.c +6 -9
@@ -1244,11 +1244,9 @@ iavf_recv_scattered_pkts_vec_flex_rxd(void *rx_queue,static inline void vtx1 (volatile struct ci_tx_desc *txdp,struct rte_mbuf *pkt,uint64_t flags) { -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 ));__m128i descriptor =_mm_set_epi64x (high_qw, pkt->buf_iova + pkt->data_off);
@@ -1273,8 +1271,8 @@ iavf_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 =IAVF_TX_DESC_CMD_EOP |0x04 ;/* bit 2 must be set */ -uint64_t rs =IAVF_TX_DESC_CMD_RS | flags; +uint64_t flags =CI_TX_DESC_CMD_EOP |0x04 ;/* bit 2 must be set */ +uint64_t rs =CI_TX_DESC_CMD_RS | flags;int i;if (txq->nb_tx_free < txq->tx_free_thresh)
@@ -1317,8 +1315,7 @@ iavf_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 )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 ); txq->tx_next_rs = (uint16_t )(txq->tx_next_rs + txq->tx_rs_thresh); }
drivers/net/intel/ice/ice_dcf_ethdev.c +1 -1
@@ -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
@@ -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
@@ -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/ice/ice_rxtx_vec_sse.c +5 -7
@@ -599,10 +599,9 @@ static inline void ice_vtx1(volatile struct ci_tx_desc *txdp, struct rte_mbuf *pkt, uint64_t flags) { - 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 ));__m128i descriptor =_mm_set_epi64x (high_qw,rte_pktmbuf_iova (pkt)); _mm_store_si128(RTE_CAST_PTR(__m128i *, txdp), descriptor);
@@ -627,7 +626,7 @@ ice_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 =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 ;int i;/* cross rx_thresh boundary is not allowed */
@@ -673,8 +672,7 @@ ice_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 )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/idpf/idpf_common_rxtx.c +11 -11
@@ -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
@@ -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
@@ -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
RFC PATCH 5/27 net/intel: create separate header for Tx scalar fns
In reply to Bruce RichardsonRather 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
@@ -309,59 +309,6 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq, ci_desc_done_fn desc_done, bool ctxreturn 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) {
@@ -480,4 +427,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
RFC PATCH 6/27 net/intel: add common fn to calculate needed descriptors
In reply to Bruce RichardsonMultiple 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
@@ -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
@@ -1025,21 +1025,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) {
@@ -1102,8 +1087,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
@@ -2667,21 +2667,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,
@@ -2767,7 +2752,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
@@ -3067,21 +3067,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) {
@@ -3144,8 +3129,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
@@ -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
RFC PATCH 7/27 net/ice: refactor context descriptor handling
In reply to Bruce RichardsonCreate 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 | 96 ++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 41 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +55 -41
@@ -3044,7 +3044,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;
@@ -3055,7 +3055,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 ;
@@ -3067,6 +3067,51 @@ 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, +uint32_t *td_offset,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 ) { + *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); + } + +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) {
@@ -3077,7 +3122,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;
@@ -3106,20 +3150,24 @@ 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++; td_cmd =0 ; td_tag =0 ; td_offset =0 ; ol_flags = tx_pkt->ol_flags; + 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, &td_offset, &cd_qw0, &cd_qw1);/* The number of descriptors that must be allocated for * a packet equals to the number of the segments of that
@@ -3161,15 +3209,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,
@@ -3177,11 +3216,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);
@@ -3190,29 +3225,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
RFC PATCH 8/27 net/i40e: refactor context descriptor handling
In reply to Bruce Richardsonmove 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 | 109 +++++++++++++++-------------- 1 file changed, 58 insertions(+), 51 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +58 -51
@@ -1000,7 +1000,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;
@@ -1011,7 +1011,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 ;
@@ -1025,6 +1025,53 @@ 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, +uint32_t *td_offset,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 ) { + *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); + } + +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) {
@@ -1035,7 +1082,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;
@@ -1076,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, &td_offset, + &cd_qw0, &cd_qw1);/** * The number of descriptors that must be allocated for
@@ -1122,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,
@@ -1137,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);
@@ -1151,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
RFC PATCH 9/27 net/idpf: refactor context descriptor handling
In reply to Bruce Richardsonmove 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
@@ -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
RFC PATCH 10/27 net/intel: consolidate checksum mask definition
In reply to Bruce RichardsonCreate a common definition for checksum masks across iavf, idpf, i40e and ice drivers.
--- drivers/net/intel/common/tx.h | 7 +++++++ 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 | 7 +------ drivers/net/intel/idpf/idpf_common_rxtx.c | 4 ++-- drivers/net/intel/idpf/idpf_common_rxtx.h | 7 +------ 7 files changed, 13 insertions(+), 29 deletions(-)
drivers/net/intel/common/tx.h +7 -0
@@ -53,6 +53,13 @@/* 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_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
@@ -49,11 +49,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
@@ -2597,7 +2597,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
@@ -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 -6
@@ -9,11 +9,6 @@#include "ice_rxtx.h" #include "ice_rxtx_vec_common.h" -#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.
@@ -3210,7 +3205,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
@@ -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
@@ -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
RFC PATCH 11/27 net/intel: create common checksum Tx offload function
In reply to Bruce RichardsonSince 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 | 63 +++++++++++++++++++++++ drivers/net/intel/i40e/i40e_rxtx.c | 57 +-------------------- drivers/net/intel/ice/ice_rxtx.c | 64 +----------------------- 3 files changed, 65 insertions(+), 119 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +63 -0
@@ -64,6 +64,69 @@ 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) +{ +/* 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 ; + *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 -56
69 lines not on this page · raw message
drivers/net/intel/ice/ice_rxtx.c +1 -63
76 lines not on this page · raw message
Signature · 1 line
2.51.0
RFC PATCH 12/27 net/intel: create a common scalar Tx function
In reply to Bruce RichardsonGiven 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 | 215 ++++++++++++++++++ drivers/net/intel/ice/ice_rxtx.c | 268 +++++------------------ 2 files changed, 267 insertions(+), 216 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +215 -0
@@ -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. */
@@ -147,5 +148,219 @@ 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, +uint32_t *td_offset,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; +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++; + + td_cmd =CI_TX_DESC_CMD_ICRC ; + td_tag =0 ; + td_offset =0 ; + ol_flags = tx_pkt->ol_flags; + + 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, &td_offset, &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 -216
280 lines not on this page · raw message
Signature · 1 line
2.51.0
RFC PATCH 13/27 net/i40e: use common scalar Tx function
In reply to Bruce RichardsonFollowing earlier rework, the scalar transmit function for i40e can use the common function previously moved over from ice driver. This saves hundreds of duplicated lines of code.
--- drivers/net/intel/i40e/i40e_rxtx.c | 206 +---------------------------- 1 file changed, 2 insertions(+), 204 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +2 -204
@@ -1015,210 +1015,8 @@ get_context_desc(uint64_t ol_flags, const struct rte_mbuf *tx_pkt,uint16_t 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 ci_tx_desc *txd; -volatile struct ci_tx_desc *txr; -struct rte_mbuf *tx_pkt; -struct rte_mbuf *m_seg; -uint16_t tx_id; -uint16_t nb_tx; -uint32_t td_cmd; -uint32_t td_offset; -uint32_t td_tag; -uint64_t ol_flags; -uint16_t nb_used; -uint16_t nb_ctx; -uint16_t tx_last; -uint16_t slen; -uint64_t buf_dma_addr; -union ci_tx_offload tx_offload = {0 }; - - txq = tx_queue; - sw_ring = txq->sw_ring; - txr = txq->ci_tx_ring; - tx_id = txq->tx_tail; - txe = &sw_ring[tx_id]; - -/* 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++) { - 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; - 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. */ -uint64_t cd_qw0 =0 , cd_qw1 =0 ; - nb_ctx =get_context_desc (ol_flags, tx_pkt, &tx_offload, txq, &td_offset, - &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 1 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 ) - 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; - } - -/* Always enable CRC offload insertion */ - td_cmd |=CI_TX_DESC_CMD_ICRC ; - -/* 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 *desc = RTE_CAST_PTR(uint64_t *, &txr[tx_id]); - - txn = &sw_ring[txe->next_id]; -RTE_MBUF_PREFETCH_TO_FREE (txn->mbuf); -if (txe->mbuf !=NULL ) { -rte_pktmbuf_free_seg (txe->mbuf); - txe->mbuf =NULL ; - } - - desc[0 ] = cd_qw0; - desc[1 ] = cd_qw1; - -PMD_TX_LOG (DEBUG ,"mbuf: %p, TCD[%u]: " -"qw0: %#" PRIx64"; " -"qw1: %#" PRIx64";" , - tx_pkt, tx_id, cd_qw0, cd_qw1); - - txe->last_id = tx_last; - tx_id = txe->next_id; - txe = txn; - } - - m_seg = tx_pkt; -do { - txd = &txr[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 ) && -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,CI_MAX_DATA_PER_TXD , - td_tag); - - 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 = &txr[tx_id]; - txn = &sw_ring[txe->next_id]; - } -PMD_TX_LOG (DEBUG ,"mbuf: %p, TDD[%u]: " -"buf_dma_addr: %#" PRIx64"; " -"td_cmd: %#x; " -"td_offset: %#x; " -"td_len: %u; " -"td_tag: %#x;" , - tx_pkt, tx_id, buf_dma_addr, - td_cmd, td_offset, slen, td_tag); - - txd->buffer_addr =rte_cpu_to_le_64 (buf_dma_addr); - txd->cmd_type_offset_bsz =i40e_build_ctob (td_cmd, - td_offset, slen, td_tag); - txe->last_id = tx_last; - tx_id = txe->next_id; - txe = txn; - m_seg = m_seg->next; - }while (m_seg !=NULL ); - -/* The last packet data descriptor needs End Of Packet (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); - -if (txq->nb_tx_used >= txq->tx_rs_thresh) { -PMD_TX_LOG (DEBUG , -"Setting RS bit on TXD id=" -"%4u (port=%d queue=%d)" , - tx_last, txq->port_id, txq->queue_id); - - 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 ); - } - -end_of_tx: -PMD_TX_LOG (DEBUG ,"port_id=%u queue_id=%u tx_tail=%u nb_tx=%u" , - (unsigned ) txq->port_id, (unsigned ) txq->queue_id, - (unsigned ) tx_id, (unsigned ) nb_tx); - -rte_io_wmb (); -I40E_PCI_REG_WC_WRITE_RELAXED (txq->qtx_tail, tx_id); - txq->tx_tail = tx_id; - -return nb_tx; +/* i40e does not support timestamp queues, so pass NULL for ts_fns */ +return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts, get_context_desc,NULL ); }static __rte_always_inline int
Signature · 1 line
2.51.0
RFC PATCH 14/27 net/intel: add IPSec hooks to common Tx function
In reply to Bruce RichardsonThe iavf driver has IPSec offload support on Tx, so add hooks to the common Tx function to support that. Do so in a way that has zero performance impact for drivers which do not have IPSec support, by passing in compile-time NULL constants for the function pointers, which can be optimized away by the compiler.
--- drivers/net/intel/common/tx_scalar_fns.h | 60 ++++++++++++++++++++++-- drivers/net/intel/i40e/i40e_rxtx.c | 4 +- drivers/net/intel/ice/ice_rxtx.c | 4 +- 3 files changed, 60 insertions(+), 8 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +56 -4
@@ -152,6 +152,24 @@ typedef uint16_t (*ci_get_ctx_desc_fn)(uint64_t ol_flags, const struct rte_mbuf const union ci_tx_offload *tx_offload, const struct ci_tx_queue *txq, uint32_t *td_offset, uint64_t *qw0, uint64_t *qw1); +/* gets IPsec descriptor information and returns number of descriptors needed (0 or 1) */ +typedef uint16_t (*get_ipsec_desc_t )(const struct rte_mbuf *mbuf, +const struct ci_tx_queue *txq, +void **ipsec_metadata, +uint64_t *qw0, +uint64_t *qw1); +/* calculates segment length for IPsec + TSO combinations */ +typedef uint16_t (*calc_ipsec_segment_len_t )(const struct rte_mbuf *mb_seg, +uint64_t ol_flags, +const void *ipsec_metadata, +uint16_t tlen); + +/** IPsec descriptor operations for drivers that support inline IPsec crypto. */ +struct ci_ipsec_ops { +get_ipsec_desc_t get_ipsec_desc; +calc_ipsec_segment_len_t calc_segment_len; +}; +/* 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 */
@@ -171,6 +189,7 @@ 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_ipsec_ops *ipsec_ops, const struct ci_timesstamp_queue_fns *ts_fns) { volatile struct ci_tx_desc *ci_tx_ring;
@@ -206,6 +225,9 @@ ci_xmit_pkts(struct ci_tx_queue *txq, (void )ci_tx_xmit_cleanup (txq);for (nb_tx =0 ; nb_tx < nb_pkts; nb_tx++) { +void *ipsec_md =NULL ; +uint16_t nb_ipsec =0 ; +uint64_t ipsec_qw0 =0 , ipsec_qw1 =0 ;uint64_t cd_qw0, cd_qw1; tx_pkt = *tx_pkts++;
@@ -225,17 +247,22 @@ ci_xmit_pkts(struct ci_tx_queue *txq, nb_ctx =get_ctx_desc (ol_flags, tx_pkt, &tx_offload, txq, &td_offset, &cd_qw0, &cd_qw1); +/* Get IPsec descriptor information if IPsec ops provided */ +if (ipsec_ops !=NULL ) + nb_ipsec = ipsec_ops->get_ipsec_desc (tx_pkt, txq, &ipsec_md, + &ipsec_qw0, &ipsec_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. +* packet plus the number of context and IPsec descriptors 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); + nb_used = (uint16_t )(ci_calc_pkt_desc (tx_pkt) + nb_ctx + nb_ipsec);else - nb_used = (uint16_t )(tx_pkt->nb_segs + nb_ctx); + nb_used = (uint16_t )(tx_pkt->nb_segs + nb_ctx + nb_ipsec); tx_last = (uint16_t )(tx_id + nb_used -1 );/* Circular ring */
@@ -288,6 +315,26 @@ ci_xmit_pkts(struct ci_tx_queue *txq, tx_id = txe->next_id; txe = txn; } + +if (ipsec_ops !=NULL && nb_ipsec >0 ) { +/* Setup TX IPsec descriptor if required */ + uint64_t *ipsec_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 ; + } + + ipsec_txd[0 ] = ipsec_qw0; + ipsec_txd[1 ] = ipsec_qw1; + + txe->last_id = tx_last; + tx_id = txe->next_id; + txe = txn; + } + m_seg = tx_pkt; do {
@@ -299,7 +346,12 @@ ci_xmit_pkts(struct ci_tx_queue *txq, txe->mbuf = m_seg;/* Setup TX Descriptor */ - slen = m_seg->data_len; +/* Calculate segment length, using IPsec callback if provided */ +if (ipsec_ops !=NULL ) + slen = ipsec_ops->calc_segment_len (m_seg, ol_flags, ipsec_md,0 ); +else + 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)) &&
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
@@ -1015,8 +1015,8 @@ get_context_desc(uint64_t ol_flags, const struct rte_mbuf *tx_pkt,uint16_t i40e_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts) { -/* i40e does not support timestamp queues, so pass NULL for ts_fns */ -return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts, get_context_desc,NULL ); +/* i40e does not support IPsec or timestamp queues, so pass NULL for both */ +return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts, get_context_desc,NULL ,NULL ); }static __rte_always_inline int
drivers/net/intel/ice/ice_rxtx.c +2 -2
@@ -3100,9 +3100,9 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;if (txq->tsq !=NULL && txq->tsq->ts_flag >0 ) -return ci_xmit_pkts (txq, tx_pkts, nb_pkts, get_context_desc, &ts_fns); +return ci_xmit_pkts (txq, tx_pkts, nb_pkts, get_context_desc,NULL , &ts_fns); -return ci_xmit_pkts (txq, tx_pkts, nb_pkts, get_context_desc,NULL ); +return ci_xmit_pkts (txq, tx_pkts, nb_pkts, get_context_desc,NULL ,NULL ); }static __rte_always_inline int
Signature · 1 line
2.51.0
RFC PATCH 15/27 net/intel: support configurable VLAN tag insertion on Tx
In reply to Bruce RichardsonMake the VLAN tag insertion logic configurable in the common code, as to where inner/outer tags get placed.
--- drivers/net/intel/common/tx.h | 10 ++++++++++ drivers/net/intel/common/tx_scalar_fns.h | 9 +++++++-- drivers/net/intel/i40e/i40e_rxtx.c | 4 ++-- drivers/net/intel/ice/ice_rxtx.c | 4 ++-- 4 files changed, 21 insertions(+), 6 deletions(-)
drivers/net/intel/common/tx.h +10 -0
@@ -45,6 +45,16 @@#define CI_TX_CTX_DESC_TSYN 0x02#define CI_TX_CTX_DESC_IL2TAG2 0x04 +/** +* L2TAG1 Field Source Selection +* Specifies which mbuf VLAN field to use for the L2TAG1 field in data descriptors. +* Context descriptor VLAN handling (L2TAG2) is managed by driver-specific callbacks. +*/ +enum ci_tx_l2tag1_field { +CI_VLAN_IN_L2TAG1 ,/**< For VLAN (not QinQ), use L2Tag1 field in data desc */ +CI_VLAN_IN_L2TAG2 ,/**< For VLAN (not QinQ), use L2Tag2 field in ctx desc */ +}; +/* 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 */
drivers/net/intel/common/tx_scalar_fns.h +7 -2
@@ -188,6 +188,7 @@ static inline uint16_t ci_xmit_pkts(struct ci_tx_queue *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts, + enum ci_tx_l2tag1_field l2tag1_field, ci_get_ctx_desc_fn get_ctx_desc, const struct ci_ipsec_ops *ipsec_ops, const struct ci_timesstamp_queue_fns *ts_fns)
@@ -286,8 +287,12 @@ ci_xmit_pkts(struct ci_tx_queue *txq, } } -/* Descriptor based VLAN insertion */ -if (ol_flags & (RTE_MBUF_F_TX_VLAN |RTE_MBUF_F_TX_QINQ )) { +/* Descriptor based VLAN/QinQ insertion */ +/* for single vlan offload, only insert in data desc with VLAN_IN_L2TAG1 is set +* for qinq offload, we always put inner tag in L2Tag1 +*/ +if (((ol_flags &RTE_MBUF_F_TX_VLAN ) && (l2tag1_field ==CI_VLAN_IN_L2TAG1 )) || + (ol_flags &RTE_MBUF_F_TX_QINQ )) { td_cmd |=CI_TX_DESC_CMD_IL2TAG1 ; td_tag = tx_pkt->vlan_tci; }
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
@@ -1002,7 +1002,7 @@ get_context_desc(uint64_t ol_flags, const struct rte_mbuf *tx_pkt,/* 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 ); + cd_type_cmd_tso_mss |= (I40E_TX_CTX_DESC_IL2TAG2 <<I40E_TXD_CTX_QW1_CMD_SHIFT ); } *qw0 = rte_cpu_to_le_32(cd_tunneling_params) |
@@ -1016,7 +1016,7 @@ uint16_t i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) {/* i40e does not support IPsec or timestamp queues, so pass NULL for both */ -return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts, get_context_desc,NULL ,NULL ); +return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_VLAN_IN_L2TAG1 , get_context_desc,NULL ,NULL ); }static __rte_always_inline int
drivers/net/intel/ice/ice_rxtx.c +2 -2
@@ -3100,9 +3100,9 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;if (txq->tsq !=NULL && txq->tsq->ts_flag >0 ) -return ci_xmit_pkts (txq, tx_pkts, nb_pkts, get_context_desc,NULL , &ts_fns); +return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_VLAN_IN_L2TAG1 , get_context_desc,NULL , &ts_fns); -return ci_xmit_pkts (txq, tx_pkts, nb_pkts, get_context_desc,NULL ,NULL ); +return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_VLAN_IN_L2TAG1 , get_context_desc,NULL ,NULL ); }static __rte_always_inline int
Signature · 1 line
2.51.0
RFC PATCH 16/27 net/iavf: use common scalar Tx function
In reply to Bruce RichardsonNow that the common scalar Tx function has all necessary hooks for the features supported by the iavf driver, use the common function to avoid duplicated code.
--- drivers/net/intel/iavf/iavf_rxtx.c | 534 ++++++----------------------- 1 file changed, 109 insertions(+), 425 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +109 -425
@@ -2327,7 +2327,7 @@ iavf_recv_pkts_bulk_alloc(void *rx_queue,/* 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) +iavf_calc_context_desc (const struct rte_mbuf *mb,uint8_t vlan_flag) {uint64_t flags = mb->ol_flags; if (flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG |
@@ -2345,44 +2345,7 @@ iavf_calc_context_desc(struct rte_mbuf *mb, uint8_t vlan_flag) }static inline void -iavf_fill_ctx_desc_cmd_field (volatile uint64_t *field,struct rte_mbuf *m, -uint8_t vlan_flag) -{ -uint64_t cmd =0 ; - -/* TSO enabled */ -if (m->ol_flags & (RTE_MBUF_F_TX_TCP_SEG |RTE_MBUF_F_TX_UDP_SEG )) - 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 ) || - m->ol_flags &RTE_MBUF_F_TX_QINQ ) { - cmd |=CI_TX_CTX_DESC_IL2TAG2 - <<IAVF_TXD_CTX_QW1_CMD_SHIFT ; - } - -if (IAVF_CHECK_TX_LLDP (m)) - cmd |=IAVF_TX_CTX_DESC_SWTCH_UPLINK - <<IAVF_TXD_CTX_QW1_CMD_SHIFT ; - - *field |= cmd; -} - -static inline void -iavf_fill_ctx_desc_ipsec_field (volatile uint64_t *field, -struct iavf_ipsec_crypto_pkt_metadata *ipsec_md) -{ -uint64_t ipsec_field = - (uint64_t )ipsec_md->ctx_desc_ipsec_params << -IAVF_TXD_CTX_QW1_IPSEC_PARAMS_CIPHERBLK_SHIFT ; - - *field |= ipsec_field; -} - - -static inline void -iavf_fill_ctx_desc_tunnelling_field (volatile uint64_t *qw0, -const struct rte_mbuf *m) +iavf_fill_ctx_desc_tunnelling_field (uint64_t *qw0,const struct rte_mbuf *m) {uint64_t eip_typ =IAVF_TX_CTX_DESC_EIPT_NONE ;uint64_t eip_len =0 ;
@@ -2457,7 +2420,7 @@ iavf_fill_ctx_desc_tunnelling_field(volatile uint64_t *qw0,static inline uint16_t iavf_fill_ctx_desc_segmentation_field (volatile uint64_t *field, -struct rte_mbuf *m,struct iavf_ipsec_crypto_pkt_metadata *ipsec_md) +const struct rte_mbuf *m,struct iavf_ipsec_crypto_pkt_metadata *ipsec_md) {uint64_t segmentation_field =0 ;uint64_t total_length =0 ;
@@ -2496,59 +2459,31 @@ struct iavf_tx_context_desc_qws {__le64 qw1; }; -static inline void -iavf_fill_context_desc (volatile struct iavf_tx_context_desc *desc, -struct rte_mbuf *m,struct iavf_ipsec_crypto_pkt_metadata *ipsec_md, -uint16_t *tlen,uint8_t vlan_flag) +/* IPsec callback for ci_xmit_pkts - gets IPsec descriptor information */ +static uint16_t +iavf_get_ipsec_desc (const struct rte_mbuf *mbuf,const struct ci_tx_queue *txq, +void **ipsec_metadata,uint64_t *qw0,uint64_t *qw1) { -volatile struct iavf_tx_context_desc_qws *desc_qws = - (volatile struct iavf_tx_context_desc_qws *)desc; -/* fill descriptor type field */ - desc_qws->qw1 =IAVF_TX_DESC_DTYPE_CONTEXT ; - -/* fill command field */ -iavf_fill_ctx_desc_cmd_field (&desc_qws->qw1, m, vlan_flag); - -/* fill segmentation field */ -if (m->ol_flags & (RTE_MBUF_F_TX_TCP_SEG |RTE_MBUF_F_TX_UDP_SEG )) { -/* fill IPsec field */ -if (m->ol_flags &RTE_MBUF_F_TX_SEC_OFFLOAD ) -iavf_fill_ctx_desc_ipsec_field (&desc_qws->qw1, - ipsec_md); - - *tlen =iavf_fill_ctx_desc_segmentation_field (&desc_qws->qw1, - m, ipsec_md); - } - -/* fill tunnelling field */ -if (m->ol_flags &RTE_MBUF_F_TX_TUNNEL_MASK ) -iavf_fill_ctx_desc_tunnelling_field (&desc_qws->qw0, m); -else - desc_qws->qw0 =0 ; +struct iavf_ipsec_crypto_pkt_metadata *md; - desc_qws->qw0 =rte_cpu_to_le_64 (desc_qws->qw0); - desc_qws->qw1 =rte_cpu_to_le_64 (desc_qws->qw1); +if (!(mbuf->ol_flags &RTE_MBUF_F_TX_SEC_OFFLOAD )) +return 0 ; -/* vlan_flag specifies VLAN tag location for VLAN, and outer tag location for QinQ. */ -if (m->ol_flags &RTE_MBUF_F_TX_QINQ ) - desc->l2tag2 = vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ? m->vlan_tci_outer : - m->vlan_tci; -else if (m->ol_flags &RTE_MBUF_F_TX_VLAN && vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ) - desc->l2tag2 = m->vlan_tci; -} + md =RTE_MBUF_DYNFIELD (mbuf, txq->ipsec_crypto_pkt_md_offset, + struct iavf_ipsec_crypto_pkt_metadata *); +if (!md) +return 0 ; + *ipsec_metadata = md; -static inline void -iavf_fill_ipsec_desc (volatile struct iavf_tx_ipsec_desc *desc, -const struct iavf_ipsec_crypto_pkt_metadata *md,uint16_t *ipsec_len) -{ - desc->qw0 =rte_cpu_to_le_64 (((uint64_t )md->l4_payload_len << +/* Fill IPsec descriptor using existing logic */ + *qw0 =rte_cpu_to_le_64 (((uint64_t )md->l4_payload_len <<IAVF_IPSEC_TX_DESC_QW0_L4PAYLEN_SHIFT ) | ((uint64_t )md->esn <<IAVF_IPSEC_TX_DESC_QW0_IPSECESN_SHIFT ) | ((uint64_t )md->esp_trailer_len <<IAVF_IPSEC_TX_DESC_QW0_TRAILERLEN_SHIFT )); - desc->qw1 = rte_cpu_to_le_64(((uint64_t)md->sa_idx << + *qw1 = rte_cpu_to_le_64(((uint64_t)md->sa_idx << IAVF_IPSEC_TX_DESC_QW1_IPSECSA_SHIFT) | ((uint64_t)md->next_proto << IAVF_IPSEC_TX_DESC_QW1_IPSECNH_SHIFT) |
@@ -2557,143 +2492,106 @@ iavf_fill_ipsec_desc(volatile struct iavf_tx_ipsec_desc *desc, ((uint64_t )(md->ol_flags &IAVF_IPSEC_CRYPTO_OL_FLAGS_NATT ?1ULL :0ULL ) <<IAVF_IPSEC_TX_DESC_QW1_UDP_SHIFT ) | - (uint64_t)IAVF_TX_DESC_DTYPE_IPSEC); + ((uint64_t )IAVF_TX_DESC_DTYPE_IPSEC << + CI_TXD_QW1_DTYPE_S)); -/** -* TODO: Pre-calculate this in the Session initialization -* -* Calculate IPsec length required in data descriptor func when TSO -* offload is enabled -*/ - *ipsec_len =sizeof (struct rte_esp_hdr ) + (md->len_iv >>2 ) + - (md->ol_flags &IAVF_IPSEC_CRYPTO_OL_FLAGS_NATT ? -sizeof (struct rte_udp_hdr ) :0 ); +return 1 ;/* One IPsec descriptor needed */ } -static inline void -iavf_build_data_desc_cmd_offset_fields (volatile uint64_t *qw1, -struct rte_mbuf *m,uint8_t vlan_flag) +/* IPsec callback for ci_xmit_pkts - calculates segment length for IPsec+TSO */ +static uint16_t +iavf_calc_ipsec_segment_len (const struct rte_mbuf *mb_seg,uint64_t ol_flags, +const void *ipsec_metadata,uint16_t tlen) { -uint64_t command =0 ; -uint64_t offset =0 ; -uint64_t l2tag1 =0 ; - - *qw1 =CI_TX_DESC_DTYPE_DATA ; - - 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 )CI_TX_DESC_CMD_IL2TAG1 ; - l2tag1 |= m->vlan_tci; - } - -/* Descriptor based QinQ insertion. vlan_flag specifies outer tag location. */ -if (m->ol_flags &RTE_MBUF_F_TX_QINQ ) { - command |= (uint64_t )CI_TX_DESC_CMD_IL2TAG1 ; - l2tag1 = vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ? m->vlan_tci_outer : - m->vlan_tci; +const struct iavf_ipsec_crypto_pkt_metadata *ipsec_md = ipsec_metadata; + +if ((ol_flags &RTE_MBUF_F_TX_SEC_OFFLOAD ) && + (ol_flags & (RTE_MBUF_F_TX_TCP_SEG |RTE_MBUF_F_TX_UDP_SEG ))) { +uint16_t ipseclen = ipsec_md ? (ipsec_md->esp_trailer_len + + ipsec_md->len_iv) :0 ; +uint16_t slen = tlen + mb_seg->l2_len + mb_seg->l3_len + + mb_seg->outer_l3_len + ipseclen; +if (ol_flags &RTE_MBUF_F_TX_L4_MASK ) + slen += mb_seg->l4_len; +return slen; } -if ((m->ol_flags & - (CI_TX_CKSUM_OFFLOAD_MASK |RTE_MBUF_F_TX_SEC_OFFLOAD )) ==0 ) - goto skip_cksum; +return mb_seg->data_len; +} -/* Set MACLEN */ -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 ) - <<CI_TX_DESC_LEN_MACLEN_S ; -else - offset |= (m->l2_len >>1 ) - <<CI_TX_DESC_LEN_MACLEN_S ; +/* Context descriptor callback for ci_xmit_pkts */ +static uint16_t +iavf_get_context_desc (uint64_t ol_flags,const struct rte_mbuf *mbuf, + const union ci_tx_offload *tx_offload __rte_unused, +const struct ci_tx_queue *txq, + uint32_t *td_offset __rte_unused, uint64_t *qw0, uint64_t *qw1) +{ +uint8_t iavf_vlan_flag; +uint16_t cd_l2tag2 =0 ; +uint64_t cd_type_cmd =IAVF_TX_DESC_DTYPE_CONTEXT ; +uint64_t cd_tunneling_params =0 ; +uint16_t tlen =0 ; +struct iavf_ipsec_crypto_pkt_metadata *ipsec_md =NULL ; + +/* Use IAVF-specific vlan_flag from txq */ + iavf_vlan_flag = txq->vlan_flag; + +/* Check if context descriptor is needed using existing IAVF logic */ +if (!iavf_calc_context_desc (mbuf, iavf_vlan_flag)) +return 0 ; -/* 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 |=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 |=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 |=CI_TX_DESC_CMD_IIPT_IPV6 ; - offset |= (m->l3_len >>2 ) <<CI_TX_DESC_LEN_IPLEN_S ; +/* Get IPsec metadata if needed */ +if (ol_flags &RTE_MBUF_F_TX_SEC_OFFLOAD ) { + ipsec_md =RTE_MBUF_DYNFIELD (mbuf, txq->ipsec_crypto_pkt_md_offset, + struct iavf_ipsec_crypto_pkt_metadata *); } -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 |=CI_TX_DESC_CMD_L4T_EOFT_TCP ; -else - command |=CI_TX_DESC_CMD_L4T_EOFT_UDP ; - offset |= (m->l4_len >>2 ) << -CI_TX_DESC_LEN_L4_LEN_S ; +/* TSO command field */ +if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG |RTE_MBUF_F_TX_UDP_SEG )) { + cd_type_cmd |= (uint64_t )CI_TX_CTX_DESC_TSO <<IAVF_TXD_CTX_QW1_CMD_SHIFT ; - *qw1 =rte_cpu_to_le_64 ((((uint64_t )command << -IAVF_TXD_DATA_QW1_CMD_SHIFT ) &IAVF_TXD_DATA_QW1_CMD_MASK ) | - (((uint64_t )offset <<IAVF_TXD_DATA_QW1_OFFSET_SHIFT ) & -IAVF_TXD_DATA_QW1_OFFSET_MASK ) | - ((uint64_t )l2tag1 <<IAVF_TXD_DATA_QW1_L2TAG1_SHIFT )); +/* IPsec field for TSO */ +if (ol_flags &RTE_MBUF_F_TX_SEC_OFFLOAD && ipsec_md) { +uint64_t ipsec_field = (uint64_t )ipsec_md->ctx_desc_ipsec_params << +IAVF_TXD_CTX_QW1_IPSEC_PARAMS_CIPHERBLK_SHIFT ; + cd_type_cmd |= ipsec_field; + } -return ; +/* TSO segmentation field */ + tlen =iavf_fill_ctx_desc_segmentation_field (&cd_type_cmd, + mbuf, ipsec_md); + (void )tlen;/* Suppress unused variable warning */ } -/* Enable L4 checksum offloads */ -switch (m->ol_flags &RTE_MBUF_F_TX_L4_MASK ) { -case RTE_MBUF_F_TX_TCP_CKSUM : - command |=CI_TX_DESC_CMD_L4T_EOFT_TCP ; - offset |= (sizeof (struct rte_tcp_hdr ) >>2 ) << -CI_TX_DESC_LEN_L4_LEN_S ; -break ; -case RTE_MBUF_F_TX_SCTP_CKSUM : - command |=CI_TX_DESC_CMD_L4T_EOFT_SCTP ; - offset |= (sizeof (struct rte_sctp_hdr ) >>2 ) << -CI_TX_DESC_LEN_L4_LEN_S ; -break ; -case RTE_MBUF_F_TX_UDP_CKSUM : - command |=CI_TX_DESC_CMD_L4T_EOFT_UDP ; - offset |= (sizeof (struct rte_udp_hdr ) >>2 ) << -CI_TX_DESC_LEN_L4_LEN_S ; -break ; +/* VLAN field for L2TAG2 */ +if ((ol_flags &RTE_MBUF_F_TX_VLAN && + iavf_vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ) || + ol_flags &RTE_MBUF_F_TX_QINQ ) { + cd_type_cmd |= (uint64_t )CI_TX_CTX_DESC_IL2TAG2 <<IAVF_TXD_CTX_QW1_CMD_SHIFT ; } -skip_cksum: - *qw1 =rte_cpu_to_le_64 ((((uint64_t )command << -IAVF_TXD_DATA_QW1_CMD_SHIFT ) &IAVF_TXD_DATA_QW1_CMD_MASK ) | - (((uint64_t )offset <<IAVF_TXD_DATA_QW1_OFFSET_SHIFT ) & -IAVF_TXD_DATA_QW1_OFFSET_MASK ) | - ((uint64_t )l2tag1 <<IAVF_TXD_DATA_QW1_L2TAG1_SHIFT )); -} - -static inline void -iavf_fill_data_desc (volatile struct ci_tx_desc *desc, -uint64_t desc_template,uint16_t buffsz, -uint64_t buffer_addr) -{ -/* fill data descriptor qw1 from template */ - desc->cmd_type_offset_bsz = desc_template; - -/* set data buffer size */ - desc->cmd_type_offset_bsz |= - (((uint64_t )buffsz <<IAVF_TXD_DATA_QW1_TX_BUF_SZ_SHIFT ) & -IAVF_TXD_DATA_QW1_TX_BUF_SZ_MASK ); - - desc->buffer_addr =rte_cpu_to_le_64 (buffer_addr); - desc->cmd_type_offset_bsz =rte_cpu_to_le_64 (desc->cmd_type_offset_bsz); -} - +/* LLDP switching field */ +if (IAVF_CHECK_TX_LLDP (mbuf)) + cd_type_cmd |=IAVF_TX_CTX_DESC_SWTCH_UPLINK <<IAVF_TXD_CTX_QW1_CMD_SHIFT ; + +/* Tunneling field */ +if (ol_flags &RTE_MBUF_F_TX_TUNNEL_MASK ) +iavf_fill_ctx_desc_tunnelling_field ((uint64_t *)&cd_tunneling_params, mbuf); + +/* L2TAG2 field (VLAN) */ +if (ol_flags &RTE_MBUF_F_TX_QINQ ) { + cd_l2tag2 = iavf_vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ? + mbuf->vlan_tci_outer : mbuf->vlan_tci; + }else if (ol_flags &RTE_MBUF_F_TX_VLAN && + iavf_vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ) { + cd_l2tag2 = mbuf->vlan_tci; + } -static struct iavf_ipsec_crypto_pkt_metadata * -iavf_ipsec_crypto_get_pkt_metadata (const struct ci_tx_queue *txq, -struct rte_mbuf *m) -{ -if (m->ol_flags &RTE_MBUF_F_TX_SEC_OFFLOAD ) -return RTE_MBUF_DYNFIELD (m, txq->ipsec_crypto_pkt_md_offset, - struct iavf_ipsec_crypto_pkt_metadata *); +/* Set outputs */ + *qw0 =rte_cpu_to_le_64 (cd_tunneling_params | ((uint64_t )cd_l2tag2 <<32 )); + *qw1 =rte_cpu_to_le_64 (cd_type_cmd); -return NULL ; +return 1 ;/* One context descriptor needed */ }/* TX function */
@@ -2701,231 +2599,17 @@ 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->ci_tx_ring; -struct ci_tx_entry *txe_ring = txq->sw_ring; -struct ci_tx_entry *txe, *txn; -struct rte_mbuf *mb, *mb_seg; -uint64_t buf_dma_addr; -uint16_t desc_idx, desc_idx_last; -uint16_t idx; -uint16_t slen; - - -/* Check if the descriptor ring needs to be cleaned. */ -if (txq->nb_tx_free < txq->tx_free_thresh) -ci_tx_xmit_cleanup (txq); - - desc_idx = txq->tx_tail; - txe = &txe_ring[desc_idx]; - -for (idx =0 ; idx < nb_pkts; idx++) { -volatile struct ci_tx_desc *ddesc; -struct iavf_ipsec_crypto_pkt_metadata *ipsec_md; - -uint16_t nb_desc_ctx, nb_desc_ipsec; -uint16_t nb_desc_data, nb_desc_required; -uint16_t tlen =0 , ipseclen =0 ; -uint64_t ddesc_template =0 ; -uint64_t ddesc_cmd =0 ; - - mb = tx_pkts[idx]; -RTE_MBUF_PREFETCH_TO_FREE (txe->mbuf); - -/** -* Get metadata for ipsec crypto from mbuf dynamic fields if -* security offload is specified. -*/ - ipsec_md =iavf_ipsec_crypto_get_pkt_metadata (txq, mb); - - nb_desc_data = mb->nb_segs; - nb_desc_ctx = -iavf_calc_context_desc (mb, txq->vlan_flag); - nb_desc_ipsec = !!(mb->ol_flags &RTE_MBUF_F_TX_SEC_OFFLOAD ); - -/** -* The number of descriptors that must be allocated for -* a packet equals to the number of the segments of that -* packet plus the context and ipsec descriptors 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 (mb->ol_flags &RTE_MBUF_F_TX_TCP_SEG ) - 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; - - desc_idx_last = (uint16_t )(desc_idx + nb_desc_required -1 ); - -/* wrap descriptor ring */ -if (desc_idx_last >= txq->nb_tx_desc) - desc_idx_last = - (uint16_t )(desc_idx_last - txq->nb_tx_desc); - -PMD_TX_LOG (DEBUG , -"port_id=%u queue_id=%u tx_first=%u tx_last=%u" , - txq->port_id, txq->queue_id, desc_idx, desc_idx_last); - -if (nb_desc_required > txq->nb_tx_free) { -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 (ci_tx_xmit_cleanup (txq)) { -if (idx ==0 ) -return 0 ; - goto end_of_tx; - } - } - } - } - -iavf_build_data_desc_cmd_offset_fields (&ddesc_template, mb, - txq->vlan_flag); - -/* Setup TX context descriptor if required */ -if (nb_desc_ctx) { -volatile struct iavf_tx_context_desc *ctx_desc = - (volatile struct iavf_tx_context_desc *) - &txr[desc_idx]; - -/* clear QW0 or the previous writeback value -* may impact next write -*/ - *(volatile uint64_t *)ctx_desc =0 ; - - txn = &txe_ring[txe->next_id]; -RTE_MBUF_PREFETCH_TO_FREE (txn->mbuf); - -if (txe->mbuf) { -rte_pktmbuf_free_seg (txe->mbuf); - txe->mbuf =NULL ; - } - -iavf_fill_context_desc (ctx_desc, mb, ipsec_md, &tlen, - txq->vlan_flag); -IAVF_DUMP_TX_DESC (txq, ctx_desc, desc_idx); - - txe->last_id = desc_idx_last; - desc_idx = txe->next_id; - txe = txn; - } - -if (nb_desc_ipsec) { -volatile struct iavf_tx_ipsec_desc *ipsec_desc = - (volatile struct iavf_tx_ipsec_desc *) - &txr[desc_idx]; - - txn = &txe_ring[txe->next_id]; -RTE_MBUF_PREFETCH_TO_FREE (txn->mbuf); - -if (txe->mbuf) { -rte_pktmbuf_free_seg (txe->mbuf); - txe->mbuf =NULL ; - } - -iavf_fill_ipsec_desc (ipsec_desc, ipsec_md, &ipseclen); - -IAVF_DUMP_TX_DESC (txq, ipsec_desc, desc_idx); - - txe->last_id = desc_idx_last; - desc_idx = txe->next_id; - txe = txn; - } - - mb_seg = mb; - -do { - ddesc = (volatile struct ci_tx_desc *) - &txr[desc_idx]; - - txn = &txe_ring[txe->next_id]; -RTE_MBUF_PREFETCH_TO_FREE (txn->mbuf); - -if (txe->mbuf) -rte_pktmbuf_free_seg (txe->mbuf); - - txe->mbuf = mb_seg; - -if ((mb_seg->ol_flags &RTE_MBUF_F_TX_SEC_OFFLOAD ) && - (mb_seg->ol_flags & - (RTE_MBUF_F_TX_TCP_SEG | -RTE_MBUF_F_TX_UDP_SEG ))) { - slen = tlen + mb_seg->l2_len + mb_seg->l3_len + - mb_seg->outer_l3_len + ipseclen; -if (mb_seg->ol_flags &RTE_MBUF_F_TX_L4_MASK ) - slen += mb_seg->l4_len; - }else { - slen = mb_seg->data_len; - } - - buf_dma_addr =rte_mbuf_data_iova (mb_seg); -while ((mb_seg->ol_flags & (RTE_MBUF_F_TX_TCP_SEG | -RTE_MBUF_F_TX_UDP_SEG )) && -unlikely (slen >CI_MAX_DATA_PER_TXD )) { -iavf_fill_data_desc (ddesc, ddesc_template, -CI_MAX_DATA_PER_TXD , buf_dma_addr); - -IAVF_DUMP_TX_DESC (txq, ddesc, desc_idx); - - 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; - txe = txn; - ddesc = &txr[desc_idx]; - txn = &txe_ring[txe->next_id]; - } - -iavf_fill_data_desc (ddesc, ddesc_template, - slen, buf_dma_addr); - -IAVF_DUMP_TX_DESC (txq, ddesc, desc_idx); - - txe->last_id = desc_idx_last; - desc_idx = txe->next_id; - txe = txn; - mb_seg = mb_seg->next; - }while (mb_seg); - -/* The last packet data descriptor needs End Of Packet (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); - -if (txq->nb_tx_used >= txq->tx_rs_thresh) { -PMD_TX_LOG (DEBUG ,"Setting RS bit on TXD id=" -"%4u (port=%d queue=%d)" , - desc_idx_last, txq->port_id, txq->queue_id); - - ddesc_cmd |=CI_TX_DESC_CMD_RS ; - -/* Update txq RS bit counters */ - txq->nb_tx_used =0 ; - } - - ddesc->cmd_type_offset_bsz |=rte_cpu_to_le_64 (ddesc_cmd << -IAVF_TXD_DATA_QW1_CMD_SHIFT ); - -IAVF_DUMP_TX_DESC (txq, ddesc, desc_idx -1 ); - } - -end_of_tx: -rte_wmb (); - -PMD_TX_LOG (DEBUG ,"port_id=%u queue_id=%u tx_tail=%u nb_tx=%u" , - txq->port_id, txq->queue_id, desc_idx, idx); - -IAVF_PCI_REG_WRITE_RELAXED (txq->qtx_tail, desc_idx); - txq->tx_tail = desc_idx; +const struct ci_ipsec_ops ipsec_ops = { + .get_ipsec_desc = iavf_get_ipsec_desc, + .calc_segment_len = iavf_calc_ipsec_segment_len, + }; -return idx; +/* IAVF does not support timestamp queues, so pass NULL for ts_fns */ +return ci_xmit_pkts (txq, tx_pkts, nb_pkts, + (txq->vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ) ? +CI_VLAN_IN_L2TAG1 :CI_VLAN_IN_L2TAG2 , + iavf_get_context_desc, &ipsec_ops,NULL ); }/* Check if the packet with vlan user priority is transmitted in the
Signature · 1 line
2.51.0
RFC PATCH 17/27 net/i40e: document requirement for QinQ support
In reply to Bruce RichardsonIn order to get multiple VLANs inserted in an outgoing packet with QinQ offload the i40e driver needs to be set to double vlan mode. This is done by using the VLAN_EXTEND Rx config flag. Add a code check for this dependency and update the docs about it.
--- doc/guides/nics/i40e.rst | 18 ++++++++++++++++++ drivers/net/intel/i40e/i40e_rxtx.c | 9 +++++++++ 2 files changed, 27 insertions(+)
doc/guides/nics/i40e.rst +18 -0
@@ -245,6 +245,24 @@ Runtime Configuration * ``segment``: Check number of mbuf segments not exceed hw limitation. * ``offload``: Check any unsupported offload flag. +QinQ Configuration +~~~~~~~~~~~~~~~~~~ + +When using QinQ TX offload (``RTE_ETH_TX_OFFLOAD_QINQ_INSERT``), you must also +enable ``RTE_ETH_RX_OFFLOAD_VLAN_EXTEND`` to configure the hardware for double +VLAN mode. Without this, only the inner VLAN tag will be inserted. + +Example:: + + struct rte_eth_conf port_conf = { + .rxmode = { + .offloads = RTE_ETH_RX_OFFLOAD_VLAN_EXTEND, + }, + .txmode = { + .offloads = RTE_ETH_TX_OFFLOAD_QINQ_INSERT, + }, + }; + Vector RX Pre-conditions ~~~~~~~~~~~~~~~~~~~~~~~~ For Vector RX it is assumed that the number of descriptor rings will be a power
drivers/net/intel/i40e/i40e_rxtx.c +9 -0
@@ -2171,6 +2171,15 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev, vsi =i40e_pf_get_vsi_by_qindex (pf, queue_idx);if (!vsi)return -EINVAL ; + +/* Check if QinQ TX offload requires VLAN extend mode */ +if ((offloads &RTE_ETH_TX_OFFLOAD_QINQ_INSERT ) && + !(dev->data->dev_conf.rxmode.offloads &RTE_ETH_RX_OFFLOAD_VLAN_EXTEND )) { +PMD_DRV_LOG (WARNING ,"Port %u: QinQ TX offload is enabled but VLAN extend mode is not set. " , + dev->data->port_id); +PMD_DRV_LOG (WARNING ,"Double VLAN insertion may not work correctly without RTE_ETH_RX_OFFLOAD_VLAN_EXTEND set in Rx configuration." ); + } + q_offset =i40e_get_queue_offset_by_qindex (pf, queue_idx);if (q_offset <0 )return -EINVAL ;
Signature · 1 line
2.51.0
RFC PATCH 18/27 net/idpf: use common scalar Tx function
In reply to Bruce RichardsonUpdate idpf driver to use the common scalar Tx function in single-queue configuration.
--- drivers/net/intel/idpf/idpf_common_rxtx.c | 179 ++-------------------- 1 file changed, 11 insertions(+), 168 deletions(-)
drivers/net/intel/idpf/idpf_common_rxtx.c +11 -168
@@ -8,7 +8,6 @@#include "idpf_common_rxtx.h" #include "idpf_common_device.h" -#include "../common/rx.h" int idpf_timestamp_dynfield_offset =-1 ;uint64_t idpf_timestamp_dynflag;
@@ -848,9 +847,11 @@ idpf_calc_context_desc(uint64_t flags)/* set TSO context descriptor, returns 0 if no context needed, 1 if context set */ static inline uint16_t -idpf_set_tso_ctx (uint64_t ol_flags,struct rte_mbuf *mbuf, -union ci_tx_offload tx_offload, -uint64_t *qw0,uint64_t *qw1) +idpf_set_tso_ctx (uint64_t ol_flags,const struct rte_mbuf *mbuf, +const union ci_tx_offload *tx_offload, + const struct ci_tx_queue *txq __rte_unused, + uint32_t *td_offset __rte_unused, +uint64_t *qw0,uint64_t *qw1) {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;
@@ -861,12 +862,12 @@ idpf_set_tso_ctx(uint64_t ol_flags, struct rte_mbuf *mbuf,return 0 ;/* TSO context descriptor setup */ -if (tx_offload.l4_len ==0 ) { +if (tx_offload->l4_len ==0 ) {TX_LOG (DEBUG ,"L4 length set to 0" );return 0 ; } - hdr_len = tx_offload.l2_len + tx_offload.l3_len + tx_offload.l4_len; + hdr_len = tx_offload->l2_len + tx_offload->l3_len + tx_offload->l4_len; tso_len = mbuf->pkt_len - hdr_len; *qw0 = rte_cpu_to_le_32(tso_len & IDPF_TXD_FLEX_CTX_MSS_RT_M) |
@@ -933,7 +934,8 @@ 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. */ uint64_t cd_qw0, cd_qw1; - nb_ctx =idpf_set_tso_ctx (ol_flags, tx_pkt, tx_offload, &cd_qw0, &cd_qw1); + nb_ctx =idpf_set_tso_ctx (ol_flags, tx_pkt, &tx_offload, txq, +NULL /* unused */ , &cd_qw0, &cd_qw1);/* Calculate the number of TX descriptors needed for * each packet. For TSO packets, use ci_calc_pkt_desc as
@@ -1339,167 +1341,8 @@ uint16_t idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { -volatile struct ci_tx_desc *txd; -volatile struct ci_tx_desc *txr; -union ci_tx_offload tx_offload = {0 }; -struct ci_tx_entry *txe, *txn; -struct ci_tx_entry *sw_ring; -struct ci_tx_queue *txq; -struct rte_mbuf *tx_pkt; -struct rte_mbuf *m_seg; -uint64_t buf_dma_addr; -uint32_t td_offset; -uint64_t ol_flags; -uint16_t tx_last; -uint16_t nb_used; -uint16_t nb_ctx; -uint16_t td_cmd; -uint16_t tx_id; -uint16_t nb_tx; -uint16_t slen; - - nb_tx =0 ; - txq = tx_queue; - -if (unlikely (txq ==NULL )) -return nb_tx; - - sw_ring = txq->sw_ring; - txr = txq->ci_tx_ring; - tx_id = txq->tx_tail; - txe = &sw_ring[tx_id]; - -/* 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++) { - td_cmd =0 ; - td_offset =0 ; - - tx_pkt = *tx_pkts++; -RTE_MBUF_PREFETCH_TO_FREE (txe->mbuf); - - ol_flags = tx_pkt->ol_flags; - tx_offload.l2_len = tx_pkt->l2_len; - tx_offload.l3_len = tx_pkt->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. */ -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 -* 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 = (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); - -TX_LOG (DEBUG ,"port_id=%u queue_id=%u" -" tx_first=%u tx_last=%u" , - txq->port_id, txq->queue_id, tx_id, tx_last); - -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; - } - } - } - } - -if (ol_flags &CI_TX_CKSUM_OFFLOAD_MASK ) - td_cmd |=IDPF_TX_FLEX_DESC_CMD_CS_EN ; - -if (nb_ctx !=0 ) { -/* Setup TX context descriptor if required */ - 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); -if (txe->mbuf !=NULL ) { -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 = &txr[tx_id]; - txn = &sw_ring[txe->next_id]; - -if (txe->mbuf !=NULL ) -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); - 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 )); - - txe->last_id = tx_last; - tx_id = txe->next_id; - txe = txn; - m_seg = m_seg->next; - }while (m_seg); - -/* The last packet data descriptor needs End Of Packet (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); - -if (txq->nb_tx_used >= txq->tx_rs_thresh) { -TX_LOG (DEBUG ,"Setting RS bit on TXD id=" -"%4u (port=%d queue=%d)" , - tx_last, txq->port_id, txq->queue_id); - - 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 <<CI_TXD_QW1_CMD_S ); - } - -end_of_tx: -rte_wmb (); - -TX_LOG (DEBUG ,"port_id=%u queue_id=%u tx_tail=%u nb_tx=%u" , - txq->port_id, txq->queue_id, tx_id, nb_tx); - -IDPF_PCI_REG_WRITE (txq->qtx_tail, tx_id); - txq->tx_tail = tx_id; - -return nb_tx; +return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_VLAN_IN_L2TAG1 , + idpf_set_tso_ctx,NULL ,NULL ); }/* TX prep functions */
Signature · 1 line
2.51.0
RFC PATCH 19/27 net/intel: avoid writing the final pkt descriptor twice
In reply to Bruce RichardsonIn the scalar datapath, there is a loop to handle multi-segment, and multi-descriptor packets on Tx. After that loop, the end-of-packet bit was written to the descriptor separately, meaning that for each single-descriptor packet there were two writes to the second quad-word - basically 3 x 64-bit writes rather than just 2. Adjusting the code to compute the EOP bit inside the loop saves that extra write per packet and so improves performance.
--- drivers/net/intel/common/tx_scalar_fns.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +6 -6
@@ -378,6 +378,10 @@ ci_xmit_pkts(struct ci_tx_queue *txq, txn = &sw_ring[txe->next_id]; } +/* fill the last descriptor with End of Packet (EOP) bit */ +if (m_seg->next ==NULL ) + td_cmd |=CI_TX_DESC_CMD_EOP ; + 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) |
@@ -390,21 +394,17 @@ ci_xmit_pkts(struct ci_tx_queue *txq, 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 ; + txd->cmd_type_offset_bsz |= +rte_cpu_to_le_64 (CI_TX_DESC_CMD_RS <<CI_TXD_QW1_CMD_S );/* 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);
Signature · 1 line
2.51.0
RFC PATCH 20/27 net/intel: write descriptors using non-volatile pointers
In reply to Bruce RichardsonUse a non-volatile uint64_t pointer to store to the descriptor ring. This will allow the compiler to optionally merge the stores as it sees best.
--- drivers/net/intel/common/tx_scalar_fns.h | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +16 -8
@@ -184,6 +184,15 @@ 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_CAST_PTR(void *, txd); + + 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,
@@ -313,8 +322,7 @@ ci_xmit_pkts(struct ci_tx_queue *txq, txe->mbuf =NULL ; } - ctx_txd[0 ] = cd_qw0; - ctx_txd[1 ] = cd_qw1; +write_txd (ctx_txd, cd_qw0, cd_qw1); txe->last_id = tx_last; tx_id = txe->next_id;
@@ -361,12 +369,12 @@ ci_xmit_pkts(struct ci_tx_queue *txq,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 | +const uint64_t cmd_type_offset_bsz =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 )); + ((uint64_t )td_tag <<CI_TXD_QW1_L2TAG1_S ); +write_txd (txd, buf_dma_addr, cmd_type_offset_bsz); buf_dma_addr +=CI_MAX_DATA_PER_TXD ; slen -=CI_MAX_DATA_PER_TXD ;
@@ -382,12 +390,12 @@ ci_xmit_pkts(struct ci_tx_queue *txq,if (m_seg->next ==NULL ) td_cmd |=CI_TX_DESC_CMD_EOP ; - 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 | +const uint64_t cmd_type_offset_bsz =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 )); + ((uint64_t )td_tag <<CI_TXD_QW1_L2TAG1_S ); +write_txd (txd, buf_dma_addr, cmd_type_offset_bsz); txe->last_id = tx_last; tx_id = txe->next_id;
Signature · 1 line
2.51.0
RE: [RFC PATCH 20/27] net/intel: write descriptors using non-volatile pointers
Quoted 6 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Friday, 19 December 2025 18.26Use a non-volatile
uint64_tpointer to store to the descriptor ring. This will allow the compiler to optionally merge the stores as it sees best.
I suppose there was a reason for the volatile.
Is removing it really safe?
E.g. this will also allow the compiler to reorder stores; not just the pair of 64-bits, but also stores to multiple descriptors.
One more comment inline below.
Quoted 12 lines
Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/intel/common/tx_scalar_fns.h | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)drivers/net/intel/common/tx_scalar_fns.h +0
-0
drivers/net/intel/common/tx_scalar_fns.h struct ci_timesstamp_queue_fns { · line 190
Quoted 7 lines
drivers/net/intel/common/tx_scalar_fns.h +4
-0@@ -184,6 +184,15 @@ 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_CAST_PTR(void *, txd);
If the descriptors are 16-byte aligned, you could mark them as such, so the compiler can use 128-bit stores on architectures where alignment matters.
Quoted 63 lines
drivers/net/intel/common/tx_scalar_fns.h +6
-2+ + 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,@@ -313,8 +322,7 @@ ci_xmit_pkts(struct ci_tx_queue *txq, txe->mbuf =NULL ; } - ctx_txd[0 ] = cd_qw0; - ctx_txd[1 ] = cd_qw1; +write_txd (ctx_txd, cd_qw0, cd_qw1); txe->last_id = tx_last; tx_id = txe->next_id;@@ -361,12 +369,12 @@ ci_xmit_pkts(struct ci_tx_queue *txq, while ((ol_flags & (RTE_MBUF_F_TX_TCP_SEG |
RTE_MBUF_F_TX_UDP_SEG)) &&drivers/net/intel/common/tx_scalar_fns.h +0
-1unlikely(slen > CI_MAX_DATA_PER_TXD)) { - txd->buffer_addr =
rte_cpu_to_le_64(buf_dma_addr);drivers/net/intel/common/tx_scalar_fns.h +0
-1- txd->cmd_type_offset_bsz =rte_cpu_to_le_64(CI_TX_DESC_DTYPE_DATA |
drivers/net/intel/common/tx_scalar_fns.h +1
-0+ const uint64_t cmd_type_offset_bsz =
CI_TX_DESC_DTYPE_DATA|drivers/net/intel/common/tx_scalar_fns.h +0
-0((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) |drivers/net/intel/common/tx_scalar_fns.h +0
-1- ((uint64_t)td_tag <<
CI_TXD_QW1_L2TAG1_S));drivers/net/intel/common/tx_scalar_fns.h +1
-0+ ((uint64_t)td_tag <<
CI_TXD_QW1_L2TAG1_S);drivers/net/intel/common/tx_scalar_fns.h +1
-0+ write_txd(txd, buf_dma_addr,
cmd_type_offset_bsz);drivers/net/intel/common/tx_scalar_fns.h +0
-2buf_dma_addr +=CI_MAX_DATA_PER_TXD ; slen -=CI_MAX_DATA_PER_TXD ;@@ -382,12 +390,12 @@ ci_xmit_pkts(struct ci_tx_queue *txq,if (m_seg->next ==NULL ) td_cmd |=CI_TX_DESC_CMD_EOP ; - 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 |
drivers/net/intel/common/tx_scalar_fns.h +1
-0+ const uint64_t cmd_type_offset_bsz =
CI_TX_DESC_DTYPE_DATA|drivers/net/intel/common/tx_scalar_fns.h +2
-2((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)); + ((uint64_t )td_tag <<CI_TXD_QW1_L2TAG1_S ); +write_txd (txd, buf_dma_addr, cmd_type_offset_bsz); txe->last_id = tx_last; tx_id = txe->next_id; --2.51.0
Re: [RFC PATCH 20/27] net/intel: write descriptors using non-volatile pointers
Quoted 11 lines · Morten Brørup
Quoted 6 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Friday, 19 December 2025 18.26Use a non-volatile
uint64_tpointer to store to the descriptor ring. This will allow the compiler to optionally merge the stores as it sees best.I suppose there was a reason for the volatile.
Is removing it really safe?
E.g. this will also allow the compiler to reorder stores; not just the pair of 64-bits, but also stores to multiple descriptors.
It would be more risky to remove for reads than for writes, I believe, since when reading we have the possibility of the NIC doing stores to the descriptors at the same time. In the case of writing new descriptors we know that the NIC will never read the descriptors until such time as we hit the doorball/write the tail value. Therefore, so long as we have a fence before the tail write, (or as part of the tail write), it doesn't matter what actual order the descriptor stores hit the ring.
Quoted 17 lines
One more comment inline below.
Quoted 15 lines
Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/intel/common/tx_scalar_fns.h | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)drivers/net/intel/common/tx_scalar_fns.h +0
-0@@ -184,6 +184,15 @@ struct ci_timesstamp_queue_fns {write_ts_tail_t write_ts_tail; };
Quoted 7 lines
drivers/net/intel/common/tx_scalar_fns.h struct ci_timesstamp_queue_fns { · line 190
Quoted 4 lines
drivers/net/intel/common/tx_scalar_fns.h +4
-0+static inline void +write_txd (volatile void *txd,uint64_t qw0,uint64_t qw1) +{ + uint64_t *txd_qw = RTE_CAST_PTR(void *, txd);If the descriptors are 16-byte aligned, you could mark them as such, so the compiler can use 128-bit stores on architectures where alignment matters.
Sure, I can try adding an aligned tag to this.
/Bruce
RFC PATCH 21/27 net/intel: remove unnecessary flag clearing
In reply to Bruce RichardsonWhen cleaning the Tx ring, there is no need to zero out the done flag from the completed entry. That flag will be automatically cleared when the descriptor is next written. This gives a small performance benefit.
--- drivers/net/intel/common/tx_scalar_fns.h | 7 ------- 1 file changed, 7 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +0 -7
@@ -51,13 +51,6 @@ ci_tx_xmit_cleanup(struct ci_tx_queue *txq)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);
Signature · 1 line
2.51.0
RFC PATCH 22/27 net/intel: mark mid-burst ring cleanup as unlikely
In reply to Bruce RichardsonIt should rarely be the case that we need to cleanup the descriptor ring mid-burst, so mark as unlikely to help performance.
--- drivers/net/intel/common/tx_scalar_fns.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/intel/common/tx_scalar_fns.h +1 -1
@@ -272,7 +272,7 @@ ci_xmit_pkts(struct ci_tx_queue *txq,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 (unlikely (nb_used > txq->nb_tx_free)) {if (ci_tx_xmit_cleanup (txq) !=0 ) {if (nb_tx ==0 )return 0 ;
Signature · 1 line
2.51.0
RFC PATCH 23/27 net/intel: add special handling for single desc packets
In reply to Bruce RichardsonWithin the scalar packets, add a shortcut path for packets that don't use TSO and have only a single data descriptor.
--- drivers/net/intel/common/tx_scalar_fns.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/net/intel/common/tx_scalar_fns.h +23 -0
@@ -304,6 +304,28 @@ ci_xmit_pkts(struct ci_tx_queue *txq,ci_txd_enable_checksum (ol_flags, &td_cmd, &td_offset, tx_offload); +/* special case for single descriptor packet, without TSO offload */ +if (nb_used ==1 && (ol_flags & (RTE_MBUF_F_TX_TCP_SEG |RTE_MBUF_F_TX_UDP_SEG )) ==0 ) { + txd = &ci_tx_ring[tx_id]; + tx_id = txe->next_id; + +if (txe->mbuf) +rte_pktmbuf_free_seg (txe->mbuf); + *txe = (struct ci_tx_entry ){ .mbuf = tx_pkt, .last_id = tx_last, .next_id = tx_id }; + +/* Setup TX Descriptor */ + td_cmd |=CI_TX_DESC_CMD_EOP ; +const uint64_t cmd_type_offset_bsz =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 )tx_pkt->data_len <<CI_TXD_QW1_TX_BUF_SZ_S ) | + ((uint64_t )td_tag <<CI_TXD_QW1_L2TAG1_S ); +write_txd (txd,rte_mbuf_data_iova (tx_pkt), cmd_type_offset_bsz); + + txe = &sw_ring[tx_id]; + goto end_pkt; + } +if (nb_ctx) {/* Setup TX context descriptor if required */ uint64_t *ctx_txd = RTE_CAST_PTR(uint64_t *, &ci_tx_ring[tx_id]);
@@ -395,6 +417,7 @@ ci_xmit_pkts(struct ci_tx_queue *txq, txe = txn; 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);
Signature · 1 line
2.51.0
RFC PATCH 24/27 net/intel: use separate array for desc status tracking
In reply to Bruce RichardsonRather 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 | 59 +++++++++++------------ 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, 110 insertions(+), 32 deletions(-)
drivers/net/intel/common/tx.h +4 -0
@@ -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 +27 -32
125 lines not on this page · raw message
drivers/net/intel/i40e/i40e_rxtx.c +20 -0
@@ -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"
@@ -2269,6 +2270,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. "
@@ -2310,6 +2318,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;
@@ -2333,6 +2342,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;
@@ -2378,6 +2397,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
@@ -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>
@@ -204,6 +205,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 ; }
@@ -804,6 +810,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;
@@ -827,6 +834,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 );
@@ -1051,6 +1069,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
@@ -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"
@@ -1576,6 +1577,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. "
@@ -1618,6 +1626,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;
@@ -1642,6 +1651,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);
@@ -1714,6 +1733,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
@@ -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
@@ -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
RFC PATCH 25/27 net/ixgbe: use separate array for desc status tracking
In reply to Bruce RichardsonDue 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
@@ -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
RFC PATCH 26/27 net/intel: drop unused Tx queue used count
In reply to Bruce RichardsonSince 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
@@ -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
@@ -404,7 +404,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
@@ -2632,7 +2632,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
@@ -298,7 +298,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
@@ -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
@@ -1127,7 +1127,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
@@ -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
@@ -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
@@ -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
RFC PATCH 27/27 net/intel: remove index for tracking end of packet
In reply to Bruce RichardsonThe 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
@@ -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
@@ -2523,14 +2523,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;
@@ -2623,7 +2622,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
@@ -292,7 +292,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; }
@@ -4002,14 +4001,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
@@ -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
@@ -1118,7 +1118,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; }
@@ -3190,14 +3189,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
@@ -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
@@ -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
RE: [RFC PATCH 27/27] net/intel: remove index for tracking end of packet
Quoted 10 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Friday, 19 December 2025 18.26The
last_idvalue in eachtx_sw_queueentry 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.Signed-off-by Bruce Richardson <[email protected]>---
[...]
Quoted 5 lines
drivers/net/intel/i40e/i40e_rxtx.c +0
-0@@ -2523,14 +2523,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 ) {
drivers/net/intel/i40e/i40e_rxtx.c i40e_tx_done_cleanup_full(struct ci_tx_queue · line 2532
Quoted 10 lines
drivers/net/intel/i40e/i40e_rxtx.c +1
-4-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 ;
Note to reviewers:
Dereferencing the mbuf (instead of checking last_id) does not add a potential cache miss, because rte_pktmbuf_free_seg() dereferences it anyway.
Quoted 5 lines
drivers/net/intel/i40e/i40e_rxtx.c +2
-0+rte_pktmbuf_free_seg (swr_ring[tx_id].mbuf); + swr_ring[tx_id].mbuf =NULL ; }
tx_id= swr_ring[tx_id].next_id;
v2 cover combine multiple Intel scalar Tx paths
In reply to Bruce RichardsonThe 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
--
2.51.0
PATCH v2 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
@@ -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
@@ -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
@@ -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
@@ -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;
@@ -1393,7 +1393,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;
@@ -1409,7 +1409,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;
@@ -1426,7 +1426,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 ;
@@ -1454,7 +1454,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 ;/**
@@ -2601,7 +2601,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);
@@ -2623,7 +2623,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 =
@@ -2896,13 +2896,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 );
@@ -3204,7 +3204,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",
@@ -3223,7 +3223,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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -281,7 +281,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 ;
@@ -832,7 +832,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,
@@ -844,7 +844,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);
@@ -2338,7 +2338,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)
@@ -2728,7 +2728,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) {
@@ -2761,7 +2761,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;
@@ -2779,7 +2779,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;
@@ -2900,7 +2900,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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 );
@@ -1613,7 +1613,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,
@@ -2607,7 +2607,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",
@@ -2626,7 +2626,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.
@@ -3015,7 +3015,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;
@@ -3136,8 +3136,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;
@@ -3300,7 +3300,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) |
@@ -3319,7 +3319,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) |
@@ -3546,14 +3546,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 );
@@ -3562,12 +3562,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 );
@@ -3577,7 +3577,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 ;
@@ -3610,7 +3610,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 ;/**
@@ -4865,7 +4865,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;
@@ -4875,7 +4875,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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v2 2/36 net/intel: use common Tx ring structure
In reply to Bruce RichardsonRather 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
@@ -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
@@ -594,7 +594,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
@@ -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
@@ -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 ;
@@ -1426,7 +1426,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 ;
@@ -1454,7 +1454,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 ;/**
@@ -2406,7 +2406,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 );
@@ -2603,7 +2603,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);
@@ -2623,7 +2623,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 =
@@ -2898,11 +2898,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 );
@@ -3223,7 +3223,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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -283,11 +283,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;
@@ -834,7 +834,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) {
@@ -844,7 +844,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);
@@ -2338,7 +2338,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)
@@ -2761,7 +2761,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;
@@ -4467,7 +4467,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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 );
@@ -1615,7 +1615,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) {
@@ -1637,7 +1637,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 =
@@ -2543,7 +2543,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 );
@@ -2626,7 +2626,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.
@@ -3015,7 +3015,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;
@@ -3136,7 +3136,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;
@@ -3159,7 +3159,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];
@@ -3245,7 +3245,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 ;
@@ -3287,7 +3287,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)
@@ -3315,7 +3315,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]; }
@@ -3398,7 +3398,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 ;
@@ -3577,7 +3577,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 ;
@@ -3610,7 +3610,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 ;/**
@@ -4870,11 +4870,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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -573,7 +573,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pktsreturn 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
@@ -1090,7 +1090,7 @@ idpf_singleq_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkreturn 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
@@ -469,7 +469,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
@@ -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
PATCH v2 3/36 net/intel: create common post-Tx cleanup function
In reply to Bruce RichardsonThe 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
@@ -249,6 +249,59 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq, ci_desc_done_fn desc_done, bool ctxreturn 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
PATCH v2 4/36 net/intel: consolidate definitions for Tx desc fields
In reply to Bruce RichardsonThe 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
@@ -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 */
@@ -276,8 +336,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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v2 5/36 net/intel: create separate header for Tx scalar fns
In reply to Bruce RichardsonRather 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
@@ -309,59 +309,6 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq, ci_desc_done_fn desc_done, bool ctxreturn 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) {
@@ -480,4 +427,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
PATCH v2 6/36 net/intel: add common fn to calculate needed descriptors
In reply to Bruce RichardsonMultiple 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
@@ -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
@@ -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
@@ -2671,21 +2671,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,
@@ -2771,7 +2756,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
@@ -3063,21 +3063,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) {
@@ -3140,8 +3125,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
@@ -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
PATCH v2 7/36 net/ice: refactor context descriptor handling
In reply to Bruce RichardsonCreate 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 | 96 ++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 41 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +55 -41
@@ -3040,7 +3040,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;
@@ -3051,7 +3051,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 ;
@@ -3063,6 +3063,51 @@ 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, +uint32_t *td_offset,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 ) { + *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); + } + +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) {
@@ -3073,7 +3118,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;
@@ -3102,20 +3146,24 @@ 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++; td_cmd =0 ; td_tag =0 ; td_offset =0 ; ol_flags = tx_pkt->ol_flags; + 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, &td_offset, &cd_qw0, &cd_qw1);/* The number of descriptors that must be allocated for * a packet equals to the number of the segments of that
@@ -3157,15 +3205,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,
@@ -3173,11 +3212,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);
@@ -3186,29 +3221,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
PATCH v2 8/36 net/i40e: refactor context descriptor handling
In reply to Bruce Richardsonmove 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 | 110 ++++++++++++++++------------- 1 file changed, 59 insertions(+), 51 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +59 -51
@@ -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 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 +1015,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 +1029,54 @@ 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, +uint32_t *td_offset,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 ) { + *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); + } + +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 +1087,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;
@@ -1080,7 +1127,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, &td_offset, + &cd_qw0, &cd_qw1);/** * The number of descriptors that must be allocated for
@@ -1126,14 +1175,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 +1182,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 +1191,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
PATCH v2 9/36 net/idpf: refactor context descriptor handling
In reply to Bruce Richardsonmove 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
@@ -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
PATCH v2 10/36 net/intel: consolidate checksum mask definition
In reply to Bruce RichardsonCreate a common definition for checksum masks across iavf, idpf, i40e and ice drivers.
--- drivers/net/intel/common/tx.h | 7 +++++++ 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, 13 insertions(+), 30 deletions(-)
drivers/net/intel/common/tx.h +7 -0
@@ -53,6 +53,13 @@/* 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_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
@@ -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 | \
@@ -1176,7 +1171,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
@@ -2601,7 +2601,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
@@ -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
@@ -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. */
@@ -3206,7 +3200,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
@@ -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
@@ -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
PATCH v2 11/36 net/intel: create common checksum Tx offload function
In reply to Bruce RichardsonSince 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 | 63 +++++++++++++++++++++++ drivers/net/intel/i40e/i40e_rxtx.c | 57 +-------------------- drivers/net/intel/ice/ice_rxtx.c | 64 +----------------------- 3 files changed, 65 insertions(+), 119 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +63 -0
@@ -64,6 +64,69 @@ 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) +{ +/* 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 ; + *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 -56
69 lines not on this page · raw message
drivers/net/intel/ice/ice_rxtx.c +1 -63
76 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH v2 12/36 net/intel: create a common scalar Tx function
In reply to Bruce RichardsonGiven 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 | 215 ++++++++++++++++++ drivers/net/intel/ice/ice_rxtx.c | 268 +++++------------------ 2 files changed, 267 insertions(+), 216 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +215 -0
@@ -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. */
@@ -147,5 +148,219 @@ 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, +uint32_t *td_offset,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; +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++; + + td_cmd =CI_TX_DESC_CMD_ICRC ; + td_tag =0 ; + td_offset =0 ; + ol_flags = tx_pkt->ol_flags; + + 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, &td_offset, &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 -216
280 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH v2 13/36 net/i40e: use common scalar Tx function
In reply to Bruce RichardsonFollowing earlier rework, the scalar transmit function for i40e can use the common function previously moved over from ice driver. This saves hundreds of duplicated lines of code.
--- drivers/net/intel/i40e/i40e_rxtx.c | 206 +---------------------------- 1 file changed, 2 insertions(+), 204 deletions(-)
drivers/net/intel/i40e/i40e_rxtx.c +2 -204
@@ -1020,210 +1020,8 @@ get_context_desc(uint64_t ol_flags, const struct rte_mbuf *tx_pkt,uint16_t 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 ci_tx_desc *txd; -volatile struct ci_tx_desc *txr; -struct rte_mbuf *tx_pkt; -struct rte_mbuf *m_seg; -uint16_t tx_id; -uint16_t nb_tx; -uint32_t td_cmd; -uint32_t td_offset; -uint32_t td_tag; -uint64_t ol_flags; -uint16_t nb_used; -uint16_t nb_ctx; -uint16_t tx_last; -uint16_t slen; -uint64_t buf_dma_addr; -union ci_tx_offload tx_offload = {0 }; - - txq = tx_queue; - sw_ring = txq->sw_ring; - txr = txq->ci_tx_ring; - tx_id = txq->tx_tail; - txe = &sw_ring[tx_id]; - -/* 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++) { - 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; - 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. */ -uint64_t cd_qw0 =0 , cd_qw1 =0 ; - nb_ctx =get_context_desc (ol_flags, tx_pkt, &tx_offload, txq, &td_offset, - &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 1 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 ) - 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; - } - -/* Always enable CRC offload insertion */ - td_cmd |=CI_TX_DESC_CMD_ICRC ; - -/* 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 *desc = RTE_CAST_PTR(uint64_t *, &txr[tx_id]); - - txn = &sw_ring[txe->next_id]; -RTE_MBUF_PREFETCH_TO_FREE (txn->mbuf); -if (txe->mbuf !=NULL ) { -rte_pktmbuf_free_seg (txe->mbuf); - txe->mbuf =NULL ; - } - - desc[0 ] = cd_qw0; - desc[1 ] = cd_qw1; - -PMD_TX_LOG (DEBUG ,"mbuf: %p, TCD[%u]: " -"qw0: %#" PRIx64"; " -"qw1: %#" PRIx64";" , - tx_pkt, tx_id, cd_qw0, cd_qw1); - - txe->last_id = tx_last; - tx_id = txe->next_id; - txe = txn; - } - - m_seg = tx_pkt; -do { - txd = &txr[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 ) && -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,CI_MAX_DATA_PER_TXD , - td_tag); - - 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 = &txr[tx_id]; - txn = &sw_ring[txe->next_id]; - } -PMD_TX_LOG (DEBUG ,"mbuf: %p, TDD[%u]: " -"buf_dma_addr: %#" PRIx64"; " -"td_cmd: %#x; " -"td_offset: %#x; " -"td_len: %u; " -"td_tag: %#x;" , - tx_pkt, tx_id, buf_dma_addr, - td_cmd, td_offset, slen, td_tag); - - txd->buffer_addr =rte_cpu_to_le_64 (buf_dma_addr); - txd->cmd_type_offset_bsz =i40e_build_ctob (td_cmd, - td_offset, slen, td_tag); - txe->last_id = tx_last; - tx_id = txe->next_id; - txe = txn; - m_seg = m_seg->next; - }while (m_seg !=NULL ); - -/* The last packet data descriptor needs End Of Packet (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); - -if (txq->nb_tx_used >= txq->tx_rs_thresh) { -PMD_TX_LOG (DEBUG , -"Setting RS bit on TXD id=" -"%4u (port=%d queue=%d)" , - tx_last, txq->port_id, txq->queue_id); - - 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 ); - } - -end_of_tx: -PMD_TX_LOG (DEBUG ,"port_id=%u queue_id=%u tx_tail=%u nb_tx=%u" , - (unsigned ) txq->port_id, (unsigned ) txq->queue_id, - (unsigned ) tx_id, (unsigned ) nb_tx); - -rte_io_wmb (); -I40E_PCI_REG_WC_WRITE_RELAXED (txq->qtx_tail, tx_id); - txq->tx_tail = tx_id; - -return nb_tx; +/* i40e does not support timestamp queues, so pass NULL for ts_fns */ +return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts, get_context_desc,NULL ); }static __rte_always_inline int
Signature · 1 line
2.51.0
PATCH v2 14/36 net/intel: add IPsec hooks to common Tx function
In reply to Bruce RichardsonThe iavf driver has IPsec offload support on Tx, so add hooks to the common Tx function to support that. Do so in a way that has zero performance impact for drivers which do not have IPSec support, by passing in compile-time NULL constants for the function pointers, which can be optimized away by the compiler.
--- drivers/net/intel/common/tx_scalar_fns.h | 60 ++++++++++++++++++++++-- drivers/net/intel/i40e/i40e_rxtx.c | 4 +- drivers/net/intel/ice/ice_rxtx.c | 4 +- 3 files changed, 60 insertions(+), 8 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +56 -4
@@ -152,6 +152,24 @@ typedef uint16_t (*ci_get_ctx_desc_fn)(uint64_t ol_flags, const struct rte_mbuf const union ci_tx_offload *tx_offload, const struct ci_tx_queue *txq, uint32_t *td_offset, uint64_t *qw0, uint64_t *qw1); +/* gets IPsec descriptor information and returns number of descriptors needed (0 or 1) */ +typedef uint16_t (*get_ipsec_desc_t )(const struct rte_mbuf *mbuf, +const struct ci_tx_queue *txq, +void **ipsec_metadata, +uint64_t *qw0, +uint64_t *qw1); +/* calculates segment length for IPsec + TSO combinations */ +typedef uint16_t (*calc_ipsec_segment_len_t )(const struct rte_mbuf *mb_seg, +uint64_t ol_flags, +const void *ipsec_metadata, +uint16_t tlen); + +/** IPsec descriptor operations for drivers that support inline IPsec crypto. */ +struct ci_ipsec_ops { +get_ipsec_desc_t get_ipsec_desc; +calc_ipsec_segment_len_t calc_segment_len; +}; +/* 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 */
@@ -171,6 +189,7 @@ 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_ipsec_ops *ipsec_ops, const struct ci_timesstamp_queue_fns *ts_fns) { volatile struct ci_tx_desc *ci_tx_ring;
@@ -206,6 +225,9 @@ ci_xmit_pkts(struct ci_tx_queue *txq, (void )ci_tx_xmit_cleanup (txq);for (nb_tx =0 ; nb_tx < nb_pkts; nb_tx++) { +void *ipsec_md =NULL ; +uint16_t nb_ipsec =0 ; +uint64_t ipsec_qw0 =0 , ipsec_qw1 =0 ;uint64_t cd_qw0, cd_qw1; tx_pkt = *tx_pkts++;
@@ -225,17 +247,22 @@ ci_xmit_pkts(struct ci_tx_queue *txq, nb_ctx =get_ctx_desc (ol_flags, tx_pkt, &tx_offload, txq, &td_offset, &cd_qw0, &cd_qw1); +/* Get IPsec descriptor information if IPsec ops provided */ +if (ipsec_ops !=NULL ) + nb_ipsec = ipsec_ops->get_ipsec_desc (tx_pkt, txq, &ipsec_md, + &ipsec_qw0, &ipsec_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. +* packet plus the number of context and IPsec descriptors 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); + nb_used = (uint16_t )(ci_calc_pkt_desc (tx_pkt) + nb_ctx + nb_ipsec);else - nb_used = (uint16_t )(tx_pkt->nb_segs + nb_ctx); + nb_used = (uint16_t )(tx_pkt->nb_segs + nb_ctx + nb_ipsec); tx_last = (uint16_t )(tx_id + nb_used -1 );/* Circular ring */
@@ -288,6 +315,26 @@ ci_xmit_pkts(struct ci_tx_queue *txq, tx_id = txe->next_id; txe = txn; } + +if (ipsec_ops !=NULL && nb_ipsec >0 ) { +/* Setup TX IPsec descriptor if required */ + uint64_t *ipsec_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 ; + } + + ipsec_txd[0 ] = ipsec_qw0; + ipsec_txd[1 ] = ipsec_qw1; + + txe->last_id = tx_last; + tx_id = txe->next_id; + txe = txn; + } + m_seg = tx_pkt; do {
@@ -299,7 +346,12 @@ ci_xmit_pkts(struct ci_tx_queue *txq, txe->mbuf = m_seg;/* Setup TX Descriptor */ - slen = m_seg->data_len; +/* Calculate segment length, using IPsec callback if provided */ +if (ipsec_ops !=NULL ) + slen = ipsec_ops->calc_segment_len (m_seg, ol_flags, ipsec_md,0 ); +else + 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)) &&
drivers/net/intel/i40e/i40e_rxtx.c +2 -2
@@ -1020,8 +1020,8 @@ get_context_desc(uint64_t ol_flags, const struct rte_mbuf *tx_pkt,uint16_t i40e_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts) { -/* i40e does not support timestamp queues, so pass NULL for ts_fns */ -return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts, get_context_desc,NULL ); +/* i40e does not support IPsec or timestamp queues, so pass NULL for both */ +return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts, get_context_desc,NULL ,NULL ); }static __rte_always_inline int
drivers/net/intel/ice/ice_rxtx.c +2 -2
@@ -3095,9 +3095,9 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;if (txq->tsq !=NULL && txq->tsq->ts_flag >0 ) -return ci_xmit_pkts (txq, tx_pkts, nb_pkts, get_context_desc, &ts_fns); +return ci_xmit_pkts (txq, tx_pkts, nb_pkts, get_context_desc,NULL , &ts_fns); -return ci_xmit_pkts (txq, tx_pkts, nb_pkts, get_context_desc,NULL ); +return ci_xmit_pkts (txq, tx_pkts, nb_pkts, get_context_desc,NULL ,NULL ); }static __rte_always_inline int
Signature · 1 line
2.51.0
PATCH v2 15/36 net/intel: support configurable VLAN tag insertion on Tx
In reply to Bruce RichardsonMake the VLAN tag insertion logic configurable in the common code, as to where inner/outer tags get placed.
--- drivers/net/intel/common/tx.h | 10 ++++++++++ drivers/net/intel/common/tx_scalar_fns.h | 9 +++++++-- drivers/net/intel/i40e/i40e_rxtx.c | 6 +++--- drivers/net/intel/ice/ice_rxtx.c | 5 +++-- 4 files changed, 23 insertions(+), 7 deletions(-)
drivers/net/intel/common/tx.h +10 -0
@@ -45,6 +45,16 @@#define CI_TX_CTX_DESC_TSYN 0x02#define CI_TX_CTX_DESC_IL2TAG2 0x04 +/** +* L2TAG1 Field Source Selection +* Specifies which mbuf VLAN field to use for the L2TAG1 field in data descriptors. +* Context descriptor VLAN handling (L2TAG2) is managed by driver-specific callbacks. +*/ +enum ci_tx_l2tag1_field { +CI_VLAN_IN_L2TAG1 ,/**< For VLAN (not QinQ), use L2Tag1 field in data desc */ +CI_VLAN_IN_L2TAG2 ,/**< For VLAN (not QinQ), use L2Tag2 field in ctx desc */ +}; +/* 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 */
drivers/net/intel/common/tx_scalar_fns.h +7 -2
@@ -188,6 +188,7 @@ static inline uint16_t ci_xmit_pkts(struct ci_tx_queue *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts, + enum ci_tx_l2tag1_field l2tag1_field, ci_get_ctx_desc_fn get_ctx_desc, const struct ci_ipsec_ops *ipsec_ops, const struct ci_timesstamp_queue_fns *ts_fns)
@@ -286,8 +287,12 @@ ci_xmit_pkts(struct ci_tx_queue *txq, } } -/* Descriptor based VLAN insertion */ -if (ol_flags & (RTE_MBUF_F_TX_VLAN |RTE_MBUF_F_TX_QINQ )) { +/* Descriptor based VLAN/QinQ insertion */ +/* for single vlan offload, only insert in data desc with VLAN_IN_L2TAG1 is set +* for qinq offload, we always put inner tag in L2Tag1 +*/ +if (((ol_flags &RTE_MBUF_F_TX_VLAN ) && l2tag1_field ==CI_VLAN_IN_L2TAG1 ) || + (ol_flags &RTE_MBUF_F_TX_QINQ )) { td_cmd |=CI_TX_DESC_CMD_IL2TAG1 ; td_tag = tx_pkt->vlan_tci; }
drivers/net/intel/i40e/i40e_rxtx.c +3 -3
@@ -1006,8 +1006,7 @@ get_context_desc(uint64_t ol_flags, const struct rte_mbuf *tx_pkt,/* 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 ); + cd_type_cmd_tso_mss |= (I40E_TX_CTX_DESC_IL2TAG2 <<I40E_TXD_CTX_QW1_CMD_SHIFT ); } *qw0 = rte_cpu_to_le_32(cd_tunneling_params) |
@@ -1021,7 +1020,8 @@ uint16_t i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) {/* i40e does not support IPsec or timestamp queues, so pass NULL for both */ -return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts, get_context_desc,NULL ,NULL ); +return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_VLAN_IN_L2TAG1 , + get_context_desc,NULL ,NULL ); }static __rte_always_inline int
drivers/net/intel/ice/ice_rxtx.c +3 -2
@@ -3095,9 +3095,10 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)struct ci_tx_queue *txq = (struct ci_tx_queue *)tx_queue;if (txq->tsq !=NULL && txq->tsq->ts_flag >0 ) -return ci_xmit_pkts (txq, tx_pkts, nb_pkts, get_context_desc,NULL , &ts_fns); +return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_VLAN_IN_L2TAG1 , + get_context_desc,NULL , &ts_fns); -return ci_xmit_pkts (txq, tx_pkts, nb_pkts, get_context_desc,NULL ,NULL ); +return ci_xmit_pkts (txq, tx_pkts, nb_pkts,CI_VLAN_IN_L2TAG1 , get_context_desc,NULL ,NULL ); }static __rte_always_inline int
Signature · 1 line
2.51.0
PATCH v2 16/36 net/iavf: use common scalar Tx function
In reply to Bruce RichardsonNow that the common scalar Tx function has all necessary hooks for the features supported by the iavf driver, use the common function to avoid duplicated code.
--- drivers/net/intel/iavf/iavf_rxtx.c | 534 ++++++----------------------- 1 file changed, 109 insertions(+), 425 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +109 -425
@@ -2331,7 +2331,7 @@ iavf_recv_pkts_bulk_alloc(void *rx_queue,/* 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) +iavf_calc_context_desc (const struct rte_mbuf *mb,uint8_t vlan_flag) {uint64_t flags = mb->ol_flags; if (flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG |
@@ -2349,44 +2349,7 @@ iavf_calc_context_desc(struct rte_mbuf *mb, uint8_t vlan_flag) }static inline void -iavf_fill_ctx_desc_cmd_field (volatile uint64_t *field,struct rte_mbuf *m, -uint8_t vlan_flag) -{ -uint64_t cmd =0 ; - -/* TSO enabled */ -if (m->ol_flags & (RTE_MBUF_F_TX_TCP_SEG |RTE_MBUF_F_TX_UDP_SEG )) - 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 ) || - m->ol_flags &RTE_MBUF_F_TX_QINQ ) { - cmd |=CI_TX_CTX_DESC_IL2TAG2 - <<IAVF_TXD_CTX_QW1_CMD_SHIFT ; - } - -if (IAVF_CHECK_TX_LLDP (m)) - cmd |=IAVF_TX_CTX_DESC_SWTCH_UPLINK - <<IAVF_TXD_CTX_QW1_CMD_SHIFT ; - - *field |= cmd; -} - -static inline void -iavf_fill_ctx_desc_ipsec_field (volatile uint64_t *field, -struct iavf_ipsec_crypto_pkt_metadata *ipsec_md) -{ -uint64_t ipsec_field = - (uint64_t )ipsec_md->ctx_desc_ipsec_params << -IAVF_TXD_CTX_QW1_IPSEC_PARAMS_CIPHERBLK_SHIFT ; - - *field |= ipsec_field; -} - - -static inline void -iavf_fill_ctx_desc_tunnelling_field (volatile uint64_t *qw0, -const struct rte_mbuf *m) +iavf_fill_ctx_desc_tunnelling_field (uint64_t *qw0,const struct rte_mbuf *m) {uint64_t eip_typ =IAVF_TX_CTX_DESC_EIPT_NONE ;uint64_t eip_len =0 ;
@@ -2461,7 +2424,7 @@ iavf_fill_ctx_desc_tunnelling_field(volatile uint64_t *qw0,static inline uint16_t iavf_fill_ctx_desc_segmentation_field (volatile uint64_t *field, -struct rte_mbuf *m,struct iavf_ipsec_crypto_pkt_metadata *ipsec_md) +const struct rte_mbuf *m,struct iavf_ipsec_crypto_pkt_metadata *ipsec_md) {uint64_t segmentation_field =0 ;uint64_t total_length =0 ;
@@ -2500,59 +2463,31 @@ struct iavf_tx_context_desc_qws {__le64 qw1; }; -static inline void -iavf_fill_context_desc (volatile struct iavf_tx_context_desc *desc, -struct rte_mbuf *m,struct iavf_ipsec_crypto_pkt_metadata *ipsec_md, -uint16_t *tlen,uint8_t vlan_flag) +/* IPsec callback for ci_xmit_pkts - gets IPsec descriptor information */ +static uint16_t +iavf_get_ipsec_desc (const struct rte_mbuf *mbuf,const struct ci_tx_queue *txq, +void **ipsec_metadata,uint64_t *qw0,uint64_t *qw1) { -volatile struct iavf_tx_context_desc_qws *desc_qws = - (volatile struct iavf_tx_context_desc_qws *)desc; -/* fill descriptor type field */ - desc_qws->qw1 =IAVF_TX_DESC_DTYPE_CONTEXT ; - -/* fill command field */ -iavf_fill_ctx_desc_cmd_field (&desc_qws->qw1, m, vlan_flag); - -/* fill segmentation field */ -if (m->ol_flags & (RTE_MBUF_F_TX_TCP_SEG |RTE_MBUF_F_TX_UDP_SEG )) { -/* fill IPsec field */ -if (m->ol_flags &RTE_MBUF_F_TX_SEC_OFFLOAD ) -iavf_fill_ctx_desc_ipsec_field (&desc_qws->qw1, - ipsec_md); - - *tlen =iavf_fill_ctx_desc_segmentation_field (&desc_qws->qw1, - m, ipsec_md); - } - -/* fill tunnelling field */ -if (m->ol_flags &RTE_MBUF_F_TX_TUNNEL_MASK ) -iavf_fill_ctx_desc_tunnelling_field (&desc_qws->qw0, m); -else - desc_qws->qw0 =0 ; +struct iavf_ipsec_crypto_pkt_metadata *md; - desc_qws->qw0 =rte_cpu_to_le_64 (desc_qws->qw0); - desc_qws->qw1 =rte_cpu_to_le_64 (desc_qws->qw1); +if (!(mbuf->ol_flags &RTE_MBUF_F_TX_SEC_OFFLOAD )) +return 0 ; -/* vlan_flag specifies VLAN tag location for VLAN, and outer tag location for QinQ. */ -if (m->ol_flags &RTE_MBUF_F_TX_QINQ ) - desc->l2tag2 = vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ? m->vlan_tci_outer : - m->vlan_tci; -else if (m->ol_flags &RTE_MBUF_F_TX_VLAN && vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ) - desc->l2tag2 = m->vlan_tci; -} + md =RTE_MBUF_DYNFIELD (mbuf, txq->ipsec_crypto_pkt_md_offset, + struct iavf_ipsec_crypto_pkt_metadata *); +if (!md) +return 0 ; + *ipsec_metadata = md; -static inline void -iavf_fill_ipsec_desc (volatile struct iavf_tx_ipsec_desc *desc, -const struct iavf_ipsec_crypto_pkt_metadata *md,uint16_t *ipsec_len) -{ - desc->qw0 =rte_cpu_to_le_64 (((uint64_t )md->l4_payload_len << +/* Fill IPsec descriptor using existing logic */ + *qw0 =rte_cpu_to_le_64 (((uint64_t )md->l4_payload_len <<IAVF_IPSEC_TX_DESC_QW0_L4PAYLEN_SHIFT ) | ((uint64_t )md->esn <<IAVF_IPSEC_TX_DESC_QW0_IPSECESN_SHIFT ) | ((uint64_t )md->esp_trailer_len <<IAVF_IPSEC_TX_DESC_QW0_TRAILERLEN_SHIFT )); - desc->qw1 = rte_cpu_to_le_64(((uint64_t)md->sa_idx << + *qw1 = rte_cpu_to_le_64(((uint64_t)md->sa_idx << IAVF_IPSEC_TX_DESC_QW1_IPSECSA_SHIFT) | ((uint64_t)md->next_proto << IAVF_IPSEC_TX_DESC_QW1_IPSECNH_SHIFT) |
@@ -2561,143 +2496,106 @@ iavf_fill_ipsec_desc(volatile struct iavf_tx_ipsec_desc *desc, ((uint64_t )(md->ol_flags &IAVF_IPSEC_CRYPTO_OL_FLAGS_NATT ?1ULL :0ULL ) <<IAVF_IPSEC_TX_DESC_QW1_UDP_SHIFT ) | - (uint64_t)IAVF_TX_DESC_DTYPE_IPSEC); + ((uint64_t )IAVF_TX_DESC_DTYPE_IPSEC << + CI_TXD_QW1_DTYPE_S)); -/** -* TODO: Pre-calculate this in the Session initialization -* -* Calculate IPsec length required in data descriptor func when TSO -* offload is enabled -*/ - *ipsec_len =sizeof (struct rte_esp_hdr ) + (md->len_iv >>2 ) + - (md->ol_flags &IAVF_IPSEC_CRYPTO_OL_FLAGS_NATT ? -sizeof (struct rte_udp_hdr ) :0 ); +return 1 ;/* One IPsec descriptor needed */ } -static inline void -iavf_build_data_desc_cmd_offset_fields (volatile uint64_t *qw1, -struct rte_mbuf *m,uint8_t vlan_flag) +/* IPsec callback for ci_xmit_pkts - calculates segment length for IPsec+TSO */ +static uint16_t +iavf_calc_ipsec_segment_len (const struct rte_mbuf *mb_seg,uint64_t ol_flags, +const void *ipsec_metadata,uint16_t tlen) { -uint64_t command =0 ; -uint64_t offset =0 ; -uint64_t l2tag1 =0 ; - - *qw1 =CI_TX_DESC_DTYPE_DATA ; - - 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 )CI_TX_DESC_CMD_IL2TAG1 ; - l2tag1 |= m->vlan_tci; - } - -/* Descriptor based QinQ insertion. vlan_flag specifies outer tag location. */ -if (m->ol_flags &RTE_MBUF_F_TX_QINQ ) { - command |= (uint64_t )CI_TX_DESC_CMD_IL2TAG1 ; - l2tag1 = vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ? m->vlan_tci_outer : - m->vlan_tci; +const struct iavf_ipsec_crypto_pkt_metadata *ipsec_md = ipsec_metadata; + +if ((ol_flags &RTE_MBUF_F_TX_SEC_OFFLOAD ) && + (ol_flags & (RTE_MBUF_F_TX_TCP_SEG |RTE_MBUF_F_TX_UDP_SEG ))) { +uint16_t ipseclen = ipsec_md ? (ipsec_md->esp_trailer_len + + ipsec_md->len_iv) :0 ; +uint16_t slen = tlen + mb_seg->l2_len + mb_seg->l3_len + + mb_seg->outer_l3_len + ipseclen; +if (ol_flags &RTE_MBUF_F_TX_L4_MASK ) + slen += mb_seg->l4_len; +return slen; } -if ((m->ol_flags & - (CI_TX_CKSUM_OFFLOAD_MASK |RTE_MBUF_F_TX_SEC_OFFLOAD )) ==0 ) - goto skip_cksum; +return mb_seg->data_len; +} -/* Set MACLEN */ -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 ) - <<CI_TX_DESC_LEN_MACLEN_S ; -else - offset |= (m->l2_len >>1 ) - <<CI_TX_DESC_LEN_MACLEN_S ; +/* Context descriptor callback for ci_xmit_pkts */ +static uint16_t +iavf_get_context_desc (uint64_t ol_flags,const struct rte_mbuf *mbuf, + const union ci_tx_offload *tx_offload __rte_unused, +const struct ci_tx_queue *txq, + uint32_t *td_offset __rte_unused, uint64_t *qw0, uint64_t *qw1) +{ +uint8_t iavf_vlan_flag; +uint16_t cd_l2tag2 =0 ; +uint64_t cd_type_cmd =IAVF_TX_DESC_DTYPE_CONTEXT ; +uint64_t cd_tunneling_params =0 ; +uint16_t tlen =0 ; +struct iavf_ipsec_crypto_pkt_metadata *ipsec_md =NULL ; + +/* Use IAVF-specific vlan_flag from txq */ + iavf_vlan_flag = txq->vlan_flag; + +/* Check if context descriptor is needed using existing IAVF logic */ +if (!iavf_calc_context_desc (mbuf, iavf_vlan_flag)) +return 0 ; -/* 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 |=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 |=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 |=CI_TX_DESC_CMD_IIPT_IPV6 ; - offset |= (m->l3_len >>2 ) <<CI_TX_DESC_LEN_IPLEN_S ; +/* Get IPsec metadata if needed */ +if (ol_flags &RTE_MBUF_F_TX_SEC_OFFLOAD ) { + ipsec_md =RTE_MBUF_DYNFIELD (mbuf, txq->ipsec_crypto_pkt_md_offset, + struct iavf_ipsec_crypto_pkt_metadata *); } -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 |=CI_TX_DESC_CMD_L4T_EOFT_TCP ; -else - command |=CI_TX_DESC_CMD_L4T_EOFT_UDP ; - offset |= (m->l4_len >>2 ) << -CI_TX_DESC_LEN_L4_LEN_S ; +/* TSO command field */ +if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG |RTE_MBUF_F_TX_UDP_SEG )) { + cd_type_cmd |= (uint64_t )CI_TX_CTX_DESC_TSO <<IAVF_TXD_CTX_QW1_CMD_SHIFT ; - *qw1 =rte_cpu_to_le_64 ((((uint64_t )command << -IAVF_TXD_DATA_QW1_CMD_SHIFT ) &IAVF_TXD_DATA_QW1_CMD_MASK ) | - (((uint64_t )offset <<IAVF_TXD_DATA_QW1_OFFSET_SHIFT ) & -IAVF_TXD_DATA_QW1_OFFSET_MASK ) | - ((uint64_t )l2tag1 <<IAVF_TXD_DATA_QW1_L2TAG1_SHIFT )); +/* IPsec field for TSO */ +if (ol_flags &RTE_MBUF_F_TX_SEC_OFFLOAD && ipsec_md) { +uint64_t ipsec_field = (uint64_t )ipsec_md->ctx_desc_ipsec_params << +IAVF_TXD_CTX_QW1_IPSEC_PARAMS_CIPHERBLK_SHIFT ; + cd_type_cmd |= ipsec_field; + } -return ; +/* TSO segmentation field */ + tlen =iavf_fill_ctx_desc_segmentation_field (&cd_type_cmd, + mbuf, ipsec_md); + (void )tlen;/* Suppress unused variable warning */ } -/* Enable L4 checksum offloads */ -switch (m->ol_flags &RTE_MBUF_F_TX_L4_MASK ) { -case RTE_MBUF_F_TX_TCP_CKSUM : - command |=CI_TX_DESC_CMD_L4T_EOFT_TCP ; - offset |= (sizeof (struct rte_tcp_hdr ) >>2 ) << -CI_TX_DESC_LEN_L4_LEN_S ; -break ; -case RTE_MBUF_F_TX_SCTP_CKSUM : - command |=CI_TX_DESC_CMD_L4T_EOFT_SCTP ; - offset |= (sizeof (struct rte_sctp_hdr ) >>2 ) << -CI_TX_DESC_LEN_L4_LEN_S ; -break ; -case RTE_MBUF_F_TX_UDP_CKSUM : - command |=CI_TX_DESC_CMD_L4T_EOFT_UDP ; - offset |= (sizeof (struct rte_udp_hdr ) >>2 ) << -CI_TX_DESC_LEN_L4_LEN_S ; -break ; +/* VLAN field for L2TAG2 */ +if ((ol_flags &RTE_MBUF_F_TX_VLAN && + iavf_vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ) || + ol_flags &RTE_MBUF_F_TX_QINQ ) { + cd_type_cmd |= (uint64_t )CI_TX_CTX_DESC_IL2TAG2 <<IAVF_TXD_CTX_QW1_CMD_SHIFT ; } -skip_cksum: - *qw1 =rte_cpu_to_le_64 ((((uint64_t )command << -IAVF_TXD_DATA_QW1_CMD_SHIFT ) &IAVF_TXD_DATA_QW1_CMD_MASK ) | - (((uint64_t )offset <<IAVF_TXD_DATA_QW1_OFFSET_SHIFT ) & -IAVF_TXD_DATA_QW1_OFFSET_MASK ) | - ((uint64_t )l2tag1 <<IAVF_TXD_DATA_QW1_L2TAG1_SHIFT )); -} - -static inline void -iavf_fill_data_desc (volatile struct ci_tx_desc *desc, -uint64_t desc_template,uint16_t buffsz, -uint64_t buffer_addr) -{ -/* fill data descriptor qw1 from template */ - desc->cmd_type_offset_bsz = desc_template; - -/* set data buffer size */ - desc->cmd_type_offset_bsz |= - (((uint64_t )buffsz <<IAVF_TXD_DATA_QW1_TX_BUF_SZ_SHIFT ) & -IAVF_TXD_DATA_QW1_TX_BUF_SZ_MASK ); - - desc->buffer_addr =rte_cpu_to_le_64 (buffer_addr); - desc->cmd_type_offset_bsz =rte_cpu_to_le_64 (desc->cmd_type_offset_bsz); -} - +/* LLDP switching field */ +if (IAVF_CHECK_TX_LLDP (mbuf)) + cd_type_cmd |=IAVF_TX_CTX_DESC_SWTCH_UPLINK <<IAVF_TXD_CTX_QW1_CMD_SHIFT ; + +/* Tunneling field */ +if (ol_flags &RTE_MBUF_F_TX_TUNNEL_MASK ) +iavf_fill_ctx_desc_tunnelling_field ((uint64_t *)&cd_tunneling_params, mbuf); + +/* L2TAG2 field (VLAN) */ +if (ol_flags &RTE_MBUF_F_TX_QINQ ) { + cd_l2tag2 = iavf_vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ? + mbuf->vlan_tci_outer : mbuf->vlan_tci; + }else if (ol_flags &RTE_MBUF_F_TX_VLAN && + iavf_vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2 ) { + cd_l2tag2 = mbuf->vlan_tci; + } -static struct iavf_ipsec_crypto_pkt_metadata * -iavf_ipsec_crypto_get_pkt_metadata (const struct ci_tx_queue *txq, -struct rte_mbuf *m) -{ -if (m->ol_flags &RTE_MBUF_F_TX_SEC_OFFLOAD ) -return RTE_MBUF_DYNFIELD (m, txq->ipsec_crypto_pkt_md_offset, - struct iavf_ipsec_crypto_pkt_metadata *); +/* Set outputs */ + *qw0 =rte_cpu_to_le_64 (cd_tunneling_params | ((uint64_t )cd_l2tag2 <<32 )); + *qw1 =rte_cpu_to_le_64 (cd_type_cmd); -return NULL ; +return 1 ;/* One context descriptor needed */ }/* TX function */
@@ -2705,231 +2603,17 @@ 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->ci_tx_ring; -struct ci_tx_entry *txe_ring = txq->sw_ring; -struct ci_tx_entry *txe, *txn; -struct rte_mbuf *mb, *mb_seg; -uint64_t buf_dma_addr; -uint16_t desc_idx, desc_idx_last; -uint16_t idx; -uint16_t slen; - - -/* Check if the descriptor ring needs to be cleaned. */ -if (txq->nb_tx_free < txq->tx_free_thresh) -ci_tx_xmit_cleanup (txq); - - desc_idx = txq->tx_tail; - txe = &txe_ring[desc_idx]; - -for (idx =0 ; idx < nb_pkts; idx++) { -volatile struct ci_tx_desc *ddesc; -struct iavf_ipsec_crypto_pkt_metadata *ipsec_md; - -uint16_t nb_desc_ctx, nb_desc_ipsec; -uint16_t nb_desc_data, nb_desc_required; -uint16_t tlen =0 , ipseclen =0 ; -uint64_t ddesc_template =0 ; -uint64_t ddesc_cmd =0 ; - - mb = tx_pkts[idx]; -RTE_MBUF_PREFETCH_TO_FREE (txe->mbuf); - -/** -* Get metadata for ipsec crypto from mbuf dynamic fields if -* security offload is specified. -*/ - ipsec_md =iavf_ipsec_crypto_get_pkt_metadata (txq, mb); - - nb_desc_data = mb->nb_segs; - nb_desc_ctx = -iavf_calc_context_desc (mb, txq->vlan_flag); - nb_desc_ipsec = !!(mb->ol_flags &RTE_MBUF_F_TX_SEC_OFFLOAD ); - -/** -* The number of descriptors that must be allocated for -* a packet equals to the number of the segments of that -* packet plus the context and ipsec descriptors 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 (mb->ol_flags &RTE_MBUF_F_TX_TCP_SEG ) - 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; - - desc_idx_last = (uint16_t )(desc_idx + nb_desc_required -1 ); - -/* wrap descriptor ring */ -if (desc_idx_last >= txq->nb_tx_desc) - desc_idx_last = - (uint16_t )(desc_idx_last - txq->nb_tx_desc); - -PMD_TX_LOG (DEBUG , -"port_id=%u queue_id=%u tx_first=%u tx_last=%u" , - txq->port_id, txq->queue_id, desc_idx, desc_idx_last); - -if (nb_desc_required > txq->nb_tx_free) { -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 (ci_tx_xmit_cleanup (txq)) { -if (idx ==0 ) -return 0 ; - goto end_of_tx; - } - } - } - } - -iavf_build_data_desc_cmd_offset_fields (&ddesc_template, mb, - txq->vlan_flag); - -/* Setup TX context descriptor if required */ -if (nb_desc_ctx) { -volatile struct iavf_tx_context_desc *ctx_desc = - (volatile struct iavf_tx_context_desc *) - &txr[desc_idx]; - -/* clear QW0 or the previous writeback value -* may impact next write -*/ - *(volatile uint64_t *)ctx_desc =0 ; - - txn = &txe_ring[txe->next_id]; -RTE_MBUF_PREFETCH_TO_FREE (txn->mbuf); - -if (txe->mbuf) { -rte_pktmbuf_free_seg (txe->mbuf); - txe->mbuf =NULL ; - } - -iavf_fill_context_desc (ctx_desc, mb, ipsec_md, &tlen, - txq->vlan_flag); -IAVF_DUMP_TX_DESC (txq, ctx_desc, desc_idx); - - txe->last_id = desc_idx_last; - desc_idx = txe->next_id; - txe = txn; - } - -if (nb_desc_ipsec) { -volatile struct iavf_tx_ipsec_desc *ipsec_desc = - (volatile struct iavf_tx_ipsec_desc *) - &txr[desc_idx]; - - txn = &txe_ring[txe->next_id]; -RTE_MBUF_PREFETCH_TO_FREE (txn->mbuf); - -if (txe->mbuf) { -rte_pktmbuf_free_seg (txe->mbuf); - txe->mbuf =NULL ; - } - -iavf_fill_ipsec_desc (ipsec_desc, ipsec_md, &ipseclen); - -IAVF_DUMP_TX_DESC (txq, ipsec_desc, desc_idx); - - txe->last_id = desc_idx_last; - desc_idx = txe->next_id; - txe = txn; - } - - mb_seg = mb; - -do { - ddesc = (volatile struct ci_tx_desc *) - &txr[desc_idx]; - - txn = &txe_ring[txe->next_id]; -RTE_MBUF_PREFETCH_TO_FREE (txn->mbuf); - -if (txe->mbuf) -rte_pktmbuf_free_seg (txe->mbuf); - - txe->mbuf = mb_seg; - -if ((mb_seg->ol_flags &RTE_MBUF_F_TX_SEC_OFFLOAD ) && - (mb_seg->ol_flags & - (RTE_MBUF_F_TX_TCP_SEG | -RTE_MBUF_F_TX_UDP_SEG ))) { - slen = tlen + mb_seg->l2_len + mb_seg->l3_len + - mb_seg->outer_l3_len + ipseclen; -if (mb_seg->ol_flags &RTE_MBUF_F_TX_L4_MASK ) - slen += mb_seg->l4_len; - }else { - slen = mb_seg->data_len; - } - - buf_dma_addr =rte_mbuf_data_iova (mb_seg); -while ((mb_seg->ol_flags & (RTE_MBUF_F_TX_TCP_SEG | -RTE_MBUF_F_TX_UDP_SEG )) && -unlikely (slen >CI_MAX_DATA_PER_TXD )) { -iavf_fill_data_desc (ddesc, ddesc_template, -CI_MAX_DATA_PER_TXD , buf_dma_addr); - -IAVF_DUMP_TX_DESC (txq, ddesc, desc_idx); - - 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; - txe = txn; - ddesc = &txr[desc_idx]; - txn = &txe_ring[txe->next_id]; - } - -iavf_fill_data_desc (ddesc, ddesc_template, - slen, buf_dma_addr); - -IAVF_DUMP_TX_DESC (txq, ddesc, desc_idx); - - txe->last_id = desc_idx_last; - desc_idx = txe->next_id; - txe = txn; - mb_seg = mb_seg->next; - }while (mb_seg); - -/* The last packet data descriptor needs End Of Packet (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); - -if (txq->nb_tx_used >= txq->tx_rs_thresh) { -PMD_TX_LOG (DEBUG ,"Setting RS bit on TXD id=" -"%4u (port=%d queue=%d)" , - desc_idx_last, txq->port_id, txq->queue_id); - - ddesc_cmd |=CI_TX_DESC_CMD_RS ; - -/* Update txq RS bit counters */ - txq->nb_tx_used =0 ; - } - - ddesc->cmd_type_offset_bsz |=rte_cpu_to_le_64 (ddesc_cmd << -IAVF_TXD_DATA_QW1_CMD_SHIFT ); - -IAVF_DUMP_TX_DESC (txq, ddesc, desc_idx -1 ); - } - -end_of_tx: -rte_wmb (); - -PMD_TX_LOG (DEBUG ,"port_id=%u queue_id=%u tx_tail=%u nb_tx=%u" , - txq->port_id, txq->queue_id, desc_idx, idx); - -IAVF_PCI_REG_WRITE_RELAXED (txq->qtx_tail, desc_idx); - txq->tx_tail = desc_idx; +const struct ci_ipsec_ops ipsec_ops = { + .get_ipsec_desc = iavf_get_ipsec_desc, + .calc_segment_len = iavf_calc_ipsec_segment_len, + }; -return idx; +/* IAVF does not support timestamp queues, so pass NULL for ts_fns */ +return ci_xmit_pkts (txq, tx_pkts, nb_pkts, + (txq->vlan_flag &IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG1 ) ? +CI_VLAN_IN_L2TAG1 :CI_VLAN_IN_L2TAG2 , + iavf_get_context_desc, &ipsec_ops,NULL ); }/* Check if the packet with vlan user priority is transmitted in the
Signature · 1 line
2.51.0
PATCH v2 17/36 net/i40e: document requirement for QinQ support
In reply to Bruce RichardsonIn order to get multiple VLANs inserted in an outgoing packet with QinQ offload the i40e driver needs to be set to double vlan mode. This is done by using the VLAN_EXTEND Rx config flag. Add a code check for this dependency and update the docs about it.
--- doc/guides/nics/i40e.rst | 18 ++++++++++++++++++ drivers/net/intel/i40e/i40e_rxtx.c | 9 +++++++++ 2 files changed, 27 insertions(+)
doc/guides/nics/i40e.rst +18 -0
@@ -245,6 +245,24 @@ Runtime Configuration * ``segment``: Check number of mbuf segments not exceed hw limitation. * ``offload``: Check any unsupported offload flag. +QinQ Configuration +~~~~~~~~~~~~~~~~~~ + +When using QinQ TX offload (``RTE_ETH_TX_OFFLOAD_QINQ_INSERT``), you must also +enable ``RTE_ETH_RX_OFFLOAD_VLAN_EXTEND`` to configure the hardware for double +VLAN mode. Without this, only the inner VLAN tag will be inserted. + +Example:: + + struct rte_eth_conf port_conf = { + .rxmode = { + .offloads = RTE_ETH_RX_OFFLOAD_VLAN_EXTEND, + }, + .txmode = { + .offloads = RTE_ETH_TX_OFFLOAD_QINQ_INSERT, + }, + }; + Vector RX Pre-conditions ~~~~~~~~~~~~~~~~~~~~~~~~ For Vector RX it is assumed that the number of descriptor rings will be a power
drivers/net/intel/i40e/i40e_rxtx.c +9 -0
@@ -2169,6 +2169,15 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev, vsi =i40e_pf_get_vsi_by_qindex (pf, queue_idx);if (!vsi)return -EINVAL ; + +/* Check if QinQ TX offload requires VLAN extend mode */ +if ((offloads &RTE_ETH_TX_OFFLOAD_QINQ_INSERT ) && + !(dev->data->dev_conf.rxmode.offloads &RTE_ETH_RX_OFFLOAD_VLAN_EXTEND )) { +PMD_DRV_LOG (WARNING ,"Port %u: QinQ TX offload is enabled but VLAN extend mode is not set. " , + dev->data->port_id); +PMD_DRV_LOG (WARNING ,"Double VLAN insertion may not work correctly without RTE_ETH_RX_OFFLOAD_VLAN_EXTEND set in Rx configuration." ); + } + q_offset =i40e_get_queue_offset_by_qindex (pf, queue_idx);if (q_offset <0 )return -EINVAL ;
Signature · 1 line
2.51.0
PATCH v2 18/36 net/idpf: use common scalar Tx function
In reply to Bruce RichardsonUpdate idpf driver to use the common scalar Tx function in single-queue configuration.
--- drivers/net/intel/idpf/idpf_common_rxtx.c | 179 ++-------------------- 1 file changed, 11 insertions(+), 168 deletions(-)
drivers/net/intel/idpf/idpf_common_rxtx.c +11 -168
@@ -8,7 +8,6 @@#include "idpf_common_rxtx.h" #include "idpf_common_device.h" -#include "../common/rx.h" int idpf_timestamp_dynfield_offset =-1 ;uint64_t idpf_timestamp_dynflag;
@@ -848,9 +847,11 @@ idpf_calc_context_desc(uint64_t flags)/* set TSO context descriptor, returns 0 if no context needed, 1 if context set */ static inline uint16_t -idpf_set_tso_ctx (uint64_t ol_flags,struct rte_mbuf *mbuf, -union ci_tx_offload tx_offload, -uint64_t *qw0,uint64_t *qw1) +idpf_set_tso_ctx (uint64_t ol_flags,const struct rte_mbuf *mbuf, +const union ci_tx_offload *tx_offload, + const struct ci_tx_queue *txq __rte_unused, + uint32_t *td_offset __rte_unused, +uint64_t *qw0,uint64_t *qw1) {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;
@@ -861,12 +862,12 @@ idpf_set_tso_ctx(uint64_t ol_flags, struct rte_mbuf *mbuf,return 0 ;/* TSO context descriptor setup */ -if (tx_offload.l4_len ==0 ) { +if (tx_offload->l4_len ==0 ) {TX_LOG (DEBUG ,"L4 length set to 0" );return 0 ; } - hdr_len = tx_offload.l2_len + tx_offload.l3_len + tx_offload.l4_len; + hdr_len = tx_offload->l2_len + tx_offload->l3_len + tx_offload->l4_len; tso_len = mbuf->pkt_len - hdr_len; *qw0 = rte_cpu_to_le_32(tso_len & IDPF_TXD_FLEX_CTX_MSS_RT_M) |
@@ -933,7 +934,8 @@ 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. */ uint64_t cd_qw0, cd_qw1; - nb_ctx =idpf_set_tso_ctx (ol_flags, tx_pkt, tx_offload, &cd_qw0, &cd_qw1); + nb_ctx =idpf_set_tso_ctx (ol_flags, tx_pkt, &tx_offload, txq, +NULL /* unused */ , &cd_qw0, &cd_qw1);/* Calculate the number of TX descriptors needed for * each packet. For TSO packets, use ci_calc_pkt_desc as
@@ -1339,167 +1341,8 @@ uint16_t idpf_dp_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { -volatile struct ci_tx_desc *txd; -volatile struct ci_tx_desc *txr; -union ci_tx_offload tx_offload = {0 }; -struct ci_tx_entry *txe, *txn; -struct ci_tx_entry *sw_ring; -struct ci_tx_queue *txq; -struct rte_mbuf *tx_pkt; -struct rte_mbuf *m_seg; -uint64_t buf_dma_addr; -uint32_t td_offset; -uint64_t ol_flags; -uint16_t tx_last; -uint16_t nb_used; -uint16_t nb_ctx; -uint16_t td_cmd; -uint16_t tx_id; -uint16_t nb_tx; -uint16_t slen; - - nb_tx =0 ; - txq = tx_queue; - -if (unlikely (txq ==NULL )) -return nb_tx; - - sw_ring = txq->sw_ring; - txr = txq->ci_tx_ring; - tx_id = txq->tx_tail; - txe = &sw_ring[tx_id]; - -/* 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++) { - td_cmd =0 ; - td_offset =0 ; - - tx_pkt = *tx_pkts++; -RTE_MBUF_PREFETCH_TO_FREE (txe->mbuf); - - ol_flags = tx_pkt->ol_flags; - tx_offload.l2_len = tx_pkt->l2_len; - tx_offload.l3_len = tx_pkt->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. */ -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 -* 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 = (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); - -TX_LOG (DEBUG ,"port_id=%u queue_id=%u" -" tx_first=%u tx_last=%u" , - txq->port_id, txq->queue_id, tx_id, tx_last); - -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; - } - } - } - } - -if (ol_flags &CI_TX_CKSUM_OFFLOAD_MASK ) - td_cmd |=IDPF_TX_FLEX_DESC_CMD_CS_EN ; - -if (nb_ctx !=0 ) { -/* Setup TX context descriptor if required */ - 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); -if (txe->mbuf !=NULL ) { -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 = &txr[tx_id]; - txn = &sw_ring[txe->next_id]; - -if (txe->mbuf !=NULL ) -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); - 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 )); - - txe->last_id = tx_last; - tx_id = txe->next_id; - txe = txn; - m_seg = m_seg->next; - }while (m_seg); - -/* The last packet data descriptor needs End Of Packet (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); - -if (txq->nb_tx_used >= txq->tx_rs_thresh) { -TX_LOG (DEBUG ,"Setting RS bit on TXD id=" -"%4u (port=%d queue=%d)" , - tx_last, txq->port_id, txq->queue_id); - - 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 <<CI_TXD_QW1_CMD_S ); - } - -end_of_tx: -rte_wmb (); - -TX_LOG (DEBUG ,"port_id=%u queue_id=%u tx_tail=%u nb_tx=%u" , - txq->port_id, txq->queue_id, tx_id, nb_tx); - -IDPF_PCI_REG_WRITE (txq->qtx_tail, tx_id); - txq->tx_tail = tx_id; - -return nb_tx; +return ci_xmit_pkts (tx_queue, tx_pkts, nb_pkts,CI_VLAN_IN_L2TAG1 , + idpf_set_tso_ctx,NULL ,NULL ); }/* TX prep functions */
Signature · 1 line
2.51.0
PATCH v2 19/36 net/intel: avoid writing the final pkt descriptor twice
In reply to Bruce RichardsonIn the scalar datapath, there is a loop to handle multi-segment, and multi-descriptor packets on Tx. After that loop, the end-of-packet bit was written to the descriptor separately, meaning that for each single-descriptor packet there were two writes to the second quad-word - basically 3 x 64-bit writes rather than just 2. Adjusting the code to compute the EOP bit inside the loop saves that extra write per packet and so improves performance.
--- drivers/net/intel/common/tx_scalar_fns.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +6 -6
@@ -378,6 +378,10 @@ ci_xmit_pkts(struct ci_tx_queue *txq, txn = &sw_ring[txe->next_id]; } +/* fill the last descriptor with End of Packet (EOP) bit */ +if (m_seg->next ==NULL ) + td_cmd |=CI_TX_DESC_CMD_EOP ; + 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) |
@@ -390,21 +394,17 @@ ci_xmit_pkts(struct ci_tx_queue *txq, 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 ; + txd->cmd_type_offset_bsz |= +rte_cpu_to_le_64 (CI_TX_DESC_CMD_RS <<CI_TXD_QW1_CMD_S );/* 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);
Signature · 1 line
2.51.0
PATCH v2 20/36 eal: add macro for marking assumed alignment
In reply to Bruce RichardsonProvide a common DPDK macro for the gcc/clang builtin __rte_assume_aligned to mark pointers as pointing to something with known minimum alignment.
--- lib/eal/include/rte_common.h | 6 ++++++ 1 file changed, 6 insertions(+)
lib/eal/include/rte_common.h +6 -0
@@ -121,6 +121,12 @@ extern "C" {#define __rte_aligned (a) __attribute__((__aligned__(a)))#endif +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_assume_aligned (ptr, align) (ptr) +#else +#define __rte_assume_aligned __builtin_assume_aligned +#endif +#ifdef RTE_ARCH_STRICT_ALIGN typedef uint64_t unaligned_uint64_t __rte_aligned(1); typedef uint32_t unaligned_uint32_t __rte_aligned(1);
Signature · 1 line
2.51.0
PATCH v2 21/36 net/intel: write descriptors using non-volatile pointers
In reply to Bruce RichardsonUse a non-volatile uint64_t pointer to store to the descriptor ring. This will allow the compiler to optionally merge the stores as it sees best.
--- drivers/net/intel/common/tx_scalar_fns.h | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +16 -8
@@ -184,6 +184,15 @@ 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,
@@ -313,8 +322,7 @@ ci_xmit_pkts(struct ci_tx_queue *txq, txe->mbuf =NULL ; } - ctx_txd[0 ] = cd_qw0; - ctx_txd[1 ] = cd_qw1; +write_txd (ctx_txd, cd_qw0, cd_qw1); txe->last_id = tx_last; tx_id = txe->next_id;
@@ -361,12 +369,12 @@ ci_xmit_pkts(struct ci_tx_queue *txq,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 | +const uint64_t cmd_type_offset_bsz =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 )); + ((uint64_t )td_tag <<CI_TXD_QW1_L2TAG1_S ); +write_txd (txd, buf_dma_addr, cmd_type_offset_bsz); buf_dma_addr +=CI_MAX_DATA_PER_TXD ; slen -=CI_MAX_DATA_PER_TXD ;
@@ -382,12 +390,12 @@ ci_xmit_pkts(struct ci_tx_queue *txq,if (m_seg->next ==NULL ) td_cmd |=CI_TX_DESC_CMD_EOP ; - 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 | +const uint64_t cmd_type_offset_bsz =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 )); + ((uint64_t )td_tag <<CI_TXD_QW1_L2TAG1_S ); +write_txd (txd, buf_dma_addr, cmd_type_offset_bsz); txe->last_id = tx_last; tx_id = txe->next_id;
Signature · 1 line
2.51.0
PATCH v2 22/36 net/intel: remove unnecessary flag clearing
In reply to Bruce RichardsonWhen cleaning the Tx ring, there is no need to zero out the done flag from the completed entry. That flag will be automatically cleared when the descriptor is next written. This gives a small performance benefit.
--- drivers/net/intel/common/tx_scalar_fns.h | 7 ------- 1 file changed, 7 deletions(-)
drivers/net/intel/common/tx_scalar_fns.h +0 -7
@@ -51,13 +51,6 @@ ci_tx_xmit_cleanup(struct ci_tx_queue *txq)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);
Signature · 1 line
2.51.0
PATCH v2 23/36 net/intel: mark mid-burst ring cleanup as unlikely
In reply to Bruce RichardsonIt should rarely be the case that we need to cleanup the descriptor ring mid-burst, so mark as unlikely to help performance.
--- drivers/net/intel/common/tx_scalar_fns.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/intel/common/tx_scalar_fns.h +1 -1
@@ -272,7 +272,7 @@ ci_xmit_pkts(struct ci_tx_queue *txq,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 (unlikely (nb_used > txq->nb_tx_free)) {if (ci_tx_xmit_cleanup (txq) !=0 ) {if (nb_tx ==0 )return 0 ;
Signature · 1 line
2.51.0
PATCH v2 24/36 net/intel: add special handling for single desc packets
In reply to Bruce RichardsonWithin the scalar packets, add a shortcut path for packets that don't use TSO and have only a single data descriptor.
--- drivers/net/intel/common/tx_scalar_fns.h | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/net/intel/common/tx_scalar_fns.h +26 -0
@@ -304,6 +304,31 @@ ci_xmit_pkts(struct ci_tx_queue *txq,ci_txd_enable_checksum (ol_flags, &td_cmd, &td_offset, tx_offload); +/* special case for single descriptor packet, without TSO offload */ +if (nb_used ==1 && + (ol_flags & (RTE_MBUF_F_TX_TCP_SEG |RTE_MBUF_F_TX_UDP_SEG )) ==0 ) { + txd = &ci_tx_ring[tx_id]; + tx_id = txe->next_id; + +if (txe->mbuf) +rte_pktmbuf_free_seg (txe->mbuf); + *txe = (struct ci_tx_entry ){ + .mbuf = tx_pkt, .last_id = tx_last, .next_id = tx_id + }; + +/* Setup TX Descriptor */ + td_cmd |=CI_TX_DESC_CMD_EOP ; +const uint64_t cmd_type_offset_bsz =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 )tx_pkt->data_len <<CI_TXD_QW1_TX_BUF_SZ_S ) | + ((uint64_t )td_tag <<CI_TXD_QW1_L2TAG1_S ); +write_txd (txd,rte_mbuf_data_iova (tx_pkt), cmd_type_offset_bsz); + + txe = &sw_ring[tx_id]; + goto end_pkt; + } +if (nb_ctx) {/* Setup TX context descriptor if required */ uint64_t *ctx_txd = RTE_CAST_PTR(uint64_t *, &ci_tx_ring[tx_id]);
@@ -395,6 +420,7 @@ ci_xmit_pkts(struct ci_tx_queue *txq, txe = txn; 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);
Signature · 1 line
2.51.0