Skip to content

Commit 858b78b

Browse files
kuba-mooPaolo Abeni
authored andcommitted
eth: fbnic: fix saving stats from XDP_TX rings on close
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: 5213ff0 ("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>
1 parent 613e9e8 commit 858b78b

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static void fbnic_aggregate_vector_counters(struct fbnic_net *fbn,
185185

186186
for (i = 0; i < nv->txt_count; i++) {
187187
fbnic_aggregate_ring_tx_counters(fbn, &nv->qt[i].sub0);
188-
fbnic_aggregate_ring_tx_counters(fbn, &nv->qt[i].sub1);
188+
fbnic_aggregate_ring_xdp_counters(fbn, &nv->qt[i].sub1);
189189
fbnic_aggregate_ring_tx_counters(fbn, &nv->qt[i].cmpl);
190190
}
191191

drivers/net/ethernet/meta/fbnic/fbnic_txrx.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,18 +1433,16 @@ void fbnic_aggregate_ring_tx_counters(struct fbnic_net *fbn,
14331433
BUILD_BUG_ON(sizeof(fbn->tx_stats.twq) / 8 != 6);
14341434
}
14351435

1436-
static void fbnic_aggregate_ring_xdp_counters(struct fbnic_net *fbn,
1437-
struct fbnic_ring *xdpr)
1436+
void fbnic_aggregate_ring_xdp_counters(struct fbnic_net *fbn,
1437+
struct fbnic_ring *xdpr)
14381438
{
14391439
struct fbnic_queue_stats *stats = &xdpr->stats;
14401440

14411441
if (!(xdpr->flags & FBNIC_RING_F_STATS))
14421442
return;
14431443

14441444
/* Capture stats from queues before dissasociating them */
1445-
fbn->rx_stats.bytes += stats->bytes;
1446-
fbn->rx_stats.packets += stats->packets;
1447-
fbn->rx_stats.dropped += stats->dropped;
1445+
fbn->tx_stats.dropped += stats->dropped;
14481446
fbn->tx_stats.bytes += stats->bytes;
14491447
fbn->tx_stats.packets += stats->packets;
14501448
}

drivers/net/ethernet/meta/fbnic/fbnic_txrx.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ void fbnic_aggregate_ring_rx_counters(struct fbnic_net *fbn,
167167
struct fbnic_ring *rxr);
168168
void fbnic_aggregate_ring_tx_counters(struct fbnic_net *fbn,
169169
struct fbnic_ring *txr);
170+
void fbnic_aggregate_ring_xdp_counters(struct fbnic_net *fbn,
171+
struct fbnic_ring *xdpr);
170172

171173
int fbnic_alloc_napi_vectors(struct fbnic_net *fbn);
172174
void fbnic_free_napi_vectors(struct fbnic_net *fbn);

0 commit comments

Comments
 (0)