DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/af_xdp: fix failure on rte_dev_remove
@ 2019-05-31 16:52 William Tu
  2019-06-01 16:13 ` Ye Xiaolong
  0 siblings, 1 reply; 4+ messages in thread
From: William Tu @ 2019-05-31 16:52 UTC (permalink / raw)
  To: dev, i.maximets

When users call rte_eth_dev_close() and rte_dev_remove(), the af_xdp
pmd return -1 (EPERM) due to eth_dev == NULL.

Since the af_xdp pmd driver advertises RTE_ETH_DEV_CLOSE_REMOVE, all
the resources are freed on rte_eth_dev_close().  rte_dev_remove() tries
to detach device and subsequently calls rte_pmd_af_xdp_remove() that tries
to free already freed resources and fails. Fix it by return success.

Fixes: f1debd77efaf6 ("net/af_xdp: introduce AF_XDP PMD")
Reported-at: https://patchwork.ozlabs.org/patch/1106528/
Signed-off-by: William Tu <u9012063@gmail.com>
Suggested-by: Ilya Maximets <i.maximets@samsung.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 35c72272c919..3dcc3628c5d0 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -944,7 +944,7 @@ rte_pmd_af_xdp_remove(struct rte_vdev_device *dev)
 	/* find the ethdev entry */
 	eth_dev = rte_eth_dev_allocated(rte_vdev_device_name(dev));
 	if (eth_dev == NULL)
-		return -1;
+		return 0;
 
 	eth_dev_close(eth_dev);
 	rte_eth_dev_release_port(eth_dev);
-- 
2.7.4


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

* Re: [dpdk-dev] [PATCH] net/af_xdp: fix failure on rte_dev_remove
  2019-05-31 16:52 [dpdk-dev] [PATCH] net/af_xdp: fix failure on rte_dev_remove William Tu
@ 2019-06-01 16:13 ` Ye Xiaolong
  2019-06-05 15:29   ` Ferruh Yigit
  0 siblings, 1 reply; 4+ messages in thread
From: Ye Xiaolong @ 2019-06-01 16:13 UTC (permalink / raw)
  To: William Tu; +Cc: dev, i.maximets

On 05/31, William Tu wrote:
>When users call rte_eth_dev_close() and rte_dev_remove(), the af_xdp
>pmd return -1 (EPERM) due to eth_dev == NULL.
>
>Since the af_xdp pmd driver advertises RTE_ETH_DEV_CLOSE_REMOVE, all
>the resources are freed on rte_eth_dev_close().  rte_dev_remove() tries
>to detach device and subsequently calls rte_pmd_af_xdp_remove() that tries
>to free already freed resources and fails. Fix it by return success.
>
>Fixes: f1debd77efaf6 ("net/af_xdp: introduce AF_XDP PMD")
>Reported-at: https://patchwork.ozlabs.org/patch/1106528/
>Signed-off-by: William Tu <u9012063@gmail.com>
>Suggested-by: Ilya Maximets <i.maximets@samsung.com>
>---
> drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
>index 35c72272c919..3dcc3628c5d0 100644
>--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
>+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
>@@ -944,7 +944,7 @@ rte_pmd_af_xdp_remove(struct rte_vdev_device *dev)
> 	/* find the ethdev entry */
> 	eth_dev = rte_eth_dev_allocated(rte_vdev_device_name(dev));
> 	if (eth_dev == NULL)
>-		return -1;
>+		return 0;
> 
> 	eth_dev_close(eth_dev);
> 	rte_eth_dev_release_port(eth_dev);

Looks good to me. Thanks for the fix.

Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>

Thanks,
Xiaolong
>-- 
>2.7.4
>

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

* Re: [dpdk-dev] [PATCH] net/af_xdp: fix failure on rte_dev_remove
  2019-06-01 16:13 ` Ye Xiaolong
@ 2019-06-05 15:29   ` Ferruh Yigit
  2019-06-06 12:18     ` David Marchand
  0 siblings, 1 reply; 4+ messages in thread
From: Ferruh Yigit @ 2019-06-05 15:29 UTC (permalink / raw)
  To: Ye Xiaolong, William Tu; +Cc: dev, i.maximets

On 6/1/2019 5:13 PM, Ye Xiaolong wrote:
> On 05/31, William Tu wrote:
>> When users call rte_eth_dev_close() and rte_dev_remove(), the af_xdp
>> pmd return -1 (EPERM) due to eth_dev == NULL.
>>
>> Since the af_xdp pmd driver advertises RTE_ETH_DEV_CLOSE_REMOVE, all
>> the resources are freed on rte_eth_dev_close().  rte_dev_remove() tries
>> to detach device and subsequently calls rte_pmd_af_xdp_remove() that tries
>> to free already freed resources and fails. Fix it by return success.
>>
>> Fixes: f1debd77efaf6 ("net/af_xdp: introduce AF_XDP PMD")
>> Reported-at: https://patchwork.ozlabs.org/patch/1106528/
>> Signed-off-by: William Tu <u9012063@gmail.com>
>> Suggested-by: Ilya Maximets <i.maximets@samsung.com>
>> ---
>> drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
>> index 35c72272c919..3dcc3628c5d0 100644
>> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
>> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
>> @@ -944,7 +944,7 @@ rte_pmd_af_xdp_remove(struct rte_vdev_device *dev)
>> 	/* find the ethdev entry */
>> 	eth_dev = rte_eth_dev_allocated(rte_vdev_device_name(dev));
>> 	if (eth_dev == NULL)
>> -		return -1;
>> +		return 0;
>>
>> 	eth_dev_close(eth_dev);
>> 	rte_eth_dev_release_port(eth_dev);
> 
> Looks good to me. Thanks for the fix.
> 
> Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>

Applied to dpdk-next-net/master, thanks.

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

* Re: [dpdk-dev] [PATCH] net/af_xdp: fix failure on rte_dev_remove
  2019-06-05 15:29   ` Ferruh Yigit
@ 2019-06-06 12:18     ` David Marchand
  0 siblings, 0 replies; 4+ messages in thread
From: David Marchand @ 2019-06-06 12:18 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Ye Xiaolong, William Tu, dev, Ilya Maximets

Ferruh,

On Wed, Jun 5, 2019 at 5:30 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> On 6/1/2019 5:13 PM, Ye Xiaolong wrote:
> > On 05/31, William Tu wrote:
> >> When users call rte_eth_dev_close() and rte_dev_remove(), the af_xdp
> >> pmd return -1 (EPERM) due to eth_dev == NULL.
> >>
> >> Since the af_xdp pmd driver advertises RTE_ETH_DEV_CLOSE_REMOVE, all
> >> the resources are freed on rte_eth_dev_close().  rte_dev_remove() tries
> >> to detach device and subsequently calls rte_pmd_af_xdp_remove() that
> tries
> >> to free already freed resources and fails. Fix it by return success.
> >>
> >> Fixes: f1debd77efaf6 ("net/af_xdp: introduce AF_XDP PMD")
> >> Reported-at: https://patchwork.ozlabs.org/patch/1106528/
> >> Signed-off-by: William Tu <u9012063@gmail.com>
> >> Suggested-by: Ilya Maximets <i.maximets@samsung.com>
> >> ---
> >> drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c
> b/drivers/net/af_xdp/rte_eth_af_xdp.c
> >> index 35c72272c919..3dcc3628c5d0 100644
> >> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> >> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> >> @@ -944,7 +944,7 @@ rte_pmd_af_xdp_remove(struct rte_vdev_device *dev)
> >>      /* find the ethdev entry */
> >>      eth_dev = rte_eth_dev_allocated(rte_vdev_device_name(dev));
> >>      if (eth_dev == NULL)
> >> -            return -1;
> >> +            return 0;
> >>
> >>      eth_dev_close(eth_dev);
> >>      rte_eth_dev_release_port(eth_dev);
> >
> > Looks good to me. Thanks for the fix.
> >
> > Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
>
> Applied to dpdk-next-net/master, thanks.
>

Don't we have similar issues with the current drivers flagged
RTE_ETH_DEV_CLOSE_REMOVE ?
And we are missing a check on this flag in rte_eth_dev_pci_generic_remove().


-- 
David Marchand

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

end of thread, other threads:[~2019-06-06 12:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31 16:52 [dpdk-dev] [PATCH] net/af_xdp: fix failure on rte_dev_remove William Tu
2019-06-01 16:13 ` Ye Xiaolong
2019-06-05 15:29   ` Ferruh Yigit
2019-06-06 12:18     ` David Marchand

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