test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] fix bug that unbound device then run dts will show wrong interface
@ 2015-07-08  6:18 Yong Liu
  2015-07-08  7:24 ` Qiu, Michael
  2015-07-08  7:36 ` [dts] [PATCH V2] " Yong Liu
  0 siblings, 2 replies; 4+ messages in thread
From: Yong Liu @ 2015-07-08  6:18 UTC (permalink / raw)
  To: dts

From: Marvin Liu <yong.liu@intel.com>

Previously net device interface name only captured in initialization process.
Now every time call get interface function will update it.

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/framework/net_device.py b/framework/net_device.py
index f8ad098..a187d27 100644
--- a/framework/net_device.py
+++ b/framework/net_device.py
@@ -59,7 +59,7 @@ class NetDevice(object):
      
         if self.nic_is_pf():
             self.default_vf_driver = ''
-        self.intf_name = self.get_interface_name()
+        self.get_interface_name()
         self.socket = self.get_nic_socket()
 
     def __send_expect(self, cmds, expected, timeout=TIMEOUT, alt_session=True):
@@ -126,11 +126,18 @@ class NetDevice(object):
     def get_interface_name(self):
         """
         Get interface name of specified pci device.
+        Cal this function will update intf_name everytime
         """
         get_interface_name = getattr(
             self, 'get_interface_name_%s' %
             self.__get_os_type())
-        return get_interface_name(self.bus_id, self.devfun_id, self.current_driver)
+        out = get_interface_name(self.bus_id, self.devfun_id, self.current_driver)
+        if "No such file or directory up" in out:
+            self.intf_name = 'N/A'
+        else:
+            self.intf_name = out
+
+        return self.intf_name
 
     def get_interface_name_linux(self, bus_id, devfun_id, driver):
         """
@@ -197,7 +204,11 @@ class NetDevice(object):
         Get mac address of specified pci device.
         """
         get_mac_addr = getattr(self, 'get_mac_addr_%s' % self.__get_os_type())
-        return get_mac_addr(self.intf_name, self.bus_id, self.devfun_id, self.current_driver)
+        out = get_mac_addr(self.intf_name, self.bus_id, self.devfun_id, self.current_driver)
+        if "No such file or directory up" in out:
+            return 'N/A'
+        else:
+            return out
 
     def get_mac_addr_linux(self, intf, bus_id, devfun_id, driver):
         """
-- 
1.9.3

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dts] [PATCH] fix bug that unbound device then run dts will show wrong interface
  2015-07-08  6:18 [dts] [PATCH] fix bug that unbound device then run dts will show wrong interface Yong Liu
@ 2015-07-08  7:24 ` Qiu, Michael
  2015-07-08  7:35   ` Liu, Yong
  2015-07-08  7:36 ` [dts] [PATCH V2] " Yong Liu
  1 sibling, 1 reply; 4+ messages in thread
From: Qiu, Michael @ 2015-07-08  7:24 UTC (permalink / raw)
  To: Liu, Yong, dts

On 7/8/2015 2:19 PM, Yong Liu wrote:
> From: Marvin Liu <yong.liu@intel.com>
>
> Previously net device interface name only captured in initialization process.
> Now every time call get interface function will update it.
>
> Signed-off-by: Marvin Liu <yong.liu@intel.com>
>
> diff --git a/framework/net_device.py b/framework/net_device.py
> index f8ad098..a187d27 100644
> --- a/framework/net_device.py
> +++ b/framework/net_device.py
> @@ -59,7 +59,7 @@ class NetDevice(object):
>       
>          if self.nic_is_pf():
>              self.default_vf_driver = ''
> -        self.intf_name = self.get_interface_name()
> +        self.get_interface_name()
>          self.socket = self.get_nic_socket()
>  
>      def __send_expect(self, cmds, expected, timeout=TIMEOUT, alt_session=True):
> @@ -126,11 +126,18 @@ class NetDevice(object):
>      def get_interface_name(self):
>          """
>          Get interface name of specified pci device.
> +        Cal this function will update intf_name everytime
>          """
>          get_interface_name = getattr(
>              self, 'get_interface_name_%s' %
>              self.__get_os_type())
> -        return get_interface_name(self.bus_id, self.devfun_id, self.current_driver)
> +        out = get_interface_name(self.bus_id, self.devfun_id, self.current_driver)
> +        if "No such file or directory up" in out:
> +            self.intf_name = 'N/A'
> +        else:
> +            self.intf_name = out
> +
> +        return self.intf_name
>  
>      def get_interface_name_linux(self, bus_id, devfun_id, driver):
>          """
> @@ -197,7 +204,11 @@ class NetDevice(object):
>          Get mac address of specified pci device.
>          """
>          get_mac_addr = getattr(self, 'get_mac_addr_%s' % self.__get_os_type())
> -        return get_mac_addr(self.intf_name, self.bus_id, self.devfun_id, self.current_driver)
> +        out = get_mac_addr(self.intf_name, self.bus_id, self.devfun_id, self.current_driver)
> +        if "No such file or directory up" in out:

Here does "up" need?

> +            return 'N/A'
> +        else:
> +            return out
>  
>      def get_mac_addr_linux(self, intf, bus_id, devfun_id, driver):
>          """


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dts] [PATCH] fix bug that unbound device then run dts will show wrong interface
  2015-07-08  7:24 ` Qiu, Michael
@ 2015-07-08  7:35   ` Liu, Yong
  0 siblings, 0 replies; 4+ messages in thread
From: Liu, Yong @ 2015-07-08  7:35 UTC (permalink / raw)
  To: Qiu, Michael, dts

Thanks, not need 'up' string, will send out V2 patch.

> -----Original Message-----
> From: Qiu, Michael
> Sent: Wednesday, July 08, 2015 3:24 PM
> To: Liu, Yong; dts@dpdk.org
> Subject: Re: [dts] [PATCH] fix bug that unbound device then run dts will
> show wrong interface
> 
> On 7/8/2015 2:19 PM, Yong Liu wrote:
> > From: Marvin Liu <yong.liu@intel.com>
> >
> > Previously net device interface name only captured in initialization
> process.
> > Now every time call get interface function will update it.
> >
> > Signed-off-by: Marvin Liu <yong.liu@intel.com>
> >
> > diff --git a/framework/net_device.py b/framework/net_device.py
> > index f8ad098..a187d27 100644
> > --- a/framework/net_device.py
> > +++ b/framework/net_device.py
> > @@ -59,7 +59,7 @@ class NetDevice(object):
> >
> >          if self.nic_is_pf():
> >              self.default_vf_driver = ''
> > -        self.intf_name = self.get_interface_name()
> > +        self.get_interface_name()
> >          self.socket = self.get_nic_socket()
> >
> >      def __send_expect(self, cmds, expected, timeout=TIMEOUT,
> alt_session=True):
> > @@ -126,11 +126,18 @@ class NetDevice(object):
> >      def get_interface_name(self):
> >          """
> >          Get interface name of specified pci device.
> > +        Cal this function will update intf_name everytime
> >          """
> >          get_interface_name = getattr(
> >              self, 'get_interface_name_%s' %
> >              self.__get_os_type())
> > -        return get_interface_name(self.bus_id, self.devfun_id,
> self.current_driver)
> > +        out = get_interface_name(self.bus_id, self.devfun_id,
> self.current_driver)
> > +        if "No such file or directory up" in out:
> > +            self.intf_name = 'N/A'
> > +        else:
> > +            self.intf_name = out
> > +
> > +        return self.intf_name
> >
> >      def get_interface_name_linux(self, bus_id, devfun_id, driver):
> >          """
> > @@ -197,7 +204,11 @@ class NetDevice(object):
> >          Get mac address of specified pci device.
> >          """
> >          get_mac_addr = getattr(self, 'get_mac_addr_%s' %
> self.__get_os_type())
> > -        return get_mac_addr(self.intf_name, self.bus_id, self.devfun_id,
> self.current_driver)
> > +        out = get_mac_addr(self.intf_name, self.bus_id, self.devfun_id,
> self.current_driver)
> > +        if "No such file or directory up" in out:
> 
> Here does "up" need?
> 
> > +            return 'N/A'
> > +        else:
> > +            return out
> >
> >      def get_mac_addr_linux(self, intf, bus_id, devfun_id, driver):
> >          """

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dts] [PATCH V2] fix bug that unbound device then run dts will show wrong interface
  2015-07-08  6:18 [dts] [PATCH] fix bug that unbound device then run dts will show wrong interface Yong Liu
  2015-07-08  7:24 ` Qiu, Michael
@ 2015-07-08  7:36 ` Yong Liu
  1 sibling, 0 replies; 4+ messages in thread
From: Yong Liu @ 2015-07-08  7:36 UTC (permalink / raw)
  To: dts

From: Marvin Liu <yong.liu@intel.com>

Previously net device interface name only captured in initialization process.
Now every time call get interface function will update it.

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/framework/net_device.py b/framework/net_device.py
index f8ad098..a187d27 100644
--- a/framework/net_device.py
+++ b/framework/net_device.py
@@ -59,7 +59,7 @@ class NetDevice(object):
      
         if self.nic_is_pf():
             self.default_vf_driver = ''
-        self.intf_name = self.get_interface_name()
+        self.get_interface_name()
         self.socket = self.get_nic_socket()
 
     def __send_expect(self, cmds, expected, timeout=TIMEOUT, alt_session=True):
@@ -126,11 +126,18 @@ class NetDevice(object):
     def get_interface_name(self):
         """
         Get interface name of specified pci device.
+        Cal this function will update intf_name everytime
         """
         get_interface_name = getattr(
             self, 'get_interface_name_%s' %
             self.__get_os_type())
-        return get_interface_name(self.bus_id, self.devfun_id, self.current_driver)
+        out = get_interface_name(self.bus_id, self.devfun_id, self.current_driver)
+        if "No such file or directory" in out:
+            self.intf_name = 'N/A'
+        else:
+            self.intf_name = out
+
+        return self.intf_name
 
     def get_interface_name_linux(self, bus_id, devfun_id, driver):
         """
@@ -197,7 +204,11 @@ class NetDevice(object):
         Get mac address of specified pci device.
         """
         get_mac_addr = getattr(self, 'get_mac_addr_%s' % self.__get_os_type())
-        return get_mac_addr(self.intf_name, self.bus_id, self.devfun_id, self.current_driver)
+        out = get_mac_addr(self.intf_name, self.bus_id, self.devfun_id, self.current_driver)
+        if "No such file or directory" in out:
+            return 'N/A'
+        else:
+            return out
 
     def get_mac_addr_linux(self, intf, bus_id, devfun_id, driver):
         """
-- 
1.9.3

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-07-08  7:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-08  6:18 [dts] [PATCH] fix bug that unbound device then run dts will show wrong interface Yong Liu
2015-07-08  7:24 ` Qiu, Michael
2015-07-08  7:35   ` Liu, Yong
2015-07-08  7:36 ` [dts] [PATCH V2] " Yong Liu

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).