3 m4_divert_push([PREPARE_TESTS])
5 # Given the output of `ovs-appctl dpif-netdev/pmd-rxq-show`, prints a list
6 # of every rxq (one per line) in the form:
7 # port_name rxq_id numa_id core_id
8 parse_pmd_rxq_show () {
9 awk '/pmd/ {numa=$4; core=substr($6, 1, length($6) - 1)} /\t/{for (i=4; i<=NF; i++) print $2, $i, numa, core}' | sort
12 # Given the output of `ovs-appctl dpctl/dump-flows`, prints a list of flows
13 # (one per line), with the pmd_id at the beginning of the line
15 flow_dump_prepend_pmd () {
16 awk '/flow-dump from non-dpdk/ {pmd_id=-1; next} /flow-dump from pmd/ {pmd_id=$7; next} {print pmd_id, $0}' | sort
19 m4_divert_pop([PREPARE_TESTS])
21 dnl CHECK_CPU_DISCOVERED([n_cpu])
23 dnl Waits until CPUs discovered and checks if number of discovered CPUs
24 dnl is greater or equal to 'n_cpu'. Without parameters checks that at
25 dnl least one CPU discovered.
26 m4_define([CHECK_CPU_DISCOVERED], [
27 PATTERN="Discovered [[0-9]]* NUMA nodes and [[0-9]]* CPU cores"
28 OVS_WAIT_UNTIL([grep "$PATTERN" ovs-vswitchd.log])
29 N_CPU=$(grep "$PATTERN" ovs-vswitchd.log | sed -e 's/.* \([[0-9]]*\) CPU cores/\1/')
31 then AT_CHECK([test "$N_CPU" -gt "0"])
32 else AT_SKIP_IF([test "$N_CPU" -lt "$1"])
36 dnl CHECK_PMD_THREADS_CREATED([n_threads], [numa_id], [+line])
38 dnl Whaits for creation of 'n_threads' or at least 1 thread if $1 not
39 dnl passed. Checking starts from line number 'line' in ovs-vswithd.log .
40 m4_define([CHECK_PMD_THREADS_CREATED], [
41 PATTERN="Created [[0-9]]* pmd threads on numa node $2"
43 if [[ -z "$line_st" ]]
47 OVS_WAIT_UNTIL([tail -n $line_st ovs-vswitchd.log | grep "$PATTERN"])
48 N_THREADS=$(tail -n $line_st ovs-vswitchd.log | grep "$PATTERN" | tail -1 | sed -e 's/.* \([[0-9]]*\) pmd .*/\1/')
50 then AT_CHECK([test "$N_THREADS" -gt 0])
51 else AT_CHECK([test "$N_THREADS" -eq "$1"])
55 m4_define([SED_NUMA_CORE_PATTERN], ["s/\(numa_id \)[[0-9]]*\( core_id \)[[0-9]]*:/\1<cleared>\2<cleared>:/"])
56 m4_define([DUMMY_NUMA], [--dummy-numa="0,0,0,0"])
58 AT_SETUP([PMD - creating a thread/add-port])
59 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy-pmd], [], [], [DUMMY_NUMA])
61 CHECK_CPU_DISCOVERED()
62 CHECK_PMD_THREADS_CREATED()
64 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | sed SED_NUMA_CORE_PATTERN], [0], [dnl
65 pmd thread numa_id <cleared> core_id <cleared>:
70 AT_CHECK([ovs-appctl dpif/show | sed 's/\(tx_queues=\)[[0-9]]*/\1<cleared>/g'], [0], [dnl
71 dummy@ovs-dummy: hit:0 missed:0
73 br0 65534/100: (dummy-internal)
74 p0 1/1: (dummy-pmd: configured_rx_queues=1, configured_tx_queues=<cleared>, requested_rx_queues=1, requested_tx_queues=<cleared>)
80 AT_SETUP([PMD - multiqueue support])
81 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy-pmd], [], [], [DUMMY_NUMA])
83 CHECK_CPU_DISCOVERED()
84 CHECK_PMD_THREADS_CREATED()
86 AT_CHECK([ovs-vsctl set interface p0 options:n_rxq=8])
88 AT_CHECK([ovs-appctl dpif/show | sed 's/\(tx_queues=\)[[0-9]]*/\1<cleared>/g'], [0], [dnl
89 dummy@ovs-dummy: hit:0 missed:0
91 br0 65534/100: (dummy-internal)
92 p0 1/1: (dummy-pmd: configured_rx_queues=8, configured_tx_queues=<cleared>, requested_rx_queues=8, requested_tx_queues=<cleared>)
95 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | sed SED_NUMA_CORE_PATTERN], [0], [dnl
96 pmd thread numa_id <cleared> core_id <cleared>:
98 port: p0 queue-id: 0 1 2 3 4 5 6 7
105 AT_SETUP([PMD - pmd-cpu-mask/distribution of rx queues])
106 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy-pmd options:n_rxq=8],
107 [], [], [DUMMY_NUMA])
109 CHECK_CPU_DISCOVERED(2)
110 CHECK_PMD_THREADS_CREATED()
112 AT_CHECK([ovs-appctl dpif/show | sed 's/\(tx_queues=\)[[0-9]]*/\1<cleared>/g'], [0], [dnl
113 dummy@ovs-dummy: hit:0 missed:0
115 br0 65534/100: (dummy-internal)
116 p0 1/1: (dummy-pmd: configured_rx_queues=8, configured_tx_queues=<cleared>, requested_rx_queues=8, requested_tx_queues=<cleared>)
119 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | sed SED_NUMA_CORE_PATTERN], [0], [dnl
120 pmd thread numa_id <cleared> core_id <cleared>:
122 port: p0 queue-id: 0 1 2 3 4 5 6 7
125 TMP=$(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])
126 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=0x3])
127 CHECK_PMD_THREADS_CREATED([2], [], [+$TMP])
129 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | sed SED_NUMA_CORE_PATTERN], [0], [dnl
130 pmd thread numa_id <cleared> core_id <cleared>:
132 port: p0 queue-id: 0 2 4 6
133 pmd thread numa_id <cleared> core_id <cleared>:
135 port: p0 queue-id: 1 3 5 7
138 TMP=$(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])
139 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=0x1])
140 CHECK_PMD_THREADS_CREATED([1], [], [+$TMP])
142 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | sed SED_NUMA_CORE_PATTERN], [0], [dnl
143 pmd thread numa_id <cleared> core_id <cleared>:
145 port: p0 queue-id: 0 1 2 3 4 5 6 7
152 AT_SETUP([PMD - stats])
153 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 ofport_request=7 type=dummy-pmd options:n_rxq=4],
154 [], [], [DUMMY_NUMA])
156 CHECK_CPU_DISCOVERED()
157 CHECK_PMD_THREADS_CREATED()
159 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg])
160 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
164 AT_CHECK([ovs-appctl dpif/show | sed 's/\(tx_queues=\)[[0-9]]*/\1<cleared>/g'], [0], [dnl
165 dummy@ovs-dummy: hit:0 missed:0
167 br0 65534/100: (dummy-internal)
168 p0 7/1: (dummy-pmd: configured_rx_queues=4, configured_tx_queues=<cleared>, requested_rx_queues=4, requested_tx_queues=<cleared>)
171 AT_CHECK([ovs-appctl dpif-netdev/pmd-stats-show | sed SED_NUMA_CORE_PATTERN | sed '/cycles/d' | grep pmd -A 5], [0], [dnl
172 pmd thread numa_id <cleared> core_id <cleared>:
175 avg. subtable lookups per hit:0.00
181 ovs-appctl time/warp 100
185 pkt="in_port(7),eth(src=50:54:00:00:00:77,dst=50:54:00:00:01:78),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)"
186 AT_CHECK([ovs-appctl netdev-dummy/receive p0 $pkt])
189 ovs-appctl time/warp 100
191 AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl
192 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),eth(src=50:54:00:00:00:77,dst=50:54:00:00:01:78),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)
194 AT_CHECK([cat ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
195 recirc_id(0),in_port(1),eth(src=50:54:00:00:00:77,dst=50:54:00:00:01:78),eth_type(0x0800),ipv4(frag=no), actions: <del>
198 AT_CHECK([ovs-appctl dpif-netdev/pmd-stats-show | sed SED_NUMA_CORE_PATTERN | sed '/cycles/d' | grep pmd -A 5], [0], [dnl
199 pmd thread numa_id <cleared> core_id <cleared>:
202 avg. subtable lookups per hit:0.00
210 dnl Reconfigure the number of rx queues of a port, make sure that all the
211 dnl queues are polled by the datapath and try to send a couple of packets.
212 AT_SETUP([PMD - reconfigure n_rxq])
214 [add-port br0 p1 -- set Interface p1 type=dummy-pmd ofport_request=1 options:n_rxq=2 -- \
215 add-port br0 p2 -- set Interface p2 type=dummy-pmd ofport_request=2
216 ], [], [], [--dummy-numa 0])
217 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
219 AT_CHECK([ovs-ofctl add-flow br0 action=controller])
221 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show], [0], [dnl
227 AT_CAPTURE_FILE([ofctl_monitor.log])
228 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
230 AT_CHECK([ovs-appctl netdev-dummy/receive p1 --qid 1 'in_port(1),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)'])
232 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 2])
233 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
235 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
236 NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
237 icmp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:f7ff
240 AT_CHECK([ovs-vsctl set interface p1 options:n_rxq=4])
242 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show], [0], [dnl
250 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
252 AT_CHECK([ovs-appctl netdev-dummy/receive p1 --qid 3 'in_port(1),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)'])
254 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 2])
255 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
257 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
258 NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
259 icmp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:f7ff
262 dnl Check resetting to default number of rx queues after removal from the db.
263 AT_CHECK([ovs-vsctl remove interface p1 options n_rxq])
265 AT_CHECK([ovs-appctl dpif/show | grep p1 | sed 's/\(tx_queues=\)[[0-9]]*/\1<cleared>/g'], [0], [dnl
266 p1 1/1: (dummy-pmd: configured_rx_queues=1, configured_tx_queues=<cleared>, requested_rx_queues=1, requested_tx_queues=<cleared>)
272 dnl There was a bug where OVS failed to create a ukey and install a megaflow
273 dnl if a packet with the exact same flow was received by two different pmd
274 dnl threads. This is a regression test for that bug.
275 AT_SETUP([PMD - same flow multiple threads])
277 [add-port br0 p1 -- set Interface p1 type=dummy-pmd ofport_request=1 options:n_rxq=2 -- \
278 set Open_vSwitch . other_config:pmd-cpu-mask=3
279 ], [], [], [--dummy-numa 0,0])
280 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
282 AT_CHECK([ovs-ofctl add-flow br0 action=controller])
284 dnl Make sure that the queues are on different cores. There's no way to
285 dnl control which queue is on which thread, we just need to make sure that
286 dnl two threads (core_id) show up in pmd-rxq-show
287 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show | cut -f 4 -d ' ' | sort], [0], [dnl
292 AT_CAPTURE_FILE([ofctl_monitor.log])
293 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
295 AT_CHECK([ovs-appctl netdev-dummy/receive p1 --qid 0 'in_port(1),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)'])
297 AT_CHECK([ovs-appctl netdev-dummy/receive p1 --qid 1 'in_port(1),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)'])
299 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
300 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
302 dnl Make sure that both flows have been installed
303 AT_CHECK([ovs-appctl dpctl/dump-flows | flow_dump_prepend_pmd], [0], [dnl
304 0 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:userspace(pid=0,slow_path(controller))
305 1 recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:userspace(pid=0,slow_path(controller))
308 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
309 NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
310 icmp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:f7ff
311 NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
312 icmp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:f7ff
318 AT_SETUP([PMD - change numa node])
320 [add-port br0 p1 -- set Interface p1 type=dummy-pmd ofport_request=1 options:n_rxq=2 -- \
321 add-port br0 p2 -- set Interface p2 type=dummy-pmd ofport_request=2 options:n_rxq=2 -- \
322 set Open_vSwitch . other_config:pmd-cpu-mask=3
323 ], [], [], [--dummy-numa 0,1])
324 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
326 AT_CHECK([ovs-ofctl add-flow br0 action=controller])
328 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show], [0], [dnl
335 AT_CAPTURE_FILE([ofctl_monitor.log])
336 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
338 AT_CHECK([ovs-appctl netdev-dummy/receive p1 --qid 0 'in_port(1),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)'])
340 AT_CHECK([ovs-appctl netdev-dummy/receive p2 --qid 1 'in_port(1),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)'])
342 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
343 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
345 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
346 NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
347 icmp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:f7ff
348 NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=42 in_port=2 (via action) data_len=42 (unbuffered)
349 icmp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:f7ff
352 AT_CHECK([ovs-vsctl set Interface p2 options:numa_id=1])
354 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show], [0], [dnl
361 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
363 AT_CHECK([ovs-appctl netdev-dummy/receive p1 --qid 1 'in_port(1),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)'])
365 AT_CHECK([ovs-appctl netdev-dummy/receive p2 --qid 0 'in_port(1),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)'])
367 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 4])
368 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
370 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
371 NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
372 icmp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:f7ff
373 NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=42 in_port=2 (via action) data_len=42 (unbuffered)
374 icmp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:f7ff
380 AT_SETUP([PMD - non pmd device])
382 [add-port br0 p1 -- set Interface p1 type=dummy-pmd ofport_request=1 options:n_rxq=1 -- \
383 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2 -- \
384 set Interface br0 options:tx_pcap=br0.pcap -- \
385 set Open_vSwitch . other_config:pmd-cpu-mask=1
386 ], [], [], [--dummy-numa 0,0])
387 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
389 AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL])
391 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show], [0], [dnl
395 AT_CHECK([ovs-appctl netdev-dummy/receive p1 --qid 0 'in_port(1),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)'])
397 AT_CHECK([ovs-appctl netdev-dummy/receive p2 --qid 0 'in_port(1),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)'])
399 OVS_WAIT_UNTIL([test `ovs-pcap br0.pcap | wc -l` -ge 2])
401 AT_CHECK([ovs-pcap br0.pcap], [0], [dnl
402 50540000000a50540000000908004500001c00000000400166df0a0000020a0000010800f7ff00000000
403 50540000000a50540000000908004500001c00000000400166df0a0000020a0000010800f7ff00000000
406 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=2])
408 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show], [0], [dnl
412 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
414 AT_CHECK([ovs-appctl netdev-dummy/receive p1 --qid 0 'in_port(1),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)'])
416 AT_CHECK([ovs-appctl netdev-dummy/receive p2 --qid 0 'in_port(1),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)'])
418 OVS_WAIT_UNTIL([test `ovs-pcap br0.pcap | wc -l` -ge 4])
420 AT_CHECK([ovs-pcap br0.pcap], [0], [dnl
421 50540000000a50540000000908004500001c00000000400166df0a0000020a0000010800f7ff00000000
422 50540000000a50540000000908004500001c00000000400166df0a0000020a0000010800f7ff00000000
423 50540000000a50540000000908004500001c00000000400166df0a0000020a0000010800f7ff00000000
424 50540000000a50540000000908004500001c00000000400166df0a0000020a0000010800f7ff00000000
430 AT_SETUP([PMD - add remove ports])
432 [], [], [], [--dummy-numa 0,0])
433 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
435 AT_CHECK([ovs-ofctl add-flow br0 actions=controller])
437 AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy-pmd ofport_request=1 options:n_rxq=1])
439 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show], [0], [dnl
443 AT_CAPTURE_FILE([ofctl_monitor.log])
444 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
446 AT_CHECK([ovs-appctl netdev-dummy/receive p1 --qid 0 'in_port(1),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)'])
448 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 2])
449 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
451 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
452 NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
453 icmp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:f7ff
456 AT_CHECK([ovs-vsctl del-port br0 p1])
457 AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy-pmd ofport_request=1 options:n_rxq=1])
459 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
461 AT_CHECK([ovs-appctl netdev-dummy/receive p1 --qid 0 'in_port(1),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)'])
463 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 2])
464 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
466 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
467 NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=42 in_port=1 (via action) data_len=42 (unbuffered)
468 icmp,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0 icmp_csum:f7ff
474 AT_SETUP([PMD - rxq affinity])
476 [], [], [], [--dummy-numa 0,0,0,0,0,0,0,0,0])
477 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
479 AT_CHECK([ovs-ofctl add-flow br0 actions=controller])
481 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=0x1fe])
483 AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy-pmd ofport_request=1 options:n_rxq=4 other_config:pmd-rxq-affinity="0:3,1:7,2:2,3:8"])
485 dnl The rxqs should be on the requested cores.
486 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show], [0], [dnl
493 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=6])
495 dnl We removed the cores requested by some queues from pmd-cpu-mask.
496 dnl Those queues will not be polled.
497 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show], [0], [dnl
501 AT_CHECK([ovs-vsctl remove Interface p1 other_config pmd-rxq-affinity])
503 dnl We removed the rxq-affinity request. dpif-netdev should assign queues
504 dnl in a round robin fashion. We just make sure that every rxq is being
506 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show | cut -f 1,2 -d ' ' | sort], [0], [dnl
513 AT_CHECK([ovs-vsctl set Interface p1 other_config:pmd-rxq-affinity='0:1'])
515 dnl We explicitly requested core 1 for queue 0. Core 1 becomes isolated and
516 dnl every other queue goes to core 2.
517 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show], [0], [dnl
524 OVS_VSWITCHD_STOP(["/dpif_netdev|WARN|There is no PMD thread on core/d"])
527 AT_SETUP([PMD - rxq affinity - NUMA])
529 [], [], [], [--dummy-numa 0,0,0,1,1])
530 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
532 AT_CHECK([ovs-ofctl add-flow br0 actions=controller])
534 AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=7e])
536 AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy-pmd ofport_request=1 options:n_rxq=2 options:numa_id=0 other_config:pmd-rxq-affinity="0:1,1:2"])
538 dnl The rxqs should be on the requested cores.
539 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show], [0], [dnl
544 AT_CHECK([ovs-vsctl set Interface p1 other_config:pmd-rxq-affinity="0:3,1:4"])
546 dnl We moved the queues to different numa node. Expecting threads on
547 dnl NUMA node 1 to be created.
548 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show], [0], [dnl
553 AT_CHECK([ovs-vsctl set Interface p1 other_config:pmd-rxq-affinity="0:3,1:1"])
555 dnl Queues splitted between NUMA nodes.
556 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show], [0], [dnl
561 AT_CHECK([ovs-vsctl remove Interface p1 other_config pmd-rxq-affinity])
563 dnl We removed the rxq-affinity request. dpif-netdev should assign queues
564 dnl in a round robin fashion. We just make sure that every rxq is being
566 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show | cut -f 1,2 -d ' ' | sort], [0], [dnl
571 AT_CHECK([ovs-vsctl set Interface p1 other_config:pmd-rxq-affinity='0:3'])
573 dnl We explicitly requesting NUMA node 1 for queue 0.
574 dnl Queue 1 should be polled by thread from NUMA node 0.
575 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show | cut -f 1,2,3 -d ' '], [0], [dnl
583 AT_SETUP([PMD - monitor threads])
585 [], [], [], [--dummy-numa 0,0])
586 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
588 dnl The two devices are connected together externally using net.sock
589 AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy-pmd ofport_request=1 options:n_rxq=1 options:pstream=punix:$OVS_RUNDIR/net.sock])
590 AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=dummy-pmd ofport_request=2 options:n_rxq=1 options:stream=unix:$OVS_RUNDIR/net.sock])
592 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show], [0], [dnl
597 dnl Enable bfd with a very aggressive interval. This will make the monitor very
598 dnl busy, and uncover race conditions with the main thread.
599 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true bfd:min_rx=1 bfd:min_tx=1])
600 AT_CHECK([ovs-vsctl set Interface p2 bfd:enable=true bfd:min_rx=1 bfd:min_tx=1])
602 AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p1 bfd_status:forwarding=true \
603 -- wait-until Interface p2 bfd_status:forwarding=true])
605 dnl Trigger reconfiguration of the datapath
606 AT_CHECK([ovs-vsctl set Interface p1 options:n_rxq=2])
607 AT_CHECK([ovs-vsctl set Interface p2 options:n_rxq=2])
609 dnl Make sure that reconfiguration succeded
610 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | parse_pmd_rxq_show], [0], [dnl
620 AT_SETUP([PMD - dpctl])
622 [del-br br0], [], [], [--dummy-numa 0,0])
623 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
625 AT_CHECK([ovs-appctl dpctl/add-dp dummy@dp0])
626 AT_CHECK([ovs-appctl dpctl/add-if dummy@dp0 p1,type=dummy-pmd])
627 AT_CHECK([ovs-appctl dpctl/add-if dummy@dp0 p2,type=dummy])
629 AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show dp0 | parse_pmd_rxq_show], [0], [dnl
633 AT_CHECK([ovs-appctl dpctl/show dummy@dp0], [0], [dnl
635 lookups: hit:0 missed:0 lost:0
637 port 0: dp0 (dummy-internal)
638 port 1: p1 (dummy-pmd: configured_rx_queues=1, configured_tx_queues=1, requested_rx_queues=1, requested_tx_queues=1)
642 AT_CHECK([ovs-appctl dpctl/add-flow dummy@dp0 'in_port(1),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x1234)' 2], [0], [dnl
645 AT_CHECK([ovs-appctl dpctl/dump-flows dummy@dp0 | sort], [0], [dnl
646 flow-dump from non-dpdk interfaces:
647 flow-dump from pmd on cpu core: 0
648 recirc_id(0),in_port(1),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x1234), packets:0, bytes:0, used:never, actions:2
649 recirc_id(0),in_port(1),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x1234), packets:0, bytes:0, used:never, actions:2
652 AT_CHECK([ovs-appctl dpctl/del-flow dummy@dp0 'in_port(1),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x1234)'], [0], [dnl
655 AT_CHECK([ovs-appctl dpctl/dump-flows dummy@dp0], [0], [dnl
658 AT_CHECK([ovs-appctl dpctl/del-dp dummy@dp0], [0], [dnl