DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH v2 1/8] net/nfp: modify the process private data
Date: Mon,  4 Dec 2023 09:57:11 +0800	[thread overview]
Message-ID: <20231204015718.780578-2-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20231204015718.780578-1-chaoyong.he@corigine.com>

Modify the process private data from 'struct nfp_cpp *' into
'struct nfp_pf_dev *'.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower.c |  2 +-
 drivers/net/nfp/nfp_ethdev.c        | 27 +++++++++++++++++----------
 drivers/net/nfp/nfp_net_common.c    |  8 +++++---
 3 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
index 6b523d98b0..f172c8350d 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -872,7 +872,7 @@ nfp_secondary_init_app_fw_flower(struct nfp_pf_dev *pf_dev)
 		return -ENODEV;
 	}
 
-	eth_dev->process_private = pf_dev->cpp;
+	eth_dev->process_private = pf_dev;
 	eth_dev->dev_ops = &nfp_flower_pf_vnic_ops;
 	eth_dev->rx_pkt_burst = nfp_net_recv_pkts;
 	eth_dev->tx_pkt_burst = nfp_flower_pf_xmit_pkts;
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index f02caf8056..9e40bce4dd 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -48,6 +48,7 @@ nfp_net_start(struct rte_eth_dev *dev)
 	uint16_t i;
 	struct nfp_hw *hw;
 	uint32_t new_ctrl;
+	struct nfp_cpp *cpp;
 	uint32_t update = 0;
 	uint32_t cap_extend;
 	uint32_t intr_vector;
@@ -166,10 +167,12 @@ nfp_net_start(struct rte_eth_dev *dev)
 	}
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-		/* Configure the physical port up */
-		nfp_eth_set_configured(net_hw->cpp, net_hw->nfp_idx, 1);
+		cpp = net_hw->cpp;
 	else
-		nfp_eth_set_configured(dev->process_private, net_hw->nfp_idx, 1);
+		cpp = ((struct nfp_pf_dev *)(dev->process_private))->cpp;
+
+	/* Configure the physical port up */
+	nfp_eth_set_configured(cpp, net_hw->nfp_idx, 1);
 
 	for (i = 0; i < dev->data->nb_rx_queues; i++)
 		dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
@@ -201,30 +204,34 @@ nfp_net_start(struct rte_eth_dev *dev)
 static int
 nfp_net_set_link_up(struct rte_eth_dev *dev)
 {
+	struct nfp_cpp *cpp;
 	struct nfp_net_hw *hw;
 
 	hw = dev->data->dev_private;
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-		/* Configure the physical port down */
-		return nfp_eth_set_configured(hw->cpp, hw->nfp_idx, 1);
+		cpp = hw->cpp;
 	else
-		return nfp_eth_set_configured(dev->process_private, hw->nfp_idx, 1);
+		cpp = ((struct nfp_pf_dev *)(dev->process_private))->cpp;
+
+	return nfp_eth_set_configured(cpp, hw->nfp_idx, 1);
 }
 
 /* Set the link down. */
 static int
 nfp_net_set_link_down(struct rte_eth_dev *dev)
 {
+	struct nfp_cpp *cpp;
 	struct nfp_net_hw *hw;
 
 	hw = dev->data->dev_private;
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-		/* Configure the physical port down */
-		return nfp_eth_set_configured(hw->cpp, hw->nfp_idx, 0);
+		cpp = hw->cpp;
 	else
-		return nfp_eth_set_configured(dev->process_private, hw->nfp_idx, 0);
+		cpp = ((struct nfp_pf_dev *)(dev->process_private))->cpp;
+
+	return nfp_eth_set_configured(cpp, hw->nfp_idx, 0);
 }
 
 static uint8_t
@@ -1361,7 +1368,7 @@ nfp_secondary_init_app_fw_nic(struct nfp_pf_dev *pf_dev)
 			break;
 		}
 
-		eth_dev->process_private = pf_dev->cpp;
+		eth_dev->process_private = pf_dev;
 		hw = eth_dev->data->dev_private;
 		nfp_net_ethdev_ops_mount(hw, eth_dev);
 
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index e969b840d6..eb480667c4 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -2115,6 +2115,7 @@ nfp_net_is_valid_nfd_version(struct nfp_net_fw_ver version)
 int
 nfp_net_stop(struct rte_eth_dev *dev)
 {
+	struct nfp_cpp *cpp;
 	struct nfp_net_hw *hw;
 
 	hw = nfp_net_get_hw(dev);
@@ -2126,10 +2127,11 @@ nfp_net_stop(struct rte_eth_dev *dev)
 	nfp_net_stop_rx_queue(dev);
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-		/* Configure the physical port down */
-		nfp_eth_set_configured(hw->cpp, hw->nfp_idx, 0);
+		cpp = hw->cpp;
 	else
-		nfp_eth_set_configured(dev->process_private, hw->nfp_idx, 0);
+		cpp = ((struct nfp_pf_dev *)(dev->process_private))->cpp;
+
+	nfp_eth_set_configured(cpp, hw->nfp_idx, 0);
 
 	return 0;
 }
-- 
2.39.1


  reply	other threads:[~2023-12-04  1:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30  8:52 [PATCH 0/7] fix resource leak problems Chaoyong He
2023-11-30  8:52 ` [PATCH 1/7] net/nfp: fix resource leak for device initialization Chaoyong He
2023-11-30  8:52 ` [PATCH 2/7] net/nfp: fix resource leak for CoreNIC firmware Chaoyong He
2023-11-30  8:52 ` [PATCH 3/7] net/nfp: fix resource leak for PF initialization Chaoyong He
2023-11-30  8:52 ` [PATCH 4/7] net/nfp: fix resource leak for flower firmware Chaoyong He
2023-11-30  8:52 ` [PATCH 5/7] net/nfp: fix resource leak for exit of CoreNIC firmware Chaoyong He
2023-11-30 11:00   ` Ferruh Yigit
2023-12-01  3:00     ` Chaoyong He
2023-12-01  9:41       ` Ferruh Yigit
2023-12-01 10:03         ` Chaoyong He
2023-11-30  8:52 ` [PATCH 6/7] net/nfp: fix resource leak for exit of flower firmware Chaoyong He
2023-11-30  8:52 ` [PATCH 7/7] net/nfp: fix resource leak for VF Chaoyong He
2023-12-04  1:57 ` [PATCH v2 0/8] fix resource leak problems Chaoyong He
2023-12-04  1:57   ` Chaoyong He [this message]
2023-12-04  1:57   ` [PATCH v2 2/8] net/nfp: fix resource leak for device initialization Chaoyong He
2023-12-04  1:57   ` [PATCH v2 3/8] net/nfp: fix resource leak for CoreNIC firmware Chaoyong He
2023-12-04  1:57   ` [PATCH v2 4/8] net/nfp: fix resource leak for PF initialization Chaoyong He
2023-12-04  1:57   ` [PATCH v2 5/8] net/nfp: fix resource leak for flower firmware Chaoyong He
2023-12-04  1:57   ` [PATCH v2 6/8] net/nfp: fix resource leak for exit of CoreNIC firmware Chaoyong He
2023-12-04  1:57   ` [PATCH v2 7/8] net/nfp: fix resource leak for exit of flower firmware Chaoyong He
2023-12-04  1:57   ` [PATCH v2 8/8] net/nfp: fix resource leak for VF Chaoyong He
2023-12-04 12:22   ` [PATCH v2 0/8] fix resource leak problems 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=20231204015718.780578-2-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=oss-drivers@corigine.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 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).