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

Bruce Richardson
2026-02-09T10:44:08Z

On Fri, Feb 06, 2026 at 10:14:15AM +0000, Loftus, Ciara wrote:
>
>
> > -----Original Message-----
> > From: Bruce Richardson <bruce.richardson@intel.com>
> > Sent: Friday 30 January 2026 11:42
> > To: dev@dpdk.org
> > Cc: Richardson, Bruce <bruce.richardson@intel.com>; Medvedkin, Vladimir
> > <vladimir.medvedkin@intel.com>; Burakov, Anatoly
> > <anatoly.burakov@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Shetty,
> > Praveen <praveen.shetty@intel.com>
> > Subject: [PATCH v3 04/36] net/intel: consolidate definitions for Tx desc fields
> >
> > The offsets of the various fields within the Tx descriptors are common
> > for i40e, iavf, ice and idpf, so put a single set of defines in tx.h and
> > use those throughout all drivers. (NOTE: there was a small difference in
> > mask of CMD field between drivers depending on whether reserved fields
> > or not were included. Those can be ignored as those bits are unused in
> > the drivers for which they are reserved). Similarly, the various flag
> > fields, such as End-of-packet (EOP) and Report-status (RS) are the same,
> > as are offload definitions so consolidate them.
> >
> > Original definitions are in base code, and are left in place because of
> > that, but are unused.
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> > 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(-)
> >
> > diff --git a/drivers/net/intel/common/tx.h b/drivers/net/intel/common/tx.h
> > index a89412c195..03245d4fba 100644
> > --- a/drivers/net/intel/common/tx.h
> > +++ b/drivers/net/intel/common/tx.h
> > @@ -10,6 +10,66 @@
> > #include <rte_ethdev.h>
> > #include <rte_vect.h>
> >
> > +/* Common TX Descriptor QW1 Field Definitions */
> > +#define CI_TXD_QW1_DTYPE_S 0
> > +#define CI_TXD_QW1_DTYPE_M (0xFUL << CI_TXD_QW1_DTYPE_S)
> > +#define CI_TXD_QW1_CMD_S 4
> > +#define CI_TXD_QW1_CMD_M (0xFFFUL << CI_TXD_QW1_CMD_S)
>
> This define is unused in the series.
>

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

> > +#define CI_TXD_QW1_OFFSET_S 16
> > +#define CI_TXD_QW1_OFFSET_M (0x3FFFFULL <<
> > CI_TXD_QW1_OFFSET_S)
> > +#define CI_TXD_QW1_TX_BUF_SZ_S 34
> > +#define CI_TXD_QW1_TX_BUF_SZ_M (0x3FFFULL <<
> > CI_TXD_QW1_TX_BUF_SZ_S)
> > +#define CI_TXD_QW1_L2TAG1_S 48
> > +#define CI_TXD_QW1_L2TAG1_M (0xFFFFULL << CI_TXD_QW1_L2TAG1_S)
> > +
> > +/* Common Descriptor Types */
> > +#define CI_TX_DESC_DTYPE_DATA 0x0
> > +#define CI_TX_DESC_DTYPE_CTX 0x1
>
> This define is also unused, although there is scope to use it in
> patch 7 net/ice: refactor context descriptor handling
>

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

> > +#define CI_TX_DESC_DTYPE_DESC_DONE 0xF
> > +
> > +/* Common TX Descriptor Command Flags */
> > +#define CI_TX_DESC_CMD_EOP 0x0001
> > +#define CI_TX_DESC_CMD_RS 0x0002
> > +#define CI_TX_DESC_CMD_ICRC 0x0004
> > +#define CI_TX_DESC_CMD_IL2TAG1 0x0008
> > +#define CI_TX_DESC_CMD_DUMMY 0x0010
> > +#define CI_TX_DESC_CMD_IIPT_IPV6 0x0020
> > +#define CI_TX_DESC_CMD_IIPT_IPV4 0x0040
> > +#define CI_TX_DESC_CMD_IIPT_IPV4_CSUM 0x0060
> > +#define CI_TX_DESC_CMD_L4T_EOFT_TCP 0x0100
> > +#define CI_TX_DESC_CMD_L4T_EOFT_SCTP 0x0200
> > +#define CI_TX_DESC_CMD_L4T_EOFT_UDP 0x0300
> > +
> > +/* Common TX Context Descriptor Commands */
> > +#define CI_TX_CTX_DESC_TSO 0x01
> > +#define CI_TX_CTX_DESC_TSYN 0x02
> > +#define CI_TX_CTX_DESC_IL2TAG2 0x04
> > +
> > +/* Common TX Descriptor Length Field Shifts */
> > +#define CI_TX_DESC_LEN_MACLEN_S 0 /* 7 BITS */
> > +#define CI_TX_DESC_LEN_IPLEN_S 7 /* 7 BITS */
> > +#define CI_TX_DESC_LEN_L4_LEN_S 14 /* 4 BITS */
> > +
> > +/* Common maximum data per TX descriptor */
> > +#define CI_MAX_DATA_PER_TXD (CI_TXD_QW1_TX_BUF_SZ_M >>
> > CI_TXD_QW1_TX_BUF_SZ_S)
> > +
> > +/**
> > + * Common TX offload union for Intel drivers.
> > + * Supports both basic offloads (l2_len, l3_len, l4_len, tso_segsz) and
> > + * extended offloads (outer_l2_len, outer_l3_len) for tunneling support.
> > + */
> > +union ci_tx_offload {
> > + uint64_t data;
> > + struct {
> > + uint64_t l2_len:7; /**< L2 (MAC) Header Length. */
> > + uint64_t l3_len:9; /**< L3 (IP) Header Length. */
> > + uint64_t l4_len:8; /**< L4 Header Length. */
> > + uint64_t tso_segsz:16; /**< TCP TSO segment size */
> > + uint64_t outer_l2_len:8; /**< outer L2 Header Length */
> > + uint64_t outer_l3_len:16; /**< outer L3 Header Length */
> > + };
> > +};
> > +
> > /*
> > * Structure of a 16-byte Tx descriptor common across i40e, ice, iavf and idpf
> > drivers
> > */
> > @@ -286,8 +346,8 @@ ci_tx_xmit_cleanup(struct ci_tx_queue *txq)
> > desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
> >
> > /* Check if descriptor is done - all drivers use 0xF as done value in bits
> > 3:0 */
>
> I think this comment referencing 0xF is out of place now that we're not using 0xF
> rather CI_TX_DESC_DTYPE_DESC_DONE in the code below.
>

Ack. Will look to update.

/Bruce