dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mvneta: remove resources when port is closed
@ 2019-07-03  7:58 lironh
  2019-07-07 10:25 ` Jerin Jacob Kollanukkaran
  0 siblings, 1 reply; 4+ messages in thread
From: lironh @ 2019-07-03  7:58 UTC (permalink / raw)
  To: jerinj; +Cc: dev, lironh, yuric

From: yuric <yuric@marvell.com>

Since 18.11, it is suggested that driver should release all its private
resources at the dev_close routine. So all resources previously released
in remove routine are now released at the dev_close routine, and the
dev_close routine will be called in driver remove routine in order to
support removing a device without closing its ports.

Above behavior changes are supported by setting RTE_ETH_DEV_CLOSE_REMOVE
flag during probe stage.

Signed-off-by: yuric <yuric@marvell.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
---
 drivers/net/mvneta/mvneta_ethdev.c | 46 +++++++++++++++++---------------------
 1 file changed, 20 insertions(+), 26 deletions(-)

diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index d46a13b..a8def8f 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -49,6 +49,8 @@ struct mvneta_ifnames {
 static int mvneta_dev_num;
 
 static void mvneta_stats_reset(struct rte_eth_dev *dev);
+static int rte_pmd_mvneta_remove(struct rte_vdev_device *vdev);
+
 
 /**
  * Deinitialize packet processor.
@@ -445,6 +447,14 @@ mvneta_dev_close(struct rte_eth_dev *dev)
 		mvneta_tx_queue_release(dev->data->tx_queues[i]);
 		dev->data->tx_queues[i] = NULL;
 	}
+
+	mvneta_dev_num--;
+
+	if (mvneta_dev_num == 0) {
+		MVNETA_LOG(INFO, "Perform MUSDK deinit");
+		mvneta_neta_deinit();
+		rte_mvep_deinit(MVEP_MOD_T_NETA);
+	}
 }
 
 /**
@@ -808,6 +818,9 @@ mvneta_eth_dev_create(struct rte_vdev_device *vdev, const char *name)
 	mvneta_set_tx_function(eth_dev);
 	eth_dev->dev_ops = &mvneta_ops;
 
+	/* Flag to call rte_eth_dev_release_port() in rte_eth_dev_close(). */
+	eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
 	rte_eth_dev_probing_finish(eth_dev);
 	return 0;
 out_free:
@@ -906,20 +919,16 @@ rte_pmd_mvneta_probe(struct rte_vdev_device *vdev)
 		ret = mvneta_eth_dev_create(vdev, ifnames.names[i]);
 		if (ret)
 			goto out_cleanup;
+
+		mvneta_dev_num++;
 	}
-	mvneta_dev_num += ifnum;
 
 	rte_kvargs_free(kvlist);
 
 	return 0;
 out_cleanup:
-	for (; i > 0; i--)
-		mvneta_eth_dev_destroy_name(ifnames.names[i]);
+	rte_pmd_mvneta_remove(vdev);
 
-	if (mvneta_dev_num == 0) {
-		mvneta_neta_deinit();
-		rte_mvep_deinit(MVEP_MOD_T_NETA);
-	}
 out_free_kvlist:
 	rte_kvargs_free(kvlist);
 
@@ -938,27 +947,12 @@ rte_pmd_mvneta_probe(struct rte_vdev_device *vdev)
 static int
 rte_pmd_mvneta_remove(struct rte_vdev_device *vdev)
 {
-	int i;
-	const char *name;
-
-	name = rte_vdev_device_name(vdev);
-	if (!name)
-		return -EINVAL;
-
-	MVNETA_LOG(INFO, "Removing %s", name);
+	uint16_t port_id;
 
-	RTE_ETH_FOREACH_DEV(i) {
-		if (rte_eth_devices[i].device != &vdev->device)
+	RTE_ETH_FOREACH_DEV(port_id) {
+		if (rte_eth_devices[port_id].device != &vdev->device)
 			continue;
-
-		mvneta_eth_dev_destroy(&rte_eth_devices[i]);
-		mvneta_dev_num--;
-	}
-
-	if (mvneta_dev_num == 0) {
-		MVNETA_LOG(INFO, "Perform MUSDK deinit");
-		mvneta_neta_deinit();
-		rte_mvep_deinit(MVEP_MOD_T_NETA);
+		rte_eth_dev_close(port_id);
 	}
 
 	return 0;
-- 
2.7.4


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

* Re: [dpdk-dev] [PATCH] net/mvneta: remove resources when port is closed
  2019-07-03  7:58 [dpdk-dev] [PATCH] net/mvneta: remove resources when port is closed lironh
@ 2019-07-07 10:25 ` Jerin Jacob Kollanukkaran
  2019-07-08 16:12   ` Ferruh Yigit
  0 siblings, 1 reply; 4+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-07-07 10:25 UTC (permalink / raw)
  To: Liron Himi; +Cc: dev, Liron Himi, Yuri Chipchev, Ferruh Yigit

> -----Original Message-----
> From: lironh@marvell.com <lironh@marvell.com>
> Sent: Wednesday, July 3, 2019 1:28 PM
> To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
> Cc: dev@dpdk.org; Liron Himi <lironh@marvell.com>; Yuri Chipchev
> <yuric@marvell.com>
> Subject: [PATCH] net/mvneta: remove resources when port is closed
> 
> From: yuric <yuric@marvell.com>
> 
> Since 18.11, it is suggested that driver should release all its private resources at
> the dev_close routine. So all resources previously released in remove routine are
> now released at the dev_close routine, and the dev_close routine will be called
> in driver remove routine in order to support removing a device without closing
> its ports.
> 
> Above behavior changes are supported by setting
> RTE_ETH_DEV_CLOSE_REMOVE flag during probe stage.
> 
> Signed-off-by: yuric <yuric@marvell.com>
> Reviewed-by: Liron Himi <lironh@marvell.com>

Applied to dpdk-next-net-mrvl/master. Thanks

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

* Re: [dpdk-dev] [PATCH] net/mvneta: remove resources when port is closed
  2019-07-07 10:25 ` Jerin Jacob Kollanukkaran
@ 2019-07-08 16:12   ` Ferruh Yigit
  2019-07-08 18:50     ` Liron Himi
  0 siblings, 1 reply; 4+ messages in thread
From: Ferruh Yigit @ 2019-07-08 16:12 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran, Liron Himi; +Cc: dev, Yuri Chipchev

On 7/7/2019 11:25 AM, Jerin Jacob Kollanukkaran wrote:
>> -----Original Message-----
>> From: lironh@marvell.com <lironh@marvell.com>
>> Sent: Wednesday, July 3, 2019 1:28 PM
>> To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
>> Cc: dev@dpdk.org; Liron Himi <lironh@marvell.com>; Yuri Chipchev
>> <yuric@marvell.com>
>> Subject: [PATCH] net/mvneta: remove resources when port is closed
>>
>> From: yuric <yuric@marvell.com>
>>
>> Since 18.11, it is suggested that driver should release all its private resources at
>> the dev_close routine. So all resources previously released in remove routine are
>> now released at the dev_close routine, and the dev_close routine will be called
>> in driver remove routine in order to support removing a device without closing
>> its ports.
>>
>> Above behavior changes are supported by setting
>> RTE_ETH_DEV_CLOSE_REMOVE flag during probe stage.
>>
>> Signed-off-by: yuric <yuric@marvell.com>
>> Reviewed-by: Liron Himi <lironh@marvell.com>
> 
> Applied to dpdk-next-net-mrvl/master. Thanks
> 

we can't use 'yuric' as sign-off name, I am updating it as:
Yuri Chipchev <yuric@marvell.com>

Please shout if this is not correct.

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

* Re: [dpdk-dev] [PATCH] net/mvneta: remove resources when port is closed
  2019-07-08 16:12   ` Ferruh Yigit
@ 2019-07-08 18:50     ` Liron Himi
  0 siblings, 0 replies; 4+ messages in thread
From: Liron Himi @ 2019-07-08 18:50 UTC (permalink / raw)
  To: Ferruh Yigit, Jerin Jacob Kollanukkaran; +Cc: dev, Yuri Chipchev, Liron Himi

Ack

Regards,
Liron

-----Original Message-----
From: Ferruh Yigit <ferruh.yigit@intel.com> 
Sent: Monday, July 8, 2019 19:12
To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Liron Himi <lironh@marvell.com>
Cc: dev@dpdk.org; Yuri Chipchev <yuric@marvell.com>
Subject: Re: [PATCH] net/mvneta: remove resources when port is closed

On 7/7/2019 11:25 AM, Jerin Jacob Kollanukkaran wrote:
>> -----Original Message-----
>> From: lironh@marvell.com <lironh@marvell.com>
>> Sent: Wednesday, July 3, 2019 1:28 PM
>> To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
>> Cc: dev@dpdk.org; Liron Himi <lironh@marvell.com>; Yuri Chipchev 
>> <yuric@marvell.com>
>> Subject: [PATCH] net/mvneta: remove resources when port is closed
>>
>> From: yuric <yuric@marvell.com>
>>
>> Since 18.11, it is suggested that driver should release all its 
>> private resources at the dev_close routine. So all resources 
>> previously released in remove routine are now released at the 
>> dev_close routine, and the dev_close routine will be called in driver 
>> remove routine in order to support removing a device without closing its ports.
>>
>> Above behavior changes are supported by setting 
>> RTE_ETH_DEV_CLOSE_REMOVE flag during probe stage.
>>
>> Signed-off-by: yuric <yuric@marvell.com>
>> Reviewed-by: Liron Himi <lironh@marvell.com>
> 
> Applied to dpdk-next-net-mrvl/master. Thanks
> 

we can't use 'yuric' as sign-off name, I am updating it as:
Yuri Chipchev <yuric@marvell.com>

Please shout if this is not correct.

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

end of thread, other threads:[~2019-07-08 18:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03  7:58 [dpdk-dev] [PATCH] net/mvneta: remove resources when port is closed lironh
2019-07-07 10:25 ` Jerin Jacob Kollanukkaran
2019-07-08 16:12   ` Ferruh Yigit
2019-07-08 18:50     ` Liron Himi

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