@@ -210,6 +210,7 @@ Userspace to kernel:
210210 ``ETHTOOL_MSG_TUNNEL_INFO_GET `` get tunnel offload info
211211 ``ETHTOOL_MSG_FEC_GET `` get FEC settings
212212 ``ETHTOOL_MSG_FEC_SET `` set FEC settings
213+ ``ETHTOOL_MSG_STATS_GET `` get standard statistics
213214 ===================================== ================================
214215
215216Kernel to userspace:
@@ -246,6 +247,7 @@ Kernel to userspace:
246247 ``ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY `` tunnel offload info
247248 ``ETHTOOL_MSG_FEC_GET_REPLY `` FEC settings
248249 ``ETHTOOL_MSG_FEC_NTF `` FEC settings
250+ ``ETHTOOL_MSG_STATS_GET_REPLY `` standard statistics
249251 ===================================== =================================
250252
251253``GET `` requests are sent by userspace applications to retrieve device
@@ -1391,6 +1393,86 @@ Kernel response contents:
13911393``ETHTOOL_A_MODULE_EEPROM_DATA `` has an attribute length equal to the amount of
13921394bytes driver actually read.
13931395
1396+ STATS_GET
1397+ =========
1398+
1399+ Get standard statistics for the interface. Note that this is not
1400+ a re-implementation of ``ETHTOOL_GSTATS `` which exposed driver-defined
1401+ stats.
1402+
1403+ Request contents:
1404+
1405+ ======================================= ====== ==========================
1406+ ``ETHTOOL_A_STATS_HEADER `` nested request header
1407+ ``ETHTOOL_A_STATS_GROUPS `` bitset requested groups of stats
1408+ ======================================= ====== ==========================
1409+
1410+ Kernel response contents:
1411+
1412+ +-----------------------------------+--------+--------------------------------+
1413+ | ``ETHTOOL_A_STATS_HEADER `` | nested | reply header |
1414+ +-----------------------------------+--------+--------------------------------+
1415+ | ``ETHTOOL_A_STATS_GRP `` | nested | one or more group of stats |
1416+ +-+---------------------------------+--------+--------------------------------+
1417+ | | ``ETHTOOL_A_STATS_GRP_ID `` | u32 | group ID - ``ETHTOOL_STATS_* `` |
1418+ +-+---------------------------------+--------+--------------------------------+
1419+ | | ``ETHTOOL_A_STATS_GRP_SS_ID `` | u32 | string set ID for names |
1420+ +-+---------------------------------+--------+--------------------------------+
1421+ | | ``ETHTOOL_A_STATS_GRP_STAT `` | nested | nest containing a statistic |
1422+ +-+---------------------------------+--------+--------------------------------+
1423+ | | ``ETHTOOL_A_STATS_GRP_HIST_RX `` | nested | histogram statistic (Rx) |
1424+ +-+---------------------------------+--------+--------------------------------+
1425+ | | ``ETHTOOL_A_STATS_GRP_HIST_TX `` | nested | histogram statistic (Tx) |
1426+ +-+---------------------------------+--------+--------------------------------+
1427+
1428+ Users specify which groups of statistics they are requesting via
1429+ the ``ETHTOOL_A_STATS_GROUPS `` bitset. Currently defined values are:
1430+
1431+ ====================== ======== ===============================================
1432+ ETHTOOL_STATS_ETH_MAC eth-mac Basic IEEE 802.3 MAC statistics (30.3.1.1.*)
1433+ ETHTOOL_STATS_ETH_PHY eth-phy Basic IEEE 802.3 PHY statistics (30.3.2.1.*)
1434+ ETHTOOL_STATS_ETH_CTRL eth-ctrl Basic IEEE 802.3 MAC Ctrl statistics (30.3.3.*)
1435+ ETHTOOL_STATS_RMON rmon RMON (RFC 2819) statistics
1436+ ====================== ======== ===============================================
1437+
1438+ Each group should have a corresponding ``ETHTOOL_A_STATS_GRP `` in the reply.
1439+ ``ETHTOOL_A_STATS_GRP_ID `` identifies which group's statistics nest contains.
1440+ ``ETHTOOL_A_STATS_GRP_SS_ID `` identifies the string set ID for the names of
1441+ the statistics in the group, if available.
1442+
1443+ Statistics are added to the ``ETHTOOL_A_STATS_GRP `` nest under
1444+ ``ETHTOOL_A_STATS_GRP_STAT ``. ``ETHTOOL_A_STATS_GRP_STAT `` should contain
1445+ single 8 byte (u64) attribute inside - the type of that attribute is
1446+ the statistic ID and the value is the value of the statistic.
1447+ Each group has its own interpretation of statistic IDs.
1448+ Attribute IDs correspond to strings from the string set identified
1449+ by ``ETHTOOL_A_STATS_GRP_SS_ID ``. Complex statistics (such as RMON histogram
1450+ entries) are also listed inside ``ETHTOOL_A_STATS_GRP `` and do not have
1451+ a string defined in the string set.
1452+
1453+ RMON "histogram" counters count number of packets within given size range.
1454+ Because RFC does not specify the ranges beyond the standard 1518 MTU devices
1455+ differ in definition of buckets. For this reason the definition of packet ranges
1456+ is left to each driver.
1457+
1458+ ``ETHTOOL_A_STATS_GRP_HIST_RX `` and ``ETHTOOL_A_STATS_GRP_HIST_TX `` nests
1459+ contain the following attributes:
1460+
1461+ ================================= ====== ===================================
1462+ ETHTOOL_A_STATS_RMON_HIST_BKT_LOW u32 low bound of the packet size bucket
1463+ ETHTOOL_A_STATS_RMON_HIST_BKT_HI u32 high bound of the bucket
1464+ ETHTOOL_A_STATS_RMON_HIST_VAL u64 packet counter
1465+ ================================= ====== ===================================
1466+
1467+ Low and high bounds are inclusive, for example:
1468+
1469+ ============================= ==== ====
1470+ RFC statistic low high
1471+ ============================= ==== ====
1472+ etherStatsPkts64Octets 0 64
1473+ etherStatsPkts512to1023Octets 512 1023
1474+ ============================= ==== ====
1475+
13941476Request translation
13951477===================
13961478
0 commit comments