Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Porting DPDK application #1454

Open
JasMetzger opened this issue Jun 19, 2024 · 8 comments
Open

Porting DPDK application #1454

JasMetzger opened this issue Jun 19, 2024 · 8 comments

Comments

@JasMetzger
Copy link
Contributor

Question

My PCAP++ DPDK application runs on an Ubuntu 20.04 linux . I am trying to run same application in a 20.04 docker container with sufficient mappings and transparency on the host system. At one point I had this working with a bunch of -v options with docker run. But now when I run the app in a docker container I cannot initDPDK for some reason.

[ERROR: /PcapLiveDeviceList.cpp: init:46] Error searching for devices: Can't look for DPDK devices: The configuration file has invalid parameters.

It "Cannot init plugins" and errors.

What is the app missing from the environment?

Operating systems

No response

@SesomB
Copy link
Contributor

SesomB commented Jun 19, 2024

Can you provide the full docker run command you used ?
Did you tried to use --net=host and mount -v /dev:/dev for hugepages ?

@JasMetzger
Copy link
Contributor Author

Almost. Here is what I did at one point and it worked. But now when I build the image it doesn't and cannot figure out how come:

sudo docker run -d --name dpdk-channel --privileged --net=host -v /dev/hugepages:/dev/hugepages -v /var/run/dpdk:/var/run/dpdk dpdk-channel:1

@seladb
Copy link
Owner

seladb commented Jun 20, 2024

@JasMetzger I never ran DPDK inside docker so I'm not sure how to to make it work, but it seems that @SesomB has some experience, maybe he can help

@JasMetzger
Copy link
Contributor Author

I think it may not be specific to DPDK. The first call was to simply list the PCAP devices PCAPLiveDeviceList and it throws an error librte_pmd_e1000.so cannot open shared object file. This runs fine outside the container.

@SesomB
Copy link
Contributor

SesomB commented Jun 20, 2024

Try to create a custom docker image that contains DPDK installation and PcapPlusPlus.
From the error you mentioned I assume DPDK is installed on the host machine but not within the docker image and thus has insufficient mapping to the DPDK's shared libraries.
If installing DPDK on the system and just running your containerized application is your intention, we probably need to map RTE_SDK (the location of all DPDK libraries are installed) directory into the container.

@JasMetzger
Copy link
Contributor Author

I've gotten a little further. I have a custom docker image with DPDK and PCAP++ application installed. It runs and get through most of the initDPDK but complains about "ZERO DPDK ports are initialized.. Something went wrong while initializing....
I am also able to run dpdk-devbind -s inside the container and it sees the DPDK Intel device bound by the host.

image

@SesomB
Copy link
Contributor

SesomB commented Jun 20, 2024

Can you show us the output of dpdk-devbind.py --status from within the container ?

Also, Try to run with:
docker run -it -d --privileged -v /sys/bus/pci/drivers:/sys/bus/pci/drivers -v /sys/kernel/mm/hugepages:/sys/kernel/mm/hugepages -v /sys/devices/system/node:/sys/devices/system/node -v /dev:/dev --name CONTAINER_NAME IMAGE_NAME

@JasMetzger
Copy link
Contributor Author

JasMetzger commented Jun 20, 2024

I get lspci errors but it eventually lists the same that it does on host:
image

I installed the libkmod into the container as well but still seem to get the lspci errors.

This is when devbind -s on the host:
image

It seems to return a count of zero when running inside the container:

in DpdkDeviceList.cpp

#if (RTE_VER_YEAR < 18) || (RTE_VER_YEAR == 18 && RTE_VER_MONTH < 5)
int numOfPorts = (int)rte_eth_dev_count();
#else
int numOfPorts = (int)rte_eth_dev_count_avail();
#endif

For comparison, When I run outside the container, the output shows the line "EAL: Probe PCI driver: net_i40e (8086:1572) device: 0000:03:00.0 (socket 0)" When I run in the container, this is where it fails, this line does not appear. So it might be related to device driver? Not sure.

I was able to fix the issue but not sure how. When I make the Docker image I include the DPDK build I used when compiling PCAP++ 23.09. From Dockerfile:

ADD dpdk-21.11.6.tgz /usr/local

Somehow the first build I packaged works; my attempts at documenting my initial steps must have failed somwehre. I am not sure what the difference there is between the two compositions but I can say it has something to do with the DPDK 21.11.6 package I used to build and deploy the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants