[PATCH 3/4] net/bnxt: support timestamp parsing in Tx
Mohammad Shuab Siddique
mohammad-shuab.siddique at broadcom.com
Mon Mar 2 18:12:35 CET 2026
From: Ajit Khaparde <ajit.khaparde at 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 at dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
Signed-off-by: Mohammad Shuab Siddique <mohammad-shuab.siddique at 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 = ð_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
More information about the dev
mailing list