Reputation: 159
I would like to setup a dpdk env then i can do packet generation and packet capture in one VM. Is this even possible ? If it is, may i ask what will the (port layout etc) setup look like in details ?
I have tried creating 2 dpdk compatible ports in one VM, and did pktgen on one port, doing packet capturing on the other. But it doesn't work. Note, while doing pktgen, i already specify the dst mac address is the mac addr of the other port which the packet capturing app is sniffing.
It seems I either wire these 2 ports together physically or create a loopback for these 2 ports which i didn't know how.
Thanks !
Upvotes: 0
Views: 735
Reputation: 81
It should be possible. Please note that "it doesn't work" doesn't quite describe your problem, so i'll have to go off my assumptions here.
Two instances of DPDK (e.g. pktgen and, say, l3fwd) should be able to coexist on a single VM without any problems, provided that you run both with different prefixes, and use the PCI white/blacklist to ensure that no port is used in more than one instance of DPDK.
So, assuming you have your ports at 08:00.0 and 09:00.0, the following might be the command-line:
./dpdk_app1 -w 08:00.0 --file-prefix=app1 # use only 08:00.0, use prefix app1
./dpdk_app2 -w 09:00.0 --file-prefix=app2 # use only 09:00.0, use prefix app2
If you're not using fairly recent (18.05+) versions of DPDK, you will also have to limit amount of memory each application will use, as by default older versions of DPDK will take over your entire hugepage memory. This is not an issue for DPDK versions 18.05+ so if you're using that, you can disregard this paragraph.
Now, to your question of logistics of how to run two ports - this is left up to you. You can connect two ports back-to-back if you are using physical NICs (either using PCI pass-through, or using Virtual Functions). This is (IMO) the easiest way, however bear in mind that Virtual Functions's port MAC address needs to match the one defined by the host - otherwise the traffic will not be steered to/from your Virtual Functions.
I have never tried this, but it is a reasonable assumption to make that sending traffic VF to VF directly should also work, provided you have set up your MAC addresses correctly. There are references to a DTS test[1] which does exactly that (only using two VM's instead of one, which i don't think would make any difference), so it should be possible.
You can also use entirely virtual ports, and use one of our software drivers (e.g. tun[2] or pcap drivers[3]) - it won't be performant, but it'll do the job.
[1] https://doc.dpdk.org/dts/test_plans/vf_to_vf_nic_bridge_test_plan.html
[2] https://doc.dpdk.org/guides/nics/tap.html
[3] https://doc.dpdk.org/guides/nics/pcap_ring.html
Upvotes: 1