public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: Mohammad Shuab Siddique <mohammad-shuab.siddique@broadcom.com>
To: dev@dpdk.org
Cc: kishore.padmanabha@broadcom.com,
	Ajit Khaparde <ajit.khaparde@broadcom.com>,
	stable@dpdk.org,
	Mohammad Shuab Siddique <mohammad-shuab.siddique@broadcom.com>
Subject: [PATCH 3/4] net/bnxt: support timestamp parsing in Tx
Date: Mon,  2 Mar 2026 10:12:35 -0700	[thread overview]
Message-ID: <20260302171236.98625-4-Mohammad-Shuab.Siddique@broadcom.com> (raw)
In-Reply-To: <20260302171236.98625-1-Mohammad-Shuab.Siddique@broadcom.com>

From: Ajit Khaparde <ajit.khaparde@broadcom.com>

Support timestamp parsing in Tx completions.
Check the mbuf ol_flags to see if a PTP packet is being transmitted.
Set the request for timestamp in the Tx descriptor.

If the port transmits a PTP packet, the hardware will capture the
timestamp at the time of the transmit and indicate it in the Tx
completion on the corresponding Tx ring.

Parse the timestamp info from the Tx completion entry and cache it
for indicating to the application when needed.

Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Mohammad Shuab Siddique <mohammad-shuab.siddique@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 23 +++++++++++++++++++++++
 drivers/net/bnxt/bnxt_txq.c    |  6 ++++++
 drivers/net/bnxt/bnxt_txq.h    |  1 +
 3 files changed, 30 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index c75cd05d99..6f962f8b73 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1827,6 +1827,8 @@ int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	struct rte_eth_link *link = &eth_dev->data->dev_link;
 	int vlan_mask = 0;
 	int rc, retry_cnt = BNXT_IF_CHANGE_RETRY_COUNT;
+	struct bnxt_tx_queue *txq;
+	uint16_t queue_idx;
 
 	if (bp->rx_cp_nr_rings > RTE_ETHDEV_QUEUE_STAT_CNTRS)
 		PMD_DRV_LOG_LINE(ERR,
@@ -1910,6 +1912,27 @@ int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	if (BNXT_P5_PTP_TIMESYNC_ENABLED(bp))
 		bnxt_schedule_ptp_alarm(bp);
 
+	/* There are a few conditions for which fast free is not supported.
+	 * PTP can be enabled/disabled without restarting some programs.
+	 */
+	for (queue_idx = 0; queue_idx < bp->tx_nr_rings; queue_idx++) {
+		txq = eth_dev->data->tx_queues[queue_idx];
+		if (BNXT_P5_PTP_TIMESYNC_ENABLED(bp) || bp->ieee_1588) {
+			txq->offloads &= ~RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
+			if (BNXT_P5_PTP_TIMESYNC_ENABLED(bp) || bp->ieee_1588)
+				txq->tx_free_thresh = RTE_BNXT_MIN_TX_BURST;
+			else
+				txq->tx_free_thresh =
+					RTE_MIN(rte_align32pow2(txq->nb_tx_desc) / 4,
+						RTE_BNXT_MAX_TX_BURST);
+		} else {
+			txq->offloads |= RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
+			txq->tx_free_thresh =
+				RTE_MIN(rte_align32pow2(txq->nb_tx_desc) / 4,
+					RTE_BNXT_MAX_TX_BURST);
+		}
+	}
+
 	return 0;
 
 error:
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index 3938ebc709..7752f06eb7 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -172,8 +172,14 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	txq->nb_tx_desc = nb_desc;
 	txq->tx_free_thresh =
 		RTE_MIN(rte_align32pow2(nb_desc) / 4, RTE_BNXT_MAX_TX_BURST);
+	/* For PTP packets, process the completion sooner */
+	if (bp->ptp_cfg != NULL)
+		txq->tx_free_thresh = RTE_BNXT_MIN_TX_BURST;
 	txq->offloads = eth_dev->data->dev_conf.txmode.offloads |
 			tx_conf->offloads;
+	/* mbuf fast free not supported for the following. Reset the bit */
+	if (bp->ieee_1588)
+		txq->offloads &= ~RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
 
 	txq->tx_deferred_start = tx_conf->tx_deferred_start;
 
diff --git a/drivers/net/bnxt/bnxt_txq.h b/drivers/net/bnxt/bnxt_txq.h
index 69652bbaaa..ac8af91c57 100644
--- a/drivers/net/bnxt/bnxt_txq.h
+++ b/drivers/net/bnxt/bnxt_txq.h
@@ -8,6 +8,7 @@
 
 /* Maximum transmit burst for vector mode.  */
 #define RTE_BNXT_MAX_TX_BURST		64U
+#define RTE_BNXT_MIN_TX_BURST		1U
 
 struct bnxt_tx_ring_info;
 struct bnxt_cp_ring_info;
-- 
2.47.3


  parent reply	other threads:[~2026-03-02 17:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-02 17:12 [PATCH 0/4] net/bnxt: PTP support series Mohammad Shuab Siddique
2026-03-02 17:12 ` [PATCH 1/4] net/bnxt: support handling PTP frames in Rx Mohammad Shuab Siddique
2026-03-02 17:12 ` [PATCH 2/4] net/bnxt: pass Rx timestamp in mbuf Mohammad Shuab Siddique
2026-03-02 17:12 ` Mohammad Shuab Siddique [this message]
2026-03-02 17:12 ` [PATCH 4/4] net/bnxt: add ptp_cfg struct support for Thor 2 VFs Mohammad Shuab Siddique
2026-03-02 17:26   ` [PATCH v2 " Mohammad Shuab Siddique
2026-03-11 18:29 ` [PATCH 0/4] net/bnxt: PTP support series Thomas Monjalon

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=20260302171236.98625-4-Mohammad-Shuab.Siddique@broadcom.com \
    --to=mohammad-shuab.siddique@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kishore.padmanabha@broadcom.com \
    --cc=stable@dpdk.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