All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Qiu <michael.qiu@intel.com>
To: dev@dpdk.org
Cc: shaopeng.he@intel.com
Subject: [PATCH 1/2 v5] fm10k: Free queues when close port
Date: Tue, 14 Jul 2015 20:45:44 +0800	[thread overview]
Message-ID: <1436877945-14367-2-git-send-email-michael.qiu@intel.com> (raw)
In-Reply-To: <1436877945-14367-1-git-send-email-michael.qiu@intel.com>

When close a port, lots of memory should be released,
such as software rings, queues, etc.

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
---
 drivers/net/fm10k/fm10k_ethdev.c | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index c1a2069..b10c546 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -65,6 +65,8 @@ static void
 fm10k_MAC_filter_set(struct rte_eth_dev *dev, const u8 *mac, bool add);
 static void
 fm10k_MACVLAN_remove_all(struct rte_eth_dev *dev);
+static void fm10k_tx_queue_release(void *queue);
+static void fm10k_rx_queue_release(void *queue);
 
 static void
 fm10k_mbx_initlock(struct fm10k_hw *hw)
@@ -809,11 +811,31 @@ fm10k_dev_stop(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	for (i = 0; i < dev->data->nb_tx_queues; i++)
-		fm10k_dev_tx_queue_stop(dev, i);
+	if (dev->data->tx_queues)
+		for (i = 0; i < dev->data->nb_tx_queues; i++)
+			fm10k_dev_tx_queue_stop(dev, i);
 
-	for (i = 0; i < dev->data->nb_rx_queues; i++)
-		fm10k_dev_rx_queue_stop(dev, i);
+	if (dev->data->rx_queues)
+		for (i = 0; i < dev->data->nb_rx_queues; i++)
+			fm10k_dev_rx_queue_stop(dev, i);
+}
+
+static void
+fm10k_dev_queue_release(struct rte_eth_dev *dev)
+{
+	int i;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (dev->data->tx_queues) {
+		for (i = 0; i < dev->data->nb_tx_queues; i++)
+			fm10k_tx_queue_release(dev->data->tx_queues[i]);
+	}
+
+	if (dev->data->rx_queues) {
+		for (i = 0; i < dev->data->nb_rx_queues; i++)
+			fm10k_rx_queue_release(dev->data->rx_queues[i]);
+	}
 }
 
 static void
@@ -828,6 +850,7 @@ fm10k_dev_close(struct rte_eth_dev *dev)
 	/* Stop mailbox service first */
 	fm10k_close_mbx_service(hw);
 	fm10k_dev_stop(dev);
+	fm10k_dev_queue_release(dev);
 	fm10k_stop_hw(hw);
 }
 
-- 
1.9.3

  reply	other threads:[~2015-07-14 12:45 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-31 14:37 [RFC PATCH] librte_pmd_fm10k: Add hotplug support for fm10k Michael Qiu
2015-06-02  8:26 ` Iremonger, Bernard
2015-06-02  9:36   ` Qiu, Michael
2015-06-10 12:21 ` [PATCH 0/2 v2] Enable " Michael Qiu
2015-06-10 12:21   ` [PATCH 1/2] fm10k: Free queues when close port Michael Qiu
2015-06-12  7:27     ` Chen, Jing D
2015-06-17  7:59     ` [PATCH 1/2 v2] " Michael Qiu
2015-06-18  7:32       ` Chen, Jing D
2015-06-18 16:29       ` Iremonger, Bernard
2015-06-19  7:36         ` Qiu, Michael
2015-06-17  8:44     ` [PATCH 2/2 v2] fm10k: Add hotplug support for fm10k Michael Qiu
2015-06-18 16:42       ` Iremonger, Bernard
2015-06-19  7:41         ` Qiu, Michael
2015-06-10 12:21   ` [PATCH 2/2] " Michael Qiu
2015-06-10 12:24   ` [PATCH 0/2 v2] Enable " Qiu, Michael
2015-06-19  8:31   ` [PATCH 0/2 v3] " Michael Qiu
2015-06-19  8:31     ` [PATCH 1/2 v3] fm10k: Free queues when close port Michael Qiu
2015-06-19  8:31     ` [PATCH 2/2 v2] fm10k: Add hotplug support for fm10k Michael Qiu
2015-06-19  8:36       ` Qiu, Michael
2015-06-26  8:29     ` [PATCH 0/2 v4] Enable " Michael Qiu
2015-06-26  8:29       ` [PATCH 1/2 v4] fm10k: Free queues when close port Michael Qiu
2015-06-26 11:02         ` Iremonger, Bernard
2015-06-29  8:17           ` Qiu, Michael
2015-06-29  8:57             ` Iremonger, Bernard
2015-06-29  9:20               ` Qiu, Michael
2015-06-29  9:53                 ` Iremonger, Bernard
2015-06-29 14:58                   ` Qiu, Michael
2015-06-29 15:15                     ` Qiu, Michael
2015-06-29 11:08                 ` Ananyev, Konstantin
2015-06-29 15:14                   ` Qiu, Michael
2015-06-26  8:29       ` [PATCH 2/2 v4] fm10k: Add hotplug support for fm10k Michael Qiu
2015-07-14 12:45       ` [PATCH 0/2 v5] Enable " Michael Qiu
2015-07-14 12:45         ` Michael Qiu [this message]
2015-07-14 12:45         ` [PATCH 2/2 v5] fm10k: Add " Michael Qiu
2015-07-19 20:26         ` [PATCH 0/2 v5] Enable " 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=1436877945-14367-2-git-send-email-michael.qiu@intel.com \
    --to=michael.qiu@intel.com \
    --cc=dev@dpdk.org \
    --cc=shaopeng.he@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.