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 743B2A0C41; Wed, 17 Nov 2021 10:26:40 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6144841144; Wed, 17 Nov 2021 10:26:40 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 7C65140040 for ; Wed, 17 Nov 2021 10:26:38 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10170"; a="257679333" X-IronPort-AV: E=Sophos;i="5.87,241,1631602800"; d="scan'208";a="257679333" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2021 01:26:37 -0800 X-IronPort-AV: E=Sophos;i="5.87,241,1631602800"; d="scan'208";a="735752715" Received: from shwdenpg197.ccr.corp.intel.com ([10.253.106.73]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2021 01:26:35 -0800 From: DongJunX To: dts@dpdk.org Cc: PingX.Yu@intel.com, weix.ling@intel.com, junx.dong@intel.com Subject: [dts] [PATCH V1] framework/test_case: removed bind_nic_driver common func to framework Date: Wed, 17 Nov 2021 17:26:30 +0800 Message-Id: <20211117092630.2797-1-junx.dong@intel.com> X-Mailer: git-send-email 2.33.1.windows.1 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 Signed-off-by: DongJunX --- framework/test_case.py | 7 ++++++ tests/TestSuite_ddp_gtp.py | 18 +------------- tests/TestSuite_ddp_mpls.py | 18 -------------- tests/TestSuite_iavf.py | 24 ------------------- tests/TestSuite_kernelpf_iavf.py | 25 -------------------- tests/TestSuite_port_control.py | 25 -------------------- tests/TestSuite_shutdown_api.py | 15 ------------ tests/TestSuite_vf_daemon.py | 17 ------------- tests/TestSuite_vf_jumboframe.py | 25 -------------------- tests/TestSuite_vf_vlan.py | 25 -------------------- tests/TestSuite_vhost_cbdma.py | 9 ------- tests/TestSuite_vhost_event_idx_interrupt.py | 9 ------- tests/TestSuite_vm2vm_virtio_net_perf.py | 16 ------------- tests/TestSuite_vm2vm_virtio_pmd.py | 9 ------- tests/TestSuite_vm2vm_virtio_user.py | 16 ------------- 15 files changed, 8 insertions(+), 250 deletions(-) diff --git a/framework/test_case.py b/framework/test_case.py index af4683da..6fa14583 100644 --- a/framework/test_case.py +++ b/framework/test_case.py @@ -533,6 +533,13 @@ class TestCase(object): return bitrate * num_ports / 8 / (frame_size + 20) + def bind_nic_driver(self, ports, driver=""): + for port in ports: + netdev = self.dut.ports_info[port]['port'] + driver_now = netdev.get_nic_driver() + driver_new = driver if driver else netdev.default_driver + if driver_new != driver_now: + netdev.bind_driver(driver=driver_new) def skip_unsupported_pkg(pkgs): """ diff --git a/tests/TestSuite_ddp_gtp.py b/tests/TestSuite_ddp_gtp.py index f2037e91..c86b07b3 100644 --- a/tests/TestSuite_ddp_gtp.py +++ b/tests/TestSuite_ddp_gtp.py @@ -125,26 +125,10 @@ class TestDdpGtp(TestCase): else: if Q_strip is self.VF_Q_strip: queue = res.group(1) - else : + else: queue = res.group(2) return int(queue) - def bind_nic_driver(self, ports, driver=""): - if driver == "igb_uio": - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'igb_uio': - netdev.bind_driver(driver='igb_uio') - else: - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver_now = netdev.get_nic_driver() - if driver == "": - driver = netdev.default_driver - if driver != driver_now: - netdev.bind_driver(driver=driver) - def setup_vm_env(self, driver='igb_uio'): """ Create testing environment with VF generated from 1PF diff --git a/tests/TestSuite_ddp_mpls.py b/tests/TestSuite_ddp_mpls.py index c0fabe8b..12d04573 100644 --- a/tests/TestSuite_ddp_mpls.py +++ b/tests/TestSuite_ddp_mpls.py @@ -72,24 +72,6 @@ class Testddp_mpls(TestCase): def set_up(self): self.setup_vm_env() - - def bind_nic_driver(self, ports, driver=""): - if driver == "igb_uio": - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'igb_uio': - netdev.bind_driver(driver='igb_uio') - else: - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver_now = netdev.get_nic_driver() - if driver == "": - driver = netdev.default_driver - if driver != driver_now: - netdev.bind_driver(driver=driver) - - def setup_vm_env(self, driver='default'): """ Create testing environment with VF generated from 1PF diff --git a/tests/TestSuite_iavf.py b/tests/TestSuite_iavf.py index 01942b5e..9ff8aba6 100644 --- a/tests/TestSuite_iavf.py +++ b/tests/TestSuite_iavf.py @@ -150,30 +150,6 @@ class TestIavf(TestCase): self.vm0_testpmd = PmdOutput(self.vm_dut_0) self.env_done = True - def bind_nic_driver(self, ports, driver=""): - # modprobe vfio driver - if driver == "vfio-pci": - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'vfio-pci': - netdev.bind_driver(driver='vfio-pci') - elif driver == "igb_uio": - # igb_uio should insmod as default, no need to check - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'igb_uio': - netdev.bind_driver(driver='igb_uio') - else: - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver_now = netdev.get_nic_driver() - if driver == "": - driver = netdev.default_driver - if driver != driver_now: - netdev.bind_driver(driver=driver) - def destroy_vm_env(self): if getattr(self, 'vm0', None): if getattr(self, 'vm_dut_0', None): diff --git a/tests/TestSuite_kernelpf_iavf.py b/tests/TestSuite_kernelpf_iavf.py index 540a4e98..3d320f12 100644 --- a/tests/TestSuite_kernelpf_iavf.py +++ b/tests/TestSuite_kernelpf_iavf.py @@ -114,31 +114,6 @@ class TestKernelpfIavf(TestCase): elif self.env_done is False: self.setup_vm_env() - def bind_nic_driver(self, ports, driver=""): - # modprobe vfio driver - if driver == "vfio-pci": - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'vfio-pci': - netdev.bind_driver(driver='vfio-pci') - - elif driver == "igb_uio": - # igb_uio should insmod as default, no need to check - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'igb_uio': - netdev.bind_driver(driver='igb_uio') - else: - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver_now = netdev.get_nic_driver() - if driver is None: - driver = netdev.default_driver - if driver != driver_now: - netdev.bind_driver(driver=driver) - def setup_vm_env(self, driver='default', set_vf_mac=True): """ Create testing environment with 1VF generated from 1PF diff --git a/tests/TestSuite_port_control.py b/tests/TestSuite_port_control.py index 299714e1..d5f26ff0 100755 --- a/tests/TestSuite_port_control.py +++ b/tests/TestSuite_port_control.py @@ -125,31 +125,6 @@ class TestPortControl(TestCase): self.env_done = False - def bind_nic_driver(self, ports, driver=""): - # modprobe vfio driver - if driver == "vfio-pci": - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'vfio-pci': - netdev.bind_driver(driver='vfio-pci') - - elif driver == "igb_uio": - # igb_uio should insmod as default, no need to check - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'igb_uio': - netdev.bind_driver(driver='igb_uio') - else: - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver_now = netdev.get_nic_driver() - if driver is None: - driver = netdev.default_driver - if driver != driver_now: - netdev.bind_driver(driver=driver) - def start_vf_pmd(self, terminal): drive_info = terminal.send_expect("./usertools/dpdk-devbind.py -s", "#") diff --git a/tests/TestSuite_shutdown_api.py b/tests/TestSuite_shutdown_api.py index 624f46d5..9f40d232 100644 --- a/tests/TestSuite_shutdown_api.py +++ b/tests/TestSuite_shutdown_api.py @@ -216,21 +216,6 @@ class TestShutdownApi(TestCase): break self.verify("Link status: up" in out, "VF link down!!!") - def bind_nic_driver(self, ports, driver=""): - if driver == "igb_uio": - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'igb_uio': - netdev.bind_driver(driver='igb_uio') - else: - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver_now = netdev.get_nic_driver() - if driver == "": - driver = netdev.default_driver - if driver != driver_now: - netdev.bind_driver(driver=driver) def setup_vm_env(self, driver='default'): """ Create testing environment with 1VF generated from 1PF diff --git a/tests/TestSuite_vf_daemon.py b/tests/TestSuite_vf_daemon.py index 62996ade..19cecddf 100644 --- a/tests/TestSuite_vf_daemon.py +++ b/tests/TestSuite_vf_daemon.py @@ -84,23 +84,6 @@ class TestVfDaemon(TestCase): break self.verify("Link status: up" in out, "VF link down!!!") - def bind_nic_driver(self, ports, driver=""): - if driver == "igb_uio": - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'igb_uio': - netdev.bind_driver(driver='igb_uio') - else: - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver_now = netdev.get_nic_driver() - if driver == "": - driver = netdev.default_driver - if driver != driver_now: - netdev.bind_driver(driver=driver) - - def setup_vm_env(self, driver='default'): """ Create testing environment with 2VFs generated from 1PF diff --git a/tests/TestSuite_vf_jumboframe.py b/tests/TestSuite_vf_jumboframe.py index 9c5db0ae..2a7b1261 100644 --- a/tests/TestSuite_vf_jumboframe.py +++ b/tests/TestSuite_vf_jumboframe.py @@ -84,31 +84,6 @@ class TestVfJumboFrame(TestCase): def set_up(self): pass - def bind_nic_driver(self, ports, driver=""): - # modprobe vfio driver - if driver == "vfio-pci": - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'vfio-pci': - netdev.bind_driver(driver='vfio-pci') - - elif driver == "igb_uio": - # igb_uio should insmod as default, no need to check - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'igb_uio': - netdev.bind_driver(driver='igb_uio') - else: - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver_now = netdev.get_nic_driver() - if driver == None: - driver = netdev.default_driver - if driver != driver_now: - netdev.bind_driver(driver=driver) - def setup_vm_env(self, driver='default'): """ Create testing environment with 1VF generated from 1PF diff --git a/tests/TestSuite_vf_vlan.py b/tests/TestSuite_vf_vlan.py index 429f9038..cfefdbe9 100644 --- a/tests/TestSuite_vf_vlan.py +++ b/tests/TestSuite_vf_vlan.py @@ -78,31 +78,6 @@ class TestVfVlan(TestCase): def set_up(self): self.setup_vm_env() - def bind_nic_driver(self, ports, driver=""): - # modprobe vfio driver - if driver == "vfio-pci": - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'vfio-pci': - netdev.bind_driver(driver='vfio-pci') - - elif driver == "igb_uio": - # igb_uio should insmod as default, no need to check - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'igb_uio': - netdev.bind_driver(driver='igb_uio') - else: - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver_now = netdev.get_nic_driver() - if driver == "": - driver = netdev.default_driver - if driver != driver_now: - netdev.bind_driver(driver=driver) - def setup_vm_env(self, driver='default'): """ Create testing environment with 2VFs generated from 2PFs diff --git a/tests/TestSuite_vhost_cbdma.py b/tests/TestSuite_vhost_cbdma.py index 034b9b24..9330a558 100644 --- a/tests/TestSuite_vhost_cbdma.py +++ b/tests/TestSuite_vhost_cbdma.py @@ -112,15 +112,6 @@ class TestVirTioVhostCbdma(TestCase): self.dut.send_expect("rm -rf /tmp/s0", "#") self.mode_list = [] - def bind_nic_driver(self, ports, driver=""): - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver_now = netdev.get_nic_driver() - if driver == "": - driver = netdev.default_driver - if driver != driver_now: - netdev.bind_driver(driver=driver) - def get_cbdma_ports_info_and_bind_to_dpdk(self, cbdma_num): """ get all cbdma ports diff --git a/tests/TestSuite_vhost_event_idx_interrupt.py b/tests/TestSuite_vhost_event_idx_interrupt.py index 4e318b6b..be934677 100644 --- a/tests/TestSuite_vhost_event_idx_interrupt.py +++ b/tests/TestSuite_vhost_event_idx_interrupt.py @@ -280,15 +280,6 @@ class TestVhostEventIdxInterrupt(TestCase): session_info[sess_index].send_expect("^c", "#") self.vm_dut[vm_index].close_session(session_info[sess_index]) - def bind_nic_driver(self, ports, driver=""): - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver_now = netdev.get_nic_driver() - if driver == "": - driver = netdev.default_driver - if driver != driver_now: - netdev.bind_driver(driver=driver) - def get_cbdma_ports_info_and_bind_to_dpdk(self): """ get all cbdma ports diff --git a/tests/TestSuite_vm2vm_virtio_net_perf.py b/tests/TestSuite_vm2vm_virtio_net_perf.py index ae9b3d2f..c627bd96 100644 --- a/tests/TestSuite_vm2vm_virtio_net_perf.py +++ b/tests/TestSuite_vm2vm_virtio_net_perf.py @@ -339,22 +339,6 @@ class TestVM2VMVirtioNetPerf(TestCase): md5_revd = md5_revd[: md5_revd.find(' ')] self.verify(md5_send == md5_revd, 'the received file is different with send file') - def bind_nic_driver(self, ports, driver=""): - if driver == "igb_uio": - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'igb_uio': - netdev.bind_driver(driver='igb_uio') - else: - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver_now = netdev.get_nic_driver() - if driver == "": - driver = netdev.default_driver - if driver != driver_now: - netdev.bind_driver(driver=driver) - def test_vm2vm_split_ring_iperf_with_tso(self): """ TestCase1: VM2VM split ring vhost-user/virtio-net test with tcp traffic diff --git a/tests/TestSuite_vm2vm_virtio_pmd.py b/tests/TestSuite_vm2vm_virtio_pmd.py index f2af6d85..5e0148b2 100644 --- a/tests/TestSuite_vm2vm_virtio_pmd.py +++ b/tests/TestSuite_vm2vm_virtio_pmd.py @@ -733,15 +733,6 @@ class TestVM2VMVirtioPMD(TestCase): 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 bind_nic_driver(self, ports, driver=""): - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver_now = netdev.get_nic_driver() - if driver == "": - driver = netdev.default_driver - if driver != driver_now: - netdev.bind_driver(driver=driver) - def tear_down(self): # # Run after each test case. diff --git a/tests/TestSuite_vm2vm_virtio_user.py b/tests/TestSuite_vm2vm_virtio_user.py index f758ab76..9c6bad1b 100644 --- a/tests/TestSuite_vm2vm_virtio_user.py +++ b/tests/TestSuite_vm2vm_virtio_user.py @@ -738,22 +738,6 @@ class TestVM2VMVirtioUser(TestCase): 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 bind_nic_driver(self, ports, driver=""): - if driver == "igb_uio": - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver = netdev.get_nic_driver() - if driver != 'igb_uio': - netdev.bind_driver(driver='igb_uio') - else: - for port in ports: - netdev = self.dut.ports_info[port]['port'] - driver_now = netdev.get_nic_driver() - if driver == "": - driver = netdev.default_driver - if driver != driver_now: - netdev.bind_driver(driver=driver) - def test_vm2vm_virtio_user_split_virtqueue_inorder_mergeable_path_with_cbdma(self): """ Test Case 12: split virtqueue vm2vm inorder mergeable path multi-queues payload check with cbdma enabled -- 2.33.1.windows.1