DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gagandeep Singh <G.Singh@nxp.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Hemant Agrawal <hemant.agrawal@nxp.com>,
	Sachin Saxena <sachin.saxena@nxp.com>
Subject: RE: [PATCH v6 6/6] net/dpaa2: enable software taildrop for ordered queues
Date: Tue, 1 Jul 2025 04:10:28 +0000	[thread overview]
Message-ID: <AS8PR04MB819822BAF3FA72E9C5FCA6FDE141A@AS8PR04MB8198.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20250630081211.6fd6793b@hermes.local>

Hi,

> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Monday, June 30, 2025 8:42 PM
> To: Gagandeep Singh <G.Singh@nxp.com>
> Cc: dev@dpdk.org; Hemant Agrawal <hemant.agrawal@nxp.com>; Sachin
> Saxena <sachin.saxena@nxp.com>
> Subject: Re: [PATCH v6 6/6] net/dpaa2: enable software taildrop for ordered
> queues
> 
> On Mon, 30 Jun 2025 15:28:00 +0530
> Gagandeep Singh <g.singh@nxp.com> wrote:
> 
> > This patch adds support for software taildrop on ordered queues in the
> > DPAA2 driver.
> > It also enables congestion notification by default on traffic
> > management (TM) queues,  which is a prerequisite for software taildrop
> > functionality.
> >
> > Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> > ---
> >  doc/guides/rel_notes/release_25_07.rst |  1 +
> >  drivers/net/dpaa2/dpaa2_rxtx.c         | 24 ++++++++++-
> >  drivers/net/dpaa2/dpaa2_tm.c           | 60 +++++++++++++-------------
> >  3 files changed, 53 insertions(+), 32 deletions(-)
> >
> > diff --git a/doc/guides/rel_notes/release_25_07.rst
> > b/doc/guides/rel_notes/release_25_07.rst
> > index 53a1c8756d..dd8bc74946 100644
> > --- a/doc/guides/rel_notes/release_25_07.rst
> > +++ b/doc/guides/rel_notes/release_25_07.rst
> > @@ -163,6 +163,7 @@ New Features
> >  * **Updated DPAA2 ethernet driver.**
> >
> >    * Added DPBP APIs for setting mempool depletion thresholds.
> > +  * Enabled software taildrop for ordered queues.
> >
> >  Removed Items
> >  -------------
> > diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c
> > b/drivers/net/dpaa2/dpaa2_rxtx.c index 67d065bb7c..dce1da80bb
> 100644
> > --- a/drivers/net/dpaa2/dpaa2_rxtx.c
> > +++ b/drivers/net/dpaa2/dpaa2_rxtx.c
> > @@ -1800,8 +1800,11 @@ dpaa2_dev_tx_ordered(void *queue, struct
> rte_mbuf **bufs, uint16_t nb_pkts)
> >  		while (qbman_result_SCN_state(dpaa2_q->cscn)) {
> >  			retry_count++;
> >  			/* Retry for some time before giving up */
> > -			if (retry_count > CONG_RETRY_COUNT)
> > +			if (retry_count > CONG_RETRY_COUNT) {
> > +				if (dpaa2_q->tm_sw_td)
> > +					goto sw_td;
> >  				goto skip_tx;
> > +			}
> >  		}
> >
> >  		frames_to_send = (nb_pkts > dpaa2_eqcr_size) ?
> > @@ -1961,6 +1964,25 @@ dpaa2_dev_tx_ordered(void *queue, struct
> rte_mbuf **bufs, uint16_t nb_pkts)
> >  			rte_pktmbuf_free_seg(buf_to_free[loop].seg);
> >  	}
> >
> > +	return num_tx;
> > +sw_td:
> > +	loop = 0;
> > +	while (loop < num_tx) {
> > +		if (unlikely(RTE_MBUF_HAS_EXTBUF(*bufs)))
> > +			rte_pktmbuf_free(*bufs);
> > +		bufs++;
> > +		loop++;
> > +	}
> 
> This looks like a possible bug.
> Is there a double free here if there are external buffers.
No, This while loop scanning the buffers which are already transmitted and freeing the external buffers. All non-external buffers will be freed by HW itself.
The function is already maintaining the " buf_to_free " so I will update this code to free from "buf_to_free" to avoid any read from already freed buffer.
Thanks.

> > +
> > +	/* free the pending buffers */
> > +	while (nb_pkts) {
> > +		rte_pktmbuf_free(*bufs);
> > +		bufs++;
> > +		nb_pkts--;
> > +		num_tx++;
> > +	}
> 
> Why not use rte_pktmbuf_free_bulk here?
You are right, I will change it to rte_pktmbuf_free_bulk.
> 
> > +	dpaa2_q->tx_pkts += num_tx;
> > +
> >  	return num_tx;
> >  }
> >
> > diff --git a/drivers/net/dpaa2/dpaa2_tm.c
> > b/drivers/net/dpaa2/dpaa2_tm.c index dbf66c756e..36e815c356 100644
> > --- a/drivers/net/dpaa2/dpaa2_tm.c
> > +++ b/drivers/net/dpaa2/dpaa2_tm.c
> > @@ -611,41 +611,39 @@ dpaa2_tm_configure_queue(struct rte_eth_dev
> *dev, struct dpaa2_tm_node *node)
> >  	}
> >  	dpaa2_q->fqid = qid.fqid;
> >
> > -	/* setting congestion notification */
> > -	if (!(priv->flags & DPAA2_TX_CGR_OFF)) {
> > -		struct dpni_congestion_notification_cfg cong_notif_cfg = {0};
> > -
> > -		cong_notif_cfg.units = DPNI_CONGESTION_UNIT_FRAMES;
> > -		cong_notif_cfg.threshold_entry = dpaa2_q->nb_desc;
> > -		/* Notify that the queue is not congested when the data in
> > -		 * the queue is below this thershold.(90% of value)
> > -		 */
> > -		cong_notif_cfg.threshold_exit = (dpaa2_q->nb_desc * 9) /
> 10;
> > -		cong_notif_cfg.message_ctx = 0;
> > -		iova = DPAA2_VADDR_TO_IOVA_AND_CHECK(dpaa2_q->cscn,
> > -				sizeof(struct qbman_result));
> > -		if (iova == RTE_BAD_IOVA) {
> > -			DPAA2_PMD_ERR("No IOMMU map for cscn(%p)",
> dpaa2_q->cscn);
> > -			return -ENOBUFS;
> > -		}
> > -		cong_notif_cfg.message_iova = iova;
> > -		cong_notif_cfg.dest_cfg.dest_type = DPNI_DEST_NONE;
> > -		cong_notif_cfg.notification_mode =
> > +	/* setting taildrop through congestion notification */
> > +	struct dpni_congestion_notification_cfg cong_notif_cfg = {0};
> > +
> > +	cong_notif_cfg.units = DPNI_CONGESTION_UNIT_FRAMES;
> > +	cong_notif_cfg.threshold_entry = dpaa2_q->nb_desc;
> > +	/* Notify that the queue is not congested when the data in
> > +	 * the queue is below this thershold.(90% of value)
> > +	 */
> > +	cong_notif_cfg.threshold_exit = (dpaa2_q->nb_desc * 9) / 10;
> > +	cong_notif_cfg.message_ctx = 0;
> > +
> > +	iova = DPAA2_VADDR_TO_IOVA_AND_CHECK(dpaa2_q->cscn,
> > +			sizeof(struct qbman_result));
> > +	if (iova == RTE_BAD_IOVA) {
> > +		DPAA2_PMD_ERR("No IOMMU map for cscn(%p)", dpaa2_q-
> >cscn);
> > +		return -ENOBUFS;
> > +	}
> > +	cong_notif_cfg.message_iova = iova;
> > +	cong_notif_cfg.dest_cfg.dest_type = DPNI_DEST_NONE;
> > +	cong_notif_cfg.notification_mode =
> >
> 	DPNI_CONG_OPT_WRITE_MEM_ON_ENTER |
> >
> 	DPNI_CONG_OPT_WRITE_MEM_ON_EXIT |
> >
> 	DPNI_CONG_OPT_COHERENT_WRITE;
> > -		cong_notif_cfg.cg_point = DPNI_CP_QUEUE;
> > +	cong_notif_cfg.cg_point = DPNI_CP_QUEUE;
> >
> > -		ret = dpni_set_congestion_notification(dpni, CMD_PRI_LOW,
> > -					priv->token,
> > -					DPNI_QUEUE_TX,
> > -					((node->parent->channel_id << 8) |
> tc_id),
> > -					&cong_notif_cfg);
> > -		if (ret) {
> > -			DPAA2_PMD_ERR("Error in setting tx congestion
> notification: "
> > -				"err=%d", ret);
> > -			return -ret;
> > -		}
> > +	ret = dpni_set_congestion_notification(dpni, CMD_PRI_LOW,
> > +			priv->token, DPNI_QUEUE_TX,
> > +			((node->parent->channel_id << 8) | tc_id),
> > +			&cong_notif_cfg);
> > +	if (ret) {
> > +		DPAA2_PMD_ERR("Error in setting tx congestion notification:
> "
> > +			"err=%d", ret);
> > +		return -ret;
> >  	}
> >  	dpaa2_q->tm_sw_td = true;
> >


  reply	other threads:[~2025-07-01  4:10 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-30  7:13 [PATCH 00/11] NXP DPAA2 driver enhancements and fixes Gagandeep Singh
2025-05-30  7:13 ` [PATCH 01/11] net/dpaa2: fix issue of extract buffer preparation Gagandeep Singh
2025-05-30  7:13 ` [PATCH 02/11] net/dpaa2: fix shaper rate Gagandeep Singh
2025-05-30  7:13 ` [PATCH 03/11] bus/fslmc: add DPBP APIs for setting depletion thresholds Gagandeep Singh
2025-05-30  7:13 ` [PATCH 04/11] mempool/dpaa2: use unified VA to IOVA conversion Gagandeep Singh
2025-05-30  7:13 ` [PATCH 05/11] net/dpaa2: add dpmac MC header file Gagandeep Singh
2025-05-30  7:13 ` [PATCH 06/11] net/dpaa2: support dpmac counters in stats Gagandeep Singh
2025-05-30  7:13 ` [PATCH 07/11] net/dpaa2: support dpmac Tx stats Gagandeep Singh
2025-05-30  7:13 ` [PATCH 08/11] net/dpaa2: support dpmac Tx stats in xstats Gagandeep Singh
2025-05-30  7:13 ` [PATCH 09/11] net/dpaa2: retrieve DPNI API version at init time Gagandeep Singh
2025-05-30  7:13 ` [PATCH 10/11] net/dpaa2: setup the speed cap based on the actual MAC Gagandeep Singh
2025-05-30  7:13 ` [PATCH 11/11] net/dpaa2: enable software taildrop for ordered queues Gagandeep Singh
2025-06-02 10:40 ` [PATCH v2 00/11] NXP DPAA2 driver enhancements and fixes Gagandeep Singh
2025-06-02 10:40   ` [PATCH v2 01/11] net/dpaa2: fix issue of extract buffer preparation Gagandeep Singh
2025-06-02 10:40   ` [PATCH v2 02/11] net/dpaa2: fix shaper rate Gagandeep Singh
2025-06-02 10:40   ` [PATCH v2 03/11] bus/fslmc: add DPBP APIs for setting depletion thresholds Gagandeep Singh
2025-06-02 10:40   ` [PATCH v2 04/11] mempool/dpaa2: use unified VA to IOVA conversion Gagandeep Singh
2025-06-02 10:40   ` [PATCH v2 05/11] net/dpaa2: add dpmac MC header file Gagandeep Singh
2025-06-04 20:01     ` Stephen Hemminger
2025-06-02 10:40   ` [PATCH v2 06/11] net/dpaa2: support dpmac counters in stats Gagandeep Singh
2025-06-02 10:40   ` [PATCH v2 07/11] net/dpaa2: support dpmac Tx stats Gagandeep Singh
2025-06-02 10:40   ` [PATCH v2 08/11] net/dpaa2: support dpmac Tx stats in xstats Gagandeep Singh
2025-06-02 10:40   ` [PATCH v2 09/11] net/dpaa2: retrieve DPNI API version at init time Gagandeep Singh
2025-06-02 10:40   ` [PATCH v2 10/11] net/dpaa2: setup the speed cap based on the actual MAC Gagandeep Singh
2025-06-02 10:40   ` [PATCH v2 11/11] net/dpaa2: enable software taildrop for ordered queues Gagandeep Singh
2025-06-09  2:54   ` [PATCH v3 00/11] NXP DPAA2 driver enhancements and fixes Gagandeep Singh
2025-06-09  2:54     ` [PATCH v3 01/11] net/dpaa2: fix issue of extract buffer preparation Gagandeep Singh
2025-06-09  2:54     ` [PATCH v3 02/11] net/dpaa2: fix shaper rate Gagandeep Singh
2025-06-09  2:54     ` [PATCH v3 03/11] bus/fslmc: add DPBP APIs for setting depletion thresholds Gagandeep Singh
2025-06-09  2:54     ` [PATCH v3 04/11] mempool/dpaa2: use unified VA to IOVA conversion Gagandeep Singh
2025-06-09  2:54     ` [PATCH v3 05/11] net/dpaa2: add dpmac MC header file Gagandeep Singh
2025-06-09  2:54     ` [PATCH v3 06/11] net/dpaa2: support dpmac counters in stats Gagandeep Singh
2025-06-09  2:54     ` [PATCH v3 07/11] net/dpaa2: support dpmac Tx stats Gagandeep Singh
2025-06-09  2:54     ` [PATCH v3 08/11] net/dpaa2: support dpmac Tx stats in xstats Gagandeep Singh
2025-06-09  2:54     ` [PATCH v3 09/11] net/dpaa2: retrieve DPNI API version at init time Gagandeep Singh
2025-06-09  2:54     ` [PATCH v3 10/11] net/dpaa2: setup the speed cap based on the actual MAC Gagandeep Singh
2025-06-09  2:54     ` [PATCH v3 11/11] net/dpaa2: enable software taildrop for ordered queues Gagandeep Singh
2025-06-11 10:51     ` [PATCH v4 00/11] NXP DPAA2 driver enhancements and fixes Gagandeep Singh
2025-06-11 10:51       ` [PATCH v4 01/11] net/dpaa2: fix issue of extract buffer preparation Gagandeep Singh
2025-06-11 10:51       ` [PATCH v4 02/11] net/dpaa2: fix shaper rate Gagandeep Singh
2025-06-11 10:51       ` [PATCH v4 03/11] bus/fslmc: add DPBP APIs for setting depletion thresholds Gagandeep Singh
2025-06-11 10:51       ` [PATCH v4 04/11] mempool/dpaa2: use unified VA to IOVA conversion Gagandeep Singh
2025-06-11 10:51       ` [PATCH v4 05/11] net/dpaa2: add dpmac MC header file Gagandeep Singh
2025-06-11 10:51       ` [PATCH v4 06/11] net/dpaa2: support dpmac counters in stats Gagandeep Singh
2025-06-11 10:51       ` [PATCH v4 07/11] net/dpaa2: support dpmac Tx stats Gagandeep Singh
2025-06-11 16:50         ` Stephen Hemminger
2025-06-11 10:51       ` [PATCH v4 08/11] net/dpaa2: support dpmac Tx stats in xstats Gagandeep Singh
2025-06-11 10:51       ` [PATCH v4 09/11] net/dpaa2: retrieve DPNI API version at init time Gagandeep Singh
2025-06-11 10:51       ` [PATCH v4 10/11] net/dpaa2: setup the speed cap based on the actual MAC Gagandeep Singh
2025-06-11 10:51       ` [PATCH v4 11/11] net/dpaa2: enable software taildrop for ordered queues Gagandeep Singh
2025-06-13  2:11       ` [PATCH v5 00/11] NXP DPAA2 driver enhancements and fixes Gagandeep Singh
2025-06-13  2:11         ` [PATCH v5 01/11] net/dpaa2: fix issue of extract buffer preparation Gagandeep Singh
2025-06-13  2:11         ` [PATCH v5 02/11] net/dpaa2: fix shaper rate Gagandeep Singh
2025-06-13  2:11         ` [PATCH v5 03/11] bus/fslmc: add DPBP APIs for setting depletion thresholds Gagandeep Singh
2025-06-13  2:11         ` [PATCH v5 04/11] mempool/dpaa2: use unified VA to IOVA conversion Gagandeep Singh
2025-06-13  2:11         ` [PATCH v5 05/11] net/dpaa2: add dpmac MC header file Gagandeep Singh
2025-06-13  2:11         ` [PATCH v5 06/11] net/dpaa2: support dpmac counters in stats Gagandeep Singh
2025-06-13  2:11         ` [PATCH v5 07/11] net/dpaa2: support dpmac Tx stats Gagandeep Singh
2025-06-13  2:11         ` [PATCH v5 08/11] net/dpaa2: support dpmac Tx stats in xstats Gagandeep Singh
2025-06-13  2:11         ` [PATCH v5 09/11] net/dpaa2: retrieve DPNI API version at init time Gagandeep Singh
2025-06-13  2:11         ` [PATCH v5 10/11] net/dpaa2: setup the speed cap based on the actual MAC Gagandeep Singh
2025-06-13  2:11         ` [PATCH v5 11/11] net/dpaa2: enable software taildrop for ordered queues Gagandeep Singh
2025-06-19  5:40         ` [PATCH v5 00/11] NXP DPAA2 driver enhancements and fixes Hemant Agrawal
2025-06-30  9:57         ` [PATCH v6 0/6] " Gagandeep Singh
2025-06-30  9:57           ` [PATCH v6 1/6] net/dpaa2: fix issue of extract buffer preparation Gagandeep Singh
2025-06-30  9:57           ` [PATCH v6 2/6] net/dpaa2: fix shaper rate Gagandeep Singh
2025-06-30  9:57           ` [PATCH v6 3/6] bus/fslmc: add DPBP APIs for setting depletion thresholds Gagandeep Singh
2025-06-30  9:57           ` [PATCH v6 4/6] mempool/dpaa2: use unified VA to IOVA conversion Gagandeep Singh
2025-06-30  9:57           ` [PATCH v6 5/6] net/dpaa2: retrieve DPNI API version at init time Gagandeep Singh
2025-06-30  9:58           ` [PATCH v6 6/6] net/dpaa2: enable software taildrop for ordered queues Gagandeep Singh
2025-06-30 15:12             ` Stephen Hemminger
2025-07-01  4:10               ` Gagandeep Singh [this message]
2025-07-01  4:29           ` [PATCH v7 0/6] NXP DPAA2 driver enhancements and fixes Gagandeep Singh
2025-07-01  4:29             ` [PATCH v7 1/6] net/dpaa2: fix issue of extract buffer preparation Gagandeep Singh
2025-07-01  4:29             ` [PATCH v7 2/6] net/dpaa2: fix shaper rate Gagandeep Singh
2025-07-01  4:29             ` [PATCH v7 3/6] bus/fslmc: add DPBP APIs for setting depletion thresholds Gagandeep Singh
2025-07-01 14:05               ` Stephen Hemminger
2025-07-02  9:44                 ` Gagandeep Singh
2025-07-01  4:29             ` [PATCH v7 4/6] mempool/dpaa2: use unified VA to IOVA conversion Gagandeep Singh
2025-07-01  4:29             ` [PATCH v7 5/6] net/dpaa2: retrieve DPNI API version at init time Gagandeep Singh
2025-07-01  4:29             ` [PATCH v7 6/6] net/dpaa2: enable software taildrop for ordered queues Gagandeep Singh
2025-07-02  9:51             ` [PATCH v8 0/5] NXP DPAA2 driver enhancements and fixes Gagandeep Singh
2025-07-02  9:51               ` [PATCH v8 1/5] net/dpaa2: fix issue of extract buffer preparation Gagandeep Singh
2025-07-02  9:51               ` [PATCH v8 2/5] net/dpaa2: fix shaper rate Gagandeep Singh
2025-07-02  9:51               ` [PATCH v8 3/5] mempool/dpaa2: use unified VA to IOVA conversion Gagandeep Singh
2025-07-02  9:51               ` [PATCH v8 4/5] net/dpaa2: retrieve DPNI API version at init time Gagandeep Singh
2025-07-02  9:51               ` [PATCH v8 5/5] net/dpaa2: enable software taildrop for ordered queues Gagandeep Singh
2025-06-09 16:42 ` [PATCH 00/11] NXP DPAA2 driver enhancements and fixes Stephen Hemminger
2025-06-29 17:25 ` Stephen Hemminger
2025-06-30 10:02   ` Gagandeep Singh

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=AS8PR04MB819822BAF3FA72E9C5FCA6FDE141A@AS8PR04MB8198.eurprd04.prod.outlook.com \
    --to=g.singh@nxp.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=sachin.saxena@nxp.com \
    --cc=stephen@networkplumber.org \
    /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).