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 CD52FA0551; Fri, 26 Aug 2022 04:43:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A43B40146; Fri, 26 Aug 2022 04:43:11 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id CF301400D6 for ; Fri, 26 Aug 2022 04:43:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661481790; x=1693017790; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Q0DpYI6zAynrwDTf0hYGMfM2WBSt927NBZ/MZC4hWkw=; b=enUViskSrAaQIb4uGh5zKIM5G5/7pwFTIOi24gtJ/63MTa+NDCfSwhhe v99rh/6zTbiRh3ZMdEgKqAWpQSqtsaj+hs6lRwaIBp3cN7hioKdcP/E/3 KYPNy7UPWJq5XodyRNjNB+0q0U9XoYKvt5SLnIuBD41695LVsUTVLpFWv BaJun4upxSeg9RjVbKXtSjYQbChLtOd99o8Po4AWhoRvViziSPhHJI4ZV IXfbFBnFI+O2dw7Wszq3Zfg0WX1VcacX0Z62MKhhUOdMnFdDokLM9Ypw7 sbx0+w8pV21ysTJgv0cnL7yOGzInhFobM/79COxlsfzx6YuPnniLLF86d w==; X-IronPort-AV: E=McAfee;i="6500,9779,10450"; a="295187340" X-IronPort-AV: E=Sophos;i="5.93,264,1654585200"; d="scan'208";a="295187340" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 19:43:08 -0700 X-IronPort-AV: E=Sophos;i="5.93,264,1654585200"; d="scan'208";a="671275170" Received: from unknown (HELO localhost.localdomain) ([10.239.252.248]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 19:43:06 -0700 From: Weiyuan Li To: dts@dpdk.org Cc: Weiyuan Li , Jiale Song Subject: [dts][PATCH V2 01/10] tests/vf_offload: update dts code for dpdk csum change Date: Fri, 26 Aug 2022 10:42:59 +0800 Message-Id: <20220826024308.17447-1-weiyuanx.li@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 According to dpdk commit 9b4ea7ae77fa(app/testpmd: revert MAC update in checksum forwarding) modify the script adapt to this chagne. 1. Modify VF case to enable promisc. 2. Modify PF case to send packet dst mac is random. Signed-off-by: Weiyuan Li --- Tested-by: Jiale Song < songx.jiale@intel.com> v2: -Added enable promisc model tests/TestSuite_vf_offload.py | 100 ++++++++++++++++++++++++---------- 1 file changed, 70 insertions(+), 30 deletions(-) diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py index 4dd05cac..eee77c69 100644 --- a/tests/TestSuite_vf_offload.py +++ b/tests/TestSuite_vf_offload.py @@ -43,7 +43,7 @@ class TestVfOffload(TestCase): self.setup_2pf_2vf_1vm_env_flag = 0 self.setup_2pf_2vf_1vm_env(driver="") self.vm0_dut_ports = self.vm_dut_0.get_ports("any") - self.portMask = utils.create_mask([self.vm0_dut_ports[0]]) + self.portMask = utils.create_mask(self.vm0_dut_ports) self.vm0_testpmd = PmdOutput(self.vm_dut_0) self.tester.send_expect( "ifconfig %s mtu %s" @@ -59,6 +59,14 @@ class TestVfOffload(TestCase): def set_up(self): pass + def ip_link_set(self, host_intf=None, cmd=None, port=None, types=None, value=0): + if host_intf is None or cmd is None or port is None or types is None: + return + set_command = f"ip link set {host_intf} {cmd} {port} {types} {value}" + out = self.dut.send_expect(set_command, "# ") + if "RTNETLINK answers: Invalid argument" in out: + self.dut.send_expect(set_command, "# ") + def setup_2pf_2vf_1vm_env(self, driver="default"): self.used_dut_port_0 = self.dut_ports[0] @@ -68,6 +76,37 @@ class TestVfOffload(TestCase): self.dut.generate_sriov_vfs_by_port(self.used_dut_port_1, 1, driver=driver) self.sriov_vfs_port_1 = self.dut.ports_info[self.used_dut_port_1]["vfs_port"] + self.host_intf_0 = self.dut.ports_info[self.used_dut_port_0]["intf"] + self.host_intf_1 = self.dut.ports_info[self.used_dut_port_1]["intf"] + + self.ip_link_set( + host_intf=self.host_intf_0, + cmd="vf", + port=0, + types="trust", + value="on", + ) + self.ip_link_set( + host_intf=self.host_intf_1, + cmd="vf", + port=0, + types="trust", + value="on", + ) + self.ip_link_set( + host_intf=self.host_intf_0, + cmd="vf", + port=0, + types="spoofchk", + value="off", + ) + self.ip_link_set( + host_intf=self.host_intf_1, + cmd="vf", + port=0, + types="spoofchk", + value="off", + ) try: for port in self.sriov_vfs_port_0: @@ -154,12 +193,11 @@ class TestVfOffload(TestCase): self.tester.get_local_port(self.dut_ports[0]) ) rx_interface = self.tester.get_interface( - self.tester.get_local_port(self.dut_ports[0]) + self.tester.get_local_port(self.dut_ports[1]) ) - sniff_src = self.vm0_testpmd.get_port_mac(0) checksum_pattern = re.compile("chksum.*=.*(0x[0-9a-z]+)") - + sniff_src = "52:00:00:00:00:00" chksum = dict() result = dict() @@ -175,16 +213,11 @@ class TestVfOffload(TestCase): self.tester.send_expect("exit()", "#") self.tester.scapy_background() - self.tester.scapy_append( - 'p = sniff(filter="ether src %s", iface="%s", count=%d)' - % (sniff_src, rx_interface, len(packets_sent)) + inst = self.tester.tcpdump_sniff_packets( + intf=rx_interface, + count=len(packets_sent), + filters=[{"layer": "ether", "config": {"src": sniff_src}}], ) - self.tester.scapy_append("nr_packets=len(p)") - self.tester.scapy_append( - 'reslist = [p[i].sprintf("%IP.chksum%;%TCP.chksum%;%UDP.chksum%;%SCTP.chksum%") for i in range(nr_packets)]' - ) - self.tester.scapy_append("import string") - self.tester.scapy_append('RESULT = ",".join(reslist)') # Send packet. self.tester.scapy_foreground() @@ -196,7 +229,15 @@ class TestVfOffload(TestCase): self.tester.scapy_execute() out = self.tester.scapy_get_result() - packets_received = out.split(",") + + p = self.tester.load_tcpdump_sniff_packets(inst) + nr_packets = len(p) + print(p) + packets_received = [ + p[i].sprintf("%IP.chksum%;%TCP.chksum%;%UDP.chksum%;%SCTP.chksum%") + for i in range(nr_packets) + ] + self.verify( len(packets_sent) == len(packets_received), "Unexpected Packets Drop" ) @@ -251,17 +292,15 @@ class TestVfOffload(TestCase): """ self.vm0_testpmd.start_testpmd( VM_CORES_MASK, - "--portmask=%s " % (self.portMask) - + "--enable-rx-cksum " - + "" - + "--port-topology=loop", + "--portmask=%s " % (self.portMask) + "--enable-rx-cksum " + "", ) self.vm0_testpmd.execute_cmd("set fwd csum") + self.vm0_testpmd.execute_cmd("set promisc 1 on") + self.vm0_testpmd.execute_cmd("set promisc 0 on") time.sleep(2) port_id_0 = 0 mac = self.vm0_testpmd.get_port_mac(0) - sndIP = "10.0.0.1" sndIPv6 = "::1" pkts = { @@ -280,19 +319,20 @@ class TestVfOffload(TestCase): expIP = sndIP expIPv6 = sndIPv6 pkts_ref = { - "IP/UDP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="%s")/UDP()/("X"*46)' + "IP/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s")/UDP()/("X"*46)' % (mac, expIP), - "IP/TCP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="%s")/TCP()/("X"*46)' + "IP/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s")/TCP()/("X"*46)' % (mac, expIP), - "IP/SCTP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="%s")/SCTP()/("X"*48)' + "IP/SCTP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s")/SCTP()/("X"*48)' % (mac, expIP), - "IPv6/UDP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="%s")/UDP()/("X"*46)' + "IPv6/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/UDP()/("X"*46)' % (mac, expIPv6), - "IPv6/TCP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="%s")/TCP()/("X"*46)' + "IPv6/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/TCP()/("X"*46)' % (mac, expIPv6), } self.checksum_enablehw(0, self.vm_dut_0) + self.checksum_enablehw(1, self.vm_dut_0) self.vm0_testpmd.execute_cmd("start") result = self.checksum_validate(pkts, pkts_ref) @@ -311,14 +351,13 @@ class TestVfOffload(TestCase): Enable SW checksum offload. Send same packet with incorrect checksum and verify checksum is valid. """ - self.vm0_testpmd.start_testpmd( VM_CORES_MASK, - "--portmask=%s " % (self.portMask) - + "--enable-rx-cksum " - + "--port-topology=loop", + "--portmask=%s " % (self.portMask) + "--enable-rx-cksum " + "", ) self.vm0_testpmd.execute_cmd("set fwd csum") + self.vm0_testpmd.execute_cmd("set promisc 1 on") + self.vm0_testpmd.execute_cmd("set promisc 0 on") time.sleep(2) @@ -350,6 +389,7 @@ class TestVfOffload(TestCase): } self.checksum_enablesw(0, self.vm_dut_0) + self.checksum_enablesw(1, self.vm_dut_0) self.vm0_testpmd.execute_cmd("start") result = self.checksum_validate(sndPkts, expPkts) @@ -457,7 +497,6 @@ class TestVfOffload(TestCase): ) mac = self.vm0_testpmd.get_port_mac(0) - self.vm0_testpmd.execute_cmd("set verbose 1", "testpmd> ", 120) self.vm0_testpmd.execute_cmd("port stop all", "testpmd> ", 120) self.vm0_testpmd.execute_cmd( @@ -501,7 +540,8 @@ class TestVfOffload(TestCase): self.vm0_testpmd.execute_cmd("tso set 800 %d" % self.vm0_dut_ports[1]) self.vm0_testpmd.execute_cmd("set fwd csum") self.vm0_testpmd.execute_cmd("port start all", "testpmd> ", 120) - self.vm0_testpmd.execute_cmd("set promisc all off", "testpmd> ", 120) + self.vm0_testpmd.execute_cmd("set promisc 0 on", "testpmd> ", 120) + self.vm0_testpmd.execute_cmd("set promisc 1 on", "testpmd> ", 120) self.vm0_testpmd.execute_cmd("start") self.tester.scapy_foreground() -- 2.25.1