xref: /linux/Documentation/netlink/specs/netdev.yaml (revision 001821b0e79716c4e17c71d8e053a23599a7a508)
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      -
443        name: tx-stop
444        doc: |
445          Number of times driver paused accepting new tx packets
446          from the stack to this queue, because the queue was full.
447          Note that if BQL is supported and enabled on the device
448          the networking stack will avoid queuing a lot of data at once.
449        type: uint
450      -
451        name: tx-wake
452        doc: |
453          Number of times driver re-started accepting send
454          requests to this queue from the stack.
455        type: uint
456
457operations:
458  list:
459    -
460      name: dev-get
461      doc: Get / dump information about a netdev.
462      attribute-set: dev
463      do:
464        request:
465          attributes:
466            - ifindex
467        reply: &dev-all
468          attributes:
469            - ifindex
470            - xdp-features
471            - xdp-zc-max-segs
472            - xdp-rx-metadata-features
473            - xsk-features
474      dump:
475        reply: *dev-all
476    -
477      name: dev-add-ntf
478      doc: Notification about device appearing.
479      notify: dev-get
480      mcgrp: mgmt
481    -
482      name: dev-del-ntf
483      doc: Notification about device disappearing.
484      notify: dev-get
485      mcgrp: mgmt
486    -
487      name: dev-change-ntf
488      doc: Notification about device configuration being changed.
489      notify: dev-get
490      mcgrp: mgmt
491    -
492      name: page-pool-get
493      doc: |
494        Get / dump information about Page Pools.
495        (Only Page Pools associated with a net_device can be listed.)
496      attribute-set: page-pool
497      do:
498        request:
499          attributes:
500            - id
501        reply: &pp-reply
502          attributes:
503            - id
504            - ifindex
505            - napi-id
506            - inflight
507            - inflight-mem
508            - detach-time
509      dump:
510        reply: *pp-reply
511      config-cond: page-pool
512    -
513      name: page-pool-add-ntf
514      doc: Notification about page pool appearing.
515      notify: page-pool-get
516      mcgrp: page-pool
517      config-cond: page-pool
518    -
519      name: page-pool-del-ntf
520      doc: Notification about page pool disappearing.
521      notify: page-pool-get
522      mcgrp: page-pool
523      config-cond: page-pool
524    -
525      name: page-pool-change-ntf
526      doc: Notification about page pool configuration being changed.
527      notify: page-pool-get
528      mcgrp: page-pool
529      config-cond: page-pool
530    -
531      name: page-pool-stats-get
532      doc: Get page pool statistics.
533      attribute-set: page-pool-stats
534      do:
535        request:
536          attributes:
537            - info
538        reply: &pp-stats-reply
539          attributes:
540            - info
541            - alloc-fast
542            - alloc-slow
543            - alloc-slow-high-order
544            - alloc-empty
545            - alloc-refill
546            - alloc-waive
547            - recycle-cached
548            - recycle-cache-full
549            - recycle-ring
550            - recycle-ring-full
551            - recycle-released-refcnt
552      dump:
553        reply: *pp-stats-reply
554      config-cond: page-pool-stats
555    -
556      name: queue-get
557      doc: Get queue information from the kernel.
558           Only configured queues will be reported (as opposed to all available
559           hardware queues).
560      attribute-set: queue
561      do:
562        request:
563          attributes:
564            - ifindex
565            - type
566            - id
567        reply: &queue-get-op
568          attributes:
569            - id
570            - type
571            - napi-id
572            - ifindex
573      dump:
574        request:
575          attributes:
576            - ifindex
577        reply: *queue-get-op
578    -
579      name: napi-get
580      doc: Get information about NAPI instances configured on the system.
581      attribute-set: napi
582      do:
583        request:
584          attributes:
585            - id
586        reply: &napi-get-op
587          attributes:
588            - id
589            - ifindex
590            - irq
591            - pid
592      dump:
593        request:
594          attributes:
595            - ifindex
596        reply: *napi-get-op
597    -
598      name: qstats-get
599      doc: |
600        Get / dump fine grained statistics. Which statistics are reported
601        depends on the device and the driver, and whether the driver stores
602        software counters per-queue.
603      attribute-set: qstats
604      dump:
605        request:
606          attributes:
607            - ifindex
608            - scope
609        reply:
610          attributes:
611            - ifindex
612            - queue-type
613            - queue-id
614            - rx-packets
615            - rx-bytes
616            - tx-packets
617            - tx-bytes
618
619mcast-groups:
620  list:
621    -
622      name: mgmt
623    -
624      name: page-pool
625