[dts] [PATCH V1 1/1] power_branch_ratio: fix port release issue

Tu, Lijuan lijuan.tu at intel.com
Mon Jul 20 09:01:17 CEST 2020


Applied, thanks

> -----Original Message-----
> From: dts <dts-bounces at dpdk.org> On Behalf Of yufengmx
> Sent: 2020年7月7日 13:39
> To: dts at dpdk.org; Yao, Lei A <lei.a.yao at intel.com>
> Cc: Mo, YufengX <yufengx.mo at intel.com>
> Subject: [dts] [PATCH V1 1/1] power_branch_ratio: fix port release issue
> 
> 
> #. fix port release issue.
> 
> Signed-off-by: yufengmx <yufengx.mo at intel.com>
> ---
>  tests/TestSuite_power_branch_ratio.py | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/TestSuite_power_branch_ratio.py
> b/tests/TestSuite_power_branch_ratio.py
> index 8bd82d4..b45ebcb 100644
> --- a/tests/TestSuite_power_branch_ratio.py
> +++ b/tests/TestSuite_power_branch_ratio.py
> @@ -303,10 +303,12 @@ class TestPowerBranchRatio(TestCase):
>          self.dut.build_install_dpdk(self.target)
> 
>      @contextmanager
> -    def restore_compilation(self):
> +    def restore_environment(self):
>          try:
>              yield
>          finally:
> +            time.sleep(10)
> +            self.restore_port_drv()
>              sw_table = [
>                  "CONFIG_RTE_LIBRTE_POWER",
>                  "CONFIG_RTE_LIBRTE_POWER_DEBUG", @@ -319,6 +321,17 @@
> class TestPowerBranchRatio(TestCase):
>              # re-compile dpdk source code
>              self.dut.build_install_dpdk(self.target)
> 
> +    def restore_port_drv(self):
> +        driver = self.drivername
> +        for port in self.dut.ports_info:
> +            netdev = port.get('port')
> +            if not netdev:
> +                continue
> +            cur_drv = netdev.get_nic_driver()
> +            if cur_drv == driver:
> +                continue
> +            netdev.bind_driver(driver)
> +
>      def init_vm_power_mgr(self):
>          self.vm_power_mgr = self.prepare_binary('vm_power_manager')
> 
> @@ -652,7 +665,7 @@ class TestPowerBranchRatio(TestCase):
>          """
>          Run after each test suite.
>          """
> -        with self.restore_compilation():
> +        with self.restore_environment():
>              self.close_vm()
> 
>      def set_up(self):
> --
> 2.21.0



More information about the dts mailing list