xref: /linux/Documentation/netlink/specs/netdev.yaml (revision 79ac11393328fb1717d17c12e3c0eef0e9fa0647)
1# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2
3name: netdev
4
5doc:
6  netdev configuration over generic netlink.
7
8definitions:
9  -
10    type: flags
11    name: xdp-act
12    render-max: true
13    entries:
14      -
15        name: basic
16        doc:
17          XDP features set supported by all drivers
18          (XDP_ABORTED, XDP_DROP, XDP_PASS, XDP_TX)
19      -
20        name: redirect
21        doc:
22          The netdev supports XDP_REDIRECT
23      -
24        name: ndo-xmit
25        doc:
26          This feature informs if netdev implements ndo_xdp_xmit callback.
27      -
28        name: xsk-zerocopy
29        doc:
30          This feature informs if netdev supports AF_XDP in zero copy mode.
31      -
32        name: hw-offload
33        doc:
34         This feature informs if netdev supports XDP hw offloading.
35      -
36        name: rx-sg
37        doc:
38          This feature informs if netdev implements non-linear XDP buffer
39          support in the driver napi callback.
40      -
41        name: ndo-xmit-sg
42        doc:
43          This feature informs if netdev implements non-linear XDP buffer
44          support in ndo_xdp_xmit callback.
45  -
46    type: flags
47    name: xdp-rx-metadata
48    entries:
49      -
50        name: timestamp
51        doc:
52          Device is capable of exposing receive HW timestamp via bpf_xdp_metadata_rx_timestamp().
53      -
54        name: hash
55        doc:
56          Device is capable of exposing receive packet hash via bpf_xdp_metadata_rx_hash().
57  -
58    type: flags
59    name: xsk-flags
60    entries:
61      -
62        name: tx-timestamp
63        doc:
64          HW timestamping egress packets is supported by the driver.
65      -
66        name: tx-checksum
67        doc:
68          L3 checksum HW offload is supported by the driver.
69  -
70    name: queue-type
71    type: enum
72    entries: [ rx, tx ]
73
74attribute-sets:
75  -
76    name: dev
77    attributes:
78      -
79        name: ifindex
80        doc: netdev ifindex
81        type: u32
82        checks:
83          min: 1
84      -
85        name: pad
86        type: pad
87      -
88        name: xdp-features
89        doc: Bitmask of enabled xdp-features.
90        type: u64
91        enum: xdp-act
92      -
93        name: xdp-zc-max-segs
94        doc: max fragment count supported by ZC driver
95        type: u32
96        checks:
97          min: 1
98      -
99        name: xdp-rx-metadata-features
100        doc: Bitmask of supported XDP receive metadata features.
101             See Documentation/networking/xdp-rx-metadata.rst for more details.
102        type: u64
103        enum: xdp-rx-metadata
104      -
105        name: xsk-features
106        doc: Bitmask of enabled AF_XDP features.
107        type: u64
108        enum: xsk-flags
109  -
110    name: page-pool
111    attributes:
112      -
113        name: id
114        doc: Unique ID of a Page Pool instance.
115        type: uint
116        checks:
117          min: 1
118          max: u32-max
119      -
120        name: ifindex
121        doc: |
122          ifindex of the netdev to which the pool belongs.
123          May be reported as 0 if the page pool was allocated for a netdev
124          which got destroyed already (page pools may outlast their netdevs
125          because they wait for all memory to be returned).
126        type: u32
127        checks:
128          min: 1
129          max: s32-max
130      -
131        name: napi-id
132        doc: Id of NAPI using this Page Pool instance.
133        type: uint
134        checks:
135          min: 1
136          max: u32-max
137      -
138        name: inflight
139        type: uint
140        doc: |
141          Number of outstanding references to this page pool (allocated
142          but yet to be freed pages). Allocated pages may be held in
143          socket receive queues, driver receive ring, page pool recycling
144          ring, the page pool cache, etc.
145      -
146        name: inflight-mem
147        type: uint
148        doc: |
149          Amount of memory held by inflight pages.
150      -
151        name: detach-time
152        type: uint
153        doc: |
154          Seconds in CLOCK_BOOTTIME of when Page Pool was detached by
155          the driver. Once detached Page Pool can no longer be used to
156          allocate memory.
157          Page Pools wait for all the memory allocated from them to be freed
158          before truly disappearing. "Detached" Page Pools cannot be
159          "re-attached", they are just waiting to disappear.
160          Attribute is absent if Page Pool has not been detached, and
161          can still be used to allocate new memory.
162  -
163    name: page-pool-info
164    subset-of: page-pool
165    attributes:
166      -
167        name: id
168      -
169        name: ifindex
170  -
171    name: page-pool-stats
172    doc: |
173      Page pool statistics, see docs for struct page_pool_stats
174      for information about individual statistics.
175    attributes:
176      -
177        name: info
178        doc: Page pool identifying information.
179        type: nest
180        nested-attributes: page-pool-info
181      -
182        name: alloc-fast
183        type: uint
184        value: 8 # reserve some attr ids in case we need more metadata later
185      -
186        name: alloc-slow
187        type: uint
188      -
189        name: alloc-slow-high-order
190        type: uint
191      -
192        name: alloc-empty
193        type: uint
194      -
195        name: alloc-refill
196        type: uint
197      -
198        name: alloc-waive
199        type: uint
200      -
201        name: recycle-cached
202        type: uint
203      -
204        name: recycle-cache-full
205        type: uint
206      -
207        name: recycle-ring
208        type: uint
209      -
210        name: recycle-ring-full
211        type: uint
212      -
213        name: recycle-released-refcnt
214        type: uint
215
216  -
217    name: napi
218    attributes:
219      -
220        name: ifindex
221        doc: ifindex of the netdevice to which NAPI instance belongs.
222        type: u32
223        checks:
224          min: 1
225      -
226        name: id
227        doc: ID of the NAPI instance.
228        type: u32
229      -
230        name: irq
231        doc: The associated interrupt vector number for the napi
232        type: u32
233      -
234        name: pid
235        doc: PID of the napi thread, if NAPI is configured to operate in
236             threaded mode. If NAPI is not in threaded mode (i.e. uses normal
237             softirq context), the attribute will be absent.
238        type: u32
239  -
240    name: queue
241    attributes:
242      -
243        name: id
244        doc: Queue index; most queue types are indexed like a C array, with
245             indexes starting at 0 and ending at queue count - 1. Queue indexes
246             are scoped to an interface and queue type.
247        type: u32
248      -
249        name: ifindex
250        doc: ifindex of the netdevice to which the queue belongs.
251        type: u32
252        checks:
253          min: 1
254      -
255        name: type
256        doc: Queue type as rx, tx. Each queue type defines a separate ID space.
257        type: u32
258        enum: queue-type
259      -
260        name: napi-id
261        doc: ID of the NAPI instance which services this queue.
262        type: u32
263
264operations:
265  list:
266    -
267      name: dev-get
268      doc: Get / dump information about a netdev.
269      attribute-set: dev
270      do:
271        request:
272          attributes:
273            - ifindex
274        reply: &dev-all
275          attributes:
276            - ifindex
277            - xdp-features
278            - xdp-zc-max-segs
279            - xdp-rx-metadata-features
280            - xsk-features
281      dump:
282        reply: *dev-all
283    -
284      name: dev-add-ntf
285      doc: Notification about device appearing.
286      notify: dev-get
287      mcgrp: mgmt
288    -
289      name: dev-del-ntf
290      doc: Notification about device disappearing.
291      notify: dev-get
292      mcgrp: mgmt
293    -
294      name: dev-change-ntf
295      doc: Notification about device configuration being changed.
296      notify: dev-get
297      mcgrp: mgmt
298    -
299      name: page-pool-get
300      doc: |
301        Get / dump information about Page Pools.
302        (Only Page Pools associated with a net_device can be listed.)
303      attribute-set: page-pool
304      do:
305        request:
306          attributes:
307            - id
308        reply: &pp-reply
309          attributes:
310            - id
311            - ifindex
312            - napi-id
313            - inflight
314            - inflight-mem
315            - detach-time
316      dump:
317        reply: *pp-reply
318      config-cond: page-pool
319    -
320      name: page-pool-add-ntf
321      doc: Notification about page pool appearing.
322      notify: page-pool-get
323      mcgrp: page-pool
324      config-cond: page-pool
325    -
326      name: page-pool-del-ntf
327      doc: Notification about page pool disappearing.
328      notify: page-pool-get
329      mcgrp: page-pool
330      config-cond: page-pool
331    -
332      name: page-pool-change-ntf
333      doc: Notification about page pool configuration being changed.
334      notify: page-pool-get
335      mcgrp: page-pool
336      config-cond: page-pool
337    -
338      name: page-pool-stats-get
339      doc: Get page pool statistics.
340      attribute-set: page-pool-stats
341      do:
342        request:
343          attributes:
344            - info
345        reply: &pp-stats-reply
346          attributes:
347            - info
348            - alloc-fast
349            - alloc-slow
350            - alloc-slow-high-order
351            - alloc-empty
352            - alloc-refill
353            - alloc-waive
354            - recycle-cached
355            - recycle-cache-full
356            - recycle-ring
357            - recycle-ring-full
358            - recycle-released-refcnt
359      dump:
360        reply: *pp-stats-reply
361      config-cond: page-pool-stats
362    -
363      name: queue-get
364      doc: Get queue information from the kernel.
365           Only configured queues will be reported (as opposed to all available
366           hardware queues).
367      attribute-set: queue
368      do:
369        request:
370          attributes:
371            - ifindex
372            - type
373            - id
374        reply: &queue-get-op
375          attributes:
376            - id
377            - type
378            - napi-id
379            - ifindex
380      dump:
381        request:
382          attributes:
383            - ifindex
384        reply: *queue-get-op
385    -
386      name: napi-get
387      doc: Get information about NAPI instances configured on the system.
388      attribute-set: napi
389      do:
390        request:
391          attributes:
392            - id
393        reply: &napi-get-op
394          attributes:
395            - id
396            - ifindex
397            - irq
398            - pid
399      dump:
400        request:
401          attributes:
402            - ifindex
403        reply: *napi-get-op
404
405mcast-groups:
406  list:
407    -
408      name: mgmt
409    -
410      name: page-pool
411