Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: enetc: fix aggregate RMON counters not showing the ranges

When running "ethtool -S eno0 --groups rmon" without an explicit "--src
emac|pmac" argument, the kernel will not report
rx-rmon-etherStatsPkts64to64Octets, rx-rmon-etherStatsPkts65to127Octets,
etc. This is because on ETHTOOL_MAC_STATS_SRC_AGGREGATE, we do not
populate the "ranges" argument.

ocelot_port_get_rmon_stats() does things differently and things work
there. I had forgotten to make sure that the code is structured the same
way in both drivers, so do that now.

Fixes: cf52bd238b75 ("net: enetc: add support for MAC Merge statistics counters")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20230321232831.1200905-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Vladimir Oltean and committed by
Jakub Kicinski
c79493c3 bb765a74

+5 -6
+5 -6
drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
··· 370 370 }; 371 371 372 372 static void enetc_rmon_stats(struct enetc_hw *hw, int mac, 373 - struct ethtool_rmon_stats *s, 374 - const struct ethtool_rmon_hist_range **ranges) 373 + struct ethtool_rmon_stats *s) 375 374 { 376 375 s->undersize_pkts = enetc_port_rd(hw, ENETC_PM_RUND(mac)); 377 376 s->oversize_pkts = enetc_port_rd(hw, ENETC_PM_ROVR(mac)); ··· 392 393 s->hist_tx[4] = enetc_port_rd(hw, ENETC_PM_T1023(mac)); 393 394 s->hist_tx[5] = enetc_port_rd(hw, ENETC_PM_T1522(mac)); 394 395 s->hist_tx[6] = enetc_port_rd(hw, ENETC_PM_T1523X(mac)); 395 - 396 - *ranges = enetc_rmon_ranges; 397 396 } 398 397 399 398 static void enetc_get_eth_mac_stats(struct net_device *ndev, ··· 444 447 struct enetc_hw *hw = &priv->si->hw; 445 448 struct enetc_si *si = priv->si; 446 449 450 + *ranges = enetc_rmon_ranges; 451 + 447 452 switch (rmon_stats->src) { 448 453 case ETHTOOL_MAC_STATS_SRC_EMAC: 449 - enetc_rmon_stats(hw, 0, rmon_stats, ranges); 454 + enetc_rmon_stats(hw, 0, rmon_stats); 450 455 break; 451 456 case ETHTOOL_MAC_STATS_SRC_PMAC: 452 457 if (si->hw_features & ENETC_SI_F_QBU) 453 - enetc_rmon_stats(hw, 1, rmon_stats, ranges); 458 + enetc_rmon_stats(hw, 1, rmon_stats); 454 459 break; 455 460 case ETHTOOL_MAC_STATS_SRC_AGGREGATE: 456 461 ethtool_aggregate_rmon_stats(ndev, rmon_stats);