All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ioana Ciornei <ioana.ciornei@nxp.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org,
	john.fastabend@gmail.com, Ioana Ciornei <ioana.ciornei@nxp.com>
Subject: [PATCH net-next 05/12] net: dpaa2-eth: export buffer pool info into a new debugfs file
Date: Mon, 12 Sep 2022 21:28:22 +0300	[thread overview]
Message-ID: <20220912182829.160715-6-ioana.ciornei@nxp.com> (raw)
In-Reply-To: <20220912182829.160715-1-ioana.ciornei@nxp.com>

Export the allocated buffer pools, the number of buffers that they have
currently and which channels are using which BP.

The output looks like below:

Buffer pool info for eth2:
IDX        BPID      Buf count      CH#0      CH#1      CH#2      CH#3
BP#0         1           5124         x         x         x         x

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 .../freescale/dpaa2/dpaa2-eth-debugfs.c       | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c
index 54e7fcf95c89..1af254caeb0d 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c
@@ -119,6 +119,51 @@ static int dpaa2_dbg_ch_show(struct seq_file *file, void *offset)
 
 DEFINE_SHOW_ATTRIBUTE(dpaa2_dbg_ch);
 
+static int dpaa2_dbg_bp_show(struct seq_file *file, void *offset)
+{
+	struct dpaa2_eth_priv *priv = (struct dpaa2_eth_priv *)file->private;
+	int i, j, num_queues, buf_cnt;
+	struct dpaa2_eth_bp *bp;
+	char ch_name[10];
+	int err;
+
+	/* Print out the header */
+	seq_printf(file, "Buffer pool info for %s:\n", priv->net_dev->name);
+	seq_printf(file, "%s  %10s%15s", "IDX", "BPID", "Buf count");
+	num_queues = dpaa2_eth_queue_count(priv);
+	for (i = 0; i < num_queues; i++) {
+		snprintf(ch_name, sizeof(ch_name), "CH#%d", i);
+		seq_printf(file, "%10s", ch_name);
+	}
+	seq_printf(file, "\n");
+
+	/* For each buffer pool, print out its BPID, the number of buffers in
+	 * that buffer pool and the channels which are using it.
+	 */
+	for (i = 0; i < priv->num_bps; i++) {
+		bp = priv->bp[i];
+
+		err = dpaa2_io_query_bp_count(NULL, bp->bpid, &buf_cnt);
+		if (err) {
+			netdev_warn(priv->net_dev, "Buffer count query error %d\n", err);
+			return err;
+		}
+
+		seq_printf(file, "%3s%d%10d%15d", "BP#", i, bp->bpid, buf_cnt);
+		for (j = 0; j < num_queues; j++) {
+			if (priv->channel[j]->bp == bp)
+				seq_printf(file, "%10s", "x");
+			else
+				seq_printf(file, "%10s", "");
+		}
+		seq_printf(file, "\n");
+	}
+
+	return 0;
+}
+
+DEFINE_SHOW_ATTRIBUTE(dpaa2_dbg_bp);
+
 void dpaa2_dbg_add(struct dpaa2_eth_priv *priv)
 {
 	struct fsl_mc_device *dpni_dev;
@@ -139,6 +184,10 @@ void dpaa2_dbg_add(struct dpaa2_eth_priv *priv)
 
 	/* per-fq stats file */
 	debugfs_create_file("ch_stats", 0444, dir, priv, &dpaa2_dbg_ch_fops);
+
+	/* per buffer pool stats file */
+	debugfs_create_file("bp_stats", 0444, dir, priv, &dpaa2_dbg_bp_fops);
+
 }
 
 void dpaa2_dbg_remove(struct dpaa2_eth_priv *priv)
-- 
2.33.1


  parent reply	other threads:[~2022-09-12 18:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12 18:28 [PATCH net-next 00/12] net: dpaa2-eth: AF_XDP zero-copy support Ioana Ciornei
2022-09-12 18:28 ` [PATCH net-next 01/12] net: dpaa2-eth: add support to query the number of queues through ethtool Ioana Ciornei
2022-09-12 18:28 ` [PATCH net-next 02/12] net: dpaa2-eth: rearrange variable in dpaa2_eth_get_ethtool_stats Ioana Ciornei
2022-09-12 18:28 ` [PATCH net-next 03/12] net: dpaa2-eth: add support for multiple buffer pools per DPNI Ioana Ciornei
2022-09-12 18:28 ` [PATCH net-next 04/12] net: dpaa2-eth: export the CH#<index> in the 'ch_stats' debug file Ioana Ciornei
2022-09-12 18:28 ` Ioana Ciornei [this message]
2022-09-12 18:28 ` [PATCH net-next 06/12] net: dpaa2-eth: update the dpni_set_pools() API to support per QDBIN pools Ioana Ciornei
2022-09-16 20:22   ` kernel test robot
2022-09-12 18:28 ` [PATCH net-next 07/12] net: dpaa2-eth: use dev_close/open instead of the internal functions Ioana Ciornei
2022-09-12 18:28 ` [PATCH net-next 08/12] net: dpaa2-eth: create and export the dpaa2_eth_alloc_skb function Ioana Ciornei
2022-09-12 18:28 ` [PATCH net-next 09/12] net: dpaa2-eth: create and export the dpaa2_eth_receive_skb() function Ioana Ciornei
2022-09-12 18:28 ` [PATCH net-next 10/12] net: dpaa2-eth: AF_XDP RX zero copy support Ioana Ciornei
2022-09-12 18:28 ` [PATCH net-next 11/12] net: dpaa2-eth: AF_XDP TX " Ioana Ciornei
2022-09-12 18:28 ` [PATCH net-next 12/12] net: dpaa2-eth: add trace points on XSK events Ioana Ciornei
2022-09-17 14:59   ` kernel test robot

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=20220912182829.160715-6-ioana.ciornei@nxp.com \
    --to=ioana.ciornei@nxp.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.