DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/vhost: release port upon close
@ 2019-06-05  9:42 Tiwei Bie
  2019-06-05 10:15 ` Maxime Coquelin
  2019-06-06  9:32 ` Maxime Coquelin
  0 siblings, 2 replies; 3+ messages in thread
From: Tiwei Bie @ 2019-06-05  9:42 UTC (permalink / raw)
  To: maxime.coquelin, zhihong.wang, dev

Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private
resources for the port can be freed by rte_eth_dev_close().

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 774774b94..0b61e37a1 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -1005,6 +1005,9 @@ eth_dev_close(struct rte_eth_dev *dev)
 	rte_free(internal);
 
 	dev->data->dev_private = NULL;
+
+	rte_free(vring_states[dev->data->port_id]);
+	vring_states[dev->data->port_id] = NULL;
 }
 
 static int
@@ -1261,7 +1264,7 @@ eth_dev_vhost_create(struct rte_vdev_device *dev, char *iface_name,
 	internal->max_queues = queues;
 	internal->vid = -1;
 	data->dev_link = pmd_link;
-	data->dev_flags = RTE_ETH_DEV_INTR_LSC;
+	data->dev_flags = RTE_ETH_DEV_INTR_LSC | RTE_ETH_DEV_CLOSE_REMOVE;
 
 	eth_dev->dev_ops = &ops;
 
@@ -1442,16 +1445,13 @@ rte_pmd_vhost_remove(struct rte_vdev_device *dev)
 	/* find an ethdev entry */
 	eth_dev = rte_eth_dev_allocated(name);
 	if (eth_dev == NULL)
-		return -ENODEV;
+		return 0;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return rte_eth_dev_release_port(eth_dev);
 
 	eth_dev_close(eth_dev);
 
-	rte_free(vring_states[eth_dev->data->port_id]);
-	vring_states[eth_dev->data->port_id] = NULL;
-
 	rte_eth_dev_release_port(eth_dev);
 
 	return 0;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/vhost: release port upon close
  2019-06-05  9:42 [dpdk-dev] [PATCH] net/vhost: release port upon close Tiwei Bie
@ 2019-06-05 10:15 ` Maxime Coquelin
  2019-06-06  9:32 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2019-06-05 10:15 UTC (permalink / raw)
  To: Tiwei Bie, zhihong.wang, dev



On 6/5/19 11:42 AM, Tiwei Bie wrote:
> Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private
> resources for the port can be freed by rte_eth_dev_close().
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   drivers/net/vhost/rte_eth_vhost.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/vhost: release port upon close
  2019-06-05  9:42 [dpdk-dev] [PATCH] net/vhost: release port upon close Tiwei Bie
  2019-06-05 10:15 ` Maxime Coquelin
@ 2019-06-06  9:32 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2019-06-06  9:32 UTC (permalink / raw)
  To: Tiwei Bie, zhihong.wang, dev



On 6/5/19 11:42 AM, Tiwei Bie wrote:
> Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private
> resources for the port can be freed by rte_eth_dev_close().
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   drivers/net/vhost/rte_eth_vhost.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 

Applied to dpdk-next-virtio/master.

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-06  9:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-05  9:42 [dpdk-dev] [PATCH] net/vhost: release port upon close Tiwei Bie
2019-06-05 10:15 ` Maxime Coquelin
2019-06-06  9:32 ` Maxime Coquelin

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).