4
4
Interface statistics
5
5
====================
6
6
7
+ Overview
8
+ ========
9
+
7
10
This document is a guide to Linux network interface statistics.
8
11
9
- There are two main sources of interface statistics in Linux:
12
+ There are three main sources of interface statistics in Linux:
10
13
11
14
- standard interface statistics based on
12
- :c:type: `struct rtnl_link_stats64 <rtnl_link_stats64> `; and
15
+ :c:type: `struct rtnl_link_stats64 <rtnl_link_stats64> `;
16
+ - protocol-specific statistics; and
13
17
- driver-defined statistics available via ethtool.
14
18
15
- There are multiple interfaces to reach the former. Most commonly used
16
- is the `ip ` command from `iproute2 `::
19
+ Standard interface statistics
20
+ -----------------------------
21
+
22
+ There are multiple interfaces to reach the standard statistics.
23
+ Most commonly used is the `ip ` command from `iproute2 `::
17
24
18
25
$ ip -s -s link show dev ens4u1u1
19
26
6: ens4u1u1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
@@ -34,7 +41,26 @@ If `-s` is specified once the detailed errors won't be shown.
34
41
35
42
`ip ` supports JSON formatting via the `-j ` option.
36
43
37
- Ethtool statistics can be dumped using `ethtool -S $ifc `, e.g.::
44
+ Protocol-specific statistics
45
+ ----------------------------
46
+
47
+ Some of the interfaces used for configuring devices are also able
48
+ to report related statistics. For example ethtool interface used
49
+ to configure pause frames can report corresponding hardware counters::
50
+
51
+ $ ethtool --include-statistics -a eth0
52
+ Pause parameters for eth0:
53
+ Autonegotiate: on
54
+ RX: on
55
+ TX: on
56
+ Statistics:
57
+ tx_pause_frames: 1
58
+ rx_pause_frames: 1
59
+
60
+ Driver-defined statistics
61
+ -------------------------
62
+
63
+ Driver-defined ethtool statistics can be dumped using `ethtool -S $ifc `, e.g.::
38
64
39
65
$ ethtool -S ens4u1u1
40
66
NIC statistics:
@@ -94,6 +120,17 @@ Identifiers via `ETHTOOL_GSTRINGS` with `string_set` set to `ETH_SS_STATS`,
94
120
and values via `ETHTOOL_GSTATS `. User space should use `ETHTOOL_GDRVINFO `
95
121
to retrieve the number of statistics (`.n_stats `).
96
122
123
+ ethtool-netlink
124
+ ---------------
125
+
126
+ Ethtool netlink is a replacement for the older IOCTL interface.
127
+
128
+ Protocol-related statistics can be requested in get commands by setting
129
+ the `ETHTOOL_FLAG_STATS ` flag in `ETHTOOL_A_HEADER_FLAGS `. Currently
130
+ statistics are supported in the following commands:
131
+
132
+ - `ETHTOOL_MSG_PAUSE_GET `
133
+
97
134
debugfs
98
135
-------
99
136
@@ -130,3 +167,13 @@ user space trying to read them.
130
167
131
168
Statistics must persist across routine operations like bringing the interface
132
169
down and up.
170
+
171
+ Kernel-internal data structures
172
+ -------------------------------
173
+
174
+ The following structures are internal to the kernel, their members are
175
+ translated to netlink attributes when dumped. Drivers must not overwrite
176
+ the statistics they don't report with 0.
177
+
178
+ .. kernel-doc :: include/linux/ethtool.h
179
+ :identifiers: ethtool_pause_stats
0 commit comments