dpdk 如何禁用 `CRC strip`、`header split`、`IP checksum offload` 和 `jumbo frame support`
How dpdk disable `CRC strip`, `header split`, `IP checksum offload`, and `jumbo frame support`
在 dpdk
的旧版本中,结构 rte_eth_rxmode
具有这些成员。
struct rte_eth_rxmode {
header_split = 0, /**< Header Split disabled */
hw_ip_checksum = 0, /**< IP checksum offload disabled */
hw_vlan_filter = 0, /**< VLAN filtering disabled */
jumbo_frame = 0, /**< Jumbo Frame Support disabled */
hw_strip_crc = 0, /**< CRC stripped by hardware */
...
}
但更新到dpdk-stable-19.11.3
后,这些成员被删除了。根据 docs,testpmd
应用程序支持 --disable-crc-strip
等命令行选项,但这些不是 EAL
命令行选项。如何禁用上面 dpdk-stable-19.11.3
中列出的这五个选项?还是默认情况下禁用这些选项?如果是这样,我如何查看这些状态?
此外,structrte_eth_txconf
的成员变量txq_flags
也从dpdk-stable-19.11.3
中移除。如何在 dpdk-stable-19.11.3
中进行设置?
好久没用dpdk
了。它发生了很大变化,我正在为这些变化而苦苦挣扎。有什么方法可以赶上这些变化吗?
在 DPDK 版本 19.11 中是,使用 struct rte_eth_rxmode
中的单个成员字段 unit64_t offloads
启用硬件卸载,这与旧 DPDK 版本的单个卸载参数不同。
另一方面,19.11 中的 hardware offloads 根据配置分为 per-port 和 per-queue 卸载。例如,用户可以设置基于每个端口和每个队列的卸载,哪些设备支持哪些可以使用 rte_eth_dev_info_get()
.
获取
如下所示struct rte_eth_rxmode
和struct rte_eth_rxconf
中的offloads
字段分别用于设置每个端口和每个队列的卸载。
struct rte_eth_rxmode {
...
/**
* Per-port Rx offloads to be set using DEV_RX_OFFLOAD_* flags.
* Only offloads set on rx_offload_capa field on rte_eth_dev_info
* structure are allowed to be set.
*/
uint64_t offloads;
...
};
struct rte_eth_rxconf {
...
/**
* Per-queue Rx offloads to be set using DEV_RX_OFFLOAD_* flags.
* Only offloads set on rx_queue_offload_capa or rx_offload_capa
* fields on rte_eth_dev_info structure are allowed to be set.
*/
uint64_t offloads;
...
};
注意:使用此处定义的宏 DEV_RX_OFFLOAD_*
标志启用支持设备的卸载 - Rx offload capabilities of a device
对于 testpmd,您可以将卸载设置为来自 DEV_RX_OFFLOAD_*
标志的位掩码,如下所示,前提是设备支持这些功能,
--rx-offloads=0xXXXXXXXX: hexadecimal bitmask of RX queue offloads
--tx-offloads=0xXXXXXXXX: hexadecimal bitmask of TX queue offloads
I haven't used dpdk for a long time. It has changed a lot, and I am struggling with these changes. Is there any way suggested for catch up these changes?
我建议您通过邮件列表 (dev@dpdk.org) 注册 dpdk 开发以了解上游 patches/updates.
使用 DPDK 19.11.3,可以通过编辑
default configuration as
static struct rte_eth_conf port_conf = {
.rxmode = {
.max_rx_pkt_len = JUMBO_FRAME_MAX_SIZE,
.split_hdr_size = 0,
.offloads = DEV_RX_OFFLOAD_JUMBO_FRAME | DEV_RX_OFFLOAD_KEEP_CRC | DEV_RX_OFFLOAD_IPV4_CKSUM | DEV_RX_OFFLOAD_HEADER_SPLIT,
},
.txmode = {
.mq_mode = ETH_MQ_TX_NONE,
}
};
或通过
获取和比较特征来修改port_init
中的卸载特征
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME | DEV_RX_OFFLOAD_HEADER_SPLIT | DEV_RX_OFFLOAD_KEEP_CRC | DEV_RX_OFFLOAD_IPV4_CKSUM;
注意:少数 NIC 支持 DEV_RX_OFFLOAD_HEADER_SPLIT
的功能,因此它很可能会在 port_init 中失败。使用 http://doc.dpdk.org/guides/nics/overview.html 作为卸载功能的通用指南。
使用 https://doc.dpdk.org/guides/testpmd_app_ug/run_app.html#eal-command-line-options 启用 testpmd
中的功能
--max-pkt-len=[size]
- 启用 JUMBO
--disable-crc-strip
- 防止 crc 被剥离
--enable-rx-cksum
- 启用硬件校验和(即使是 IPv4 校验和)
注意:关于 DEV_RX_OFFLOAD_HEADER_SPLIT 看起来它没有添加到 testpmd,因为没有多少 NIC PMD 支持相同的。
如果有 NIC PMD 不支持的功能,您可能会收到类似
的错误消息
Ethdev port_id=0 requested Rx offloads 0x2000e doesn't match Rx offloads capabilities 0x92e6f in rte_eth_dev_configure()
为了获得更多描述,请 运行 和 --log-level=pmd,8
在 dpdk
的旧版本中,结构 rte_eth_rxmode
具有这些成员。
struct rte_eth_rxmode {
header_split = 0, /**< Header Split disabled */
hw_ip_checksum = 0, /**< IP checksum offload disabled */
hw_vlan_filter = 0, /**< VLAN filtering disabled */
jumbo_frame = 0, /**< Jumbo Frame Support disabled */
hw_strip_crc = 0, /**< CRC stripped by hardware */
...
}
但更新到dpdk-stable-19.11.3
后,这些成员被删除了。根据 docs,testpmd
应用程序支持 --disable-crc-strip
等命令行选项,但这些不是 EAL
命令行选项。如何禁用上面 dpdk-stable-19.11.3
中列出的这五个选项?还是默认情况下禁用这些选项?如果是这样,我如何查看这些状态?
此外,structrte_eth_txconf
的成员变量txq_flags
也从dpdk-stable-19.11.3
中移除。如何在 dpdk-stable-19.11.3
中进行设置?
好久没用dpdk
了。它发生了很大变化,我正在为这些变化而苦苦挣扎。有什么方法可以赶上这些变化吗?
在 DPDK 版本 19.11 中是,使用 struct rte_eth_rxmode
中的单个成员字段 unit64_t offloads
启用硬件卸载,这与旧 DPDK 版本的单个卸载参数不同。
另一方面,19.11 中的 hardware offloads 根据配置分为 per-port 和 per-queue 卸载。例如,用户可以设置基于每个端口和每个队列的卸载,哪些设备支持哪些可以使用 rte_eth_dev_info_get()
.
如下所示struct rte_eth_rxmode
和struct rte_eth_rxconf
中的offloads
字段分别用于设置每个端口和每个队列的卸载。
struct rte_eth_rxmode {
...
/**
* Per-port Rx offloads to be set using DEV_RX_OFFLOAD_* flags.
* Only offloads set on rx_offload_capa field on rte_eth_dev_info
* structure are allowed to be set.
*/
uint64_t offloads;
...
};
struct rte_eth_rxconf {
...
/**
* Per-queue Rx offloads to be set using DEV_RX_OFFLOAD_* flags.
* Only offloads set on rx_queue_offload_capa or rx_offload_capa
* fields on rte_eth_dev_info structure are allowed to be set.
*/
uint64_t offloads;
...
};
注意:使用此处定义的宏 DEV_RX_OFFLOAD_*
标志启用支持设备的卸载 - Rx offload capabilities of a device
对于 testpmd,您可以将卸载设置为来自 DEV_RX_OFFLOAD_*
标志的位掩码,如下所示,前提是设备支持这些功能,
--rx-offloads=0xXXXXXXXX: hexadecimal bitmask of RX queue offloads
--tx-offloads=0xXXXXXXXX: hexadecimal bitmask of TX queue offloads
I haven't used dpdk for a long time. It has changed a lot, and I am struggling with these changes. Is there any way suggested for catch up these changes?
我建议您通过邮件列表 (dev@dpdk.org) 注册 dpdk 开发以了解上游 patches/updates.
使用 DPDK 19.11.3,可以通过编辑
default configuration as
static struct rte_eth_conf port_conf = {
.rxmode = {
.max_rx_pkt_len = JUMBO_FRAME_MAX_SIZE,
.split_hdr_size = 0,
.offloads = DEV_RX_OFFLOAD_JUMBO_FRAME | DEV_RX_OFFLOAD_KEEP_CRC | DEV_RX_OFFLOAD_IPV4_CKSUM | DEV_RX_OFFLOAD_HEADER_SPLIT,
},
.txmode = {
.mq_mode = ETH_MQ_TX_NONE,
}
};
或通过
获取和比较特征来修改port_init
中的卸载特征
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME | DEV_RX_OFFLOAD_HEADER_SPLIT | DEV_RX_OFFLOAD_KEEP_CRC | DEV_RX_OFFLOAD_IPV4_CKSUM;
注意:少数 NIC 支持 DEV_RX_OFFLOAD_HEADER_SPLIT
的功能,因此它很可能会在 port_init 中失败。使用 http://doc.dpdk.org/guides/nics/overview.html 作为卸载功能的通用指南。
使用 https://doc.dpdk.org/guides/testpmd_app_ug/run_app.html#eal-command-line-options 启用 testpmd
中的功能--max-pkt-len=[size]
- 启用 JUMBO--disable-crc-strip
- 防止 crc 被剥离--enable-rx-cksum
- 启用硬件校验和(即使是 IPv4 校验和)
注意:关于 DEV_RX_OFFLOAD_HEADER_SPLIT 看起来它没有添加到 testpmd,因为没有多少 NIC PMD 支持相同的。
如果有 NIC PMD 不支持的功能,您可能会收到类似
的错误消息Ethdev port_id=0 requested Rx offloads 0x2000e doesn't match Rx offloads capabilities 0x92e6f in rte_eth_dev_configure()
为了获得更多描述,请 运行 和 --log-level=pmd,8