net: bcmgenet: expose more stats in ethtool
Expose more per-queue and overall stats in ethtool Signed-off-by: Zak Kemble <zakkemble@gmail.com> Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Link: https://patch.msgid.link/20250519113257.1031-4-zakkemble@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
e985b97ac1
commit
bbdf9ec610
@@ -1029,6 +1029,10 @@ struct bcmgenet_stats {
|
||||
tx_rings[num].stats64, packets), \
|
||||
STAT_GENET_SOFT_MIB64("txq" __stringify(num) "_bytes", \
|
||||
tx_rings[num].stats64, bytes), \
|
||||
STAT_GENET_SOFT_MIB64("txq" __stringify(num) "_errors", \
|
||||
tx_rings[num].stats64, errors), \
|
||||
STAT_GENET_SOFT_MIB64("txq" __stringify(num) "_dropped", \
|
||||
tx_rings[num].stats64, dropped), \
|
||||
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_bytes", \
|
||||
rx_rings[num].stats64, bytes), \
|
||||
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_packets", \
|
||||
@@ -1036,7 +1040,23 @@ struct bcmgenet_stats {
|
||||
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_errors", \
|
||||
rx_rings[num].stats64, errors), \
|
||||
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_dropped", \
|
||||
rx_rings[num].stats64, dropped)
|
||||
rx_rings[num].stats64, dropped), \
|
||||
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_multicast", \
|
||||
rx_rings[num].stats64, multicast), \
|
||||
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_missed", \
|
||||
rx_rings[num].stats64, missed), \
|
||||
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_length_errors", \
|
||||
rx_rings[num].stats64, length_errors), \
|
||||
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_over_errors", \
|
||||
rx_rings[num].stats64, over_errors), \
|
||||
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_crc_errors", \
|
||||
rx_rings[num].stats64, crc_errors), \
|
||||
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_frame_errors", \
|
||||
rx_rings[num].stats64, frame_errors), \
|
||||
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_fragmented_errors", \
|
||||
rx_rings[num].stats64, fragmented_errors), \
|
||||
STAT_GENET_SOFT_MIB64("rxq" __stringify(num) "_broadcast", \
|
||||
rx_rings[num].stats64, broadcast)
|
||||
|
||||
/* There is a 0xC gap between the end of RX and beginning of TX stats and then
|
||||
* 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[] = {
|
||||
STAT_RTNL(rx_dropped),
|
||||
STAT_RTNL(tx_dropped),
|
||||
STAT_RTNL(multicast),
|
||||
STAT_RTNL(rx_missed_errors),
|
||||
STAT_RTNL(rx_length_errors),
|
||||
STAT_RTNL(rx_over_errors),
|
||||
STAT_RTNL(rx_crc_errors),
|
||||
STAT_RTNL(rx_frame_errors),
|
||||
/* UniMAC RSV counters */
|
||||
STAT_GENET_MIB_RX("rx_64_octets", mib.rx.pkt_cnt.cnt_64),
|
||||
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,
|
||||
if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) {
|
||||
netif_err(priv, rx_status, dev,
|
||||
"dropping fragmented packet!\n");
|
||||
BCMGENET_STATS64_INC(stats, errors);
|
||||
BCMGENET_STATS64_INC(stats, fragmented_errors);
|
||||
dev_kfree_skb_any(skb);
|
||||
goto next;
|
||||
}
|
||||
@@ -2412,6 +2437,8 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
|
||||
u64_stats_add(&stats->bytes, len);
|
||||
if (dma_flag & DMA_RX_MULT)
|
||||
u64_stats_inc(&stats->multicast);
|
||||
else if (dma_flag & DMA_RX_BRDCAST)
|
||||
u64_stats_inc(&stats->broadcast);
|
||||
u64_stats_update_end(&stats->syncp);
|
||||
|
||||
/* Notify kernel */
|
||||
@@ -3569,6 +3596,7 @@ static void bcmgenet_get_stats64(struct net_device *dev,
|
||||
struct bcmgenet_tx_stats64 *tx_stats;
|
||||
struct bcmgenet_rx_stats64 *rx_stats;
|
||||
u64 rx_length_errors, rx_over_errors;
|
||||
u64 rx_missed, rx_fragmented_errors;
|
||||
u64 rx_crc_errors, rx_frame_errors;
|
||||
u64 tx_errors, tx_dropped;
|
||||
u64 rx_errors, rx_dropped;
|
||||
@@ -3577,7 +3605,6 @@ static void bcmgenet_get_stats64(struct net_device *dev,
|
||||
unsigned int start;
|
||||
unsigned int q;
|
||||
u64 multicast;
|
||||
u64 rx_missed;
|
||||
|
||||
for (q = 0; q <= priv->hw_params->tx_queues; q++) {
|
||||
tx_stats = &priv->tx_rings[q].stats64;
|
||||
@@ -3608,12 +3635,14 @@ static void bcmgenet_get_stats64(struct net_device *dev,
|
||||
rx_over_errors = u64_stats_read(&rx_stats->over_errors);
|
||||
rx_crc_errors = u64_stats_read(&rx_stats->crc_errors);
|
||||
rx_frame_errors = u64_stats_read(&rx_stats->frame_errors);
|
||||
rx_fragmented_errors = u64_stats_read(&rx_stats->fragmented_errors);
|
||||
multicast = u64_stats_read(&rx_stats->multicast);
|
||||
} while (u64_stats_fetch_retry(&rx_stats->syncp, start));
|
||||
|
||||
rx_errors += rx_length_errors;
|
||||
rx_errors += rx_crc_errors;
|
||||
rx_errors += rx_frame_errors;
|
||||
rx_errors += rx_fragmented_errors;
|
||||
|
||||
stats->rx_bytes += rx_bytes;
|
||||
stats->rx_packets += rx_packets;
|
||||
|
||||
@@ -170,11 +170,13 @@ struct bcmgenet_rx_stats64 {
|
||||
u64_stats_t errors;
|
||||
u64_stats_t dropped;
|
||||
u64_stats_t multicast;
|
||||
u64_stats_t broadcast;
|
||||
u64_stats_t missed;
|
||||
u64_stats_t length_errors;
|
||||
u64_stats_t over_errors;
|
||||
u64_stats_t crc_errors;
|
||||
u64_stats_t frame_errors;
|
||||
u64_stats_t fragmented_errors;
|
||||
};
|
||||
|
||||
#define UMAC_MIB_START 0x400
|
||||
|
||||
Reference in New Issue
Block a user