netdev.yaml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
  2. name: netdev
  3. doc:
  4. netdev configuration over generic netlink.
  5. definitions:
  6. -
  7. type: flags
  8. name: xdp-act
  9. render-max: true
  10. entries:
  11. -
  12. name: basic
  13. doc:
  14. XDP features set supported by all drivers
  15. (XDP_ABORTED, XDP_DROP, XDP_PASS, XDP_TX)
  16. -
  17. name: redirect
  18. doc:
  19. The netdev supports XDP_REDIRECT
  20. -
  21. name: ndo-xmit
  22. doc:
  23. This feature informs if netdev implements ndo_xdp_xmit callback.
  24. -
  25. name: xsk-zerocopy
  26. doc:
  27. This feature informs if netdev supports AF_XDP in zero copy mode.
  28. -
  29. name: hw-offload
  30. doc:
  31. This feature informs if netdev supports XDP hw offloading.
  32. -
  33. name: rx-sg
  34. doc:
  35. This feature informs if netdev implements non-linear XDP buffer
  36. support in the driver napi callback.
  37. -
  38. name: ndo-xmit-sg
  39. doc:
  40. This feature informs if netdev implements non-linear XDP buffer
  41. support in ndo_xdp_xmit callback.
  42. -
  43. type: flags
  44. name: xdp-rx-metadata
  45. entries:
  46. -
  47. name: timestamp
  48. doc:
  49. Device is capable of exposing receive HW timestamp via bpf_xdp_metadata_rx_timestamp().
  50. -
  51. name: hash
  52. doc:
  53. Device is capable of exposing receive packet hash via bpf_xdp_metadata_rx_hash().
  54. -
  55. name: vlan-tag
  56. doc:
  57. Device is capable of exposing receive packet VLAN tag via bpf_xdp_metadata_rx_vlan_tag().
  58. -
  59. type: flags
  60. name: xsk-flags
  61. entries:
  62. -
  63. name: tx-timestamp
  64. doc:
  65. HW timestamping egress packets is supported by the driver.
  66. -
  67. name: tx-checksum
  68. doc:
  69. L3 checksum HW offload is supported by the driver.
  70. -
  71. name: queue-type
  72. type: enum
  73. entries: [ rx, tx ]
  74. -
  75. name: qstats-scope
  76. type: flags
  77. entries: [ queue ]
  78. attribute-sets:
  79. -
  80. name: dev
  81. attributes:
  82. -
  83. name: ifindex
  84. doc: netdev ifindex
  85. type: u32
  86. checks:
  87. min: 1
  88. -
  89. name: pad
  90. type: pad
  91. -
  92. name: xdp-features
  93. doc: Bitmask of enabled xdp-features.
  94. type: u64
  95. enum: xdp-act
  96. -
  97. name: xdp-zc-max-segs
  98. doc: max fragment count supported by ZC driver
  99. type: u32
  100. checks:
  101. min: 1
  102. -
  103. name: xdp-rx-metadata-features
  104. doc: Bitmask of supported XDP receive metadata features.
  105. See Documentation/networking/xdp-rx-metadata.rst for more details.
  106. type: u64
  107. enum: xdp-rx-metadata
  108. -
  109. name: xsk-features
  110. doc: Bitmask of enabled AF_XDP features.
  111. type: u64
  112. enum: xsk-flags
  113. -
  114. name: page-pool
  115. attributes:
  116. -
  117. name: id
  118. doc: Unique ID of a Page Pool instance.
  119. type: uint
  120. checks:
  121. min: 1
  122. max: u32-max
  123. -
  124. name: ifindex
  125. doc: |
  126. ifindex of the netdev to which the pool belongs.
  127. May be reported as 0 if the page pool was allocated for a netdev
  128. which got destroyed already (page pools may outlast their netdevs
  129. because they wait for all memory to be returned).
  130. type: u32
  131. checks:
  132. min: 1
  133. max: s32-max
  134. -
  135. name: napi-id
  136. doc: Id of NAPI using this Page Pool instance.
  137. type: uint
  138. checks:
  139. min: 1
  140. max: u32-max
  141. -
  142. name: inflight
  143. type: uint
  144. doc: |
  145. Number of outstanding references to this page pool (allocated
  146. but yet to be freed pages). Allocated pages may be held in
  147. socket receive queues, driver receive ring, page pool recycling
  148. ring, the page pool cache, etc.
  149. -
  150. name: inflight-mem
  151. type: uint
  152. doc: |
  153. Amount of memory held by inflight pages.
  154. -
  155. name: detach-time
  156. type: uint
  157. doc: |
  158. Seconds in CLOCK_BOOTTIME of when Page Pool was detached by
  159. the driver. Once detached Page Pool can no longer be used to
  160. allocate memory.
  161. Page Pools wait for all the memory allocated from them to be freed
  162. before truly disappearing. "Detached" Page Pools cannot be
  163. "re-attached", they are just waiting to disappear.
  164. Attribute is absent if Page Pool has not been detached, and
  165. can still be used to allocate new memory.
  166. -
  167. name: dmabuf
  168. doc: ID of the dmabuf this page-pool is attached to.
  169. type: u32
  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. name: napi
  225. attributes:
  226. -
  227. name: ifindex
  228. doc: ifindex of the netdevice to which NAPI instance belongs.
  229. type: u32
  230. checks:
  231. min: 1
  232. -
  233. name: id
  234. doc: ID of the NAPI instance.
  235. type: u32
  236. -
  237. name: irq
  238. doc: The associated interrupt vector number for the napi
  239. type: u32
  240. -
  241. name: pid
  242. doc: PID of the napi thread, if NAPI is configured to operate in
  243. threaded mode. If NAPI is not in threaded mode (i.e. uses normal
  244. softirq context), the attribute will be absent.
  245. type: u32
  246. -
  247. name: queue
  248. attributes:
  249. -
  250. name: id
  251. doc: Queue index; most queue types are indexed like a C array, with
  252. indexes starting at 0 and ending at queue count - 1. Queue indexes
  253. are scoped to an interface and queue type.
  254. type: u32
  255. -
  256. name: ifindex
  257. doc: ifindex of the netdevice to which the queue belongs.
  258. type: u32
  259. checks:
  260. min: 1
  261. -
  262. name: type
  263. doc: Queue type as rx, tx. Each queue type defines a separate ID space.
  264. type: u32
  265. enum: queue-type
  266. -
  267. name: napi-id
  268. doc: ID of the NAPI instance which services this queue.
  269. type: u32
  270. -
  271. name: dmabuf
  272. doc: ID of the dmabuf attached to this queue, if any.
  273. type: u32
  274. -
  275. name: qstats
  276. doc: |
  277. Get device statistics, scoped to a device or a queue.
  278. These statistics extend (and partially duplicate) statistics available
  279. in struct rtnl_link_stats64.
  280. Value of the `scope` attribute determines how statistics are
  281. aggregated. When aggregated for the entire device the statistics
  282. represent the total number of events since last explicit reset of
  283. the device (i.e. not a reconfiguration like changing queue count).
  284. When reported per-queue, however, the statistics may not add
  285. up to the total number of events, will only be reported for currently
  286. active objects, and will likely report the number of events since last
  287. reconfiguration.
  288. attributes:
  289. -
  290. name: ifindex
  291. doc: ifindex of the netdevice to which stats belong.
  292. type: u32
  293. checks:
  294. min: 1
  295. -
  296. name: queue-type
  297. doc: Queue type as rx, tx, for queue-id.
  298. type: u32
  299. enum: queue-type
  300. -
  301. name: queue-id
  302. doc: Queue ID, if stats are scoped to a single queue instance.
  303. type: u32
  304. -
  305. name: scope
  306. doc: |
  307. What object type should be used to iterate over the stats.
  308. type: uint
  309. enum: qstats-scope
  310. -
  311. name: rx-packets
  312. doc: |
  313. Number of wire packets successfully received and passed to the stack.
  314. For drivers supporting XDP, XDP is considered the first layer
  315. of the stack, so packets consumed by XDP are still counted here.
  316. type: uint
  317. value: 8 # reserve some attr ids in case we need more metadata later
  318. -
  319. name: rx-bytes
  320. doc: Successfully received bytes, see `rx-packets`.
  321. type: uint
  322. -
  323. name: tx-packets
  324. doc: |
  325. Number of wire packets successfully sent. Packet is considered to be
  326. successfully sent once it is in device memory (usually this means
  327. the device has issued a DMA completion for the packet).
  328. type: uint
  329. -
  330. name: tx-bytes
  331. doc: Successfully sent bytes, see `tx-packets`.
  332. type: uint
  333. -
  334. name: rx-alloc-fail
  335. doc: |
  336. Number of times skb or buffer allocation failed on the Rx datapath.
  337. Allocation failure may, or may not result in a packet drop, depending
  338. on driver implementation and whether system recovers quickly.
  339. type: uint
  340. -
  341. name: rx-hw-drops
  342. doc: |
  343. Number of all packets which entered the device, but never left it,
  344. including but not limited to: packets dropped due to lack of buffer
  345. space, processing errors, explicit or implicit policies and packet
  346. filters.
  347. type: uint
  348. -
  349. name: rx-hw-drop-overruns
  350. doc: |
  351. Number of packets dropped due to transient lack of resources, such as
  352. buffer space, host descriptors etc.
  353. type: uint
  354. -
  355. name: rx-csum-complete
  356. doc: Number of packets that were marked as CHECKSUM_COMPLETE.
  357. type: uint
  358. -
  359. name: rx-csum-unnecessary
  360. doc: Number of packets that were marked as CHECKSUM_UNNECESSARY.
  361. type: uint
  362. -
  363. name: rx-csum-none
  364. doc: Number of packets that were not checksummed by device.
  365. type: uint
  366. -
  367. name: rx-csum-bad
  368. doc: |
  369. Number of packets with bad checksum. The packets are not discarded,
  370. but still delivered to the stack.
  371. type: uint
  372. -
  373. name: rx-hw-gro-packets
  374. doc: |
  375. Number of packets that were coalesced from smaller packets by the device.
  376. Counts only packets coalesced with the HW-GRO netdevice feature,
  377. LRO-coalesced packets are not counted.
  378. type: uint
  379. -
  380. name: rx-hw-gro-bytes
  381. doc: See `rx-hw-gro-packets`.
  382. type: uint
  383. -
  384. name: rx-hw-gro-wire-packets
  385. doc: |
  386. Number of packets that were coalesced to bigger packetss with the HW-GRO
  387. netdevice feature. LRO-coalesced packets are not counted.
  388. type: uint
  389. -
  390. name: rx-hw-gro-wire-bytes
  391. doc: See `rx-hw-gro-wire-packets`.
  392. type: uint
  393. -
  394. name: rx-hw-drop-ratelimits
  395. doc: |
  396. Number of the packets dropped by the device due to the received
  397. packets bitrate exceeding the device rate limit.
  398. type: uint
  399. -
  400. name: tx-hw-drops
  401. doc: |
  402. Number of packets that arrived at the device but never left it,
  403. encompassing packets dropped for reasons such as processing errors, as
  404. well as those affected by explicitly defined policies and packet
  405. filtering criteria.
  406. type: uint
  407. -
  408. name: tx-hw-drop-errors
  409. doc: Number of packets dropped because they were invalid or malformed.
  410. type: uint
  411. -
  412. name: tx-csum-none
  413. doc: |
  414. Number of packets that did not require the device to calculate the
  415. checksum.
  416. type: uint
  417. -
  418. name: tx-needs-csum
  419. doc: |
  420. Number of packets that required the device to calculate the checksum.
  421. type: uint
  422. -
  423. name: tx-hw-gso-packets
  424. doc: |
  425. Number of packets that necessitated segmentation into smaller packets
  426. by the device.
  427. type: uint
  428. -
  429. name: tx-hw-gso-bytes
  430. doc: See `tx-hw-gso-packets`.
  431. type: uint
  432. -
  433. name: tx-hw-gso-wire-packets
  434. doc: |
  435. Number of wire-sized packets generated by processing
  436. `tx-hw-gso-packets`
  437. type: uint
  438. -
  439. name: tx-hw-gso-wire-bytes
  440. doc: See `tx-hw-gso-wire-packets`.
  441. type: uint
  442. -
  443. name: tx-hw-drop-ratelimits
  444. doc: |
  445. Number of the packets dropped by the device due to the transmit
  446. packets bitrate exceeding the device rate limit.
  447. type: uint
  448. -
  449. name: tx-stop
  450. doc: |
  451. Number of times driver paused accepting new tx packets
  452. from the stack to this queue, because the queue was full.
  453. Note that if BQL is supported and enabled on the device
  454. the networking stack will avoid queuing a lot of data at once.
  455. type: uint
  456. -
  457. name: tx-wake
  458. doc: |
  459. Number of times driver re-started accepting send
  460. requests to this queue from the stack.
  461. type: uint
  462. -
  463. name: queue-id
  464. subset-of: queue
  465. attributes:
  466. -
  467. name: id
  468. -
  469. name: type
  470. -
  471. name: dmabuf
  472. attributes:
  473. -
  474. name: ifindex
  475. doc: netdev ifindex to bind the dmabuf to.
  476. type: u32
  477. checks:
  478. min: 1
  479. -
  480. name: queues
  481. doc: receive queues to bind the dmabuf to.
  482. type: nest
  483. nested-attributes: queue-id
  484. multi-attr: true
  485. -
  486. name: fd
  487. doc: dmabuf file descriptor to bind.
  488. type: u32
  489. -
  490. name: id
  491. doc: id of the dmabuf binding
  492. type: u32
  493. checks:
  494. min: 1
  495. operations:
  496. list:
  497. -
  498. name: dev-get
  499. doc: Get / dump information about a netdev.
  500. attribute-set: dev
  501. do:
  502. request:
  503. attributes:
  504. - ifindex
  505. reply: &dev-all
  506. attributes:
  507. - ifindex
  508. - xdp-features
  509. - xdp-zc-max-segs
  510. - xdp-rx-metadata-features
  511. - xsk-features
  512. dump:
  513. reply: *dev-all
  514. -
  515. name: dev-add-ntf
  516. doc: Notification about device appearing.
  517. notify: dev-get
  518. mcgrp: mgmt
  519. -
  520. name: dev-del-ntf
  521. doc: Notification about device disappearing.
  522. notify: dev-get
  523. mcgrp: mgmt
  524. -
  525. name: dev-change-ntf
  526. doc: Notification about device configuration being changed.
  527. notify: dev-get
  528. mcgrp: mgmt
  529. -
  530. name: page-pool-get
  531. doc: |
  532. Get / dump information about Page Pools.
  533. (Only Page Pools associated with a net_device can be listed.)
  534. attribute-set: page-pool
  535. do:
  536. request:
  537. attributes:
  538. - id
  539. reply: &pp-reply
  540. attributes:
  541. - id
  542. - ifindex
  543. - napi-id
  544. - inflight
  545. - inflight-mem
  546. - detach-time
  547. - dmabuf
  548. dump:
  549. reply: *pp-reply
  550. config-cond: page-pool
  551. -
  552. name: page-pool-add-ntf
  553. doc: Notification about page pool appearing.
  554. notify: page-pool-get
  555. mcgrp: page-pool
  556. config-cond: page-pool
  557. -
  558. name: page-pool-del-ntf
  559. doc: Notification about page pool disappearing.
  560. notify: page-pool-get
  561. mcgrp: page-pool
  562. config-cond: page-pool
  563. -
  564. name: page-pool-change-ntf
  565. doc: Notification about page pool configuration being changed.
  566. notify: page-pool-get
  567. mcgrp: page-pool
  568. config-cond: page-pool
  569. -
  570. name: page-pool-stats-get
  571. doc: Get page pool statistics.
  572. attribute-set: page-pool-stats
  573. do:
  574. request:
  575. attributes:
  576. - info
  577. reply: &pp-stats-reply
  578. attributes:
  579. - info
  580. - alloc-fast
  581. - alloc-slow
  582. - alloc-slow-high-order
  583. - alloc-empty
  584. - alloc-refill
  585. - alloc-waive
  586. - recycle-cached
  587. - recycle-cache-full
  588. - recycle-ring
  589. - recycle-ring-full
  590. - recycle-released-refcnt
  591. dump:
  592. reply: *pp-stats-reply
  593. config-cond: page-pool-stats
  594. -
  595. name: queue-get
  596. doc: Get queue information from the kernel.
  597. Only configured queues will be reported (as opposed to all available
  598. hardware queues).
  599. attribute-set: queue
  600. do:
  601. request:
  602. attributes:
  603. - ifindex
  604. - type
  605. - id
  606. reply: &queue-get-op
  607. attributes:
  608. - id
  609. - type
  610. - napi-id
  611. - ifindex
  612. - dmabuf
  613. dump:
  614. request:
  615. attributes:
  616. - ifindex
  617. reply: *queue-get-op
  618. -
  619. name: napi-get
  620. doc: Get information about NAPI instances configured on the system.
  621. attribute-set: napi
  622. do:
  623. request:
  624. attributes:
  625. - id
  626. reply: &napi-get-op
  627. attributes:
  628. - id
  629. - ifindex
  630. - irq
  631. - pid
  632. dump:
  633. request:
  634. attributes:
  635. - ifindex
  636. reply: *napi-get-op
  637. -
  638. name: qstats-get
  639. doc: |
  640. Get / dump fine grained statistics. Which statistics are reported
  641. depends on the device and the driver, and whether the driver stores
  642. software counters per-queue.
  643. attribute-set: qstats
  644. dump:
  645. request:
  646. attributes:
  647. - ifindex
  648. - scope
  649. reply:
  650. attributes:
  651. - ifindex
  652. - queue-type
  653. - queue-id
  654. - rx-packets
  655. - rx-bytes
  656. - tx-packets
  657. - tx-bytes
  658. -
  659. name: bind-rx
  660. doc: Bind dmabuf to netdev
  661. attribute-set: dmabuf
  662. flags: [ admin-perm ]
  663. do:
  664. request:
  665. attributes:
  666. - ifindex
  667. - fd
  668. - queues
  669. reply:
  670. attributes:
  671. - id
  672. kernel-family:
  673. headers: [ "linux/list.h"]
  674. sock-priv: struct list_head
  675. mcast-groups:
  676. list:
  677. -
  678. name: mgmt
  679. -
  680. name: page-pool