From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8FEF6A0548; Wed, 21 Apr 2021 10:08:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7B2C34195D; Wed, 21 Apr 2021 10:08:26 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id A755640140 for ; Wed, 21 Apr 2021 10:08:24 +0200 (CEST) IronPort-SDR: ITFzLqp3dZlcwsU5XY1NsOeValdeaytm8eKGjAU0U5mFewyD0NuV1/6C019tTXcPPd4CUHFGJE l41ZQLZHQzTQ== X-IronPort-AV: E=McAfee;i="6200,9189,9960"; a="195772709" X-IronPort-AV: E=Sophos;i="5.82,238,1613462400"; d="scan'208";a="195772709" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2021 01:08:23 -0700 IronPort-SDR: mfTjOS0ep5oirDGNU/oqAn6eLepm4jwmev97YWdrMWsSbU5befBGKdTPmvpknq9tfrFvlE/WaP 27AtmSr3+wNw== X-IronPort-AV: E=Sophos;i="5.82,238,1613462400"; d="scan'208";a="420896979" Received: from unknown (HELO localhost.localdomain) ([10.240.183.77]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2021 01:08:21 -0700 From: Bo Chen To: dts@dpdk.org Cc: Bo Chen Date: Wed, 21 Apr 2021 16:10:41 +0000 Message-Id: <20210421161041.103613-1-BoX.C.Chen@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dts] [PATCH V1] tests/rss_key_update: replace legacy filter with rte flow X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 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" 1. replace legacy filter command with rte flow. 2. reduce execution time 3. fix wrong running logic Signed-off-by: Bo Chen --- tests/TestSuite_rss_key_update.py | 99 +++++++++++++++++++------------ 1 file changed, 60 insertions(+), 39 deletions(-) diff --git a/tests/TestSuite_rss_key_update.py b/tests/TestSuite_rss_key_update.py index adb44f18..4a9e3d83 100644 --- a/tests/TestSuite_rss_key_update.py +++ b/tests/TestSuite_rss_key_update.py @@ -60,6 +60,7 @@ iptypes = {'ipv4-sctp': 'sctp', 'ipv6-frag': 'ip' } + class TestRssKeyUpdate(TestCase): def send_packet(self, itf, tran_type, symmetric): @@ -72,7 +73,7 @@ class TestRssKeyUpdate(TestCase): 'ipv4-frag': 'IP(src="192.168.0.%d", dst="192.168.0.%d",frag=1,flags="MF")', 'ipv4-udp': 'IP(src="192.168.0.%d", dst="192.168.0.%d")/UDP(sport=1024,dport=1024)', 'ipv4-tcp': 'IP(src="192.168.0.%d", dst="192.168.0.%d")/TCP(sport=1024,dport=1024)', - 'ipv6-other':'IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")', + 'ipv6-other': 'IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")', 'ipv6-sctp': 'IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d", nh=132)/SCTP(sport=1024,dport=1024,tag=1)', 'ipv6-udp': 'IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/UDP(sport=1024,dport=1024)', 'ipv6-tcp': 'IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/TCP(sport=1024,dport=1024)', @@ -86,12 +87,13 @@ class TestRssKeyUpdate(TestCase): # send packet with different source and dest ip if tran_type in packet_list.keys(): - packet_temp = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/%s], iface="%s")' % (mac, itf, packet_list[tran_type], itf) + packet_temp = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/%s], iface="%s")' % ( + mac, itf, packet_list[tran_type], itf) for i in range(10): packet = packet_temp % (i + 1, i + 2) self.tester.scapy_append(packet) if symmetric: - packet2 = packet_list[tran_type] % (mac, itf, i + 2, i + 1, itf) + packet2 = packet_temp % (i + 2, i + 1) self.tester.scapy_append(packet2) self.tester.scapy_execute() time.sleep(.5) @@ -124,12 +126,13 @@ class TestRssKeyUpdate(TestCase): reta_line[name.strip()] = value.strip() received_pkts.append(reta_line) - return(self.verifyResult(received_pkts, symmetric)) + return self.verifyResult(received_pkts, symmetric) def verifyResult(self, reta_lines, symmetric): """ Verify whether or not the result passes. """ + global pre_RSS_hash result = [] key_id = {} self.verify(len(reta_lines) > 0, 'No packet received!') @@ -137,15 +140,14 @@ class TestRssKeyUpdate(TestCase): ['packet index', 'hash value', 'hash index', 'queue id', 'actual queue id', 'pass ']) for i, tmp_reta_line in enumerate(reta_lines): - status = "false" # compute the hash result of five tuple into the 7 LSBs value. hash_index = int(tmp_reta_line["RSS hash"], 16) % reta_num - if(reta_entries[hash_index] == int(tmp_reta_line["queue"])): + if reta_entries[hash_index] == int(tmp_reta_line["queue"]): status = "true" result.insert(i, 0) if symmetric: - if(i % 2 == 1): - if(pre_RSS_hash == tmp_reta_line["RSS hash"]): + if i % 2 == 1: + if pre_RSS_hash == tmp_reta_line["RSS hash"]: status = "true" result.insert(len(reta_lines) + (i - 1) // 2, 0) else: @@ -168,9 +170,10 @@ class TestRssKeyUpdate(TestCase): Run at the start of each test suite. """ - self.verify(self.nic in ["columbiaville_25g", "columbiaville_100g","fortville_eagle", "fortville_spirit", - "fortville_spirit_single", "redrockcanyou", "atwood", - "boulderrapid", "fortpark_TLV", "fortpark_BASE-T","fortville_25g", "niantic", "carlsville", "foxville"], + self.verify(self.nic in ["columbiaville_25g", "columbiaville_100g", "fortville_eagle", "fortville_spirit", + "fortville_spirit_single", "redrockcanyou", "atwood", + "boulderrapid", "fortpark_TLV", "fortpark_BASE-T", "fortville_25g", "niantic", + "carlsville", "foxville"], "NIC Unsupported: " + str(self.nic)) global reta_num global iptypes @@ -179,7 +182,7 @@ class TestRssKeyUpdate(TestCase): queue = 4 if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", - "fortpark_BASE-T","fortville_25g", "carlsville"]: + "fortpark_BASE-T", "fortville_25g", "carlsville"]: reta_num = 512 elif self.nic in ["niantic", "foxville"]: reta_num = 128 @@ -224,27 +227,31 @@ class TestRssKeyUpdate(TestCase): self.dut.send_expect("set fwd rxonly", "testpmd> ") self.dut.send_expect("set promisc all off", "testpmd> ") self.dut.send_expect(f"set nbcore {queue + 1}", "testpmd> ") + key = '4439796BB54C5023B675EA5B124F9F30B8A2C03DDFDC4D02A08C9B334AF64A4C05C6FA343958D8557D99583AE138C92E81150366' + ck = '4439796BB54C50f3B675EF5B124F9F30B8A2C0FFFFDC4D02A08C9B334FF64A4C05C6FA343958D855FFF9583AE138C92E81150FFF' + + # configure the reta with specific mappings. + for i in range(reta_num): + reta_entries.insert(i, random.randint(0, queue - 1)) + self.dut.send_expect(f"port config 0 rss reta ({i},{reta_entries[i]})", "testpmd> ") for iptype, rsstype in list(iptypes.items()): self.logger.info(f"***********************{iptype} rss test********************************") - self.dut.send_expect("port stop all", "testpmd> ") - self.dut.send_expect(f"set_hash_global_config 0 toeplitz {iptype} enable", "testpmd> ") - self.dut.send_expect("port start all", "testpmd> ") + self.dut.send_expect(f"port config 0 rss-hash-key {iptype} {key}", "testpmd> ") + self.dut.send_expect("flow flush 0", "testpmd> ") + cmd = f'flow create 0 ingress pattern eth / ipv4 / end actions rss types {iptype} end queues end func toeplitz / end' + self.dut.send_expect(cmd, "testpmd> ") out = self.dut.send_expect(f"port config all rss {rsstype}", "testpmd> ") self.verify("error" not in out, "Configuration of RSS hash failed: Invalid argument") - # configure the reta with specific mappings. - for i in range(reta_num): - reta_entries.insert(i, random.randint(0, queue - 1)) - self.dut.send_expect(f"port config 0 rss reta ({i},{reta_entries[i]})", "testpmd> ") - ori_output = self.send_packet(self.itf, iptype, False) - self.dut.send_expect("show port 0 rss-hash key", "testpmd> ") - self.dut.send_expect(f"port config 0 rss-hash-key {iptype} 4439796BB54C50f3B675EF5B124F9F30B8A2C0FFFFDC4D02A08C9B334FF64A4C05C6FA343958D855FFF9583AE138C92E81150FFF", "testpmd> ") - + self.dut.send_expect(f"port config 0 rss-hash-key {iptype} {ck}", "testpmd> ") + self.dut.send_expect("flow flush 0", "testpmd> ") + cmd = f'flow create 0 ingress pattern eth / ipv4 / end actions rss types {iptype} end queues end func toeplitz / end' + self.dut.send_expect(cmd, "testpmd> ") new_output = self.send_packet(self.itf, iptype, False) - - self.verify(ori_output != new_output, "before and after results are the same, hash key configuration failed!") + self.verify(ori_output != new_output, + "before and after results are the same, hash key configuration failed!") def test_set_hash_key_toeplitz_symmetric(self): @@ -252,30 +259,44 @@ class TestRssKeyUpdate(TestCase): self.dut.send_expect("set fwd rxonly", "testpmd> ") self.dut.send_expect("set promisc all off", "testpmd> ") self.dut.send_expect(f"set nbcore {queue + 1}", "testpmd> ") + key = '4439796BB54C5023B675EA5B124F9F30B8A2C03DDFDC4D02A08C9B334AF64A4C05C6FA343958D8557D99583AE138C92E81150366' + ck = '4439796BB54C50f3B675EF5B124F9F30B8A2C0FFFFDC4D02A08C9B334FF64A4C05C6FA343958D855FFF9583AE138C92E81150FFF' + rule_action = 'func symmetric_toeplitz queues end / end' + + # configure the reta with specific mappings. + for i in range(reta_num): + reta_entries.insert(i, random.randint(0, queue - 1)) + self.dut.send_expect(f"port config 0 rss reta ({i},{reta_entries[i]})", "testpmd> ") for iptype, rsstype in list(iptypes.items()): self.logger.info(f"***********************{iptype} rss test********************************") - self.dut.send_expect("port stop all", "testpmd> ") - self.dut.send_expect(f"set_hash_global_config 0 toeplitz {iptype} enable", "testpmd> ") - self.dut.send_expect("set_sym_hash_ena_per_port 0 enable", "testpmd> ") - self.dut.send_expect("port start all", "testpmd> ") + self.dut.send_expect(f"port config 0 rss-hash-key {iptype} {key}", "testpmd> ") + self.dut.send_expect("flow flush 0", "testpmd> ") + rule_cmd = f'flow create 0 ingress pattern eth / ipv4 / end actions rss types {iptype} end queues end {rule_action}' + if 'sctp' in iptype or 'udp' in iptype or 'tcp' in iptype: + rule_cmd = rule_cmd.replace('/ ipv4 /', f'/ ipv4 / {rsstype} /') + if 'ipv6' in iptype: + rule_cmd = rule_cmd.replace('ipv4', 'ipv6') + + self.dut.send_expect(rule_cmd, "testpmd> ") out = self.dut.send_expect(f"port config all rss {rsstype}", "testpmd> ") self.verify("error" not in out, "configuration of rss hash failed: invalid argument") - - # configure the reta with specific mappings. - for i in range(reta_num): - reta_entries.insert(i, random.randint(0, queue - 1)) - self.dut.send_expect(f"port config 0 rss reta ({i},{reta_entries[i]})", "testpmd> ") - ori_output = self.send_packet(self.itf, iptype, True) - out = self.dut.send_expect("show port 0 rss-hash key", "testpmd> ") self.verify("rss disable" not in out, "rss is disable!") - self.dut.send_expect(f"port config 0 rss-hash-key {iptype} 4439796BB54C50f3B675EF5B124F9F30B8A2C0FFFFDC4D02A08C9B334FF64A4C05C6FA343958D855FFF9583AE138C92E81150FFF", "testpmd> ") + self.dut.send_expect(f"port config 0 rss-hash-key {iptype} {ck}", "testpmd> ") - new_output = self.send_packet(self.itf, iptype, True) + self.dut.send_expect("flow flush 0", "testpmd> ") + cmd = f'flow create 0 ingress pattern eth / ipv4 / end actions rss types {iptype} end queues end {rule_action}' + if 'sctp' in iptype or 'udp' in iptype or 'tcp' in iptype: + cmd = cmd.replace('/ ipv4 /', f'/ ipv4 / {rsstype} /') + if 'ipv6' in iptype: + cmd = cmd.replace('ipv4', 'ipv6') - self.verify(ori_output != new_output, "before and after results are the same, hash key configuration failed!") + self.dut.send_expect(cmd, "testpmd> ") + new_output = self.send_packet(self.itf, iptype, True) + self.verify(ori_output != new_output, + "before and after results are the same, hash key configuration failed!") def test_set_hash_key_short_long(self): -- 2.31.1