usertools: Fix clearing any old data

Message ID 0c31ecf46994f3c582f14842446c538ebe0622d9.1559301086.git.tredaelli@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series usertools: Fix clearing any old data |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/Intel-compilation fail Compilation issues

Commit Message

Timothy Redaelli May 31, 2019, 11:11 a.m. UTC
  Currently clear_data (dpdk-devbind.py) doesn't work as expected since
"global devices" is missing and so "devices" is considered a local variable.

This commit changes "clear_data" function in order to really clear
devices by adding "global devices".

CC: stable@dpdk.org

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
---
 usertools/dpdk-devbind.py | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Luca Boccassi May 31, 2019, 1:37 p.m. UTC | #1
On Fri, 2019-05-31 at 13:11 +0200, Timothy Redaelli wrote:
> Currently clear_data (dpdk-devbind.py) doesn't work as expected since
> "global devices" is missing and so "devices" is considered a local
> variable.
> 
> This commit changes "clear_data" function in order to really clear
> devices by adding "global devices".
> 
> CC: 
> stable@dpdk.org
> 
> 
> Signed-off-by: Timothy Redaelli <
> tredaelli@redhat.com
> >
> ---
>  usertools/dpdk-devbind.py | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
> index 9e79f0d28..e6b551d33 100755
> --- a/usertools/dpdk-devbind.py
> +++ b/usertools/dpdk-devbind.py
> @@ -210,6 +210,7 @@ def get_pci_device_details(dev_id, probe_lspci):
>  
>  def clear_data():
>      '''This function clears any old data'''
> +    global devices
>      devices = {}
>  
>  def get_device_details(devices_type):
> 

Acked-by: Luca Boccassi <bluca@debian.org>
  
David Marchand June 4, 2019, 7:20 a.m. UTC | #2
On Fri, May 31, 2019 at 3:37 PM Luca Boccassi <bluca@debian.org> wrote:

> On Fri, 2019-05-31 at 13:11 +0200, Timothy Redaelli wrote:
> > Currently clear_data (dpdk-devbind.py) doesn't work as expected since
> > "global devices" is missing and so "devices" is considered a local
> > variable.
> >
> > This commit changes "clear_data" function in order to really clear
> > devices by adding "global devices".
> >
> > CC:
> > stable@dpdk.org


Fixes: ea9f00f7289a ("usertools: refactor NIC and crypto binding details")


> >
> >
> > Signed-off-by: Timothy Redaelli <
> > tredaelli@redhat.com
> > >
> > ---
> >  usertools/dpdk-devbind.py | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
> > index 9e79f0d28..e6b551d33 100755
> > --- a/usertools/dpdk-devbind.py
> > +++ b/usertools/dpdk-devbind.py
> > @@ -210,6 +210,7 @@ def get_pci_device_details(dev_id, probe_lspci):
> >
> >  def clear_data():
> >      '''This function clears any old data'''
> > +    global devices
> >      devices = {}
> >
> >  def get_device_details(devices_type):
> >
>
> Acked-by: Luca Boccassi <bluca@debian.org>
>


Reviewed-by: David Marchand <david.marchand@redhat.com>
  
Thomas Monjalon July 4, 2019, 9:08 p.m. UTC | #3
04/06/2019 09:20, David Marchand:
> On Fri, May 31, 2019 at 3:37 PM Luca Boccassi <bluca@debian.org> wrote:
> > On Fri, 2019-05-31 at 13:11 +0200, Timothy Redaelli wrote:
> > > Currently clear_data (dpdk-devbind.py) doesn't work as expected since
> > > "global devices" is missing and so "devices" is considered a local
> > > variable.
> > >
> > > This commit changes "clear_data" function in order to really clear
> > > devices by adding "global devices".
> > >
> > > CC:
> > > stable@dpdk.org
> 
> Fixes: ea9f00f7289a ("usertools: refactor NIC and crypto binding details")
> 
> > > Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
>
> > Acked-by: Luca Boccassi <bluca@debian.org>
> 
> Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks
  

Patch

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 9e79f0d28..e6b551d33 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -210,6 +210,7 @@  def get_pci_device_details(dev_id, probe_lspci):
 
 def clear_data():
     '''This function clears any old data'''
+    global devices
     devices = {}
 
 def get_device_details(devices_type):