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 CF186A0546; Wed, 7 Apr 2021 03:22:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A0597140FEA; Wed, 7 Apr 2021 03:22:11 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id D9654407FF for ; Wed, 7 Apr 2021 03:22:09 +0200 (CEST) IronPort-SDR: tF4L86n5y18OoO4BFrXqJ+PbR90+UyufzvyWi274JQ3edUcbwMVUydY4eoH3ZHBxAhl4yy4tRI 5Nv5NopB0JYA== X-IronPort-AV: E=McAfee;i="6000,8403,9946"; a="193237231" X-IronPort-AV: E=Sophos;i="5.82,201,1613462400"; d="scan'208";a="193237231" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2021 18:22:08 -0700 IronPort-SDR: Hab91cOb9NeVZcbQngRhYtj0gb2j/9IoOtRRxSBmkbYDAF5+CZ3+qrS6jb774wiIvYEHPyN0/l WyIMcsMsPTPg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,201,1613462400"; d="scan'208";a="381128860" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga006.jf.intel.com with ESMTP; 06 Apr 2021 18:22:08 -0700 Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 6 Apr 2021 18:22:07 -0700 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by SHSMSX603.ccr.corp.intel.com (10.109.6.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Wed, 7 Apr 2021 09:22:05 +0800 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.2106.013; Wed, 7 Apr 2021 09:22:05 +0800 From: "Tu, Lijuan" To: "Ling, WeiX" , "dts@dpdk.org" CC: "Ling, WeiX" Thread-Topic: [dts] [PATCH V1] tests/vhost_cbdma: add bind dut ports to DPDK-compatible driver step Thread-Index: AQHXJezZDjwFU2u4xkuIM5wKIwJyW6qoSnYQ Date: Wed, 7 Apr 2021 01:22:05 +0000 Message-ID: <89568be275104e48a5cddaef565efda5@intel.com> References: <20210331051316.602359-1-weix.ling@intel.com> In-Reply-To: <20210331051316.602359-1-weix.ling@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V1] tests/vhost_cbdma: add bind dut ports to DPDK-compatible driver step 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 Sender: "dts" > -----Original Message----- > From: dts On Behalf Of Ling Wei > Sent: 2021=1B$BG/=1B(B3=1B$B7n=1B(B31=1B$BF|=1B(B 13:13 > To: dts@dpdk.org > Cc: Ling, WeiX > Subject: [dts] [PATCH V1] tests/vhost_cbdma: add bind dut ports to DPDK- > compatible driver step >=20 > Add bind dut ports to DPDK-compatible driver method and step in tear_down > after test_check_threshold_value_with_cbdma > exectue over. >=20 > Signed-off-by: Ling Wei > --- > tests/TestSuite_vhost_cbdma.py | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) >=20 > diff --git a/tests/TestSuite_vhost_cbdma.py b/tests/TestSuite_vhost_cbdma= .py > index 260c534e..5699a7db 100644 > --- a/tests/TestSuite_vhost_cbdma.py > +++ b/tests/TestSuite_vhost_cbdma.py > @@ -110,6 +110,22 @@ class TestVirTioVhostCbdma(TestCase): > self.dut.send_expect("rm -rf /tmp/s0", "#") > self.mode_list =3D [] >=20 > + def bind_nic_driver(self, ports, driver=3D""): > + if driver =3D=3D "igb_uio": > + for port in ports: > + netdev =3D self.dut.ports_info[port]['port'] > + driver =3D netdev.get_nic_driver() > + if driver !=3D 'igb_uio': > + netdev.bind_driver(driver=3D'igb_uio') > + else: > + for port in ports: > + netdev =3D self.dut.ports_info[port]['port'] > + driver_now =3D netdev.get_nic_driver() > + if driver =3D=3D "": > + driver =3D netdev.default_driver > + if driver !=3D driver_now: > + netdev.bind_driver(driver=3Ddriver) Too many duplicated code, prefer to reduce them as following: for port in ports: netdev =3D self.dut.ports_info[port]['port'] driver_now =3D netdev.get_nic_driver() if driver =3D=3D "": driver =3D netdev.default_driver if driver !=3D driver_now: netdev.bind_driver(driver=3Ddriver)=20 > + > def get_cbdma_ports_info_and_bind_to_dpdk(self, cbdma_num): > """ > get all cbdma ports > @@ -533,6 +549,8 @@ class TestVirTioVhostCbdma(TestCase): > """ > self.dut.send_expect("killall -I %s" % self.testpmd_name, '#', 2= 0) > self.bind_cbdma_device_to_kernel() > + if self.running_case =3D=3D 'test_check_threshold_value_with_cbd= ma': > + self.bind_nic_driver(self.dut_ports, self.drivername) >=20 > def tear_down_all(self): > """ > -- > 2.25.1