[01/13] net/ionic: add stat for completion queue entries processed

Message ID 20240202193238.62669-2-andrew.boyer@amd.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series net/ionic: miscellaneous fixes and improvements |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Boyer, Andrew Feb. 2, 2024, 7:32 p.m. UTC
  When completion coalescing is turned on in the FW, there will be
fewer CQE than Tx packets. Expose the stat through debug logging.

Signed-off-by: Andrew Boyer <andrew.boyer@amd.com>
---
 drivers/net/ionic/ionic_lif.h         | 1 +
 drivers/net/ionic/ionic_rxtx.c        | 3 +++
 drivers/net/ionic/ionic_rxtx_sg.c     | 2 ++
 drivers/net/ionic/ionic_rxtx_simple.c | 2 ++
 4 files changed, 8 insertions(+)
  

Comments

Stephen Hemminger Feb. 3, 2024, 4:24 a.m. UTC | #1
On Fri, 2 Feb 2024 11:32:26 -0800
Andrew Boyer <andrew.boyer@amd.com> wrote:

> When completion coalescing is turned on in the FW, there will be
> fewer CQE than Tx packets. Expose the stat through debug logging.
> 
> Signed-off-by: Andrew Boyer <andrew.boyer@amd.com>

If you care about the stat it should be in xstats.
  
Boyer, Andrew Feb. 5, 2024, 12:49 p.m. UTC | #2
> On Feb 2, 2024, at 11:24 PM, Stephen Hemminger <stephen@networkplumber.org> wrote:
> 
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> On Fri, 2 Feb 2024 11:32:26 -0800
> Andrew Boyer <andrew.boyer@amd.com> wrote:
> 
>> When completion coalescing is turned on in the FW, there will be
>> fewer CQE than Tx packets. Expose the stat through debug logging.
>> 
>> Signed-off-by: Andrew Boyer <andrew.boyer@amd.com>
> 
> If you care about the stat it should be in xstats.

Thanks for looking. Moving all of our per-queue stats to xstats is on the todo list.

-Andrew
  

Patch

diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h
index 36b3bcc5a9..cac7a4583b 100644
--- a/drivers/net/ionic/ionic_lif.h
+++ b/drivers/net/ionic/ionic_lif.h
@@ -32,6 +32,7 @@ 
 struct ionic_tx_stats {
 	uint64_t packets;
 	uint64_t bytes;
+	uint64_t comps;
 	uint64_t drop;
 	uint64_t stop;
 	uint64_t no_csum;
diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c
index b9e73b4871..d92b231f8f 100644
--- a/drivers/net/ionic/ionic_rxtx.c
+++ b/drivers/net/ionic/ionic_rxtx.c
@@ -117,6 +117,9 @@  ionic_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id)
 	stats = &txq->stats;
 	IONIC_PRINT(DEBUG, "TX queue %u pkts %ju tso %ju",
 		txq->qcq.q.index, stats->packets, stats->tso);
+	IONIC_PRINT(DEBUG, "TX queue %u comps %ju (%ju per)",
+		txq->qcq.q.index, stats->comps,
+		stats->comps ? stats->packets / stats->comps : 0);
 
 	return 0;
 }
diff --git a/drivers/net/ionic/ionic_rxtx_sg.c b/drivers/net/ionic/ionic_rxtx_sg.c
index ab8e56e91c..6c028a698c 100644
--- a/drivers/net/ionic/ionic_rxtx_sg.c
+++ b/drivers/net/ionic/ionic_rxtx_sg.c
@@ -26,6 +26,7 @@  ionic_tx_flush_sg(struct ionic_tx_qcq *txq)
 {
 	struct ionic_cq *cq = &txq->qcq.cq;
 	struct ionic_queue *q = &txq->qcq.q;
+	struct ionic_tx_stats *stats = &txq->stats;
 	struct rte_mbuf *txm;
 	struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base;
 	void **info;
@@ -72,6 +73,7 @@  ionic_tx_flush_sg(struct ionic_tx_qcq *txq)
 		}
 
 		cq_desc = &cq_desc_base[cq->tail_idx];
+		stats->comps++;
 	}
 }
 
diff --git a/drivers/net/ionic/ionic_rxtx_simple.c b/drivers/net/ionic/ionic_rxtx_simple.c
index 5f81856256..5969287b66 100644
--- a/drivers/net/ionic/ionic_rxtx_simple.c
+++ b/drivers/net/ionic/ionic_rxtx_simple.c
@@ -26,6 +26,7 @@  ionic_tx_flush(struct ionic_tx_qcq *txq)
 {
 	struct ionic_cq *cq = &txq->qcq.cq;
 	struct ionic_queue *q = &txq->qcq.q;
+	struct ionic_tx_stats *stats = &txq->stats;
 	struct rte_mbuf *txm;
 	struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base;
 	void **info;
@@ -67,6 +68,7 @@  ionic_tx_flush(struct ionic_tx_qcq *txq)
 		}
 
 		cq_desc = &cq_desc_base[cq->tail_idx];
+		stats->comps++;
 	}
 }