From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Long Wu <long.wu@corigine.com>,
chaoyong.he@corigine.com, stable@dpdk.org,
Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH] net/nfp: fix representor port release queue problem
Date: Tue, 19 Mar 2024 15:07:54 +0800 [thread overview]
Message-ID: <20240319070754.398799-1-chaoyong.he@corigine.com> (raw)
From: Long Wu <long.wu@corigine.com>
The PF representor port's queue is different from the VF/physical
representor port. So the release process in close port should
be different too.
Fixes: 39b3951 ("net/nfp: fix resource leak for exit of flower firmware")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
.../net/nfp/flower/nfp_flower_representor.c | 69 ++++++++++++++-----
1 file changed, 50 insertions(+), 19 deletions(-)
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index f26bf83edb..c4f33cbb2e 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -304,6 +304,54 @@ nfp_flower_repr_tx_burst(void *tx_queue,
return sent;
}
+static void
+nfp_flower_repr_free_queue(struct nfp_flower_representor *repr)
+{
+ uint16_t i;
+ struct rte_eth_dev *eth_dev = repr->eth_dev;
+
+ for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
+ rte_free(eth_dev->data->tx_queues[i]);
+
+ for (i = 0; i < eth_dev->data->nb_rx_queues; i++)
+ rte_free(eth_dev->data->rx_queues[i]);
+}
+
+static void
+nfp_flower_pf_repr_close_queue(struct nfp_flower_representor *repr)
+{
+ struct rte_eth_dev *eth_dev = repr->eth_dev;
+
+ /*
+ * We assume that the DPDK application is stopping all the
+ * threads/queues before calling the device close function.
+ */
+ nfp_net_disable_queues(eth_dev);
+
+ /* Clear queues */
+ nfp_net_close_tx_queue(eth_dev);
+ nfp_net_close_rx_queue(eth_dev);
+}
+
+static void
+nfp_flower_repr_close_queue(struct nfp_flower_representor *repr)
+{
+ switch (repr->repr_type) {
+ case NFP_REPR_TYPE_PHYS_PORT:
+ nfp_flower_repr_free_queue(repr);
+ break;
+ case NFP_REPR_TYPE_PF:
+ nfp_flower_pf_repr_close_queue(repr);
+ break;
+ case NFP_REPR_TYPE_VF:
+ nfp_flower_repr_free_queue(repr);
+ break;
+ default:
+ PMD_DRV_LOG(ERR, "Unsupported repr port type.");
+ break;
+ }
+}
+
static int
nfp_flower_repr_uninit(struct rte_eth_dev *eth_dev)
{
@@ -348,8 +396,6 @@ nfp_flower_repr_dev_close(struct rte_eth_dev *dev)
uint16_t i;
struct nfp_net_hw *hw;
struct nfp_pf_dev *pf_dev;
- struct nfp_net_txq *this_tx_q;
- struct nfp_net_rxq *this_rx_q;
struct nfp_flower_representor *repr;
struct nfp_app_fw_flower *app_fw_flower;
@@ -361,26 +407,11 @@ nfp_flower_repr_dev_close(struct rte_eth_dev *dev)
hw = app_fw_flower->pf_hw;
pf_dev = hw->pf_dev;
- /*
- * We assume that the DPDK application is stopping all the
- * threads/queues before calling the device close function.
- */
- nfp_net_disable_queues(dev);
-
- /* Clear queues */
- for (i = 0; i < dev->data->nb_tx_queues; i++) {
- this_tx_q = dev->data->tx_queues[i];
- nfp_net_reset_tx_queue(this_tx_q);
- }
-
- for (i = 0; i < dev->data->nb_rx_queues; i++) {
- this_rx_q = dev->data->rx_queues[i];
- nfp_net_reset_rx_queue(this_rx_q);
- }
-
if (pf_dev->app_fw_id != NFP_APP_FW_FLOWER_NIC)
return -EINVAL;
+ nfp_flower_repr_close_queue(repr);
+
nfp_flower_repr_free(repr, repr->repr_type);
for (i = 0; i < MAX_FLOWER_VFS; i++) {
--
2.39.1
next reply other threads:[~2024-03-19 7:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 7:07 Chaoyong He [this message]
2024-03-19 11:11 ` Ferruh Yigit
2024-03-19 11:14 ` Chaoyong He
2024-04-12 10:12 ` 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=20240319070754.398799-1-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--cc=long.wu@corigine.com \
--cc=oss-drivers@corigine.com \
--cc=peng.zhang@corigine.com \
--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).