History

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).

Jakub Kicinski committed 5 years ago

Commit a8b06e91 parent bfad2b96 files · +161 −0Browse files

Showing the changes to include/uapi (2 of 6 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/ethtool.h +2 −0
  2. include/uapi/linux/ethtool_netlink.h +23 −0
include/uapi/linux/ethtool.h+2−0
@@ -673,6 +673,7 @@ enum ethtool_link_ext_substate_cable_issue { · 672 unmodified lines
673673 * @ETH_SS_STATS_ETH_PHY: names of IEEE 802.3 PHY statistics
674674 * @ETH_SS_STATS_ETH_MAC: names of IEEE 802.3 MAC statistics
675675 * @ETH_SS_STATS_ETH_CTRL: names of IEEE 802.3 MAC Control statistics
676+ * @ETH_SS_STATS_RMON: names of RMON statistics
676677 *
677678 * @ETH_SS_COUNT: number of defined string sets
678679 */
@@ -697,6 +698,7 @@ enum ethtool_stringset { · 18 unmodified lines
697698 ETH_SS_STATS_ETH_PHY,
698699 ETH_SS_STATS_ETH_MAC,
699700 ETH_SS_STATS_ETH_CTRL,
701+ ETH_SS_STATS_RMON,
700702
701703 /* add new constants above here */
702704 ETH_SS_COUNT
include/uapi/linux/ethtool_netlink.h+23−0
@@ -700,6 +700,7 @@ enum { · 699 unmodified lines
700700 ETHTOOL_STATS_ETH_PHY,
701701 ETHTOOL_STATS_ETH_MAC,
702702 ETHTOOL_STATS_ETH_CTRL,
703+ ETHTOOL_STATS_RMON,
703704
704705 /* add new constants above here */
705706 __ETHTOOL_STATS_CNT
@@ -714,6 +715,13 @@ enum { · 8 unmodified lines
714715
715716 ETHTOOL_A_STATS_GRP_STAT, /* nest */
716717
718+ ETHTOOL_A_STATS_GRP_HIST_RX, /* nest */
719+ ETHTOOL_A_STATS_GRP_HIST_TX, /* nest */
720+
721+ ETHTOOL_A_STATS_GRP_HIST_BKT_LOW, /* u32 */
722+ ETHTOOL_A_STATS_GRP_HIST_BKT_HI, /* u32 */
723+ ETHTOOL_A_STATS_GRP_HIST_VAL, /* u64 */
724+
717725 /* add new constants above here */
718726 __ETHTOOL_A_STATS_GRP_CNT,
719727 ETHTOOL_A_STATS_GRP_MAX = (__ETHTOOL_A_STATS_CNT - 1)
@@ -793,6 +801,21 @@ enum { · 73 unmodified lines
793801 ETHTOOL_A_STATS_ETH_CTRL_MAX = (__ETHTOOL_A_STATS_ETH_CTRL_CNT - 1)
794802 };
795803
804+enum {
805+ /* etherStatsUndersizePkts */
806+ ETHTOOL_A_STATS_RMON_UNDERSIZE,
807+ /* etherStatsOversizePkts */
808+ ETHTOOL_A_STATS_RMON_OVERSIZE,
809+ /* etherStatsFragments */
810+ ETHTOOL_A_STATS_RMON_FRAG,
811+ /* etherStatsJabbers */
812+ ETHTOOL_A_STATS_RMON_JABBER,
813+
814+ /* add new constants above here */
815+ __ETHTOOL_A_STATS_RMON_CNT,
816+ ETHTOOL_A_STATS_RMON_MAX = (__ETHTOOL_A_STATS_RMON_CNT - 1)
817+};
818+
796819 /* generic netlink info */
797820 #define ETHTOOL_GENL_NAME "ethtool"
798821 #define ETHTOOL_GENL_VERSION 1