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 23BE3A04B6; Thu, 17 Sep 2020 08:28:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BD11B1D508; Thu, 17 Sep 2020 08:28:32 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 7A8CF1D453 for ; Thu, 17 Sep 2020 08:28:30 +0200 (CEST) IronPort-SDR: 7GzfB76H9u/hwGuj+1nW49m1yaLAahNUTpq//UR0KMT36yMBdZ9gv3ZQc3dFDQUccVsOyrlrNN S2A0vddxCT3w== X-IronPort-AV: E=McAfee;i="6000,8403,9746"; a="177721023" X-IronPort-AV: E=Sophos;i="5.76,435,1592895600"; d="scan'208";a="177721023" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2020 23:28:29 -0700 IronPort-SDR: RrFbCs3R3T4se1XZv0GoFy7vj57KfjE73dzB919XzWTB2x4k1eRdWTFaLFGrnKDcTBBKuHwoHP hm4Cg/NCXq/A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,435,1592895600"; d="scan'208";a="409800941" Received: from unknown (HELO localhost.localdomain) ([10.240.183.80]) by fmsmga001.fm.intel.com with ESMTP; 16 Sep 2020 23:28:28 -0700 From: JiangYuX To: dts@dpdk.org Cc: JiangYu Date: Thu, 17 Sep 2020 14:28:06 +0800 Message-Id: <20200917062806.6335-1-yux.jiang@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dts] [PATCH V1] tests/TestSuite_dpdk_gro_lib: add 1 cbdma script 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" From: JiangYu 1, add 1 cbdma script: test_vhost_gro_tcp_ipv4_with_cbdma_enable 2, modify start_vm: csum=on,gso=on 3, adapt launch_testpmd_gro_on para: mode and queue Signed-off-by: JiangYu --- tests/TestSuite_dpdk_gro_lib.py | 121 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 111 insertions(+), 10 deletions(-) diff --git a/tests/TestSuite_dpdk_gro_lib.py b/tests/TestSuite_dpdk_gro_lib.py index f2b5b0d..3f23e3e 100644 --- a/tests/TestSuite_dpdk_gro_lib.py +++ b/tests/TestSuite_dpdk_gro_lib.py @@ -97,6 +97,12 @@ class TestDPDKGROLib(TestCase): self.prepare_dpdk() self.base_dir = self.dut.base_dir.replace('~', '/root') + self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) + # get cbdma device + self.cbdma_dev_infos = [] + self.dmas_info = None + self.device_str = None + def set_up(self): # # Run before each test case. @@ -106,15 +112,60 @@ class TestDPDKGROLib(TestCase): self.dut.send_expect("killall -s INT %s" % self.testpmd_name, "#") self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") - def launch_testpmd_gro_on(self, mode=1): + def get_cbdma_ports_info_and_bind_to_dpdk(self, cbdma_num): + """ + get all cbdma ports + """ + str_info = 'Misc (rawdev) devices using kernel driver' + out = self.dut.send_expect('./usertools/dpdk-devbind.py --status-dev misc', '# ', 30) + device_info = out.split('\n') + for device in device_info: + pci_info = re.search('\s*(0000:\d*:\d*.\d*)', device) + if pci_info is not None: + dev_info = pci_info.group(1) + # the numa id of ioat dev, only add the device which + # on same socket with nic dev + bus = int(dev_info[5:7], base=16) + if bus >= 128: + cur_socket = 1 + else: + cur_socket = 0 + if self.ports_socket == cur_socket: + self.cbdma_dev_infos.append(pci_info.group(1)) + self.verify(len(self.cbdma_dev_infos) >= cbdma_num, 'There no enough cbdma device to run this suite') + used_cbdma = self.cbdma_dev_infos[0:cbdma_num] + dmas_info = '' + for dmas in used_cbdma: + number = used_cbdma.index(dmas) + dmas = 'txq{}@{};'.format(number, dmas) + dmas_info += dmas + self.dmas_info = dmas_info[:-1] + self.device_str = ' '.join(self.cbdma_dev_infos) + self.dut.setup_modules(self.target, "igb_uio","None") + self.dut.send_expect('./usertools/dpdk-devbind.py --force --bind=%s %s' % ("igb_uio", self.device_str), '# ', 60) + + def bind_cbdma_device_to_kernel(self): + if self.device_str is not None: + self.dut.send_expect('modprobe ioatdma', '# ') + self.dut.send_expect('./usertools/dpdk-devbind.py -u %s' % self.device_str, '# ', 30) + self.dut.send_expect('./usertools/dpdk-devbind.py --force --bind=ioatdma %s' % self.device_str, '# ', 60) + + def launch_testpmd_gro_on(self, mode=1, queue=1): # # Launch the vhost sample with different parameters # mode 1 : tcp traffic light mode # mode 2 : tcp traffic heavy mode # mode 3 : vxlan traffic light mode # mode 4 : tcp traffic flush 4 - eal_param = self.dut.create_eal_parameters(cores=self.vhost_list, vdevs=['net_vhost0,iface=%s/vhost-net,queues=1' % self.base_dir]) - self.testcmd_start = self.path + eal_param + " -- -i --enable-hw-vlan-strip --tx-offloads=0x00 --txd=1024 --rxd=1024" + # mode 5 : tcp traffice light mode with cdbma enable + if mode == 5: + self.get_cbdma_ports_info_and_bind_to_dpdk(cbdma_num=2) + self.dut.send_expect('./usertools/dpdk-devbind.py --force --bind=igb_uio %s' % self.pci, '# ', 20) + eal_param = self.dut.create_eal_parameters(cores=self.vhost_list, vdevs=["'net_vhost0,iface=%s/vhost-net,queues=%s,dmas=[%s],dmathr=1024'" % (self.base_dir, queue, self.dmas_info)]) + self.testcmd_start = self.path + eal_param + " -- -i --txd=1024 --rxd=1024 --txq=2 --rxq=2" + else: + eal_param = self.dut.create_eal_parameters(cores=self.vhost_list, vdevs=['net_vhost0,iface=%s/vhost-net,queues=%s' % (self.base_dir, queue)]) + self.testcmd_start = self.path + eal_param + " -- -i --enable-hw-vlan-strip --tx-offloads=0x00 --txd=1024 --rxd=1024" self.vhost_user = self.dut.new_session(suite="user") self.vhost_user.send_expect(self.testcmd_start, "testpmd> ", 120) self.vhost_user.send_expect("set fwd csum", "testpmd> ", 120) @@ -125,13 +176,13 @@ class TestDPDKGROLib(TestCase): self.vhost_user.send_expect("csum set ip hw 0", "testpmd> ", 120) self.vhost_user.send_expect("csum set tcp hw 1", "testpmd> ", 120) self.vhost_user.send_expect("csum set ip hw 1", "testpmd> ", 120) - if(mode == 1): + if(mode == 1 or mode == 5): self.vhost_user.send_expect("set port 0 gro on", "testpmd> ", 120) self.vhost_user.send_expect("set gro flush 1", "testpmd> ", 120) - if(mode == 2): + elif(mode == 2): self.vhost_user.send_expect("set port 0 gro on", "testpmd> ", 120) self.vhost_user.send_expect("set gro flush 2", "testpmd> ", 120) - if (mode == 3): + elif (mode == 3): self.vhost_user.send_expect("csum parse-tunnel on 1", "testpmd> ", 120) self.vhost_user.send_expect("csum parse-tunnel on 0", "testpmd> ", 120) self.vhost_user.send_expect("csum set outer-ip hw 0", "testpmd> ", 120) @@ -240,15 +291,18 @@ class TestDPDKGROLib(TestCase): vm_config.params[i]['cpu'][0]['number'] = 1 vm_config.params[i]['cpu'][0]['cpupin'] = self.qemu_cpupin - def start_vm(self): + def start_vm(self, mode=1, queue=1): self.vm1 = VM(self.dut, 'vm0', 'vhost_sample') self.vm1.load_config() vm_params_1 = {} vm_params_1['driver'] = 'vhost-user' vm_params_1['opt_path'] = self.base_dir + '/vhost-net' vm_params_1['opt_mac'] = self.virtio_mac1 - vm_params_1[ - 'opt_settings'] = 'mrg_rxbuf=on,csum=off,gso=off,host_tso4=on,guest_tso4=on' + if mode == 5: + vm_params_1['opt_queue'] = queue + vm_params_1['opt_settings'] = 'mrg_rxbuf=on,csum=on,gso=on,host_tso4=on,guest_tso4=on,mq=on,vectors=15' + else: + vm_params_1['opt_settings'] = 'mrg_rxbuf=on,csum=on,gso=on,host_tso4=on,guest_tso4=on' self.vm1.set_vm_device(**vm_params_1) self.set_vm_cpu_number(self.vm1) try: @@ -275,6 +329,15 @@ class TestDPDKGROLib(TestCase): self.result_table_print() self.output_result = "Iperf throughput is %s" % iperfdata[-1] self.logger.info(self.output_result) + iperfdata_kb = 0 + tmp_value = iperfdata[-1].split(" ")[0] + if 'Gbits' in iperfdata[-1]: + iperfdata_kb = float(tmp_value)*1000000 + elif 'Mbits' in iperfdata[-1]: + iperfdata_kb = float(tmp_value)*1000 + else: + iperfdata_kb = float(tmp_value) + return iperfdata_kb def test_vhost_gro_tcp_lightmode(self): self.config_kernel_nic_host(0) @@ -299,7 +362,7 @@ class TestDPDKGROLib(TestCase): 'ip netns exec ns1 iperf -c %s -i 1 -t 10 -P 1> /root/iperf_client.log &' % (self.virtio_ip1), '', 180) time.sleep(30) - self.iperf_result_verify('GRO lib') + tc1_perfdata = self.iperf_result_verify('GRO lib') print(("the GRO lib %s " % (self.output_result))) self.dut.send_expect('rm /root/iperf_client.log', '#', 10) # Turn off DPDK GRO lib and Kernel GRO off @@ -313,6 +376,7 @@ class TestDPDKGROLib(TestCase): self.dut.send_expect('rm /root/iperf_client.log', '#', 10) self.quit_testpmd() self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") + self.dut.send_expect('echo %s > /root/dpdk_gro_lib_on_iperf_tc1.log' % tc1_perfdata, '#', 10) def test_vhost_gro_tcp_heavymode(self): self.config_kernel_nic_host(0) @@ -376,6 +440,42 @@ class TestDPDKGROLib(TestCase): self.quit_testpmd() self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") + def test_vhost_gro_tcp_ipv4_with_cbdma_enable(self): + self.config_kernel_nic_host(0) + self.heavymode = 5 + self.launch_testpmd_gro_on(self.heavymode, queue=2) + self.start_vm(mode=5, queue=2) + time.sleep(5) + self.dut.get_session_output(timeout=2) + # Get the virtio-net device name + for port in self.vm1_dut.ports_info: + self.vm1_intf = port['intf'] + # Start the Iperf test + self.vm1_dut.send_expect('ifconfig -a', '#', 30) + self.vm1_dut.send_expect( + 'ifconfig %s %s up' % + (self.vm1_intf, self.virtio_ip1), '#', 10) + self.vm1_dut.send_expect('ethtool -L %s combined 2' % self.vm1_intf, '#', 10) + self.vm1_dut.send_expect( + 'ethtool -K %s gro off' % + (self.vm1_intf), '#', 10) + self.vm1_dut.send_expect('iperf -s', '', 10) + self.dut.send_expect('rm /root/iperf_client.log', '#', 10) + out = self.dut.send_expect( + 'ip netns exec ns1 iperf -c %s -i 1 -t 60 -m -P 2 > /root/iperf_client.log &' % + (self.virtio_ip1), '', 180) + time.sleep(30) + print(out) + tc4_perfdata = self.iperf_result_verify('GRO lib') + print(("the GRO lib %s " % (self.output_result))) + #self.dut.send_expect('rm /root/iperf_client.log', '#', 10) + self.quit_testpmd() + self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") + tc1_perfdata = self.dut.send_expect("cat /root/dpdk_gro_lib_on_iperf_tc1.log", "#") + self.verify("No such file or directory" not in tc1_perfdata, "Cannot find dpdk_gro_lib_on_iperf_tc1.log, please run test_vhost_gro_tcp_lightmode firstly") + if tc1_perfdata: + self.verify(float(tc4_perfdata) > float(tc1_perfdata), "TestFailed: W/cbdma iperf data is %s Kbits/sec, W/O cbdma iperf data is %s Kbits/sec" %(tc4_perfdata, tc1_perfdata)) + def tear_down(self): """ Run after each test case. @@ -390,6 +490,7 @@ class TestDPDKGROLib(TestCase): self.dut.send_expect( "./usertools/dpdk-devbind.py -b %s %s" % (self.pci_drv, self.peer_pci), '# ', 30) + self.bind_cbdma_device_to_kernel() def tear_down_all(self): """ -- 2.7.4