Sample application showing a simple forwarding application, which allows users to explicitly allow/deny flows.
┌─────────────────────────────────────────────────────────────────────┐
│x86 Host │
│ ┌──────────────────────────────────────────────────────────────┤
│ │Virtual machine │
│ │ │
│ │ ┌─────────────────────────────────────────────────────────┤
│ │ │DPDK APP │
│ │ │ ┌---allow/deny◄---┐ │
│ │ │ ¦ ¦ │
│ │ ├────────────────────¦───────┬─────────¦──────────────────┤
│ │ │VF 1 ¦ │VF 2 ¦ │
│ │ │ ¦ │ ¦ │
│ │ │ ¦ │ ¦ │
│ │ │ ¦ │ ¦ │
├──────┴────┼──────────────┬─────¦───────┼─────────¦────┬─────────────┤
│NVIDIA NIC │ VF 1 VNF rx │ VF 1¦VNF tx │ VF 2 VNF¦rx │ VF 2 VNF tx │
│ │ ┌─────┐ │ ¦-------┼--┐ ┌──┴──┐ │ │
│ │ │ rss │ │ ¦ │ ¦ │ rss │ │ │
│ │ └─────┘ │ ¦ │ ¦ └──▲──┘ │ │
│ │ │ ¦ │ ¦ ¦ │ │
│ │ ┌──────────┐ │ ¦ │ ┌┴──────┴──┐ │ │
│ │ │ hairpin │ │ ¦ │ │ hairpin │ │ │
│ └─┴──────────┴─┴─────▼───────┴─┴──────────┴─┴─────────────┤
│ │
└─────────────────────────────────────────────────────────────────────┘
Any packets without offloaded flows will get put in the VF's rx queues and rx_burst'ed by the PMD. The PMD will then make a decision on whether to allow the traffic or not.
- If the PMD decides to allow the flow, the packet will be tx_bursted to the opposite VF's TX queues and put on the wire.
- If the PMD decides to deny the flow, the packet will be dropped.
Any packets with offloaded flows will be directly hairpinned to the opposite VF's TX queues and will be put on the wire, without incurring any CPU overhead.
- DOCA:
2.7.0085
- DPDK:
22.11.2404.0.11
Make sure they are in pkg-config path: pkg-config --modversion libdpdk doca
.
meson build
ninja -C build
With VF PCIs 26:00.3
and 26.00.5
:
./build/doca-selective-fwd -a26:00.3,dv_flow_en=2,dv_xmeta_en=4 -a26:00.5,dv_flow_en=2,dv_xmeta_en=4
Users can selectively offload hairpin flows for traffic which is received.
[06:38:23:967506][398293][DOCA][INF][pipes.c:291][run_app] Setup done. Listening for packets
[P0 Q2] Offload 60.0.0.1:1238 -> 60.0.0.3:80? (s/p/n): p
[06:38:56:092519][398293][DOCA][INF][pipes.c:327][run_app] Flow offloaded
[P0 Q44] Offload 60.0.0.1:4000 -> 60.0.0.2:4001? (s/p/n): n
[06:39:21:403840][398293][DOCA][INF][pipes.c:331][run_app] Flow will not be offloaded
[P0 Q44] Offload 60.0.0.1:4000 -> 60.0.0.2:4001? (s/p/n): n
[06:39:28:982206][398293][DOCA][INF][pipes.c:331][run_app] Flow will not be offloaded
If user selects:
- s - packet is re-injected to the same port which received it, and a flow which hairpins future packets for that 5-tuple is added
- p - packet is re-injected to the peer port (the one which did not receive it), and a flow which hairpins future packets for that 5-tuple is added
- n - packet is dropped