xref: /linux/Documentation/netlink/specs/netdev.yaml (revision 46e6acfe3501fa938af9c5bd730f0020235b08a2)
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-complete
354        doc: Number of packets that were marked as CHECKSUM_COMPLETE.
355        type: uint
356      -
357        name: rx-csum-unnecessary
358        doc: Number of packets that were marked as CHECKSUM_UNNECESSARY.
359        type: uint
360      -
361        name: rx-csum-none
362        doc: Number of packets that were not checksummed by device.
363        type: uint
364      -
365        name: rx-csum-bad
366        doc: |
367          Number of packets with bad checksum. The packets are not discarded,
368          but still delivered to the stack.
369        type: uint
370      -
371        name: rx-hw-gro-packets
372        doc: |
373          Number of packets that were coalesced from smaller packets by the device.
374          Counts only packets coalesced with the HW-GRO netdevice feature,
375          LRO-coalesced packets are not counted.
376        type: uint
377      -
378        name: rx-hw-gro-bytes
379        doc: See `rx-hw-gro-packets`.
380        type: uint
381      -
382        name: rx-hw-gro-wire-packets
383        doc: |
384          Number of packets that were coalesced to bigger packetss with the HW-GRO
385          netdevice feature. LRO-coalesced packets are not counted.
386        type: uint
387      -
388        name: rx-hw-gro-wire-bytes
389        doc: See `rx-hw-gro-wire-packets`.
390        type: uint
391      -
392        name: rx-hw-drop-ratelimits
393        doc: |
394          Number of the packets dropped by the device due to the received
395          packets bitrate exceeding the device rate limit.
396        type: uint
397      -
398        name: tx-hw-drops
399        doc: |
400          Number of packets that arrived at the device but never left it,
401          encompassing packets dropped for reasons such as processing errors, as
402          well as those affected by explicitly defined policies and packet
403          filtering criteria.
404        type: uint
405      -
406        name: tx-hw-drop-errors
407        doc: Number of packets dropped because they were invalid or malformed.
408        type: uint
409      -
410        name: tx-csum-none
411        doc: |
412          Number of packets that did not require the device to calculate the
413          checksum.
414        type: uint
415      -
416        name: tx-needs-csum
417        doc: |
418          Number of packets that required the device to calculate the checksum.
419        type: uint
420      -
421        name: tx-hw-gso-packets
422        doc: |
423          Number of packets that necessitated segmentation into smaller packets
424          by the device.
425        type: uint
426      -
427        name: tx-hw-gso-bytes
428        doc: See `tx-hw-gso-packets`.
429        type: uint
430      -
431        name: tx-hw-gso-wire-packets
432        doc: |
433          Number of wire-sized packets generated by processing
434          `tx-hw-gso-packets`
435        type: uint
436      -
437        name: tx-hw-gso-wire-bytes
438        doc: See `tx-hw-gso-wire-packets`.
439        type: uint
440      -
441        name: tx-hw-drop-ratelimits
442        doc: |
443          Number of the packets dropped by the device due to the transmit
444          packets bitrate exceeding the device rate limit.
445        type: uint
446      -
447        name: tx-stop
448        doc: |
449          Number of times driver paused accepting new tx packets
450          from the stack to this queue, because the queue was full.
451          Note that if BQL is supported and enabled on the device
452          the networking stack will avoid queuing a lot of data at once.
453        type: uint
454      -
455        name: tx-wake
456        doc: |
457          Number of times driver re-started accepting send
458          requests to this queue from the stack.
459        type: uint
460
461operations:
462  list:
463    -
464      name: dev-get
465      doc: Get / dump information about a netdev.
466      attribute-set: dev
467      do:
468        request:
469          attributes:
470            - ifindex
471        reply: &dev-all
472          attributes:
473            - ifindex
474            - xdp-features
475            - xdp-zc-max-segs
476            - xdp-rx-metadata-features
477            - xsk-features
478      dump:
479        reply: *dev-all
480    -
481      name: dev-add-ntf
482      doc: Notification about device appearing.
483      notify: dev-get
484      mcgrp: mgmt
485    -
486      name: dev-del-ntf
487      doc: Notification about device disappearing.
488      notify: dev-get
489      mcgrp: mgmt
490    -
491      name: dev-change-ntf
492      doc: Notification about device configuration being changed.
493      notify: dev-get
494      mcgrp: mgmt
495    -
496      name: page-pool-get
497      doc: |
498        Get / dump information about Page Pools.
499        (Only Page Pools associated with a net_device can be listed.)
500      attribute-set: page-pool
501      do:
502        request:
503          attributes:
504            - id
505        reply: &pp-reply
506          attributes:
507            - id
508            - ifindex
509            - napi-id
510            - inflight
511            - inflight-mem
512            - detach-time
513      dump:
514        reply: *pp-reply
515      config-cond: page-pool
516    -
517      name: page-pool-add-ntf
518      doc: Notification about page pool appearing.
519      notify: page-pool-get
520      mcgrp: page-pool
521      config-cond: page-pool
522    -
523      name: page-pool-del-ntf
524      doc: Notification about page pool disappearing.
525      notify: page-pool-get
526      mcgrp: page-pool
527      config-cond: page-pool
528    -
529      name: page-pool-change-ntf
530      doc: Notification about page pool configuration being changed.
531      notify: page-pool-get
532      mcgrp: page-pool
533      config-cond: page-pool
534    -
535      name: page-pool-stats-get
536      doc: Get page pool statistics.
537      attribute-set: page-pool-stats
538      do:
539        request:
540          attributes:
541            - info
542        reply: &pp-stats-reply
543          attributes:
544            - info
545            - alloc-fast
546            - alloc-slow
547            - alloc-slow-high-order
548            - alloc-empty
549            - alloc-refill
550            - alloc-waive
551            - recycle-cached
552            - recycle-cache-full
553            - recycle-ring
554            - recycle-ring-full
555            - recycle-released-refcnt
556      dump:
557        reply: *pp-stats-reply
558      config-cond: page-pool-stats
559    -
560      name: queue-get
561      doc: Get queue information from the kernel.
562           Only configured queues will be reported (as opposed to all available
563           hardware queues).
564      attribute-set: queue
565      do:
566        request:
567          attributes:
568            - ifindex
569            - type
570            - id
571        reply: &queue-get-op
572          attributes:
573            - id
574            - type
575            - napi-id
576            - ifindex
577      dump:
578        request:
579          attributes:
580            - ifindex
581        reply: *queue-get-op
582    -
583      name: napi-get
584      doc: Get information about NAPI instances configured on the system.
585      attribute-set: napi
586      do:
587        request:
588          attributes:
589            - id
590        reply: &napi-get-op
591          attributes:
592            - id
593            - ifindex
594            - irq
595            - pid
596      dump:
597        request:
598          attributes:
599            - ifindex
600        reply: *napi-get-op
601    -
602      name: qstats-get
603      doc: |
604        Get / dump fine grained statistics. Which statistics are reported
605        depends on the device and the driver, and whether the driver stores
606        software counters per-queue.
607      attribute-set: qstats
608      dump:
609        request:
610          attributes:
611            - ifindex
612            - scope
613        reply:
614          attributes:
615            - ifindex
616            - queue-type
617            - queue-id
618            - rx-packets
619            - rx-bytes
620            - tx-packets
621            - tx-bytes
622
623mcast-groups:
624  list:
625    -
626      name: mgmt
627    -
628      name: page-pool
629