Ensure that if there are no local numa pmd cores
available that pmd cores from all other non-local
numas will be used.

Signed-off-by: Kevin Traynor <ktray...@redhat.com>
---
 tests/pmd.at | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 61 insertions(+), 1 deletion(-)

diff --git a/tests/pmd.at b/tests/pmd.at
index a2f9d34a2..a5b0a2523 100644
--- a/tests/pmd.at
+++ b/tests/pmd.at
@@ -10,4 +10,11 @@ parse_pmd_rxq_show () {
 }
 
+# Given the output of `ovs-appctl dpif-netdev/pmd-rxq-show`,
+# prints the first rxq on each pmd in the form:
+# 'port:' port_name 'queue_id:' rxq_id
+parse_pmd_rxq_show_first_rxq () {
+   awk '/isolated/ {print  $4, $5, $6, $7}' | sort
+}
+
 # Given the output of `ovs-appctl dpif-netdev/pmd-rxq-show`,
 # and with queues for each core on one line, prints the rxqs
@@ -200,5 +207,5 @@ OVS_VSWITCHD_STOP
 AT_CLEANUP
 
-AT_SETUP([PMD - pmd-cpu-mask - NUMA])
+AT_SETUP([PMD - pmd-cpu-mask - dual NUMA])
 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy-pmd 
options:n_rxq=8 options:numa_id=1 -- set Open_vSwitch . 
other_config:pmd-cpu-mask=1],
                    [], [], [--dummy-numa 1,1,0,0])
@@ -360,4 +367,57 @@ OVS_VSWITCHD_STOP
 AT_CLEANUP
 
+AT_SETUP([PMD - pmd-cpu-mask - multi NUMA])
+OVS_VSWITCHD_START([add-port br0 p0 \
+                    -- set Interface p0 type=dummy-pmd options:n_rxq=4 \
+                    -- set Interface p0 options:numa_id=0 \
+                    -- set Open_vSwitch . other_config:pmd-cpu-mask=0xf \
+                    -- set open_vswitch . other_config:pmd-rxq-assign=cycles],
+                   [], [], [--dummy-numa 1,2,1,2])
+
+TMP=$(($(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])+1))
+AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-rxq-assign=group])
+
+OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Performing pmd to rx 
queue assignment using group algorithm"])
+OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "There's no available 
(non-isolated) pmd thread on numa node 0."])
+
+# check all pmds from both non-local numas are assigned an rxq
+AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | awk '/false$/ { printf("%s\t", 
$0); next } 1' | parse_pmd_rxq_show_first_rxq], [0], [dnl
+port: p0 queue-id: 0
+port: p0 queue-id: 1
+port: p0 queue-id: 2
+port: p0 queue-id: 3
+])
+
+TMP=$(($(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])+1))
+AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-rxq-assign=cycles])
+
+OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Performing pmd to rx 
queue assignment using cycles algorithm"])
+OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "There's no available 
(non-isolated) pmd thread on numa node 0."])
+
+# check all pmds from both non-local numas are assigned an rxq
+AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | awk '/false$/ { printf("%s\t", 
$0); next } 1' | parse_pmd_rxq_show_first_rxq], [0], [dnl
+port: p0 queue-id: 0
+port: p0 queue-id: 1
+port: p0 queue-id: 2
+port: p0 queue-id: 3
+])
+
+TMP=$(($(cat ovs-vswitchd.log | wc -l | tr -d [[:blank:]])+1))
+AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:pmd-rxq-assign=roundrobin])
+
+OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "Performing pmd to rx 
queue assignment using roundrobin algorithm"])
+OVS_WAIT_UNTIL([tail -n +$TMP ovs-vswitchd.log | grep "There's no available 
(non-isolated) pmd thread on numa node 0."])
+
+# check all pmds from both non-local numas are assigned an rxq
+AT_CHECK([ovs-appctl dpif-netdev/pmd-rxq-show | awk '/false$/ { printf("%s\t", 
$0); next } 1' | parse_pmd_rxq_show_first_rxq], [0], [dnl
+port: p0 queue-id: 0
+port: p0 queue-id: 1
+port: p0 queue-id: 2
+port: p0 queue-id: 3
+])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
 AT_SETUP([PMD - stats])
 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 ofport_request=7 
type=dummy-pmd options:n_rxq=4],
-- 
2.34.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to