test suite reviews and discussions
 help / color / mirror / Atom feed
From: "Liu, Yong" <yong.liu@intel.com>
To: "Xu, GangX" <gangx.xu@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Cc: "Xu, GangX" <gangx.xu@intel.com>
Subject: Re: [dts] [PATCH V2] modify pci prefix error on freebsd
Date: Thu, 8 Sep 2016 08:45:14 +0000	[thread overview]
Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E6022EAC5@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1473321463-8148-1-git-send-email-gangx.xu@intel.com>

Gang, please check code style with pep8 tool. Thanks.

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of xu,gang
> Sent: Thursday, September 08, 2016 3:58 PM
> To: dts@dpdk.org
> Cc: Xu, GangX
> Subject: [dts] [PATCH V2] modify pci prefix error on freebsd
> 
> Signed-off-by: xu,gang <gangx.xu@intel.com>
> ---
>  framework/crb.py   |  2 +-
>  framework/dut.py   | 14 +++++++-------
>  nics/net_device.py | 17 +++++++++--------
>  3 files changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/framework/crb.py b/framework/crb.py
> index 066bb3f..c5faa3e 100644
> --- a/framework/crb.py
> +++ b/framework/crb.py
> @@ -281,7 +281,7 @@ class Crb(object):
>              return None
>          return match.group(1)
> 
> -    def get_pci_dev_driver_freebsd(self, bus_id, devfun_id):
> +    def get_pci_dev_driver_freebsd(self, domain_id,bus_id, devfun_id):

Need space between two parameters, you can check the issue by pep8 command and auto fix by autopep8 command.


>          """
>          Get the driver of specified pci device.
>          """
> diff --git a/framework/dut.py b/framework/dut.py
> index 2f4e53a..1305bed 100644
> --- a/framework/dut.py
> +++ b/framework/dut.py
> @@ -229,10 +229,7 @@ class Dut(Crb):
>          """
>          After all execution done, some special nic like fm10k should be
> stop
>          """
> -        for port in self.ports_info:
> -            pci_bus = port['pci']
> -            pci_id = port['type']
> -            # get device driver
> +        for (pci_bus, pci_id) in self.pci_devices_info:
>              driver = settings.get_nic_driver(pci_id)
>              if driver is not None:
>                  # unbind device driver
> @@ -718,15 +715,18 @@ class Dut(Crb):
>          self.ports_info = []
> 
>          skipped = RED('Skipped: Unknown/not selected')
> -
> +
>          for (pci_bus, pci_id) in self.pci_devices_info:
> 
>              if not dts.accepted_nic(pci_id):
>                  self.logger.info("DUT: [%s %s] %s" % (pci_bus, pci_id,
>                                                        skipped))
>                  continue
> -
> -            port = GetNicObj(self, pci_bus, '')
> +            addr_array = pci_bus.split(':')
> +            domain_id = addr_array[0]
> +            bus_id = addr_array[1]
> +            devfun_id = addr_array[2]
> +            port = GetNicObj(self,domain_id,bus_id,devfun_id)
>              intf = port.get_interface_name()
> 
>              macaddr = port.get_mac_addr()
> diff --git a/nics/net_device.py b/nics/net_device.py
> index 897ceb9..93b7c6b 100644
> --- a/nics/net_device.py
> +++ b/nics/net_device.py
> @@ -136,7 +136,7 @@ class NetDevice(object):
>              socket = -1
>          return socket
> 
> -    def get_nic_socket_freebsd(self, bus_id, devfun_id):
> +    def get_nic_socket_freebsd(self,domain_id, bus_id, devfun_id):
Same as previous comment.

>          NotImplemented
> 
>      @nic_has_driver
> @@ -200,7 +200,7 @@ class NetDevice(object):
>              domain_id, bus_id, devfun_id)
>          return self.__send_expect(command, '# ')
> 
> -    def get_interface_name_freebsd(self, bus_id, devfun_id, driver):
> +    def get_interface_name_freebsd(self, domain_id,bus_id, devfun_id,
> driver):
>          """
>          Get interface name of specified pci device on Freebsd.
>          """
> @@ -212,14 +212,15 @@ class NetDevice(object):
>              get_interface_name_freebsd = getattr(self,
> 
> 'get_interface_name_freebsd_%s' % generic_driver)
> 
> -        return get_interface_name_freebsd(bus_id, devfun_id)
> +        return get_interface_name_freebsd(domain_id,bus_id, devfun_id)
> 
> -    def get_interface_name_freebsd_generic(self, bus_id, devfun_id):
> +    def get_interface_name_freebsd_generic(self, domain_id,bus_id,
> devfun_id):
>          """
>          Get the interface name by the default way on freebsd.
>          """
> +        pci_str = "%s:%s:%s" % (domain_id,bus_id,devfun_id)
Need follow pep8 rule.

>          out = self.__send_expect("pciconf -l", "# ")
> -        rexp = r"(\w*)@pci0:%s" % bus_id
> +        rexp = r"(\w*)@pci0:%s" % pci_str
>          pattern = re.compile(rexp)
>          match = pattern.findall(out)
>          if len(match) == 0:
> @@ -307,7 +308,7 @@ class NetDevice(object):
>                     (domain_id, bus_id, devfun_id, virtio, intf))
>          return self.__send_expect(command, '# ')
> 
> -    def get_mac_addr_freebsd(self, intf, bus_id, devfun_id, driver):
> +    def get_mac_addr_freebsd(self, intf, domain_id, bus_id, devfun_id,
> driver):
>          """
>          Get mac address of specified pci device on Freebsd.
>          """
> @@ -323,9 +324,9 @@ class NetDevice(object):
>                  'get_mac_addr_freebsd_%s' %
>                  generic_driver)
> 
> -        return get_mac_addr_freebsd(intf, bus_id, devfun_id)
> +        return get_mac_addr_freebsd(intf, domain_id, bus_id, devfun_id)
> 
> -    def get_mac_addr_freebsd_generic(self, intf, bus_id, devfun_id):
> +    def get_mac_addr_freebsd_generic(self, intf, domain_id, bus_id,
> devfun_id):
>          """
>          Get the MAC by the default way on Freebsd.
>          """
> --
> 1.9.3

      reply	other threads:[~2016-09-08  8:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08  7:57 xu,gang
2016-09-08  8:45 ` Liu, Yong [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=86228AFD5BCD8E4EBFD2B90117B5E81E6022EAC5@SHSMSX103.ccr.corp.intel.com \
    --to=yong.liu@intel.com \
    --cc=dts@dpdk.org \
    --cc=gangx.xu@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).