[dpdk-dev] [PATCH] ethdev: handle removed device properly on promisc replay

Andrew Rybchenko arybchenko at solarflare.com
Tue Sep 24 19:01:20 CEST 2019


Promiscuous mode callback may return error if the device is removed.
Use eth_err() helper to check the condition and return appropriate
error code.

Fixes: dff6d544fb3c ("ethdev: do nothing if promiscuous mode is applied again")

Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
---
 lib/librte_ethdev/rte_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index d0da3322e..af823607c 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1401,7 +1401,8 @@ rte_eth_dev_config_restore(struct rte_eth_dev *dev,
 	 */
 	if (rte_eth_promiscuous_get(port_id) == 1 &&
 	    *dev->dev_ops->promiscuous_enable != NULL) {
-		ret = (*dev->dev_ops->promiscuous_enable)(dev);
+		ret = eth_err(port_id,
+			      (*dev->dev_ops->promiscuous_enable)(dev));
 		if (ret != 0 && ret != -ENOTSUP) {
 			RTE_ETHDEV_LOG(ERR,
 				"Failed to enable promiscuous mode for device (port %u): %s\n",
@@ -1410,7 +1411,8 @@ rte_eth_dev_config_restore(struct rte_eth_dev *dev,
 		}
 	} else if (rte_eth_promiscuous_get(port_id) == 0 &&
 		   *dev->dev_ops->promiscuous_disable != NULL) {
-		ret = (*dev->dev_ops->promiscuous_disable)(dev);
+		ret = eth_err(port_id,
+			      (*dev->dev_ops->promiscuous_disable)(dev));
 		if (ret != 0 && ret != -ENOTSUP) {
 			RTE_ETHDEV_LOG(ERR,
 				"Failed to disable promiscuous mode for device (port %u): %s\n",
-- 
2.17.1



More information about the dev mailing list