From patchwork Wed Jul 29 16:41:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lu, Nannan" X-Patchwork-Id: 74975 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DE6D4A052B; Wed, 29 Jul 2020 09:49:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D1BB81BFFA; Wed, 29 Jul 2020 09:49:44 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 710571BFF5 for ; Wed, 29 Jul 2020 09:49:43 +0200 (CEST) IronPort-SDR: QRl1asgEccAX5mfdQHV8unNnNDxey8kuKsncfPpnl4SI5IxYaGcxl2dm4XwXkKf9Q3WJLL8AVl nVQ0VlTxV+qA== X-IronPort-AV: E=McAfee;i="6000,8403,9696"; a="148832466" X-IronPort-AV: E=Sophos;i="5.75,409,1589266800"; d="scan'208";a="148832466" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2020 00:49:42 -0700 IronPort-SDR: JSWvyKtRfB7A5OwrE9WFMT71978iVxhemO6s1yqQUoOOseyplUnAwliHoUWaEkfbHSs8fuGWDC vlcnENEK3vZQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,409,1589266800"; d="scan'208";a="490206281" Received: from dpdk-lunannan.sh.intel.com ([10.67.111.68]) by fmsmga006.fm.intel.com with ESMTP; 29 Jul 2020 00:49:41 -0700 From: Nannan Lu To: dts@dpdk.org Cc: Nannan Lu Date: Wed, 29 Jul 2020 16:41:34 +0000 Message-Id: <1596040894-1659533-1-git-send-email-nannan.lu@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dts] [PATCH V1] tests/TestSuite_cvl_dcf_switch_filter.py: Modify max_vfs case to adapt to different CVL NICs 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" Modify max_vfs test case to make the case adapt to different CVL NICs with different number of ports. Signed-off-by: Nannan Lu --- tests/TestSuite_cvl_dcf_switch_filter.py | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/tests/TestSuite_cvl_dcf_switch_filter.py b/tests/TestSuite_cvl_dcf_switch_filter.py index c15fd31..c4d0ef3 100644 --- a/tests/TestSuite_cvl_dcf_switch_filter.py +++ b/tests/TestSuite_cvl_dcf_switch_filter.py @@ -1550,25 +1550,32 @@ class CVLDCFSwitchFilterTest(TestCase): matched_dic["check_func"]["func"](out, matched_dic["check_func"]["param"], matched_dic["expect_results"], tx_dic["check_func"]["param"], tx_dic["expect_results"]) def test_max_vfs(self): - #set up 64 vfs on 1 pf environment + # get max vfs number + max_vf_number = int(256/(len(self.dut_ports))) + #set up max_vf_number vfs on 1 pf environment self.used_dut_port_0 = self.dut_ports[0] self.pf0_intf = self.dut.ports_info[self.used_dut_port_0]['intf'] out = self.dut.send_expect('ethtool -i %s' % self.pf0_intf, '#') - #generate 64 VFs on PF0 - self.dut.generate_sriov_vfs_by_port(self.used_dut_port_0, 64, driver='default') + #generate max_vf_number VFs on PF0 + self.dut.generate_sriov_vfs_by_port(self.used_dut_port_0, max_vf_number, driver='default') self.sriov_vfs_port = self.dut.ports_info[self.used_dut_port_0]['vfs_port'] + #bind max_vf_number vfs to iavf + iavf_driver_file_location = self.suite_config["iavf_driver_file_location"] + self.dut.send_expect("rmmod iavf", "# ", 15) + self.dut.send_expect("insmod %s" % iavf_driver_file_location, "# ", 60) + time.sleep(2) + for port in self.sriov_vfs_port: + port.bind_driver('iavf') #sort the vf interfaces and pcis by pcis vfs = {} for vf_port in self.sriov_vfs_port: - vf_port.bind_driver() vfs[vf_port.pci] = vf_port.intf_name vfs_sort = sorted(vfs.items(), key=lambda item:item[0]) vf_pci = [key for key,value in vfs_sort] vf_intf = [value for key,value in vfs_sort] - #start the 64 VFs in the kernel + #start the max_vf_number VFs in the kernel for intf in vf_intf: self.dut.send_expect('ifconfig %s up' % intf, '#') - self.dut.send_expect('ip link set %s vf 0 trust on' % self.pf0_intf, '#') self.dut.send_expect('./usertools/dpdk-devbind.py -b %s %s' % (self.vf_driver, vf_pci[0]), '# ') time.sleep(5) @@ -1579,25 +1586,29 @@ class CVLDCFSwitchFilterTest(TestCase): command = "./%s/app/testpmd %s -- -i" % (self.dut.target, all_eal_param) out = self.dut.send_expect(command, "testpmd> ", 15) self.testpmd_status = "running" - #generate 63 rules to each vf and matched packets - for i in range(1,64): + #generate max_vf_number-1 rules to each vf and matched packets + for i in range(1,max_vf_number): rte_flow_pattern = "flow create 0 ingress pattern eth / ipv4 src is 192.168.0.%d / tcp / end actions vf id %d / end" % (i, i) tv_max_vfs["rte_flow_pattern"].append(rte_flow_pattern) matched_scapy_str = 'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.0.%d")/TCP()/Raw("X"*480)' % i tv_max_vfs["matched"]["scapy_str"].append(matched_scapy_str) out = self.dut.send_expect("show port info all", "testpmd> ", 15) - #create 63 rules + #create max_vf_number-1 rules rule_list = self.create_switch_filter_rule(tv_max_vfs["rte_flow_pattern"]) self.check_switch_filter_rule_list(0, rule_list) #send matched packets and check + tv_max_vfs["matched"]["check_func"]["param"]["expect_port"] = list(range(1, max_vf_number)) + tv_max_vfs["matched"]["expect_results"]["expect_pkts"] = [1]*(max_vf_number-1) matched_dic = tv_max_vfs["matched"] out = self.send_packets(matched_dic) - #check the 63 packets received by each vf + #check the max_vf_number-1 packets received by each vf self.session_secondary = self.dut.new_session(suite="session_secondary") #get the log of each kernel vf out_vfs = self.get_kernel_vf_log(vf_intf, self.session_secondary) matched_dic["check_func"]["func"](out_vfs, matched_dic["expect_results"]["expect_pkts"]) #send mismatched packets and check + tv_max_vfs["mismatched"]["check_func"]["param"]["expect_port"] = list(range(1, max_vf_number)) + tv_max_vfs["mismatched"]["expect_results"]["expect_pkts"] = [1]*(max_vf_number-1) mismatched_dic = tv_max_vfs["mismatched"] out = self.send_packets(mismatched_dic) #get the log of each kernel vf @@ -1614,6 +1625,7 @@ class CVLDCFSwitchFilterTest(TestCase): out_vfs = self.get_kernel_vf_log(vf_intf, self.session_secondary) #the kernel vf will not clear the statistics automatically, the rx packets number is still the same destroy_dict["check_func"]["func"](out_vfs, destroy_dict["expect_results"]["expect_pkts"]) + def test_max_field_vectors(self): #set up 4 vfs on 1 pf environment