DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Soumyadeep Hore <soumyadeep.hore@intel.com>
Cc: <dev@dpdk.org>, <aman.deep.singh@intel.com>,
	<manoj.kumar.subbarao@intel.com>
Subject: Re: [PATCH v3 5/6] net/intel: add AVX512 Support for TxPP
Date: Mon, 9 Jun 2025 16:21:10 +0100	[thread overview]
Message-ID: <aEb75roiohANCGHW@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <20250608113223.487043-6-soumyadeep.hore@intel.com>

On Sun, Jun 08, 2025 at 11:32:22AM +0000, Soumyadeep Hore wrote:
> Tx Time based queues are supported using AVX512 vector.
> 
> Signed-off-by: Soumyadeep Hore <soumyadeep.hore@intel.com>
> ---

This looks to have a lot of duplicated code compared to the AVX2 version,
can they be merged?

/Bruce

>  drivers/net/intel/ice/ice_rxtx_vec_avx512.c | 206 +++++++++++++++++++-
>  1 file changed, 205 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/intel/ice/ice_rxtx_vec_avx512.c b/drivers/net/intel/ice/ice_rxtx_vec_avx512.c
> index bd49be07c9..394cd15a71 100644
> --- a/drivers/net/intel/ice/ice_rxtx_vec_avx512.c
> +++ b/drivers/net/intel/ice/ice_rxtx_vec_avx512.c
> @@ -912,6 +912,200 @@ ice_vtx(volatile struct ice_tx_desc *txdp, struct rte_mbuf **pkt,
>  	}
>  }
>  
> +static __rte_always_inline void
> +ice_vts1(volatile struct ice_ts_desc *ts, struct rte_mbuf *pkt,
> +		uint16_t tx_tail, uint16_t nb_tx_desc, int ts_offset)
> +{
> +	ts->tx_desc_idx_tstamp = ice_get_ts_queue_desc(pkt,
> +						tx_tail, nb_tx_desc, ts_offset);
> +}
> +
> +static __rte_always_inline void
> +ice_vts4(volatile struct ice_ts_desc *ts, struct rte_mbuf **pkt,
> +	uint16_t nb_pkts, uint16_t tx_tail, uint16_t nb_tx_desc,
> +	int ts_offset)
> +{
> +	uint16_t tx_id;
> +
> +	for (; nb_pkts > 3; ts += 4, pkt += 4, nb_pkts -= 4,
> +			tx_tail += 4) {
> +		tx_id = tx_tail + 4;
> +		uint32_t ts_dsc3 = ice_get_ts_queue_desc(pkt[3],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 3;
> +		uint32_t ts_dsc2 = ice_get_ts_queue_desc(pkt[2],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 2;
> +		uint32_t ts_dsc1 = ice_get_ts_queue_desc(pkt[1],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 1;
> +		uint32_t ts_dsc0 = ice_get_ts_queue_desc(pkt[0],
> +						tx_id, nb_tx_desc, ts_offset);
> +		__m128i desc0_3 = _mm_set_epi32(ts_dsc3, ts_dsc2,
> +						ts_dsc1, ts_dsc0);
> +		_mm_store_si128(RTE_CAST_PTR(void *, ts), desc0_3);
> +	}
> +
> +	/* do any last ones */
> +	while (nb_pkts) {
> +		tx_tail++;
> +		ice_vts1(ts, *pkt, tx_tail, nb_tx_desc, ts_offset);
> +		ts++, pkt++, nb_pkts--;
> +	}
> +}
> +
> +static __rte_always_inline void
> +ice_vts8(volatile struct ice_ts_desc *ts, struct rte_mbuf **pkt,
> +	uint16_t nb_pkts, uint16_t tx_tail, uint16_t nb_tx_desc,
> +	int ts_offset)
> +{
> +	uint16_t tx_id;
> +
> +	for (; nb_pkts > 7; ts += 8, pkt += 8, nb_pkts -= 8,
> +			tx_tail += 8) {
> +		tx_id = tx_tail + 8;
> +		uint32_t ts_dsc7 = ice_get_ts_queue_desc(pkt[7],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 7;
> +		uint32_t ts_dsc6 = ice_get_ts_queue_desc(pkt[6],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 6;
> +		uint32_t ts_dsc5 = ice_get_ts_queue_desc(pkt[5],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 5;
> +		uint32_t ts_dsc4 = ice_get_ts_queue_desc(pkt[4],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 4;
> +		uint32_t ts_dsc3 = ice_get_ts_queue_desc(pkt[3],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 3;
> +		uint32_t ts_dsc2 = ice_get_ts_queue_desc(pkt[2],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 2;
> +		uint32_t ts_dsc1 = ice_get_ts_queue_desc(pkt[1],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 1;
> +		uint32_t ts_dsc0 = ice_get_ts_queue_desc(pkt[0],
> +						tx_id, nb_tx_desc, ts_offset);
> +		__m256i desc0_7 = _mm256_set_epi32(ts_dsc7, ts_dsc6,
> +						ts_dsc5, ts_dsc4, ts_dsc3, ts_dsc2,
> +						ts_dsc1, ts_dsc0);
> +		_mm256_storeu_si256(RTE_CAST_PTR(void *, ts), desc0_7);
> +	}
> +
> +	/* do any last ones */
> +	if (nb_pkts)
> +		ice_vts4(ts, pkt, nb_pkts, tx_tail, nb_tx_desc,
> +				ts_offset);
> +}
> +
> +static __rte_always_inline void
> +ice_vts(volatile struct ice_ts_desc *ts, struct rte_mbuf **pkt,
> +	uint16_t nb_pkts, uint16_t tx_tail, uint16_t nb_tx_desc,
> +	int ts_offset)
> +{
> +	uint16_t tx_id;
> +
> +	for (; nb_pkts > 15; ts += 16, pkt += 16, nb_pkts -= 16,
> +			tx_tail += 16) {
> +		tx_id = tx_tail + 16;
> +		uint32_t ts_dsc15 = ice_get_ts_queue_desc(pkt[15],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 15;
> +		uint32_t ts_dsc14 = ice_get_ts_queue_desc(pkt[14],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 14;
> +		uint32_t ts_dsc13 = ice_get_ts_queue_desc(pkt[13],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 13;
> +		uint32_t ts_dsc12 = ice_get_ts_queue_desc(pkt[12],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 12;
> +		uint32_t ts_dsc11 = ice_get_ts_queue_desc(pkt[11],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 11;
> +		uint32_t ts_dsc10 = ice_get_ts_queue_desc(pkt[10],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 10;
> +		uint32_t ts_dsc9 = ice_get_ts_queue_desc(pkt[9],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 9;
> +		uint32_t ts_dsc8 = ice_get_ts_queue_desc(pkt[8],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 8;
> +		uint32_t ts_dsc7 = ice_get_ts_queue_desc(pkt[7],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 7;
> +		uint32_t ts_dsc6 = ice_get_ts_queue_desc(pkt[6],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 6;
> +		uint32_t ts_dsc5 = ice_get_ts_queue_desc(pkt[5],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 5;
> +		uint32_t ts_dsc4 = ice_get_ts_queue_desc(pkt[4],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 4;
> +		uint32_t ts_dsc3 = ice_get_ts_queue_desc(pkt[3],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 3;
> +		uint32_t ts_dsc2 = ice_get_ts_queue_desc(pkt[2],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 2;
> +		uint32_t ts_dsc1 = ice_get_ts_queue_desc(pkt[1],
> +						tx_id, nb_tx_desc, ts_offset);
> +		tx_id = tx_tail + 1;
> +		uint32_t ts_dsc0 = ice_get_ts_queue_desc(pkt[0],
> +						tx_id, nb_tx_desc, ts_offset);
> +		__m512i desc0_15 = _mm512_set_epi32(ts_dsc15, ts_dsc14,
> +						ts_dsc13, ts_dsc12, ts_dsc11, ts_dsc10,
> +						ts_dsc9, ts_dsc8, ts_dsc7, ts_dsc6,
> +						ts_dsc5, ts_dsc4, ts_dsc3, ts_dsc2,
> +						ts_dsc1, ts_dsc0);
> +		_mm512_storeu_si512(RTE_CAST_PTR(void *, ts), desc0_15);
> +	}
> +
> +	/* do any last ones */
> +	if (nb_pkts)
> +		ice_vts8(ts, pkt, nb_pkts, tx_tail, nb_tx_desc,
> +				ts_offset);
> +}
> +
> +static __rte_always_inline uint16_t
> +ice_xmit_fixed_ts_burst_vec_avx512(struct ci_tx_queue *txq,
> +				struct rte_mbuf **tx_pkts, uint16_t nb_pkts,
> +				uint16_t tx_tail)
> +{
> +	volatile struct ice_ts_desc *ts;
> +	uint16_t n;
> +	uint16_t ts_id;
> +	uint16_t fetch;
> +
> +	ts_id = txq->tsq.ts_tail;
> +	ts = &txq->tsq.ice_ts_ring[ts_id];
> +
> +	n = (uint16_t)(txq->tsq.nb_ts_desc - ts_id);
> +	if (nb_pkts >= n) {
> +		ice_vts(ts, tx_pkts, n, txq->tx_tail, txq->nb_tx_desc,
> +				txq->tsq.ts_offset);
> +		tx_pkts += n;
> +		ts += n;
> +		tx_tail += n;
> +		nb_pkts = (uint16_t)(nb_pkts - n);
> +		ts_id = 0;
> +		ts = &txq->tsq.ice_ts_ring[ts_id];
> +		fetch = txq->tsq.nb_ts_desc - txq->nb_tx_desc;
> +		for (; ts_id < fetch; ts_id++, ts++)
> +			ice_vts1(ts, *tx_pkts, tx_tail + 1,
> +					txq->nb_tx_desc, txq->tsq.ts_offset);
> +	}
> +
> +	ice_vts(ts, tx_pkts, nb_pkts, tx_tail, txq->nb_tx_desc,
> +			txq->tsq.ts_offset);
> +	ts_id = (uint16_t)(ts_id + nb_pkts);
> +
> +	return ts_id;
> +}
> +
>  static __rte_always_inline uint16_t
>  ice_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
>  				uint16_t nb_pkts, bool do_offload)
> @@ -920,6 +1114,7 @@ ice_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
>  	volatile struct ice_tx_desc *txdp;
>  	struct ci_tx_entry_vec *txep;
>  	uint16_t n, nb_commit, tx_id;
> +	uint16_t ts_id = -1;
>  	uint64_t flags = ICE_TD_CMD;
>  	uint64_t rs = ICE_TX_DESC_CMD_RS | ICE_TD_CMD;
>  
> @@ -940,6 +1135,10 @@ ice_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
>  
>  	txq->nb_tx_free = (uint16_t)(txq->nb_tx_free - nb_pkts);
>  
> +	if (txq->tsq.ts_flag > 0)
> +		ts_id = ice_xmit_fixed_ts_burst_vec_avx512(txq,
> +								tx_pkts, nb_commit, tx_id);
> +
>  	n = (uint16_t)(txq->nb_tx_desc - tx_id);
>  	if (nb_commit >= n) {
>  		ci_tx_backlog_entry_vec(txep, tx_pkts, n);
> @@ -975,7 +1174,12 @@ ice_xmit_fixed_burst_vec_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
>  
>  	txq->tx_tail = tx_id;
>  
> -	ICE_PCI_REG_WC_WRITE(txq->qtx_tail, txq->tx_tail);
> +	if (txq->tsq.ts_flag > 0) {
> +		ICE_PCI_REG_WC_WRITE(txq->qtx_tail, ts_id);
> +		txq->tsq.ts_tail = ts_id;
> +	} else {
> +		ICE_PCI_REG_WC_WRITE(txq->qtx_tail, txq->tx_tail);
> +	}
>  
>  	return nb_pkts;
>  }
> -- 
> 2.43.0
> 

  reply	other threads:[~2025-06-09 15:21 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-06 21:19 [PATCH v1 0/6] Add TxPP Support for E830 Soumyadeep Hore
2025-06-06 21:19 ` [PATCH v1 1/6] net/intel: update E830 Tx Time Queue Context Structure Soumyadeep Hore
2025-06-07 17:08   ` [PATCH v2 0/6] Add TxPP Support for E830 Soumyadeep Hore
2025-06-07 17:08     ` [PATCH v2 1/6] net/intel: update E830 Tx Time Queue Context Structure Soumyadeep Hore
2025-06-07 17:09     ` [PATCH v2 2/6] net/intel: add read clock feature in ICE Soumyadeep Hore
2025-06-07 17:09     ` [PATCH v2 3/6] net/intel: add TxPP Support for E830 Soumyadeep Hore
2025-06-07 17:09     ` [PATCH v2 4/6] net/intel: add AVX2 Support for TxPP Soumyadeep Hore
2025-06-07 17:09     ` [PATCH v2 5/6] net/intel: add AVX512 " Soumyadeep Hore
2025-06-07 17:09     ` [PATCH v2 6/6] doc: announce TxPP support for E830 adapters Soumyadeep Hore
2025-06-08 11:32   ` [PATCH v3 0/6] Add TxPP Support for E830 Soumyadeep Hore
2025-06-08 11:32     ` [PATCH v3 1/6] net/intel: update E830 Tx Time Queue Context Structure Soumyadeep Hore
2025-06-08 11:32     ` [PATCH v3 2/6] net/intel: add read clock feature in ICE Soumyadeep Hore
2025-06-09 13:57       ` Bruce Richardson
2025-06-10 11:50         ` Hore, Soumyadeep
2025-06-08 11:32     ` [PATCH v3 3/6] net/intel: add TxPP Support for E830 Soumyadeep Hore
2025-06-09 12:52       ` Bruce Richardson
2025-06-10 11:47         ` Hore, Soumyadeep
2025-06-09 14:39       ` Bruce Richardson
2025-06-10 11:53         ` Hore, Soumyadeep
2025-06-08 11:32     ` [PATCH v3 4/6] net/intel: add AVX2 Support for TxPP Soumyadeep Hore
2025-06-09 15:19       ` Bruce Richardson
2025-06-08 11:32     ` [PATCH v3 5/6] net/intel: add AVX512 " Soumyadeep Hore
2025-06-09 15:21       ` Bruce Richardson [this message]
2025-06-08 11:32     ` [PATCH v3 6/6] doc: announce TxPP support for E830 adapters Soumyadeep Hore
2025-06-09 13:38       ` Bruce Richardson
2025-06-10 13:11   ` [PATCH v4 0/6] Add TxPP Support for E830 Soumyadeep Hore
2025-06-10 13:11     ` [PATCH v4 1/6] net/intel: update E830 Tx Time Queue Context Structure Soumyadeep Hore
2025-06-10 13:11     ` [PATCH v4 2/6] net/intel: add read clock feature in ICE Soumyadeep Hore
2025-06-10 13:11     ` [PATCH v4 3/6] net/intel: add TxPP Support for E830 Soumyadeep Hore
2025-06-10 13:11     ` [PATCH v4 4/6] net/intel: add AVX2 Support for TxPP Soumyadeep Hore
2025-06-10 13:11     ` [PATCH v4 5/6] net/intel: add AVX512 " Soumyadeep Hore
2025-06-10 13:11     ` [PATCH v4 6/6] doc: announce TxPP support for E830 adapters Soumyadeep Hore
2025-06-06 21:19 ` [PATCH v1 2/6] net/intel: add read clock feature in ICE Soumyadeep Hore
2025-06-06 21:19 ` [PATCH v1 3/6] net/intel: add TxPP Support for E830 Soumyadeep Hore
2025-06-06 21:19 ` [PATCH v1 4/6] net/intel: add AVX2 Support for TxPP Soumyadeep Hore
2025-06-06 21:19 ` [PATCH v1 5/6] net/intel: add AVX512 " Soumyadeep Hore
2025-06-06 21:19 ` [PATCH v1 6/6] doc: announce TxPP support for E830 adapters Soumyadeep Hore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aEb75roiohANCGHW@bricha3-mobl1.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=manoj.kumar.subbarao@intel.com \
    --cc=soumyadeep.hore@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).