DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue
@ 2015-02-26  4:57 Ouyang Changchun
  2015-02-26  5:52 ` Xu, Qian Q
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Ouyang Changchun @ 2015-02-26  4:57 UTC (permalink / raw)
  To: dev

In virtio test, on guest
1. Bind virtio port to igb_uio driver;
2. Remove igb_uio module;
3. Bind virtio port to virtio-pci driver, it fails and reports:
   "Error - no supported modules are loaded"

The tool should check the to-be-bound driver flag, if it is dpdk driver(igb_uio, vfio etc),
and the corresponding module is not loaded, then exit, otherwise, just report a warning,
and continue to bind the non-dpdk driver(like virtio-pci) to dev.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
 tools/dpdk_nic_bind.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py
index 2483056..8523f82 100755
--- a/tools/dpdk_nic_bind.py
+++ b/tools/dpdk_nic_bind.py
@@ -175,8 +175,11 @@ def check_modules():
 
     # check if we have at least one loaded module
     if True not in [mod["Found"] for mod in mods] and b_flag is not None:
-        print "Error - no supported modules are loaded"
-        sys.exit(1)
+        if b_flag in dpdk_drivers:
+            print "Error - no supported modules(DPDK driver) are loaded"
+            sys.exit(1)
+        else:
+            print "Warning - no supported modules(DPDK driver) are loaded"
 
     # change DPDK driver list to only contain drivers that are loaded
     dpdk_drivers = [mod["Name"] for mod in mods if mod["Found"]]
-- 
1.8.4.2

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

* Re: [dpdk-dev] [PATCH] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue
  2015-02-26  4:57 [dpdk-dev] [PATCH] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue Ouyang Changchun
@ 2015-02-26  5:52 ` Xu, Qian Q
  2015-03-03 11:43 ` Bruce Richardson
  2015-03-04  2:55 ` [dpdk-dev] [PATCH v2] " Ouyang Changchun
  2 siblings, 0 replies; 7+ messages in thread
From: Xu, Qian Q @ 2015-02-26  5:52 UTC (permalink / raw)
  To: Ouyang, Changchun, dev

Tested-by: Qian Xu <qian.q.xu@intel.com>

- Tested Commit: b67578ccdf45df9fd0f0204578b71acd854ca834
- OS: Fedora20 3.11
- GCC: gcc version 4.8.3 20140624
- CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
- NIC: Intel 82599 Ethernet 10G SFI/SFP+ Network Connection
- Default x86_64-native-linuxapp-gcc configuration
- Total 1 case, 1 passed, 0 failed

- Case: bind virtio-pci driver when igb_uio is removed
Steps:   
1. Bind virtio port to igb_uio driver;
2. Remove igb_uio module;
3. Bind virtio port to virtio-pci driver, it can be binded to virtio-pci driver and also have a warning that no supported modules(DPDK Driver) are loaded.
   
Signed-off-by: Qian Xu <qian.q.xu@intel.com>
 
-----Original Message-----
From: Ouyang, Changchun 
Sent: Thursday, February 26, 2015 12:58 PM
To: dev@dpdk.org
Cc: Richardson, Bruce; Cao, Waterman; Ouyang, Changchun
Subject: [PATCH] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue

In virtio test, on guest
1. Bind virtio port to igb_uio driver;
2. Remove igb_uio module;
3. Bind virtio port to virtio-pci driver, it fails and reports:
   "Error - no supported modules are loaded"

The tool should check the to-be-bound driver flag, if it is dpdk driver(igb_uio, vfio etc), and the corresponding module is not loaded, then exit, otherwise, just report a warning, and continue to bind the non-dpdk driver(like virtio-pci) to dev.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
 tools/dpdk_nic_bind.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py index 2483056..8523f82 100755
--- a/tools/dpdk_nic_bind.py
+++ b/tools/dpdk_nic_bind.py
@@ -175,8 +175,11 @@ def check_modules():
 
     # check if we have at least one loaded module
     if True not in [mod["Found"] for mod in mods] and b_flag is not None:
-        print "Error - no supported modules are loaded"
-        sys.exit(1)
+        if b_flag in dpdk_drivers:
+            print "Error - no supported modules(DPDK driver) are loaded"
+            sys.exit(1)
+        else:
+            print "Warning - no supported modules(DPDK driver) are loaded"
 
     # change DPDK driver list to only contain drivers that are loaded
     dpdk_drivers = [mod["Name"] for mod in mods if mod["Found"]]
--
1.8.4.2

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

* Re: [dpdk-dev] [PATCH] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue
  2015-02-26  4:57 [dpdk-dev] [PATCH] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue Ouyang Changchun
  2015-02-26  5:52 ` Xu, Qian Q
@ 2015-03-03 11:43 ` Bruce Richardson
  2015-03-04  2:41   ` Ouyang, Changchun
  2015-03-04  2:55 ` [dpdk-dev] [PATCH v2] " Ouyang Changchun
  2 siblings, 1 reply; 7+ messages in thread
From: Bruce Richardson @ 2015-03-03 11:43 UTC (permalink / raw)
  To: Ouyang Changchun; +Cc: dev

On Thu, Feb 26, 2015 at 12:57:49PM +0800, Ouyang Changchun wrote:
First off, I think the title needs to be changed. How about something like:
"dpdk_nic_bind: don't exit if an unused module is missing"

> In virtio test, on guest
> 1. Bind virtio port to igb_uio driver;
> 2. Remove igb_uio module;
> 3. Bind virtio port to virtio-pci driver, it fails and reports:
>    "Error - no supported modules are loaded"
> 
> The tool should check the to-be-bound driver flag, if it is dpdk driver(igb_uio, vfio etc),
> and the corresponding module is not loaded, then exit, otherwise, just report a warning,
> and continue to bind the non-dpdk driver(like virtio-pci) to dev.

This is a good description of the problem. Once you change the title, I think an
initial sentence is needed here by way of intro - such as:
"The dpdk_nic_bind script will not allow ports to be bound or unbound if
none of the kernel modules supported by DPDK is loaded. This patch relaxes this
restriction by checking if a DPDK module is actually requested. The example
below illustrates this problem:"

> 
> Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
> ---
>  tools/dpdk_nic_bind.py | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py
> index 2483056..8523f82 100755
> --- a/tools/dpdk_nic_bind.py
> +++ b/tools/dpdk_nic_bind.py
> @@ -175,8 +175,11 @@ def check_modules():
>  
>      # check if we have at least one loaded module
>      if True not in [mod["Found"] for mod in mods] and b_flag is not None:
> -        print "Error - no supported modules are loaded"
> -        sys.exit(1)
> +        if b_flag in dpdk_drivers:
> +            print "Error - no supported modules(DPDK driver) are loaded"
> +            sys.exit(1)
> +        else:
> +            print "Warning - no supported modules(DPDK driver) are loaded"
>  
>      # change DPDK driver list to only contain drivers that are loaded
>      dpdk_drivers = [mod["Name"] for mod in mods if mod["Found"]]
> -- 
> 1.8.4.2
> 
This is a worthwhile change. However, I think it could be made better:
* If we try to bind a device to ixgbe, and ixgbe is not loaded, we get no error
from the script
* If igb_uio is loaded and we try to bind a device to vfio which is not loaded
again we get no error from the script.

If would be nice if instead of this checking explicitly for DPDK modules, we 
just check if the module to be bound is present and give an error if not.

/Bruce

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

* Re: [dpdk-dev] [PATCH] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue
  2015-03-03 11:43 ` Bruce Richardson
@ 2015-03-04  2:41   ` Ouyang, Changchun
  0 siblings, 0 replies; 7+ messages in thread
From: Ouyang, Changchun @ 2015-03-04  2:41 UTC (permalink / raw)
  To: Richardson, Bruce; +Cc: dev

Hi,

> -----Original Message-----
> From: Richardson, Bruce
> Sent: Tuesday, March 3, 2015 7:44 PM
> To: Ouyang, Changchun
> Cc: dev@dpdk.org; Cao, Waterman
> Subject: Re: [PATCH] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue
> 
> On Thu, Feb 26, 2015 at 12:57:49PM +0800, Ouyang Changchun wrote:
> First off, I think the title needs to be changed. How about something like:
> "dpdk_nic_bind: don't exit if an unused module is missing"
> 
> > In virtio test, on guest
> > 1. Bind virtio port to igb_uio driver; 2. Remove igb_uio module; 3.
> > Bind virtio port to virtio-pci driver, it fails and reports:
> >    "Error - no supported modules are loaded"
> >
> > The tool should check the to-be-bound driver flag, if it is dpdk
> > driver(igb_uio, vfio etc), and the corresponding module is not loaded,
> > then exit, otherwise, just report a warning, and continue to bind the non-
> dpdk driver(like virtio-pci) to dev.
> 
> This is a good description of the problem. Once you change the title, I think
> an initial sentence is needed here by way of intro - such as:
> "The dpdk_nic_bind script will not allow ports to be bound or unbound if
> none of the kernel modules supported by DPDK is loaded. This patch relaxes
> this restriction by checking if a DPDK module is actually requested. The
> example below illustrates this problem:"
> 

Will update this description in v2.
Thanks

> >
> > Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
> > ---
> >  tools/dpdk_nic_bind.py | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py index
> > 2483056..8523f82 100755
> > --- a/tools/dpdk_nic_bind.py
> > +++ b/tools/dpdk_nic_bind.py
> > @@ -175,8 +175,11 @@ def check_modules():
> >
> >      # check if we have at least one loaded module
> >      if True not in [mod["Found"] for mod in mods] and b_flag is not None:
> > -        print "Error - no supported modules are loaded"
> > -        sys.exit(1)
> > +        if b_flag in dpdk_drivers:
> > +            print "Error - no supported modules(DPDK driver) are loaded"
> > +            sys.exit(1)
> > +        else:
> > +            print "Warning - no supported modules(DPDK driver) are loaded"
> >
> >      # change DPDK driver list to only contain drivers that are loaded
> >      dpdk_drivers = [mod["Name"] for mod in mods if mod["Found"]]
> > --
> > 1.8.4.2
> >
> This is a worthwhile change. However, I think it could be made better:
> * If we try to bind a device to ixgbe, and ixgbe is not loaded, we get no error
> from the script
> * If igb_uio is loaded and we try to bind a device to vfio which is not loaded
> again we get no error from the script.
> 
> If would be nice if instead of this checking explicitly for DPDK modules, we
> just check if the module to be bound is present and give an error if not.
>
 
For all these cases, they could be detected in function bind_one,
If any module exactly required can't be found/opened,  it will go to except branch and raise a error message like:
Error: bind failed ..... Cannot open.....

Thanks
Changchun

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

* [dpdk-dev] [PATCH v2] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue
  2015-02-26  4:57 [dpdk-dev] [PATCH] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue Ouyang Changchun
  2015-02-26  5:52 ` Xu, Qian Q
  2015-03-03 11:43 ` Bruce Richardson
@ 2015-03-04  2:55 ` Ouyang Changchun
  2015-03-04 11:31   ` Qiu, Michael
  2 siblings, 1 reply; 7+ messages in thread
From: Ouyang Changchun @ 2015-03-04  2:55 UTC (permalink / raw)
  To: dev

The dpdk_nic_bind script will not allow ports to be bound or unbound if none of the
kernel modules supported by DPDK is loaded. This patch relaxes this restriction by
checking if a DPDK module is actually requested. The example below illustrates this
problem:

In virtio test, on the guest
1. Bind virtio port to igb_uio driver;
2. Remove igb_uio module;
3. Bind virtio port to virtio-pci driver, it fails and reports:
   "Error - no supported modules are loaded"

The script should check the to-be-bound driver flag, if it is dpdk driver(igb_uio, vfio etc),
and the corresponding module is not loaded, then exit, otherwise, just report a warning,
and continue to bind the non-dpdk driver(like virtio-pci) to dev.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---

Changes in v2:
  -- Update the description.

 tools/dpdk_nic_bind.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py
index 2483056..8523f82 100755
--- a/tools/dpdk_nic_bind.py
+++ b/tools/dpdk_nic_bind.py
@@ -175,8 +175,11 @@ def check_modules():
 
     # check if we have at least one loaded module
     if True not in [mod["Found"] for mod in mods] and b_flag is not None:
-        print "Error - no supported modules are loaded"
-        sys.exit(1)
+        if b_flag in dpdk_drivers:
+            print "Error - no supported modules(DPDK driver) are loaded"
+            sys.exit(1)
+        else:
+            print "Warning - no supported modules(DPDK driver) are loaded"
 
     # change DPDK driver list to only contain drivers that are loaded
     dpdk_drivers = [mod["Name"] for mod in mods if mod["Found"]]
-- 
1.8.4.2

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

* Re: [dpdk-dev] [PATCH v2] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue
  2015-03-04  2:55 ` [dpdk-dev] [PATCH v2] " Ouyang Changchun
@ 2015-03-04 11:31   ` Qiu, Michael
  2015-03-05 20:31     ` Thomas Monjalon
  0 siblings, 1 reply; 7+ messages in thread
From: Qiu, Michael @ 2015-03-04 11:31 UTC (permalink / raw)
  To: Ouyang, Changchun, dev

On 3/4/2015 10:56 AM, Ouyang Changchun wrote:
> The dpdk_nic_bind script will not allow ports to be bound or unbound if none of the
> kernel modules supported by DPDK is loaded. This patch relaxes this restriction by
> checking if a DPDK module is actually requested. The example below illustrates this
> problem:
>
> In virtio test, on the guest
> 1. Bind virtio port to igb_uio driver;
> 2. Remove igb_uio module;
> 3. Bind virtio port to virtio-pci driver, it fails and reports:
>    "Error - no supported modules are loaded"
>
> The script should check the to-be-bound driver flag, if it is dpdk driver(igb_uio, vfio etc),
> and the corresponding module is not loaded, then exit, otherwise, just report a warning,
> and continue to bind the non-dpdk driver(like virtio-pci) to dev.
>
> Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
> ---
>
> Changes in v2:
>   -- Update the description.
>
>  tools/dpdk_nic_bind.py | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py
> index 2483056..8523f82 100755
> --- a/tools/dpdk_nic_bind.py
> +++ b/tools/dpdk_nic_bind.py
> @@ -175,8 +175,11 @@ def check_modules():
>  
>      # check if we have at least one loaded module
>      if True not in [mod["Found"] for mod in mods] and b_flag is not None:
> -        print "Error - no supported modules are loaded"
> -        sys.exit(1)
> +        if b_flag in dpdk_drivers:
> +            print "Error - no supported modules(DPDK driver) are loaded"
> +            sys.exit(1)
> +        else:
> +            print "Warning - no supported modules(DPDK driver) are loaded"
>  
>      # change DPDK driver list to only contain drivers that are loaded
>      dpdk_drivers = [mod["Name"] for mod in mods if mod["Found"]]
Acked-by: Michael Qiu <michael.qiu@intel.com>

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

* Re: [dpdk-dev] [PATCH v2] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue
  2015-03-04 11:31   ` Qiu, Michael
@ 2015-03-05 20:31     ` Thomas Monjalon
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2015-03-05 20:31 UTC (permalink / raw)
  To: Ouyang, Changchun; +Cc: dev

> > The dpdk_nic_bind script will not allow ports to be bound or unbound if none of the
> > kernel modules supported by DPDK is loaded. This patch relaxes this restriction by
> > checking if a DPDK module is actually requested. The example below illustrates this
> > problem:
> >
> > In virtio test, on the guest
> > 1. Bind virtio port to igb_uio driver;
> > 2. Remove igb_uio module;
> > 3. Bind virtio port to virtio-pci driver, it fails and reports:
> >    "Error - no supported modules are loaded"
> >
> > The script should check the to-be-bound driver flag, if it is dpdk driver(igb_uio, vfio etc),
> > and the corresponding module is not loaded, then exit, otherwise, just report a warning,
> > and continue to bind the non-dpdk driver(like virtio-pci) to dev.
> >
> > Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
> Acked-by: Michael Qiu <michael.qiu@intel.com>

Applied, thanks

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

end of thread, other threads:[~2015-03-05 20:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-26  4:57 [dpdk-dev] [PATCH] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue Ouyang Changchun
2015-02-26  5:52 ` Xu, Qian Q
2015-03-03 11:43 ` Bruce Richardson
2015-03-04  2:41   ` Ouyang, Changchun
2015-03-04  2:55 ` [dpdk-dev] [PATCH v2] " Ouyang Changchun
2015-03-04 11:31   ` Qiu, Michael
2015-03-05 20:31     ` Thomas Monjalon

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