diff mbox series

[ovs-dev,v2,5/5] dpif-netdev.at: Add test for Tx packets steering.

Message ID 20211215143407.76465-6-maxime.coquelin@redhat.com
State Superseded
Headers show
Series dpif-netdev: Hash-based Tx packet steering | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test fail github build: failed

Commit Message

Maxime Coquelin Dec. 15, 2021, 2:34 p.m. UTC
This patch introduces a new test for Tx packets
steering modes. First test validates the static mode,
by checking that all packets are transmitted on a single
queue (single PMD thread), then it tests the same with
enabling hash based packet steering, ensuring packets
are transmitted on both queues.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 tests/dpif-netdev.at | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
diff mbox series

Patch

diff --git a/tests/dpif-netdev.at b/tests/dpif-netdev.at
index 53eee185a..482e5029f 100644
--- a/tests/dpif-netdev.at
+++ b/tests/dpif-netdev.at
@@ -635,3 +635,47 @@  OVS_WAIT_UNTIL([grep "flow: in_port is not an exact match" ovs-vswitchd.log])
 OVS_VSWITCHD_STOP(["/flow: in_port is not an exact match/d
 /failed to put/d"])
 AT_CLEANUP
+
+# SEND_UDP_PKTS([p_name], [p_ofport])
+#
+# Sends 128 packets to port 'p_name' with different UDP destination ports.
+m4_define([SEND_UDP_PKTS],
+   [
+    for i in `seq 1 128`; do
+      pkt="in_port($2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:01:00),eth_type(0x0800),ipv4(src=10.0.1.1,dst=10.0.0.1,proto=17),udp(src=1000,dst=$i)"
+      ovs-appctl netdev-dummy/receive $1 $pkt --len 256
+    done
+   ]
+)
+
+AT_SETUP([dpif-netdev - tx packets steering])
+OVS_VSWITCHD_START(
+  [add-port br0 p1 -- set Interface p1 type=dummy-pmd ofport_request=1], [], [], [--dummy-numa 0])
+
+AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=dummy-pmd ofport_request=2 options:n_txq=2 other_config:tx-steering=default])
+AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=output:2])
+
+AT_CHECK([SEND_UDP_PKTS([p1], [1])])
+
+OVS_WAIT_UNTIL([test `ovs-vsctl get Interface p2 statistics:tx_packets` -eq 128])
+AT_CHECK([ovs-vsctl get Interface p2 statistics], [], [stdout])
+AT_CHECK([test `ovs-vsctl get Interface p2 statistics:tx_q0_packets` -eq 0 -a   \
+               `ovs-vsctl get Interface p2 statistics:tx_q1_packets` -eq 128 || \
+          test `ovs-vsctl get Interface p2 statistics:tx_q0_packets` -eq 128 -a \
+               `ovs-vsctl get Interface p2 statistics:tx_q1_packets` -eq 0])
+
+AT_CHECK([ovs-vsctl del-port p2])
+
+AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=dummy-pmd ofport_request=2 options:n_txq=2 other_config:tx-steering=hash])
+AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=output:2])
+
+AT_CHECK([SEND_UDP_PKTS([p1], [1])])
+
+OVS_WAIT_UNTIL([test `ovs-vsctl get Interface p2 statistics:tx_packets` -eq 128])
+AT_CHECK([ovs-vsctl get Interface p2 statistics], [], [stdout])
+
+AT_CHECK([test `ovs-vsctl get Interface p2 statistics:tx_q0_packets` -ge 0 -a \
+               `ovs-vsctl get Interface p2 statistics:tx_q1_packets` -ge 0])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP