Simplify adjacency rewrite code
Using memcpy instead of complex specific copy logic. This simplify
the implementation and also improve perf slightly.
Also move adjacency data from tail to head of buffer, which improves
cache locality (header and data share the same cacheline)
Finally, fix VxLAN which used to workaround vnet_rewrite logic.
Change-Id: I770ddad9846f7ee505aa99ad417e6a61d5cbbefa
Signed-off-by: Benoît Ganne <bganne@cisco.com>
diff --git a/src/scripts/vnet/l3fwd b/src/scripts/vnet/l3fwd
new file mode 100644
index 0000000..e3dcf73
--- /dev/null
+++ b/src/scripts/vnet/l3fwd
@@ -0,0 +1,67 @@
+create packet-generator interface pg0
+set int ip address pg0 192.168.1.1/24
+set int ip address pg0 192:168:1::1/64
+set ip arp pg0 192.168.1.2 1:2:3:4:5:6 static
+set ip6 neighbor pg0 192:168:1::2 1:2:3:4:5:6 static
+set int state pg0 up
+
+create packet-generator interface pg1
+set int ip address pg1 192.168.2.1/24
+set int ip address pg1 192:168:2::1/64
+set ip arp pg1 192.168.2.2 6:5:4:3:2:1 static
+set ip6 neighbor pg1 192:168:2::2 6:5:4:3:2:1 static
+set int state pg1 up
+
+packet-generator new {
+ name v4-1-to-2
+ limit -1
+ node ip4-input
+ size 64-64
+ interface pg0
+ data {
+ UDP: 192.168.1.2 -> 192.168.2.2
+ UDP: 4321 -> 1234
+ length 128 checksum 0 incrementing 1
+ }
+}
+
+packet-generator new {
+ name v4-2-to-1
+ limit -1
+ node ip4-input
+ size 64-64
+ interface pg0
+ data {
+ UDP: 192.168.2.2 -> 192.168.1.2
+ UDP: 1234 -> 4321
+ length 128 checksum 0 incrementing 1
+ }
+}
+
+packet-generator new {
+ name v6-1-to-2
+ limit -1
+ node ip6-input
+ size 64-64
+ interface pg0
+ data {
+ UDP: 192:168:1::2 -> 192:168:2::2
+ UDP: 4321 -> 1234
+ length 128 checksum 0 incrementing 1
+ }
+}
+
+packet-generator new {
+ name v6-2-to-1
+ limit -1
+ node ip6-input
+ size 64-64
+ interface pg0
+ data {
+ UDP: 192:168:2::2 -> 192:168:1::2
+ UDP: 1234 -> 4321
+ length 128 checksum 0 incrementing 1
+ }
+}
+
+packet-generator enable