From bf2644cd38734c42431a8d6cef3ab99b5e464065 Mon Sep 17 00:00:00 2001 From: William Tu Date: Fri, 31 May 2019 09:52:42 -0700 Subject: [PATCH] net/af_xdp: fix remove path 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: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD") Cc: stable@dpdk.org Reported-at: https://patchwork.ozlabs.org/patch/1106528/ Suggested-by: Ilya Maximets Signed-off-by: William Tu Acked-by: Xiaolong Ye --- 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 28e6aa27e2..8eaa17d4da 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.20.1