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>, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v2 1/6] ethdev: fix device state on detach
Date: Wed, 26 Jul 2017 15:35:52 +0200	[thread overview]
Message-ID: <c7aa5b19140a4ba2f6286e4e39dd2b7dd6061aa4.1501076035.git.gaetan.rivet@6wind.com> (raw)
In-Reply-To: <cover.1501076035.git.gaetan.rivet@6wind.com>
In-Reply-To: <cover.1501076035.git.gaetan.rivet@6wind.com>

The device state should be handled by the ether layer when possible.
Applications should not have to do it.

Not setting the state to UNUSED will make the port_id of the device
valid for all ether API functions, usually resulting in segfault.

Fixes: 284c908cc588 ("app/testpmd: request device removal interrupt")
Cc: stable@dpdk.org

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
 app/test-pmd/testpmd.c        | 1 -
 lib/librte_ether/rte_ethdev.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index e754d12..9142218 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1836,7 +1836,6 @@ rmv_event_callback(void *arg)
 	close_port(port_id);
 	printf("removing device %s\n", dev->device->name);
 	rte_eal_dev_detach(dev->device);
-	dev->state = RTE_ETH_DEV_UNUSED;
 }
 
 /* This function is used by the interrupt thread */
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index d4ebb1b..8c365ed 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -453,6 +453,7 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
 	if (ret < 0)
 		goto err;
 
+	rte_eth_devices[port_id].state = RTE_ETH_DEV_UNUSED;
 	return 0;
 
 err:
-- 
2.1.4

  reply	other threads:[~2017-07-26 13:36 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-26  5:43 [dpdk-dev] [PATCH] net/mlx5: fix verification of device context Shachar Beiser
2017-07-26  9:06 ` Adrien Mazarguil
2017-07-26  9:21   ` Shachar Beiser
2017-07-26 12:55     ` Gaëtan Rivet
2017-07-26 13:30 ` [dpdk-dev] [PATCH 0/6] fix ethdev device detach Gaetan Rivet
2017-07-26 13:30   ` [dpdk-dev] [PATCH 1/6] ethdev: fix device state on detach Gaetan Rivet
2017-07-26 13:30   ` [dpdk-dev] [PATCH 3/6] net/mlx4: advertize the detach capability Gaetan Rivet
2017-07-26 13:30   ` [dpdk-dev] [PATCH 4/6] net/mlx5: " Gaetan Rivet
2017-07-26 13:30   ` [dpdk-dev] [PATCH 5/6] app/testpmd: let the user know device detach failed Gaetan Rivet
2017-07-26 13:30   ` [dpdk-dev] [PATCH 6/6] doc: announce ethdev API change for detach flag Gaetan Rivet
2017-07-26 13:35   ` [dpdk-dev] [PATCH v2 0/6] fix ethdev device detach Gaetan Rivet
2017-07-26 13:35     ` Gaetan Rivet [this message]
2017-07-26 13:35     ` [dpdk-dev] [PATCH v2 2/6] ethdev: properly check detach capability Gaetan Rivet
2017-07-26 13:35     ` [dpdk-dev] [PATCH v2 3/6] net/mlx4: advertize the " Gaetan Rivet
2017-07-26 13:35     ` [dpdk-dev] [PATCH v2 4/6] net/mlx5: " Gaetan Rivet
2017-07-26 13:35     ` [dpdk-dev] [PATCH v2 5/6] app/testpmd: let the user know device detach failed Gaetan Rivet
2017-07-26 13:35     ` [dpdk-dev] [PATCH v2 6/6] doc: announce ethdev API change for detach flag Gaetan Rivet
2017-07-28 15:54       ` Mcnamara, John
2017-07-31  9:40       ` [dpdk-dev] [PATCH v3] " Gaetan Rivet
2017-08-08  8:37         ` Thomas Monjalon
2017-07-30  7:33     ` [dpdk-dev] [PATCH v2 0/6] fix ethdev device detach Shachar Beiser
2017-07-31  8:57     ` Adrien Mazarguil
2017-07-31  9:31       ` Thomas Monjalon

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=c7aa5b19140a4ba2f6286e4e39dd2b7dd6061aa4.1501076035.git.gaetan.rivet@6wind.com \
    --to=gaetan.rivet@6wind.com \
    --cc=dev@dpdk.org \
    --cc=stable@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).