DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Add option to dpdk-devbind.py to restore kernel driver binding
@ 2018-04-10 10:55 Tosatti, Giovanni
  2018-04-10 12:55 ` Burakov, Anatoly
  2018-04-10 13:19 ` Burakov, Anatoly
  0 siblings, 2 replies; 8+ messages in thread
From: Tosatti, Giovanni @ 2018-04-10 10:55 UTC (permalink / raw)
  To: dev

This patch adds a " --restore" option that will unbind all devices currently bound to DPDK PMDs back to the kernel driver.

--- /opt/Perforce/gtosatti_centos/E-XMS/CSA-Mainline/Third-Party/dpdk/dpdk-16.07.orig/tools/dpdk-devbind.py
+++ /opt/Perforce/gtosatti_centos/E-XMS/CSA-Mainline/Third-Party/dpdk/dpdk-16.07/tools/dpdk-devbind.py
@@ -91,6 +91,9 @@
     -u, --unbind:
         Unbind a device (Equivalent to \"-b none\")
 
+    -r, --restore
+        Restore ALL the DPDK devices to their kernel drivers
+
     --force:
         By default, devices which are used by Linux - as indicated by having
         routes in the routing table - cannot be modified. Using the --force
@@ -448,6 +451,21 @@
         if "Driver_str" in devices[d]:
             unbind_one(d, force)
 
+def restore_all_to_kernel():
+    global force_flag
+    # List all the available devices
+    for d in devices.keys():
+        if not has_driver(d):
+	    # Discard the unbinded devices
+            continue
+        if devices[d]["Driver_str"] in dpdk_drivers:
+            # List the unused Drivers of the the DPDK Devices...  
+	    unused_drivers = devices[d]["Module_str"].split(",")
+            print("Restoring kernel driver for: %s '%s' '%s'" % (devices[d]["Slot"],
+                  devices[d]["Device_str"], devices[d]["Module_str"]))
+            # Bind the current Device to the FIRST unused Driver
+            if unused_drivers:
+                bind_one(devices[d]["Slot"], unused_drivers[0], force_flag)
 
 def display_devices(title, dev_list, extra_params=None):
     '''Displays to the user the details of a list of devices given in
@@ -513,7 +531,7 @@
     try:
         opts, args = getopt.getopt(sys.argv[1:], "b:us",
                                    ["help", "usage", "status", "force",
-                                    "bind=", "unbind"])
+                                    "bind=", "unbind", "restore"])
     except getopt.GetoptError as error:
         print(str(error))
         print("Run '%s --usage' for further information" % sys.argv[0])
@@ -527,11 +545,15 @@
             status_flag = True
         if opt == "--force":
             force_flag = True
-        if opt == "-b" or opt == "-u" or opt == "--bind" or opt == "--unbind":
+        if (opt == "-b" or opt == "--bind" or
+            opt == "-u" or opt == "--unbind" or
+            opt == "-r" or opt == "--restore"):
             if b_flag is not None:
                 print("Error - Only one bind or unbind may be specified\n")
                 sys.exit(1)
-            if opt == "-u" or opt == "--unbind":
+            if opt == "-r" or opt == "--restore":
+                b_flag = "restore"
+            elif opt == "-u" or opt == "--unbind":
                 b_flag = "none"
             else:
                 b_flag = arg
@@ -551,11 +573,14 @@
         sys.exit(1)
 
     if b_flag is not None and len(args) == 0:
-        print("Error: No devices specified.")
-        print("Run '%s --usage' for further information" % sys.argv[0])
-        sys.exit(1)
-
-    if b_flag == "none" or b_flag == "None":
+   	if b_flag != "restore":
+            print("Error: No devices specified.")
+            print("Run '%s --usage' for further information" % sys.argv[0])
+            sys.exit(1)
+
+    if b_flag == "restore":
+        restore_all_to_kernel()
+    elif b_flag == "none" or b_flag == "None":
         unbind_all(args, force_flag)
     elif b_flag is not None:
         bind_all(args, b_flag, force_flag)

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

* Re: [dpdk-dev] Add option to dpdk-devbind.py to restore kernel driver binding
  2018-04-10 10:55 [dpdk-dev] Add option to dpdk-devbind.py to restore kernel driver binding Tosatti, Giovanni
@ 2018-04-10 12:55 ` Burakov, Anatoly
  2018-04-10 13:19 ` Burakov, Anatoly
  1 sibling, 0 replies; 8+ messages in thread
From: Burakov, Anatoly @ 2018-04-10 12:55 UTC (permalink / raw)
  To: Tosatti, Giovanni, dev

On 10-Apr-18 11:55 AM, Tosatti, Giovanni wrote:
> This patch adds a " --restore" option that will unbind all devices currently bound to DPDK PMDs back to the kernel driver.

Hi Giovanni,

Nitpicking the commit message, but I believe "unbind" here is a bit of a 
misnomer - one does not "unbind to kernel driver", it's either "bind to 
kernel driver" or "bind to DPDK driver" :)

> 
> --- /opt/Perforce/gtosatti_centos/E-XMS/CSA-Mainline/Third-Party/dpdk/dpdk-16.07.orig/tools/dpdk-devbind.py
> +++ /opt/Perforce/gtosatti_centos/E-XMS/CSA-Mainline/Third-Party/dpdk/dpdk-16.07/tools/dpdk-devbind.py
> @@ -91,6 +91,9 @@
>       -u, --unbind:
>           Unbind a device (Equivalent to \"-b none\")
>   
> +    -r, --restore
> +        Restore ALL the DPDK devices to their kernel drivers

Same here - perhaps for clarity this should be "For all devices bound to 
DPDK drivers, bind them to their kernel drivers".

> +
>       --force:
>           By default, devices which are used by Linux - as indicated by having
>           routes in the routing table - cannot be modified. Using the --force
> @@ -448,6 +451,21 @@
>           if "Driver_str" in devices[d]:
>               unbind_one(d, force)
>   
> +def restore_all_to_kernel():

-- 
Thanks,
Anatoly

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

* Re: [dpdk-dev] Add option to dpdk-devbind.py to restore kernel driver binding
  2018-04-10 10:55 [dpdk-dev] Add option to dpdk-devbind.py to restore kernel driver binding Tosatti, Giovanni
  2018-04-10 12:55 ` Burakov, Anatoly
@ 2018-04-10 13:19 ` Burakov, Anatoly
  2019-04-05 15:50   ` Ferruh Yigit
  1 sibling, 1 reply; 8+ messages in thread
From: Burakov, Anatoly @ 2018-04-10 13:19 UTC (permalink / raw)
  To: Tosatti, Giovanni, dev

On 10-Apr-18 11:55 AM, Tosatti, Giovanni wrote:
> This patch adds a " --restore" option that will unbind all devices currently bound to DPDK PMDs back to the kernel driver.
> 
> --- /opt/Perforce/gtosatti_centos/E-XMS/CSA-Mainline/Third-Party/dpdk/dpdk-16.07.orig/tools/dpdk-devbind.py
> +++ /opt/Perforce/gtosatti_centos/E-XMS/CSA-Mainline/Third-Party/dpdk/dpdk-16.07/tools/dpdk-devbind.py
> @@ -91,6 +91,9 @@
>       -u, --unbind:

Two other issues:

1) the header is also wrongly formatted. it should read something like:

tools/devbind: add option to restore kernel driver binding

2) the patch does not apply. not only it appears to be generated not 
from git-send-email but reads as a diff, but it looks like it's 
generated against a very old version of DPDK.

You might want to look at DPDK contribution guidelines:

http://dpdk.org/doc/guides/contributing/patches.html

Thanks for your effort so far!

-- 
Thanks,
Anatoly

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

* Re: [dpdk-dev] Add option to dpdk-devbind.py to restore kernel driver binding
  2018-04-10 13:19 ` Burakov, Anatoly
@ 2019-04-05 15:50   ` Ferruh Yigit
  2019-04-05 15:50     ` Ferruh Yigit
  0 siblings, 1 reply; 8+ messages in thread
From: Ferruh Yigit @ 2019-04-05 15:50 UTC (permalink / raw)
  To: Burakov, Anatoly, Tosatti, Giovanni, dev

On 4/10/2018 2:19 PM, Burakov, Anatoly wrote:
> On 10-Apr-18 11:55 AM, Tosatti, Giovanni wrote:
>> This patch adds a " --restore" option that will unbind all devices currently bound to DPDK PMDs back to the kernel driver.
>>
>> --- /opt/Perforce/gtosatti_centos/E-XMS/CSA-Mainline/Third-Party/dpdk/dpdk-16.07.orig/tools/dpdk-devbind.py
>> +++ /opt/Perforce/gtosatti_centos/E-XMS/CSA-Mainline/Third-Party/dpdk/dpdk-16.07/tools/dpdk-devbind.py
>> @@ -91,6 +91,9 @@
>>       -u, --unbind:
> 
> Two other issues:
> 
> 1) the header is also wrongly formatted. it should read something like:
> 
> tools/devbind: add option to restore kernel driver binding
> 
> 2) the patch does not apply. not only it appears to be generated not 
> from git-send-email but reads as a diff, but it looks like it's 
> generated against a very old version of DPDK.
> 
> You might want to look at DPDK contribution guidelines:
> 
> http://dpdk.org/doc/guides/contributing/patches.html
> 
> Thanks for your effort so far!
> 

There is no response to change request for a year now.

I am marking the patch as rejected, if it is still relevant please send a
new version on top of latest repo.

Sorry for any inconvenience caused.

For reference patches:
https://patches.dpdk.org/patch/37774/

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

* Re: [dpdk-dev] Add option to dpdk-devbind.py to restore kernel driver binding
  2019-04-05 15:50   ` Ferruh Yigit
@ 2019-04-05 15:50     ` Ferruh Yigit
  0 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2019-04-05 15:50 UTC (permalink / raw)
  To: Burakov, Anatoly, Tosatti, Giovanni, dev

On 4/10/2018 2:19 PM, Burakov, Anatoly wrote:
> On 10-Apr-18 11:55 AM, Tosatti, Giovanni wrote:
>> This patch adds a " --restore" option that will unbind all devices currently bound to DPDK PMDs back to the kernel driver.
>>
>> --- /opt/Perforce/gtosatti_centos/E-XMS/CSA-Mainline/Third-Party/dpdk/dpdk-16.07.orig/tools/dpdk-devbind.py
>> +++ /opt/Perforce/gtosatti_centos/E-XMS/CSA-Mainline/Third-Party/dpdk/dpdk-16.07/tools/dpdk-devbind.py
>> @@ -91,6 +91,9 @@
>>       -u, --unbind:
> 
> Two other issues:
> 
> 1) the header is also wrongly formatted. it should read something like:
> 
> tools/devbind: add option to restore kernel driver binding
> 
> 2) the patch does not apply. not only it appears to be generated not 
> from git-send-email but reads as a diff, but it looks like it's 
> generated against a very old version of DPDK.
> 
> You might want to look at DPDK contribution guidelines:
> 
> http://dpdk.org/doc/guides/contributing/patches.html
> 
> Thanks for your effort so far!
> 

There is no response to change request for a year now.

I am marking the patch as rejected, if it is still relevant please send a
new version on top of latest repo.

Sorry for any inconvenience caused.

For reference patches:
https://patches.dpdk.org/patch/37774/

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

* Re: [dpdk-dev] Add option to dpdk-devbind.py to restore kernel driver binding
@ 2018-04-10 11:10 Tosatti, Giovanni
  0 siblings, 0 replies; 8+ messages in thread
From: Tosatti, Giovanni @ 2018-04-10 11:10 UTC (permalink / raw)
  To: dev

--- /opt/Perforce/gtosatti_centos/E-XMS/CSA-Mainline/Third-Party/dpdk/dpdk-16.07.orig/tools/dpdk-devbind.py
+++ /opt/Perforce/gtosatti_centos/E-XMS/CSA-Mainline/Third-Party/dpdk/dp
+++ dk-16.07/tools/dpdk-devbind.py
@@ -91,6 +91,9 @@
     -u, --unbind:
         Unbind a device (Equivalent to \"-b none\")
 
+    -r, --restore
+        Restore ALL the DPDK devices to their kernel drivers
+
     --force:
         By default, devices which are used by Linux - as indicated by having
         routes in the routing table - cannot be modified. Using the --force @@ -448,6 +451,21 @@
         if "Driver_str" in devices[d]:
             unbind_one(d, force)
 
+def restore_all_to_kernel():
+    global force_flag
+    # List all the available devices
+    for d in devices.keys():
+        if not has_driver(d):
+	    # Discard the unbinded devices
+            continue
+        if devices[d]["Driver_str"] in dpdk_drivers:
+            # List the unused Drivers of the the DPDK Devices
+	    unused_drivers = devices[d]["Module_str"].split(",")
+            print("Restoring kernel driver for: %s '%s' '%s'" % (devices[d]["Slot"],
+                  devices[d]["Device_str"], devices[d]["Module_str"]))
+            # Bind the current Device to the FIRST unused Driver
+            if unused_drivers:
+                bind_one(devices[d]["Slot"], unused_drivers[0], 
+force_flag)
 
 def display_devices(title, dev_list, extra_params=None):
     '''Displays to the user the details of a list of devices given in @@ -513,7 +531,7 @@
     try:
         opts, args = getopt.getopt(sys.argv[1:], "b:us",
                                    ["help", "usage", "status", "force",
-                                    "bind=", "unbind"])
+                                    "bind=", "unbind", "restore"])
     except getopt.GetoptError as error:
         print(str(error))
         print("Run '%s --usage' for further information" % sys.argv[0]) @@ -527,11 +545,15 @@
             status_flag = True
         if opt == "--force":
             force_flag = True
-        if opt == "-b" or opt == "-u" or opt == "--bind" or opt == "--unbind":
+        if (opt == "-b" or opt == "--bind" or
+            opt == "-u" or opt == "--unbind" or
+            opt == "-r" or opt == "--restore"):
             if b_flag is not None:
                 print("Error - Only one bind or unbind may be specified\n")
                 sys.exit(1)
-            if opt == "-u" or opt == "--unbind":
+            if opt == "-r" or opt == "--restore":
+                b_flag = "restore"
+            elif opt == "-u" or opt == "--unbind":
                 b_flag = "none"
             else:
                 b_flag = arg
@@ -551,11 +573,14 @@
         sys.exit(1)
 
     if b_flag is not None and len(args) == 0:
-        print("Error: No devices specified.")
-        print("Run '%s --usage' for further information" % sys.argv[0])
-        sys.exit(1)
-
-    if b_flag == "none" or b_flag == "None":
+   	if b_flag != "restore":
+            print("Error: No devices specified.")
+            print("Run '%s --usage' for further information" % sys.argv[0])
+            sys.exit(1)
+
+    if b_flag == "restore":
+        restore_all_to_kernel()
+    elif b_flag == "none" or b_flag == "None":
         unbind_all(args, force_flag)
     elif b_flag is not None:
         bind_all(args, b_flag, force_flag)

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

* Re: [dpdk-dev] Add option to dpdk-devbind.py to restore kernel driver binding
  2018-03-22 13:41 Tosatti, Giovanni
@ 2018-03-22 14:19 ` Burakov, Anatoly
  0 siblings, 0 replies; 8+ messages in thread
From: Burakov, Anatoly @ 2018-03-22 14:19 UTC (permalink / raw)
  To: Tosatti, Giovanni, dev

On 22-Mar-18 1:41 PM, Tosatti, Giovanni wrote:
> Hi all,
> I'm new to this list.
> I have a use case that required me to do a small enhancement to the dpdk-devbind.py script.
> In particular I found very useful to have a --restore option that will unbind all devices currently bound to DPDK PMDs back to the kernel driver.
> The patch is in attachment... would you consider merging that into upstream?
> 
> Thanks,
> Giovanni Tosatti
> 
> 

Hi,

Mailing list does not allow attachments, so you should post it directly. 
Also, no need to ask for permission - just send it as an RFC and see if 
it generates enough interest to be accepted.

-- 
Thanks,
Anatoly

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

* [dpdk-dev] Add option to dpdk-devbind.py to restore kernel driver binding
@ 2018-03-22 13:41 Tosatti, Giovanni
  2018-03-22 14:19 ` Burakov, Anatoly
  0 siblings, 1 reply; 8+ messages in thread
From: Tosatti, Giovanni @ 2018-03-22 13:41 UTC (permalink / raw)
  To: dev

Hi all,
I'm new to this list.
I have a use case that required me to do a small enhancement to the dpdk-devbind.py script.
In particular I found very useful to have a --restore option that will unbind all devices currently bound to DPDK PMDs back to the kernel driver.
The patch is in attachment... would you consider merging that into upstream?

Thanks,
Giovanni Tosatti

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

end of thread, other threads:[~2019-04-05 15:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-10 10:55 [dpdk-dev] Add option to dpdk-devbind.py to restore kernel driver binding Tosatti, Giovanni
2018-04-10 12:55 ` Burakov, Anatoly
2018-04-10 13:19 ` Burakov, Anatoly
2019-04-05 15:50   ` Ferruh Yigit
2019-04-05 15:50     ` Ferruh Yigit
  -- strict thread matches above, loose matches on Subject: below --
2018-04-10 11:10 Tosatti, Giovanni
2018-03-22 13:41 Tosatti, Giovanni
2018-03-22 14:19 ` Burakov, Anatoly

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