test suite reviews and discussions
 help / color / mirror / Atom feed
From: "Tu, Lijuan" <lijuan.tu@intel.com>
To: "Ling, WeiX" <weix.ling@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Cc: "Ling, WeiX" <weix.ling@intel.com>
Subject: Re: [dts] [PATCH V1] tests/vhost_cbdma: add bind dut ports to DPDK-compatible driver step
Date: Wed, 7 Apr 2021 01:22:05 +0000	[thread overview]
Message-ID: <89568be275104e48a5cddaef565efda5@intel.com> (raw)
In-Reply-To: <20210331051316.602359-1-weix.ling@intel.com>



> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Ling Wei
> Sent: 2021年3月31日 13:13
> To: dts@dpdk.org
> Cc: Ling, WeiX <weix.ling@intel.com>
> Subject: [dts] [PATCH V1] tests/vhost_cbdma: add bind dut ports to DPDK-
> compatible driver step
> 
> Add bind dut ports to DPDK-compatible driver method and step in tear_down
> after test_check_threshold_value_with_cbdma
> exectue over.
> 
> Signed-off-by: Ling Wei <weix.ling@intel.com>
> ---
>  tests/TestSuite_vhost_cbdma.py | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> 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 = []
> 
> +    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)

Too many duplicated code, prefer to reduce them as following:

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
> @@ -533,6 +549,8 @@ class TestVirTioVhostCbdma(TestCase):
>          """
>          self.dut.send_expect("killall -I %s" % self.testpmd_name, '#', 20)
>          self.bind_cbdma_device_to_kernel()
> +        if self.running_case == 'test_check_threshold_value_with_cbdma':
> +            self.bind_nic_driver(self.dut_ports, self.drivername)
> 
>      def tear_down_all(self):
>          """
> --
> 2.25.1


      parent reply	other threads:[~2021-04-07  1:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-31  5:13 Ling Wei
2021-03-31  5:16 ` Ling, WeiX
2021-04-02  7:47   ` Wang, Yinan
2021-04-07  1:22 ` Tu, Lijuan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=89568be275104e48a5cddaef565efda5@intel.com \
    --to=lijuan.tu@intel.com \
    --cc=dts@dpdk.org \
    --cc=weix.ling@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).