test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V2] tests/shutdown_api: update enable_disablerss
@ 2019-01-25  5:51 Wenjie Li
  2019-01-25  7:31 ` Yao, BingX Y
  0 siblings, 1 reply; 2+ messages in thread
From: Wenjie Li @ 2019-01-25  5:51 UTC (permalink / raw)
  To: dts; +Cc: Wenjie Li

Align to the changes of test plan.

Signed-off-by: Wenjie Li <wenjiex.a.li@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dts] [PATCH V2] tests/shutdown_api: update enable_disablerss
  2019-01-25  5:51 [dts] [PATCH V2] tests/shutdown_api: update enable_disablerss Wenjie Li
@ 2019-01-25  7:31 ` Yao, BingX Y
  0 siblings, 0 replies; 2+ messages in thread
From: Yao, BingX Y @ 2019-01-25  7:31 UTC (permalink / raw)
  To: Li, WenjieX A, dts; +Cc: Li, WenjieX A

Tested-by: yaobing <bingx.y.yao@intel.com>

-----Original Message-----
From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Wenjie Li
Sent: Friday, January 25, 2019 1:52 PM
To: dts@dpdk.org
Cc: Li, WenjieX A <wenjiex.a.li@intel.com>
Subject: [dts] [PATCH V2] tests/shutdown_api: update enable_disablerss

Align to the changes of test plan.

Signed-off-by: Wenjie Li <wenjiex.a.li@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-25  7:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-25  5:51 [dts] [PATCH V2] tests/shutdown_api: update enable_disablerss Wenjie Li
2019-01-25  7:31 ` Yao, BingX Y

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).