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 B5697A0518; Fri, 24 Jul 2020 04:01:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 720251D5D1; Fri, 24 Jul 2020 04:01:43 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 02C711C010 for ; Fri, 24 Jul 2020 04:01:41 +0200 (CEST) IronPort-SDR: QQf32oulnUrDTdc5v8eORKCRF4u4gzXJ7vmbRronEJ5us4mRa0BnARAVIlzciJad7Km/YRCYa7 XXlAmCYYtVLA== X-IronPort-AV: E=McAfee;i="6000,8403,9691"; a="148567261" X-IronPort-AV: E=Sophos;i="5.75,388,1589266800"; d="scan'208";a="148567261" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jul 2020 19:01:40 -0700 IronPort-SDR: qQqSGwHz86jRMIXouEjNnZIxIp4nVS9AyI7ImqovJS75DiBF/oizNVkHToU9czP6N7nD3vJquE 2w3RidkxZnXg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,388,1589266800"; d="scan'208";a="488578162" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga006.fm.intel.com with ESMTP; 23 Jul 2020 19:01:40 -0700 Received: from fmsmsx121.amr.corp.intel.com (10.18.125.36) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 23 Jul 2020 19:01:40 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx121.amr.corp.intel.com (10.18.125.36) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 23 Jul 2020 19:01:39 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.22]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.250]) with mapi id 14.03.0439.000; Fri, 24 Jul 2020 10:01:36 +0800 From: "Tu, Lijuan" To: David Liu , "dts@dpdk.org" CC: "lylavoie@iol.unh.edu" Thread-Topic: [dts] [PATCH v2]Add RSS Key Update Feature Thread-Index: AQHWWuPXvonqOKHawEus8CID0j3yIKkWBVrg Date: Fri, 24 Jul 2020 02:01:36 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BC83F2D@SHSMSX101.ccr.corp.intel.com> References: <20200715200853.6125-1-dliu@iol.unh.edu> In-Reply-To: <20200715200853.6125-1-dliu@iol.unh.edu> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH v2]Add RSS Key Update Feature 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" Hi David, V2 should be also based on DTS remote master, but not your local code. When V1 are not merged, we submit V2, V2 should cover V1+ fix comments base= d on DTS remote code, maintainer will ignore V1 and merge V2. It's not make= sense to merge patches with obvious defect.=20 > -----Original Message----- > From: dts On Behalf Of David Liu > Sent: 2020=1B$BG/=1B(B7=1B$B7n=1B(B16=1B$BF|=1B(B 4:09 > To: dts@dpdk.org > Cc: lylavoie@iol.unh.edu; David Liu > Subject: [dts] [PATCH v2]Add RSS Key Update Feature >=20 > Merge duplicated code. Add flag in send packet and verify result to ide= ntify > symmetric used. >=20 > Signed-off-by: David Liu > --- > tests/TestSuite_rss_key_update.py | 183 ++++++++---------------------- > 1 file changed, 46 insertions(+), 137 deletions(-) >=20 > diff --git a/tests/TestSuite_rss_key_update.py > b/tests/TestSuite_rss_key_update.py > index 0985f30..adb44f1 100644 > --- a/tests/TestSuite_rss_key_update.py > +++ b/tests/TestSuite_rss_key_update.py > @@ -39,7 +39,6 @@ Test the support of RSS Key Update by Poll Mode Drivers= . >=20 > import time > import re > -import packet > import random > import utils >=20 > @@ -63,85 +62,37 @@ iptypes =3D {'ipv4-sctp': 'sctp', >=20 > class TestRssKeyUpdate(TestCase): >=20 > - def send_packet(self, itf, tran_type): > + def send_packet(self, itf, tran_type, symmetric): > """ > Sends packets. > """ > + packet_list =3D { > + 'ipv4-sctp': 'IP(src=3D"192.168.0.%d", > dst=3D"192.168.0.%d")/SCTP(sport=3D1024,dport=3D1024,tag=3D1)', > + 'ipv4-other': 'IP(src=3D"192.168.0.%d", dst=3D"192.168.0.%d"= )', > + 'ipv4-frag': 'IP(src=3D"192.168.0.%d", > dst=3D"192.168.0.%d",frag=3D1,flags=3D"MF")', > + 'ipv4-udp': 'IP(src=3D"192.168.0.%d", > dst=3D"192.168.0.%d")/UDP(sport=3D1024,dport=3D1024)', > + 'ipv4-tcp': 'IP(src=3D"192.168.0.%d", > dst=3D"192.168.0.%d")/TCP(sport=3D1024,dport=3D1024)', > + 'ipv6-other':'IPv6(src=3D"3ffe:2501:200:1fff::%d", > dst=3D"3ffe:2501:200:3::%d")', > + 'ipv6-sctp': 'IPv6(src=3D"3ffe:2501:200:1fff::%d", > dst=3D"3ffe:2501:200:3::%d", nh=3D132)/SCTP(sport=3D1024,dport=3D1024,tag= =3D1)', > + 'ipv6-udp': 'IPv6(src=3D"3ffe:2501:200:1fff::%d", > dst=3D"3ffe:2501:200:3::%d")/UDP(sport=3D1024,dport=3D1024)', > + 'ipv6-tcp': 'IPv6(src=3D"3ffe:2501:200:1fff::%d", > dst=3D"3ffe:2501:200:3::%d")/TCP(sport=3D1024,dport=3D1024)', > + 'ipv6-frag': 'IPv6(src=3D"3ffe:2501:200:1fff::%d", > dst=3D"3ffe:2501:200:3::%d",nh=3D44)/IPv6ExtHdrFragment()' > + } > + > received_pkts =3D [] > self.tester.scapy_foreground() > self.dut.send_expect("start", "testpmd>") > mac =3D self.dut.get_mac_address(0) >=20 > # send packet with different source and dest ip > - if tran_type =3D=3D "ipv4-other": > - for i in range(10): > - packet =3D r'sendp([Ether(dst=3D"%s", > src=3Dget_if_hwaddr("%s"))/IP(src=3D"192.168.0.%d", dst=3D"192.168.0.%d")= ], > iface=3D"%s")' % ( > - mac, itf, 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(10): > - packet =3D r'sendp([Ether(dst=3D"%s", > src=3Dget_if_hwaddr("%s"))/IP(src=3D"192.168.0.%d", > dst=3D"192.168.0.%d")/TCP(sport=3D1024,dport=3D1024)], iface=3D"%s")' % ( > - mac, itf, 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(10): > - packet =3D r'sendp([Ether(dst=3D"%s", > src=3Dget_if_hwaddr("%s"))/IP(src=3D"192.168.0.%d", > dst=3D"192.168.0.%d")/UDP(sport=3D1024,dport=3D1024)], iface=3D"%s")' % ( > - mac, itf, 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(10): > - packet =3D r'sendp([Ether(dst=3D"%s", > src=3Dget_if_hwaddr("%s"))/IP(src=3D"192.168.0.%d", > dst=3D"192.168.0.%d")/SCTP(sport=3D1024,dport=3D1024,tag=3D1)], iface=3D"= %s")' % ( > - mac, itf, 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(10): > - packet =3D r'sendp([Ether(dst=3D"%s", > src=3Dget_if_hwaddr("%s"))/IP(src=3D"192.168.0.%d", > dst=3D"192.168.0.%d",frag=3D1,flags=3D"MF")], iface=3D"%s")' % ( > - mac, itf, i + 1, i + 2, itf) > - self.tester.scapy_append(packet) > - self.tester.scapy_execute() > - time.sleep(.5) > - > - elif tran_type =3D=3D "ipv6-other": > - for i in range(10): > - packet =3D r'sendp([Ether(dst=3D"%s", > src=3Dget_if_hwaddr("%s"))/IPv6(src=3D"3ffe:2501:200:1fff::%d", > dst=3D"3ffe:2501:200:3::%d")], iface=3D"%s")' % ( > - mac, itf, 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(10): > - packet =3D r'sendp([Ether(dst=3D"%s", > src=3Dget_if_hwaddr("%s"))/IPv6(src=3D"3ffe:2501:200:1fff::%d", > dst=3D"3ffe:2501:200:3::%d")/TCP(sport=3D1024,dport=3D1024)], iface=3D"%s= ")' % ( > - mac, itf, 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(10): > - packet =3D r'sendp([Ether(dst=3D"%s", > src=3Dget_if_hwaddr("%s"))/IPv6(src=3D"3ffe:2501:200:1fff::%d", > dst=3D"3ffe:2501:200:3::%d")/UDP(sport=3D1024,dport=3D1024)], iface=3D"%s= ")' % ( > - mac, itf, i + 1, i + 2, itf) > - self.tester.scapy_append(packet) > - self.tester.scapy_execute() > - time.sleep(.5) > - elif tran_type =3D=3D "ipv6-sctp": > + if tran_type in packet_list.keys(): > + packet_temp =3D r'sendp([Ether(dst=3D"%s", > + src=3Dget_if_hwaddr("%s"))/%s], iface=3D"%s")' % (mac, itf, > + packet_list[tran_type], itf) > for i in range(10): > - packet =3D r'sendp([Ether(dst=3D"%s", > src=3Dget_if_hwaddr("%s"))/IPv6(src=3D"3ffe:2501:200:1fff::%d", > dst=3D"3ffe:2501:200:3::%d", nh=3D132)/SCTP(sport=3D1024,dport=3D1024,tag= =3D1)], > iface=3D"%s")' % ( > - mac, itf, 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(10): > - packet =3D r'sendp([Ether(dst=3D"%s", > src=3Dget_if_hwaddr("%s"))/IPv6(src=3D"3ffe:2501:200:1fff::%d", > dst=3D"3ffe:2501:200:3::%d",nh=3D44)/IPv6ExtHdrFragment()], iface=3D"%s")= ' % ( > - mac, itf, i + 1, i + 2, itf) > + packet =3D packet_temp % (i + 1, i + 2) > self.tester.scapy_append(packet) > + if symmetric: > + packet2 =3D packet_list[tran_type] % (mac, itf, i + = 2, i + 1, itf) > + self.tester.scapy_append(packet2) > self.tester.scapy_execute() > time.sleep(.5) > else: > @@ -154,102 +105,64 @@ class TestRssKeyUpdate(TestCase): > # collect the hash result and the queue id > for line in lines: > line =3D line.strip() > - if len(line) !=3D 0 and line.strip().startswith("port "): > + if len(line) !=3D 0 and line.startswith("port "): > reta_line =3D {} > - rexp =3D r"port (\d)/queue (\d{1,2}): received (\d) pack= ets" > - m =3D re.match(rexp, line.strip()) > + rexp =3D r"port (\d+)/queue (\d+): received (\d+) packet= s" > + m =3D re.match(rexp, line) > if m: > reta_line["port"] =3D m.group(1) > reta_line["queue"] =3D m.group(2) >=20 > - elif len(line) !=3D 0 and line.startswith(("src=3D",)): > + elif len(line) !=3D 0 and line.startswith("src=3D"): > if "RSS hash" not in line: > continue > 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) >=20 > reta_line[name.strip()] =3D value.strip() > received_pkts.append(reta_line) >=20 > - return(self.verifyResult(received_pkts)) > + return(self.verifyResult(received_pkts, symmetric)) >=20 > - def verifyResult(self, reta_lines): > + def verifyResult(self, reta_lines, symmetric): > """ > Verify whether or not the result passes. > """ > - > - global reta_num > result =3D [] > key_id =3D {} > self.verify(len(reta_lines) > 0, 'No packet received!') > self.result_table_create( > ['packet index', 'hash value', 'hash index', 'queue id', 'ac= tual queue id', > 'pass ']) >=20 > - i =3D 0 > - > - for tmp_reta_line in reta_lines: > + for i, tmp_reta_line in enumerate(reta_lines): > status =3D "false" > # compute the hash result of five tuple into the 7 LSBs valu= e. > hash_index =3D int(tmp_reta_line["RSS hash"], 16) % reta_num > - print(reta_entries[hash_index], tmp_reta_line) > if(reta_entries[hash_index] =3D=3D int(tmp_reta_line["queue"= ])): > status =3D "true" > result.insert(i, 0) > + if symmetric: > + if(i % 2 =3D=3D 1): > + if(pre_RSS_hash =3D=3D tmp_reta_line["RSS hash"]= ): > + status =3D "true" > + result.insert(len(reta_lines) + (i - 1) // 2= , 0) > + else: > + status =3D "fail" > + result.insert(len(reta_lines) + (i - 1) // 2= , 1) > + pre_RSS_hash =3D tmp_reta_line["RSS hash"] > else: > status =3D "fail" > result.insert(i, 1) > self.result_table_add( > [i, tmp_reta_line["RSS hash"], hash_index, reta_entries[= hash_index], > tmp_reta_line["queue"], status]) > - i =3D i + 1 > - key_id[tmp_reta_line["RSS hash"]]=3Dreta_entries[hash_index] > + key_id[tmp_reta_line["RSS hash"]] =3D > + reta_entries[hash_index] >=20 > self.result_table_print() > self.verify(sum(result) =3D=3D 0, "the reta update function fail= ed!") > return key_id >=20 > - def verifyResult_symmetric(self, reta_lines): > - """ > - Verify whether or not the result passes. > - """ > - > - global reta_num > - result =3D [] > - key_id =3D {} > - self.verify(len(reta_lines) > 0, 'No packet received!') > - self.result_table_create( > - ['packet index', 'RSS hash', 'hash index', 'queue id', 'actu= al queue id', 'pass > ']) > - > - i =3D 0 > - for tmp_reta_line in reta_lines: > - status =3D "false" > - # compute the hash result of five tuple into the 7 LSBs valu= e. > - hash_index =3D int(tmp_reta_line["RSS hash"], 16) % reta_num > - if(reta_entries[hash_index] =3D=3D int(tmp_reta_line["queue"= ])): > - status =3D "true" > - result.insert(i, 0) > - if(i % 2 =3D=3D 1): > - if(pre_RSS_hash =3D=3D tmp_reta_line["RSS hash"]): > - status =3D "true" > - result.insert(len(reta_lines) + (i - 1) // 2, 0) > - else: > - status =3D "fail" > - result.insert(len(reta_lines) + (i - 1) // 2, 1) > - pre_RSS_hash =3D tmp_reta_line["RSS hash"] > - else: > - status =3D "fail" > - result.insert(i, 1) > - self.result_table_add( > - [i, tmp_reta_line["RSS hash"], hash_index, reta_entries[= hash_index], > tmp_reta_line["queue"], status]) > - i =3D i + 1 > - key_id[tmp_reta_line["RSS hash"]]=3Dreta_entries[hash_index] > - > - self.result_table_print() > - self.verify( > - sum(result) =3D=3D 0, "the symmetric RSS hash function faile= d!") > - return key_id > - > def set_up_all(self): > """ > Run at the start of each test suite. > @@ -282,7 +195,7 @@ class TestRssKeyUpdate(TestCase): > elif self.nic in ["redrockcanyou", "atwood", "boulderrapid"]: > reta_num =3D 128 > else: > - self.verify(False, f"NIC Unsupported:{self.nic}") > + self.verify(False, f"NIC Unsupported: {self.nic}") >=20 > cores =3D self.dut.get_core_list("all") > self.coremask =3D utils.create_mask(cores) @@ -300,8 +213,6 @@ c= lass > TestRssKeyUpdate(TestCase): > dutPorts =3D self.dut.get_ports(self.nic) > localPort =3D self.tester.get_local_port(dutPorts[0]) > self.itf =3D self.tester.get_interface(localPort) > - global reta_num > - global iptypes >=20 > self.dut.kill_all() >=20 > @@ -326,12 +237,12 @@ class TestRssKeyUpdate(TestCase): > reta_entries.insert(i, random.randint(0, queue - 1)) > self.dut.send_expect(f"port config 0 rss reta ({i},{reta= _entries[i]})", > "testpmd> ") >=20 > - ori_output =3D self.send_packet(self.itf, iptype) > + ori_output =3D self.send_packet(self.itf, iptype, False) >=20 > self.dut.send_expect("show port 0 rss-hash key", "testpmd> "= ) > self.dut.send_expect(f"port config 0 rss-hash-key {iptype} > 4439796BB54C50f3B675EF5B124F9F30B8A2C0FFFFDC4D02A08C9B334FF64A4C > 05C6FA343958D855FFF9583AE138C92E81150FFF", "testpmd> ") >=20 > - new_output =3D self.send_packet(self.itf, iptype) > + new_output =3D self.send_packet(self.itf, iptype, False) >=20 > self.verify(ori_output !=3D new_output, "before and after re= sults are the > same, hash key configuration failed!") >=20 > @@ -356,16 +267,15 @@ class TestRssKeyUpdate(TestCase): > reta_entries.insert(i, random.randint(0, queue - 1)) > self.dut.send_expect(f"port config 0 rss reta ({i},{reta= _entries[i]})", > "testpmd> ") >=20 > - ori_output =3D self.send_packet(self.itf, iptype) > + ori_output =3D self.send_packet(self.itf, iptype, True) >=20 > out =3D self.dut.send_expect("show port 0 rss-hash key", "te= stpmd> ") > self.verify("rss disable" not in out, "rss is disable!") > self.dut.send_expect(f"port config 0 rss-hash-key {iptype} > 4439796BB54C50f3B675EF5B124F9F30B8A2C0FFFFDC4D02A08C9B334FF64A4C > 05C6FA343958D855FFF9583AE138C92E81150FFF", "testpmd> ") >=20 > - new_output =3D self.send_packet(self.itf, iptype) > + new_output =3D self.send_packet(self.itf, iptype, True) >=20 > self.verify(ori_output !=3D new_output, "before and after re= sults are the > same, hash key configuration failed!") > - self.dut.send_expect("quit", "# ", 30) >=20 > def test_set_hash_key_short_long(self): >=20 > @@ -384,26 +294,25 @@ class TestRssKeyUpdate(TestCase): > out =3D self.dut.send_expect("show port info all", "testpmd> ", = 120) > self.verify(f"Hash key size in bytes: {nic_rss_key_size[self.nic= ]}" in out, "not > expected hash key size!") >=20 > - test_keies =3D { > + test_keys =3D { >=20 > "4439796BB54C50f3B675EF5B124F9F30B8A2C0FFFFDC4D02A08C9B334FF64A4 > C05C6FA343958D855FFF9583AE138C92E81150FFFFF": "longer", >=20 > "4439796BB54C50f3B675EF5B124F9F30B8A2C0DC4D02A08C9B334FF64A4C05C > 6FA343958D855FFF9583AE138C92E81150FFF": "shorter", > } >=20 > # config key length longer/shorter than 104 hexa-decimal numbers > - for key, error in test_keies.items(): > + for key, error in test_keys.items(): > out =3D self.dut.send_expect(f"port config 0 rss-hash-key ip= v4-udp {key}", > "testpmd> ") > self.verify("invalid" in out, f"Try to set hash key {error} = than 104 hexa- > decimal numbers!") >=20 > # config ket length same as 104 hex-decimal numbers and keep the= config > key =3D > "4439796BB54C50f3B675EF5B124F9F30B8A2C0FFFFDC4D02A08C9B334FF64A4 > C05C6FA343958D855FFF9583AE138C92E81150FFF" > out =3D self.dut.send_expect(f"port config 0 rss-hash-key ipv4-u= dp {key}", > "testpmd> ") > - self.dut.send_expect("quit", "# ", 30) >=20 > def tear_down(self): > """ > Run after each test case. > """ > - self.dut.send_expect("quit", "# ", 30) > + self.pmdout.quit() >=20 > def tear_down_all(self): > """ > -- > 2.17.1