nic-xdp-diagnostics

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

NIC Diagnostics for XDP

面向XDP的网卡诊断

Comprehensive reference for diagnosing, configuring, and monitoring NICs in AF_XDP / XDP workloads.

面向AF_XDP / XDP工作负载的网卡诊断、配置与监控综合参考指南。

1. Driver Detection & NIC Identification

1. 驱动检测与网卡识别

Identify the NIC and driver in use

识别当前使用的网卡与驱动

bash
undefined
bash
undefined

PCI device listing — find your NIC's bus address

PCI设备列表 — 找到你网卡的总线地址

lspci
lspci

Driver name, version, firmware, bus-info

驱动名称、版本、固件、总线信息

ethtool -i <iface>
ethtool -i <iface>

Link state, speed, duplex negotiation

链路状态、速率、双工协商结果

ethtool <iface> ethtool <iface> | egrep -i 'link|speed|duplex'
ethtool <iface> ethtool <iface> | egrep -i 'link|speed|duplex'

Confirm interface is up and check for attached XDP program

确认接口已启用,并检查挂载的XDP程序

ip link show dev <iface> ip link show dev <iface> | grep xdp
undefined
ip link show dev <iface> ip link show dev <iface> | grep xdp
undefined

Why it matters

重要性说明

XDP zero-copy support is driver-specific. Only certain drivers (ice, i40e, mlx5, etc.) support
XDP_DRV
mode and AF_XDP zero-copy. Knowing the driver tells you what features are available and what quirks to expect.

XDP零拷贝支持是驱动专属特性,只有特定驱动(ice、i40e、mlx5等)支持
XDP_DRV
模式和AF_XDP零拷贝。明确所用驱动可以让你知晓可用功能,以及需要注意的适配问题。

2. Hardware Queue Configuration

2. 硬件队列配置

View and set combined queue count

查看与设置组合队列数量

bash
undefined
bash
undefined

Show current and max queue count

显示当前和最大队列数量

ethtool -l <iface>
ethtool -l <iface>

Set combined queues (must match or exceed XDP queue IDs you bind to)

设置组合队列(数量必须匹配或超过你绑定的XDP队列ID)

ethtool -L <iface> combined <N>
ethtool -L <iface> combined <N>

List all queues exposed by the NIC

列出网卡暴露的所有队列

ls -1 /sys/class/net/<iface>/queues
undefined
ls -1 /sys/class/net/<iface>/queues
undefined

Ring buffer sizes

环形缓冲区大小

bash
undefined
bash
undefined

Show current and max ring buffer depths (rx/tx)

显示当前和最大环形缓冲区深度(接收/发送方向)

ethtool -g <iface>
undefined
ethtool -g <iface>
undefined

Why it matters

重要性说明

Each AF_XDP socket binds to a specific hardware queue. You need enough queues for your workload, and the ring buffer depth affects burst absorption. Too few queues = contention; too shallow rings = drops under burst.

每个AF_XDP套接字会绑定到特定硬件队列。你的工作负载需要足够的队列支撑,而环形缓冲区深度会影响突发流量承载能力。队列过少会导致资源竞争,环形缓冲区过浅会导致突发流量下丢包。

3. Offload Control — GSO, GRO, TSO, LRO

3. 卸载控制 — GSO、GRO、TSO、LRO

Inspect current offload state

检查当前卸载状态

bash
ethtool -k <iface>
ethtool -k <iface> | grep -E 'generic-receive|large-receive|scatter-gather|tcp-segmentation'
bash
ethtool -k <iface>
ethtool -k <iface> | grep -E 'generic-receive|large-receive|scatter-gather|tcp-segmentation'

Disable offloads for XDP

为XDP禁用卸载功能

bash
undefined
bash
undefined

XDP requires offloads disabled — aggregated/segmented frames break XDP processing

XDP需要关闭卸载功能 — 聚合/分段帧会破坏XDP处理逻辑

ethtool -K <iface> gro off lro off tso off gso off
undefined
ethtool -K <iface> gro off lro off tso off gso off
undefined

Why it matters

重要性说明

GRO/LRO aggregate multiple packets into a single large buffer. TSO/GSO do the same on the TX side. XDP programs operate on individual frames at the driver level — aggregated super-frames will either be rejected or cause undefined behavior. Always disable these before attaching XDP programs.

GRO/LRO会将多个数据包聚合为单个大缓冲区,TSO/GSO在发送侧执行相同的聚合操作。XDP程序在驱动层对单个帧进行处理,聚合后的超大帧要么会被拒绝,要么会导致未定义行为。挂载XDP程序前请务必关闭这些功能。

4. VLAN Offload Control

4. VLAN卸载控制

Inspect and toggle VLAN offloads

检查与切换VLAN卸载状态

bash
ethtool -k <iface> | grep -i vlan
bash
ethtool -k <iface> | grep -i vlan

Disable VLAN tag stripping (keep tags in packet data for XDP inspection)

禁用VLAN标签剥离(保留数据包中的标签供XDP检查)

ethtool -K <iface> rxvlan off ethtool -K <iface> txvlan off
ethtool -K <iface> rxvlan off ethtool -K <iface> txvlan off

Or via the longer form

或者使用完整参数形式

ethtool -K <iface> rx-vlan-offload off ethtool -K <iface> rx-vlan-filter off
ethtool -K <iface> rx-vlan-offload off ethtool -K <iface> rx-vlan-filter off

Re-enable if needed

如有需要可重新启用

ethtool -K <iface> rxvlan on ethtool -K <iface> rx-vlan-filter on
undefined
ethtool -K <iface> rxvlan on ethtool -K <iface> rx-vlan-filter on
undefined

Why it matters

重要性说明

When VLAN offload is on, the NIC strips the 802.1Q tag before the packet reaches XDP. If your XDP program needs to inspect or filter on VLAN IDs, you must disable
rxvlan
so the tag remains in the Ethernet header.

开启VLAN卸载时,网卡会在数据包到达XDP之前剥离802.1Q标签。如果你的XDP程序需要检查或基于VLAN ID过滤,必须禁用
rxvlan
以保证标签保留在以太网头中。

5. Flow Director (FDIR) / ntuple Rules

5. 流导(FDIR)/ ntuple规则

Check ntuple support

检查ntuple支持情况

bash
ethtool -k <iface> | grep -i ntuple
bash
ethtool -k <iface> | grep -i ntuple

View existing flow rules

查看现有流规则

bash
ethtool -n <iface>
ethtool -u <iface>
bash
ethtool -n <iface>
ethtool -u <iface>

Add FDIR rules — steer traffic to a specific hardware queue

添加FDIR规则 — 将流量引导到特定硬件队列

bash
undefined
bash
undefined

Steer UDP traffic matching a 5-tuple → queue 3

将匹配5元组的UDP流量引导到队列3

sudo ethtool -U <iface> flow-type udp4
src-ip <src> dst-ip <dst> dst-port <port> action 3
sudo ethtool -U <iface> flow-type udp4
src-ip <src> dst-ip <dst> dst-port <port> action 3

Steer TCP traffic to a specific dst-port → queue 0

将目标端口匹配的TCP流量引导到队列0

sudo ethtool -U <iface> flow-type tcp4
src-ip 0.0.0.0 dst-ip <dst> dst-port <port> action 0
undefined
sudo ethtool -U <iface> flow-type tcp4
src-ip 0.0.0.0 dst-ip <dst> dst-port <port> action 0
undefined

Why it matters

重要性说明

FDIR rules let you pin specific flows to specific hardware queues. Since each AF_XDP socket binds to one queue, FDIR is how you guarantee that your target traffic lands on the queue your XDP program is listening on. Without FDIR, RSS hashing distributes packets unpredictably across all queues.

FDIR规则允许你将特定流绑定到特定硬件队列。由于每个AF_XDP套接字绑定到一个队列,FDIR可以保证你的目标流量进入XDP程序监听的队列。没有FDIR的话,RSS哈希会将数据包不可预测地分发到所有队列。

6. Private Flags & Loopback

6. 私有标识与环回

bash
undefined
bash
undefined

Show driver-specific private flags

显示驱动专属的私有标识

ethtool --show-priv-flags <iface>
ethtool --show-priv-flags <iface>

Enable hardware loopback (useful for testing without a second machine)

启用硬件环回(无需第二台机器即可测试)

sudo ethtool --set-priv-flags <iface> loopback on sudo ethtool -s <iface> loopback on
sudo ethtool --set-priv-flags <iface> loopback on sudo ethtool -s <iface> loopback on

Check loopback support

检查环回支持情况

sudo ethtool --show-features <iface> | grep loopback

---
sudo ethtool --show-features <iface> | grep loopback

---

7. Detecting Idle CPU Cores for Pinning

7. 查找空闲CPU核心用于绑定

Map the CPU topology

映射CPU拓扑

bash
undefined
bash
undefined

Full CPU topology: CPU ID, physical core, socket, NUMA node

完整CPU拓扑:CPU ID、物理核心、插槽、NUMA节点、在线状态

lscpu -e=CPU,CORE,SOCKET,NODE,ONLINE
undefined
lscpu -e=CPU,CORE,SOCKET,NODE,ONLINE
undefined

Find NUMA node for the NIC

查找网卡对应的NUMA节点

bash
undefined
bash
undefined

Critical: pin XDP threads to cores on the same NUMA node as the NIC

关键:将XDP线程绑定到与网卡同NUMA节点的核心上

cat /sys/class/net/<iface>/device/numa_node
undefined
cat /sys/class/net/<iface>/device/numa_node
undefined

Find which cores are busy vs idle

查找核心忙闲状态

bash
undefined
bash
undefined

Per-CPU utilization — look for cores near 0% usage

单CPU利用率 — 寻找使用率接近0%的核心

mpstat -P ALL 1 5
mpstat -P ALL 1 5

Check what's pinned to each core already

检查每个核心上已绑定的进程

ps -eo pid,comm,psr --sort=psr | awk '{count[$3]++; procs[$3]=procs[$3] " " $2} END {for (c in count) print "CPU " c ": " count[c] " procs:" procs[c]}'
ps -eo pid,comm,psr --sort=psr | awk '{count[$3]++; procs[$3]=procs[$3] " " $2} END {for (c in count) print "CPU " c ": " count[c] " procs:" procs[c]}'

Check IRQ affinity — which cores handle which NIC interrupts

检查IRQ亲和性 — 哪些核心处理哪些网卡中断

cat /proc/interrupts | grep <iface> awk '/<iface>-TxRx/{print $1,$NF}' /proc/interrupts | sed 's/://' grep . /proc/irq/*/smp_affinity_list
undefined
cat /proc/interrupts | grep <iface> awk '/<iface>-TxRx/{print $1,$NF}' /proc/interrupts | sed 's/://' grep . /proc/irq/*/smp_affinity_list
undefined

Disable irqbalance (prevents the OS from moving IRQs to your pinned cores)

禁用irqbalance(防止操作系统将IRQ移动到你绑定的核心上)

bash
sudo systemctl stop irqbalance
systemctl status irqbalance
bash
sudo systemctl stop irqbalance
systemctl status irqbalance

Pin IRQs to specific cores

将IRQ绑定到特定核心

bash
undefined
bash
undefined

Check current IRQ CPU affinity

检查当前IRQ的CPU亲和性

cat /proc/irq/<irq_num>/smp_affinity_list
cat /proc/irq/<irq_num>/smp_affinity_list

Pin an IRQ to a specific core

将IRQ绑定到指定核心

echo <core_id> | sudo tee /proc/irq/<irq_num>/smp_affinity_list
undefined
echo <core_id> | sudo tee /proc/irq/<irq_num>/smp_affinity_list
undefined

MSI-X IRQ vector enumeration

MSI-X IRQ向量枚举

bash
undefined
bash
undefined

List all MSI-X vectors for the NIC's PCI device

列出网卡PCI设备的所有MSI-X向量

ls /sys/devices/pci<domain>/<bus>/<device>/msi_irqs
undefined
ls /sys/devices/pci<domain>/<bus>/<device>/msi_irqs
undefined

Why it matters

重要性说明

XDP busy-poll loops are CPU-bound. Pinning them to an idle core on the correct NUMA node eliminates cross-node memory latency and prevents the scheduler from preempting your hot loop. Always:
  1. Find the NIC's NUMA node
  2. Pick idle cores on that node
  3. Stop irqbalance
  4. Pin NIC IRQs away from your XDP cores
  5. Pin your XDP threads to the chosen cores

XDP忙询循环是CPU密集型任务,将其绑定到对应NUMA节点的空闲核心上可以消除跨节点内存延迟,同时避免调度器抢占你的热路径循环。请遵循以下步骤:
  1. 找到网卡的NUMA节点
  2. 选择该节点上的空闲核心
  3. 停止irqbalance服务
  4. 将网卡IRQ绑定到非XDP使用的核心
  5. 将XDP线程绑定到选定的核心

8. Hardware Queue & Drop Monitoring

8. 硬件队列与丢包监控

Live NIC statistics

实时网卡统计

bash
undefined
bash
undefined

Full stats dump

完整统计导出

ethtool -S <iface>
ethtool -S <iface>

XDP/XSK specific counters

XDP/XSK专属计数器

ethtool -S <iface> | grep -i xdp
ethtool -S <iface> | grep -i xdp

Filter for drops, errors, misses

过滤丢包、错误、未命中统计

ethtool -S <iface> | egrep -i 'rx|drop|err|xdp|xsk' | head -n 50
ethtool -S <iface> | egrep -i 'rx|drop|err|xdp|xsk' | head -n 50

Per-queue packet counts

单队列数据包计数

ethtool -S <iface> | grep -E "rx_queue" ethtool -S <iface> | grep "rx_queue_<N>_packets:"
undefined
ethtool -S <iface> | grep -E "rx_queue" ethtool -S <iface> | grep "rx_queue_<N>_packets:"
undefined

Live monitoring dashboards

实时监控面板

bash
undefined
bash
undefined

Watch queue counters in real time

实时查看队列计数器

watch -n 1 'ethtool -S <iface> | grep -E "rx_queue"'
watch -n 1 'ethtool -S <iface> | grep -E "rx_queue"'

Watch drops and errors

监控丢包与错误

watch -n1 "ethtool -S <iface> | grep -E 'rx_packets|rx_dropped|rx_queue'"
watch -n1 "ethtool -S <iface> | grep -E 'rx_packets|rx_dropped|rx_queue'"

Combined NIC + XDP socket status

整合网卡+XDP套接字状态

watch -n 1 "echo '=== NIC ===' && ethtool -S <iface> | grep -iE 'drop|miss|err|full' && echo '=== XDP ===' && cat /proc/net/xdp 2>/dev/null"
watch -n 1 "echo '=== 网卡 ===' && ethtool -S <iface> | grep -iE 'drop|miss|err|full' && echo '=== XDP ===' && cat /proc/net/xdp 2>/dev/null"

Full drop monitoring loop

完整丢包监控循环

IFACE=<iface>; QUEUE=<N> while true; do echo "--- $(date) ---" echo "NIC Drops:" ethtool -S $IFACE 2>/dev/null | grep -E "drop|miss|error|discard" | head -10 echo -e "\nQueue $QUEUE:" ethtool -S $IFACE 2>/dev/null | grep -i "queue_${QUEUE}" echo -e "\nXDP Sockets:" cat /proc/net/xdp 2>/dev/null || echo "No XDP sockets found" echo -e "\nInterface Totals:" cat /proc/net/dev | awk -v iface=$IFACE '$1 ~ iface {print "RX pkts:", $2, "RX drop:", $5}' sleep 5 done
undefined
IFACE=<iface>; QUEUE=<N> while true; do echo "--- $(date) ---" echo "网卡丢包:" ethtool -S $IFACE 2>/dev/null | grep -E "drop|miss|error|discard" | head -10 echo -e "\n队列 $QUEUE 状态:" ethtool -S $IFACE 2>/dev/null | grep -i "queue_${QUEUE}" echo -e "\nXDP套接字:" cat /proc/net/xdp 2>/dev/null || echo "未找到XDP套接字" echo -e "\n接口总计:" cat /proc/net/dev | awk -v iface=$IFACE '$1 ~ iface {print "接收包数:", $2, "接收丢包:", $5}' sleep 5 done
undefined

AF_XDP socket status

AF_XDP套接字状态

bash
undefined
bash
undefined

Kernel's view of active XDP sockets

内核视角的活跃XDP套接字

cat /proc/net/xdp cat /proc/net/xdp 2>/dev/null || ss -ax | grep -i xdp

---
cat /proc/net/xdp cat /proc/net/xdp 2>/dev/null || ss -ax | grep -i xdp

---

9. BPF Program Inspection & Profiling

9. BPF程序检查与性能分析

bpftool — inspect loaded XDP/BPF programs and maps

bpftool — 检查已加载的XDP/BPF程序和映射

bash
undefined
bash
undefined

List all loaded BPF programs

列出所有已加载的BPF程序

bpftool prog show
bpftool prog show

Details on a specific program

查看特定程序的详情

bpftool prog show id <prog_id>
bpftool prog show id <prog_id>

Profile a BPF program (cycles, instructions over 5 seconds)

分析BPF程序(5秒内的周期数、指令数)

bpftool prog profile id <prog_id> duration 5 cycles instructions
bpftool prog profile id <prog_id> duration 5 cycles instructions

List all BPF maps

列出所有BPF映射

bpftool map show bpftool map show | grep -i xsk
bpftool map show bpftool map show | grep -i xsk

Dump map contents (debug maps, XSK maps)

导出映射内容(调试映射、XSK映射)

bpftool map dump name <map_name> bpftool map dump pinned /sys/fs/bpf/xsks_map bpftool map dump id <map_id>
undefined
bpftool map dump name <map_name> bpftool map dump pinned /sys/fs/bpf/xsks_map bpftool map dump id <map_id>
undefined

Why it matters

重要性说明

bpftool
is the primary way to verify your XDP program is loaded, attached to the right interface, and that its maps (especially XSK maps) are populated correctly. Map dumps let you verify that socket file descriptors are registered in the XSKMAP.

bpftool
是验证XDP程序是否加载、是否挂载到正确接口、映射(尤其是XSK映射)是否正确填充的核心工具。映射导出可以帮助你验证套接字文件描述符是否已注册到XSKMAP中。

10. Kernel Tracing — ftrace / trace_pipe

10. 内核追踪 — ftrace / trace_pipe

Capture XDP trace events from the kernel

捕获内核的XDP追踪事件

bash
undefined
bash
undefined

Stream trace output (Ctrl+C to stop)

流式输出追踪内容(按Ctrl+C停止)

cat /sys/kernel/debug/tracing/trace_pipe
cat /sys/kernel/debug/tracing/trace_pipe

Background capture to a file

后台捕获到文件

cat /sys/kernel/debug/tracing/trace_pipe > /tmp/xdp_trace.log &
cat /sys/kernel/debug/tracing/trace_pipe > /tmp/xdp_trace.log &

Read the log

读取日志

cat /tmp/xdp_trace.log
cat /tmp/xdp_trace.log

Tail live

实时查看日志尾部

tail -f /sys/kernel/debug/tracing/trace_pipe
tail -f /sys/kernel/debug/tracing/trace_pipe

Stop background trace capture

停止后台追踪捕获

pkill -f trace_pipe fuser -k /sys/kernel/debug/tracing/trace_pipe
undefined
pkill -f trace_pipe fuser -k /sys/kernel/debug/tracing/trace_pipe
undefined

Watch dmesg for XDP events

查看dmesg中的XDP事件

bash
watch -n1 "dmesg | grep xdp"
bash
watch -n1 "dmesg | grep xdp"

Why it matters

重要性说明

When XDP programs call
bpf_trace_printk()
, output goes to
trace_pipe
. This is the primary printf-style debugging mechanism for eBPF/XDP programs. Use it to trace packet paths, verify filter logic, and debug drop reasons.

当XDP程序调用
bpf_trace_printk()
时,输出会写入
trace_pipe
,这是eBPF/XDP程序主要的printf风格调试机制。可以用它追踪数据包路径、验证过滤逻辑、调试丢包原因。

11. perf — CPU-Level Performance Profiling

11. perf — CPU级性能分析

Stat counters (lightweight, no recording)

统计计数器(轻量,无需录制)

bash
undefined
bash
undefined

Core hardware counters for your XDP process

XDP进程的核心硬件计数器

sudo perf stat -e cycles,instructions,cache-misses,LLC-load-misses,branches,branch-misses
-p $(pgrep <process>) -- sleep 10
sudo perf stat -e cycles,instructions,cache-misses,LLC-load-misses,branches,branch-misses
-p $(pgrep <process>) -- sleep 10

Extended counters (-d -d -d = most detail)

扩展计数器(-d -d -d = 最详细)

sudo perf stat -d -d -d -p $(pgrep <process>)
undefined
sudo perf stat -d -d -d -p $(pgrep <process>)
undefined

Record + flamegraph workflow

录制+火焰图工作流

bash
undefined
bash
undefined

Record with DWARF call graphs (most accurate stacks)

使用DWARF调用图录制(栈信息最准确)

sudo perf record --call-graph dwarf -e cycles
-p $(pgrep <process>) -- sleep 10
sudo perf record --call-graph dwarf -e cycles
-p $(pgrep <process>) -- sleep 10

Record on a specific CPU core

在特定CPU核心上录制

sudo perf record -F 997 -g --call-graph dwarf -C <core> -o perf.data -- sleep 60
sudo perf record -F 997 -g --call-graph dwarf -C <core> -o perf.data -- sleep 60

Record multiple event types

录制多种事件类型

sudo perf record -e cycles,stalled-cycles-frontend,stalled-cycles-backend,cache-misses,branch-misses
-g -p $(pgrep <process>)
sudo perf record -e cycles,stalled-cycles-frontend,stalled-cycles-backend,cache-misses,branch-misses
-g -p $(pgrep <process>)

Interactive report

交互式报告

sudo perf report
sudo perf report

Generate flamegraph (requires inferno)

生成火焰图(需要安装inferno)

sudo perf script -i perf.data | inferno-collapse-perf | inferno-flamegraph > flamegraph.svg
sudo perf script -i perf.data | inferno-collapse-perf | inferno-flamegraph > flamegraph.svg

Live top-like view

类top的实时视图

sudo perf top -p $(pgrep <process>) -g
undefined
sudo perf top -p $(pgrep <process>) -g
undefined

Why it matters

重要性说明

perf stat
answers "is my hot loop efficient?" — watch IPC (instructions per cycle), cache miss rates, and branch mispredictions.
perf record
+ flamegraphs show exactly where CPU time is spent in your rx/tx loop, revealing bottlenecks in ring operations, packet parsing, or syscalls.

perf stat
可以解答“我的热循环是否高效”的问题,关注IPC(每周期指令数)、缓存未命中率、分支预测错误率即可。
perf record
+火焰图可以精确展示收发循环中的CPU时间消耗,暴露环形操作、数据包解析或系统调用中的瓶颈。

12. IRQ-to-Queue-to-Core Mapping

12. IRQ-队列-核心映射

Full mapping workflow

完整映射工作流

bash
undefined
bash
undefined

1. Find which IRQs belong to your NIC

1. 找到属于你的网卡的IRQ

cat /proc/interrupts | grep <iface> awk '/<iface>-TxRx/{print $1,$NF}' /proc/interrupts | sed 's/://'
cat /proc/interrupts | grep <iface> awk '/<iface>-TxRx/{print $1,$NF}' /proc/interrupts | sed 's/://'

2. Check current CPU affinity for each IRQ

2. 检查每个IRQ的当前CPU亲和性

cat /proc/irq/<irq_num>/smp_affinity_list
cat /proc/irq/<irq_num>/smp_affinity_list

3. Pin queue IRQs to specific cores (avoid your XDP poll cores)

3. 将队列IRQ绑定到特定核心(避开你的XDP轮询核心)

echo <core_id> | sudo tee /proc/irq/<irq_num>/smp_affinity_list
undefined
echo <core_id> | sudo tee /proc/irq/<irq_num>/smp_affinity_list
undefined

Why it matters

重要性说明

Each NIC queue generates interrupts on a specific IRQ line. If the kernel delivers that IRQ to the same core running your XDP busy-poll, you get contention. Map out which IRQ serves which queue, then pin IRQs to cores that are not running your XDP threads.

每个网卡队列会在特定IRQ线上生成中断,如果内核将该IRQ分发到运行XDP忙询的同个核心,就会产生资源竞争。梳理清楚每个队列对应的IRQ,然后将IRQ绑定到未运行XDP线程的核心上。

13. Quick Diagnostic Checklist

13. 快速诊断清单

Run this sequence when setting up or debugging an XDP workload:
StepCommandLooking For
1
ethtool -i <iface>
Driver supports XDP (ice, i40e, mlx5)
2
ethtool -l <iface>
Enough combined queues
3
ethtool -g <iface>
Ring buffer depth adequate
4
ethtool -k <iface> | grep -E 'gro|tso|gso|lro'
All OFF
5
ethtool -k <iface> | grep ntuple
ntuple ON for FDIR
6
ethtool -n <iface>
FDIR rules steering to correct queues
7
cat /sys/class/net/<iface>/device/numa_node
NUMA node for core selection
8
lscpu -e=CPU,CORE,SOCKET,NODE,ONLINE
Available cores on correct NUMA
9
systemctl status irqbalance
Should be STOPPED
10
cat /proc/interrupts | grep <iface>
IRQs pinned away from XDP cores
11
bpftool prog show
XDP program loaded and attached
12
cat /proc/net/xdp
AF_XDP sockets active
13
ethtool -S <iface> | grep -i drop
Zero or stable drop counters
设置或调试XDP工作负载时可按以下步骤执行:
步骤命令预期检查项
1
ethtool -i <iface>
驱动支持XDP(ice、i40e、mlx5)
2
ethtool -l <iface>
组合队列数量充足
3
ethtool -g <iface>
环形缓冲区深度足够
4
ethtool -k <iface> | grep -E 'gro|tso|gso|lro'
所有状态均为OFF
5
ethtool -k <iface> | grep ntuple
ntuple开启以支持FDIR
6
ethtool -n <iface>
FDIR规则将流量引导到正确队列
7
cat /sys/class/net/<iface>/device/numa_node
确认核心选择对应的NUMA节点
8
lscpu -e=CPU,CORE,SOCKET,NODE,ONLINE
对应NUMA节点上有可用核心
9
systemctl status irqbalance
服务状态应为STOPPED
10
cat /proc/interrupts | grep <iface>
IRQ绑定到XDP核心以外的CPU
11
bpftool prog show
XDP程序已加载并挂载
12
cat /proc/net/xdp
AF_XDP套接字活跃
13
ethtool -S <iface> | grep -i drop
丢包计数器为0或数值稳定