]> www.infradead.org Git - users/hch/misc.git/commitdiff
eth: fbnic: fix saving stats from XDP_TX rings on close
authorJakub Kicinski <kuba@kernel.org>
Tue, 7 Oct 2025 23:26:47 +0000 (16:26 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 9 Oct 2025 09:10:02 +0000 (11:10 +0200)
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>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20251007232653.2099376-4-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
drivers/net/ethernet/meta/fbnic/fbnic_txrx.h

index a1c2db69b198a0a8ecb0d5429e0f3620e3fcc375..a37906b70c3aca13eb89eea7df3a57669d6989b9 100644 (file)
@@ -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);
        }
 
index a56dc148f66d74b01d18239f3c96aeed6c865726..26328e8090c6322f19b5bb1bacdd6547156fe9cc 100644 (file)
@@ -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;
 }
index 31fac0ba09026d3f71e10714590564a71afa46da..4a41e21ed542c7753020e73c8b209a1d10c70460 100644 (file)
@@ -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);