[v2,04/11] net/nfp: remove the unneeded data abstraction

Message ID 20231028065315.1937188-5-chaoyong.he@corigine.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series Clean up NFP PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chaoyong He Oct. 28, 2023, 6:53 a.m. UTC
  The data structure 'struct nfp_net_adapter' has only one data field and
we won't extend it in the future, which makes this abstraction unneeded,
so remove this data structure and the related macro
'NFP_NET_DEV_PRIVATE_TO_HW'.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower.c |  2 +-
 drivers/net/nfp/nfd3/nfp_nfd3_dp.c  |  2 +-
 drivers/net/nfp/nfdk/nfp_nfdk_dp.c  |  2 +-
 drivers/net/nfp/nfp_ethdev.c        | 18 ++++-----
 drivers/net/nfp/nfp_ethdev_vf.c     |  6 +--
 drivers/net/nfp/nfp_ipsec.c         | 18 ++++-----
 drivers/net/nfp/nfp_net_common.c    | 57 ++++++++++++++---------------
 drivers/net/nfp/nfp_net_common.h    |  3 --
 drivers/net/nfp/nfp_net_ctrl.c      |  2 +-
 drivers/net/nfp/nfp_rxtx.c          |  4 +-
 10 files changed, 55 insertions(+), 59 deletions(-)
  

Comments

Ferruh Yigit Nov. 1, 2023, 5:57 p.m. UTC | #1
On 10/28/2023 7:53 AM, Chaoyong He wrote:
> The data structure 'struct nfp_net_adapter' has only one data field and
> we won't extend it in the future, which makes this abstraction unneeded,
> so remove this data structure and the related macro
> 'NFP_NET_DEV_PRIVATE_TO_HW'.
> 

Mentioned abstract struct, 'struct nfp_net_adapter', is not removed in
this patch, although mentioned macro removed.

Since there is not user of the struct after this patch, I guess
intention was to remove the struct, so if there is no other issue I can
remove the struct while merging.


> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
  
Chaoyong He Nov. 2, 2023, 1:25 a.m. UTC | #2
> On 10/28/2023 7:53 AM, Chaoyong He wrote:
> > The data structure 'struct nfp_net_adapter' has only one data field
> > and we won't extend it in the future, which makes this abstraction
> > unneeded, so remove this data structure and the related macro
> > 'NFP_NET_DEV_PRIVATE_TO_HW'.
> >
> 
> Mentioned abstract struct, 'struct nfp_net_adapter', is not removed in this
> patch, although mentioned macro removed.

Oh, It should be missed when I do rebase, sorry about it.

> 
> Since there is not user of the struct after this patch, I guess intention was to
> remove the struct, so if there is no other issue I can remove the struct while
> merging.

It's nice, thank you very much!

> 
> 
> > Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> > Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
  

Patch

diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
index f3fedbf7e5..246dd2d454 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -848,7 +848,7 @@  nfp_init_app_fw_flower(struct nfp_pf_dev *pf_dev,
 	}
 
 	/* Allocate memory for the PF AND ctrl vNIC here (hence the * 2) */
-	pf_hw = rte_zmalloc_socket("nfp_pf_vnic", 2 * sizeof(struct nfp_net_adapter),
+	pf_hw = rte_zmalloc_socket("nfp_pf_vnic", 2 * sizeof(struct nfp_net_hw),
 			RTE_CACHE_LINE_SIZE, numa_node);
 	if (pf_hw == NULL) {
 		PMD_INIT_LOG(ERR, "Could not malloc nfp pf vnic");
diff --git a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c
index c85fadc80d..3f9909c6e0 100644
--- a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c
+++ b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c
@@ -377,7 +377,7 @@  nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev,
 	uint16_t tx_free_thresh;
 	const struct rte_memzone *tz;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 
 	nfp_net_tx_desc_limits(hw, &min_tx_desc, &max_tx_desc);
 
diff --git a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c
index 10e6982c95..fe87ea3e25 100644
--- a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c
+++ b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c
@@ -454,7 +454,7 @@  nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev,
 	struct nfp_net_txq *txq;
 	const struct rte_memzone *tz;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 
 	nfp_net_tx_desc_limits(hw, &min_tx_desc, &max_tx_desc);
 
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 0fed0ef72d..8e69fa67b2 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -55,7 +55,7 @@  nfp_net_start(struct rte_eth_dev *dev)
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	net_hw = dev->data->dev_private;
 	pf_dev = NFP_NET_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	app_fw_nic = NFP_PRIV_TO_APP_FW_NIC(pf_dev->app_fw_priv);
 	hw = &net_hw->super;
@@ -201,7 +201,7 @@  nfp_net_stop(struct rte_eth_dev *dev)
 {
 	struct nfp_net_hw *hw;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 
 	nfp_net_disable_queues(dev);
 
@@ -224,7 +224,7 @@  nfp_net_set_link_up(struct rte_eth_dev *dev)
 {
 	struct nfp_net_hw *hw;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		/* Configure the physical port down */
@@ -239,7 +239,7 @@  nfp_net_set_link_down(struct rte_eth_dev *dev)
 {
 	struct nfp_net_hw *hw;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		/* Configure the physical port down */
@@ -262,7 +262,7 @@  nfp_net_close(struct rte_eth_dev *dev)
 		return 0;
 
 	pf_dev = NFP_NET_DEV_PRIVATE_TO_PF(dev->data->dev_private);
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 	pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	app_fw_nic = NFP_PRIV_TO_APP_FW_NIC(pf_dev->app_fw_priv);
 
@@ -350,7 +350,7 @@  nfp_udp_tunnel_port_add(struct rte_eth_dev *dev,
 	struct nfp_net_hw *hw;
 	enum rte_eth_tunnel_type tnl_type;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 	vxlan_port = tunnel_udp->udp_port;
 	tnl_type   = tunnel_udp->prot_type;
 
@@ -388,7 +388,7 @@  nfp_udp_tunnel_port_del(struct rte_eth_dev *dev,
 	struct nfp_net_hw *hw;
 	enum rte_eth_tunnel_type tnl_type;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 	vxlan_port = tunnel_udp->udp_port;
 	tnl_type   = tunnel_udp->prot_type;
 
@@ -828,7 +828,7 @@  nfp_init_app_fw_nic(struct nfp_pf_dev *pf_dev,
 			goto port_cleanup;
 		}
 
-		hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+		hw = eth_dev->data->dev_private;
 
 		/* Add this device to the PF's array of physical ports */
 		app_fw_nic->ports[i] = hw;
@@ -1067,7 +1067,7 @@  nfp_secondary_init_app_fw_nic(struct rte_pci_device *pci_dev,
 		}
 
 		eth_dev->process_private = cpp;
-		hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+		hw = eth_dev->data->dev_private;
 		nfp_net_ethdev_ops_mount(hw, eth_dev);
 
 		rte_eth_dev_probing_finish(eth_dev);
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index e24fec861d..cb8a37bce7 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -66,7 +66,7 @@  nfp_netvf_start(struct rte_eth_dev *dev)
 	new_ctrl = nfp_check_offloads(dev);
 
 	/* Writing configuration parameters in the device */
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	net_hw = dev->data->dev_private;
 	hw = &net_hw->super;
 	nfp_net_params_setup(net_hw);
 
@@ -258,7 +258,7 @@  nfp_netvf_init(struct rte_eth_dev *eth_dev)
 		return -ENODEV;
 	}
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	net_hw = eth_dev->data->dev_private;
 	net_hw->dev_info = dev_info;
 	hw = &net_hw->super;
 
@@ -393,7 +393,7 @@  static int
 nfp_vf_pci_probe(struct rte_pci_device *pci_dev)
 {
 	return rte_eth_dev_pci_generic_probe(pci_dev,
-			sizeof(struct nfp_net_adapter), nfp_netvf_init);
+			sizeof(struct nfp_net_hw), nfp_netvf_init);
 }
 
 static int
diff --git a/drivers/net/nfp/nfp_ipsec.c b/drivers/net/nfp/nfp_ipsec.c
index 7e26977dc1..9a0ae89af3 100644
--- a/drivers/net/nfp/nfp_ipsec.c
+++ b/drivers/net/nfp/nfp_ipsec.c
@@ -579,7 +579,7 @@  nfp_aead_map(struct rte_eth_dev *eth_dev,
 	const uint32_t *key;
 	struct nfp_net_hw *net_hw;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	net_hw = eth_dev->data->dev_private;
 	device_id = net_hw->device_id;
 	offset = 0;
 
@@ -667,7 +667,7 @@  nfp_cipher_map(struct rte_eth_dev *eth_dev,
 	const uint32_t *key;
 	struct nfp_net_hw *net_hw;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	net_hw = eth_dev->data->dev_private;
 	device_id = net_hw->device_id;
 
 	switch (cipher->algo) {
@@ -808,7 +808,7 @@  nfp_auth_map(struct rte_eth_dev *eth_dev,
 		return -EINVAL;
 	}
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	net_hw = eth_dev->data->dev_private;
 	device_id = net_hw->device_id;
 	digest_length = digest_length << 3;
 
@@ -1082,7 +1082,7 @@  nfp_crypto_create_session(void *device,
 	sa_idx = -1;
 	eth_dev = device;
 	priv_session = SECURITY_GET_SESS_PRIV(session);
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	net_hw = eth_dev->data->dev_private;
 
 	if (net_hw->ipsec_data->sa_free_cnt == 0) {
 		PMD_DRV_LOG(ERR, "No space in SA table, spi: %d", conf->ipsec.spi);
@@ -1163,7 +1163,7 @@  nfp_security_set_pkt_metadata(void *device,
 	sqn = params;
 	eth_dev = device;
 	priv_session = SECURITY_GET_SESS_PRIV(session);
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	net_hw = eth_dev->data->dev_private;
 
 	if (priv_session->ipsec.direction == RTE_SECURITY_IPSEC_SA_DIR_EGRESS) {
 		struct nfp_tx_ipsec_desc_msg *desc_md;
@@ -1236,7 +1236,7 @@  nfp_security_session_get_stats(void *device,
 	memset(&msg, 0, sizeof(msg));
 	msg.cmd = NFP_IPSEC_CFG_MSG_GET_SA_STATS;
 	msg.sa_idx = priv_session->sa_index;
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	net_hw = eth_dev->data->dev_private;
 
 	ret = nfp_ipsec_cfg_cmd_issue(net_hw, &msg);
 	if (ret < 0) {
@@ -1288,7 +1288,7 @@  nfp_crypto_remove_sa(struct rte_eth_dev *eth_dev,
 	struct nfp_ipsec_msg cfg;
 
 	sa_index = priv_session->sa_index;
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	net_hw = eth_dev->data->dev_private;
 
 	cfg.cmd = NFP_IPSEC_CFG_MSG_INV_SA;
 	cfg.sa_idx = sa_index;
@@ -1380,7 +1380,7 @@  nfp_ipsec_init(struct rte_eth_dev *dev)
 	struct nfp_net_hw *net_hw;
 	struct nfp_net_ipsec_data *data;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	net_hw = dev->data->dev_private;
 
 	cap_extend = net_hw->super.cap_ext;
 	if ((cap_extend & NFP_NET_CFG_CTRL_IPSEC) == 0) {
@@ -1427,7 +1427,7 @@  nfp_ipsec_uninit(struct rte_eth_dev *dev)
 	struct nfp_net_hw *net_hw;
 	struct nfp_ipsec_session *priv_session;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	net_hw = dev->data->dev_private;
 
 	cap_extend = net_hw->super.cap_ext;
 	if ((cap_extend & NFP_NET_CFG_CTRL_IPSEC) == 0) {
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index ac97e3bed5..10f6298f74 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -252,7 +252,7 @@  nfp_net_configure(struct rte_eth_dev *dev)
 	struct rte_eth_rxmode *rxmode;
 	struct rte_eth_txmode *txmode;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 	dev_conf = &dev->data->dev_conf;
 	rxmode = &dev_conf->rxmode;
 	txmode = &dev_conf->txmode;
@@ -329,7 +329,7 @@  nfp_net_enable_queues(struct rte_eth_dev *dev)
 {
 	struct nfp_net_hw *hw;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 
 	nfp_enable_queues(&hw->super, dev->data->nb_rx_queues,
 			dev->data->nb_tx_queues);
@@ -340,7 +340,7 @@  nfp_net_disable_queues(struct rte_eth_dev *dev)
 {
 	struct nfp_net_hw *net_hw;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	net_hw = dev->data->dev_private;
 
 	nfp_disable_queues(&net_hw->super);
 }
@@ -367,7 +367,7 @@  nfp_net_set_mac_addr(struct rte_eth_dev *dev,
 	struct nfp_hw *hw;
 	struct nfp_net_hw *net_hw;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	net_hw = dev->data->dev_private;
 	hw = &net_hw->super;
 	if ((hw->ctrl & NFP_NET_CFG_CTRL_ENABLE) != 0 &&
 			(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR) == 0) {
@@ -407,7 +407,7 @@  nfp_configure_rx_interrupt(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 
 	if (rte_intr_type_get(intr_handle) == RTE_INTR_HANDLE_UIO) {
 		PMD_DRV_LOG(INFO, "VF: enabling RX interrupt with UIO");
@@ -443,7 +443,7 @@  nfp_check_offloads(struct rte_eth_dev *dev)
 	struct nfp_net_hw *hw;
 	struct rte_eth_conf *dev_conf;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 	cap = hw->super.cap;
 
 	dev_conf = &dev->data->dev_conf;
@@ -516,7 +516,7 @@  nfp_net_promisc_enable(struct rte_eth_dev *dev)
 		repr = dev->data->dev_private;
 		net_hw = repr->app_fw_flower->pf_hw;
 	} else {
-		net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+		net_hw = dev->data->dev_private;
 	}
 
 	hw = &net_hw->super;
@@ -551,7 +551,7 @@  nfp_net_promisc_disable(struct rte_eth_dev *dev)
 	struct nfp_hw *hw;
 	struct nfp_net_hw *net_hw;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	net_hw = dev->data->dev_private;
 	hw = &net_hw->super;
 
 	if ((hw->ctrl & NFP_NET_CFG_CTRL_PROMISC) == 0) {
@@ -588,7 +588,7 @@  nfp_net_link_update(struct rte_eth_dev *dev,
 	struct rte_eth_link link;
 	struct nfp_eth_table *nfp_eth_table;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 
 	memset(&link, 0, sizeof(struct rte_eth_link));
 
@@ -654,7 +654,7 @@  nfp_net_stats_get(struct rte_eth_dev *dev,
 	if (stats == NULL)
 		return -EINVAL;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 
 	memset(&nfp_dev_stats, 0, sizeof(nfp_dev_stats));
 
@@ -732,7 +732,7 @@  nfp_net_stats_reset(struct rte_eth_dev *dev)
 	uint16_t i;
 	struct nfp_net_hw *hw;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 
 	/* Reading per RX ring stats */
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
@@ -794,7 +794,7 @@  nfp_net_xstats_size(const struct rte_eth_dev *dev)
 	const uint32_t size = RTE_DIM(nfp_net_xstats);
 
 	/* If the device is a VF, then there will be no MAC stats */
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 	if (hw->mac_stats == NULL) {
 		for (count = 0; count < size; count++) {
 			if (nfp_net_xstats[count].group == NFP_XSTAT_GROUP_MAC)
@@ -828,7 +828,7 @@  nfp_net_xstats_value(const struct rte_eth_dev *dev,
 	struct nfp_net_hw *hw;
 	struct nfp_xstat xstat;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 	xstat = nfp_net_xstats[index];
 
 	if (xstat.group == NFP_XSTAT_GROUP_MAC)
@@ -967,7 +967,7 @@  nfp_net_xstats_reset(struct rte_eth_dev *dev)
 	uint32_t read_size;
 	struct nfp_net_hw *hw;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 	read_size = nfp_net_xstats_size(dev);
 
 	for (id = 0; id < read_size; id++) {
@@ -1015,7 +1015,7 @@  nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	uint16_t max_tx_desc;
 	struct nfp_net_hw *hw;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 
 	nfp_net_rx_desc_limits(hw, &min_rx_desc, &max_rx_desc);
 	nfp_net_tx_desc_limits(hw, &min_tx_desc, &max_tx_desc);
@@ -1220,7 +1220,7 @@  nfp_net_supported_ptypes_get(struct rte_eth_dev *dev)
 	if (dev->rx_pkt_burst != nfp_net_recv_pkts)
 		return NULL;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	net_hw = dev->data->dev_private;
 	if ((net_hw->super.cap_ext & NFP_NET_CFG_CTRL_PKT_TYPE) == 0)
 		return NULL;
 
@@ -1242,7 +1242,7 @@  nfp_rx_queue_intr_enable(struct rte_eth_dev *dev,
 	/* Make sure all updates are written before un-masking */
 	rte_wmb();
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 	nn_cfg_writeb(&hw->super, NFP_NET_CFG_ICR(base + queue_id),
 			NFP_NET_CFG_ICR_UNMASKED);
 	return 0;
@@ -1263,7 +1263,7 @@  nfp_rx_queue_intr_disable(struct rte_eth_dev *dev,
 	/* Make sure all updates are written before un-masking */
 	rte_wmb();
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 	nn_cfg_writeb(&hw->super, NFP_NET_CFG_ICR(base + queue_id), NFP_NET_CFG_ICR_RXTX);
 
 	return 0;
@@ -1301,7 +1301,7 @@  nfp_net_irq_unmask(struct rte_eth_dev *dev)
 	struct nfp_net_hw *hw;
 	struct rte_pci_device *pci_dev;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 	pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 
 	/* Make sure all updates are written before un-masking */
@@ -1376,7 +1376,7 @@  nfp_net_dev_mtu_set(struct rte_eth_dev *dev,
 {
 	struct nfp_net_hw *hw;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 
 	/* MTU setting is forbidden if port is started */
 	if (dev->data->dev_started) {
@@ -1412,9 +1412,8 @@  nfp_net_vlan_offload_set(struct rte_eth_dev *dev,
 	struct nfp_net_hw *net_hw;
 	uint32_t rxvlan_ctrl = 0;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	net_hw = dev->data->dev_private;
 	hw = &net_hw->super;
-
 	rx_offload = dev->data->dev_conf.rxmode.offloads;
 	new_ctrl = hw->ctrl;
 
@@ -1463,7 +1462,7 @@  nfp_net_rss_reta_write(struct rte_eth_dev *dev,
 	struct nfp_hw *hw;
 	struct nfp_net_hw *net_hw;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	net_hw = dev->data->dev_private;
 	hw = &net_hw->super;
 
 	if (reta_size != NFP_NET_CFG_RSS_ITBL_SZ) {
@@ -1519,7 +1518,7 @@  nfp_net_reta_update(struct rte_eth_dev *dev,
 	struct nfp_hw *hw;
 	struct nfp_net_hw *net_hw;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	net_hw = dev->data->dev_private;
 	hw = &net_hw->super;
 
 	if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0)
@@ -1552,7 +1551,7 @@  nfp_net_reta_query(struct rte_eth_dev *dev,
 	struct nfp_hw *hw;
 	struct nfp_net_hw *net_hw;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	net_hw = dev->data->dev_private;
 	hw = &net_hw->super;
 
 	if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0)
@@ -1602,7 +1601,7 @@  nfp_net_rss_hash_write(struct rte_eth_dev *dev,
 	struct nfp_net_hw *net_hw;
 	uint32_t cfg_rss_ctrl = 0;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	net_hw = dev->data->dev_private;
 	hw = &net_hw->super;
 
 	/* Writing the key byte by byte */
@@ -1658,7 +1657,7 @@  nfp_net_rss_hash_update(struct rte_eth_dev *dev,
 	struct nfp_hw *hw;
 	struct nfp_net_hw *net_hw;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	net_hw = dev->data->dev_private;
 	hw = &net_hw->super;
 
 	rss_hf = rss_conf->rss_hf;
@@ -1699,7 +1698,7 @@  nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev,
 	uint32_t cfg_rss_ctrl;
 	struct nfp_net_hw *net_hw;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	net_hw = dev->data->dev_private;
 	hw = &net_hw->super;
 
 	if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0)
@@ -1987,7 +1986,7 @@  nfp_net_firmware_version_get(struct rte_eth_dev *dev,
 	if (fw_size < FW_VER_LEN)
 		return FW_VER_LEN;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 
 	snprintf(vnic_version, FW_VER_LEN, "%d.%d.%d.%d",
 			hw->ver.extend, hw->ver.class,
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index 6607175460..a23b5be968 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -238,9 +238,6 @@  int nfp_net_firmware_version_get(struct rte_eth_dev *dev, char *fw_version, size
 int nfp_repr_firmware_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size);
 bool nfp_net_is_valid_nfd_version(struct nfp_net_fw_ver version);
 
-#define NFP_NET_DEV_PRIVATE_TO_HW(adapter)\
-	(&((struct nfp_net_adapter *)adapter)->hw)
-
 #define NFP_NET_DEV_PRIVATE_TO_PF(dev_priv)\
 	(((struct nfp_net_hw *)dev_priv)->pf_dev)
 
diff --git a/drivers/net/nfp/nfp_net_ctrl.c b/drivers/net/nfp/nfp_net_ctrl.c
index 5135a1ad27..ea14b98924 100644
--- a/drivers/net/nfp/nfp_net_ctrl.c
+++ b/drivers/net/nfp/nfp_net_ctrl.c
@@ -31,7 +31,7 @@  nfp_net_tlv_caps_parse(struct rte_eth_dev *dev)
 	struct nfp_net_hw *net_hw;
 	struct nfp_net_tlv_caps *caps;
 
-	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	net_hw = dev->data->dev_private;
 	caps = &net_hw->tlv_caps;
 	nfp_net_tlv_caps_reset(caps);
 
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 644be2700e..38ce83aa46 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -840,7 +840,7 @@  nfp_net_rx_queue_setup(struct rte_eth_dev *dev,
 	struct nfp_net_rxq *rxq;
 	const struct rte_memzone *tz;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 
 	nfp_net_rx_desc_limits(hw, &min_rx_desc, &max_rx_desc);
 
@@ -1067,7 +1067,7 @@  nfp_net_tx_queue_setup(struct rte_eth_dev *dev,
 {
 	struct nfp_net_hw *hw;
 
-	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	hw = dev->data->dev_private;
 
 	if (hw->ver.extend == NFP_NET_CFG_VERSION_DP_NFD3)
 		return nfp_net_nfd3_tx_queue_setup(dev, queue_idx,