[1/3] ethdev: avoid error on PCI unplug of already closed ethdev

Message ID 1561110041-1795-1-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [1/3] ethdev: avoid error on PCI unplug of already closed ethdev |

Checks

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

Commit Message

Andrew Rybchenko June 21, 2019, 9:40 a.m. UTC
  If PCI Ethernet device driver removes it on close
(RTE_ETH_DEV_CLOSE_REMOVE) and later PCI device itself is unplugged,
it should not fail because of Ethernet device is already removed.

Fixes: 23ea57a2a0ce ("ethdev: complete closing of port")
Cc: stable@dpdk.org

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
---
Cc: Thomas Monjalon <thomas@monjalon.net>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>

 lib/librte_ethdev/rte_ethdev_pci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

David Marchand June 21, 2019, 9:52 a.m. UTC | #1
On Fri, Jun 21, 2019 at 11:41 AM Andrew Rybchenko <arybchenko@solarflare.com>
wrote:

> If PCI Ethernet device driver removes it on close
> (RTE_ETH_DEV_CLOSE_REMOVE) and later PCI device itself is unplugged,
> it should not fail because of Ethernet device is already removed.
>
> Fixes: 23ea57a2a0ce ("ethdev: complete closing of port")
> Cc: stable@dpdk.org
>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
> ---
> Cc: Thomas Monjalon <thomas@monjalon.net>
> Cc: Ferruh Yigit <ferruh.yigit@intel.com>
>
>  lib/librte_ethdev/rte_ethdev_pci.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/librte_ethdev/rte_ethdev_pci.h
> b/lib/librte_ethdev/rte_ethdev_pci.h
> index 23257e986..ccdbb46ec 100644
> --- a/lib/librte_ethdev/rte_ethdev_pci.h
> +++ b/lib/librte_ethdev/rte_ethdev_pci.h
> @@ -184,7 +184,7 @@ rte_eth_dev_pci_generic_remove(struct rte_pci_device
> *pci_dev,
>
>         eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
>         if (!eth_dev)
> -               return -ENODEV;
> +               return 0;
>
>         if (dev_uninit) {
>                 ret = dev_uninit(eth_dev);
> --
> 2.17.1
>

We are changing the behavior for all drivers, while I understand this
should apply to the ones that have the RTE_ETH_DEV_CLOSE_REMOVE flag.
Btw, I had reported this earlier [1], care to add a little Reported-by for
me ? :-)

1: http://mails.dpdk.org/archives/dev/2019-June/134150.html
  
Andrew Rybchenko June 21, 2019, 10:15 a.m. UTC | #2
On 6/21/19 12:52 PM, David Marchand wrote:
> On Fri, Jun 21, 2019 at 11:41 AM Andrew Rybchenko <arybchenko@solarflare.com>
> wrote:
>> If PCI Ethernet device driver removes it on close
>> (RTE_ETH_DEV_CLOSE_REMOVE) and later PCI device itself is unplugged,
>> it should not fail because of Ethernet device is already removed.
>>
>> Fixes: 23ea57a2a0ce ("ethdev: complete closing of port")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>> Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
>> ---
>> Cc: Thomas Monjalon <thomas@monjalon.net>
>> Cc: Ferruh Yigit <ferruh.yigit@intel.com>
>>
>>   lib/librte_ethdev/rte_ethdev_pci.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/librte_ethdev/rte_ethdev_pci.h
>> b/lib/librte_ethdev/rte_ethdev_pci.h
>> index 23257e986..ccdbb46ec 100644
>> --- a/lib/librte_ethdev/rte_ethdev_pci.h
>> +++ b/lib/librte_ethdev/rte_ethdev_pci.h
>> @@ -184,7 +184,7 @@ rte_eth_dev_pci_generic_remove(struct rte_pci_device
>> *pci_dev,
>>
>>          eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
>>          if (!eth_dev)
>> -               return -ENODEV;
>> +               return 0;
>>
>>          if (dev_uninit) {
>>                  ret = dev_uninit(eth_dev);
>> --
>> 2.17.1
>>
> We are changing the behavior for all drivers, while I understand this
> should apply to the ones that have the RTE_ETH_DEV_CLOSE_REMOVE flag.
> Btw, I had reported this earlier [1], care to add a little Reported-by for
> me ? :-)

Yes, I agree. Unfortunately there is no ethdev here to check
RTE_ETH_DEV_CLOSE_REMOVE. It could be PCI driver flag for the
feature, but I'm not sure if it makes sense to add one more
flag for transition.

> 1: http://mails.dpdk.org/archives/dev/2019-June/134150.html
  
Ferruh Yigit July 2, 2019, 5:38 p.m. UTC | #3
On 6/21/2019 11:15 AM, Andrew Rybchenko wrote:
> On 6/21/19 12:52 PM, David Marchand wrote:
>> On Fri, Jun 21, 2019 at 11:41 AM Andrew Rybchenko <arybchenko@solarflare.com>
>> wrote:
>>> If PCI Ethernet device driver removes it on close
>>> (RTE_ETH_DEV_CLOSE_REMOVE) and later PCI device itself is unplugged,
>>> it should not fail because of Ethernet device is already removed.
>>>
>>> Fixes: 23ea57a2a0ce ("ethdev: complete closing of port")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>>> Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
>>> ---
>>> Cc: Thomas Monjalon <thomas@monjalon.net>
>>> Cc: Ferruh Yigit <ferruh.yigit@intel.com>
>>>
>>>   lib/librte_ethdev/rte_ethdev_pci.h | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/lib/librte_ethdev/rte_ethdev_pci.h
>>> b/lib/librte_ethdev/rte_ethdev_pci.h
>>> index 23257e986..ccdbb46ec 100644
>>> --- a/lib/librte_ethdev/rte_ethdev_pci.h
>>> +++ b/lib/librte_ethdev/rte_ethdev_pci.h
>>> @@ -184,7 +184,7 @@ rte_eth_dev_pci_generic_remove(struct rte_pci_device
>>> *pci_dev,
>>>
>>>          eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
>>>          if (!eth_dev)
>>> -               return -ENODEV;
>>> +               return 0;
>>>
>>>          if (dev_uninit) {
>>>                  ret = dev_uninit(eth_dev);
>>> --
>>> 2.17.1
>>>
>> We are changing the behavior for all drivers, while I understand this
>> should apply to the ones that have the RTE_ETH_DEV_CLOSE_REMOVE flag.
>> Btw, I had reported this earlier [1], care to add a little Reported-by for
>> me ? :-)
> 
> Yes, I agree. Unfortunately there is no ethdev here to check
> RTE_ETH_DEV_CLOSE_REMOVE. It could be PCI driver flag for the
> feature, but I'm not sure if it makes sense to add one more
> flag for transition.
> 
>> 1: http://mails.dpdk.org/archives/dev/2019-June/134150.html

Reported-by: David Marchand <david.marchand@redhat.com>

> 

Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
  
Ferruh Yigit July 3, 2019, 1:55 p.m. UTC | #4
On 7/2/2019 6:38 PM, Ferruh Yigit wrote:
> On 6/21/2019 11:15 AM, Andrew Rybchenko wrote:
>> On 6/21/19 12:52 PM, David Marchand wrote:
>>> On Fri, Jun 21, 2019 at 11:41 AM Andrew Rybchenko <arybchenko@solarflare.com>
>>> wrote:
>>>> If PCI Ethernet device driver removes it on close
>>>> (RTE_ETH_DEV_CLOSE_REMOVE) and later PCI device itself is unplugged,
>>>> it should not fail because of Ethernet device is already removed.
>>>>
>>>> Fixes: 23ea57a2a0ce ("ethdev: complete closing of port")
>>>> Cc: stable@dpdk.org
>>>>
>>>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>>>> Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
>>>> ---
>>>> Cc: Thomas Monjalon <thomas@monjalon.net>
>>>> Cc: Ferruh Yigit <ferruh.yigit@intel.com>
>>>>
>>>>   lib/librte_ethdev/rte_ethdev_pci.h | 2 +-
>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/lib/librte_ethdev/rte_ethdev_pci.h
>>>> b/lib/librte_ethdev/rte_ethdev_pci.h
>>>> index 23257e986..ccdbb46ec 100644
>>>> --- a/lib/librte_ethdev/rte_ethdev_pci.h
>>>> +++ b/lib/librte_ethdev/rte_ethdev_pci.h
>>>> @@ -184,7 +184,7 @@ rte_eth_dev_pci_generic_remove(struct rte_pci_device
>>>> *pci_dev,
>>>>
>>>>          eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
>>>>          if (!eth_dev)
>>>> -               return -ENODEV;
>>>> +               return 0;
>>>>
>>>>          if (dev_uninit) {
>>>>                  ret = dev_uninit(eth_dev);
>>>> --
>>>> 2.17.1
>>>>
>>> We are changing the behavior for all drivers, while I understand this
>>> should apply to the ones that have the RTE_ETH_DEV_CLOSE_REMOVE flag.
>>> Btw, I had reported this earlier [1], care to add a little Reported-by for
>>> me ? :-)
>>
>> Yes, I agree. Unfortunately there is no ethdev here to check
>> RTE_ETH_DEV_CLOSE_REMOVE. It could be PCI driver flag for the
>> feature, but I'm not sure if it makes sense to add one more
>> flag for transition.
>>
>>> 1: http://mails.dpdk.org/archives/dev/2019-June/134150.html
> 
> Reported-by: David Marchand <david.marchand@redhat.com>
> 
>>
> 
> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 

Series applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/lib/librte_ethdev/rte_ethdev_pci.h b/lib/librte_ethdev/rte_ethdev_pci.h
index 23257e986..ccdbb46ec 100644
--- a/lib/librte_ethdev/rte_ethdev_pci.h
+++ b/lib/librte_ethdev/rte_ethdev_pci.h
@@ -184,7 +184,7 @@  rte_eth_dev_pci_generic_remove(struct rte_pci_device *pci_dev,
 
 	eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
 	if (!eth_dev)
-		return -ENODEV;
+		return 0;
 
 	if (dev_uninit) {
 		ret = dev_uninit(eth_dev);