2.6. Packet Drops 原因


当队列已满时,数据包会被丢弃,通常是当队列没有足够快时,数据包被丢弃。瓶颈是当队列没有足够快排空时,应该排空队列的实体。在大多数情况下,使用 drop 计数器来跟踪丢弃的数据包。有时,硬件或软件设计中的一个错误可能会导致数据包跳过丢弃计数器。

Data Plan Development Kit(DPDK)包括用于转发数据包的 testpmd 应用。在本章中显示的情况下,testpmd 安装在虚拟机上,并轮询带有分配的逻辑内核(lcore)的端口,以将数据包从一个端口转发到另一个端口。testpmd 常与流量生成器一起使用,在本例中为物理虚拟物理(PVP)路径中的吞吐量。

2.6.1. OVS-DPDK Too Slow to Drain physical NIC

本例显示 PMD 线程负责轮询物理网络适配器(dpdk0)的接收(RX)队列。当 PMD 线程无法跟上数据包卷或中断时,数据包可能会被丢弃。

图 2.1. 轮询物理适配器 RX 队列

以下命令显示 dpdk0 界面中的统计信息。如果数据包被丢弃,因为 ovs-dpdk 没有快排空物理适配器,您会看到 rx_dropped 的速度会快速增长。

注意

PMD 应该为每个 NUMA 节点有一个以上物理 CPU 内核。

# ovs-vsctl --column statistics list interface dpdk0

statistics          : {mac_local_errors=0, mac_remote_errors=0, "rx_1024_to_1522_packets"=26, "rx_128_to_255_packets"=243,
"rx_1523_to_max_packets"=0, "rx_1_to_64_packets"=102602, "rx_256_to_511_packets"=6100, "rx_512_to_1023_packets"=27,
"rx_65_to_127_packets"=16488, rx_broadcast_packets=2751, rx_bytes=7718218, rx_crc_errors=0, rx_dropped=0, rx_errors=0,
rx_fragmented_errors=0, rx_illegal_byte_errors=0, rx_jabber_errors=0, rx_length_errors=0, rx_mac_short_dropped=0,
rx_mbuf_allocation_errors=0, rx_oversize_errors=0, rx_packets=125486, rx_undersized_errors=0, "tx_1024_to_1522_packets"=63,
"tx_128_to_255_packets"=319, "tx_1523_to_max_packets"=0, "tx_1_to_64_packets"=1053, "tx_256_to_511_packets"=50,
"tx_512_to_1023_packets"=68, "tx_65_to_127_packets"=7732, tx_broadcast_packets=12, tx_bytes=466813, tx_dropped=0,
tx_errors=0, tx_link_down_dropped=0, tx_multicast_packets=5642, tx_packets=9285}
Copy to Clipboard Toggle word wrap

2.6.2. VM Too Slow to Drain vhost-user

此示例与 图 2.1 中的示例类似,如果 lcore 线程超过发送到实例接收(RX)队列的数据包卷,则可能会遇到数据包丢失。

如需更多信息,请参阅以下文章:

图 2.2. 轮询虚拟适配器 RX 队列

要检查主机的 tx_dropped 值是否与虚拟机的 rx_dropped 值对应,请运行以下命令:

ovs-vsctl --column statistics list interface vhud8ada965-ce

statistics          : {"rx_1024_to_1522_packets"=0, "rx_128_to_255_packets"=0, "rx_1523_to_max_packets"=0,
"rx_1_to_64_packets"=0, "rx_256_to_511_packets"=0, "rx_512_to_1023_packets"=0, "rx_65_to_127_packets"=0, rx_bytes=0,
rx_dropped=0, rx_errors=0, rx_packets=0, tx_bytes=0, tx_dropped=0, tx_packets=0}
Copy to Clipboard Toggle word wrap

2.6.3. OVS-DPDK Too Slow to Drain vhost-user

在本例中,MonyD 线程是从主机角度轮询 virtio TX 的接收队列。如果 PMD 线程被数据包卷超过,或者中断,数据包可能会丢弃。

图 2.3. 轮询虚拟适配器 TX 队列

跟踪来自虚拟机的数据包的返回路径,并提供主机上的丢弃计数器(tx_dropped)和 VM(rx_dropped)端值,运行以下命令:

ovs-vsctl --column statistics list interface vhue5146cdf-aa

statistics          : {"rx_1024_to_1522_packets"=0, "rx_128_to_255_packets"=0, "rx_1523_to_max_packets"=0,
"rx_1_to_64_packets"=0, "rx_256_to_511_packets"=0, "rx_512_to_1023_packets"=0, "rx_65_to_127_packets"=0,
rx_bytes=0, rx_dropped=0, rx_errors=0, rx_packets=0, tx_bytes=0, tx_dropped=0, tx_packets=0}
Copy to Clipboard Toggle word wrap

2.6.4. Egress 物理接口上的数据包丢失

PCIe 和 RAM 之间的慢速传输速率可能会导致物理适配器从 TX 队列丢弃数据包。虽然这不经常存在,但是了解如何识别和解决这个问题非常重要。

图 2.4. 轮询物理适配器 TX 队列

以下命令显示 dpdk1 界面中的统计信息。如果 tx_dropped 大于零且快速增长,则创建一个红帽支持问题单。

ovs-vsctl --column statistics list interface dpdk1

statistics          : {mac_local_errors=0, mac_remote_errors=0, "rx_1024_to_1522_packets"=26,
"rx_128_to_255_packets"=243, "rx_1523_to_max_packets"=0, "rx_1_to_64_packets"=102602, "rx_256_to_511_packets"=6100,
"rx_512_to_1023_packets"=27, "rx_65_to_127_packets"=16488, rx_broadcast_packets=2751, rx_bytes=7718218,
rx_crc_errors=0, rx_dropped=0, rx_errors=0, rx_fragmented_errors=0, rx_illegal_byte_errors=0, rx_jabber_errors=0,
rx_length_errors=0, rx_mac_short_dropped=0, rx_mbuf_allocation_errors=0, rx_oversize_errors=0, rx_packets=125486,
rx_undersized_errors=0, "tx_1024_to_1522_packets"=63, "tx_128_to_255_packets"=319, "tx_1523_to_max_packets"=0,
"tx_1_to_64_packets"=1053, "tx_256_to_511_packets"=50, "tx_512_to_1023_packets"=68, "tx_65_to_127_packets"=7732,
tx_broadcast_packets=12, tx_bytes=466813, tx_dropped=0, tx_errors=0, tx_link_down_dropped=0,
tx_multicast_packets=5642, tx_packets=9285}
Copy to Clipboard Toggle word wrap

如果您看到这些类型的数据包丢失,请考虑重新配置内存频道。

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat