]>
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 ' | |
10e92b4f | 16 | s/ufid:[-0-9a-f]* // |
9c4044a5 JS |
17 | s/used:[0-9]*\.[0-9]*/used:0.0/ |
18 | s/actions:.*/actions: <del>/ | |
19 | s/packets:[0-9]*/packets:0/ | |
20 | s/bytes:[0-9]*/bytes:0/ | |
2be3fe44 BP |
21 | ' | sort |
22 | } | |
23 | ||
3fd12197 JR |
24 | strip_xout_keep_actions () { |
25 | sed ' | |
26 | s/ufid:[-0-9a-f]* // | |
27 | s/used:[0-9]*\.[0-9]*/used:0.0/ | |
28 | s/packets:[0-9]*/packets:0/ | |
29 | s/bytes:[0-9]*/bytes:0/ | |
30 | ' | sort | |
31 | } | |
32 | ||
2be3fe44 BP |
33 | filter_flow_install () { |
34 | grep 'flow_add' | sed 's/.*flow_add: //' | sort | uniq | |
35 | } | |
36 | ||
e8a7d666 IM |
37 | filter_hw_flow_install () { |
38 | grep 'netdev_dummy.*flow put\[create\]' | sed 's/.*|DBG|//' | sort | uniq | |
39 | } | |
40 | ||
41 | filter_hw_flow_del () { | |
42 | grep 'netdev_dummy.*flow del' | sed 's/.*|DBG|//' | sort | uniq | |
43 | } | |
44 | ||
45 | filter_hw_packet_netdev_dummy () { | |
46 | grep 'netdev_dummy.*: packet:.*with mark' | sed 's/.*|DBG|//' | sort | uniq | |
47 | } | |
48 | ||
2be3fe44 BP |
49 | filter_flow_dump () { |
50 | grep 'flow_dump ' | sed ' | |
5a0e4aec BP |
51 | s/.*flow_dump // |
52 | s/used:[0-9]*\.[0-9]*/used:0.0/ | |
2be3fe44 BP |
53 | ' | sort | uniq |
54 | } | |
55 | ||
56 | strip_metadata () { | |
57 | sed 's/metadata=0x[0-9a-f]*/metadata=0x0/' | |
58 | } | |
59 | ] | |
60 | m4_divert_pop([PREPARE_TESTS]) | |
9c4044a5 | 61 | |
fa10e59a IM |
62 | AT_SETUP([dpif-netdev - netdev-dummy/receive]) |
63 | # Create br0 with interfaces p0 | |
64 | OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1 -- ]) | |
65 | AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg]) | |
66 | ||
67 | AT_CHECK([ovs-ofctl add-flow br0 action=normal]) | |
68 | ovs-appctl time/stop | |
69 | ovs-appctl time/warp 5000 | |
70 | 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)']) | |
71 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl | |
72 | 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) | |
73 | ]) | |
74 | ||
75 | 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]) | |
76 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl | |
77 | 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) | |
78 | ]) | |
79 | OVS_VSWITCHD_STOP | |
80 | AT_CLEANUP | |
81 | ||
82 | ||
71c1cd42 IM |
83 | m4_define([DPIF_NETDEV_DUMMY_IFACE], |
84 | [AT_SETUP([dpif-netdev - $1 interface]) | |
85 | # Create br0 with interfaces p1 and p7 | |
86 | # and br1 with interfaces p2 and p8 | |
87 | # with p1 and p2 connected via unix domain socket | |
88 | OVS_VSWITCHD_START( | |
89 | [add-port br0 p1 -- set interface p1 type=$1 options:pstream=punix:$OVS_RUNDIR/p0.sock ofport_request=1 -- \ | |
90 | add-port br0 p7 -- set interface p7 ofport_request=7 type=$1 -- \ | |
91 | add-br br1 -- \ | |
92 | set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \ | |
93 | set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \ | |
94 | fail-mode=secure -- \ | |
95 | add-port br1 p2 -- set interface p2 type=$1 options:stream=unix:$OVS_RUNDIR/p0.sock ofport_request=2 -- \ | |
96 | add-port br1 p8 -- set interface p8 ofport_request=8 type=$1 --], [], [], | |
97 | [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])]) | |
98 | AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg]) | |
99 | ||
100 | AT_CHECK([ovs-ofctl add-flow br0 action=normal]) | |
101 | AT_CHECK([ovs-ofctl add-flow br1 action=normal]) | |
102 | ovs-appctl time/stop | |
103 | ovs-appctl time/warp 5000 | |
3d4b2e6e JS |
104 | 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)']) |
105 | 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 |
106 | ovs-appctl time/warp 100 |
107 | sleep 1 # wait for forwarders process packets | |
108 | ||
109 | AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl | |
3d4b2e6e JS |
110 | 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> |
111 | 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> | |
112 | 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> | |
113 | 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 |
114 | ]) |
115 | ||
71c1cd42 IM |
116 | OVS_VSWITCHD_STOP |
117 | AT_CLEANUP]) | |
b10d46a6 | 118 | |
71c1cd42 IM |
119 | DPIF_NETDEV_DUMMY_IFACE([dummy]) |
120 | DPIF_NETDEV_DUMMY_IFACE([dummy-pmd]) | |
b10d46a6 | 121 | |
71c1cd42 IM |
122 | m4_define([DPIF_NETDEV_MISS_FLOW_INSTALL], |
123 | [AT_SETUP([dpif-netdev - miss upcall key matches flow_install - $1]) | |
124 | OVS_VSWITCHD_START( | |
14fea1f3 IM |
125 | [add-port br0 p1 \ |
126 | -- set interface p1 type=$1 options:pstream=punix:$OVS_RUNDIR/p0.sock \ | |
127 | -- set bridge br0 datapath-type=dummy \ | |
128 | other-config:datapath-id=1234 fail-mode=secure], [], [], | |
71c1cd42 IM |
129 | [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])]) |
130 | AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg]) | |
b10d46a6 | 131 | |
71c1cd42 | 132 | AT_CHECK([ovs-ofctl add-flow br0 action=normal]) |
3d4b2e6e JS |
133 | 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)']) |
134 | 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 IM |
135 | sleep 1 |
136 | ||
137 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl | |
3d4b2e6e | 138 | 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 | 139 | ]) |
71c1cd42 | 140 | AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl |
3d4b2e6e | 141 | 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 |
142 | ]) |
143 | ||
71c1cd42 IM |
144 | # Now, the same again without megaflows. |
145 | AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled | |
b10d46a6 | 146 | ]) |
3d4b2e6e | 147 | 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)']) |
71c1cd42 | 148 | sleep 1 |
b10d46a6 | 149 | |
71c1cd42 | 150 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl |
3d4b2e6e | 151 | 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 | 152 | ]) |
71c1cd42 | 153 | AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl |
3d4b2e6e JS |
154 | 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> |
155 | 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 |
156 | ]) |
157 | ||
71c1cd42 IM |
158 | OVS_VSWITCHD_STOP |
159 | AT_CLEANUP]) | |
160 | ||
161 | DPIF_NETDEV_MISS_FLOW_INSTALL([dummy]) | |
162 | DPIF_NETDEV_MISS_FLOW_INSTALL([dummy-pmd]) | |
b10d46a6 | 163 | |
6f9e77fd IM |
164 | m4_define([DPIF_NETDEV_FLOW_PUT_MODIFY], |
165 | [AT_SETUP([dpif-netdev - datapath flow modification - $1]) | |
166 | OVS_VSWITCHD_START( | |
167 | [add-port br0 p1 -- set interface p1 type=$1 ofport_request=1 options:pstream=punix:$OVS_RUNDIR/p1.sock -- \ | |
168 | add-port br0 p2 -- set interface p2 type=$1 ofport_request=2 options:pstream=punix:$OVS_RUNDIR/p2.sock -- \ | |
169 | set bridge br0 datapath-type=dummy \ | |
170 | other-config:datapath-id=1234 fail-mode=secure], [], [], | |
171 | [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])]) | |
172 | AT_CHECK([ovs-appctl vlog/set dpif:file:dbg dpif_netdev:file:dbg]) | |
173 | ||
174 | # Add a flow that directs some packets received on p1 to p2 and the | |
175 | # rest back out p1. | |
176 | AT_CHECK([ovs-ofctl del-flows br0]) | |
177 | 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]) | |
178 | AT_CHECK([ovs-ofctl add-flow br0 priority=0,in_port=1,actions=IN_PORT]) | |
179 | ||
180 | # Inject a packet of the form that should go to p2. | |
181 | 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))" | |
182 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0]) | |
183 | ||
184 | OVS_WAIT_UNTIL([grep "miss upcall" ovs-vswitchd.log]) | |
185 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl | |
186 | 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)) | |
187 | ]) | |
188 | ovs-appctl revalidator/wait | |
189 | # Dump the datapath flow to see that it goes to p2 ("actions:2"). | |
190 | AT_CHECK([ovs-appctl dpif/dump-flows br0], [0], [dnl | |
191 | 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 | |
192 | ]) | |
193 | ||
194 | # Delete the flows, then add new flows that would not match the same | |
195 | # packet as before. | |
196 | AT_CHECK([ovs-ofctl del-flows br0]) | |
197 | 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]) | |
198 | AT_CHECK([ovs-ofctl add-flow br0 priority=0,in_port=1,actions=IN_PORT]) | |
199 | ||
200 | # Wait for flow revalidation | |
201 | ovs-appctl revalidator/wait | |
202 | ||
203 | # Inject the same packet again. | |
204 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64]) | |
205 | ||
206 | ovs-appctl revalidator/wait | |
207 | # Dump the datapath flow to see that it goes to p1 ("actions:IN_PORT"). | |
208 | AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_timers], [0], [dnl | |
209 | 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 | |
210 | ]) | |
211 | OVS_VSWITCHD_STOP | |
212 | AT_CLEANUP]) | |
213 | ||
214 | DPIF_NETDEV_FLOW_PUT_MODIFY([dummy]) | |
215 | DPIF_NETDEV_FLOW_PUT_MODIFY([dummy-pmd]) | |
216 | ||
217 | ||
71c1cd42 IM |
218 | m4_define([DPIF_NETDEV_MISS_FLOW_DUMP], |
219 | [AT_SETUP([dpif-netdev - miss upcall key matches flow_dump - $1]) | |
220 | OVS_VSWITCHD_START( | |
14fea1f3 IM |
221 | [add-port br0 p1 \ |
222 | -- set interface p1 type=$1 options:pstream=punix:$OVS_RUNDIR/p0.sock \ | |
223 | -- set bridge br0 datapath-type=dummy \ | |
224 | other-config:datapath-id=1234 fail-mode=secure], [], [], | |
71c1cd42 IM |
225 | [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])]) |
226 | AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled | |
64bb477f | 227 | ], []) |
71c1cd42 | 228 | AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg]) |
b10d46a6 | 229 | |
71c1cd42 | 230 | AT_CHECK([ovs-ofctl add-flow br0 action=normal]) |
3d4b2e6e | 231 | 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)']) |
71c1cd42 | 232 | sleep 1 |
b10d46a6 | 233 | |
71c1cd42 | 234 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl |
3d4b2e6e | 235 | 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 | 236 | ]) |
71c1cd42 | 237 | AT_CHECK([filter_flow_dump < ovs-vswitchd.log | strip_xout], [0], [dnl |
3d4b2e6e | 238 | 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 |
239 | ]) |
240 | ||
71c1cd42 IM |
241 | # Now, the same again without megaflows. |
242 | AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled | |
b10d46a6 | 243 | ]) |
71c1cd42 | 244 | AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled |
64bb477f | 245 | ], []) |
3d4b2e6e | 246 | 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)']) |
71c1cd42 | 247 | sleep 1 |
b10d46a6 | 248 | |
71c1cd42 | 249 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl |
3d4b2e6e | 250 | 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 | 251 | ]) |
71c1cd42 | 252 | AT_CHECK([filter_flow_dump < ovs-vswitchd.log | strip_xout], [0], [dnl |
3d4b2e6e JS |
253 | 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> |
254 | 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 |
255 | ]) |
256 | ||
71c1cd42 IM |
257 | OVS_VSWITCHD_STOP |
258 | AT_CLEANUP]) | |
259 | ||
260 | DPIF_NETDEV_MISS_FLOW_DUMP([dummy]) | |
261 | DPIF_NETDEV_MISS_FLOW_DUMP([dummy-pmd]) | |
4b27db64 JR |
262 | |
263 | AT_SETUP([dpif-netdev - meters]) | |
264 | # Create br0 with interfaces p1 and p7 | |
265 | # and br1 with interfaces p2 and p8 | |
266 | # with p1 and p2 connected via unix domain socket | |
267 | OVS_VSWITCHD_START( | |
268 | [add-port br0 p1 -- set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p0.sock ofport_request=1 -- \ | |
269 | add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \ | |
270 | add-br br1 -- \ | |
271 | set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \ | |
272 | set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \ | |
273 | fail-mode=secure -- \ | |
274 | add-port br1 p2 -- set interface p2 type=dummy options:stream=unix:$OVS_RUNDIR/p0.sock ofport_request=2 -- \ | |
275 | add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --]) | |
276 | AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg]) | |
277 | ||
278 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=1 pktps burst stats bands=type=drop rate=1 burst_size=1']) | |
279 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=2 kbps burst stats bands=type=drop rate=1 burst_size=2']) | |
280 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=1 action=meter:1,7']) | |
281 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=7 action=meter:2,1']) | |
282 | AT_CHECK([ovs-ofctl add-flow br1 'in_port=2 action=8']) | |
283 | AT_CHECK([ovs-ofctl add-flow br1 'in_port=8 action=2']) | |
284 | ovs-appctl time/stop | |
285 | ||
286 | AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl | |
287 | OFPST_METER_CONFIG reply (OF1.3) (xid=0x2): | |
288 | meter=1 pktps burst stats bands= | |
289 | type=drop rate=1 burst_size=1 | |
290 | ||
291 | meter=2 kbps burst stats bands= | |
292 | type=drop rate=1 burst_size=2 | |
293 | ]) | |
294 | ||
295 | ovs-appctl time/warp 5000 | |
3d4b2e6e JS |
296 | 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]) |
297 | 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]) | |
298 | 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]) | |
299 | 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]) | |
300 | 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]) | |
301 | 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]) | |
302 | 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]) | |
303 | 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]) | |
304 | 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]) | |
305 | 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 |
306 | sleep 1 # wait for forwarders process packets |
307 | ||
308 | # Meter 1 is measuring packets, allowing one packet per second with | |
309 | # bursts of one packet, so 4 out of 5 packets should hit the drop | |
310 | # band. | |
311 | # Meter 2 is measuring kbps, with burst size 2 (== 2000 bits). 4 packets | |
312 | # (240 bytes == 1920 bits) pass, but the last packet should hit the drop band. | |
313 | AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl | |
314 | OFPST_METER reply (OF1.3) (xid=0x2): | |
315 | meter:1 flow_count:1 packet_in_count:5 byte_in_count:300 duration:0.0s bands: | |
316 | 0: packet_count:4 byte_count:240 | |
317 | ||
318 | meter:2 flow_count:1 packet_in_count:5 byte_in_count:300 duration:0.0s bands: | |
319 | 0: packet_count:1 byte_count:60 | |
320 | ]) | |
321 | ||
322 | # Advance time by 1/2 second | |
323 | ovs-appctl time/warp 500 | |
324 | ||
3d4b2e6e JS |
325 | 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]) |
326 | 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]) | |
327 | 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]) | |
328 | 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]) | |
329 | 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]) | |
330 | 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]) | |
331 | 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]) | |
332 | 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]) | |
333 | 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]) | |
334 | 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 |
335 | sleep 1 # wait for forwarders process packets |
336 | ||
337 | # Meter 1 is measuring packets, allowing one packet per second with | |
338 | # bursts of one packet, so all 5 of the new packets should hit the drop | |
339 | # band. | |
340 | # Meter 2 is measuring kbps, with burst size 2 (== 2000 bits). After 500ms | |
341 | # there should be space for 80 + 500 bits, so one new 60 byte (480 bit) packet | |
342 | # should pass, remaining 4 should hit the drop band. | |
343 | AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl | |
344 | OFPST_METER reply (OF1.3) (xid=0x2): | |
345 | meter:1 flow_count:1 packet_in_count:10 byte_in_count:600 duration:0.0s bands: | |
346 | 0: packet_count:9 byte_count:540 | |
347 | ||
348 | meter:2 flow_count:1 packet_in_count:10 byte_in_count:600 duration:0.0s bands: | |
349 | 0: packet_count:5 byte_count:300 | |
350 | ]) | |
351 | ||
352 | AT_CHECK([cat ovs-vswitchd.log | filter_flow_install | strip_xout_keep_actions], [0], [dnl | |
3d4b2e6e JS |
353 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:meter(0),7 |
354 | recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:8 | |
355 | recirc_id(0),in_port(7),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:meter(1),1 | |
356 | recirc_id(0),in_port(8),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:2 | |
4b27db64 JR |
357 | ]) |
358 | ||
359 | OVS_VSWITCHD_STOP | |
360 | AT_CLEANUP | |
e8a7d666 IM |
361 | |
362 | m4_define([DPIF_NETDEV_FLOW_HW_OFFLOAD], | |
363 | [AT_SETUP([dpif-netdev - partial hw offload - $1]) | |
e8a7d666 | 364 | OVS_VSWITCHD_START( |
5fc5c50f IM |
365 | [add-port br0 p1 -- \ |
366 | set interface p1 type=$1 ofport_request=1 options:pstream=punix:$OVS_RUNDIR/p1.sock options:ifindex=1 -- \ | |
e8a7d666 IM |
367 | set bridge br0 datapath-type=dummy \ |
368 | other-config:datapath-id=1234 fail-mode=secure], [], [], | |
369 | [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])]) | |
370 | AT_CHECK([ovs-appctl vlog/set dpif:file:dbg dpif_netdev:file:dbg netdev_dummy:file:dbg]) | |
371 | ||
372 | AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:hw-offload=true]) | |
373 | OVS_WAIT_UNTIL([grep "netdev: Flow API Enabled" ovs-vswitchd.log]) | |
374 | ||
375 | AT_CHECK([ovs-ofctl del-flows br0]) | |
376 | AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=IN_PORT]) | |
377 | ||
378 | 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)" | |
379 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0]) | |
380 | ||
381 | OVS_WAIT_UNTIL([grep "miss upcall" ovs-vswitchd.log]) | |
382 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl | |
383 | 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) | |
384 | ]) | |
385 | # Check that flow successfully offloaded. | |
386 | OVS_WAIT_UNTIL([grep "succeed to add netdev flow" ovs-vswitchd.log]) | |
387 | AT_CHECK([filter_hw_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl | |
388 | p1: flow put[[create]]: flow match: recirc_id=0,eth,ip,in_port=1,vlan_tci=0x0000,nw_frag=no, mark: 0 | |
389 | ]) | |
390 | # Check that datapath flow installed successfully. | |
391 | AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl | |
392 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: <del> | |
393 | ]) | |
394 | # Inject the same packet again. | |
395 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0]) | |
396 | ||
397 | # Check for succesfull packet matching with installed offloaded flow. | |
398 | AT_CHECK([filter_hw_packet_netdev_dummy < ovs-vswitchd.log | strip_xout], [0], [dnl | |
399 | 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: 0 | |
400 | ]) | |
401 | ||
402 | ovs-appctl revalidator/wait | |
403 | # Dump the datapath flow to see that actions was executed for a packet. | |
404 | AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_timers], [0], [dnl | |
405 | 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 | |
406 | ]) | |
407 | ||
408 | # Wait for datapath flow expiration. | |
409 | ovs-appctl time/stop | |
410 | ovs-appctl time/warp 15000 | |
411 | ovs-appctl revalidator/wait | |
412 | ||
413 | # Check that flow successfully deleted from HW. | |
414 | OVS_WAIT_UNTIL([grep "succeed to delete netdev flow" ovs-vswitchd.log]) | |
415 | AT_CHECK([filter_hw_flow_del < ovs-vswitchd.log | strip_xout], [0], [dnl | |
416 | p1: flow del: mark: 0 | |
417 | ]) | |
418 | OVS_VSWITCHD_STOP | |
419 | AT_CLEANUP]) | |
420 | ||
421 | DPIF_NETDEV_FLOW_HW_OFFLOAD([dummy]) | |
422 | DPIF_NETDEV_FLOW_HW_OFFLOAD([dummy-pmd]) | |
54e2baec IM |
423 | |
424 | ||
425 | m4_define([DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS], | |
426 | [AT_SETUP([dpif-netdev - partial hw offload with packet modifications - $1]) | |
427 | OVS_VSWITCHD_START( | |
428 | [add-port br0 p1 -- \ | |
429 | set interface p1 type=$1 ofport_request=1 options:pcap=p1.pcap options:ifindex=1 -- \ | |
430 | set bridge br0 datapath-type=dummy \ | |
431 | other-config:datapath-id=1234 fail-mode=secure], [], [], | |
432 | [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])]) | |
433 | AT_CHECK([ovs-appctl vlog/set dpif:file:dbg dpif_netdev:file:dbg netdev_dummy:file:dbg]) | |
434 | ||
435 | AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:hw-offload=true]) | |
436 | OVS_WAIT_UNTIL([grep "netdev: Flow API Enabled" ovs-vswitchd.log]) | |
437 | ||
438 | AT_CHECK([ovs-ofctl del-flows br0]) | |
439 | ||
440 | # Setting flow to modify ipv4 src address and udp dst port to be sure that | |
441 | # offloaded packets has correctly initialized l3/l4 offsets. | |
442 | 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]) | |
443 | ||
444 | 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))" | |
445 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0]) | |
446 | ||
447 | OVS_WAIT_UNTIL([grep "miss upcall" ovs-vswitchd.log]) | |
448 | AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl | |
449 | 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 | |
450 | 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)) | |
451 | ]) | |
452 | # Check that flow successfully offloaded. | |
453 | OVS_WAIT_UNTIL([grep "succeed to add netdev flow" ovs-vswitchd.log]) | |
454 | AT_CHECK([filter_hw_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl | |
455 | 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: 0 | |
456 | ]) | |
457 | # Check that datapath flow installed successfully. | |
458 | AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl | |
459 | 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> | |
460 | ]) | |
461 | # Inject the same packet again. | |
462 | AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0]) | |
463 | ||
464 | # Check for succesfull packet matching with installed offloaded flow. | |
465 | AT_CHECK([filter_hw_packet_netdev_dummy < ovs-vswitchd.log | strip_xout], [0], [dnl | |
466 | 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 | |
467 | 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: 0 | |
468 | ]) | |
469 | ||
470 | ovs-appctl revalidator/wait | |
471 | # Dump the datapath flow to see that actions was executed for a packet. | |
472 | AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_timers], [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)), dnl | |
474 | packets:1, bytes:64, used:0.0s, actions:set(ipv4(src=192.168.0.7)),set(udp(dst=3773)),1 | |
475 | ]) | |
476 | ||
477 | # Wait for datapath flow expiration. | |
478 | ovs-appctl time/stop | |
479 | ovs-appctl time/warp 15000 | |
480 | ovs-appctl revalidator/wait | |
481 | ||
482 | # Check that flow successfully deleted from HW. | |
483 | OVS_WAIT_UNTIL([grep "succeed to delete netdev flow" ovs-vswitchd.log]) | |
484 | AT_CHECK([filter_hw_flow_del < ovs-vswitchd.log | strip_xout], [0], [dnl | |
485 | p1: flow del: mark: 0 | |
486 | ]) | |
487 | ||
488 | # Check that ip address and udp port were correctly modified in output packets. | |
489 | AT_CHECK([ovs-ofctl parse-pcap p1.pcap], [0], [dnl | |
490 | 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 | |
491 | 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 | |
492 | 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 | |
493 | 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 | |
494 | ]) | |
495 | ||
496 | OVS_VSWITCHD_STOP | |
497 | AT_CLEANUP]) | |
498 | ||
499 | DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS([dummy]) | |
500 | DPIF_NETDEV_FLOW_HW_OFFLOAD_OFFSETS([dummy-pmd]) |