P4ELTE / t4p4s

Retargetable compiler for the P4 language
http://p4.elte.hu/
Apache License 2.0
119 stars 42 forks source link

Error when running l2switch example #41

Closed msg-programs closed 2 years ago

msg-programs commented 2 years ago

I've set up T4P4S in a fresh Ubuntu 21.04 VM and am now trying to get the l2switch example to work. The commands used for compilation and execution are as follows. I've separated them, since I'm using network namespaces in my setup and the t4p4s.sh sometimes doesn't want to work with ip netns exec, so I have to do it like this.

Compilation:

./t4p4s.sh :l2switch dbg verbose model=psa

Execution, veth3-s and veth4-s are virtual ethernet devices:

./l2switch -c 0xc -n 2 --no-pci --vdev net_pcap0,rx_iface_in=veth3-s,tx_iface=veth3-s,tx_iface=veth3-s --vdev net_pcap1,rx_iface_in=veth4-s,tx_iface=veth4-s,tx_iface=veth4-s -- -p 0x3 --config "\"(0,0,2)(1,0,3)\""

When running the switch, the switch fails to run properly, displaying the following:

--- Init switch
EAL: Detected CPU lcores: 4
EAL: Detected NUMA nodes: 1
EAL: Detected shared 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
2  :::: Allocating DPDK mbuf pool on socket 0
2  :::: Init ports
2  :::: Init port 0
2  :::: Creating queues: nb_rxq=1 nb_txq=2
Ethdev port_id=0 requested Rx offloads 0xe doesn't match Rx offloads capabilities 0x0 in rte_eth_dev_configure()
EAL: Error - exiting with code: 1
  Cause: Cannot configure device: err=-22, port=0

I have had this problem with T4P4S before while using P4PI on a Raspberry Pi, but the error always somehow resolved itself, which is... sub-optimal.
The general setup (i.e. running the switch program inside a netns with veths as the interface devices) is working using P4PI, so it must be something other than my setup.

My examples.cfg is unchanged; the opts_dpdk.cfg has only the names of the interfaces the switch uses changed.

What causes this issue and how would I resolve it (if possible)? I haven't been able to find much information on this online and I'm still learning about DPDK and P4 in general.

I apologize in advance if this happens to be a trivial issue.

EDIT: Versions of all components:

- DPDK: 22.03.0
- GRPC: Commit from 2022-05-06 20:31:11 (SHA 5918f98ecbf5ace77f30fa97f7fc3e8bdac08e04)
- P4C: 1.2.2.1, Commit from 2022-03-01 18:37:15 (SHA 978a1166684010832a3bd408a7c68fd592ccb7a0). Local changes made to CMakeLists.txt by bootstrap script line 557 (changes `-fuse-ld=gold` to `-fuse-ld=lld-12`) 
- P4Runtime_GRPCPP: Commit from 2020-11-25 15:53:26 (SHA 261bdc73f149d15e61e73b4afa80c8085de9445f)
- PI: 0.1.0, Commit from 2022-03-09 22:04:59 (SHA f547455a260b710706bef82afab4cb9937bac416)
- Protobuf: 3.19.4, Commit from 2022-01-28 04:25:56 (SHA 22d0e265de7d2b3d2e9a00d071313502e7d4cccf)
- t4p4s: Commit from 2022-04-30 17:52:57 (SHA 22d0e265de7d2b3d2e9a00d071313502e7d4cccf). Local changes made to various files. None of them were made by me and I couldn't find a script that could have done them.
msg-programs commented 2 years ago

While comparing the setups on the VM and on the Pi, I overlooked the option vethmode. Adding this to the list of arguments solved the issue. This option is set for all of the programs in the examples.cfg of P4PI.