我有一台 Ubuntu PC,它带有 Intel i210 NIC,端口名为 enp1s0。它没有分配 IP 地址。该端口连接到类似 Ubuntu PC 上的另一个带有 I210 的端口,该端口也没有分配 IP 地址。两个端口上的 DHCP 均已禁用,MDNS 已关闭(avahi 守护程序)。
- 驱动程序 igb 版本:6.2.0-31-generic
- 固件版本:3.25,0x800006eb,1.1824.0
我看到每个 tx-rx 队列的端口每 2 秒出现一次 IRQ,但我找不到根本原因。我有一个/proc/interrupts
以 10 秒为间隔输出的脚本,输出为:
31: 0 0 0 1 IR-PCI-MSIX-0000:01:00.0 0-edge enp1s0
32: 7 0 0 1375 IR-PCI-MSIX-0000:01:00.0 1-edge enp1s0-TxRx-0
33: 1420 8 0 0 IR-PCI-MSIX-0000:01:00.0 2-edge enp1s0-TxRx-1
34: 0 0 1653 0 IR-PCI-MSIX-0000:01:00.0 3-edge enp1s0-TxRx-2
35: 0 0 1518 11 IR-PCI-MSIX-0000:01:00.0 4-edge enp1s0-TxRx-3
-------------------------------------------------------------------------------------------------------
31: 0 0 0 1 IR-PCI-MSIX-0000:01:00.0 0-edge enp1s0
32: 7 0 0 1380 IR-PCI-MSIX-0000:01:00.0 1-edge enp1s0-TxRx-0
33: 1425 8 0 0 IR-PCI-MSIX-0000:01:00.0 2-edge enp1s0-TxRx-1
34: 0 0 1658 0 IR-PCI-MSIX-0000:01:00.0 3-edge enp1s0-TxRx-2
35: 0 0 1523 11 IR-PCI-MSIX-0000:01:00.0 4-edge enp1s0-TxRx-3
现在我不是在此端口上发送或接收任何数据。我使用 tcpdump 验证了这一点。
使用 Ethtool 监控端口的统计数据。在 10 秒内,我每个 tx-rx-queue 收到 5 个 IRQ,这些统计数据没有变化。
ethtool -S enp1s0 | grep rx
rx_packets: 0
rx_bytes: 0
rx_broadcast: 0
rx_multicast: 0
rx_crc_errors: 0
rx_no_buffer_count: 0
rx_missed_errors: 0
rx_long_length_errors: 0
rx_short_length_errors: 0
rx_align_errors: 0
rx_flow_control_xon: 0
rx_flow_control_xoff: 0
rx_long_byte_count: 0
rx_smbus: 0
os2bmc_rx_by_bmc: 0
os2bmc_rx_by_host: 0
rx_hwtstamp_cleared: 0
rx_errors: 0
rx_length_errors: 0
rx_over_errors: 0
rx_frame_errors: 0
rx_fifo_errors: 0
rx_queue_0_packets: 0
rx_queue_0_bytes: 0
rx_queue_0_drops: 0
rx_queue_0_csum_err: 0
rx_queue_0_alloc_failed: 0
rx_queue_1_packets: 0
rx_queue_1_bytes: 0
rx_queue_1_drops: 0
rx_queue_1_csum_err: 0
rx_queue_1_alloc_failed: 0
rx_queue_2_packets: 0
rx_queue_2_bytes: 0
rx_queue_2_drops: 0
rx_queue_2_csum_err: 0
rx_queue_2_alloc_failed: 0
rx_queue_3_packets: 0
rx_queue_3_bytes: 0
rx_queue_3_drops: 0
rx_queue_3_csum_err: 0
rx_queue_3_alloc_failed: 0
然而接收到的数据包仍然会触发 NAPI 轮询:
我看到所有 CPU 每 2 秒执行一次 NAPI 轮询操作。这表明驱动程序每 2 秒调用一次 NAPI 调度。
sudo trace-cmd record -e napi:napi_poll
等待一会儿然后:
sudo trace-cmd report -t | grep enp1s0
kworker/3:0-36 [003] 1571.355236183: napi_poll: napi poll on napi struct 0xffffa09b91c4d050 for device enp1s0 work 0 budget 64
<idle>-0 [000] 1571.355249600: napi_poll: napi poll on napi struct 0xffffa09b91c49050 for device enp1s0 work 0 budget 64
<idle>-0 [002] 1571.355250331: napi_poll: napi poll on napi struct 0xffffa09b91c4a050 for device enp1s0 work 0 budget 64
<idle>-0 [002] 1571.355250909: napi_poll: napi poll on napi struct 0xffffa09b91c4f050 for device enp1s0 work 0 budget 64
kworker/3:0-36 [003] 1573.371205650: napi_poll: napi poll on napi struct 0xffffa09b91c4d050 for device enp1s0 work 0 budget 64
<idle>-0 [002] 1573.371218257: napi_poll: napi poll on napi struct 0xffffa09b91c4a050 for device enp1s0 work 0 budget 64
<idle>-0 [002] 1573.371219336: napi_poll: napi poll on napi struct 0xffffa09b91c4f050 for device enp1s0 work 0 budget 64
<idle>-0 [000] 1573.371224475: napi_poll: napi poll on napi struct 0xffffa09b91c49050 for device enp1s0 work 0 budget 64
kworker/3:0-36 [003] 1575.355151221: napi_poll: napi poll on napi struct 0xffffa09b91c4d050 for device enp1s0 work 0 budget 64
<idle>-0 [000] 1575.355163970: napi_poll: napi poll on napi struct 0xffffa09b91c49050 for device enp1s0 work 0 budget 64
<idle>-0 [002] 1575.355165554: napi_poll: napi poll on napi struct 0xffffa09b91c4a050 for device enp1s0 work 0 budget 64
<idle>-0 [002] 1575.355166268: napi_poll: napi poll on napi struct 0xffffa09b91c4f050 for device enp1s0 work 0 budget 64
kworker/3:0-36 [003] 1577.371105686: napi_poll: napi poll on napi struct 0xffffa09b91c4d050 for device enp1s0 work 0 budget 64
<idle>-0 [002] 1577.371119014: napi_poll: napi poll on napi struct 0xffffa09b91c4a050 for device enp1s0 work 0 budget 64
<idle>-0 [002] 1577.371119537: napi_poll: napi poll on napi struct 0xffffa09b91c4f050 for device enp1s0 work 0 budget 64
<idle>-0 [000] 1577.371152808: napi_poll: napi poll on napi struct 0xffffa09b91c49050 for device enp1s0 work 0 budget 64
kworker/3:0-36 [003] 1579.355064065: napi_poll: napi poll on napi struct 0xffffa09b91c4d050 for device enp1s0 work 0 budget 64
<idle>-0 [002] 1579.355077379: napi_poll: napi poll on napi struct 0xffffa09b91c4a050 for device enp1s0 work 0 budget 64
<idle>-0 [002] 1579.355077852: napi_poll: napi poll on napi struct 0xffffa09b91c4f050 for device enp1s0 work 0 budget 64
<idle>-0 [000] 1579.355111058: napi_poll: napi poll on napi struct 0xffffa09b91c49050 for device enp1s0 work 0 budget 64