net/bnxt: add Tx DMA error stat counter
PATCH 1/1 net/bnxt: add Tx DMA error stat counter
From: Mohammad Shuab Siddique <[email protected]>
Hardware already reports an invalid/bad DMA address on a Tx BD via the TX_CMPL_ERRORS_DMA_ERROR bit in the Tx completion record, but the driver never inspected it, so a bad mbuf->buf_iova on Tx completed silently with no visibility.
Check the bit in bnxt_handle_tx_cp() and in the AVX2/SSE vector Tx-completion handlers, and count occurrences in a new per-queue tx_dma_err counter. The counter is folded into the standard oerrors stat and also exposed as a named xstat (tx_dma_err_pkts) for finer-grained visibility.
--- drivers/net/bnxt/bnxt_rxtx_vec_avx2.c | 6 ++++++ drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 6 ++++++ drivers/net/bnxt/bnxt_stats.c | 20 ++++++++++++++++++++ drivers/net/bnxt/bnxt_stats.h | 3 +++ drivers/net/bnxt/bnxt_txq.h | 1 + drivers/net/bnxt/bnxt_txr.c | 6 ++++++ 6 files changed, 42 insertions(+)
drivers/net/bnxt/bnxt_rxtx_vec_avx2.c +6 -0
@@ -743,6 +743,12 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq)if (!bnxt_cpr_cmp_valid (txcmp, raw_cons, ring_mask +1 ))break ; +uint16_t errors_v =rte_le_to_cpu_16 (txcmp->errors_v); + +if (unlikely (errors_v &TX_CMPL_ERRORS_DMA_ERROR )) +rte_atomic_fetch_add_explicit (&txq->tx_dma_err,1 , + rte_memory_order_relaxed); + nb_tx_pkts += txcmp->opaque; raw_cons =NEXT_RAW_CMP (raw_cons); }while (nb_tx_pkts < ring_mask);
drivers/net/bnxt/bnxt_rxtx_vec_sse.c +6 -0
@@ -577,6 +577,12 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq)if (!bnxt_cpr_cmp_valid (txcmp, raw_cons, ring_mask +1 ))break ; +uint16_t errors_v =rte_le_to_cpu_16 (txcmp->errors_v); + +if (unlikely (errors_v &TX_CMPL_ERRORS_DMA_ERROR )) +rte_atomic_fetch_add_explicit (&txq->tx_dma_err,1 , + rte_memory_order_relaxed); +if (likely (CMP_TYPE (txcmp) ==TX_CMPL_TYPE_TX_L2 )) nb_tx_pkts += txcmp->opaque;else
drivers/net/bnxt/bnxt_stats.c +20 -0
@@ -697,6 +697,8 @@ static int bnxt_stats_get_ext(struct rte_eth_dev *eth_dev, bnxt_stats->oerrors +=rte_atomic_load_explicit (&txq->tx_mbuf_drop, rte_memory_order_relaxed); + bnxt_stats->oerrors +=rte_atomic_load_explicit (&txq->tx_dma_err, + rte_memory_order_relaxed);if (!txq->tx_started)continue ;
@@ -774,6 +776,9 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev, bnxt_stats->oerrors +=rte_atomic_load_explicit (&txq->tx_mbuf_drop, rte_memory_order_relaxed); + bnxt_stats->oerrors += +rte_atomic_load_explicit (&txq->tx_dma_err, + rte_memory_order_relaxed); }return rc;
@@ -824,6 +829,7 @@ int bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)struct bnxt_tx_queue *txq = bp->tx_queues[i]; txq->tx_mbuf_drop =0 ; + txq->tx_dma_err =0 ; }bnxt_clear_prev_stat (bp);
@@ -927,6 +933,7 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,RTE_DIM (bnxt_tx_stats_strings) + sz +RTE_DIM (bnxt_rx_ext_stats_strings) +RTE_DIM (bnxt_tx_ext_stats_strings) + +BNXT_NUM_SW_XSTATS +bnxt_flow_stats_cnt (bp);if (n < stat_count || xstats ==NULL )
@@ -1049,6 +1056,14 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev, count++; } + xstats[count].id = count; + xstats[count].value =0 ; +for (i =0 ; i < bp->tx_cp_nr_rings; i++) + xstats[count].value += +rte_atomic_load_explicit (&bp->tx_queues[i]->tx_dma_err, + rte_memory_order_relaxed); + count++; +if (bp->fw_cap &BNXT_FW_CAP_ADV_FLOW_COUNTERS && bp->fw_cap &BNXT_FW_CAP_ADV_FLOW_MGMT &&BNXT_FLOW_XSTATS_EN (bp)) {
@@ -1128,6 +1143,7 @@ int bnxt_dev_xstats_get_names_op(struct rte_eth_dev *eth_dev, sz +RTE_DIM (bnxt_rx_ext_stats_strings) +RTE_DIM (bnxt_tx_ext_stats_strings) + +BNXT_NUM_SW_XSTATS +bnxt_flow_stats_cnt (bp);if (xstats_names ==NULL || size < stat_cnt)
@@ -1181,6 +1197,10 @@ int bnxt_dev_xstats_get_names_op(struct rte_eth_dev *eth_dev, count++; } +strlcpy (xstats_names[count].name,"tx_dma_err_pkts" , +sizeof (xstats_names[count].name)); + count++; +if (bp->fw_cap &BNXT_FW_CAP_ADV_FLOW_COUNTERS && bp->fw_cap &BNXT_FW_CAP_ADV_FLOW_MGMT &&BNXT_FLOW_XSTATS_EN (bp)) {
drivers/net/bnxt/bnxt_stats.h +3 -0
@@ -8,6 +8,9 @@#include <ethdev_driver.h> +/* Number of software (non-HWRM) xstats appended after the FW-reported ones. */ +#define BNXT_NUM_SW_XSTATS 1 +void bnxt_free_stats (struct bnxt *bp);int bnxt_stats_get_op (struct rte_eth_dev *eth_dev,struct rte_eth_stats *bnxt_stats,struct eth_queue_stats *qstats);
drivers/net/bnxt/bnxt_txq.h +1 -0
@@ -36,6 +36,7 @@ struct bnxt_tx_queue {struct rte_mbuf **free;uint64_t offloads;RTE_ATOMIC (uint64_t ) tx_mbuf_drop; +RTE_ATOMIC (uint64_t ) tx_dma_err; };void bnxt_free_txq_stats (struct bnxt_tx_queue *txq);
drivers/net/bnxt/bnxt_txr.c +6 -0
@@ -782,6 +782,12 @@ static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)if (!bnxt_cpr_cmp_valid (txcmp, raw_cons, ring_mask +1 ))break ; +uint16_t errors_v =rte_le_to_cpu_16 (txcmp->errors_v); + +if (unlikely (errors_v &TX_CMPL_ERRORS_DMA_ERROR )) +rte_atomic_fetch_add_explicit (&txq->tx_dma_err,1 , + rte_memory_order_relaxed); +if (CMP_TYPE (txcmp) ==CMPL_BASE_TYPE_TX_L2_COAL ) {struct tx_cmpl_coal *txcmp_c = (struct tx_cmpl_coal *)txcmp;
Signature · 1 line
2.47.3
PATCH v2 1/1 net/bnxt: add Tx DMA error stat counter
From: Mohammad Shuab Siddique <[email protected]>
Hardware already reports an invalid/bad DMA address on a Tx BD via the TX_CMPL_ERRORS_DMA_ERROR bit in the Tx completion record, but the driver never inspected it, so a bad mbuf->buf_iova on Tx completed silently with no visibility.
Check the bit in bnxt_handle_tx_cp() and in the AVX2/SSE vector Tx-completion handlers, and count occurrences in a new per-queue tx_dma_err counter. The counter is folded into the standard oerrors stat and also exposed as a named xstat (tx_dma_err_pkts) for finer-grained visibility.
---
v2:
* Added a release notes entry documenting the new tx_dma_err_pkts xstat, per reviewer request.
* Left the bnxt_stats_reset_op() reset of tx_dma_err as a direct assignment rather than an atomic store, matching the existing tx_mbuf_drop reset immediately above it (same file, same pattern); changing only the new field would be inconsistent, and the reset path isn't concurrent with the fast-path increments.
* NOTE: apply this patch before "net/bnxt: add support for queue size of 16384" (v2) -- both add a bullet under the same "Updated bnxt driver" release-notes heading, and the latter's context assumes this one's bullet is already present. Send/apply order below reflects this.
doc/guides/rel_notes/release_26_11.rst | 6 ++++++ drivers/net/bnxt/bnxt_rxtx_vec_avx2.c | 6 ++++++ drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 6 ++++++ drivers/net/bnxt/bnxt_stats.c | 20 ++++++++++++++++++++ drivers/net/bnxt/bnxt_stats.h | 3 +++ drivers/net/bnxt/bnxt_txq.h | 1 + drivers/net/bnxt/bnxt_txr.c | 6 ++++++ 7 files changed, 48 insertions(+)
doc/guides/rel_notes/release_26_11.rst +6 -0
@@ -55,6 +55,12 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Updated bnxt driver.** + + * Added a per-queue ``tx_dma_err_pkts`` xstat to report Tx completions + that the device flagged with a DMA error. These are also folded into + the standard ``oerrors`` counter. + Removed Items -------------
drivers/net/bnxt/bnxt_rxtx_vec_avx2.c +6 -0
@@ -743,6 +743,12 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq)if (!bnxt_cpr_cmp_valid (txcmp, raw_cons, ring_mask +1 ))break ; +uint16_t errors_v =rte_le_to_cpu_16 (txcmp->errors_v); + +if (unlikely (errors_v &TX_CMPL_ERRORS_DMA_ERROR )) +rte_atomic_fetch_add_explicit (&txq->tx_dma_err,1 , + rte_memory_order_relaxed); + nb_tx_pkts += txcmp->opaque; raw_cons =NEXT_RAW_CMP (raw_cons); }while (nb_tx_pkts < ring_mask);
drivers/net/bnxt/bnxt_rxtx_vec_sse.c +6 -0
@@ -577,6 +577,12 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq)if (!bnxt_cpr_cmp_valid (txcmp, raw_cons, ring_mask +1 ))break ; +uint16_t errors_v =rte_le_to_cpu_16 (txcmp->errors_v); + +if (unlikely (errors_v &TX_CMPL_ERRORS_DMA_ERROR )) +rte_atomic_fetch_add_explicit (&txq->tx_dma_err,1 , + rte_memory_order_relaxed); +if (likely (CMP_TYPE (txcmp) ==TX_CMPL_TYPE_TX_L2 )) nb_tx_pkts += txcmp->opaque;else
drivers/net/bnxt/bnxt_stats.c +20 -0
@@ -697,6 +697,8 @@ static int bnxt_stats_get_ext(struct rte_eth_dev *eth_dev, bnxt_stats->oerrors +=rte_atomic_load_explicit (&txq->tx_mbuf_drop, rte_memory_order_relaxed); + bnxt_stats->oerrors +=rte_atomic_load_explicit (&txq->tx_dma_err, + rte_memory_order_relaxed);if (!txq->tx_started)continue ;
@@ -774,6 +776,9 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev, bnxt_stats->oerrors +=rte_atomic_load_explicit (&txq->tx_mbuf_drop, rte_memory_order_relaxed); + bnxt_stats->oerrors += +rte_atomic_load_explicit (&txq->tx_dma_err, + rte_memory_order_relaxed); }return rc;
@@ -824,6 +829,7 @@ int bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)struct bnxt_tx_queue *txq = bp->tx_queues[i]; txq->tx_mbuf_drop =0 ; + txq->tx_dma_err =0 ; }bnxt_clear_prev_stat (bp);
@@ -927,6 +933,7 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,RTE_DIM (bnxt_tx_stats_strings) + sz +RTE_DIM (bnxt_rx_ext_stats_strings) +RTE_DIM (bnxt_tx_ext_stats_strings) + +BNXT_NUM_SW_XSTATS +bnxt_flow_stats_cnt (bp);if (n < stat_count || xstats ==NULL )
@@ -1049,6 +1056,14 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev, count++; } + xstats[count].id = count; + xstats[count].value =0 ; +for (i =0 ; i < bp->tx_cp_nr_rings; i++) + xstats[count].value += +rte_atomic_load_explicit (&bp->tx_queues[i]->tx_dma_err, + rte_memory_order_relaxed); + count++; +if (bp->fw_cap &BNXT_FW_CAP_ADV_FLOW_COUNTERS && bp->fw_cap &BNXT_FW_CAP_ADV_FLOW_MGMT &&BNXT_FLOW_XSTATS_EN (bp)) {
@@ -1128,6 +1143,7 @@ int bnxt_dev_xstats_get_names_op(struct rte_eth_dev *eth_dev, sz +RTE_DIM (bnxt_rx_ext_stats_strings) +RTE_DIM (bnxt_tx_ext_stats_strings) + +BNXT_NUM_SW_XSTATS +bnxt_flow_stats_cnt (bp);if (xstats_names ==NULL || size < stat_cnt)
@@ -1181,6 +1197,10 @@ int bnxt_dev_xstats_get_names_op(struct rte_eth_dev *eth_dev, count++; } +strlcpy (xstats_names[count].name,"tx_dma_err_pkts" , +sizeof (xstats_names[count].name)); + count++; +if (bp->fw_cap &BNXT_FW_CAP_ADV_FLOW_COUNTERS && bp->fw_cap &BNXT_FW_CAP_ADV_FLOW_MGMT &&BNXT_FLOW_XSTATS_EN (bp)) {
drivers/net/bnxt/bnxt_stats.h +3 -0
@@ -8,6 +8,9 @@#include <ethdev_driver.h> +/* Number of software (non-HWRM) xstats appended after the FW-reported ones. */ +#define BNXT_NUM_SW_XSTATS 1 +void bnxt_free_stats (struct bnxt *bp);int bnxt_stats_get_op (struct rte_eth_dev *eth_dev,struct rte_eth_stats *bnxt_stats,struct eth_queue_stats *qstats);
drivers/net/bnxt/bnxt_txq.h +1 -0
@@ -36,6 +36,7 @@ struct bnxt_tx_queue {struct rte_mbuf **free;uint64_t offloads;RTE_ATOMIC (uint64_t ) tx_mbuf_drop; +RTE_ATOMIC (uint64_t ) tx_dma_err; };void bnxt_free_txq_stats (struct bnxt_tx_queue *txq);
drivers/net/bnxt/bnxt_txr.c +6 -0
@@ -782,6 +782,12 @@ static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)if (!bnxt_cpr_cmp_valid (txcmp, raw_cons, ring_mask +1 ))break ; +uint16_t errors_v =rte_le_to_cpu_16 (txcmp->errors_v); + +if (unlikely (errors_v &TX_CMPL_ERRORS_DMA_ERROR )) +rte_atomic_fetch_add_explicit (&txq->tx_dma_err,1 , + rte_memory_order_relaxed); +if (CMP_TYPE (txcmp) ==CMPL_BASE_TYPE_TX_L2_COAL ) {struct tx_cmpl_coal *txcmp_c = (struct tx_cmpl_coal *)txcmp;
Signature · 1 line
2.47.3
Quoted 7 lines · On Sun, 20 Sep 2026 20:27:03 -0600 Mohammad Shuab Siddique…
From: Mohammad Shuab Siddique <[email protected]>
Hardware already reports an invalid/bad DMA address on a Tx BD via the
TX_CMPL_ERRORS_DMA_ERRORbit in the Tx completion record, but the driver never inspected it, so a badmbuf->buf_iovaon Tx completed silently with no visibility.
Quoted 8 lines
Check the bit in
bnxt_handle_tx_cp()and in the AVX2/SSE vector Tx-completion handlers, and count occurrences in a new per-queuetx_dma_errcounter. The counter is folded into the standard oerrors stat and also exposed as a named xstat (tx_dma_err_pkts) for finer-grained visibility.Signed-off-by Mohammad Shuab Siddique <[email protected]>---
[PATCH v2] net/bnxt: add Tx DMA error stat counter
Warning: tx_dma_err is a per-queue, single-writer counter but uses rte_atomic_fetch_add_explicit() in the completion fast path. That is a locked RMW for no benefit. Use a plain increment. The existing tx_mbuf_drop pattern is not a reason to extend it.
Warning: bnxt_handle_tx_cp_vec() in bnxt_rxtx_vec_neon.c is not updated. arm64 never counts DMA errors.
Warning: the release note says "per-queue xstat", but the patch exposes a single port-wide sum. Fix one or the other.
Info: "tx_dma_err_pkts" counts completions, not packets. Vector completions cover opaque packets, and with the following coalescing patch one completion covers many. Rename the xstat or count packets.
PATCH v3 1/1 net/bnxt: add Tx DMA error stat counter
In reply to Mohammad Shuab SiddiqueFrom: Mohammad Shuab Siddique <[email protected]>
Hardware already reports an invalid/bad DMA address on a Tx BD via the TX_CMPL_ERRORS_DMA_ERROR bit in the Tx completion record, but the driver never inspected it, so a bad mbuf->buf_iova on Tx completed silently with no visibility.
Check the bit in bnxt_handle_tx_cp() and in the AVX2/SSE/NEON vector Tx-completion handlers, and count occurrences in a new per-queue tx_dma_err counter. The counter is folded into the standard oerrors stat and also exposed as a named xstat (tx_dma_err_cmpl) for finer-grained visibility. The xstat name reflects what is actually
counted: one increment per Tx completion record that carries the error bit, not one per packet -- a coalesced Tx completion can cover several packets. The xstat itself is also a port-level sum across queues, not a per-queue value, even though the underlying counter field is per-queue.
tx_dma_err has a single writer (the lcore polling that Tx queue's completions) and is read from other threads via xstats, so the increment stores the new value with rte_atomic_store_explicit() after a relaxed load, rather than rte_atomic_fetch_add_explicit():
with only one writer there is nothing to race against for the read-modify-write itself, so the stronger fetch_add (a locked RMW on most architectures) is unneeded on this per-packet path; the atomic store still ensures other threads never observe a torn value.
---
v3:
* Renamed the xstat from tx_dma_err_pkts to tx_dma_err_cmpl, and reworded the release note from "per-queue" to "port-level" to match what bnxt_dev_xstats_get_op() actually returns. Stephen Hemminger pointed out both: the xstat counts completions, not packets (a coalesced completion covers several packets, so "_pkts" overstates granularity), and the value summed across queues is exposed as one port-wide xstat, not one per queue.
* Added the DMA-error check to the NEON vector Tx-completion handler (bnxt_handle_tx_cp_vec() in bnxt_rxtx_vec_neon.c), matching the AVX2/SSE handlers already covered -- also per Stephen Hemminger.
* Switched the increment from rte_atomic_fetch_add_explicit() to a relaxed load + rte_atomic_store_explicit(): tx_dma_err has a single writer (the lcore polling that queue's completions), so the stronger fetch_add (a locked read-modify-write on most architectures) was unneeded on this per-packet path.
* Changed bnxt_stats_reset_op()'s tx_dma_err reset from a direct = 0 assignment (v2) to rte_atomic_store_explicit(..., 0, ...), matching the atomic store now used for the increment and for the other reset site (bnxt_dev_xstats_reset_op()).
v2:
* Added a release notes entry documenting the new xstat, per reviewer request.
* NOTE: apply this patch before "net/bnxt: add support for queue size of 16384" -- both add a bullet under the same "Updated bnxt driver" release-notes heading, and the latter's context assumes this one's bullet is already present.
doc/guides/rel_notes/release_26_11.rst | 6 ++++++ drivers/net/bnxt/bnxt_rxtx_vec_avx2.c | 8 ++++++++ drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 8 ++++++++ drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 8 ++++++++ drivers/net/bnxt/bnxt_stats.c | 26 ++++++++++++++++++++++++++ drivers/net/bnxt/bnxt_stats.h | 3 +++ drivers/net/bnxt/bnxt_txq.h | 1 + drivers/net/bnxt/bnxt_txr.c | 8 ++++++++ 8 files changed, 68 insertions(+)
doc/guides/rel_notes/release_26_11.rst +6 -0
@@ -74,6 +74,12 @@ New Features ``xdp_meta_rx_ts_valid_mask``. * Added ``read_clock`` operation to query the PTP hardware clock. +* **Updated bnxt driver.** + + * Added a ``tx_dma_err_cmpl`` xstat to report Tx completions that the + device flagged with a DMA error. This is a port-level counter, and + is also folded into the standard ``oerrors`` counter. + * **Updated Intel iavf driver.** * Runtime Rx/Tx queue setup is now automatically disabled
drivers/net/bnxt/bnxt_rxtx_vec_avx2.c +8 -0
@@ -743,6 +743,14 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq)if (!bnxt_cpr_cmp_valid (txcmp, raw_cons, ring_mask +1 ))break ; +uint16_t errors_v =rte_le_to_cpu_16 (txcmp->errors_v); + +if (unlikely (errors_v &TX_CMPL_ERRORS_DMA_ERROR )) +rte_atomic_store_explicit (&txq->tx_dma_err, +rte_atomic_load_explicit (&txq->tx_dma_err, + rte_memory_order_relaxed) +1 , + rte_memory_order_relaxed); + nb_tx_pkts += txcmp->opaque; raw_cons =NEXT_RAW_CMP (raw_cons); }while (nb_tx_pkts < ring_mask);
drivers/net/bnxt/bnxt_rxtx_vec_neon.c +8 -0
@@ -355,6 +355,14 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq)if (!bnxt_cpr_cmp_valid (txcmp, raw_cons, ring_mask +1 ))break ; +uint16_t errors_v =rte_le_to_cpu_16 (txcmp->errors_v); + +if (unlikely (errors_v &TX_CMPL_ERRORS_DMA_ERROR )) +rte_atomic_store_explicit (&txq->tx_dma_err, +rte_atomic_load_explicit (&txq->tx_dma_err, + rte_memory_order_relaxed) +1 , + rte_memory_order_relaxed); +if (likely (CMP_TYPE (txcmp) ==TX_CMPL_TYPE_TX_L2 )) nb_tx_pkts += txcmp->opaque;else
drivers/net/bnxt/bnxt_rxtx_vec_sse.c +8 -0
@@ -577,6 +577,14 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq)if (!bnxt_cpr_cmp_valid (txcmp, raw_cons, ring_mask +1 ))break ; +uint16_t errors_v =rte_le_to_cpu_16 (txcmp->errors_v); + +if (unlikely (errors_v &TX_CMPL_ERRORS_DMA_ERROR )) +rte_atomic_store_explicit (&txq->tx_dma_err, +rte_atomic_load_explicit (&txq->tx_dma_err, + rte_memory_order_relaxed) +1 , + rte_memory_order_relaxed); +if (likely (CMP_TYPE (txcmp) ==TX_CMPL_TYPE_TX_L2 )) nb_tx_pkts += txcmp->opaque;else
drivers/net/bnxt/bnxt_stats.c +26 -0
@@ -685,6 +685,8 @@ static int bnxt_stats_get_ext(struct rte_eth_dev *eth_dev, bnxt_stats->oerrors +=rte_atomic_load_explicit (&txq->tx_mbuf_drop, rte_memory_order_relaxed); + bnxt_stats->oerrors +=rte_atomic_load_explicit (&txq->tx_dma_err, + rte_memory_order_relaxed);if (!txq->tx_started)continue ;
@@ -758,6 +760,9 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev, bnxt_stats->oerrors +=rte_atomic_load_explicit (&txq->tx_mbuf_drop, rte_memory_order_relaxed); + bnxt_stats->oerrors += +rte_atomic_load_explicit (&txq->tx_dma_err, + rte_memory_order_relaxed); }return rc;
@@ -808,6 +813,8 @@ int bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)struct bnxt_tx_queue *txq = bp->tx_queues[i]; txq->tx_mbuf_drop =0 ; +rte_atomic_store_explicit (&txq->tx_dma_err,0 , + rte_memory_order_relaxed); }bnxt_clear_prev_stat (bp);
@@ -911,6 +918,7 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,RTE_DIM (bnxt_tx_stats_strings) + sz +RTE_DIM (bnxt_rx_ext_stats_strings) +RTE_DIM (bnxt_tx_ext_stats_strings) + +BNXT_NUM_SW_XSTATS +bnxt_flow_stats_cnt (bp);if (n < stat_count || xstats ==NULL )
@@ -1033,6 +1041,14 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev, count++; } + xstats[count].id = count; + xstats[count].value =0 ; +for (i =0 ; i < bp->tx_cp_nr_rings; i++) + xstats[count].value += +rte_atomic_load_explicit (&bp->tx_queues[i]->tx_dma_err, + rte_memory_order_relaxed); + count++; +if (bp->fw_cap &BNXT_FW_CAP_ADV_FLOW_COUNTERS && bp->fw_cap &BNXT_FW_CAP_ADV_FLOW_MGMT &&BNXT_FLOW_XSTATS_EN (bp)) {
@@ -1112,6 +1128,7 @@ int bnxt_dev_xstats_get_names_op(struct rte_eth_dev *eth_dev, sz +RTE_DIM (bnxt_rx_ext_stats_strings) +RTE_DIM (bnxt_tx_ext_stats_strings) + +BNXT_NUM_SW_XSTATS +bnxt_flow_stats_cnt (bp);if (xstats_names ==NULL || size < stat_cnt)
@@ -1165,6 +1182,10 @@ int bnxt_dev_xstats_get_names_op(struct rte_eth_dev *eth_dev, count++; } +strlcpy (xstats_names[count].name,"tx_dma_err_cmpl" , +sizeof (xstats_names[count].name)); + count++; +if (bp->fw_cap &BNXT_FW_CAP_ADV_FLOW_COUNTERS && bp->fw_cap &BNXT_FW_CAP_ADV_FLOW_MGMT &&BNXT_FLOW_XSTATS_EN (bp)) {
@@ -1190,6 +1211,7 @@ int bnxt_dev_xstats_get_names_op(struct rte_eth_dev *eth_dev,int bnxt_dev_xstats_reset_op (struct rte_eth_dev *eth_dev) {struct bnxt *bp = eth_dev->data->dev_private; +unsigned int i;int ret; ret =is_bnxt_in_error (bp);
@@ -1202,6 +1224,10 @@ int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)return -ENOTSUP ; } +for (i =0 ; i < bp->tx_cp_nr_rings; i++) +rte_atomic_store_explicit (&bp->tx_queues[i]->tx_dma_err,0 , + rte_memory_order_relaxed); + ret =bnxt_hwrm_port_clr_stats (bp);if (ret !=0 ) PMD_DRV_LOG_LINE(ERR, "Failed to reset xstats: %s",
drivers/net/bnxt/bnxt_stats.h +3 -0
@@ -8,6 +8,9 @@#include <ethdev_driver.h> +/* Number of software (non-HWRM) xstats appended after the FW-reported ones. */ +#define BNXT_NUM_SW_XSTATS 1 +void bnxt_free_stats (struct bnxt *bp);int bnxt_stats_get_op (struct rte_eth_dev *eth_dev,struct rte_eth_stats *bnxt_stats,struct eth_queue_stats *qstats);
drivers/net/bnxt/bnxt_txq.h +1 -0
@@ -36,6 +36,7 @@ struct bnxt_tx_queue {struct rte_mbuf **free;uint64_t offloads;RTE_ATOMIC (uint64_t ) tx_mbuf_drop; +RTE_ATOMIC (uint64_t ) tx_dma_err; };void bnxt_free_txq_stats (struct bnxt_tx_queue *txq);
drivers/net/bnxt/bnxt_txr.c +8 -0
@@ -782,6 +782,14 @@ static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)if (!bnxt_cpr_cmp_valid (txcmp, raw_cons, ring_mask +1 ))break ; +uint16_t errors_v =rte_le_to_cpu_16 (txcmp->errors_v); + +if (unlikely (errors_v &TX_CMPL_ERRORS_DMA_ERROR )) +rte_atomic_store_explicit (&txq->tx_dma_err, +rte_atomic_load_explicit (&txq->tx_dma_err, + rte_memory_order_relaxed) +1 , + rte_memory_order_relaxed); +if (CMP_TYPE (txcmp) ==CMPL_BASE_TYPE_TX_L2_COAL ) {struct tx_cmpl_coal *txcmp_c = (struct tx_cmpl_coal *)txcmp;
Signature · 1 line
2.47.3