DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: Thomas Monjalon <thomas@monjalon.net>,
	Ferruh Yigit <ferruh.yigit@intel.com>
Cc: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH] ethdev: handle removed device properly on promisc replay
Date: Tue, 24 Sep 2019 18:01:20 +0100	[thread overview]
Message-ID: <1569344480-7571-1-git-send-email-arybchenko@solarflare.com> (raw)

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@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


             reply	other threads:[~2019-09-24 17:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-24 17:01 Andrew Rybchenko [this message]
2019-09-26 10:43 ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1569344480-7571-1-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).