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 17C66A00C5; Thu, 11 Jun 2020 15:22:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0A8851252; Thu, 11 Jun 2020 15:22:49 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id B658CA3 for ; Thu, 11 Jun 2020 15:22:46 +0200 (CEST) IronPort-SDR: LEHx4ua1efgEoJ6PD14gzFnu3LC9MA81qEHOKuKCGsR6TS4jo7j33PrCkdKbGflVBNuMOe8ZeT ZZYwobxiEDOA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2020 06:22:45 -0700 IronPort-SDR: 8EDDM2OF5ViDOmj8qUD8mihR7MC14CEzoyRhnKmI4DoPzq9aItYiNGXUDgFRkyMXooNlnE5xkv t8brVixMoqLg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,499,1583222400"; d="scan'208";a="447924695" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga005.jf.intel.com with ESMTP; 11 Jun 2020 06:22:45 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 11 Jun 2020 06:22:44 -0700 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 11 Jun 2020 06:22:44 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.85]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.185]) with mapi id 14.03.0439.000; Thu, 11 Jun 2020 21:22:40 +0800 From: "Tu, Lijuan" To: "Peng, Yuan" , "dts@dpdk.org" CC: "Peng, Yuan" Thread-Topic: [dts] [PATCH]tests: rework scripts due to command change in i40e Thread-Index: AQHWPiuy08fWUScOg0WRqZ0fIUVoSqjTamXA Date: Thu, 11 Jun 2020 13:22:39 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BC5BE28@SHSMSX101.ccr.corp.intel.com> References: <1591711629-139754-1-git-send-email-yuan.peng@intel.com> In-Reply-To: <1591711629-139754-1-git-send-email-yuan.peng@intel.com> 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]tests: rework scripts due to command change in i40e 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" Applied, thanks -----Original Message----- From: dts On Behalf Of Peng Yuan Sent: 2020=1B$BG/=1B(B6=1B$B7n=1B(B9=1B$BF|=1B(B 22:07 To: dts@dpdk.org Cc: Peng, Yuan Subject: [dts] [PATCH]tests: rework scripts due to command change in i40e rework scripts due to command change in i40e. devide cases for i40e and ixgbe/igb. Signed-off-by: Peng Yuan diff --git a/tests/TestSuite_rss_to_rte_flow.py b/tests/TestSuite_rss_to_rt= e_flow.py index dd7c869..0745d24 100644 --- a/tests/TestSuite_rss_to_rte_flow.py +++ b/tests/TestSuite_rss_to_rte_flow.py @@ -54,27 +54,41 @@ class TestRSS_to_Rteflow(TestCase): # Based on h/w type, choose how many ports to use self.dut_ports =3D self.dut.get_ports(self.nic) # Verify that enough ports are available - self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports") - - localPort =3D self.tester.get_local_port(self.dut_ports[0]) - self.tester_itf =3D self.tester.get_interface(localPort) - self.tester_mac =3D self.tester.get_mac(localPort) - self.pf_interface =3D self.dut.ports_info[self.dut_ports[0]]['intf= '] - self.pf_mac =3D self.dut.get_mac_address(0) - self.pf_pci =3D self.dut.ports_info[self.dut_ports[0]]['pci'] + self.verify(len(self.dut_ports) >=3D 2, "Insufficient ports") + self.pmd_output =3D PmdOutput(self.dut) + + localPort0 =3D self.tester.get_local_port(self.dut_ports[0]) + localPort1 =3D self.tester.get_local_port(self.dut_ports[1]) + + self.tester0_itf =3D self.tester.get_interface(localPort0) + self.tester1_itf =3D self.tester.get_interface(localPort1) + + self.tester0_mac =3D self.tester.get_mac(localPort0) + self.tester1_mac =3D self.tester.get_mac(localPort1) + + self.pf0_interface =3D self.dut.ports_info[self.dut_ports[0]]['int= f'] + self.pf1_interface =3D self.dut.ports_info[self.dut_ports[1]]['int= f'] + + self.pf0_mac =3D self.dut.get_mac_address(0) + self.pf1_mac =3D self.dut.get_mac_address(1) + self.pf0_pci =3D self.dut.ports_info[self.dut_ports[0]]['pci'] + self.pf1_pci =3D self.dut.ports_info[self.dut_ports[1]]['pci'] self.pmdout =3D PmdOutput(self.dut) self.cores =3D "1S/2C/1T" - self.pkt1 =3D "Ether(dst=3D'%s')/IP(src=3D'10.0.0.1',dst=3D'192.16= 8.0.2')/SCTP(dport=3D80, sport=3D80)/('X'*48)" % self.pf_mac - self.pkt2 =3D "Ether(dst=3D'%s')/IP(src=3D'10.0.0.1',dst=3D'192.16= 8.0.2')/UDP(dport=3D50, sport=3D50)/('X'*48)" % self.pf_mac - self.pkt3 =3D "Ether(dst=3D'%s')/IP(src=3D'10.0.0.1',dst=3D'192.16= 8.0.3')/TCP(dport=3D50, sport=3D50)/('X'*48)" % self.pf_mac - self.pkt4 =3D "Ether(dst=3D'%s')/IP(src=3D'10.0.0.1',dst=3D'192.16= 8.0.2')/('X'*48)" % self.pf_mac - self.pkt5 =3D "Ether(dst=3D'%s')/IPv6(src=3D'2001::1',dst=3D'2001:= :2',nh=3D132)/SCTP(dport=3D80, sport=3D80)/('X'*48)" % self.pf_mac - self.pkt6 =3D "Ether(dst=3D'%s')/IPv6(src=3D'2001::1',dst=3D'2001:= :2')/UDP(dport=3D50, sport=3D50)/('X'*48)" % self.pf_mac - self.pkt7 =3D "Ether(dst=3D'%s')/IPv6(src=3D'2001::2',dst=3D'2001:= :3')/TCP(dport=3D50, sport=3D50)/('X'*48)" % self.pf_mac - self.pkt8 =3D "Ether(dst=3D'%s')/IPv6(src=3D'2001::2',dst=3D'2001:= :3')/('X'*48)" % self.pf_mac - self.prio_pkt1 =3D "Ether(dst=3D'%s')/Dot1Q(prio=3D1)/IP(src=3D'10= .0.0.1',dst=3D'192.168.0.2')/TCP(dport=3D80, sport=3D80)/('X'*48)" % self.p= f_mac - self.prio_pkt2 =3D "Ether(dst=3D'%s')/Dot1Q(prio=3D2)/IP(src=3D'10= .0.0.1',dst=3D'192.168.0.2')/TCP(dport=3D80, sport=3D80)/('X'*48)" % self.p= f_mac - self.prio_pkt3 =3D "Ether(dst=3D'%s')/Dot1Q(prio=3D3)/IP(src=3D'10= .0.0.1',dst=3D'192.168.0.2')/TCP(dport=3D80, sport=3D80)/('X'*48)" % self.p= f_mac + self.pkt1 =3D "Ether(dst=3D'%s')/IP(src=3D'10.0.0.1',dst=3D'192.16= 8.0.2')/SCTP(dport=3D80, sport=3D80)/('X'*48)" % self.pf0_mac + self.pkt2 =3D "Ether(dst=3D'%s')/IP(src=3D'10.0.0.1',dst=3D'192.16= 8.0.2', proto=3D17)/UDP(dport=3D50, sport=3D50)/('X'*48)" % self.pf0_mac + self.pkt3 =3D "Ether(dst=3D'%s')/IP(src=3D'10.0.0.1',dst=3D'192.16= 8.0.3')/TCP(dport=3D50, sport=3D50)/('X'*48)" % self.pf0_mac + self.pkt4 =3D "Ether(dst=3D'%s')/IP(src=3D'10.0.0.1',dst=3D'192.16= 8.0.2')/('X'*48)" % self.pf0_mac + self.pkt5 =3D "Ether(dst=3D'%s')/IPv6(src=3D'2001::1',dst=3D'2001:= :2',nh=3D132)/SCTP(dport=3D80, sport=3D80)/('X'*48)" % self.pf0_mac + self.pkt6 =3D "Ether(dst=3D'%s')/IPv6(src=3D'2001::1',dst=3D'2001:= :2')/UDP(dport=3D50, sport=3D50)/('X'*48)" % self.pf0_mac + self.pkt7 =3D "Ether(dst=3D'%s')/IPv6(src=3D'2001::2',dst=3D'2001:= :3')/TCP(dport=3D50, sport=3D50)/('X'*48)" % self.pf0_mac + self.pkt8 =3D "Ether(dst=3D'%s')/IPv6(src=3D'2001::2',dst=3D'2001:= :3')/('X'*48)" % self.pf0_mac + self.pkt9 =3D "Ether(dst=3D'%s')/IP(src=3D'10.0.0.1',dst=3D'192.16= 8.0.2', frag=3D1)/Raw('X'*48)" % self.pf0_mac + self.pkt10 =3D "Ether(dst=3D'%s')/IPv6(dst=3D'CDCD:910A:2222:5498:= 8475:1111:3900:2020', nh=3D44)/('X'*48)" % self.pf0_mac + self.pkt11 =3D "Ether(dst=3D'%s', type=3D0x0807)/Raw(load=3D'\x61\= x62\x63\x64')" % self.pf0_mac + self.prio_pkt1 =3D "Ether(dst=3D'%s')/Dot1Q(prio=3D1)/IP(src=3D'10= .0.0.1',dst=3D'192.168.0.2')/TCP(dport=3D80, sport=3D80)/('X'*48)" % self.p= f0_mac + self.prio_pkt2 =3D "Ether(dst=3D'%s')/Dot1Q(prio=3D2)/IP(src=3D'10= .0.0.1',dst=3D'192.168.0.2')/TCP(dport=3D80, sport=3D80)/('X'*48)" % self.p= f0_mac + self.prio_pkt3 =3D "Ether(dst=3D'%s')/Dot1Q(prio=3D3)/IP(src=3D'10= .0.0.1',dst=3D'192.168.0.2')/TCP(dport=3D80, sport=3D80)/('X'*48)" % self.p= f0_mac =20 def set_up(self): """ @@ -89,57 +103,114 @@ class TestRSS_to_Rteflow(TestCase): self.dut.send_expect("quit", "# ") time.sleep(2) =20 - def get_queue_number(self): + def get_queue_number(self, port_id=3D0): """ get the queue which packet enter. """ outstring =3D self.pmdout.get_output() - result_scanner =3D r'port\s?%s/queue\s?(\d+):\s?received \d+ packe= ts' % self.dut_ports[0] - scanner =3D re.compile(result_scanner, re.DOTALL) + print(outstring) + scanner =3D re.compile(r"port\s?%d/queue\s?(\d+):\s?received \d+ p= ackets" % port_id) m =3D scanner.search(outstring) queue_id =3D m.group(1) print(("queue is %s" % queue_id)) - self.pmdout.execute_cmd("clear port stats all") + self.dut.send_expect("clear port stats all", "NIC statistics for p= ort 1 cleared", 20) return queue_id =20 - def send_and_check(self, pkt, rss_queue): + def send_and_check(self, pkts, rss_queue, port_id=3D0): """ send packet and check the result """ - self.tester.scapy_append('sendp(%s, iface=3D"%s")' % (pkt, self.te= ster_itf)) - self.tester.scapy_execute() - queue =3D self.get_queue_number() - self.verify(queue in rss_queue, "the packet doesn't enter the expe= cted RSS queue.") - return queue + itf =3D self.tester0_itf if port_id =3D=3D 0 else self.tester1_itf + queue_list =3D [] + if isinstance(pkts, list): + for pkt in pkts: + self.tester.scapy_append('sendp(%s, iface=3D"%s")' % (pkt,= itf)) + self.tester.scapy_execute() + queue =3D self.get_queue_number(port_id) + self.verify(queue in rss_queue, "the packet doesn't enter = the expected RSS queue.") + queue_list.append(queue) + else: + self.tester.scapy_append('sendp(%s, iface=3D"%s")' % (pkts, it= f)) + self.tester.scapy_execute() + queue =3D self.get_queue_number(port_id) + self.verify(queue in rss_queue, "the packet doesn't enter the = expected RSS queue.") + queue_list.append(queue) + return queue_list =20 - def send_packet(self, ptype, itf): + def send_packet(self, ptype, port_id=3D0): """ Sends packets. """ pkt_list =3D [] - for i in range(128): - if ptype =3D=3D "ipv4-udp": - scapy_pkt =3D 'Ether(dst=3D"%s", src=3D"%s")/IP(src=3D"192= .168.0.%d", dst=3D"192.168.0.%d")/UDP(dport=3D%d, sport=3D%d)' % ( - self.pf_mac, self.tester_mac, i + 1, i + 2, i + 21, i = + 22) - elif ptype =3D=3D "ipv4-other": - scapy_pkt =3D 'Ether(dst=3D"%s", src=3D"%s")/IP(src=3D"192= .168.0.%d", dst=3D"192.168.0.%d")' % (self.pf_mac, self.tester_mac, i + 1, = i + 2) - pkt_list.append(scapy_pkt) + if ptype =3D=3D "ipv4-udp": + for i in range(100): + scapy_pkt =3D 'Ether(dst=3D"%s")/IP(src=3D"192.168.0.%d", = dst=3D"192.168.0.%d")/UDP(dport=3D%d, sport=3D%d)' % ( + self.pf0_mac, i + 1, i + 2, i + 21, i + 22) + pkt_list.append(scapy_pkt) + elif ptype =3D=3D "ipv4-other": + for i in range(100): + scapy_pkt =3D 'Ether(dst=3D"%s")/IP(src=3D"192.168.0.%d", = dst=3D"192.168.0.%d")' % (self.pf0_mac, i + 1, i + 2) + pkt_list.append(scapy_pkt) + elif ptype =3D=3D "ipv4-tcp": + for i in range(100): + scapy_pkt =3D 'Ether(dst=3D"%s")/IP(src=3D"192.168.0.%d", = dst=3D"192.168.0.%d")/TCP(dport=3D%d, sport=3D%d)' % ( + self.pf0_mac, i + 1, i + 2, i + 21, i + 22) + pkt_list.append(scapy_pkt) + elif ptype =3D=3D "ipv4-sctp": + for i in range(100): + scapy_pkt =3D 'Ether(dst=3D"%s")/IP(src=3D"192.168.0.%d", = dst=3D"192.168.0.%d")/SCTP(dport=3D%d, sport=3D%d)' % ( + self.pf0_mac, i + 1, i + 2, i + 21, i + 22) + pkt_list.append(scapy_pkt) + elif ptype =3D=3D "ipv4-frag": + for i in range(100): + scapy_pkt =3D 'Ether(dst=3D"%s")/IP(src=3D"192.168.0.%d", = dst=3D"192.168.0.%d",frag=3D1,flags=3D"MF")' % (self.pf0_mac, i + 1, i + 2) + pkt_list.append(scapy_pkt) + elif ptype =3D=3D "ipv6-other": + for i in range(100): + scapy_pkt =3D 'Ether(dst=3D"%s")/IPv6(src=3D"3ffe:2501:200= :1fff::%d", dst=3D"3ffe:2501:200:3::%d")' % (self.pf0_mac, i + 1, i + 2) + pkt_list.append(scapy_pkt) + elif ptype =3D=3D "ipv6-frag": + for i in range(100): + scapy_pkt =3D 'Ether(dst=3D"%s")/IPv6(src=3D"3ffe:2501:200= :1fff::%d", dst=3D"3ffe:2501:200:3::%d",nh=3D44)/IPv6ExtHdrFragment()' % (s= elf.pf0_mac, i + 1, i + 2) + pkt_list.append(scapy_pkt) + elif ptype =3D=3D "ipv6-udp": + for i in range(100): + scapy_pkt =3D 'Ether(dst=3D"%s")/IPv6(src=3D"3ffe:2501:200= :1fff::%d", dst=3D"3ffe:2501:200:3::%d")/UDP(dport=3D%d, sport=3D%d)' % ( + self.pf0_mac, i + 1, i + 2, i + 21, i + 22) + pkt_list.append(scapy_pkt) + elif ptype =3D=3D "ipv6-tcp": + for i in range(100): + scapy_pkt =3D 'Ether(dst=3D"%s")/IPv6(src=3D"3ffe:2501:200= :1fff::%d", dst=3D"3ffe:2501:200:3::%d")/TCP(dport=3D%d, sport=3D%d)' % ( + self.pf0_mac, i + 1, i + 2, i + 21, i + 22) + pkt_list.append(scapy_pkt) + elif ptype =3D=3D "ipv6-sctp": + for i in range(100): + scapy_pkt =3D 'Ether(dst=3D"%s")/IPv6(src=3D"3ffe:2501:200= :1fff::%d", dst=3D"3ffe:2501:200:3::%d", nh=3D132)/SCTP(dport=3D%d, sport= =3D%d)' % ( + self.pf0_mac, i + 1, i + 2, i + 21, i + 22) + pkt_list.append(scapy_pkt) + + elif ptype =3D=3D "l2-payload": + for i in range(100): + scapy_pkt =3D r'Ether(dst=3D"%s", type=3D0x08%s)/Raw(load= =3D"\x61\x62\x63\x64")' % (self.pf0_mac, str(i) if (len(str(i)) =3D=3D 2) e= lse ("0"+str(i))) + pkt_list.append(scapy_pkt) =20 pkt =3D packet.Packet() pkt.update_pkt(pkt_list) + itf =3D self.tester0_itf if port_id =3D=3D 0 else self.tester1_itf pkt.send_pkt(self.tester, tx_port=3Ditf) =20 - def check_packet_queue(self, queue, out): + def check_packet_queue(self, queue, out, port_id=3D0): """ get the queue which packet enter. """ time.sleep(2) if queue =3D=3D "all": - self.verify("Queue=3D 0" in out and "Queue=3D 1" in out and "Q= ueue=3D 2" in out and "Queue=3D 3" in out, + self.verify("RX Port=3D %d/Queue=3D 0" % port_id in out and "R= X Port=3D %d/Queue=3D 1" % port_id in out and "RX Port=3D %d/Queue=3D 2" % = port_id in out and "RX Port=3D %d/Queue=3D 3" % port_id in out, "There is some queues doesn't work.") elif queue =3D=3D "0": - self.verify("Queue=3D 0" in out and "Queue=3D 1" not in out an= d "Queue=3D 2" not in out and "Queue=3D 3" not in out, + self.verify("RX Port=3D %d/Queue=3D 0" % port_id in out and "R= X Port=3D %d/Queue=3D 1" % port_id not in out and "RX Port=3D %d/Queue=3D 2= " % port_id not in out and "RX Port=3D %d/Queue=3D 3" % port_id not in out, "RSS is enabled.") + lines =3D out.split("\r\n") reta_line =3D {} queue_flag =3D 0 @@ -154,262 +225,315 @@ class TestRSS_to_Rteflow(TestCase): packet_num =3D m.group(1) packet_sumnum =3D packet_sumnum + int(packet_num) queue_flag =3D 0 - elif line.strip().startswith("------- Forward"): + elif line.strip().startswith("------- Forward Stats for RX Por= t=3D %d" % port_id): queue_flag =3D 1 - elif line.strip().startswith("RX-packets"): + elif line.strip().startswith("+++++++++++++++ Accumulated"): + queue_flag =3D 2 + elif line.strip().startswith("RX-packets") and queue_flag =3D= =3D 2: result_scanner =3D r"RX-packets:\s?([0-9]+)" scanner =3D re.compile(result_scanner, re.DOTALL) m =3D scanner.search(line) packet_rec =3D m.group(1) =20 - self.verify(packet_sumnum =3D=3D int(packet_rec) =3D=3D 128, "Ther= e are some packets lost.") + self.verify(packet_sumnum =3D=3D int(packet_rec) =3D=3D 100, "Ther= e are some packets lost.") =20 - def test_disable_enable_rss(self): + def send_check_100_packet_queue(self, ptype_list, queue, port_id=3D0): """ - Disable and enable RSS. + send 100 packets and get the queues distributed result. """ - self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D4 --txq=3D4 = --port-topology=3Dchained") - self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) - self.dut.send_expect("set verbose 1", "testpmd> ", 120) - self.dut.send_expect("start", "testpmd> ", 120) - time.sleep(2) - - # Show port default RSS functions - if (self.nic in ["fortville_eagle", "fortville_spirit", "carlsvill= e", - "fortville_spirit_single", "fortpark_TLV","fortpa= rk_BASE-T", "fortville_25g"]): - self.dut.send_expect( - "show port 0 rss-hash", "ipv4-frag ipv4-other ipv6-frag ip= v6-other ip") + if isinstance(ptype_list, list): + for ptype in ptype_list: + self.send_packet(ptype, port_id) + out =3D self.dut.send_expect("stop", "testpmd> ") + if isinstance(queue, list): + self.check_packet_selected_queue(queue, out, port_id) + else: + self.check_packet_queue(queue, out, port_id) + self.dut.send_expect("start", "testpmd> ", 120) else: - self.dut.send_expect( - "show port 0 rss-hash", "ipv4 ipv6 ipv6-ex ip") - self.send_packet("ipv4-other", self.tester_itf) - out =3D self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue("all", out) - self.dut.send_expect("start", "testpmd> ", 120) + self.send_packet(ptype_list, port_id) + out =3D self.dut.send_expect("stop", "testpmd> ", 120) + if isinstance(queue, list): + self.check_packet_selected_queue(queue, out, port_id) + else: + self.check_packet_queue(queue, out, port_id) + self.dut.send_expect("start", "testpmd> ", 120) =20 - # Disable RSS hash function - self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types none end = / end", "created") - if self.nic =3D=3D 'foxville': - self.dut.send_expect("flow flush 0", "testpmd> ") - self.dut.send_expect( - "show port 0 rss-hash", "RSS disabled") - # send the packets and verify the results - self.send_packet("ipv4-other", self.tester_itf) - out =3D self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue("0", out) - self.dut.send_expect("start", "testpmd> ", 120) + def check_packet_selected_queue(self, queues, out, port_id=3D0): + """ + get the queue which packet enter. + """ + time.sleep(2) + for queue in queues: + self.verify("RX Port=3D %d/Queue=3D %s" % (port_id, queue) in = out, + "The packets are not distributed to expected queue.") =20 - # Enable RSS hash function all - self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types all end /= end", "created") - if (self.nic in ["fortville_eagle", "fortville_spirit", "carlsvill= e", - "fortville_spirit_single", "fortpark_TLV","fortpa= rk_BASE-T", "fortville_25g"]): - self.dut.send_expect( - "show port 0 rss-hash", "all ipv4-frag ipv4-tcp ipv4-udp i= pv4-sctp ipv4-other ipv6-frag ipv6-tcp ipv6-udp ipv6-sctp ipv6-other l2-pay= load ip udp tcp sctp") - else: - self.dut.send_expect( - "show port 0 rss-hash", "all ipv4 ipv4-tcp ipv4-udp ipv6 i= pv6-tcp ipv6-udp ipv6-ex ipv6-tcp-ex ipv6-udp-ex ip udp tcp") - # send the packets and verify the results - self.send_packet("ipv4-other", self.tester_itf) - out =3D self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue("all", out) + lines =3D out.split("\r\n") + reta_line =3D {} + queue_flag =3D 0 + packet_sumnum =3D 0 + # collect the hash result and the queue id + for line in lines: + line =3D line.strip() + if queue_flag =3D=3D 1: + result_scanner =3D r"RX-packets:\s?([0-9]+)" + scanner =3D re.compile(result_scanner, re.DOTALL) + m =3D scanner.search(line) + packet_num =3D m.group(1) + packet_sumnum =3D packet_sumnum + int(packet_num) + queue_flag =3D 0 + elif line.strip().startswith("------- Forward Stats for RX Por= t=3D %d" % port_id): + result =3D re.search(r"------- Forward Stats for RX Port= =3D\s*\d*/Queue=3D\s*(\d*)", line) + if result.group(1) in queues: + queue_flag =3D 1 + elif line.strip().startswith("+++++++++++++++ Accumulated"): + queue_flag =3D 2 + elif line.strip().startswith("RX-packets") and queue_flag =3D= =3D 2: + result_scanner =3D r"RX-packets:\s?([0-9]+)" + scanner =3D re.compile(result_scanner, re.DOTALL) + m =3D scanner.search(line) + packet_rec =3D m.group(1) + + self.verify(packet_sumnum =3D=3D int(packet_rec) =3D=3D 100, "Ther= e are some packets lost.") =20 - def test_enable_ipv4_udp_rss(self): + def test_set_rss_types(self): """ - Enable IPv4-UDP RSS. + Disable and enable RSS. """ + self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "c= arlsville", + "fortville_spirit_single", "fortpark_TLV"= , "fortville_25g"], "NIC Unsupported: " + str(self.nic)) self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D4 --txq=3D4 = --port-topology=3Dchained") self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) self.dut.send_expect("set verbose 1", "testpmd> ", 120) - self.dut.send_expect("start", "testpmd> ", 120) + out =3D self.dut.send_expect("start", "testpmd> ", 120) time.sleep(2) =20 - # Show port default RSS fucntions - if (self.nic in ["fortville_eagle", "fortville_spirit","carlsville= ", - "fortville_spirit_single", "fortpark_TLV","fortpa= rk_BASE-T", "fortville_25g"]): - self.dut.send_expect( - "show port 0 rss-hash", "ipv4-frag ipv4-other ipv6-frag ip= v6-other ip") - else: - self.dut.send_expect( - "show port 0 rss-hash", "ipv4 ipv6 ipv6-ex ip") - self.send_packet("ipv4-other", self.tester_itf) - out =3D self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue("all", out) - self.dut.send_expect("start", "testpmd> ", 120) + # Show port default RSS functions + self.dut.send_expect( + "show port 0 rss-hash", "ipv4-frag ipv4-other ipv6-frag ipv6-o= ther ip") + self.dut.send_expect( + "show port 1 rss-hash", "ipv4-frag ipv4-other ipv6-frag ipv6-o= ther ip") =20 - self.send_packet("ipv4-udp", self.tester_itf) - out =3D self.dut.send_expect("stop", "testpmd> ", 120) - if (self.nic in ["fortville_eagle", "fortville_spirit","carlsville= ", - "fortville_spirit_single", "fortpark_TLV","fortpa= rk_BASE-T", "fortville_25g"]): - self.check_packet_queue("0", out) - else: - self.check_packet_queue("all", out) - self.dut.send_expect("start", "testpmd> ", 120) + self.send_check_100_packet_queue("ipv4-other", "all", port_id=3D0) + self.send_check_100_packet_queue("ipv4-other", "all", port_id=3D1) + self.send_check_100_packet_queue("ipv4-udp", "0", port_id=3D0) + self.send_check_100_packet_queue("ipv4-udp", "0", port_id=3D1) =20 - # enable ipv4-udp rss function + + # Enable ipv4-udp RSS hash function on port 0 self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types ipv4-udp = end / end", "created") + "flow create 0 ingress pattern eth / ipv4 / udp / end actions = rss types ipv4-udp end queues end / end", "created") self.dut.send_expect( "show port 0 rss-hash", "ipv4-udp udp") + self.send_check_100_packet_queue("ipv4-other", "0", port_id=3D0) + self.send_check_100_packet_queue("ipv4-other", "all", port_id=3D1) + self.send_check_100_packet_queue("ipv4-udp", "all", port_id=3D0) + self.send_check_100_packet_queue("ipv4-udp", "0", port_id=3D1) + + # Enable all RSS hash function on port 1 + self.dut.send_expect("flow create 1 ingress pattern eth / end acti= ons rss types l2-payload end queues end / end", "created") + self.dut.send_expect("flow create 1 ingress pattern eth / ipv4 / e= nd actions rss types ipv4-other end queues end / end", "created") + self.dut.send_expect("flow create 1 ingress pattern eth / ipv4 / e= nd actions rss types ipv4-frag end queues end / end", "created") + self.dut.send_expect("flow create 1 ingress pattern eth / ipv4 / u= dp / end actions rss types ipv4-udp end queues end / end", "created") + self.dut.send_expect("flow create 1 ingress pattern eth / ipv4 / t= cp / end actions rss types ipv4-tcp end queues end / end", "created") + self.dut.send_expect("flow create 1 ingress pattern eth / ipv4 / s= ctp / end actions rss types ipv4-sctp end queues end / end", "created") + self.dut.send_expect("flow create 1 ingress pattern eth / ipv6 / e= nd actions rss types ipv6-other end queues end / end", "created") + self.dut.send_expect("flow create 1 ingress pattern eth / ipv6 / e= nd actions rss types ipv6-frag end queues end / end", "created") + self.dut.send_expect("flow create 1 ingress pattern eth / ipv6 / u= dp / end actions rss types ipv6-udp end queues end / end", "created") + self.dut.send_expect("flow create 1 ingress pattern eth / ipv6 / t= cp / end actions rss types ipv6-tcp end queues end / end", "created") + self.dut.send_expect("flow create 1 ingress pattern eth / ipv6 / s= ctp / end actions rss types ipv6-sctp end queues end / end", "created") + + self.dut.send_expect( + "show port 1 rss-hash", "all ipv4-frag ipv4-tcp ipv4-udp ipv4-= sctp ipv4-other ipv6-frag ipv6-tcp ipv6-udp ipv6-sctp ipv6-other l2-payload= ip udp tcp sctp") # send the packets and verify the results - self.send_packet("ipv4-other", self.tester_itf) - out =3D self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue("0", out) - self.dut.send_expect("start", "testpmd> ", 120) + ptype_list1 =3D ["ipv4-other", "ipv4-frag", "ipv4-udp", "ipv4-tcp"= , "ipv4-sctp", "ipv6-other", "ipv6-frag", "ipv6-udp", "ipv6-tcp", "ipv6-sct= p", "l2-payload"] + self.send_check_100_packet_queue(ptype_list1, "all", port_id=3D1) + + ptype_list2 =3D ["ipv4-other", "ipv4-frag", "ipv4-tcp", "ipv4-sctp= ", "ipv6-other", "ipv6-frag", "ipv6-udp", "ipv6-tcp", "ipv6-sctp", "l2-payl= oad"] + self.send_check_100_packet_queue(ptype_list2, "0", port_id=3D0) + self.send_check_100_packet_queue("ipv4-udp", "all", port_id=3D0) + + # Enable all RSS hash function on port 0 + self.dut.send_expect("flow create 0 ingress pattern eth / end acti= ons rss types l2-payload end queues end / end", "created") + self.dut.send_expect("flow create 0 ingress pattern eth / ipv4 / e= nd actions rss types ipv4-other end queues end / end", "created") + self.dut.send_expect("flow create 0 ingress pattern eth / ipv4 / e= nd actions rss types ipv4-frag end queues end / end", "created") + self.dut.send_expect("flow create 0 ingress pattern eth / ipv4 / u= dp / end actions rss types ipv4-udp end queues end / end", "created") + self.dut.send_expect("flow create 0 ingress pattern eth / ipv4 / t= cp / end actions rss types ipv4-tcp end queues end / end", "created") + self.dut.send_expect("flow create 0 ingress pattern eth / ipv4 / s= ctp / end actions rss types ipv4-sctp end queues end / end", "created") + self.dut.send_expect("flow create 0 ingress pattern eth / ipv6 / e= nd actions rss types ipv6-other end queues end / end", "created") + self.dut.send_expect("flow create 0 ingress pattern eth / ipv6 / e= nd actions rss types ipv6-frag end queues end / end", "created") + self.dut.send_expect("flow create 0 ingress pattern eth / ipv6 / u= dp / end actions rss types ipv6-udp end queues end / end", "created") + self.dut.send_expect("flow create 0 ingress pattern eth / ipv6 / t= cp / end actions rss types ipv6-tcp end queues end / end", "created") + self.dut.send_expect("flow create 0 ingress pattern eth / ipv6 / s= ctp / end actions rss types ipv6-sctp end queues end / end", "created") =20 - self.send_packet("ipv4-udp", self.tester_itf) - out =3D self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue("all", out) + self.send_check_100_packet_queue(ptype_list1, "all", port_id=3D0) + self.send_check_100_packet_queue(ptype_list1, "all", port_id=3D1) =20 - def test_rss_queue_rule(self): + # delete rule 0/2/10 of port 1 + self.dut.send_expect("flow destroy 1 rule 0", "Flow rule #0 destro= yed") + self.dut.send_expect("flow destroy 1 rule 2", "Flow rule #2 destro= yed") + self.dut.send_expect("flow destroy 1 rule 10", "Flow rule #10 dest= royed") + + self.send_check_100_packet_queue(ptype_list1, "all", port_id=3D0) + + ptype_list3 =3D ["ipv4-other", "ipv4-udp", "ipv4-tcp", "ipv4-sctp"= , "ipv6-other", "ipv6-frag", "ipv6-udp", "ipv6-tcp"] + self.send_check_100_packet_queue(ptype_list3, "all", port_id=3D1) + + ptype_list4 =3D ["ipv4-frag", "ipv6-sctp", "l2-payload"] + self.send_check_100_packet_queue(ptype_list4, "0", port_id=3D1) + + # flush all rules of port 0 + self.dut.send_expect("flow flush 0", "testpmd> ") + self.dut.send_expect("show port 0 rss-hash", "RSS disabled") + self.send_check_100_packet_queue(ptype_list1, "0", port_id=3D0) + self.send_check_100_packet_queue(ptype_list3, "all", port_id=3D1) + self.send_check_100_packet_queue(ptype_list4, "0", port_id=3D1) + + # flush all rules of port 1 + self.dut.send_expect("flow flush 1", "testpmd> ") + self.dut.send_expect("show port 1 rss-hash", "RSS disabled") + self.send_check_100_packet_queue(ptype_list1, "0", port_id=3D0) + self.send_check_100_packet_queue(ptype_list1, "0", port_id=3D1) + + def test_set_rss_queues(self): """ Set valid and invalid parameter. """ - num =3D '4' if self.nic in ["foxville", "springville"] else '8' - self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D%s --txq=3D%= s --port-topology=3Dchained" % (num, num)) + self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "c= arlsville", + "fortville_spirit_single", "fortpark_TLV"= , "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D8 --txq=3D8 = --port-topology=3Dchained") self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) self.dut.send_expect("set verbose 1", "testpmd> ", 120) self.dut.send_expect("start", "testpmd> ", 120) time.sleep(2) =20 - # Create a rss queue rule - if self.nic in ['foxville',"springville"]: - self.dut.send_expect( - #"flow create 0 ingress pattern end actions rss queues 1 4= 7 end / end", "created") - "flow create 0 ingress pattern end actions rss queues 1 2 = 3 end / end", "created") - else: - self.dut.send_expect( - "flow create 0 ingress pattern end actions rss queues 1 4 = 7 end / end", "created") + # Create a rss queue rule on port 0 + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss types end queue= s 1 4 7 end / end", "created") + self.dut.send_expect( + "show port 0 rss-hash", "ipv4-frag ipv4-other ipv6-frag ipv6-o= ther ip") =20 # send the packets and verify the results - # ipv4-other and ipv6-other is enabled by default. - # i40e - rss_queue =3D ["1", "4", "7"] - if (self.nic in ["fortville_eagle", "fortville_spirit", "carlsvill= e", - "fortville_spirit_single", "fortpark_TLV","fortpa= rk_BASE-T", "fortville_25g"]): - self.send_and_check(self.pkt4, rss_queue) - self.send_and_check(self.pkt8, rss_queue) - rss_queue =3D ["0"] - self.send_and_check(self.pkt1, rss_queue) - self.send_and_check(self.pkt2, rss_queue) - self.send_and_check(self.pkt3, rss_queue) - self.send_and_check(self.pkt5, rss_queue) - self.send_and_check(self.pkt6, rss_queue) - self.send_and_check(self.pkt7, rss_queue) - else: - if self.nic in ['foxville', 'springville']: - rss_queue =3D ["1", "2", "3"] - self.send_and_check(self.pkt1, rss_queue) - self.send_and_check(self.pkt2, rss_queue) - self.send_and_check(self.pkt3, rss_queue) - self.send_and_check(self.pkt4, rss_queue) - self.send_and_check(self.pkt5, rss_queue) - self.send_and_check(self.pkt6, rss_queue) - self.send_and_check(self.pkt7, rss_queue) - self.send_and_check(self.pkt8, rss_queue) - - # There can't be more than one RSS queue rule existing. + self.send_check_100_packet_queue("ipv4-other", ["1","4","7"], port= _id=3D0) + self.send_check_100_packet_queue("ipv4-other", "all", port_id=3D1) + self.send_check_100_packet_queue("ipv4-udp", "0", port_id=3D0) + self.send_check_100_packet_queue("ipv4-udp", "0", port_id=3D1) + # Create a rss queue rule on port 1 self.dut.send_expect( - "flow create 0 ingress pattern end actions rss queues 3 end / = end", "error") + "flow create 1 ingress pattern end actions rss types end queue= s 3 end / end", "created") + # send the packets and verify the results + self.send_check_100_packet_queue("ipv4-other", ["1","4","7"], port= _id=3D0) + self.send_check_100_packet_queue("ipv4-other", ["3"], port_id=3D1) + self.send_check_100_packet_queue("ipv4-udp", "0", port_id=3D0) + self.send_check_100_packet_queue("ipv4-udp", "0", port_id=3D1) + + # Create a different rss queue rule on port 1 self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types ipv4-udp = end queues 3 end / end", "error") - # Flush the rules and create a new RSS queue rule. + "flow create 1 ingress pattern end actions rss types end queue= s 1 4 7 end / end", "created") + # send the packets and verify the results + self.send_check_100_packet_queue("ipv4-other", ["1","4","7"], port= _id=3D0) + self.send_check_100_packet_queue("ipv4-other", ["1","4","7"], port= _id=3D1) + + # flush rule on port 0 self.dut.send_expect("flow flush 0", "testpmd> ") + self.dut.send_expect("show port 0 rss-hash", "ipv4-frag ipv4-other= ipv6-frag ipv6-other ip") + # send the packets and verify the results + self.send_check_100_packet_queue("ipv4-other", "all", port_id=3D0) + self.send_check_100_packet_queue("ipv4-other", ["1","4","7"], port= _id=3D1) + + # Create a rss queue rule on port 0 again self.dut.send_expect( - "flow create 0 ingress pattern end actions rss queues 3 end / = end", "created") - # Send the packets and verify the results - if (self.nic in ["fortville_eagle", "fortville_spirit","carlsville= ", - "fortville_spirit_single", "fortpark_TLV","fortpa= rk_BASE-T", "fortville_25g"]): - rss_queue =3D ["3"] - self.send_and_check(self.pkt4, rss_queue) - self.send_and_check(self.pkt8, rss_queue) - rss_queue =3D ["0"] - self.send_and_check(self.pkt1, rss_queue) - self.send_and_check(self.pkt2, rss_queue) - self.send_and_check(self.pkt3, rss_queue) - self.send_and_check(self.pkt5, rss_queue) - self.send_and_check(self.pkt6, rss_queue) - self.send_and_check(self.pkt7, rss_queue) - else: - rss_queue =3D ["3"] - self.send_and_check(self.pkt1, rss_queue) - self.send_and_check(self.pkt2, rss_queue) - self.send_and_check(self.pkt3, rss_queue) - self.send_and_check(self.pkt4, rss_queue) - self.send_and_check(self.pkt5, rss_queue) - self.send_and_check(self.pkt6, rss_queue) - self.send_and_check(self.pkt7, rss_queue) - self.send_and_check(self.pkt8, rss_queue) - self.dut.send_expect("flow flush 0", "testpmd> ") + "flow create 0 ingress pattern end actions rss types end queue= s 1 4 7 end / end", "created") + # delete rule 1 of port 1 + self.dut.send_expect("flow destroy 1 rule 1", "Flow rule #1 destro= yed") + # send the packets and verify the results + self.send_check_100_packet_queue("ipv4-other", ["1","4","7"], port= _id=3D0) + self.send_check_100_packet_queue("ipv4-other", "all", port_id=3D1) =20 - # Set a wrong parameter: queue ID is 16 + # Create a rss queue rule on port 1 again self.dut.send_expect( - "flow create 0 ingress pattern end actions rss queues 8 end / = end", "error") + "flow create 1 ingress pattern end actions rss types end queue= s 3 end / end", "created") + # delete rule 0 of port 1 + self.dut.send_expect("flow destroy 1 rule 0", "Flow rule #0 destro= yed") + # send the packets and verify the results + self.send_check_100_packet_queue("ipv4-other", ["1","4","7"], port= _id=3D0) + self.send_check_100_packet_queue("ipv4-other", ["3"], port_id=3D1) + + # flush rules of port 1 + self.dut.send_expect("flow flush 1", "testpmd> ") + # send the packets and verify the results + self.send_check_100_packet_queue("ipv4-other", ["1","4","7"], port= _id=3D0) + self.send_check_100_packet_queue("ipv4-other", "all", port_id=3D1) + # Set all the queues to the rule - if self.nic in ['foxville', 'springville']: - self.dut.send_expect( - "flow create 0 ingress pattern end actions rss queues 0 1 = 2 3 end / end", "created") - else: - self.dut.send_expect( - "flow create 0 ingress pattern end actions rss queues 0 1 = 2 3 4 5 6 7 end / end", "created") + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss types end queue= s 0 1 2 3 4 5 6 7 end / end", "created") + self.send_check_100_packet_queue("ipv4-other", "all", port_id=3D0) + + # Set a wrong parameter: queue ID is 16 + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss types end queue= s 8 end / end", "Invalid argument") =20 - def test_different_types_rss_queue_rule(self): + def test_set_rss_types_rss_queue(self): """ Set valid and invalid parameter. """ - num =3D '4' if self.nic in ["foxville", "springville"] else '8' - self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D%s --txq=3D%= s --port-topology=3Dchained" % (num, num)) + self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "c= arlsville", + "fortville_spirit_single", "fortpark_TLV"= , "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D8 --txq=3D8 = --port-topology=3Dchained") self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) self.dut.send_expect("set verbose 1", "testpmd> ", 120) self.dut.send_expect("start", "testpmd> ", 120) time.sleep(2) =20 - # Create a rss queue rule - if self.nic in ['foxville', 'springville']: - self.dut.send_expect( - #"flow create 0 ingress pattern end actions rss types udp = ipv4-tcp ipv6-sctp ipv4-other end queues 1 4 7 end / end", "created") - "flow create 0 ingress pattern end actions rss types udp i= pv4-tcp ipv6-sctp ipv4-other end queues 1 2 3 end / end", "created") - else: - self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types udp i= pv4-tcp ipv6-sctp ipv4-other end queues 1 4 7 end / end", "created") + # Create rss rules on port 0 + self.dut.send_expect( + "flow create 0 ingress pattern eth / ipv4 / udp / end actions = rss types ipv4-udp end queues end / end", "created") + # send the packets and verify the results + self.send_check_100_packet_queue("ipv4-other", "0", port_id=3D0) + self.send_check_100_packet_queue("ipv4-other", "all", port_id=3D1) + self.send_check_100_packet_queue("ipv4-udp", "all", port_id=3D0) + self.send_check_100_packet_queue("ipv4-udp", "0", port_id=3D1) =20 + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss types end queue= s 0 2 7 end / end", "created") # send the packets and verify the results - rss_queue =3D ["1", "4", "7"] - if (self.nic in ["fortville_eagle", "fortville_spirit", "carlsvill= e", - "fortville_spirit_single", "fortpark_TLV","fortpa= rk_BASE-T", "fortville_25g"]): - self.send_and_check(self.pkt2, rss_queue) - self.send_and_check(self.pkt3, rss_queue) - self.send_and_check(self.pkt4, rss_queue) - self.send_and_check(self.pkt5, rss_queue) - self.send_and_check(self.pkt6, rss_queue) - rss_queue =3D ["0"] - self.send_and_check(self.pkt1, rss_queue) - self.send_and_check(self.pkt7, rss_queue) - self.send_and_check(self.pkt8, rss_queue) - elif(self.nic in ["cavium_a063", "cavium_a064"]): - self.send_and_check(self.pkt2, rss_queue) - self.send_and_check(self.pkt3, rss_queue) - self.send_and_check(self.pkt6, rss_queue) - elif(self.nic in ["foxville", "springville"]): - rss_queue =3D ["1", "2", "3"] - self.send_and_check(self.pkt2, rss_queue) - self.send_and_check(self.pkt3, rss_queue) - self.send_and_check(self.pkt6, rss_queue) - else: - self.send_and_check(self.pkt2, rss_queue) - self.send_and_check(self.pkt3, rss_queue) - self.send_and_check(self.pkt6, rss_queue) - rss_queue =3D ["0"] - self.send_and_check(self.pkt1, rss_queue) - self.send_and_check(self.pkt4, rss_queue) - self.send_and_check(self.pkt5, rss_queue) - self.send_and_check(self.pkt7, rss_queue) - self.send_and_check(self.pkt8, rss_queue) + self.send_check_100_packet_queue("ipv4-other", "0", port_id=3D0) + self.send_check_100_packet_queue("ipv4-other", "all", port_id=3D1) + self.send_check_100_packet_queue("ipv4-udp", ["0","2","7"], port_i= d=3D0) + self.send_check_100_packet_queue("ipv4-udp", "0", port_id=3D1) =20 - # There can't be more than one RSS queue rule existing. + # Create rss rules on port 1 + self.dut.send_expect( + "flow create 1 ingress pattern end actions rss types end queue= s 1 4 7 end / end", "created") + self.dut.send_expect( + "flow create 1 ingress pattern eth / end actions rss types l2-= payload end queues end / end", "created") + self.dut.send_expect( + "flow create 1 ingress pattern eth / ipv4 / udp / end actions = rss types ipv4-udp end queues end / end", "created") self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types ipv6-othe= r end queues 3 end / end", "error") + "flow create 1 ingress pattern eth / ipv4 / tcp / end actions = rss types ipv4-tcp end queues end / end", "created") + self.dut.send_expect( + "flow create 1 ingress pattern eth / ipv6 / end actions rss ty= pes ipv6-other end queues end / end", "created") + self.dut.send_expect( + "flow create 1 ingress pattern eth / ipv6 / sctp / end actions= rss types ipv6-sctp end queues end / end", "created") + self.dut.send_expect( + "flow create 1 ingress pattern eth / ipv6 / udp / end actions = rss types ipv6-udp end queues end / end", "created") + # send the packets and verify the results + ptype_list1 =3D ["ipv4-other", "ipv4-frag", "ipv4-tcp", "ipv4-sctp= ", "ipv6-other", "ipv6-frag", "ipv6-udp", "ipv6-tcp", "ipv6-sctp", "l2-payl= oad"] + ptype_list2 =3D ["ipv4-udp", "ipv4-tcp", "ipv6-other", "ipv6-udp",= "ipv6-sctp", "l2-payload"] + ptype_list3 =3D ["ipv4-other", "ipv4-frag", "ipv4-sctp", "ipv6-fra= g", "ipv6-tcp"] + self.send_check_100_packet_queue("ipv4-udp", ["0","2","7"], port_i= d=3D0) + self.send_check_100_packet_queue(ptype_list1, "0", port_id=3D0) + self.send_check_100_packet_queue(ptype_list2, ["1","4","7"], port_= id=3D1) + self.send_check_100_packet_queue(ptype_list3, "0", port_id=3D1) + + # Set a different RSS queue rule on port 1 + self.dut.send_expect( + "flow create 1 ingress pattern end actions rss types end queue= s 3 end / end", "created") + self.send_check_100_packet_queue("ipv4-udp", ["0","2","7"], port_i= d=3D0) + self.send_check_100_packet_queue(ptype_list1, "0", port_id=3D0) + self.send_check_100_packet_queue(ptype_list2, ["3"], port_id=3D1) + self.send_check_100_packet_queue(ptype_list3, "0", port_id=3D1) =20 def test_set_key_keylen(self): """ @@ -417,12 +541,13 @@ class TestRSS_to_Rteflow(TestCase): """ # Only supported by i40e self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "c= arlsville", - "fortville_spirit_single", "fortpark_TLV"= ,"fortpark_BASE-T", "fortville_25g"], "NIC Unsupported: " + str(self.nic)) - pkt1 =3D "Ether(dst=3D'%s')/IP(src=3D'0.0.0.0',dst=3D'4.0.0.0')/UD= P(sport=3D100, dport=3D200)/('X'*48)" % self.pf_mac - pkt2 =3D "Ether(dst=3D'%s')/IP(src=3D'0.0.0.0',dst=3D'4.0.0.0')/UD= P(sport=3D100, dport=3D201)/('X'*48)" % self.pf_mac - pkt3 =3D "Ether(dst=3D'%s')/IP(src=3D'0.0.0.0',dst=3D'4.0.0.0')/UD= P(sport=3D101, dport=3D201)/('X'*48)" % self.pf_mac - pkt4 =3D "Ether(dst=3D'%s')/IP(src=3D'0.0.0.0',dst=3D'4.0.0.1')/UD= P(sport=3D101, dport=3D201)/('X'*48)" % self.pf_mac - pkt5 =3D "Ether(dst=3D'%s')/IP(src=3D'0.0.0.1',dst=3D'4.0.0.1')/UD= P(sport=3D101, dport=3D201)/('X'*48)" % self.pf_mac + "fortville_spirit_single", "fortpark_TLV"= , "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + pkt1 =3D "Ether(dst=3D'%s')/IP(src=3D'0.0.0.0',dst=3D'4.0.0.0')/UD= P(sport=3D100, dport=3D200)/('X'*48)" % self.pf0_mac + pkt2 =3D "Ether(dst=3D'%s')/IP(src=3D'0.0.0.0',dst=3D'4.0.0.0')/UD= P(sport=3D100, dport=3D201)/('X'*48)" % self.pf0_mac + pkt3 =3D "Ether(dst=3D'%s')/IP(src=3D'0.0.0.0',dst=3D'4.0.0.0')/UD= P(sport=3D101, dport=3D201)/('X'*48)" % self.pf0_mac + pkt4 =3D "Ether(dst=3D'%s')/IP(src=3D'0.0.0.0',dst=3D'4.0.0.1')/UD= P(sport=3D101, dport=3D201)/('X'*48)" % self.pf0_mac + pkt5 =3D "Ether(dst=3D'%s')/IP(src=3D'0.0.0.1',dst=3D'4.0.0.1')/UD= P(sport=3D101, dport=3D201)/('X'*48)" % self.pf0_mac + pkts =3D [pkt1, pkt2, pkt3, pkt4, pkt5] =20 self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D4 --txq=3D4 = --port-topology=3Dchained") self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) @@ -432,179 +557,178 @@ class TestRSS_to_Rteflow(TestCase): =20 # Create a rss rule self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types ipv4-udp = end / end", "created") + "flow create 0 ingress pattern eth / ipv4 / udp / end actions = rss types ipv4-udp end queues end / end", "created") + self.dut.send_expect( + "flow create 1 ingress pattern eth / ipv4 / udp / end actions = rss types ipv4-udp end queues end / end", "created") out1 =3D self.dut.send_expect("show port 0 rss-hash key", "testpmd= > ", 120) rss_queue =3D ["0", "1", "2", "3"] - queue1 =3D self.send_and_check(pkt1, rss_queue) - queue2 =3D self.send_and_check(pkt2, rss_queue) - queue3 =3D self.send_and_check(pkt3, rss_queue) - queue4 =3D self.send_and_check(pkt4, rss_queue) - queue5 =3D self.send_and_check(pkt5, rss_queue) - list1 =3D [queue1, queue2, queue3, queue4, queue5] - - # Create a rss key rule - self.dut.send_expect("flow flush 0", "testpmd> ") + port0_list1 =3D self.send_and_check(pkts, rss_queue, port_id=3D0) + port1_list1 =3D self.send_and_check(pkts, rss_queue, port_id=3D1) + + # Create a rss key rule on port 0 key =3D "1234567890123456789012345678901234567890FFFFFFFFFFFF12345= 67890123456789012345678901234567890FFFFFFFFFFFF" self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types ipv4-udp = end key %s / end" % key, "created") + "flow create 0 ingress pattern eth / ipv4 / udp / end actions = rss types ipv4-udp end queues end key %s / end" % key, "created") out2 =3D self.dut.send_expect("show port 0 rss-hash key", "testpmd= > ", 120) - key_queue1 =3D self.send_and_check(pkt1, rss_queue) - key_queue2 =3D self.send_and_check(pkt2, rss_queue) - key_queue3 =3D self.send_and_check(pkt3, rss_queue) - key_queue4 =3D self.send_and_check(pkt4, rss_queue) - key_queue5 =3D self.send_and_check(pkt5, rss_queue) - list2 =3D [key_queue1, key_queue2, key_queue3, key_queue4, key_que= ue5] + port0_list2 =3D self.send_and_check(pkts, rss_queue, port_id=3D0) + port1_list2 =3D self.send_and_check(pkts, rss_queue, port_id=3D1) =20 - self.verify((key in out2) and (out1 !=3D out2) and (list1 !=3D lis= t2), "the key setting doesn't take effect.") + self.verify((key in out2) and (out1 !=3D out2) and (port0_list1 != =3D port0_list2), "the key setting doesn't take effect.") =20 - # Create a rss rule with truncating key_len - self.dut.send_expect("flow flush 0", "testpmd> ") + # Create a rss key rule with truncating key_len on port 0 key =3D "1234567890123456789012345678901234567890FFFFFFFFFFFF12345= 67890123456789012345678901234567890FFFFFFFFFFFF" key_len =3D "50" self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types ipv4-udp = end key %s key_len %s / end" % (key, key_len), "created") + "flow create 0 ingress pattern eth / ipv4 / udp / end actions = rss types ipv4-udp end queues end key %s key_len %s / end" % (key, key_len)= , "created") out3 =3D self.dut.send_expect("show port 0 rss-hash key", "testpmd= > ", 120) - key_queue1 =3D self.send_and_check(pkt1, rss_queue) - key_queue2 =3D self.send_and_check(pkt2, rss_queue) - key_queue3 =3D self.send_and_check(pkt3, rss_queue) - key_queue4 =3D self.send_and_check(pkt4, rss_queue) - key_queue5 =3D self.send_and_check(pkt5, rss_queue) - list3 =3D [key_queue1, key_queue2, key_queue3, key_queue4, key_que= ue5] + port0_list3 =3D self.send_and_check(pkts, rss_queue, port_id=3D0) + port1_list3 =3D self.send_and_check(pkts, rss_queue, port_id=3D1) =20 - self.verify((key not in out3) and (out3 !=3D out1 !=3D out2) and (= list3 !=3D list1 !=3D list2), "the key setting doesn't take effect.") + self.verify((key in out2) and (out1 !=3D out2) and (port0_list1 != =3D port0_list2), "the key setting doesn't take effect.") =20 - # Create a rss rule with padding key_len - self.dut.send_expect("flow flush 0", "testpmd> ") + self.verify((key not in out3) and (out3 !=3D out1 !=3D out2) and (= port0_list3 !=3D port0_list1 !=3D port0_list2), "the key setting doesn't ta= ke effect.") + + # Create a rss rule with padding key_len on port 0 key =3D "1234567890123456789012345678901234567890FFFFFFFFFFFF12345= 67890123456789012345678901234567890FFFFFF" key_len =3D "52" self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types ipv4-udp = end key %s key_len %s / end" % (key, key_len), "created") + "flow create 0 ingress pattern eth / ipv4 / udp / end actions = rss types ipv4-udp end queues end key %s key_len %s / end" % (key, key_len)= , "created") out4 =3D self.dut.send_expect("show port 0 rss-hash key", "testpmd= > ", 120) - key_queue1 =3D self.send_and_check(pkt1, rss_queue) - key_queue2 =3D self.send_and_check(pkt2, rss_queue) - key_queue3 =3D self.send_and_check(pkt3, rss_queue) - key_queue4 =3D self.send_and_check(pkt4, rss_queue) - key_queue5 =3D self.send_and_check(pkt5, rss_queue) - list4 =3D [key_queue1, key_queue2, key_queue3, key_queue4, key_que= ue5] + port0_list4 =3D self.send_and_check(pkts, rss_queue, port_id=3D0) + port1_list4 =3D self.send_and_check(pkts, rss_queue, port_id=3D1) + + self.verify((key in out4) and (out4 !=3D out1 !=3D out2 !=3D out3)= and (port0_list4 !=3D port0_list1 !=3D port0_list2), "the key setting does= n't take effect.") + self.verify(port1_list1 =3D=3D port1_list2 =3D=3D port1_list3 =3D= =3D port1_list4, "the key setting on port 0 impact port 1.") + + # Create a rss key rule on port 1 + key =3D "1234567890123456789012345678901234567890FFFFFFFFFFFF12345= 67890123456789012345678909876543210EEEEEEEEEEEE" + self.dut.send_expect( + "flow create 1 ingress pattern eth / ipv4 / udp / end actions = rss types ipv4-udp end queues end key %s / end" % key, "created") + out5 =3D self.dut.send_expect("show port 1 rss-hash key", "testpmd= > ", 120) + port0_list5 =3D self.send_and_check(pkts, rss_queue, port_id=3D0) + port1_list5 =3D self.send_and_check(pkts, rss_queue, port_id=3D1) =20 - self.verify((key in out4) and (out4 !=3D out1 !=3D out2 !=3D out3)= and (list4 !=3D list1 !=3D list2), "the key setting doesn't take effect.") + self.verify((key in out5) and (out1 !=3D out5) and (port1_list4 != =3D port1_list5), "the key setting doesn't take effect.") + self.verify(port0_list5 =3D=3D port0_list4, "the key setting on po= rt 1 impact port 0.") =20 def test_disable_rss_in_commandline(self): """ Set RSS queue rule while disable RSS in command-line. """ - num =3D '4' if self.nic in ["foxville", "springville"] else '8' - self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D%s --txq=3D%= s --disable-rss --port-topology=3Dchained" % (num, num)) + self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "c= arlsville", + "fortville_spirit_single", "fortpark_TLV"= , "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D8 --txq=3D8 = --disable-rss --port-topology=3Dchained") self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) self.dut.send_expect("set verbose 1", "testpmd> ", 120) self.dut.send_expect("start", "testpmd> ", 120) time.sleep(2) + rss_queue =3D ["0"] + pkts =3D [self.pkt1, self.pkt2, self.pkt3, self.pkt4, self.pkt5, s= elf.pkt6, self.pkt7, self.pkt8, self.pkt9, self.pkt10, self.pkt11] + self.send_and_check(pkts, rss_queue, port_id=3D0) =20 - # Create a rss queue rule + # enable ipv4-udp and ipv6-tcp RSS function type self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types all end /= end", "created") - self.send_packet("ipv4-udp", self.tester_itf) - out =3D self.dut.send_expect("stop", "testpmd> ", 120) - self.check_packet_queue("all", out) - self.dut.send_expect("quit", "# ") + "flow create 0 ingress pattern eth / ipv4 / udp / end actions = rss types ipv4-udp end queues end / end", "created") + self.dut.send_expect( + "flow create 0 ingress pattern eth / ipv6 / tcp / end actions = rss types ipv6-tcp end queues end / end", "created") + rss_queue =3D ["0", "1", "2", "3", "4", "5", "6", "7"] + pkts =3D [self.pkt2, self.pkt3] + self.send_and_check(pkts, rss_queue, port_id=3D0) + rss_queue =3D ["0"] + pkts =3D [self.pkt1, self.pkt4, self.pkt5, self.pkt6, self.pkt7, s= elf.pkt8, self.pkt9, self.pkt10] + self.send_and_check(pkts, rss_queue, port_id=3D0) + rss_queue =3D ["0"] + pkts =3D [self.pkt1, self.pkt2, self.pkt3, self.pkt4, self.pkt5, s= elf.pkt6, self.pkt7, self.pkt8, self.pkt9, self.pkt10] + self.send_and_check(pkts, rss_queue, port_id=3D1) =20 - self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D%s --txq=3D%= s --disable-rss --port-topology=3Dchained" % (num, num)) - self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) - self.dut.send_expect("set verbose 1", "testpmd> ", 120) - self.dut.send_expect("start", "testpmd> ", 120) - time.sleep(2) - # Create a rss queue rule - if self.nic in ['foxville', 'springville']: - self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types ipv6-= tcp ipv4-udp sctp ipv6-other end queues 1 2 3 end / end", "created") - else: - self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types ipv6-= tcp ipv4-udp sctp ipv6-other end queues 5 6 7 end / end", "created") - # send the packets and verify the results - rss_queue =3D ["5", "6", "7"] - if (self.nic in ["fortville_eagle", "fortville_spirit", "carlsvill= e", - "fortville_spirit_single", "fortpark_TLV","fortpa= rk_BASE-T", "fortville_25g"]): - self.send_and_check(self.pkt1, rss_queue) - self.send_and_check(self.pkt2, rss_queue) - self.send_and_check(self.pkt5, rss_queue) - self.send_and_check(self.pkt7, rss_queue) - self.send_and_check(self.pkt8, rss_queue) - rss_queue =3D ["0"] - self.send_and_check(self.pkt3, rss_queue) - self.send_and_check(self.pkt4, rss_queue) - self.send_and_check(self.pkt6, rss_queue) - else: - if self.nic in ['foxville', 'springville']: - rss_queue =3D ["1", "2", "3"] - self.send_and_check(self.pkt2, rss_queue) - self.send_and_check(self.pkt7, rss_queue) - rss_queue =3D ["0"] - self.send_and_check(self.pkt1, rss_queue) - self.send_and_check(self.pkt3, rss_queue) - self.send_and_check(self.pkt4, rss_queue) - self.send_and_check(self.pkt5, rss_queue) - self.send_and_check(self.pkt6, rss_queue) - self.send_and_check(self.pkt8, rss_queue) + # set queue 1, 4, 7 into RSS queue rule + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss types end queue= s 1 4 7 end / end", "created") + rss_queue =3D ["1", "4", "7"] + pkts =3D [self.pkt2, self.pkt3] + self.send_and_check(pkts, rss_queue, port_id=3D0) + rss_queue =3D ["0"] + pkts =3D [self.pkt1, self.pkt4, self.pkt5, self.pkt6, self.pkt7, s= elf.pkt8, self.pkt9, self.pkt10] + self.send_and_check(pkts, rss_queue, port_id=3D0) + rss_queue =3D ["0"] + pkts =3D [self.pkt1, self.pkt2, self.pkt3, self.pkt4, self.pkt5, s= elf.pkt6, self.pkt7, self.pkt8, self.pkt9, self.pkt10] + self.send_and_check(pkts, rss_queue, port_id=3D1) + + # enable ipv4-udp and ipv6-other RSS function type on port 1 + self.dut.send_expect( + "flow create 1 ingress pattern eth / ipv4 / udp / end actions = rss types ipv4-udp end queues end / end", "created") + self.dut.send_expect( + "flow create 1 ingress pattern eth / ipv6 / end actions rss ty= pes ipv6-other end queues end / end", "created") + rss_queue =3D ["1", "4", "7"] + pkts =3D [self.pkt2, self.pkt3] + self.send_and_check(pkts, rss_queue, port_id=3D0) + rss_queue =3D ["0"] + pkts =3D [self.pkt1, self.pkt4, self.pkt5, self.pkt6, self.pkt7, s= elf.pkt8, self.pkt9, self.pkt10] + self.send_and_check(pkts, rss_queue, port_id=3D0) + + rss_queue =3D ["0", "1", "2", "3", "4", "5", "6", "7"] + pkts =3D [self.pkt2, self.pkt8] + self.send_and_check(pkts, rss_queue, port_id=3D1) + rss_queue =3D ["0"] + pkts =3D [self.pkt1, self.pkt3, self.pkt4, self.pkt5, self.pkt6, s= elf.pkt7, self.pkt9, self.pkt10] + self.send_and_check(pkts, rss_queue, port_id=3D1) =20 - # There can't be more than one RSS queue rule existing. self.dut.send_expect("flow flush 0", "testpmd> ") rss_queue =3D ["0"] - self.send_and_check(self.pkt1, rss_queue) - self.send_and_check(self.pkt2, rss_queue) - self.send_and_check(self.pkt3, rss_queue) - self.send_and_check(self.pkt4, rss_queue) - self.send_and_check(self.pkt5, rss_queue) - self.send_and_check(self.pkt6, rss_queue) - self.send_and_check(self.pkt7, rss_queue) - self.send_and_check(self.pkt8, rss_queue) + pkts =3D [self.pkt1, self.pkt2, self.pkt3, self.pkt4, self.pkt5, s= elf.pkt6, self.pkt7, self.pkt8, self.pkt9, self.pkt10] + self.send_and_check(pkts, rss_queue, port_id=3D0) + rss_queue =3D ["0", "1", "2", "3", "4", "5", "6", "7"] + pkts =3D [self.pkt2, self.pkt8] + self.send_and_check(pkts, rss_queue, port_id=3D1) + rss_queue =3D ["0"] + pkts =3D [self.pkt1, self.pkt3, self.pkt4, self.pkt5, self.pkt6, s= elf.pkt7, self.pkt9, self.pkt10] + self.send_and_check(pkts, rss_queue, port_id=3D1) + + self.dut.send_expect("flow flush 1", "testpmd> ") + rss_queue =3D ["0"] + pkts =3D [self.pkt1, self.pkt2, self.pkt3, self.pkt4, self.pkt5, s= elf.pkt6, self.pkt7, self.pkt8, self.pkt9, self.pkt10] + self.send_and_check(pkts, rss_queue, port_id=3D0) + self.send_and_check(pkts, rss_queue, port_id=3D1) =20 def test_flow_director_rss_rule_combination(self): """ Set RSS queue rule and flow director rule in meantime. + flow directory filter is priority to RSS hash filter. """ - num =3D '4' if self.nic in ["foxville", "springville"] else '8' - self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D%s --txq=3D%= s --pkt-filter-mode=3Dperfect" % (num, num)) + self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "c= arlsville", + "fortville_spirit_single", "fortpark_TLV"= , "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D8 --txq=3D8 = --pkt-filter-mode=3Dperfect") self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) self.dut.send_expect("set verbose 1", "testpmd> ", 120) self.dut.send_expect("start", "testpmd> ", 120) time.sleep(2) =20 - # Create a rss queue rule - if self.nic in ['foxville', 'springville']: - self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types udp e= nd queues 1 2 3 end / end", "created") - else: - self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types udp e= nd queues 3 4 5 end / end", "created") + # Enable ipv4-udp type and Create a rss queue rule + self.dut.send_expect( + "flow create 0 ingress pattern eth / ipv4 / udp / end actions = rss types ipv4-udp end queues end / end", "created") + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss types end queue= s 3 4 5 end / end", "created") # send the packets and verify the results - rss_queue =3D ["1", "2", "3"] if self.nic in ['foxville', 'springv= ille'] else ["3", "4", "5"] - self.send_and_check(self.pkt2, rss_queue) + rss_queue =3D ["3", "4", "5"] + self.send_and_check(self.pkt2, rss_queue, port_id=3D0) + # Create a flow director rule - if (self.nic in ["bartonhills", "powerville", "foxville", "springv= ille"]): - # Create a flow director rule - self.dut.send_expect( - "flow create 0 ingress pattern eth / ipv4 proto is 6 / udp= dst is 50 / end actions queue index 1 / end", "created") - rss_queue =3D ["1"] - pkt =3D "Ether(dst=3D'%s')/IP(src=3D'10.0.0.1',dst=3D'192.168.= 0.2',proto=3D6)/UDP(dport=3D50, sport=3D50)/('X'*48)" % self.pf_mac - self.send_and_check(pkt, rss_queue) - else: - # Create a flow director rule - self.dut.send_expect( - "flow create 0 ingress pattern eth / ipv4 src is 10.0.0.1 = dst is 192.168.0.2 / udp src is 50 dst is 50 / end actions queue index 1 / = end", "created") - # send the packets and verify the results - rss_queue =3D ["1"] - self.send_and_check(self.pkt2, rss_queue) + self.dut.send_expect( + "flow create 0 ingress pattern eth / ipv4 src is 10.0.0.1 dst = is 192.168.0.2 / udp src is 50 dst is 50 / end actions queue index 1 / end"= , "created") + # send the packets and verify the results + rss_queue =3D ["1"] + self.send_and_check(self.pkt2, rss_queue, port_id=3D0) # There can't be more than one RSS queue rule existing. - self.dut.send_expect("flow destroy 0 rule 1", "testpmd> ") - rss_queue =3D ["1", "2", "3"] if self.nic in ['foxville', 'springv= ille'] else ["3", "4", "5"] - self.send_and_check(self.pkt2, rss_queue) + self.dut.send_expect("flow destroy 0 rule 2", "testpmd> ") + rss_queue =3D ["3", "4", "5"] + self.send_and_check(self.pkt2, rss_queue, port_id=3D0) =20 - def test_queue_region_with_rss_rule_api(self): + def test_queue_region_with_rte_flow_api(self): """ Set RSS queue rule with queue region API. """ self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "c= arlsville", - "fortville_spirit_single", "fortpark_TLV"= ,"fortpark_BASE-T", "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + "fortville_spirit_single", "fortpark_TLV"= , "fortville_25g"], "NIC Unsupported: " + str(self.nic)) self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D16 --txq=3D1= 6 --port-topology=3Dchained") self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) self.dut.send_expect("set verbose 1", "testpmd> ", 120) @@ -613,13 +737,14 @@ class TestRSS_to_Rteflow(TestCase): =20 # Create a rss queue rule. self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types tcp end q= ueues 7 8 10 11 12 14 15 end / end", "created") + "flow create 0 ingress pattern end actions rss types end queue= s 7 8 10 11 12 14 15 end / end", "created") + self.dut.send_expect( + "flow create 0 ingress pattern eth / ipv4 / tcp / end actions = rss types ipv4-tcp end queues end / end", "created") # send the packets and verify the results rss_queue =3D ["7", "8", "10", "11", "12", "14", "15"] - queue1 =3D self.send_and_check(self.prio_pkt1, rss_queue) - queue2 =3D self.send_and_check(self.prio_pkt2, rss_queue) - queue3 =3D self.send_and_check(self.prio_pkt3, rss_queue) - self.verify(queue1 =3D=3D queue2 =3D=3D queue3, "the packet doesn'= t enter the expected RSS queue.") + pkts =3D [self.prio_pkt1, self.prio_pkt2, self.prio_pkt3] + queue_list =3D self.send_and_check(pkts, rss_queue, port_id=3D0) + self.verify(queue_list[0] =3D=3D queue_list[1] =3D=3D queue_list[2= ], "the packet doesn't enter the expected RSS queue.") =20 # Create three queue regions. self.dut.send_expect( @@ -630,34 +755,35 @@ class TestRSS_to_Rteflow(TestCase): "flow create 0 ingress pattern vlan tci is 0x6000 / end action= s rss queues 15 end / end", "created") # send the packets and verify the results rss_queue =3D ["7", "8"] - queue1 =3D self.send_and_check(self.prio_pkt1, rss_queue) + queue1 =3D self.send_and_check(self.prio_pkt1, rss_queue, port_id= =3D0) rss_queue =3D ["11", "12"] - queue2 =3D self.send_and_check(self.prio_pkt2, rss_queue) + queue2 =3D self.send_and_check(self.prio_pkt2, rss_queue, port_id= =3D0) rss_queue =3D ["15"] - queue3 =3D self.send_and_check(self.prio_pkt3, rss_queue) + queue3 =3D self.send_and_check(self.prio_pkt3, rss_queue, port_id= =3D0) =20 # Destroy one queue region rule, all the rules become invalid. - self.dut.send_expect("flow destroy 0 rule 2", "testpmd> ") - rss_queue =3D ["0"] - self.send_and_check(self.prio_pkt1, rss_queue) - self.send_and_check(self.prio_pkt2, rss_queue) - self.send_and_check(self.prio_pkt3, rss_queue) + self.dut.send_expect("flow destroy 0 rule 3", "testpmd> ") + rss_queue =3D ["7", "8", "10", "11", "12", "14", "15"] + queue_list2 =3D self.send_and_check(pkts, rss_queue, port_id=3D0) + self.verify(queue_list =3D=3D queue_list2, "the packet doesn't ent= er the expected RSS queue.") =20 - def test_queue_region_with_invalid_parameter(self): + def test_queue_region_in_rte_flow_with_invalid_parameter(self): """ - Set RSS queue rule with invalid parameter in queue region API. + Set RSS queue region rule with invalid parameter in rte_flow API. """ self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "c= arlsville", - "fortville_spirit_single", "fortpark_TLV"= ,"fortpark_BASE-T", "fortville_25g", "carlsville"], "NIC Unsupported: " + s= tr(self.nic)) + "fortville_spirit_single", "fortpark_TLV"= , "fortville_25g"], "NIC Unsupported: " + str(self.nic)) self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D16 --txq=3D1= 6 --port-topology=3Dchained") self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) self.dut.send_expect("set verbose 1", "testpmd> ", 120) self.dut.send_expect("start", "testpmd> ", 120) time.sleep(2) =20 + self.dut.send_expect( + "flow create 0 ingress pattern vlan tci is 0x2000 / end action= s rss queues 10 11 end / end", "error") # Create a rss queue rule. self.dut.send_expect( - "flow create 0 ingress pattern end actions rss queues 8 10 11 = 12 15 end / end", "created") + "flow create 0 ingress pattern end actions rss types end queue= s 8 10 11 12 15 end / end", "created") # Set a queue region with invalid queue ID self.dut.send_expect( "flow create 0 ingress pattern vlan tci is 0x2000 / end action= s rss queues 8 9 end / end", "error") @@ -667,6 +793,8 @@ class TestRSS_to_Rteflow(TestCase): # Set a queue region with invalid queue number self.dut.send_expect( "flow create 0 ingress pattern vlan tci is 0x4000 / end action= s rss queues 10 11 12 end / end", "error") + self.dut.send_expect( + "flow create 0 ingress pattern vlan tci is 0x2000 / end action= s rss queues 10 11 end / end", "created") =20 def test_queue_region_with_rss_rule_combination(self): """ @@ -674,9 +802,9 @@ class TestRSS_to_Rteflow(TestCase): The queue region is priority to RSS queue rule. """ self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "c= arlsville", - "fortville_spirit_single", "fortpark_TLV"= ,"fortpark_BASE-T", "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + "fortville_spirit_single", "fortpark_TLV"= , "fortville_25g"], "NIC Unsupported: " + str(self.nic)) self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D16 --txq=3D1= 6 --port-topology=3Dchained") - self.dut.send_expect("port config all rss all", "testpmd> ", 120) + self.dut.send_expect("flow create 0 ingress pattern eth / ipv4 / u= dp / end actions rss types ipv4-udp end queues end / end", "created", 120) self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) self.dut.send_expect("set verbose 1", "testpmd> ", 120) self.dut.send_expect("start", "testpmd> ", 120) @@ -691,21 +819,222 @@ class TestRSS_to_Rteflow(TestCase): "set port 0 queue-region flush on", "testpmd> ") # send the packets and verify the results rss_queue =3D ["1"] - self.send_and_check(self.pkt2, rss_queue) + self.send_and_check(self.pkt2, rss_queue, port_id=3D0) =20 # Create a RSS queue rule. self.dut.send_expect( - "flow create 0 ingress pattern end actions rss queues 6 7 end = / end", "testpmd> ") + "flow create 0 ingress pattern end actions rss types end queue= s 6 7 end / end", "testpmd> ") # send the packets and verify the results rss_queue =3D ["1"] - self.send_and_check(self.pkt2, rss_queue) + self.send_and_check(self.pkt2, rss_queue, port_id=3D0) =20 # destroy the queue region. self.dut.send_expect( "set port 0 queue-region flush off", "testpmd> ") # send the packets and verify the results rss_queue =3D ["6", "7"] - self.send_and_check(self.pkt2, rss_queue) + self.send_and_check(self.pkt2, rss_queue, port_id=3D0) + + def test_disable_enable_rss_ixgbe_igb(self): + """ + Disable and enable RSS. + """ + self.verify(self.nic not in ["fortville_eagle", "fortville_spirit"= , "carlsville", + "fortville_spirit_single", "fortpark_TLV"= , "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D4 --txq=3D4 = --port-topology=3Dchained") + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) + self.dut.send_expect("set verbose 1", "testpmd> ", 120) + self.dut.send_expect("start", "testpmd> ", 120) + time.sleep(2) + + # Show port default RSS functions + self.dut.send_expect("show port 0 rss-hash", "all ipv4 ipv6 ipv6-e= x ip") + ptype_list1 =3D ["ipv4-other", "ipv4-frag", "ipv4-udp", "ipv4-tcp"= , "ipv4-sctp", "ipv6-other", "ipv6-frag", "ipv6-udp", "ipv6-tcp", "ipv6-sct= p"] + self.send_check_100_packet_queue(ptype_list1, "all", port_id=3D0) + + # Disable RSS hash function + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss types none end = / end", "created") + self.dut.send_expect( + "show port 0 rss-hash", "RSS disabled") + self.send_check_100_packet_queue(ptype_list1, "0", port_id=3D0) + + # Enable RSS hash function all + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss types all end /= end", "created") + self.dut.send_expect( + "show port 0 rss-hash", "all ipv4 ipv4-tcp ipv4-udp ipv6 ipv6-= tcp ipv6-udp ipv6-ex ipv6-tcp-ex ipv6-udp-ex ip udp tcp") + self.send_check_100_packet_queue(ptype_list1, "all", port_id=3D0) + + def test_enable_ipv4_udp_rss_ixgbe_igb(self): + """ + Enable IPv4-UDP RSS. + """ + self.verify(self.nic not in ["fortville_eagle", "fortville_spirit"= , "carlsville", + "fortville_spirit_single", "fortpark_TLV"= , "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D4 --txq=3D4 = --port-topology=3Dchained") + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) + self.dut.send_expect("set verbose 1", "testpmd> ", 120) + self.dut.send_expect("start", "testpmd> ", 120) + time.sleep(2) + + # Show port default RSS fucntions + self.dut.send_expect( + "show port 0 rss-hash", "all ipv4 ipv6 ipv6-ex ip") + # enable ipv4-udp rss function + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss types ipv4-udp = end / end", "created") + self.dut.send_expect( + "show port 0 rss-hash", "all ipv4-udp udp") + # send the packets and verify the results + self.send_check_100_packet_queue("ipv4-udp", "all", port_id=3D0) + ptype_list1 =3D ["ipv4-other", "ipv4-frag", "ipv4-tcp", "ipv4-sctp= ", "ipv6-other", "ipv6-frag", "ipv6-udp", "ipv6-tcp", "ipv6-sctp"] + self.send_check_100_packet_queue(ptype_list1, "0", port_id=3D0) + + def test_rss_queue_rule_ixgbe_igb(self): + """ + Set valid and invalid parameter. + """ + self.verify(self.nic not in ["fortville_eagle", "fortville_spirit"= , "carlsville", + "fortville_spirit_single", "fortpark_TLV"= , "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D8 --txq=3D8 = --port-topology=3Dchained") + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) + self.dut.send_expect("set verbose 1", "testpmd> ", 120) + self.dut.send_expect("start", "testpmd> ", 120) + time.sleep(2) + + # Create a rss queue rule + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss queues 1 4 7 en= d / end", "created") + # send the packets and verify the results + ptype_list1 =3D ["ipv4-other", "ipv4-frag", "ipv4-udp", "ipv4-tcp"= , "ipv4-sctp", "ipv6-other", "ipv6-frag", "ipv6-udp", "ipv6-tcp", "ipv6-sct= p"] + self.send_check_100_packet_queue(ptype_list1, ["1","4","7"], port_= id=3D0) + + # There can't be more than one RSS queue rule existing. + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss queues 3 end / = end", "error") + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss types ipv4-udp = end queues 3 end / end", "error") + # Flush the rules and create a new RSS queue rule. + self.dut.send_expect("flow flush 0", "testpmd> ") + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss types ipv4-udp = end queues 3 end / end", "created") + # Send the packets and verify the results + self.send_check_100_packet_queue("ipv4-udp", ["3"], port_id=3D0) + ptype_list2 =3D ["ipv4-other", "ipv4-frag", "ipv4-tcp", "ipv4-sctp= ", "ipv6-other", "ipv6-frag", "ipv6-udp", "ipv6-tcp", "ipv6-sctp"] + self.send_check_100_packet_queue(ptype_list2, "0", port_id=3D0) + + self.dut.send_expect("flow flush 0", "testpmd> ") + + # Set a wrong parameter: queue ID is 8 + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss queues 8 end / = end", "error") + # Set all the queues to the rule + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss queues 0 1 2 3 = 4 5 6 7 end / end", "created") + self.send_check_100_packet_queue(ptype_list1, "all", port_id=3D0) + + def test_different_types_ixgbe_igb(self): + """ + Set different types rss queue rules. + """ + self.verify(self.nic not in ["fortville_eagle", "fortville_spirit"= , "carlsville", + "fortville_spirit_single", "fortpark_TLV"= , "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D8 --txq=3D8 = --port-topology=3Dchained") + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) + self.dut.send_expect("set verbose 1", "testpmd> ", 120) + self.dut.send_expect("start", "testpmd> ", 120) + time.sleep(2) + + # Create a rss queue rule + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss types udp ipv4-= tcp ipv6-sctp ipv4-other end queues 1 4 7 end / end", "created") + self.dut.send_expect( + "show port 0 rss-hash", "all ipv4-tcp ipv4-udp ipv6-udp ipv6-u= dp-ex udp tcp") + ptype_list1 =3D ["ipv4-udp", "ipv4-tcp", "ipv6-udp"] + ptype_list2 =3D ["ipv4-other", "ipv4-frag", "ipv4-sctp", "ipv6-oth= er", "ipv6-frag", "ipv6-tcp", "ipv6-sctp"] + + # send the packets and verify the results + if(self.nic in ["cavium_a063", "cavium_a064"]): + self.send_check_100_packet_queue(ptype_list1, ["1","4","7"], p= ort_id=3D0) + else: + self.send_check_100_packet_queue(ptype_list1, ["1","4","7"], p= ort_id=3D0) + self.send_check_100_packet_queue(ptype_list2, "0", port_id=3D0= ) + + # Create different ptype rss rule. + self.dut.send_expect("flow flush 0", "testpmd> ") + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss types ipv4 ipv6= end queues 3 7 end / end", "created") + self.dut.send_expect( + "show port 0 rss-hash", "all ipv4 ipv6 ip") + ptype_list3 =3D ["ipv4-other", "ipv4-frag", "ipv4-udp", "ipv4-tcp"= , "ipv4-sctp", "ipv6-other", "ipv6-frag", "ipv6-udp", "ipv6-tcp", "ipv6-sct= p"] + self.send_check_100_packet_queue(ptype_list3, ["3","7"], port_id= =3D0) + + def test_disable_rss_in_commandline_ixgbe_igb(self): + """ + Set RSS queue rule while disable RSS in command-line. + """ + self.verify(self.nic not in ["fortville_eagle", "fortville_spirit"= , "carlsville", + "fortville_spirit_single", "fortpark_TLV"= , "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D8 --txq=3D8 = --disable-rss --port-topology=3Dchained") + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) + self.dut.send_expect("set verbose 1", "testpmd> ", 120) + self.dut.send_expect("start", "testpmd> ", 120) + time.sleep(2) + + ptype_list1 =3D ["ipv4-other", "ipv4-frag", "ipv4-udp", "ipv4-tcp"= , "ipv4-sctp", "ipv6-other", "ipv6-frag", "ipv6-udp", "ipv6-tcp", "ipv6-sct= p"] + self.send_check_100_packet_queue(ptype_list1, "0", port_id=3D0) + + # Create a rss queue rule + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss types all end /= end", "created") + self.send_check_100_packet_queue(ptype_list1, "all", port_id=3D0) + + # Delete the rule + self.dut.send_expect("flow flush 0", "testpmd> ") + self.send_check_100_packet_queue(ptype_list1, "0", port_id=3D0) + + # Create a rss queue rule + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss types ipv6-tcp = ipv4-udp end queues 5 6 7 end / end", "created") + self.dut.send_expect( + "show port 0 rss-hash", "all ipv4-udp ipv6-tcp udp tcp") + + # send the packets and verify the results + ptype_list2 =3D ["ipv4-udp", "ipv6-tcp"] + ptype_list3 =3D ["ipv4-other", "ipv4-frag", "ipv4-tcp", "ipv4-sctp= ", "ipv6-other", "ipv6-frag", "ipv6-udp", "ipv6-sctp"] + self.send_check_100_packet_queue(ptype_list2, ["5","6","7"], port_= id=3D0) + self.send_check_100_packet_queue(ptype_list3, "0", port_id=3D0) + + def test_flow_director_rss_rule_combination_ixgbe_igb(self): + """ + Set RSS queue rule and flow director rule in meantime. + """ + self.verify(self.nic not in ["fortville_eagle", "fortville_spirit"= , "carlsville", + "fortville_spirit_single", "fortpark_TLV"= , "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D8 --txq=3D8 = --pkt-filter-mode=3Dperfect") + self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) + self.dut.send_expect("set verbose 1", "testpmd> ", 120) + self.dut.send_expect("start", "testpmd> ", 120) + time.sleep(2) + + # Create a rss queue rule + self.dut.send_expect( + "flow create 0 ingress pattern end actions rss types ipv4-udp = end queues 3 4 5 end / end", "created") + self.send_and_check(self.pkt2, ["3", "4", "5"], port_id=3D0) + + # Create a flow director rule + if (self.nic in ["bartonhills", "powerville"]): + self.dut.send_expect( + "flow create 0 ingress pattern eth / ipv4 proto is 17 / ud= p dst is 50 / end actions queue index 1 / end", "created") + self.send_and_check(self.pkt2, ["1"], port_id=3D0) + else: + self.dut.send_expect( + "flow create 0 ingress pattern eth / ipv4 src is 10.0.0.1 = dst is 192.168.0.2 / udp src is 50 dst is 50 / end actions queue index 1 / = end", "created") + self.send_and_check(self.pkt2, ["1"], port_id=3D0) + # Delete the fdir rule + self.dut.send_expect("flow destroy 0 rule 1", "testpmd> ") + self.send_and_check(self.pkt2, ["3", "4", "5"], port_id=3D0) =20 def tear_down(self): """ --=20 2.7.4