From: Shenwei Wang <shenwei.wang@nxp.com>
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Jesper Dangaard Brouer <hawk@kernel.org>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev, Shenwei Wang <shenwei.wang@nxp.com>
Subject: [PATCH v5 3/3] net: fec: add page pool statistics
Date: Tue, 15 Nov 2022 14:49:51 -0600 [thread overview]
Message-ID: <20221115204951.370217-4-shenwei.wang@nxp.com> (raw)
In-Reply-To: <20221115204951.370217-1-shenwei.wang@nxp.com>
add page pool statistics to ethtool stats.
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
---
drivers/net/ethernet/freescale/fec_main.c | 24 ++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index bb2157022022..ae905ea1ab7d 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2755,6 +2755,24 @@ static void fec_enet_get_xdp_stats(struct fec_enet_private *fep, u64 *data)
memcpy(data, xdp_stats, sizeof(xdp_stats));
}
+static void fec_enet_page_pool_stats(struct fec_enet_private *fep, u64 *data)
+{
+ struct page_pool_stats stats = {};
+ struct fec_enet_priv_rx_q *rxq;
+ int i;
+
+ for (i = fep->num_rx_queues - 1; i >= 0; i--) {
+ rxq = fep->rx_queue[i];
+
+ if (!rxq->page_pool)
+ continue;
+
+ page_pool_get_stats(rxq->page_pool, &stats);
+ }
+
+ page_pool_ethtool_stats_get(data, &stats);
+}
+
static void fec_enet_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 *data)
{
@@ -2768,6 +2786,8 @@ static void fec_enet_get_ethtool_stats(struct net_device *dev,
fec_enet_get_xdp_stats(fep, data);
data += XDP_STATS_TOTAL;
+
+ fec_enet_page_pool_stats(fep, data);
}
static void fec_enet_get_strings(struct net_device *netdev,
@@ -2784,6 +2804,7 @@ static void fec_enet_get_strings(struct net_device *netdev,
strscpy(data, fec_xdp_stat_strs[i], ETH_GSTRING_LEN);
data += ETH_GSTRING_LEN;
}
+ page_pool_ethtool_stats_get_strings(data);
break;
case ETH_SS_TEST:
net_selftest_get_strings(data);
@@ -2795,7 +2816,8 @@ static int fec_enet_get_sset_count(struct net_device *dev, int sset)
{
switch (sset) {
case ETH_SS_STATS:
- return (ARRAY_SIZE(fec_stats) + XDP_STATS_TOTAL);
+ return (ARRAY_SIZE(fec_stats) + XDP_STATS_TOTAL
+ + page_pool_ethtool_stats_get_count());
case ETH_SS_TEST:
return net_selftest_get_count();
default:
--
2.34.1
next prev parent reply other threads:[~2022-11-15 20:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 20:49 [PATCH v5 0/3] net: fec: add xdp and " Shenwei Wang
2022-11-15 20:49 ` [PATCH v5 1/3] net: page_pool: export page_pool_stats definition Shenwei Wang
2022-11-15 20:49 ` [PATCH v5 2/3] net: fec: add xdp statistics Shenwei Wang
2022-11-16 16:02 ` Alexander Lobakin
2022-11-17 1:15 ` [EXT] " Shenwei Wang
2022-11-15 20:49 ` Shenwei Wang [this message]
2022-11-16 16:47 ` [PATCH v5 0/3] net: fec: add xdp and page pool statistics Jakub Kicinski
2022-11-16 16:49 ` [EXT] " Shenwei Wang
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=20221115204951.370217-4-shenwei.wang@nxp.com \
--to=shenwei.wang@nxp.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=imx@lists.linux.dev \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®