From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org, bpf@vger.kernel.org,
Jakub Kicinski <kuba@kernel.org>,
alexanderduyck@fb.com, sdf@fomichev.me, mohsin.bashr@gmail.com
Subject: [PATCH net v2 3/9] eth: fbnic: fix saving stats from XDP_TX rings on close
Date: Tue, 7 Oct 2025 16:26:47 -0700 [thread overview]
Message-ID: <20251007232653.2099376-4-kuba@kernel.org> (raw)
In-Reply-To: <20251007232653.2099376-1-kuba@kernel.org>
When rings are freed - stats get added to the device level stat
structs. Save the stats from the XDP_TX ring just as Tx stats.
Previously they would be saved to Rx and Tx stats. So we'd not
see XDP_TX packets as Rx during runtime but after an down/up cycle
the packets would appear in stats.
Correct the helper used by ethtool code which does a runtime
config switch.
Reviewed-by: Simon Horman <horms@kernel.org>
Fixes: 5213ff086344 ("eth: fbnic: Collect packet statistics for XDP")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: alexanderduyck@fb.com
CC: sdf@fomichev.me
CC: mohsin.bashr@gmail.com
CC: bpf@vger.kernel.org
---
drivers/net/ethernet/meta/fbnic/fbnic_txrx.h | 2 ++
drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c | 2 +-
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 8 +++-----
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.h b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.h
index 31fac0ba0902..4a41e21ed542 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.h
@@ -167,6 +167,8 @@ void fbnic_aggregate_ring_rx_counters(struct fbnic_net *fbn,
struct fbnic_ring *rxr);
void fbnic_aggregate_ring_tx_counters(struct fbnic_net *fbn,
struct fbnic_ring *txr);
+void fbnic_aggregate_ring_xdp_counters(struct fbnic_net *fbn,
+ struct fbnic_ring *xdpr);
int fbnic_alloc_napi_vectors(struct fbnic_net *fbn);
void fbnic_free_napi_vectors(struct fbnic_net *fbn);
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c b/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
index a1c2db69b198..a37906b70c3a 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
@@ -185,7 +185,7 @@ static void fbnic_aggregate_vector_counters(struct fbnic_net *fbn,
for (i = 0; i < nv->txt_count; i++) {
fbnic_aggregate_ring_tx_counters(fbn, &nv->qt[i].sub0);
- fbnic_aggregate_ring_tx_counters(fbn, &nv->qt[i].sub1);
+ fbnic_aggregate_ring_xdp_counters(fbn, &nv->qt[i].sub1);
fbnic_aggregate_ring_tx_counters(fbn, &nv->qt[i].cmpl);
}
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
index a56dc148f66d..26328e8090c6 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
@@ -1433,8 +1433,8 @@ void fbnic_aggregate_ring_tx_counters(struct fbnic_net *fbn,
BUILD_BUG_ON(sizeof(fbn->tx_stats.twq) / 8 != 6);
}
-static void fbnic_aggregate_ring_xdp_counters(struct fbnic_net *fbn,
- struct fbnic_ring *xdpr)
+void fbnic_aggregate_ring_xdp_counters(struct fbnic_net *fbn,
+ struct fbnic_ring *xdpr)
{
struct fbnic_queue_stats *stats = &xdpr->stats;
@@ -1442,9 +1442,7 @@ static void fbnic_aggregate_ring_xdp_counters(struct fbnic_net *fbn,
return;
/* Capture stats from queues before dissasociating them */
- fbn->rx_stats.bytes += stats->bytes;
- fbn->rx_stats.packets += stats->packets;
- fbn->rx_stats.dropped += stats->dropped;
+ fbn->tx_stats.dropped += stats->dropped;
fbn->tx_stats.bytes += stats->bytes;
fbn->tx_stats.packets += stats->packets;
}
--
2.51.0
next prev parent reply other threads:[~2025-10-07 23:27 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 23:26 [PATCH net v2 0/9] eth: fbnic: fix XDP_TX and XDP vs qstats Jakub Kicinski
2025-10-07 23:26 ` [PATCH net v2 1/9] eth: fbnic: fix missing programming of the default descriptor Jakub Kicinski
2025-10-08 23:28 ` Jacob Keller
2025-10-07 23:26 ` [PATCH net v2 2/9] eth: fbnic: fix accounting of XDP packets Jakub Kicinski
2025-10-08 23:29 ` Jacob Keller
2025-10-07 23:26 ` Jakub Kicinski [this message]
2025-10-08 23:30 ` [PATCH net v2 3/9] eth: fbnic: fix saving stats from XDP_TX rings on close Jacob Keller
2025-10-07 23:26 ` [PATCH net v2 4/9] selftests: drv-net: xdp: rename netnl to ethnl Jakub Kicinski
2025-10-08 23:31 ` Jacob Keller
2025-10-07 23:26 ` [PATCH net v2 5/9] selftests: drv-net: xdp: add test for interface level qstats Jakub Kicinski
2025-10-08 23:32 ` Jacob Keller
2025-10-07 23:26 ` [PATCH net v2 6/9] eth: fbnic: fix reporting of alloc_failed qstats Jakub Kicinski
2025-10-08 23:33 ` Jacob Keller
2025-10-07 23:26 ` [PATCH net v2 7/9] selftests: drv-net: fix linter warnings in pp_alloc_fail Jakub Kicinski
2025-10-08 23:34 ` Jacob Keller
2025-10-07 23:26 ` [PATCH net v2 8/9] selftests: drv-net: pp_alloc_fail: lower traffic expectations Jakub Kicinski
2025-10-08 23:35 ` Jacob Keller
2025-10-07 23:26 ` [PATCH net v2 9/9] selftests: drv-net: pp_alloc_fail: add necessary optoins to config Jakub Kicinski
2025-10-08 23:35 ` Jacob Keller
2025-10-09 9:20 ` [PATCH net v2 0/9] eth: fbnic: fix XDP_TX and XDP vs qstats patchwork-bot+netdevbpf
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=20251007232653.2099376-4-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=alexanderduyck@fb.com \
--cc=andrew+netdev@lunn.ch \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=mohsin.bashr@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
/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