20. Generic Routing Encapsulation (GRE) Tests

Generic Routing Encapsulation (GRE) is a tunneling protocol developed by Cisco Systems that can encapsulate a wide variety of network layer protocols inside virtual point-to-point links over an Internet Protocol network. Fortville support GRE packet detecting, checksum computing and filtering.

20.1. Prerequisites

Fortville nic should be on the DUT.

20.2. Test Case 1: GRE ipv4 packet detect

Start testpmd and enable rxonly forwarding mode:

testpmd -c ffff -n 4 -- -i --tx-offloads=0x8fff
testpmd> set fwd rxonly
testpmd> set verbose 1
testpmd> start

Send packet as table listed and packet type match each layer.

Outer Vlan Outer IP Tunnel Inner L3 Inner L4
No Ipv4 GRE Ipv4 Udp
No Ipv4 GRE Ipv4 Tcp
No Ipv4 GRE Ipv4 Sctp
Yes Ipv4 GRE Ipv4 Udp
Yes Ipv4 GRE Ipv4 Tcp
Yes Ipv4 GRE Ipv4 Sctp

20.3. Test Case 2: GRE ipv6 packet detect

Start testpmd and enable rxonly forwarding mode:

testpmd -c ffff -n 4 -- -i --tx-offloads=0x8fff
testpmd> set fwd rxonly
testpmd> set verbose 1
testpmd> start

Send packet as table listed and packet type match each layer:

Ether()/IPv6(nh=47)/GRE()/IP()/UDP()/Raw('x'*40)
Ether()/IPv6(nh=47)/GRE(proto=0x86dd)/IPv6()/UDP()/Raw('x'*40)
Outer Vlan Outer IP Tunnel Inner L3 Inner L4
No Ipv6 GRE Ipv4 Udp
No Ipv6 GRE Ipv4 Tcp
No Ipv6 GRE Ipv4 Sctp
Yes Ipv6 GRE Ipv4 Udp
Yes Ipv6 GRE Ipv4 Tcp
Yes Ipv6 GRE Ipv4 Sctp
Outer Vlan Outer IP Tunnel Inner L3 Inner L4
No Ipv6 GRE Ipv6 Udp
No Ipv6 GRE Ipv6 Tcp
No Ipv6 GRE Ipv6 Sctp
Yes Ipv6 GRE Ipv6 Udp
Yes Ipv6 GRE Ipv6 Tcp
Yes Ipv6 GRE Ipv6 Sctp

20.4. Test Case 3: GRE packet filter

Start testpmd with multi queues:

testpmd -c ff -n 3 -- -i  --rxq=4 --txq=4 --tx-offloads=0x8fff
testpmd> set fwd rxonly
testpmd> set nbcore 4
testpmd> set verbose 1
testpmd> start

Add GRE filter that forward inner ip address 0.0.0.0 to queue 3:

testpmd> tunnel_filter add 0 XX:XX:XX:XX:XX:XX YY:YY:YY:YY:YY:YY \
         0.0.0.0 1 ipingre iip 0 3

Send packet inner ip address matched and check packet received by queue 3:

p = Ether()/IP()/GRE()/IP(dst="0.0.0.0")/UDP()

Remove tunnel filter and check same packet received by queue 0:

testpmd> tunnel_filter rm 0 XX:XX:XX:XX:XX:XX YY:YY:YY:YY:YY:YY \
         0.0.0.0 1 ipingre iip 0 3

Add GRE filter that forward outer ip address 0.0.0.0 to queue 3:

testpmd> tunnel_filter add 0 XX:XX:XX:XX:XX:XX YY:YY:YY:YY:YY:YY \
         0.0.0.0 1 ipingre oip 0 3

Send packet outer ip address matched and check packet received by queue 3.

Remove tunnel filter and check same packet received by queue 0:

testpmd> tunnel_filter rm 0 XX:XX:XX:XX:XX:XX YY:YY:YY:YY:YY:YY \
         0.0.0.0 1 ipingre oip 0 3

20.5. Test Case 4: GRE packet chksum offload

Start testpmd with hardware checksum offload enabled:

testpmd -c ff -n 3 -- -i --tx-offloads=0x8fff --enable-rx-cksum  --port-topology=loop
testpmd> set verbose 1
testpmd> set fwd csum
testpmd> csum set ip hw 0
testpmd> csum set udp hw 0
testpmd> csum set sctp hw 0
testpmd> csum set outer-ip hw 0
testpmd> csum set tcp hw 0
testpmd> csum parse_tunnel on 0
testpmd> start

Send packet with wrong outer IP checksum and check forwarded packet IP checksum is correct:

Ether()/IP(chksum=0x0)/GRE()/IP()/TCP()

Send packet with wrong inner IP checksum and check forwarded packet IP checksum is correct:

Ether()/IP()/GRE()/IP(chksum=0x0)/TCP()

Send packet with wrong inner TCP checksum and check forwarded packet TCP checksum is correct:

Ether()/IP()/GRE()/IP()/TCP(chksum=0x0)

Send packet with wrong inner UDP checksum and check forwarded packet UDP checksum is correct:

Ether()/IP()/GRE()/IP()/UDP(chksum=0xffff)

Send packet with wrong inner SCTP checksum and check forwarded packet SCTP checksum is correct:

Ether()/IP()/GRE()/IP()/SCTP(chksum=0x0)