xref: /linux/Documentation/netlink/specs/netdev.yaml (revision 39dc8b8ea387ce7f4fe2d2d6d550ed52aa9aa040)
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        name: vlan-tag
59        doc:
60          Device is capable of exposing receive packet VLAN tag via bpf_xdp_metadata_rx_vlan_tag().
61  -
62    type: flags
63    name: xsk-flags
64    entries:
65      -
66        name: tx-timestamp
67        doc:
68          HW timestamping egress packets is supported by the driver.
69      -
70        name: tx-checksum
71        doc:
72          L3 checksum HW offload is supported by the driver.
73  -
74    name: queue-type
75    type: enum
76    entries: [ rx, tx ]
77  -
78    name: qstats-scope
79    type: flags
80    entries: [ queue ]
81
82attribute-sets:
83  -
84    name: dev
85    attributes:
86      -
87        name: ifindex
88        doc: netdev ifindex
89        type: u32
90        checks:
91          min: 1
92      -
93        name: pad
94        type: pad
95      -
96        name: xdp-features
97        doc: Bitmask of enabled xdp-features.
98        type: u64
99        enum: xdp-act
100      -
101        name: xdp-zc-max-segs
102        doc: max fragment count supported by ZC driver
103        type: u32
104        checks:
105          min: 1
106      -
107        name: xdp-rx-metadata-features
108        doc: Bitmask of supported XDP receive metadata features.
109             See Documentation/networking/xdp-rx-metadata.rst for more details.
110        type: u64
111        enum: xdp-rx-metadata
112      -
113        name: xsk-features
114        doc: Bitmask of enabled AF_XDP features.
115        type: u64
116        enum: xsk-flags
117  -
118    name: page-pool
119    attributes:
120      -
121        name: id
122        doc: Unique ID of a Page Pool instance.
123        type: uint
124        checks:
125          min: 1
126          max: u32-max
127      -
128        name: ifindex
129        doc: |
130          ifindex of the netdev to which the pool belongs.
131          May be reported as 0 if the page pool was allocated for a netdev
132          which got destroyed already (page pools may outlast their netdevs
133          because they wait for all memory to be returned).
134        type: u32
135        checks:
136          min: 1
137          max: s32-max
138      -
139        name: napi-id
140        doc: Id of NAPI using this Page Pool instance.
141        type: uint
142        checks:
143          min: 1
144          max: u32-max
145      -
146        name: inflight
147        type: uint
148        doc: |
149          Number of outstanding references to this page pool (allocated
150          but yet to be freed pages). Allocated pages may be held in
151          socket receive queues, driver receive ring, page pool recycling
152          ring, the page pool cache, etc.
153      -
154        name: inflight-mem
155        type: uint
156        doc: |
157          Amount of memory held by inflight pages.
158      -
159        name: detach-time
160        type: uint
161        doc: |
162          Seconds in CLOCK_BOOTTIME of when Page Pool was detached by
163          the driver. Once detached Page Pool can no longer be used to
164          allocate memory.
165          Page Pools wait for all the memory allocated from them to be freed
166          before truly disappearing. "Detached" Page Pools cannot be
167          "re-attached", they are just waiting to disappear.
168          Attribute is absent if Page Pool has not been detached, and
169          can still be used to allocate new memory.
170  -
171    name: page-pool-info
172    subset-of: page-pool
173    attributes:
174      -
175        name: id
176      -
177        name: ifindex
178  -
179    name: page-pool-stats
180    doc: |
181      Page pool statistics, see docs for struct page_pool_stats
182      for information about individual statistics.
183    attributes:
184      -
185        name: info
186        doc: Page pool identifying information.
187        type: nest
188        nested-attributes: page-pool-info
189      -
190        name: alloc-fast
191        type: uint
192        value: 8 # reserve some attr ids in case we need more metadata later
193      -
194        name: alloc-slow
195        type: uint
196      -
197        name: alloc-slow-high-order
198        type: uint
199      -
200        name: alloc-empty
201        type: uint
202      -
203        name: alloc-refill
204        type: uint
205      -
206        name: alloc-waive
207        type: uint
208      -
209        name: recycle-cached
210        type: uint
211      -
212        name: recycle-cache-full
213        type: uint
214      -
215        name: recycle-ring
216        type: uint
217      -
218        name: recycle-ring-full
219        type: uint
220      -
221        name: recycle-released-refcnt
222        type: uint
223
224  -
225    name: napi
226    attributes:
227      -
228        name: ifindex
229        doc: ifindex of the netdevice to which NAPI instance belongs.
230        type: u32
231        checks:
232          min: 1
233      -
234        name: id
235        doc: ID of the NAPI instance.
236        type: u32
237      -
238        name: irq
239        doc: The associated interrupt vector number for the napi
240        type: u32
241      -
242        name: pid
243        doc: PID of the napi thread, if NAPI is configured to operate in
244             threaded mode. If NAPI is not in threaded mode (i.e. uses normal
245             softirq context), the attribute will be absent.
246        type: u32
247  -
248    name: queue
249    attributes:
250      -
251        name: id
252        doc: Queue index; most queue types are indexed like a C array, with
253             indexes starting at 0 and ending at queue count - 1. Queue indexes
254             are scoped to an interface and queue type.
255        type: u32
256      -
257        name: ifindex
258        doc: ifindex of the netdevice to which the queue belongs.
259        type: u32
260        checks:
261          min: 1
262      -
263        name: type
264        doc: Queue type as rx, tx. Each queue type defines a separate ID space.
265        type: u32
266        enum: queue-type
267      -
268        name: napi-id
269        doc: ID of the NAPI instance which services this queue.
270        type: u32
271
272  -
273    name: qstats
274    doc: |
275      Get device statistics, scoped to a device or a queue.
276      These statistics extend (and partially duplicate) statistics available
277      in struct rtnl_link_stats64.
278      Value of the `scope` attribute determines how statistics are
279      aggregated. When aggregated for the entire device the statistics
280      represent the total number of events since last explicit reset of
281      the device (i.e. not a reconfiguration like changing queue count).
282      When reported per-queue, however, the statistics may not add
283      up to the total number of events, will only be reported for currently
284      active objects, and will likely report the number of events since last
285      reconfiguration.
286    attributes:
287      -
288        name: ifindex
289        doc: ifindex of the netdevice to which stats belong.
290        type: u32
291        checks:
292          min: 1
293      -
294        name: queue-type
295        doc: Queue type as rx, tx, for queue-id.
296        type: u32
297        enum: queue-type
298      -
299        name: queue-id
300        doc: Queue ID, if stats are scoped to a single queue instance.
301        type: u32
302      -
303        name: scope
304        doc: |
305          What object type should be used to iterate over the stats.
306        type: uint
307        enum: qstats-scope
308      -
309        name: rx-packets
310        doc: |
311          Number of wire packets successfully received and passed to the stack.
312          For drivers supporting XDP, XDP is considered the first layer
313          of the stack, so packets consumed by XDP are still counted here.
314        type: uint
315        value: 8 # reserve some attr ids in case we need more metadata later
316      -
317        name: rx-bytes
318        doc: Successfully received bytes, see `rx-packets`.
319        type: uint
320      -
321        name: tx-packets
322        doc: |
323          Number of wire packets successfully sent. Packet is considered to be
324          successfully sent once it is in device memory (usually this means
325          the device has issued a DMA completion for the packet).
326        type: uint
327      -
328        name: tx-bytes
329        doc: Successfully sent bytes, see `tx-packets`.
330        type: uint
331      -
332        name: rx-alloc-fail
333        doc: |
334          Number of times skb or buffer allocation failed on the Rx datapath.
335          Allocation failure may, or may not result in a packet drop, depending
336          on driver implementation and whether system recovers quickly.
337        type: uint
338      -
339        name: rx-hw-drops
340        doc: |
341          Number of all packets which entered the device, but never left it,
342          including but not limited to: packets dropped due to lack of buffer
343          space, processing errors, explicit or implicit policies and packet
344          filters.
345        type: uint
346      -
347        name: rx-hw-drop-overruns
348        doc: |
349          Number of packets dropped due to transient lack of resources, such as
350          buffer space, host descriptors etc.
351        type: uint
352      -
353        name: rx-csum-unnecessary
354        doc: Number of packets that were marked as CHECKSUM_UNNECESSARY.
355        type: uint
356      -
357        name: rx-csum-none
358        doc: Number of packets that were not checksummed by device.
359        type: uint
360      -
361        name: rx-csum-bad
362        doc: |
363          Number of packets with bad checksum. The packets are not discarded,
364          but still delivered to the stack.
365        type: uint
366      -
367        name: rx-hw-gro-packets
368        doc: |
369          Number of packets that were coalesced from smaller packets by the device.
370          Counts only packets coalesced with the HW-GRO netdevice feature,
371          LRO-coalesced packets are not counted.
372        type: uint
373      -
374        name: rx-hw-gro-bytes
375        doc: See `rx-hw-gro-packets`.
376        type: uint
377      -
378        name: rx-hw-gro-wire-packets
379        doc: |
380          Number of packets that were coalesced to bigger packetss with the HW-GRO
381          netdevice feature. LRO-coalesced packets are not counted.
382        type: uint
383      -
384        name: rx-hw-gro-wire-bytes
385        doc: See `rx-hw-gro-wire-packets`.
386        type: uint
387      -
388        name: rx-hw-drop-ratelimits
389        doc: |
390          Number of the packets dropped by the device due to the received
391          packets bitrate exceeding the device rate limit.
392        type: uint
393      -
394        name: tx-hw-drops
395        doc: |
396          Number of packets that arrived at the device but never left it,
397          encompassing packets dropped for reasons such as processing errors, as
398          well as those affected by explicitly defined policies and packet
399          filtering criteria.
400        type: uint
401      -
402        name: tx-hw-drop-errors
403        doc: Number of packets dropped because they were invalid or malformed.
404        type: uint
405      -
406        name: tx-csum-none
407        doc: |
408          Number of packets that did not require the device to calculate the
409          checksum.
410        type: uint
411      -
412        name: tx-needs-csum
413        doc: |
414          Number of packets that required the device to calculate the checksum.
415        type: uint
416      -
417        name: tx-hw-gso-packets
418        doc: |
419          Number of packets that necessitated segmentation into smaller packets
420          by the device.
421        type: uint
422      -
423        name: tx-hw-gso-bytes
424        doc: See `tx-hw-gso-packets`.
425        type: uint
426      -
427        name: tx-hw-gso-wire-packets
428        doc: |
429          Number of wire-sized packets generated by processing
430          `tx-hw-gso-packets`
431        type: uint
432      -
433        name: tx-hw-gso-wire-bytes
434        doc: See `tx-hw-gso-wire-packets`.
435        type: uint
436      -
437        name: tx-hw-drop-ratelimits
438        doc: |
439          Number of the packets dropped by the device due to the transmit
440          packets bitrate exceeding the device rate limit.
441        type: uint
442
443operations:
444  list:
445    -
446      name: dev-get
447      doc: Get / dump information about a netdev.
448      attribute-set: dev
449      do:
450        request:
451          attributes:
452            - ifindex
453        reply: &dev-all
454          attributes:
455            - ifindex
456            - xdp-features
457            - xdp-zc-max-segs
458            - xdp-rx-metadata-features
459            - xsk-features
460      dump:
461        reply: *dev-all
462    -
463      name: dev-add-ntf
464      doc: Notification about device appearing.
465      notify: dev-get
466      mcgrp: mgmt
467    -
468      name: dev-del-ntf
469      doc: Notification about device disappearing.
470      notify: dev-get
471      mcgrp: mgmt
472    -
473      name: dev-change-ntf
474      doc: Notification about device configuration being changed.
475      notify: dev-get
476      mcgrp: mgmt
477    -
478      name: page-pool-get
479      doc: |
480        Get / dump information about Page Pools.
481        (Only Page Pools associated with a net_device can be listed.)
482      attribute-set: page-pool
483      do:
484        request:
485          attributes:
486            - id
487        reply: &pp-reply
488          attributes:
489            - id
490            - ifindex
491            - napi-id
492            - inflight
493            - inflight-mem
494            - detach-time
495      dump:
496        reply: *pp-reply
497      config-cond: page-pool
498    -
499      name: page-pool-add-ntf
500      doc: Notification about page pool appearing.
501      notify: page-pool-get
502      mcgrp: page-pool
503      config-cond: page-pool
504    -
505      name: page-pool-del-ntf
506      doc: Notification about page pool disappearing.
507      notify: page-pool-get
508      mcgrp: page-pool
509      config-cond: page-pool
510    -
511      name: page-pool-change-ntf
512      doc: Notification about page pool configuration being changed.
513      notify: page-pool-get
514      mcgrp: page-pool
515      config-cond: page-pool
516    -
517      name: page-pool-stats-get
518      doc: Get page pool statistics.
519      attribute-set: page-pool-stats
520      do:
521        request:
522          attributes:
523            - info
524        reply: &pp-stats-reply
525          attributes:
526            - info
527            - alloc-fast
528            - alloc-slow
529            - alloc-slow-high-order
530            - alloc-empty
531            - alloc-refill
532            - alloc-waive
533            - recycle-cached
534            - recycle-cache-full
535            - recycle-ring
536            - recycle-ring-full
537            - recycle-released-refcnt
538      dump:
539        reply: *pp-stats-reply
540      config-cond: page-pool-stats
541    -
542      name: queue-get
543      doc: Get queue information from the kernel.
544           Only configured queues will be reported (as opposed to all available
545           hardware queues).
546      attribute-set: queue
547      do:
548        request:
549          attributes:
550            - ifindex
551            - type
552            - id
553        reply: &queue-get-op
554          attributes:
555            - id
556            - type
557            - napi-id
558            - ifindex
559      dump:
560        request:
561          attributes:
562            - ifindex
563        reply: *queue-get-op
564    -
565      name: napi-get
566      doc: Get information about NAPI instances configured on the system.
567      attribute-set: napi
568      do:
569        request:
570          attributes:
571            - id
572        reply: &napi-get-op
573          attributes:
574            - id
575            - ifindex
576            - irq
577            - pid
578      dump:
579        request:
580          attributes:
581            - ifindex
582        reply: *napi-get-op
583    -
584      name: qstats-get
585      doc: |
586        Get / dump fine grained statistics. Which statistics are reported
587        depends on the device and the driver, and whether the driver stores
588        software counters per-queue.
589      attribute-set: qstats
590      dump:
591        request:
592          attributes:
593            - ifindex
594            - scope
595        reply:
596          attributes:
597            - ifindex
598            - queue-type
599            - queue-id
600            - rx-packets
601            - rx-bytes
602            - tx-packets
603            - tx-bytes
604
605mcast-groups:
606  list:
607    -
608      name: mgmt
609    -
610      name: page-pool
611