运行示例出现错误:“错误:端口数量必须为偶数”

huangapple go评论55阅读模式
英文:

Running example gives "Error: number of ports must be even"

问题

我正在使用DPDK并已设置了一些大页面。我正在按照运行RX/TX回调示例的说明进行操作:

https://doc.dpdk.org/guides-18.08/sample_app_ug/rxtx_callbacks.html

在运行以下命令后:

sudo ./build/examples/dpdk-rxtx_callbacks -l 1 -n 4

我遇到了以下问题:

EAL: 检测到CPU逻辑内核:16
EAL: 检测到NUMA节点:1
EAL: 检测到DPDK的静态链接
EAL: 多进程套接字 /var/run/dpdk/rte/mp_socket
EAL: 选择IOVA模式 'PA'
EAL: VFIO支持已初始化
TELEMETRY: 没有传统回调,未创建传统套接字
EAL: 错误 - 退出,代码:1
原因:错误:端口数量必须是偶数

我的网卡:

lspci | egrep -i --color 'network|ethernet'
00:1f.6 以太网控制器:Intel Corporation Ethernet Connection (14) I219-LM(版本11)

DPDK支持I219:

https://core.dpdk.org/supported/nics/intel/

我已经通过谷歌搜索了一下,似乎当网卡不受支持时会出现这个问题。

I219和I219-LM之间有区别吗,因此出现了错误?

英文:

I am using DPDK and have set some huge pages. I am following the instructions to run the RX/TX callback example:

https://doc.dpdk.org/guides-18.08/sample_app_ug/rxtx_callbacks.html

After running this:

sudo ./build/examples/dpdk-rxtx_callbacks -l 1 -n 4

I get:

EAL: Detected CPU lcores: 16
EAL: Detected NUMA nodes: 1
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: VFIO support initialized
TELEMETRY: No legacy callbacks, legacy socket not created
EAL: Error - exiting with code: 1
 Cause: Error: number of ports must be even

My NIC:

lspci | egrep -i --color 'network|ethernet'
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (14) I219-LM (rev 11)

DPDK supports I219:

https://core.dpdk.org/supported/nics/intel/

I've Google'd it seems this problem occurs when a NIC isn't supported.

Is there a difference between I219 and I219-LM, hence the error?

答案1

得分: 1

除非您确实在使用DPDK 18.08版本,否则请确保使用最新文档,尽管它并没有提到您遇到这个问题的原因。rxtx_callbacks的编写方式要求端口数量是偶数。 "Port" 可以理解为 "adapter"。根据您的 lspci 输出,您只有一个I219适配器。(还没有提到的是:您可以使用多个 -a <port pci bus number> EAL 选项指定端口列表,如果没有指定,它将默认使用所有可用的适配器。)

它的编程目的是在每个偶数端口上接收数据包并将接收到的数据包发送回相应的奇数端口,即 port ^ 1。您可以在 lcore_main 函数中看到这些代码行。没有必要这样做,您可以将其更改为将数据包返回到接收它们的相同端口上,或者根本不发送数据包出去。您还需要在 main 函数的设置部分放宽限制。

我还应该提到,仅仅在 lspci 中看到适配器是不够的,它还必须绑定到与DPDK兼容的驱动程序。请参阅 dpdk-devbind,该工具可以显示每个适配器的状态,并具有命令来让您解绑/绑定适配器到兼容的驱动程序。

英文:

Unless you're really using DPDK 18.08, be sure to use latest documentation, although it doesn't mention the reason you're running into this snag either. The way rxtx_callbacks is written, it requires an even number of ports. "Port" can be read as "adapter." According to your lspci output, you only have a single I219. (Also not mentioned: you can specify your list of ports using multiple -a &lt;port pci bus number&gt; EAL options and, if none are specified, it will default to using all available adapters.)

What it is programmed to do is receive on every even port and send the received packet(s) back out the corresponding odd port, i.e. port ^ 1. You can see those lines in the lcore_main function. There's no need to have it do that and you can change it to mirror the packets back out on the same port it received them on or simply never send the packets out. You'd have to also ease the restrictions in the setup section of the main function.

I should also mention that it's necessary, but not sufficient to simply have an adapter show up in lspci. It should also be bound to a DPDK-compatible driver. See dpdk-devbind, which can show you the status of each adapter and also has commands to let you unbind / bind the adapter to a compatible driver.

huangapple
  • 本文由 发表于 2023年2月24日 03:03:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/75549247.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定