app/testpmd: add commands for tunnel offload
Tunnel Offload API provides hardware independent, unified model
to offload tunneled traffic. Key model elements are:
- apply matches to both outer and inner packet headers
during entire offload procedure;
- restore outer header of partially offloaded packet;
- model is implemented as a set of helper functions.
Implementation details:
* Create application tunnel:
flow tunnel create <port> type <tunnel type>
On success, the command creates application tunnel object and returns
the tunnel descriptor. Tunnel descriptor is used in subsequent flow
creation commands to reference the tunnel.
* Create tunnel steering flow rule:
tunnel_set <tunnel descriptor> parameter used with steering rule
template.
* Create tunnel matching flow rule:
tunnel_match <tunnel descriptor> used with matching rule template.
* If tunnel steering rule was offloaded, outer header of a partially
offloaded packet is restored after miss.
Example:
test packet=
<Ether dst=24:8a:07:8d:ae:d6 src=50:6b:4b:cc:fc:e2 type=IPv4 |
<IP version=4 ihl=5 proto=udp src=1.1.1.1 dst=1.1.1.10 |
<UDP sport=4789 dport=4789 len=58 chksum=0x7f7b |
<VXLAN NextProtocol=Ethernet vni=0x0 |
<Ether dst=24:aa:aa:aa:aa:d6 src=50:bb:bb:bb:bb:e2 type=IPv4 |
<IP version=4 ihl=5 proto=icmp src=2.2.2.2 dst=2.2.2.200 |
<ICMP type=echo-request code=0 chksum=0xf7ff id=0x0 seq=0x0 |>>>>>>>
>>> len(packet)
92
testpmd> flow flush 0
testpmd> port 0/queue 0: received 1 packets
src=50:6B:4B:CC:FC:E2 - dst=24:8A:07:8D:AE:D6 - type=0x0800 -
length=92
testpmd> flow tunnel 0 type vxlan
port 0: flow tunnel #1 type vxlan
testpmd> flow create 0 ingress group 0 tunnel_set 1
pattern eth /ipv4 / udp dst is 4789 / vxlan / end
actions jump group 0 / end
Flow rule #0 created
testpmd> port 0/queue 0: received 1 packets
tunnel restore info: - vxlan tunnel - outer header present # <--
src=50:6B:4B:CC:FC:E2 - dst=24:8A:07:8D:AE:D6 - type=0x0800 -
length=92
testpmd> flow create 0 ingress group 0 tunnel_match 1
pattern eth / ipv4 / udp dst is 4789 / vxlan / eth / ipv4 /
end
actions set_mac_dst mac_addr 02:CA:FE:CA:FA:80 /
queue index 0 / end
Flow rule #1 created
testpmd> port 0/queue 0: received 1 packets
src=50:BB:BB:BB:BB:E2 - dst=02:CA:FE:CA:FA:80 - type=0x0800 -
length=42
* Destroy flow tunnel
flow tunnel destroy <port> id <tunnel id>
* Show existing flow tunnels
flow tunnel list <port>
Signed-off-by: Gregory Etelson <getelson@nvidia.com>