Skip to content

Commit bbdf9ec

Browse files
ZakKemblekuba-moo
authored andcommitted
net: bcmgenet: expose more stats in ethtool
Expose more per-queue and overall stats in ethtool Signed-off-by: Zak Kemble <[email protected]> Tested-by: Florian Fainelli <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e985b97 commit bbdf9ec

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

drivers/net/ethernet/broadcom/genet/bcmgenet.c

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,14 +1029,34 @@ struct bcmgenet_stats {
10291029
tx_rings[num].stats64, packets), \
10301030
STAT_GENET_SOFT_MIB64("txq" __stringify(num) "_bytes", \
10311031
tx_rings[num].stats64, bytes), \
1032+
STAT_GENET_SOFT_MIB64("txq" __stringify(num) "_errors", \
1033+
tx_rings[num].stats64, errors), \
1034+
STAT_GENET_SOFT_MIB64("txq" __stringify(num) "_dropped", \
1035+
tx_rings[num].stats64, dropped), \
10321036
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_bytes", \
10331037
rx_rings[num].stats64, bytes), \
10341038
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_packets", \
10351039
rx_rings[num].stats64, packets), \
10361040
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_errors", \
10371041
rx_rings[num].stats64, errors), \
10381042
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_dropped", \
1039-
rx_rings[num].stats64, dropped)
1043+
rx_rings[num].stats64, dropped), \
1044+
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_multicast", \
1045+
rx_rings[num].stats64, multicast), \
1046+
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_missed", \
1047+
rx_rings[num].stats64, missed), \
1048+
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_length_errors", \
1049+
rx_rings[num].stats64, length_errors), \
1050+
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_over_errors", \
1051+
rx_rings[num].stats64, over_errors), \
1052+
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_crc_errors", \
1053+
rx_rings[num].stats64, crc_errors), \
1054+
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_frame_errors", \
1055+
rx_rings[num].stats64, frame_errors), \
1056+
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_fragmented_errors", \
1057+
rx_rings[num].stats64, fragmented_errors), \
1058+
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_broadcast", \
1059+
rx_rings[num].stats64, broadcast)
10401060

10411061
/* There is a 0xC gap between the end of RX and beginning of TX stats and then
10421062
* between the end of TX stats and the beginning of the RX RUNT
@@ -1057,6 +1077,11 @@ static const struct bcmgenet_stats bcmgenet_gstrings_stats[] = {
10571077
STAT_RTNL(rx_dropped),
10581078
STAT_RTNL(tx_dropped),
10591079
STAT_RTNL(multicast),
1080+
STAT_RTNL(rx_missed_errors),
1081+
STAT_RTNL(rx_length_errors),
1082+
STAT_RTNL(rx_over_errors),
1083+
STAT_RTNL(rx_crc_errors),
1084+
STAT_RTNL(rx_frame_errors),
10601085
/* UniMAC RSV counters */
10611086
STAT_GENET_MIB_RX("rx_64_octets", mib.rx.pkt_cnt.cnt_64),
10621087
STAT_GENET_MIB_RX("rx_65_127_oct", mib.rx.pkt_cnt.cnt_127),
@@ -2358,7 +2383,7 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
23582383
if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) {
23592384
netif_err(priv, rx_status, dev,
23602385
"dropping fragmented packet!\n");
2361-
BCMGENET_STATS64_INC(stats, errors);
2386+
BCMGENET_STATS64_INC(stats, fragmented_errors);
23622387
dev_kfree_skb_any(skb);
23632388
goto next;
23642389
}
@@ -2412,6 +2437,8 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
24122437
u64_stats_add(&stats->bytes, len);
24132438
if (dma_flag & DMA_RX_MULT)
24142439
u64_stats_inc(&stats->multicast);
2440+
else if (dma_flag & DMA_RX_BRDCAST)
2441+
u64_stats_inc(&stats->broadcast);
24152442
u64_stats_update_end(&stats->syncp);
24162443

24172444
/* Notify kernel */
@@ -3569,6 +3596,7 @@ static void bcmgenet_get_stats64(struct net_device *dev,
35693596
struct bcmgenet_tx_stats64 *tx_stats;
35703597
struct bcmgenet_rx_stats64 *rx_stats;
35713598
u64 rx_length_errors, rx_over_errors;
3599+
u64 rx_missed, rx_fragmented_errors;
35723600
u64 rx_crc_errors, rx_frame_errors;
35733601
u64 tx_errors, tx_dropped;
35743602
u64 rx_errors, rx_dropped;
@@ -3577,7 +3605,6 @@ static void bcmgenet_get_stats64(struct net_device *dev,
35773605
unsigned int start;
35783606
unsigned int q;
35793607
u64 multicast;
3580-
u64 rx_missed;
35813608

35823609
for (q = 0; q <= priv->hw_params->tx_queues; q++) {
35833610
tx_stats = &priv->tx_rings[q].stats64;
@@ -3608,12 +3635,14 @@ static void bcmgenet_get_stats64(struct net_device *dev,
36083635
rx_over_errors = u64_stats_read(&rx_stats->over_errors);
36093636
rx_crc_errors = u64_stats_read(&rx_stats->crc_errors);
36103637
rx_frame_errors = u64_stats_read(&rx_stats->frame_errors);
3638+
rx_fragmented_errors = u64_stats_read(&rx_stats->fragmented_errors);
36113639
multicast = u64_stats_read(&rx_stats->multicast);
36123640
} while (u64_stats_fetch_retry(&rx_stats->syncp, start));
36133641

36143642
rx_errors += rx_length_errors;
36153643
rx_errors += rx_crc_errors;
36163644
rx_errors += rx_frame_errors;
3645+
rx_errors += rx_fragmented_errors;
36173646

36183647
stats->rx_bytes += rx_bytes;
36193648
stats->rx_packets += rx_packets;

drivers/net/ethernet/broadcom/genet/bcmgenet.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,13 @@ struct bcmgenet_rx_stats64 {
170170
u64_stats_t errors;
171171
u64_stats_t dropped;
172172
u64_stats_t multicast;
173+
u64_stats_t broadcast;
173174
u64_stats_t missed;
174175
u64_stats_t length_errors;
175176
u64_stats_t over_errors;
176177
u64_stats_t crc_errors;
177178
u64_stats_t frame_errors;
179+
u64_stats_t fragmented_errors;
178180
};
179181

180182
#define UMAC_MIB_START 0x400

0 commit comments

Comments
 (0)