[dts] [PATCH V2] tests/shutdown_api: update enable_disablerss

Wenjie Li wenjiex.a.li at intel.com
Fri Jan 25 06:51:45 CET 2019


Align to the changes of test plan.

Signed-off-by: Wenjie Li <wenjiex.a.li at intel.com>
---
V1:
1. start testpmd with "--txq=16 --rxq=16".
2. change the command to enable rss.
3. check all forward packets are not in the same queue.
4. add parameter "enable_rss" in check_forwarding() and send_packet() to
get the queue id of forward packet.

V2:
Get the queue id only when rss is enabled.

 tests/TestSuite_shutdown_api.py | 31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/tests/TestSuite_shutdown_api.py b/tests/TestSuite_shutdown_api.py
index 9f3f03f..2569159 100644
--- a/tests/TestSuite_shutdown_api.py
+++ b/tests/TestSuite_shutdown_api.py
@@ -40,6 +40,7 @@ import utils
 import time
 import re
 import os
+import random
 from test_case import TestCase
 from pmd_output import PmdOutput
 from settings import HEADER_SIZE, PROTOCOL_PACKET_SIZE
@@ -83,14 +84,14 @@ class TestShutdownApi(TestCase):
         stats = output.get_pmd_stats(portid)
         return stats
 
-    def check_forwarding(self, ports=None, pktSize=68, received=True, vlan=False, promisc=False, vlan_strip=False):
+    def check_forwarding(self, ports=None, pktSize=68, received=True, vlan=False, promisc=False, vlan_strip=False, enable_rss=False):
         if ports is None:
             ports = self.ports
         if len(ports) == 1:
-            self.send_packet(ports[0], ports[0], pktSize, received, vlan, promisc, vlan_strip)
+            self.send_packet(ports[0], ports[0], pktSize, received, vlan, promisc, vlan_strip, enable_rss)
             return
 
-    def send_packet(self, txPort, rxPort, pktSize=68, received=True, vlan=False, promisc=False, vlan_strip=False):
+    def send_packet(self, txPort, rxPort, pktSize=68, received=True, vlan=False, promisc=False, vlan_strip=False, enable_rss=False):
         """
         Send packages according to parameters.
         """
@@ -113,11 +114,19 @@ class TestShutdownApi(TestCase):
             pkg = 'Ether(src="%s", dst="%s")/Dot1Q(vlan=1)/IP()/Raw(load="P" * %d)' % (smac, dmac, padding)
         else:
             padding = pktSize - HEADER_SIZE['eth'] - HEADER_SIZE['ip']
-            pkg = 'Ether(src="%s", dst="%s")/IP()/Raw(load="P" * %d)' % (smac, dmac, padding)
+            if enable_rss:
+                sip = "192.168.0.1"
+                dip = "192.168.0.%s" % random.randint(2, 254)
+                pkg = 'Ether(src="%s", dst="%s")/IP(src="%s", dst="%s")/Raw(load="P" * %d)' % (smac, dmac, sip, dip, padding)
+            else:
+                pkg = 'Ether(src="%s", dst="%s")/IP()/Raw(load="P" * %d)' % (smac, dmac, padding)
 
         self.tester.scapy_foreground()
         self.tester.scapy_append('sendp(%s, iface="%s")' % (pkg, itf))
         self.tester.scapy_execute()
+        if enable_rss:
+            out = self.dut.get_session_output()
+            self.acutal_queue_id = int(re.compile('Receive queue=(.*?)\s+?').findall(out, re.S)[0], 16)
         time.sleep(3)
 
         port0_stats = self.get_stats(txPort)
@@ -397,14 +406,22 @@ class TestShutdownApi(TestCase):
         """
         Enable/Disable RSS.
         """
-        self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.create_mask(self.ports), socket=self.ports_socket)
+        self.queue_num = 16
+        self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop --txq=%s --rxq=%s" 
+                % (utils.create_mask(self.ports), self.queue_num, self.queue_num), socket=self.ports_socket)
 
         self.dut.send_expect("port stop all", "testpmd> ", 100)
-        self.dut.send_expect("port config rss ip", "testpmd> ")
+        self.dut.send_expect("port config all rss ip", "testpmd> ")
         self.dut.send_expect("set fwd mac", "testpmd>")
         self.dut.send_expect("port start all", "testpmd> ", 100)
         self.dut.send_expect("start", "testpmd> ")
-        self.check_forwarding()
+        self.dut.send_expect("set verbose 1", "testpmd> ")
+        queue_list = []
+        for i in range(0, self.queue_num):
+            self.check_forwarding(enable_rss=True)
+            queue_list.append(self.acutal_queue_id)
+        print("Forward packets to queues: %s" % queue_list)
+        self.verify(len(list(set(queue_list))) > 1, "All packets were send to the same queue %s" %self.acutal_queue_id)
 
     def test_change_numberrxdtxd(self):
         """
-- 
2.17.2



More information about the dts mailing list