seladb / PcapPlusPlus

PcapPlusPlus is a multiplatform C++ library for capturing, parsing and crafting of network packets. It is designed to be efficient, powerful and easy to use. It provides C++ wrappers for the most popular packet processing engines such as libpcap, Npcap, WinPcap, DPDK, AF_XDP and PF_RING.
https://pcapplusplus.github.io/
The Unlicense
2.75k stars 674 forks source link

DpdkBridge cann't send packets in vf mode #178

Closed daoxuans closed 5 years ago

daoxuans commented 5 years ago

i have a Intel X520 NIC using SR-IOV mode. when test dpdkbridge example using vf nic ports, i found this process cann't forward packets to another port. In contrast, this example works fine when using pf nics. Can you give me some advice?

seladb commented 5 years ago

to be honest, I've never tested it in SR-IOV mode. I also don't have an Intel NIC available to do those tests. Did you try running the L2Fwd example that comes with DPDK? Does it work?

daoxuans commented 5 years ago

Yes, i tried DPDK L2Fwd example, it works fine. I'think some configurations are unsupported in SR-IOV mode, unfortunately, I didn't find out which configuration it was.

seladb commented 5 years ago

That's interesting. Unfortunately I don't have access to a system like you have so it won't be an easy thing to debug. Could you please describe what do you see?

daoxuans commented 5 years ago

A1: not crashing. A2: it can processing incoming packets. A3: can't see any packets going out on the other side.

seladb commented 5 years ago

Can you please try the other example: https://github.com/seladb/PcapPlusPlus/tree/master/Examples/DpdkExample-FilterTraffic and let me know if it works as expected?

The other example doesn't send any packets, it just processes incoming packets. If it works it probably means the problem lies in the send packets mechanism.

seladb commented 5 years ago

Could you please try to run the other example mentioned above and let me know the results?

daoxuans commented 5 years ago

Sorry, I am on vacation, I will try ASAP.

daoxuans commented 5 years ago

Examples/DpdkExample-FilterTraffic can't works correctly, similar to the previous example. I think it is related to dpdk configuration. But beyond that, i found a problem, at Examples/DpdkExample-FilterTraffic/AppWorkerThread.h :Line 131 "sendPacketsTo->sendPacket(*packetArr[i], 0);" all threads using "txq=0", is that safe?

echo-Mike commented 5 years ago

@shidaoxuan Concurrent usage of single Rx/Tx queue is never safe except when PMD supports DEV_TX_OFFLOAD_MT_LOCKFREE for Tx queues

seladb commented 5 years ago

@shidaoxuan could you please specify which part in DpdkExample-FilterTraffic doesn't work as expected? Is the app receiving packets?

daoxuans commented 5 years ago

In SRIOV Mode, "DpdkExample-FilterTraffic" and "dpdkbridge" can't send packets, i can't find the root cause.

seladb commented 5 years ago

Just to double check: this is happening only with PcapPlusPlus examples, right? On built-in DPDK examples you see packet being sent?

daoxuans commented 5 years ago

Yes, dpdk l2fw-jobstats example is ok.

seladb commented 5 years ago

I can try help you debug if you can somehow share your environment (you can also reach out to me by email)

seladb commented 5 years ago

please let me know what could be the next steps

daoxuans commented 5 years ago

I emailed my leader for debugging dpdk example, but he didn't allow it. i suggest hanging up this issue first.

seladb commented 5 years ago

What do you mean by hanging up this issue?

daoxuans commented 5 years ago

I‘ll reopen it when there are new discoveries.