Family netdev netlink 規範¶
概要¶
透過通用 netlink 的 netdev 配置。
操作¶
dev-get¶
獲取/轉儲關於 netdev 的資訊。
- attribute-set:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- flags:
[
admin-perm]- do:
- request
- attributes:
[
ifindex,fd,queues]
- reply
- attributes:
[
id]
napi-set¶
設定可配置的 NAPI 例項設定。
- attribute-set:
- flags:
[
admin-perm]- do:
- request
- attributes:
[
id,defer-hard-irqs,gro-flush-timeout,irq-suspend-timeout]
bind-tx¶
為 TX 將 dmabuf 繫結到 netdev
- attribute-set:
- 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:
rxtx
qstats-scope¶
- type:
flags
- entries:
queue
屬性集¶
dev¶
ifindex (u32)¶
- doc:
netdev ifindex
pad (pad)¶
xdp-features (u64)¶
- doc:
已啟用的 xdp-features 的位掩碼。
- enum:
xdp-zc-max-segs (u32)¶
- doc:
ZC 驅動程式支援的最大片段計數
xdp-rx-metadata-features (u64)¶
- doc:
支援的 XDP 接收元資料特性的位掩碼。 有關更多詳細資訊,請參閱 XDP RX 元資料。
- enum:
xsk-features (u64)¶
- doc:
已啟用的 AF_XDP 特性的位掩碼。
- enum:
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:
page-pool-info¶
id¶
ifindex¶
page-pool-stats¶
info (nest)¶
- doc:
頁面池標識資訊。
- nested-attributes:
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:
napi-id (u32)¶
- doc:
為此佇列提供服務的 NAPI 例項的 ID。
dmabuf (u32)¶
- doc:
附加到此佇列的 dmabuf 的 ID(如果有)。
io-uring (nest)¶
- doc:
io_uring 記憶體提供程式資訊。
- nested-attributes:
xsk (nest)¶
- doc:
此佇列的 XSK 資訊(如果有)。
- nested-attributes:
qstats¶
ifindex (u32)¶
- doc:
統計資訊所屬的網路裝置 (netdevice) 的 ifindex。
queue-type (u32)¶
- doc:
佇列型別,如 rx、tx,用於 queue-id。
- enum:
queue-id (u32)¶
- doc:
佇列 ID,如果統計資訊的作用域限定為單個佇列例項。
scope (uint)¶
- doc:
應使用什麼物件型別來迭代統計資訊。
- enum:
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:
- multi-attr:
True
fd (u32)¶
- doc:
要繫結的 dmabuf 檔案描述符。
id (u32)¶
- doc:
dmabuf 繫結的 ID。