]>
Commit | Line | Data |
---|---|---|
9c4044a5 JS |
1 | AT_BANNER([dpif-netdev]) |
2 | ||
2be3fe44 BP |
3 | m4_divert_push([PREPARE_TESTS]) |
4 | [ | |
9c4044a5 JS |
5 | # Strips out uninteresting parts of flow output, as well as parts |
6 | # that vary from one run to another (e.g., timing and bond actions). | |
4b27db64 JR |
7 | strip_timers () { |
8 | sed ' | |
9 | s/duration:[0-9]*\.[0-9]*/duration:0.0/ | |
10 | s/used:[0-9]*\.[0-9]*/used:0.0/ | |
11 | ' | |
12 | } | |
13 | ||
2be3fe44 BP |
14 | strip_xout () { |
15 | sed ' | |
9ac365a8 | 16 | s/mega_ufid:[-0-9a-f]* // |
10e92b4f | 17 | s/ufid:[-0-9a-f]* // |
9c4044a5 JS |
18 | s/used:[0-9]*\.[0-9]*/used:0.0/ |
19 | s/actions:.*/actions: <del>/ | |
20 | s/packets:[0-9]*/packets:0/ | |
21 | s/bytes:[0-9]*/bytes:0/ | |
2be3fe44 BP |
22 | ' | sort |
23 | } | |
24 | ||
3fd12197 JR |
25 | strip_xout_keep_actions () { |
26 | sed ' | |
9ac365a8 | 27 | s/mega_ufid:[-0-9a-f]* // |
3fd12197 JR |
28 | s/ufid:[-0-9a-f]* // |
29 | s/used:[0-9]*\.[0-9]*/used:0.0/ | |
30 | s/packets:[0-9]*/packets:0/ | |
31 | s/bytes:[0-9]*/bytes:0/ | |
32 | ' | sort | |
33 | } | |
34 | ||
2be3fe44 BP |
35 | filter_flow_install () { |
36 | grep 'flow_add' | sed 's/.*flow_add: //' | sort | uniq | |
37 | } | |
38 | ||
e8a7d666 IM |
39 | filter_hw_flow_install () { |
40 | grep 'netdev_dummy.*flow put\[create\]' | sed 's/.*|DBG|//' | sort | uniq | |
41 | } | |
42 | ||
43 | filter_hw_flow_del () { | |
44 | grep 'netdev_dummy.*flow del' | sed 's/.*|DBG|//' | sort | uniq | |
45 | } | |
46 | ||
47 | filter_hw_packet_netdev_dummy () { | |
48 | grep 'netdev_dummy.*: packet:.*with mark' | sed 's/.*|DBG|//' | sort | uniq | |
49 | } | |
50 | ||
2be3fe44 BP |
51 | filter_flow_dump () { |
52 | grep 'flow_dump ' | sed ' | |
5a0e4aec BP |
53 | s/.*flow_dump // |
54 | s/used:[0-9]*\.[0-9]*/used:0.0/ | |
2be3fe44 BP |
55 | ' | sort | uniq |
56 | } | |
57 | ||
58 | strip_metadata () { | |
59 | sed 's/metadata=0x[0-9a-f]*/metadata=0x0/' | |
60 | } | |
61 | ] | |
62 | m4_divert_pop([PREPARE_TESTS]) | |
9c4044a5 | 63 | |
fa10e59a IM |
64 | AT_SETUP([dpif-netdev - netdev-dummy/receive]) |
65 | # Create br0 with interfaces p0 | |
66 | OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1 -- ]) | |
67 | AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg]) | |
68 | ||
69 | AT_CHECK([ovs-ofctl add-flow br0 action=normal]) | |
70 | ovs-appctl time/stop | |
71 | ovs-appctl time/warp 5000 | |
72 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:02:00),eth_type(0x0800),ipv4(src=10.0.0.1,dst=10.0.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(ack)']) | |
275f78f9 | 73 | OVS_WAIT_UNTIL([grep "miss upcall" ovs-vswitchd.log]) |
fa10e59a IM |
74 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl |
75 | skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:01,dst=50:54:00:00:02:00),eth_type(0x0800),ipv4(src=10.0.0.1,dst=10.0.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(ack) | |
76 | ]) | |
77 | ||
78 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:06:00),eth_type(0x0800),ipv4(src=10.0.0.5,dst=10.0.0.6,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(ack)' --len 1024]) | |
275f78f9 | 79 | OVS_WAIT_UNTIL([test `grep -c "miss upcall" ovs-vswitchd.log` -ge 2]) |
fa10e59a IM |
80 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl |
81 | skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:05,dst=50:54:00:00:06:00),eth_type(0x0800),ipv4(src=10.0.0.5,dst=10.0.0.6,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(ack) | |
82 | ]) | |
83 | OVS_VSWITCHD_STOP | |
84 | AT_CLEANUP | |
85 | ||
86 | ||
71c1cd42 IM |
87 | m4_define([DPIF_NETDEV_DUMMY_IFACE], |
88 | [AT_SETUP([dpif-netdev - $1 interface]) | |
89 | # Create br0 with interfaces p1 and p7 | |
90 | # and br1 with interfaces p2 and p8 | |
91 | # with p1 and p2 connected via unix domain socket | |
92 | OVS_VSWITCHD_START( | |
93 | [add-port br0 p1 -- set interface p1 type=$1 options:pstream=punix:$OVS_RUNDIR/p0.sock ofport_request=1 -- \ | |
94 | add-port br0 p7 -- set interface p7 ofport_request=7 type=$1 -- \ | |
95 | add-br br1 -- \ | |
96 | set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \ | |
97 | set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \ | |
98 | fail-mode=secure -- \ | |
99 | add-port br1 p2 -- set interface p2 type=$1 options:stream=unix:$OVS_RUNDIR/p0.sock ofport_request=2 -- \ | |
100 | add-port br1 p8 -- set interface p8 ofport_request=8 type=$1 --], [], [], | |
101 | [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])]) | |
102 | AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg]) | |
103 | ||
104 | AT_CHECK([ovs-ofctl add-flow br0 action=normal]) | |
105 | AT_CHECK([ovs-ofctl add-flow br1 action=normal]) | |
106 | ovs-appctl time/stop | |
107 | ovs-appctl time/warp 5000 | |
3d4b2e6e JS |
108 | AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)']) |
109 | AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)']) | |
71c1cd42 IM |
110 | ovs-appctl time/warp 100 |
111 | sleep 1 # wait for forwarders process packets | |
112 | ||
113 | AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl | |
3d4b2e6e JS |
114 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del> |
115 | recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del> | |
116 | recirc_id(0),in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del> | |
117 | recirc_id(0),in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del> | |
9c4044a5 JS |
118 | ]) |
119 | ||
71c1cd42 IM |
120 | OVS_VSWITCHD_STOP |
121 | AT_CLEANUP]) | |
b10d46a6 | 122 | |
71c1cd42 IM |
123 | DPIF_NETDEV_DUMMY_IFACE([dummy]) |
124 | DPIF_NETDEV_DUMMY_IFACE([dummy-pmd]) | |
b10d46a6 | 125 | |
71c1cd42 IM |
126 | m4_define([DPIF_NETDEV_MISS_FLOW_INSTALL], |
127 | [AT_SETUP([dpif-netdev - miss upcall key matches flow_install - $1]) | |
128 | OVS_VSWITCHD_START( | |
14fea1f3 IM |
129 | [add-port br0 p1 \ |
130 | -- set interface p1 type=$1 options:pstream=punix:$OVS_RUNDIR/p0.sock \ | |
131 | -- set bridge br0 datapath-type=dummy \ | |
132 | other-config:datapath-id=1234 fail-mode=secure], [], [], | |
71c1cd42 IM |
133 | [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])]) |
134 | AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg]) | |
b10d46a6 | 135 | |
71c1cd42 | 136 | AT_CHECK([ovs-ofctl add-flow br0 action=normal]) |
3d4b2e6e JS |
137 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)']) |
138 | ovs-appctl ofproto/trace 'in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' | |
71c1cd42 | 139 | |
275f78f9 | 140 | OVS_WAIT_UNTIL([grep "miss upcall" ovs-vswitchd.log]) |
71c1cd42 | 141 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl |
3d4b2e6e | 142 | skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0) |
b10d46a6 | 143 | ]) |
71c1cd42 | 144 | AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl |
3d4b2e6e | 145 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del> |
b10d46a6 JS |
146 | ]) |
147 | ||
71c1cd42 IM |
148 | # Now, the same again without megaflows. |
149 | AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled | |
b10d46a6 | 150 | ]) |
3d4b2e6e | 151 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)']) |
b10d46a6 | 152 | |
275f78f9 | 153 | OVS_WAIT_UNTIL([test `grep -c "miss upcall" ovs-vswitchd.log` -ge 2]) |
71c1cd42 | 154 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl |
3d4b2e6e | 155 | skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0) |
b10d46a6 | 156 | ]) |
71c1cd42 | 157 | AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl |
3d4b2e6e JS |
158 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del> |
159 | skb_priority(0),skb_mark(0),ct_state(-new-est-rel-rpl-inv-trk-snat-dnat),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), actions: <del> | |
b10d46a6 JS |
160 | ]) |
161 | ||
71c1cd42 IM |
162 | OVS_VSWITCHD_STOP |
163 | AT_CLEANUP]) | |
164 | ||
165 | DPIF_NETDEV_MISS_FLOW_INSTALL([dummy]) | |
166 | DPIF_NETDEV_MISS_FLOW_INSTALL([dummy-pmd]) | |
b10d46a6 | 167 | |
6f9e77fd IM |
168 | m4_define([DPIF_NETDEV_FLOW_PUT_MODIFY], |
169 | [AT_SETUP([dpif-netdev - datapath flow modification - $1]) | |
170 | OVS_VSWITCHD_START( | |
171 | [add-port br0 p1 -- set interface p1 type=$1 ofport_request=1 options:pstream=punix:$OVS_RUNDIR/p1.sock -- \ | |
172 | add-port br0 p2 -- set interface p2 type=$1 ofport_request=2 options:pstream=punix:$OVS_RUNDIR/p2.sock -- \ | |
173 | set bridge br0 datapath-type=dummy \ | |
174 | other-config:datapath-id=1234 fail-mode=secure], [], [], | |
175 | [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])]) | |
176 | AT_CHECK([ovs-appctl vlog/set dpif:file:dbg dpif_netdev:file:dbg]) | |
177 | ||
178 | # Add a flow that directs some packets received on p1 to p2 and the | |
179 | # rest back out p1. | |
180 | AT_CHECK([ovs-ofctl del-flows br0]) | |
181 | AT_CHECK([ovs-ofctl add-flow br0 priority=1,ip,in_port=1,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,actions=output:2]) | |
182 | AT_CHECK([ovs-ofctl add-flow br0 priority=0,in_port=1,actions=IN_PORT]) | |
183 | ||
184 | # Inject a packet of the form that should go to p2. | |
185 | packet="in_port(1),packet_type(ns=0,id=0),eth(src=00:06:07:08:09:0a,dst=00:01:02:03:04:05),eth_type(0x8100),vlan(vid=1000,pcp=5),encap(eth_type(0x0800),ipv4(src=127.0.0.1,dst=127.0.0.1,proto=0,tos=0,ttl=64,frag=no))" | |
186 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0]) | |
187 | ||
188 | OVS_WAIT_UNTIL([grep "miss upcall" ovs-vswitchd.log]) | |
189 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl | |
190 | skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=00:06:07:08:09:0a,dst=00:01:02:03:04:05),eth_type(0x8100),vlan(vid=1000,pcp=5),encap(eth_type(0x0800),ipv4(src=127.0.0.1,dst=127.0.0.1,proto=0,tos=0,ttl=64,frag=no)) | |
191 | ]) | |
192 | ovs-appctl revalidator/wait | |
193 | # Dump the datapath flow to see that it goes to p2 ("actions:2"). | |
194 | AT_CHECK([ovs-appctl dpif/dump-flows br0], [0], [dnl | |
195 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=00:06:07:08:09:0a,dst=00:01:02:03:04:05),eth_type(0x8100),vlan(vid=1000,pcp=5),encap(eth_type(0x0800),ipv4(frag=no)), packets:0, bytes:0, used:never, actions:2 | |
196 | ]) | |
197 | ||
198 | # Delete the flows, then add new flows that would not match the same | |
199 | # packet as before. | |
200 | AT_CHECK([ovs-ofctl del-flows br0]) | |
201 | AT_CHECK([ovs-ofctl add-flow br0 priority=1,in_port=1,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,dl_type=0x0801,actions=output:2]) | |
202 | AT_CHECK([ovs-ofctl add-flow br0 priority=0,in_port=1,actions=IN_PORT]) | |
203 | ||
204 | # Wait for flow revalidation | |
205 | ovs-appctl revalidator/wait | |
206 | ||
207 | # Inject the same packet again. | |
208 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64]) | |
209 | ||
210 | ovs-appctl revalidator/wait | |
211 | # Dump the datapath flow to see that it goes to p1 ("actions:IN_PORT"). | |
212 | AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_timers], [0], [dnl | |
213 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=00:06:07:08:09:0a,dst=00:01:02:03:04:05),eth_type(0x8100),vlan(vid=1000,pcp=5),encap(eth_type(0x0800),ipv4(frag=no)), packets:1, bytes:64, used:0.0s, actions:1 | |
214 | ]) | |
215 | OVS_VSWITCHD_STOP | |
216 | AT_CLEANUP]) | |
217 | ||
218 | DPIF_NETDEV_FLOW_PUT_MODIFY([dummy]) | |
219 | DPIF_NETDEV_FLOW_PUT_MODIFY([dummy-pmd]) | |
220 | ||
221 | ||
71c1cd42 IM |
222 | m4_define([DPIF_NETDEV_MISS_FLOW_DUMP], |
223 | [AT_SETUP([dpif-netdev - miss upcall key matches flow_dump - $1]) | |
224 | OVS_VSWITCHD_START( | |
14fea1f3 IM |
225 | [add-port br0 p1 \ |
226 | -- set interface p1 type=$1 options:pstream=punix:$OVS_RUNDIR/p0.sock \ | |
227 | -- set bridge br0 datapath-type=dummy \ | |
228 | other-config:datapath-id=1234 fail-mode=secure], [], [], | |
71c1cd42 IM |
229 | [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])]) |
230 | AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled | |
64bb477f | 231 | ], []) |
71c1cd42 | 232 | AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg]) |
b10d46a6 | 233 | |
71c1cd42 | 234 | AT_CHECK([ovs-ofctl add-flow br0 action=normal]) |
3d4b2e6e | 235 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)']) |
b10d46a6 | 236 | |
275f78f9 | 237 | OVS_WAIT_UNTIL([grep "miss upcall" ovs-vswitchd.log]) |
71c1cd42 | 238 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl |
3d4b2e6e | 239 | skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0) |
b10d46a6 | 240 | ]) |
275f78f9 | 241 | ovs-appctl revalidator/wait |
71c1cd42 | 242 | AT_CHECK([filter_flow_dump < ovs-vswitchd.log | strip_xout], [0], [dnl |
3d4b2e6e | 243 | skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions: <del> |
b10d46a6 JS |
244 | ]) |
245 | ||
71c1cd42 IM |
246 | # Now, the same again without megaflows. |
247 | AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled | |
b10d46a6 | 248 | ]) |
71c1cd42 | 249 | AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled |
64bb477f | 250 | ], []) |
3d4b2e6e | 251 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)']) |
b10d46a6 | 252 | |
275f78f9 | 253 | OVS_WAIT_UNTIL([test `grep -c "miss upcall" ovs-vswitchd.log` -ge 2]) |
71c1cd42 | 254 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl |
3d4b2e6e | 255 | skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0) |
b10d46a6 | 256 | ]) |
275f78f9 | 257 | ovs-appctl revalidator/wait |
71c1cd42 | 258 | AT_CHECK([filter_flow_dump < ovs-vswitchd.log | strip_xout], [0], [dnl |
3d4b2e6e JS |
259 | skb_priority(0),skb_mark(0),ct_state(0/0xff),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:0, bytes:0, used:never, actions: <del> |
260 | skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions: <del> | |
b10d46a6 JS |
261 | ]) |
262 | ||
71c1cd42 IM |
263 | OVS_VSWITCHD_STOP |
264 | AT_CLEANUP]) | |
265 | ||
266 | DPIF_NETDEV_MISS_FLOW_DUMP([dummy]) | |
267 | DPIF_NETDEV_MISS_FLOW_DUMP([dummy-pmd]) | |
4b27db64 JR |
268 | |
269 | AT_SETUP([dpif-netdev - meters]) | |
270 | # Create br0 with interfaces p1 and p7 | |
271 | # and br1 with interfaces p2 and p8 | |
272 | # with p1 and p2 connected via unix domain socket | |
273 | OVS_VSWITCHD_START( | |
274 | [add-port br0 p1 -- set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p0.sock ofport_request=1 -- \ | |
275 | add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \ | |
276 | add-br br1 -- \ | |
277 | set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \ | |
278 | set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \ | |
279 | fail-mode=secure -- \ | |
280 | add-port br1 p2 -- set interface p2 type=dummy options:stream=unix:$OVS_RUNDIR/p0.sock ofport_request=2 -- \ | |
281 | add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --]) | |
282 | AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg]) | |
283 | ||
284 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=1 pktps burst stats bands=type=drop rate=1 burst_size=1']) | |
285 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=2 kbps burst stats bands=type=drop rate=1 burst_size=2']) | |
286 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=1 action=meter:1,7']) | |
287 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=7 action=meter:2,1']) | |
288 | AT_CHECK([ovs-ofctl add-flow br1 'in_port=2 action=8']) | |
289 | AT_CHECK([ovs-ofctl add-flow br1 'in_port=8 action=2']) | |
290 | ovs-appctl time/stop | |
291 | ||
292 | AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl | |
293 | OFPST_METER_CONFIG reply (OF1.3) (xid=0x2): | |
294 | meter=1 pktps burst stats bands= | |
295 | type=drop rate=1 burst_size=1 | |
296 | ||
297 | meter=2 kbps burst stats bands= | |
298 | type=drop rate=1 burst_size=2 | |
299 | ]) | |
300 | ||
301 | ovs-appctl time/warp 5000 | |
3d4b2e6e JS |
302 | AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) |
303 | AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
304 | AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
305 | AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
306 | AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
307 | AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
308 | AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
309 | AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
310 | AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
311 | AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
4b27db64 JR |
312 | sleep 1 # wait for forwarders process packets |
313 | ||
314 | # Meter 1 is measuring packets, allowing one packet per second with | |
315 | # bursts of one packet, so 4 out of 5 packets should hit the drop | |
316 | # band. | |
317 | # Meter 2 is measuring kbps, with burst size 2 (== 2000 bits). 4 packets | |
318 | # (240 bytes == 1920 bits) pass, but the last packet should hit the drop band. | |
319 | AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl | |
320 | OFPST_METER reply (OF1.3) (xid=0x2): | |
321 | meter:1 flow_count:1 packet_in_count:5 byte_in_count:300 duration:0.0s bands: | |
322 | 0: packet_count:4 byte_count:240 | |
323 | ||
324 | meter:2 flow_count:1 packet_in_count:5 byte_in_count:300 duration:0.0s bands: | |
325 | 0: packet_count:1 byte_count:60 | |
326 | ]) | |
327 | ||
328 | # Advance time by 1/2 second | |
329 | ovs-appctl time/warp 500 | |
330 | ||
3d4b2e6e JS |
331 | AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) |
332 | AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
333 | AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
334 | AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
335 | AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
336 | AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
337 | AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
338 | AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
339 | AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
340 | AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60]) | |
4b27db64 JR |
341 | sleep 1 # wait for forwarders process packets |
342 | ||
343 | # Meter 1 is measuring packets, allowing one packet per second with | |
344 | # bursts of one packet, so all 5 of the new packets should hit the drop | |
345 | # band. | |
346 | # Meter 2 is measuring kbps, with burst size 2 (== 2000 bits). After 500ms | |
347 | # there should be space for 80 + 500 bits, so one new 60 byte (480 bit) packet | |
348 | # should pass, remaining 4 should hit the drop band. | |
349 | AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl | |
350 | OFPST_METER reply (OF1.3) (xid=0x2): | |
351 | meter:1 flow_count:1 packet_in_count:10 byte_in_count:600 duration:0.0s bands: | |
352 | 0: packet_count:9 byte_count:540 | |
353 | ||
354 | meter:2 flow_count:1 packet_in_count:10 byte_in_count:600 duration:0.0s bands: | |
355 | 0: packet_count:5 byte_count:300 | |
356 | ]) | |
357 | ||
a13a0209 AT |
358 | ovs-appctl time/warp 5000 |
359 | ||
360 | AT_CHECK([ | |
361 | ovs-appctl coverage/read-counter datapath_drop_meter | |
362 | ], [0], [dnl | |
363 | 14 | |
364 | ]) | |
365 | ||
4b27db64 | 366 | AT_CHECK([cat ovs-vswitchd.log | filter_flow_install | strip_xout_keep_actions], [0], [dnl |
3d4b2e6e JS |
367 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:meter(0),7 |
368 | recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:8 | |
369 | recirc_id(0),in_port(7),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:meter(1),1 | |
370 | recirc_id(0),in_port(8),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:2 | |
4b27db64 JR |
371 | ]) |
372 | ||
373 | OVS_VSWITCHD_STOP | |
374 | AT_CLEANUP | |
e8a7d666 IM |
375 | |
376 | m4_define([DPIF_NETDEV_FLOW_HW_OFFLOAD], | |
377 | [AT_SETUP([dpif-netdev - partial hw offload - $1]) | |
e8a7d666 | 378 | OVS_VSWITCHD_START( |
5fc5c50f | 379 | [add-port br0 p1 -- \ |
f7995da0 | 380 | set interface p1 type=$1 ofport_request=1 options:pstream=punix:$OVS_RUNDIR/p1.sock options:ifindex=1100 -- \ |
e8a7d666 IM |
381 | set bridge br0 datapath-type=dummy \ |
382 | other-config:datapath-id=1234 fail-mode=secure], [], [], | |
383 | [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])]) | |
384 | AT_CHECK([ovs-appctl vlog/set dpif:file:dbg dpif_netdev:file:dbg netdev_dummy:file:dbg]) | |
385 | ||
386 | AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:hw-offload=true]) | |
387 | OVS_WAIT_UNTIL([grep "netdev: Flow API Enabled" ovs-vswitchd.log]) | |
388 | ||
389 | AT_CHECK([ovs-ofctl del-flows br0]) | |
390 | AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=IN_PORT]) | |
391 | ||
392 | packet="packet_type(ns=0,id=0),eth(src=00:06:07:08:09:0a,dst=00:01:02:03:04:05),eth_type(0x0800),ipv4(src=127.0.0.1,dst=127.0.0.1,proto=0,tos=0,ttl=64,frag=no)" | |
393 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0]) | |
394 | ||
395 | OVS_WAIT_UNTIL([grep "miss upcall" ovs-vswitchd.log]) | |
396 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl | |
397 | skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=00:06:07:08:09:0a,dst=00:01:02:03:04:05),eth_type(0x0800),ipv4(src=127.0.0.1,dst=127.0.0.1,proto=0,tos=0,ttl=64,frag=no) | |
398 | ]) | |
399 | # Check that flow successfully offloaded. | |
400 | OVS_WAIT_UNTIL([grep "succeed to add netdev flow" ovs-vswitchd.log]) | |
401 | AT_CHECK([filter_hw_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl | |
77057965 | 402 | p1: flow put[[create]]: flow match: recirc_id=0,eth,ip,in_port=1,vlan_tci=0x0000,nw_frag=no, mark: 1 |
e8a7d666 IM |
403 | ]) |
404 | # Check that datapath flow installed successfully. | |
405 | AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl | |
406 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del> | |
407 | ]) | |
408 | # Inject the same packet again. | |
409 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0]) | |
410 | ||
411 | # Check for succesfull packet matching with installed offloaded flow. | |
412 | AT_CHECK([filter_hw_packet_netdev_dummy < ovs-vswitchd.log | strip_xout], [0], [dnl | |
77057965 | 413 | p1: packet: ip,vlan_tci=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,nw_src=127.0.0.1,nw_dst=127.0.0.1,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=64 matches with flow: recirc_id=0,eth,ip,vlan_tci=0x0000,nw_frag=no with mark: 1 |
e8a7d666 IM |
414 | ]) |
415 | ||
416 | ovs-appctl revalidator/wait | |
417 | # Dump the datapath flow to see that actions was executed for a packet. | |
418 | AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_timers], [0], [dnl | |
419 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:64, used:0.0s, actions:1 | |
420 | ]) | |
421 | ||
422 | # Wait for datapath flow expiration. | |
423 | ovs-appctl time/stop | |
424 | ovs-appctl time/warp 15000 | |
425 | ovs-appctl revalidator/wait | |
426 | ||
427 | # Check that flow successfully deleted from HW. | |
428 | OVS_WAIT_UNTIL([grep "succeed to delete netdev flow" ovs-vswitchd.log]) | |
429 | AT_CHECK([filter_hw_flow_del < ovs-vswitchd.log | strip_xout], [0], [dnl | |
77057965 | 430 | p1: flow del: mark: 1 |
e8a7d666 IM |
431 | ]) |
432 | OVS_VSWITCHD_STOP | |
433 | AT_CLEANUP]) | |
434 | ||
435 | DPIF_NETDEV_FLOW_HW_OFFLOAD([dummy]) | |
436 | DPIF_NETDEV_FLOW_HW_OFFLOAD([dummy-pmd]) | |
54e2baec IM |
437 | |
438 | ||
439 | m4_define([DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS], | |
440 | [AT_SETUP([dpif-netdev - partial hw offload with packet modifications - $1]) | |
441 | OVS_VSWITCHD_START( | |
442 | [add-port br0 p1 -- \ | |
f7995da0 | 443 | set interface p1 type=$1 ofport_request=1 options:pcap=p1.pcap options:ifindex=1101 -- \ |
54e2baec IM |
444 | set bridge br0 datapath-type=dummy \ |
445 | other-config:datapath-id=1234 fail-mode=secure], [], [], | |
446 | [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])]) | |
447 | AT_CHECK([ovs-appctl vlog/set dpif:file:dbg dpif_netdev:file:dbg netdev_dummy:file:dbg]) | |
448 | ||
449 | AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:hw-offload=true]) | |
450 | OVS_WAIT_UNTIL([grep "netdev: Flow API Enabled" ovs-vswitchd.log]) | |
451 | ||
452 | AT_CHECK([ovs-ofctl del-flows br0]) | |
453 | ||
454 | # Setting flow to modify ipv4 src address and udp dst port to be sure that | |
455 | # offloaded packets has correctly initialized l3/l4 offsets. | |
456 | AT_CHECK([ovs-ofctl add-flow br0 in_port=1,udp,actions=mod_nw_src:192.168.0.7,mod_tp_dst:3773,output:IN_PORT]) | |
457 | ||
458 | packet="packet_type(ns=0,id=0),eth(src=00:06:07:08:09:0a,dst=00:01:02:03:04:05),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0800),ipv4(src=127.0.0.1,dst=127.0.0.1,proto=17,ttl=64,frag=no),udp(src=81,dst=82))" | |
459 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0]) | |
460 | ||
461 | OVS_WAIT_UNTIL([grep "miss upcall" ovs-vswitchd.log]) | |
462 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl | |
463 | skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),dnl | |
464 | packet_type(ns=0,id=0),eth(src=00:06:07:08:09:0a,dst=00:01:02:03:04:05),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0800),ipv4(src=127.0.0.1,dst=127.0.0.1,proto=17,tos=0,ttl=64,frag=no),udp(src=81,dst=82)) | |
465 | ]) | |
466 | # Check that flow successfully offloaded. | |
467 | OVS_WAIT_UNTIL([grep "succeed to add netdev flow" ovs-vswitchd.log]) | |
468 | AT_CHECK([filter_hw_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl | |
77057965 | 469 | p1: flow put[[create]]: flow match: recirc_id=0,eth,udp,in_port=1,dl_vlan=99,dl_vlan_pcp=7,nw_src=127.0.0.1,nw_frag=no,tp_dst=82, mark: 1 |
54e2baec IM |
470 | ]) |
471 | # Check that datapath flow installed successfully. | |
472 | AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl | |
473 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0800),ipv4(src=127.0.0.1,proto=17,frag=no),udp(dst=82)), actions: <del> | |
474 | ]) | |
475 | # Inject the same packet again. | |
476 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0]) | |
477 | ||
478 | # Check for succesfull packet matching with installed offloaded flow. | |
479 | AT_CHECK([filter_hw_packet_netdev_dummy < ovs-vswitchd.log | strip_xout], [0], [dnl | |
480 | p1: packet: udp,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,nw_src=127.0.0.1,nw_dst=127.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=81,tp_dst=82 dnl | |
77057965 | 481 | matches with flow: recirc_id=0,eth,udp,dl_vlan=99,dl_vlan_pcp=7,nw_src=127.0.0.1,nw_frag=no,tp_dst=82 with mark: 1 |
54e2baec IM |
482 | ]) |
483 | ||
484 | ovs-appctl revalidator/wait | |
485 | # Dump the datapath flow to see that actions was executed for a packet. | |
486 | AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_timers], [0], [dnl | |
487 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0800),ipv4(src=127.0.0.1,proto=17,frag=no),udp(dst=82)), dnl | |
488 | packets:1, bytes:64, used:0.0s, actions:set(ipv4(src=192.168.0.7)),set(udp(dst=3773)),1 | |
489 | ]) | |
490 | ||
491 | # Wait for datapath flow expiration. | |
492 | ovs-appctl time/stop | |
493 | ovs-appctl time/warp 15000 | |
494 | ovs-appctl revalidator/wait | |
495 | ||
496 | # Check that flow successfully deleted from HW. | |
497 | OVS_WAIT_UNTIL([grep "succeed to delete netdev flow" ovs-vswitchd.log]) | |
498 | AT_CHECK([filter_hw_flow_del < ovs-vswitchd.log | strip_xout], [0], [dnl | |
77057965 | 499 | p1: flow del: mark: 1 |
54e2baec IM |
500 | ]) |
501 | ||
502 | # Check that ip address and udp port were correctly modified in output packets. | |
503 | AT_CHECK([ovs-ofctl parse-pcap p1.pcap], [0], [dnl | |
504 | udp,in_port=ANY,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,nw_src=127.0.0.1,nw_dst=127.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=81,tp_dst=82 | |
505 | udp,in_port=ANY,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,nw_src=192.168.0.7,nw_dst=127.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=81,tp_dst=3773 | |
506 | udp,in_port=ANY,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,nw_src=127.0.0.1,nw_dst=127.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=81,tp_dst=82 | |
507 | udp,in_port=ANY,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,nw_src=192.168.0.7,nw_dst=127.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=81,tp_dst=3773 | |
508 | ]) | |
509 | ||
510 | OVS_VSWITCHD_STOP | |
511 | AT_CLEANUP]) | |
512 | ||
513 | DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS([dummy]) | |
514 | DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS([dummy-pmd]) | |
1baa102a EB |
515 | |
516 | m4_define([DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS_VID_ARP], | |
517 | [AT_SETUP([dpif-netdev - partial hw offload with arp vlan id packet modifications - $1]) | |
518 | OVS_VSWITCHD_START( | |
519 | [add-port br0 p1 -- \ | |
520 | set interface p1 type=$1 ofport_request=1 options:pcap=p1.pcap options:ifindex=1102 -- \ | |
521 | set bridge br0 datapath-type=dummy \ | |
522 | other-config:datapath-id=1234 fail-mode=secure], [], [], | |
523 | [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])]) | |
524 | AT_CHECK([ovs-appctl vlog/set dpif:file:dbg dpif_netdev:file:dbg netdev_dummy:file:dbg]) | |
525 | ||
526 | AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:hw-offload=true]) | |
527 | OVS_WAIT_UNTIL([grep "netdev: Flow API Enabled" ovs-vswitchd.log]) | |
528 | ||
529 | AT_CHECK([ovs-ofctl del-flows br0]) | |
530 | ||
531 | # Setting flow to modify vlan id with arp packet to be sure that | |
532 | # offloaded packets has correctly initialized l3 offset. | |
533 | AT_CHECK([ovs-ofctl add-flow br0 in_port=1,arp,dl_vlan=99,actions=mod_vlan_vid=11,output:IN_PORT]) | |
534 | ||
535 | packet="packet_type(ns=0,id=0),eth(src=00:06:07:08:09:0a,dst=00:01:02:03:04:05),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0806),arp(sip=127.0.0.1,tip=127.0.0.1,op=1,sha=00:0b:0c:0d:0e:0f,tha=00:00:00:00:00:00))" | |
536 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0]) | |
537 | ||
538 | OVS_WAIT_UNTIL([grep "miss upcall" ovs-vswitchd.log]) | |
539 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl | |
540 | skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),dnl | |
541 | packet_type(ns=0,id=0),eth(src=00:06:07:08:09:0a,dst=00:01:02:03:04:05),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0806),arp(sip=127.0.0.1,tip=127.0.0.1,op=1,sha=00:0b:0c:0d:0e:0f,tha=00:00:00:00:00:00)) | |
542 | ]) | |
543 | # Check that flow successfully offloaded. | |
544 | OVS_WAIT_UNTIL([grep "succeed to add netdev flow" ovs-vswitchd.log]) | |
545 | AT_CHECK([filter_hw_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl | |
77057965 | 546 | p1: flow put[[create]]: flow match: recirc_id=0,eth,arp,in_port=1,dl_vlan=99,dl_vlan_pcp=7, mark: 1 |
1baa102a EB |
547 | ]) |
548 | # Check that datapath flow installed successfully. | |
549 | AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl | |
550 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0806)), actions: <del> | |
551 | ]) | |
552 | # Inject the same packet again. | |
553 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0]) | |
554 | ||
555 | # Check for succesfull packet matching with installed offloaded flow. | |
556 | AT_CHECK([filter_hw_packet_netdev_dummy < ovs-vswitchd.log | strip_xout], [0], [dnl | |
557 | p1: packet: arp,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,arp_spa=127.0.0.1,arp_tpa=127.0.0.1,arp_op=1,arp_sha=00:0b:0c:0d:0e:0f,arp_tha=00:00:00:00:00:00 dnl | |
77057965 | 558 | matches with flow: recirc_id=0,eth,arp,dl_vlan=99,dl_vlan_pcp=7 with mark: 1 |
1baa102a EB |
559 | ]) |
560 | ||
561 | ovs-appctl revalidator/wait | |
562 | # Dump the datapath flow to see that actions was executed for a packet. | |
563 | AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_timers], [0], [dnl | |
564 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x0806)), dnl | |
565 | packets:1, bytes:64, used:0.0s, actions:pop_vlan,push_vlan(vid=11,pcp=7),1 | |
566 | ]) | |
567 | ||
568 | # Wait for datapath flow expiration. | |
569 | ovs-appctl time/stop | |
570 | ovs-appctl time/warp 15000 | |
571 | ovs-appctl revalidator/wait | |
572 | ||
573 | # Check that flow successfully deleted from HW. | |
574 | OVS_WAIT_UNTIL([grep "succeed to delete netdev flow" ovs-vswitchd.log]) | |
575 | AT_CHECK([filter_hw_flow_del < ovs-vswitchd.log | strip_xout], [0], [dnl | |
77057965 | 576 | p1: flow del: mark: 1 |
1baa102a EB |
577 | ]) |
578 | ||
579 | # Check that VLAN ID was correctly modified in output packets. | |
580 | AT_CHECK([ovs-ofctl parse-pcap p1.pcap], [0], [dnl | |
581 | arp,in_port=ANY,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,arp_spa=127.0.0.1,arp_tpa=127.0.0.1,arp_op=1,arp_sha=00:0b:0c:0d:0e:0f,arp_tha=00:00:00:00:00:00 | |
582 | arp,in_port=ANY,dl_vlan=11,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,arp_spa=127.0.0.1,arp_tpa=127.0.0.1,arp_op=1,arp_sha=00:0b:0c:0d:0e:0f,arp_tha=00:00:00:00:00:00 | |
583 | arp,in_port=ANY,dl_vlan=99,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,arp_spa=127.0.0.1,arp_tpa=127.0.0.1,arp_op=1,arp_sha=00:0b:0c:0d:0e:0f,arp_tha=00:00:00:00:00:00 | |
584 | arp,in_port=ANY,dl_vlan=11,dl_vlan_pcp=7,vlan_tci1=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,arp_spa=127.0.0.1,arp_tpa=127.0.0.1,arp_op=1,arp_sha=00:0b:0c:0d:0e:0f,arp_tha=00:00:00:00:00:00 | |
585 | ]) | |
586 | ||
587 | OVS_VSWITCHD_STOP | |
588 | AT_CLEANUP]) | |
589 | ||
590 | DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS_VID_ARP([dummy]) | |
591 | DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS_VID_ARP([dummy-pmd]) |