From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3E4ACA046B for ; Mon, 22 Jul 2019 05:11:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D3E542BAC; Mon, 22 Jul 2019 05:11:15 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 1FB3229CB for ; Mon, 22 Jul 2019 05:11:12 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jul 2019 20:11:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,293,1559545200"; d="scan'208";a="192588288" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 21 Jul 2019 20:11:11 -0700 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 21 Jul 2019 20:11:11 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 21 Jul 2019 20:11:11 -0700 Received: from shsmsx105.ccr.corp.intel.com ([169.254.11.232]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.22]) with mapi id 14.03.0439.000; Mon, 22 Jul 2019 11:11:09 +0800 From: "Zhang, YanX A" To: "Zhao, HaiyangX" , "dts@dpdk.org" CC: "Lin, Xueqin" , "Zhao, HaiyangX" Thread-Topic: [dts] [PATCH V1 2/2] tests/vf_rss: optmize vf_pmdrss and vf_pmdrss_reta Thread-Index: AQHVPhsuYu9GcJryvkylx82OzZlhmqbV+fKA Date: Mon, 22 Jul 2019 03:11:09 +0000 Message-ID: <2C49E4B25FAD1D419F7564D633EF72E1F3B460@SHSMSX105.ccr.corp.intel.com> References: <20190719181634.10735-1-haiyangx.zhao@intel.com> <20190719181634.10735-2-haiyangx.zhao@intel.com> In-Reply-To: <20190719181634.10735-2-haiyangx.zhao@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V1 2/2] tests/vf_rss: optmize vf_pmdrss and vf_pmdrss_reta X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Tested-by: Zhang, YanX A -----Original Message----- From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Haiyang Zhao Sent: Saturday, July 20, 2019 2:17 AM To: dts@dpdk.org Cc: Lin, Xueqin ; Zhao, HaiyangX Subject: [dts] [PATCH V1 2/2] tests/vf_rss: optmize vf_pmdrss and vf_pmdrss= _reta *.increase sent packet to 128 and check every queue can receive packet in vf_pmdrss. *.modify iptypes and add rss config command in rss_reta. *.modify rss reta size for different nics. *.fix pep8 issue. Signed-off-by: Haiyang Zhao --- tests/TestSuite_vf_rss.py | 110 +++++++++++++++++++++++++------------- 1 file changed, 73 insertions(+), 37 deletions(-) diff --git a/tests/TestSuite_vf_rss.py b/tests/TestSuite_vf_rss.py index e5= c19e2..e19a9a5 100644 --- a/tests/TestSuite_vf_rss.py +++ b/tests/TestSuite_vf_rss.py @@ -46,11 +46,12 @@ from test_case import TestCase from pmd_output import = PmdOutput from virt_common import VM =20 + class TestVfRss(TestCase): =20 supported_vf_driver =3D ['pci-stub', 'vfio-pci'] =20 - def send_packet(self, itf, tran_type): + def send_packet(self, itf, tran_type, queue, packet_count=3D16): """ Sends packets. """ @@ -63,28 +64,35 @@ class TestVfRss(TestCase): mac =3D self.vm0_testpmd.get_port_mac(0) # send packet with different source and dest ip if tran_type =3D=3D "ipv4-other": - for i in range(16): + for i in range(packet_count): packet =3D r'sendp([Ether(dst=3D"%s", src=3D"02:00:00:00:0= 0:00")/IP(src=3D"192.168.0.%d", dst=3D"192.168.0.%d")], iface=3D"%s")' % ( mac, i + 1, i + 2, itf) self.tester.scapy_append(packet) self.tester.scapy_execute() time.sleep(.5) + elif tran_type =3D=3D "ipv4-frag": + for i in range(packet_count): + packet =3D r'sendp([Ether(dst=3D"%s", src=3D"02:00:00:00:0= 0:00")/IP(src=3D"192.168.0.%d", dst=3D"192.168.0.%d", frag=3D1, flags=3D"MF= ")], iface=3D"%s")' % ( + mac, i + 1, i + 2, itf) + self.tester.scapy_append(packet) + self.tester.scapy_execute() + time.sleep(.5) elif tran_type =3D=3D "ipv4-tcp": - for i in range(16): + for i in range(packet_count): packet =3D r'sendp([Ether(dst=3D"%s", src=3D"02:00:00:00:0= 0:00")/IP(src=3D"192.168.0.%d", dst=3D"192.168.0.%d")/TCP(sport=3D1024,dpor= t=3D1024)], iface=3D"%s")' % ( mac, i + 1, i + 2, itf) self.tester.scapy_append(packet) self.tester.scapy_execute() time.sleep(.5) elif tran_type =3D=3D "ipv4-udp": - for i in range(16): + for i in range(packet_count): packet =3D r'sendp([Ether(dst=3D"%s", src=3D"02:00:00:00:0= 0:00")/IP(src=3D"192.168.0.%d", dst=3D"192.168.0.%d")/UDP(sport=3D1024,dpor= t=3D1024)], iface=3D"%s")' % ( mac, i + 1, i + 2, itf) self.tester.scapy_append(packet) self.tester.scapy_execute() time.sleep(.5) elif tran_type =3D=3D "ipv4-sctp": - for i in range(16): + for i in range(packet_count): packet =3D r'sendp([Ether(dst=3D"%s")/IP(src=3D"192.168.0.= %d", dst=3D"192.168.0.%d")/SCTP(sport=3D1024,dport=3D1025,tag=3D1)], iface= =3D"%s")' % ( mac, i + 1, i + 2, itf) self.tester.scapy_append(packet) @@ -94,7 +102,7 @@ class = TestVfRss(TestCase): self.tester.scapy_execute() time.sleep(.5) elif tran_type =3D=3D "l2_payload": - for i in range(16): + for i in range(packet_count): packet =3D r'sendp([Ether(src=3D"00:00:00:00:00:%02d",dst= =3D"%s")], iface=3D"%s")' % ( i + 1, mac, itf) self.tester.scapy_append(packet) @@ -102,28 +110,35 @@ cla= ss TestVfRss(TestCase): time.sleep(.5) =20 elif tran_type =3D=3D "ipv6-other": - for i in range(16): + for i in range(packet_count): packet =3D r'sendp([Ether(dst=3D"%s", src=3D"02:00:00:00:0= 0:00")/IPv6(src=3D"3ffe:2501:200:1fff::%d", dst=3D"3ffe:2501:200:3::%d")], = iface=3D"%s")' % ( mac, i + 1, i + 2, itf) self.tester.scapy_append(packet) self.tester.scapy_execute() time.sleep(.5) + elif tran_type =3D=3D "ipv6-frag": + for i in range(packet_count): + packet =3D r'sendp([Ether(dst=3D"%s", src=3D"02:00:00:00:0= 0:00")/IPv6(src=3D"3ffe:2501:200:1fff::%d", dst=3D"3ffe:2501:200:3::%d", nh= =3D44)/IPv6ExtHdrFragment()], iface=3D"%s")' % ( + mac, i + 1, i + 2, itf) + self.tester.scapy_append(packet) + self.tester.scapy_execute() + time.sleep(.5) elif tran_type =3D=3D "ipv6-tcp": - for i in range(16): + for i in range(packet_count): packet =3D r'sendp([Ether(dst=3D"%s", src=3D"02:00:00:00:0= 0:00")/IPv6(src=3D"3ffe:2501:200:1fff::%d", dst=3D"3ffe:2501:200:3::%d")/TC= P(sport=3D1024,dport=3D1024)], iface=3D"%s")' % ( mac, i + 1, i + 2, itf) self.tester.scapy_append(packet) self.tester.scapy_execute() time.sleep(.5) elif tran_type =3D=3D "ipv6-udp": - for i in range(16): + for i in range(packet_count): packet =3D r'sendp([Ether(dst=3D"%s", src=3D"02:00:00:00:0= 0:00")/IPv6(src=3D"3ffe:2501:200:1fff::%d", dst=3D"3ffe:2501:200:3::%d")/UD= P(sport=3D1024,dport=3D1024)], iface=3D"%s")' % ( mac, i + 1, i + 2, itf) self.tester.scapy_append(packet) self.tester.scapy_execute() time.sleep(.5) elif tran_type =3D=3D "ipv6-sctp": - for i in range(16): + for i in range(packet_count): packet =3D r'sendp([Ether(dst=3D"%s")/IPv6(src=3D"3ffe:250= 1:200:1fff::%d", dst=3D"3ffe:2501:200:3::%d", nh=3D132)/SCTP(sport=3D1024,d= port=3D1025,tag=3D1)], iface=3D"%s")' % ( mac, i + 1, i + 2, itf) self.tester.scapy_append(packet) @@ -136,13 +151,14 @@ cla= ss TestVfRss(TestCase): else: print "\ntran_type error!\n" =20 - #out =3D self.vm_dut_0.send_expect("stop", "testpmd>") out =3D self.vm_dut_0.get_session_output() print '*******************************************' print out - if not reta_entries: - self.verify('RSS hash=3D' in out, 'rss faied') - return=20 + if not reta_entries: + # for test_vfpmd_rss, check every queue can receive packet. + for i in range(queue): + self.verify('RSS queue=3D{}'.format(hex(i)) in out, 'queue= {} did not receive packets'.format(i)) + return lines =3D out.split("\r\n") out =3D '' reta_line =3D {} @@ -153,13 +169,12 @@ class TestVfRss(TestCase): if len(line) !=3D 0 and line.startswith(("src=3D",)): for item in line.split("-"): item =3D item.strip() - if(item.startswith("RSS hash")): + if item.startswith("RSS hash"): name, value =3D item.split("=3D", 1) print name + "-" + value - - reta_line[name.strip()] =3D value.strip() - reta_lines.append(reta_line) - reta_line =3D {} + reta_line[name.strip()] =3D value.strip() + reta_lines.append(reta_line) + reta_line =3D {} elif len(line) !=3D 0 and line.strip().startswith("port "): rexp =3D r"port (\d)/queue (\d{1,2}): received (\d) packet= s" m =3D re.match(rexp, line.strip()) @@ -171,7 +186,6 @@ cla= ss TestVfRss(TestCase): else: pass self.verifyResult() - =20 =20 def verifyResult(self): """ @@ -184,15 +198,19 @@ class TestVfRss(TestCase): ['packet index', 'hash value', 'hash index', 'queue id', 'actu= al queue id', 'pass ']) =20 i =3D 0 + self.verify(len(reta_lines) > 0, "The testpmd output has no RSS=20 + hash!") for tmp_reta_line in reta_lines: status =3D "false" if self.kdriver =3D=3D "fm10k": # compute the hash result of five tuple into the 7 LSBs va= lue. hash_index =3D int(tmp_reta_line["RSS hash"], 16) % 128 - else: + elif self.kdriver =3D=3D 'i40e' or self.nic in ['sageville', '= sagepond']: # compute the hash result of five tuple into the 7 LSBs va= lue. + hash_index =3D int(tmp_reta_line["RSS hash"], 16) % 64 + else: hash_index =3D int(tmp_reta_line["RSS hash"], 16) % 512 - if(reta_entries[hash_index] =3D=3D int(tmp_reta_line["queue"])= ): + + if reta_entries[hash_index] =3D=3D int(tmp_reta_line["queue"])= : status =3D "true" result.insert(i, 0) else: @@ -212,7 +230,8 @@ class TestVfRss(TestCase): """ =20 self.verify( - self.nic in ["niantic", "fortville_eagle", "fortville_spirit",= "fortville_spirit_single", "fortville_25g", "sageville", "fortpark_TLV"], + self.nic in ["redrockcanyou", "atwood", "boulderrapid", "fortv= ille_eagle", "fortville_spirit", + "fortville_spirit_single", "fortville_25g",=20 + "sageville", "sagepond", "fortpark_TLV"], "NIC Unsupported: " + str(self.nic)) self.dut_ports =3D self.dut.get_ports(self.nic) self.verify(len(self.dut_ports) >=3D 1, "Not enough ports availabl= e") @@ -237,6 +256,7 @@ class TestVfRss(TestCase): Run before each test case. """ pass + def setup_1pf_1vf_1vm_env(self, driver=3D'default'): =20 self.used_dut_port_0 =3D self.dut_ports[0] @@ -244,7 +264,6 @@ cla= ss TestVfRss(TestCase): self.sriov_vfs_port_0 =3D self.dut.ports_info[self.used_dut_port_0= ]['vfs_port'] =20 try: - for port in self.sriov_vfs_port_0: port.bind_driver(self.vf_driver) =20 @@ -254,7 +273,7 @@ class TestVfRss(TestCase): if driver =3D=3D 'igb_uio': # start testpmd without the two VFs on the host self.host_testpmd =3D PmdOutput(self.dut) - eal_param =3D '-b %(vf0)s -b %(vf1)s' % {'vf0': self.sriov= _vfs_port_0[0].pci} + eal_param =3D '-b %(vf0)s ' % {'vf0':=20 + self.sriov_vfs_port_0[0].pci} self.host_testpmd.start_testpmd("1S/2C/2T", eal_param=3Dea= l_param) =20 # set up VM0 ENV @@ -301,15 +320,23 @@ class TestVfRss(TestCase): =20 def test_vf_pmdrss_reta(self): =20 - # niantic kernel host driver not support this case - if self.nic is 'niantic' and not self.host_testpmd: - self.logger.warning("niantic kernel host driver not support th= is case") - return vm0dutPorts =3D self.vm_dut_0.get_ports('any') localPort =3D self.tester.get_local_port(vm0dutPorts[0]) itf =3D self.tester.get_interface(localPort) self.vm0_ports_socket =3D self.vm_dut_0.get_numa_id(vm0dutPorts[0]= ) - iptypes =3D ['IPV4'] + iptypes =3D { + 'ipv4-other': 'ip', + 'ipv4-frag': 'ip', + 'ipv4-udp': 'udp', + 'ipv4-tcp': 'tcp', + 'ipv4-sctp': 'sctp', + 'ipv6-other': 'ip', + 'ipv6-frag': 'ip', + 'ipv6-udp': 'udp', + 'ipv6-tcp': 'tcp', + 'ipv6-sctp': 'sctp', + # 'l2_payload': 'ether' + } =20 self.vm_dut_0.kill_all() =20 @@ -320,33 +347,42 @@ class TestVfRss(TestCase): self.vm0_testpmd.start_testpmd( "all", "--rxq=3D%d --txq=3D%d %s" % (queue, queue, eal_par= am), socket=3Dself.vm0_ports_socket) =20 - for iptype in iptypes: + for iptype, rss_type in iptypes.items(): self.vm_dut_0.send_expect("set verbose 8", "testpmd> ") self.vm_dut_0.send_expect("set fwd rxonly", "testpmd> ") self.vm_dut_0.send_expect( "set nbcore %d" % (queue + 1), "testpmd> ") =20 # configure the reta with specific mappings. - if(self.nic in ["niantic", "redrockcanyou", "atwood", "bou= lderrapid"]): + if self.nic in ["redrockcanyou", "atwood", "boulderrapid"]= : for i in range(128): reta_entries.insert(i, random.randint(0, queue - 1= )) self.vm_dut_0.send_expect( "port config 0 rss reta (%d,%d)" % (i, reta_en= tries[i]), "testpmd> ") + self.vm_dut_0.send_expect("port config all rss %s" % r= ss_type, "testpmd> ") + elif self.kdriver =3D=3D 'i40e' or self.nic in ['sageville= ', 'sagepond']: + for i in range(64): + reta_entries.insert(i, random.randint(0, queue - 1= )) + self.vm_dut_0.send_expect( + "port config 0 rss reta (%d,%d)" % (i, reta_en= tries[i]), "testpmd> ") + self.vm_dut_0.send_expect("port config all rss %s"=20 + % rss_type, "testpmd> ") else: for i in range(512): reta_entries.insert(i, random.randint(0, queue - 1= )) self.vm_dut_0.send_expect( "port config 0 rss reta (%d,%d)" % (i, reta_en= tries[i]), "testpmd> ") + self.vm_dut_0.send_expect("port config all rss %s"=20 + % rss_type, "testpmd> ") =20 - self.send_packet(itf, iptype) + self.send_packet(itf, iptype, queue) =20 self.vm_dut_0.send_expect("quit", "# ", 30) + def test_vf_pmdrss(self):=20 vm0dutPorts =3D self.vm_dut_0.get_ports('any') localPort =3D self.tester.get_local_port(vm0dutPorts[0]) itf =3D self.tester.get_interface(localPort) self.vm0_ports_socket =3D self.vm_dut_0.get_numa_id(vm0dutPorts[0]= ) - iptypes =3D {'ipv4-sctp':'ip', + iptypes =3D { 'ipv4-other':'ip', 'ipv4-udp':'udp', 'ipv4-tcp':'tcp', @@ -367,7 +403,7 @@ class TestVfRss(TestCase): self.vm0_testpmd.start_testpmd( "all", "--rxq=3D%d --txq=3D%d %s" % (queue, queue, eal_par= am), socket=3Dself.vm0_ports_socket) =20 - for iptype,rsstype in iptypes.items(): + for iptype, rsstype in iptypes.items(): self.vm_dut_0.send_expect("set verbose 8", "testpmd> ") self.vm_dut_0.send_expect("set fwd rxonly", "testpmd> ") out =3D self.vm_dut_0.send_expect("port config all rss %s"= % rsstype, "testpmd> ") @@ -375,9 +411,9 @@ class TestVfRss(TestCase): self.vm_dut_0.send_expect( "set nbcore %d" % (queue + 1), "testpmd> ") =20 - self.send_packet(itf, iptype) - + self.send_packet(itf, iptype, queue, 128) self.vm_dut_0.send_expect("quit", "# ", 30) + def tear_down(self): """ Run after each test case. -- 2.17.1