Logo

Linux 内核

6.16.0-rc4

快速搜索

目录

  • 开发流程
  • 提交补丁
  • 行为准则
  • 维护者手册
  • 所有开发流程文档
  • 核心 API
  • 驱动 API
  • 子系统
    • 核心子系统
    • 人机接口
    • 网络接口
      • 网络
      • NetLabel
      • InfiniBand
      • ISDN
      • MHI
    • 存储接口
    • 其他子系统
  • 锁
  • 许可规则
  • 编写文档
  • 开发工具
  • 测试指南
  • 黑客指南
  • 追踪
  • 故障注入
  • 实时补丁
  • Rust
  • 管理
  • 构建系统
  • 报告问题
  • 用户空间工具
  • 用户空间 API
  • 固件
  • 固件和设备树
  • CPU 架构
  • 未分类文档
  • 翻译

本页

  • 显示源码

Family netdev netlink 规范¶

目录

  • Family netdev netlink 规范

    • 概要

    • 操作

      • dev-get

      • dev-add-ntf

      • dev-del-ntf

      • dev-change-ntf

      • page-pool-get

      • page-pool-add-ntf

      • page-pool-del-ntf

      • page-pool-change-ntf

      • page-pool-stats-get

      • queue-get

      • napi-get

      • qstats-get

      • bind-rx

      • napi-set

      • bind-tx

    • 多播组

    • 定义

      • xdp-act

      • xdp-rx-metadata

      • xsk-flags

      • queue-type

      • qstats-scope

    • 属性集

      • dev

      • io-uring-provider-info

      • page-pool

      • page-pool-info

      • page-pool-stats

      • napi

      • xsk-info

      • queue

      • qstats

      • queue-id

      • dmabuf

概要¶

通过通用 netlink 的 netdev 配置。

操作¶

dev-get¶

获取/转储关于 netdev 的信息。

attribute-set:

dev

do:
request
attributes:

[ifindex]

reply
attributes:

[ifindex, xdp-features, xdp-zc-max-segs, xdp-rx-metadata-features, xsk-features]

dump:
reply
attributes:

[ifindex, xdp-features, xdp-zc-max-segs, xdp-rx-metadata-features, xsk-features]

dev-add-ntf¶

关于设备出现的通知。

notify:

dev-get

mcgrp:

mgmt

dev-del-ntf¶

关于设备消失的通知。

notify:

dev-get

mcgrp:

mgmt

dev-change-ntf¶

关于设备配置被更改的通知。

notify:

dev-get

mcgrp:

mgmt

page-pool-get¶

获取/转储关于 Page Pools 的信息。(只能列出与 net_device 关联的 Page Pools。)

attribute-set:

page-pool

config-cond:

page-pool

do:
request
attributes:

[id]

reply
attributes:

[id, ifindex, napi-id, inflight, inflight-mem, detach-time, dmabuf, io-uring]

dump:
reply
attributes:

[id, ifindex, napi-id, inflight, inflight-mem, detach-time, dmabuf, io-uring]

page-pool-add-ntf¶

关于页面池出现的通知。

notify:

page-pool-get

mcgrp:

page-pool

config-cond:

page-pool

page-pool-del-ntf¶

关于页面池消失的通知。

notify:

page-pool-get

mcgrp:

page-pool

config-cond:

page-pool

page-pool-change-ntf¶

关于页面池配置被更改的通知。

notify:

page-pool-get

mcgrp:

page-pool

config-cond:

page-pool

page-pool-stats-get¶

获取页面池统计信息。

attribute-set:

page-pool-stats

config-cond:

page-pool-stats

do:
request
attributes:

[info]

reply
attributes:

[info, alloc-fast, alloc-slow, alloc-slow-high-order, alloc-empty, alloc-refill, alloc-waive, recycle-cached, recycle-cache-full, recycle-ring, recycle-ring-full, recycle-released-refcnt]

dump:
reply
attributes:

[info, alloc-fast, alloc-slow, alloc-slow-high-order, alloc-empty, alloc-refill, alloc-waive, recycle-cached, recycle-cache-full, recycle-ring, recycle-ring-full, recycle-released-refcnt]

queue-get¶

从内核获取队列信息。 将仅报告已配置的队列(而不是所有可用的硬件队列)。

attribute-set:

queue

do:
request
attributes:

[ifindex, type, id]

reply
attributes:

[id, type, napi-id, ifindex, dmabuf, io-uring, xsk]

dump:
request
attributes:

[ifindex]

reply
attributes:

[id, type, napi-id, ifindex, dmabuf, io-uring, xsk]

napi-get¶

获取关于系统上配置的 NAPI 实例的信息。

attribute-set:

napi

do:
request
attributes:

[id]

reply
attributes:

[id, ifindex, irq, pid, defer-hard-irqs, gro-flush-timeout, irq-suspend-timeout]

dump:
request
attributes:

[ifindex]

reply
attributes:

[id, ifindex, irq, pid, defer-hard-irqs, gro-flush-timeout, irq-suspend-timeout]

qstats-get¶

获取/转储细粒度统计信息。 报告哪些统计信息取决于设备和驱动程序,以及驱动程序是否存储每个队列的软件计数器。

attribute-set:

qstats

dump:
request
attributes:

[ifindex, scope]

reply
attributes:

[ifindex, queue-type, queue-id, rx-packets, rx-bytes, tx-packets, tx-bytes]

bind-rx¶

将 dmabuf 绑定到 netdev

attribute-set:

dmabuf

flags:

[admin-perm]

do:
request
attributes:

[ifindex, fd, queues]

reply
attributes:

[id]

napi-set¶

设置可配置的 NAPI 实例设置。

attribute-set:

napi

flags:

[admin-perm]

do:
request
attributes:

[id, defer-hard-irqs, gro-flush-timeout, irq-suspend-timeout]

bind-tx¶

为 TX 将 dmabuf 绑定到 netdev

attribute-set:

dmabuf

do:
request
attributes:

[ifindex, fd]

reply
attributes:

[id]

多播组¶

  • mgmt

  • page-pool

定义¶

xdp-act¶

type:

flags

entries:
basic:

所有驱动程序支持的 XDP 特性集(XDP_ABORTED、XDP_DROP、XDP_PASS、XDP_TX)

redirect:

netdev 支持 XDP_REDIRECT

ndo-xmit:

此特性通知 netdev 是否实现了 ndo_xdp_xmit 回调。

xsk-zerocopy:

此特性通知 netdev 是否在零复制模式下支持 AF_XDP。

hw-offload:

此特性通知 netdev 是否支持 XDP hw 卸载。

rx-sg:

此特性通知 netdev 是否在驱动程序 napi 回调中实现了非线性 XDP 缓冲区支持。

ndo-xmit-sg:

此特性通知 netdev 是否在 ndo_xdp_xmit 回调中实现了非线性 XDP 缓冲区支持。

xdp-rx-metadata¶

type:

flags

entries:
timestamp:

设备能够通过 bpf_xdp_metadata_rx_timestamp() 公开接收 HW 时间戳。

hash:

设备能够通过 bpf_xdp_metadata_rx_hash() 公开接收数据包哈希。

vlan-tag:

设备能够通过 bpf_xdp_metadata_rx_vlan_tag() 公开接收数据包 VLAN 标签。

xsk-flags¶

type:

flags

entries:
tx-timestamp:

驱动程序支持 HW 时间戳标记出口数据包。

tx-checksum:

驱动程序支持 L3 校验和 HW 卸载。

tx-launch-time-fifo:

驱动程序支持启动时间 HW 卸载。

queue-type¶

type:

enum

entries:
  • rx

  • tx

qstats-scope¶

type:

flags

entries:
  • queue

属性集¶

dev¶

ifindex (u32)¶

doc:

netdev ifindex

pad (pad)¶

xdp-features (u64)¶

doc:

已启用的 xdp-features 的位掩码。

enum:

xdp-act

xdp-zc-max-segs (u32)¶

doc:

ZC 驱动程序支持的最大片段计数

xdp-rx-metadata-features (u64)¶

doc:

支持的 XDP 接收元数据特性的位掩码。 有关更多详细信息,请参阅 XDP RX 元数据。

enum:

xdp-rx-metadata

xsk-features (u64)¶

doc:

已启用的 AF_XDP 特性的位掩码。

enum:

xsk-flags

io-uring-provider-info¶

page-pool¶

id (uint)¶

doc:

页面池实例的唯一 ID。

ifindex (u32)¶

doc:

页面池所属的 netdev 的 ifindex。 如果为已销毁的 netdev 分配了页面池,则可能报告为 0(页面池可能会比其 netdevs 更持久,因为它们会等待所有内存都被返回)。

napi-id (uint)¶

doc:

使用此页面池实例的 NAPI 的 Id。

inflight (uint)¶

doc:

对此页面池的未完成引用数(已分配但尚未释放的页面)。 已分配的页面可能保存在套接字接收队列、驱动程序接收环、页面池回收环、页面池缓存等中。

inflight-mem (uint)¶

doc:

未完成页面持有的内存量。

detach-time (uint)¶

doc:

驱动程序分离页面池时 CLOCK_BOOTTIME 中的秒数。 分离后,页面池不能再用于分配内存。 页面池会等待从它们分配的所有内存被释放,然后才会真正消失。 “已分离”的页面池无法“重新连接”,它们只是在等待消失。 如果页面池尚未分离,并且仍可用于分配新内存,则不存在该属性。

dmabuf (u32)¶

doc:

此页面池附加到的 dmabuf 的 ID。

io-uring (nest)¶

doc:

io-uring 内存提供程序信息。

nested-attributes:

io-uring-provider-info

page-pool-info¶

id¶

ifindex¶

page-pool-stats¶

info (nest)¶

doc:

页面池标识信息。

nested-attributes:

page-pool-info

alloc-fast (uint)¶

value:

8

alloc-slow (uint)¶

alloc-slow-high-order (uint)¶

alloc-empty (uint)¶

alloc-refill (uint)¶

alloc-waive (uint)¶

recycle-cached (uint)¶

recycle-cache-full (uint)¶

recycle-ring (uint)¶

recycle-ring-full (uint)¶

recycle-released-refcnt (uint)¶

napi¶

ifindex (u32)¶

doc:

NAPI 实例所属的网络设备 (netdevice) 的 ifindex。

id (u32)¶

doc:

NAPI 实例的 ID。

irq (u32)¶

doc:

与 NAPI 关联的中断向量号。

pid (u32)¶

doc:

NAPI 线程的 PID,如果 NAPI 配置为线程模式运行。如果 NAPI 不在线程模式下(即使用正常的 softirq 上下文),则此属性将不存在。

defer-hard-irqs (u32)¶

doc:

IRQ 延迟结束并重新启用硬件 IRQ 之前的连续空轮询次数。

gro-flush-timeout (uint)¶

doc:

触发 NAPI 监视器定时器(用于调度 NAPI 处理)的超时时间,以纳秒为单位。此外,非零值还将阻止 GRO 在 NAPI 周期结束时刷新最近的超级帧。这可能会增加接收延迟,以换取减少网络堆栈处理的帧数。

irq-suspend-timeout (uint)¶

doc:

以纳秒为单位,暂停 irq 处理的时间长度(如果事件轮询找到事件)。

xsk-info¶

queue¶

id (u32)¶

doc:

队列索引;大多数队列类型都像 C 数组一样进行索引,索引从 0 开始,到队列计数 - 1 结束。队列索引的作用域限定于接口和队列类型。

ifindex (u32)¶

doc:

队列所属的网络设备 (netdevice) 的 ifindex。

type (u32)¶

doc:

队列类型,如 rx、tx。每种队列类型都定义一个单独的 ID 空间。内核中分配的 XDP TX 队列未链接到 NAPI,因此未列出。AF_XDP 队列将在 xsk 属性中设置更多信息。

enum:

queue-type

napi-id (u32)¶

doc:

为此队列提供服务的 NAPI 实例的 ID。

dmabuf (u32)¶

doc:

附加到此队列的 dmabuf 的 ID(如果有)。

io-uring (nest)¶

doc:

io_uring 内存提供程序信息。

nested-attributes:

io-uring-provider-info

xsk (nest)¶

doc:

此队列的 XSK 信息(如果有)。

nested-attributes:

xsk-info

qstats¶

ifindex (u32)¶

doc:

统计信息所属的网络设备 (netdevice) 的 ifindex。

queue-type (u32)¶

doc:

队列类型,如 rx、tx,用于 queue-id。

enum:

queue-type

queue-id (u32)¶

doc:

队列 ID,如果统计信息的作用域限定为单个队列实例。

scope (uint)¶

doc:

应使用什么对象类型来迭代统计信息。

enum:

qstats-scope

rx-packets (uint)¶

doc:

成功接收并传递到堆栈的线上传输的数据包数量。对于支持 XDP 的驱动程序,XDP 被认为是堆栈的第一层,因此 XDP 消耗的数据包仍在此处计数。

value:

8

rx-bytes (uint)¶

doc:

成功接收的字节数,请参阅 rx-packets。

tx-packets (uint)¶

doc:

成功发送的线上传输的数据包数量。一旦数据包位于设备内存中,则认为该数据包已成功发送(通常这意味着设备已为该数据包发出 DMA 完成信号)。

tx-bytes (uint)¶

doc:

成功发送的字节数,请参阅 tx-packets。

rx-alloc-fail (uint)¶

doc:

Rx 数据路径上 skb 或缓冲区分配失败的次数。分配失败可能导致数据包丢弃,也可能不会,具体取决于驱动程序实现以及系统是否快速恢复。

rx-hw-drops (uint)¶

doc:

进入设备但从未离开设备的所有数据包的数量,包括但不限于:由于缺少缓冲区空间、处理错误、显式或隐式策略和数据包过滤器而丢弃的数据包。

rx-hw-drop-overruns (uint)¶

doc:

由于瞬时资源不足(例如缓冲区空间、主机描述符等)而丢弃的数据包数量。

rx-csum-complete (uint)¶

doc:

标记为 CHECKSUM_COMPLETE 的数据包数量。

rx-csum-unnecessary (uint)¶

doc:

标记为 CHECKSUM_UNNECESSARY 的数据包数量。

rx-csum-none (uint)¶

doc:

设备未校验的数据包数量。

rx-csum-bad (uint)¶

doc:

具有错误校验和的数据包数量。数据包不会被丢弃,但仍会传递到堆栈。

rx-hw-gro-packets (uint)¶

doc:

由设备将较小数据包合并成较大数据包的数量。仅计算与 HW-GRO 网络设备功能合并的数据包,不计算 LRO 合并的数据包。

rx-hw-gro-bytes (uint)¶

doc:

请参阅 rx-hw-gro-packets。

rx-hw-gro-wire-packets (uint)¶

doc:

与 HW-GRO 网络设备功能合并为更大的数据包的数据包数量。不计算 LRO 合并的数据包。

rx-hw-gro-wire-bytes (uint)¶

doc:

请参阅 rx-hw-gro-wire-packets。

rx-hw-drop-ratelimits (uint)¶

doc:

由于接收到的数据包比特率超过设备速率限制,设备丢弃的数据包数量。

tx-hw-drops (uint)¶

doc:

到达设备但从未离开设备的数据包数量,包括因处理错误等原因而丢弃的数据包,以及受明确定义的策略和数据包过滤标准影响的数据包。

tx-hw-drop-errors (uint)¶

doc:

由于无效或格式错误而丢弃的数据包数量。

tx-csum-none (uint)¶

doc:

不需要设备计算校验和的数据包数量。

tx-needs-csum (uint)¶

doc:

需要设备计算校验和的数据包数量。此计数器包括设备计算 L4 校验和的 GSO wire 数据包的数量。

tx-hw-gso-packets (uint)¶

doc:

需要设备将数据包分割成较小数据包的数量。

tx-hw-gso-bytes (uint)¶

doc:

请参阅 tx-hw-gso-packets。

tx-hw-gso-wire-packets (uint)¶

doc:

通过处理 tx-hw-gso-packets 生成的 wire 大小的数据包数量。

tx-hw-gso-wire-bytes (uint)¶

doc:

请参阅 tx-hw-gso-wire-packets。

tx-hw-drop-ratelimits (uint)¶

doc:

由于传输的数据包比特率超过设备速率限制,设备丢弃的数据包数量。

tx-stop (uint)¶

doc:

驱动程序暂停接受来自堆栈到此队列的新 tx 数据包的次数,因为队列已满。请注意,如果在设备上支持并启用了 BQL,则网络堆栈将避免一次排队大量数据。

tx-wake (uint)¶

doc:

驱动程序重新开始接受来自堆栈到此队列的发送请求的次数。

queue-id¶

id¶

type¶

dmabuf¶

ifindex (u32)¶

doc:

将 dmabuf 绑定到的网络设备 (netdev) ifindex。

queues (nest)¶

doc:

要将 dmabuf 绑定到的接收队列。

nested-attributes:

queue-id

multi-attr:

True

fd (u32)¶

doc:

要绑定的 dmabuf 文件描述符。

id (u32)¶

doc:

dmabuf 绑定的 ID。

©The kernel development community. | Powered by Sphinx 5.3.0 & Alabaster 0.7.16 | Page source