DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gaetan Rivet <gaetan.rivet@6wind.com>
To: dev@dpdk.org
Cc: Gaetan Rivet <gaetan.rivet@6wind.com>
Subject: [dpdk-dev] [PATCH v2 1/6] ethdev: do not rely on detachable flag in detach
Date: Tue, 24 Oct 2017 12:35:37 +0200	[thread overview]
Message-ID: <409639fdf67753288cff5bf7d91f725666ff5678.1508840586.git.gaetan.rivet@6wind.com> (raw)
In-Reply-To: <cover.1508840456.git.gaetan.rivet@6wind.com>

This flag is deprecated and should not be used to check for the device
ability to be detached.

The rte_dev library call will fail with the relevant error code if
detaching this port is not possible.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
 lib/librte_ether/rte_ethdev.c | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 0b1e928..d9a71e2 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -356,21 +356,6 @@ rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id)
 	return -ENODEV;
 }
 
-static int
-rte_eth_dev_is_detachable(uint16_t port_id)
-{
-	uint32_t dev_flags;
-
-	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
-
-	dev_flags = rte_eth_devices[port_id].data->dev_flags;
-	if ((dev_flags & RTE_ETH_DEV_DETACHABLE) &&
-		(!(dev_flags & RTE_ETH_DEV_BONDED_SLAVE)))
-		return 0;
-	else
-		return 1;
-}
-
 /* attach the new device, then store port_id of the device */
 int
 rte_eth_dev_attach(const char *devargs, uint16_t *port_id)
@@ -421,16 +406,23 @@ rte_eth_dev_attach(const char *devargs, uint16_t *port_id)
 int
 rte_eth_dev_detach(uint16_t port_id, char *name)
 {
+	uint32_t dev_flags;
 	int ret = -1;
 
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+
 	if (name == NULL) {
 		ret = -EINVAL;
 		goto err;
 	}
 
-	/* FIXME: move this to eal, once device flags are relocated there */
-	if (rte_eth_dev_is_detachable(port_id))
+	dev_flags = rte_eth_devices[port_id].data->dev_flags;
+	if (dev_flags & RTE_ETH_DEV_BONDED_SLAVE) {
+		RTE_LOG(ERR, EAL, "Port %" PRIu16 " is bonded, cannot detach\n",
+			port_id);
+		ret = -ENOTSUP;
 		goto err;
+	}
 
 	snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
 		 "%s", rte_eth_devices[port_id].data->name);
-- 
2.1.4

  reply	other threads:[~2017-10-24 10:36 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24  8:59 [dpdk-dev] [PATCH v1 0/3] Remove RTE_ETH_DEV_DETACHABLE Gaetan Rivet
2017-10-24  8:59 ` [dpdk-dev] [PATCH v1 1/3] ethdev: remove detachable device flag Gaetan Rivet
2017-10-24  9:13   ` Andrew Rybchenko
2017-10-24  9:23   ` Thomas Monjalon
2017-10-24  9:27     ` Gaëtan Rivet
2017-10-24  8:59 ` [dpdk-dev] [PATCH v1 2/3] doc: follow detachable flag disappearance Gaetan Rivet
2017-10-25  8:55   ` Mcnamara, John
2017-10-25  8:56   ` Mcnamara, John
2017-10-24  8:59 ` [dpdk-dev] [PATCH v1 3/3] pci: propagate PMD removal error value for unplug Gaetan Rivet
2017-10-24 10:35 ` [dpdk-dev] [PATCH v2 0/6] Remove RTE_ETH_DEV_DETACHABLE Gaetan Rivet
2017-10-24 10:35   ` Gaetan Rivet [this message]
2017-10-24 10:35     ` [dpdk-dev] [PATCH v2 2/6] ethdev: remove detachable device flag Gaetan Rivet
2017-10-24 10:35     ` [dpdk-dev] [PATCH v2 3/6] pci: propagate PMD removal error value for unplug Gaetan Rivet
2017-10-24 10:35     ` [dpdk-dev] [PATCH v2 4/6] doc: follow detachable flag disappearance Gaetan Rivet
2017-10-25  8:57       ` Mcnamara, John
2017-10-24 10:35     ` [dpdk-dev] [PATCH v2 5/6] doc: update detachable flag deprecation notice Gaetan Rivet
2017-10-25  9:03       ` Mcnamara, John
2017-10-24 10:35     ` [dpdk-dev] [PATCH v2 6/6] doc: note ether API change for detachable flag Gaetan Rivet
2017-10-25  8:58       ` Mcnamara, John
2017-10-25  9:01       ` Mcnamara, John
2017-10-24 12:35   ` [dpdk-dev] [PATCH v2 0/6] Remove RTE_ETH_DEV_DETACHABLE Thomas Monjalon
2017-10-25 17:37     ` Ferruh Yigit
2017-10-30  9:45       ` Alejandro Lucero
2017-10-31 11:09         ` Alejandro Lucero
2017-10-31 17:24           ` Ferruh Yigit
2017-10-24 23:56   ` Ferruh Yigit
2017-10-25 16:11     ` 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=409639fdf67753288cff5bf7d91f725666ff5678.1508840586.git.gaetan.rivet@6wind.com \
    --to=gaetan.rivet@6wind.com \
    --cc=dev@dpdk.org \
    /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).