Skip to content

Commit 2eb34ba

Browse files
anguy11Jeff Kirsher
authored andcommitted
ixgbevf: Add XDP queue stats reporting
XDP stats are included in TX stats, however, they are not reported in TX queue stats since they are setup on different queues. Add reporting for XDP queue stats to provide consistency between the total stats and per queue stats. Signed-off-by: Tony Nguyen <[email protected]> Acked-by: John Fastabend <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent be83333 commit 2eb34ba

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

drivers/net/ethernet/intel/ixgbevf/ethtool.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ static struct ixgbe_stats ixgbevf_gstrings_stats[] = {
8282

8383
#define IXGBEVF_QUEUE_STATS_LEN ( \
8484
(((struct ixgbevf_adapter *)netdev_priv(netdev))->num_tx_queues + \
85+
((struct ixgbevf_adapter *)netdev_priv(netdev))->num_xdp_queues + \
8586
((struct ixgbevf_adapter *)netdev_priv(netdev))->num_rx_queues) * \
8687
(sizeof(struct ixgbevf_stats) / sizeof(u64)))
8788
#define IXGBEVF_GLOBAL_STATS_LEN ARRAY_SIZE(ixgbevf_gstrings_stats)
@@ -491,6 +492,23 @@ static void ixgbevf_get_ethtool_stats(struct net_device *netdev,
491492
i += 2;
492493
}
493494

495+
/* populate XDP queue data */
496+
for (j = 0; j < adapter->num_xdp_queues; j++) {
497+
ring = adapter->xdp_ring[j];
498+
if (!ring) {
499+
data[i++] = 0;
500+
data[i++] = 0;
501+
continue;
502+
}
503+
504+
do {
505+
start = u64_stats_fetch_begin_irq(&ring->syncp);
506+
data[i] = ring->stats.packets;
507+
data[i + 1] = ring->stats.bytes;
508+
} while (u64_stats_fetch_retry_irq(&ring->syncp, start));
509+
i += 2;
510+
}
511+
494512
/* populate Rx queue data */
495513
for (j = 0; j < adapter->num_rx_queues; j++) {
496514
ring = adapter->rx_ring[j];
@@ -534,6 +552,12 @@ static void ixgbevf_get_strings(struct net_device *netdev, u32 stringset,
534552
sprintf(p, "tx_queue_%u_bytes", i);
535553
p += ETH_GSTRING_LEN;
536554
}
555+
for (i = 0; i < adapter->num_xdp_queues; i++) {
556+
sprintf(p, "xdp_queue_%u_packets", i);
557+
p += ETH_GSTRING_LEN;
558+
sprintf(p, "xdp_queue_%u_bytes", i);
559+
p += ETH_GSTRING_LEN;
560+
}
537561
for (i = 0; i < adapter->num_rx_queues; i++) {
538562
sprintf(p, "rx_queue_%u_packets", i);
539563
p += ETH_GSTRING_LEN;

0 commit comments

Comments
 (0)