blob: 9448442ad293a108a0781b3bbd9dbb25b755d11d [file] [log] [blame]
Michal Kubecek2b4a8992019-12-27 15:55:18 +01001=============================
2Netlink interface for ethtool
3=============================
4
5
6Basic information
7=================
8
9Netlink interface for ethtool uses generic netlink family ``ethtool``
10(userspace application should use macros ``ETHTOOL_GENL_NAME`` and
11``ETHTOOL_GENL_VERSION`` defined in ``<linux/ethtool_netlink.h>`` uapi
12header). This family does not use a specific header, all information in
13requests and replies is passed using netlink attributes.
14
15The ethtool netlink interface uses extended ACK for error and warning
16reporting, userspace application developers are encouraged to make these
17messages available to user in a suitable way.
18
19Requests can be divided into three categories: "get" (retrieving information),
20"set" (setting parameters) and "action" (invoking an action).
21
22All "set" and "action" type requests require admin privileges
23(``CAP_NET_ADMIN`` in the namespace). Most "get" type requests are allowed for
24anyone but there are exceptions (where the response contains sensitive
25information). In some cases, the request as such is allowed for anyone but
26unprivileged users have attributes with sensitive information (e.g.
27wake-on-lan password) omitted.
28
29
30Conventions
31===========
32
33Attributes which represent a boolean value usually use NLA_U8 type so that we
34can distinguish three states: "on", "off" and "not present" (meaning the
35information is not available in "get" requests or value is not to be changed
36in "set" requests). For these attributes, the "true" value should be passed as
37number 1 but any non-zero value should be understood as "true" by recipient.
38In the tables below, "bool" denotes NLA_U8 attributes interpreted in this way.
39
40In the message structure descriptions below, if an attribute name is suffixed
41with "+", parent nest can contain multiple attributes of the same type. This
42implements an array of entries.
43
44
45Request header
46==============
47
48Each request or reply message contains a nested attribute with common header.
49Structure of this header is
50
51 ============================== ====== =============================
52 ``ETHTOOL_A_HEADER_DEV_INDEX`` u32 device ifindex
53 ``ETHTOOL_A_HEADER_DEV_NAME`` string device name
54 ``ETHTOOL_A_HEADER_FLAGS`` u32 flags common for all requests
55 ============================== ====== =============================
56
57``ETHTOOL_A_HEADER_DEV_INDEX`` and ``ETHTOOL_A_HEADER_DEV_NAME`` identify the
58device message relates to. One of them is sufficient in requests, if both are
59used, they must identify the same device. Some requests, e.g. global string
60sets, do not require device identification. Most ``GET`` requests also allow
61dump requests without device identification to query the same information for
62all devices providing it (each device in a separate message).
63
64``ETHTOOL_A_HEADER_FLAGS`` is a bitmap of request flags common for all request
65types. The interpretation of these flags is the same for all request types but
66the flags may not apply to requests. Recognized flags are:
67
68 ================================= ===================================
69 ``ETHTOOL_FLAG_COMPACT_BITSETS`` use compact format bitsets in reply
70 ``ETHTOOL_FLAG_OMIT_REPLY`` omit optional reply (_SET and _ACT)
71 ================================= ===================================
72
73New request flags should follow the general idea that if the flag is not set,
74the behaviour is backward compatible, i.e. requests from old clients not aware
75of the flag should be interpreted the way the client expects. A client must
76not set flags it does not understand.
77
78
79List of message types
80=====================
81
82All constants identifying message types use ``ETHTOOL_CMD_`` prefix and suffix
83according to message purpose:
84
85 ============== ======================================
86 ``_GET`` userspace request to retrieve data
87 ``_SET`` userspace request to set data
88 ``_ACT`` userspace request to perform an action
89 ``_GET_REPLY`` kernel reply to a ``GET`` request
90 ``_SET_REPLY`` kernel reply to a ``SET`` request
91 ``_ACT_REPLY`` kernel reply to an ``ACT`` request
92 ``_NTF`` kernel notification
93 ============== ======================================
94
95``GET`` requests are sent by userspace applications to retrieve device
96information. They usually do not contain any message specific attributes.
97Kernel replies with corresponding "GET_REPLY" message. For most types, ``GET``
98request with ``NLM_F_DUMP`` and no device identification can be used to query
99the information for all devices supporting the request.
100
101If the data can be also modified, corresponding ``SET`` message with the same
102layout as corresponding ``GET_REPLY`` is used to request changes. Only
103attributes where a change is requested are included in such request (also, not
104all attributes may be changed). Replies to most ``SET`` request consist only
105of error code and extack; if kernel provides additional data, it is sent in
106the form of corresponding ``SET_REPLY`` message which can be suppressed by
107setting ``ETHTOOL_FLAG_OMIT_REPLY`` flag in request header.
108
109Data modification also triggers sending a ``NTF`` message with a notification.
110These usually bear only a subset of attributes which was affected by the
111change. The same notification is issued if the data is modified using other
112means (mostly ioctl ethtool interface). Unlike notifications from ethtool
113netlink code which are only sent if something actually changed, notifications
114triggered by ioctl interface may be sent even if the request did not actually
115change any data.
116
117``ACT`` messages request kernel (driver) to perform a specific action. If some
118information is reported by kernel (which can be suppressed by setting
119``ETHTOOL_FLAG_OMIT_REPLY`` flag in request header), the reply takes form of
120an ``ACT_REPLY`` message. Performing an action also triggers a notification
121(``NTF`` message).
122
123Later sections describe the format and semantics of these messages.
124
125
126Request translation
127===================
128
129The following table maps ioctl commands to netlink commands providing their
130functionality. Entries with "n/a" in right column are commands which do not
131have their netlink replacement yet.
132
133 =================================== =====================================
134 ioctl command netlink command
135 =================================== =====================================
136 ``ETHTOOL_GSET`` n/a
137 ``ETHTOOL_SSET`` n/a
138 ``ETHTOOL_GDRVINFO`` n/a
139 ``ETHTOOL_GREGS`` n/a
140 ``ETHTOOL_GWOL`` n/a
141 ``ETHTOOL_SWOL`` n/a
142 ``ETHTOOL_GMSGLVL`` n/a
143 ``ETHTOOL_SMSGLVL`` n/a
144 ``ETHTOOL_NWAY_RST`` n/a
145 ``ETHTOOL_GLINK`` n/a
146 ``ETHTOOL_GEEPROM`` n/a
147 ``ETHTOOL_SEEPROM`` n/a
148 ``ETHTOOL_GCOALESCE`` n/a
149 ``ETHTOOL_SCOALESCE`` n/a
150 ``ETHTOOL_GRINGPARAM`` n/a
151 ``ETHTOOL_SRINGPARAM`` n/a
152 ``ETHTOOL_GPAUSEPARAM`` n/a
153 ``ETHTOOL_SPAUSEPARAM`` n/a
154 ``ETHTOOL_GRXCSUM`` n/a
155 ``ETHTOOL_SRXCSUM`` n/a
156 ``ETHTOOL_GTXCSUM`` n/a
157 ``ETHTOOL_STXCSUM`` n/a
158 ``ETHTOOL_GSG`` n/a
159 ``ETHTOOL_SSG`` n/a
160 ``ETHTOOL_TEST`` n/a
161 ``ETHTOOL_GSTRINGS`` n/a
162 ``ETHTOOL_PHYS_ID`` n/a
163 ``ETHTOOL_GSTATS`` n/a
164 ``ETHTOOL_GTSO`` n/a
165 ``ETHTOOL_STSO`` n/a
166 ``ETHTOOL_GPERMADDR`` rtnetlink ``RTM_GETLINK``
167 ``ETHTOOL_GUFO`` n/a
168 ``ETHTOOL_SUFO`` n/a
169 ``ETHTOOL_GGSO`` n/a
170 ``ETHTOOL_SGSO`` n/a
171 ``ETHTOOL_GFLAGS`` n/a
172 ``ETHTOOL_SFLAGS`` n/a
173 ``ETHTOOL_GPFLAGS`` n/a
174 ``ETHTOOL_SPFLAGS`` n/a
175 ``ETHTOOL_GRXFH`` n/a
176 ``ETHTOOL_SRXFH`` n/a
177 ``ETHTOOL_GGRO`` n/a
178 ``ETHTOOL_SGRO`` n/a
179 ``ETHTOOL_GRXRINGS`` n/a
180 ``ETHTOOL_GRXCLSRLCNT`` n/a
181 ``ETHTOOL_GRXCLSRULE`` n/a
182 ``ETHTOOL_GRXCLSRLALL`` n/a
183 ``ETHTOOL_SRXCLSRLDEL`` n/a
184 ``ETHTOOL_SRXCLSRLINS`` n/a
185 ``ETHTOOL_FLASHDEV`` n/a
186 ``ETHTOOL_RESET`` n/a
187 ``ETHTOOL_SRXNTUPLE`` n/a
188 ``ETHTOOL_GRXNTUPLE`` n/a
189 ``ETHTOOL_GSSET_INFO`` n/a
190 ``ETHTOOL_GRXFHINDIR`` n/a
191 ``ETHTOOL_SRXFHINDIR`` n/a
192 ``ETHTOOL_GFEATURES`` n/a
193 ``ETHTOOL_SFEATURES`` n/a
194 ``ETHTOOL_GCHANNELS`` n/a
195 ``ETHTOOL_SCHANNELS`` n/a
196 ``ETHTOOL_SET_DUMP`` n/a
197 ``ETHTOOL_GET_DUMP_FLAG`` n/a
198 ``ETHTOOL_GET_DUMP_DATA`` n/a
199 ``ETHTOOL_GET_TS_INFO`` n/a
200 ``ETHTOOL_GMODULEINFO`` n/a
201 ``ETHTOOL_GMODULEEEPROM`` n/a
202 ``ETHTOOL_GEEE`` n/a
203 ``ETHTOOL_SEEE`` n/a
204 ``ETHTOOL_GRSSH`` n/a
205 ``ETHTOOL_SRSSH`` n/a
206 ``ETHTOOL_GTUNABLE`` n/a
207 ``ETHTOOL_STUNABLE`` n/a
208 ``ETHTOOL_GPHYSTATS`` n/a
209 ``ETHTOOL_PERQUEUE`` n/a
210 ``ETHTOOL_GLINKSETTINGS`` n/a
211 ``ETHTOOL_SLINKSETTINGS`` n/a
212 ``ETHTOOL_PHY_GTUNABLE`` n/a
213 ``ETHTOOL_PHY_STUNABLE`` n/a
214 ``ETHTOOL_GFECPARAM`` n/a
215 ``ETHTOOL_SFECPARAM`` n/a
216 =================================== =====================================