ethtool: add interface to read RMON stats

Most devices maintain RMON (RFC 2819) stats - particularly
the "histogram" of packets received by size. Unlike other
RFCs which duplicate IEEE stats, the short/oversized frame
counters in RMON don't seem to match IEEE stats 1-to-1 either,
so expose those, too. Do not expose basic packet, CRC errors
etc - those are already otherwise covered.

Because standard defines packet ranges only up to 1518, and
everything above that should theoretically be "oversized"
- devices often create their own ranges.

Going beyond what the RFC defines - expose the "histogram"
in the Tx direction (assume for now that the ranges will
be the same).

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jakub Kicinski
2021-04-16 12:27:42 -07:00
committed by David S. Miller
parent bfad2b979d
commit a8b06e9d40
6 changed files with 161 additions and 0 deletions

View File

@@ -700,6 +700,7 @@ enum {
ETHTOOL_STATS_ETH_PHY,
ETHTOOL_STATS_ETH_MAC,
ETHTOOL_STATS_ETH_CTRL,
ETHTOOL_STATS_RMON,
/* add new constants above here */
__ETHTOOL_STATS_CNT
@@ -714,6 +715,13 @@ enum {
ETHTOOL_A_STATS_GRP_STAT, /* nest */
ETHTOOL_A_STATS_GRP_HIST_RX, /* nest */
ETHTOOL_A_STATS_GRP_HIST_TX, /* nest */
ETHTOOL_A_STATS_GRP_HIST_BKT_LOW, /* u32 */
ETHTOOL_A_STATS_GRP_HIST_BKT_HI, /* u32 */
ETHTOOL_A_STATS_GRP_HIST_VAL, /* u64 */
/* add new constants above here */
__ETHTOOL_A_STATS_GRP_CNT,
ETHTOOL_A_STATS_GRP_MAX = (__ETHTOOL_A_STATS_CNT - 1)
@@ -793,6 +801,21 @@ enum {
ETHTOOL_A_STATS_ETH_CTRL_MAX = (__ETHTOOL_A_STATS_ETH_CTRL_CNT - 1)
};
enum {
/* etherStatsUndersizePkts */
ETHTOOL_A_STATS_RMON_UNDERSIZE,
/* etherStatsOversizePkts */
ETHTOOL_A_STATS_RMON_OVERSIZE,
/* etherStatsFragments */
ETHTOOL_A_STATS_RMON_FRAG,
/* etherStatsJabbers */
ETHTOOL_A_STATS_RMON_JABBER,
/* add new constants above here */
__ETHTOOL_A_STATS_RMON_CNT,
ETHTOOL_A_STATS_RMON_MAX = (__ETHTOOL_A_STATS_RMON_CNT - 1)
};
/* generic netlink info */
#define ETHTOOL_GENL_NAME "ethtool"
#define ETHTOOL_GENL_VERSION 1