DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yanling Song <songyl@ramaxel.com>
To: <dev@dpdk.org>
Cc: <songyl@ramaxel.com>, <yanling.song@linux.dev>,
	<yanggan@ramaxel.com>, <xuyun@ramaxel.com>,
	<ferruh.yigit@intel.com>, <stephen@networkplumber.org>,
	<lihuisong@huawei.com>
Subject: [PATCH v6 26/26] net/spnic: fixes unsafe C style code
Date: Thu, 30 Dec 2021 14:09:04 +0800	[thread overview]
Message-ID: <d47e28231b651c7139b656089a08df02a226eb2f.1640838702.git.songyl@ramaxel.com> (raw)
In-Reply-To: <cover.1640838702.git.songyl@ramaxel.com>

Use the hardware structure instead of void* as parameter of
function to keep the type information

Signed-off-by: Yanling Song <songyl@ramaxel.com>
---
 drivers/net/spnic/base/spnic_cmdq.c      |  14 +--
 drivers/net/spnic/base/spnic_cmdq.h      |   6 +-
 drivers/net/spnic/base/spnic_hw_cfg.c    |  49 ++++------
 drivers/net/spnic/base/spnic_hw_cfg.h    |  16 ++--
 drivers/net/spnic/base/spnic_hw_comm.c   |  32 ++++---
 drivers/net/spnic/base/spnic_hw_comm.h   |  22 ++---
 drivers/net/spnic/base/spnic_hwdev.c     |   8 +-
 drivers/net/spnic/base/spnic_hwif.c      |  52 +++++------
 drivers/net/spnic/base/spnic_hwif.h      |  22 ++---
 drivers/net/spnic/base/spnic_mgmt.c      |   9 +-
 drivers/net/spnic/base/spnic_mgmt.h      |   4 +-
 drivers/net/spnic/base/spnic_nic_cfg.c   | 110 +++++++++++------------
 drivers/net/spnic/base/spnic_nic_cfg.h   |  84 ++++++++---------
 drivers/net/spnic/base/spnic_nic_event.c |  30 +++----
 drivers/net/spnic/base/spnic_nic_event.h |  10 +--
 drivers/net/spnic/base/spnic_wq.c        |   3 +-
 drivers/net/spnic/base/spnic_wq.h        |   2 +-
 drivers/net/spnic/spnic_ethdev.c         |  10 +--
 drivers/net/spnic/spnic_io.c             |  34 +++----
 drivers/net/spnic/spnic_io.h             |  10 +--
 drivers/net/spnic/spnic_rx.c             |   4 +-
 drivers/net/spnic/spnic_tx.c             |   4 +-
 22 files changed, 252 insertions(+), 283 deletions(-)

diff --git a/drivers/net/spnic/base/spnic_cmdq.c b/drivers/net/spnic/base/spnic_cmdq.c
index b8950f91c2..62189d20a3 100644
--- a/drivers/net/spnic/base/spnic_cmdq.c
+++ b/drivers/net/spnic/base/spnic_cmdq.c
@@ -160,9 +160,9 @@ bool spnic_cmdq_idle(struct spnic_cmdq *cmdq)
 		true : false);
 }
 
-struct spnic_cmd_buf *spnic_alloc_cmd_buf(void *hwdev)
+struct spnic_cmd_buf *spnic_alloc_cmd_buf(struct spnic_hwdev *hwdev)
 {
-	struct spnic_cmdqs *cmdqs = ((struct spnic_hwdev *)hwdev)->cmdqs;
+	struct spnic_cmdqs *cmdqs = hwdev->cmdqs;
 	struct spnic_cmd_buf *cmd_buf;
 
 	cmd_buf = rte_zmalloc(NULL, sizeof(*cmd_buf), 0);
@@ -491,7 +491,7 @@ static int cmdq_sync_cmd_detail_resp(struct spnic_cmdq *cmdq,
 	return err;
 }
 
-static int cmdq_params_valid(void *hwdev, struct spnic_cmd_buf *buf_in)
+static int cmdq_params_valid(struct spnic_hwdev *hwdev, struct spnic_cmd_buf *buf_in)
 {
 	if (!buf_in || !hwdev) {
 		PMD_DRV_LOG(ERR, "Invalid CMDQ buffer or hwdev is NULL");
@@ -520,11 +520,11 @@ static int wait_cmdqs_enable(struct spnic_cmdqs *cmdqs)
 	return -EBUSY;
 }
 
-int spnic_cmdq_direct_resp(void *hwdev, enum spnic_mod_type mod, u8 cmd,
+int spnic_cmdq_direct_resp(struct spnic_hwdev *hwdev, enum spnic_mod_type mod, u8 cmd,
 			   struct spnic_cmd_buf *buf_in, u64 *out_param,
 			   u32 timeout)
 {
-	struct spnic_cmdqs *cmdqs = ((struct spnic_hwdev *)hwdev)->cmdqs;
+	struct spnic_cmdqs *cmdqs = hwdev->cmdqs;
 	int err;
 
 	err = cmdq_params_valid(hwdev, buf_in);
@@ -543,11 +543,11 @@ int spnic_cmdq_direct_resp(void *hwdev, enum spnic_mod_type mod, u8 cmd,
 					 mod, cmd, buf_in, out_param, timeout);
 }
 
-int spnic_cmdq_detail_resp(void *hwdev, enum spnic_mod_type mod, u8 cmd,
+int spnic_cmdq_detail_resp(struct spnic_hwdev *hwdev, enum spnic_mod_type mod, u8 cmd,
 			   struct spnic_cmd_buf *buf_in,
 			   struct spnic_cmd_buf *buf_out, u32 timeout)
 {
-	struct spnic_cmdqs *cmdqs = ((struct spnic_hwdev *)hwdev)->cmdqs;
+	struct spnic_cmdqs *cmdqs = hwdev->cmdqs;
 	int err;
 
 	err = cmdq_params_valid(hwdev, buf_in);
diff --git a/drivers/net/spnic/base/spnic_cmdq.h b/drivers/net/spnic/base/spnic_cmdq.h
index 9a08262860..bee899361c 100644
--- a/drivers/net/spnic/base/spnic_cmdq.h
+++ b/drivers/net/spnic/base/spnic_cmdq.h
@@ -225,7 +225,7 @@ int spnic_reinit_cmdq_ctxts(struct spnic_hwdev *hwdev);
 
 bool spnic_cmdq_idle(struct spnic_cmdq *cmdq);
 
-struct spnic_cmd_buf *spnic_alloc_cmd_buf(void *hwdev);
+struct spnic_cmd_buf *spnic_alloc_cmd_buf(struct spnic_hwdev *hwdev);
 
 void spnic_free_cmd_buf(struct spnic_cmd_buf *cmd_buf);
 
@@ -233,11 +233,11 @@ void spnic_free_cmd_buf(struct spnic_cmd_buf *cmd_buf);
  * PF/VF sends cmd to ucode by cmdq, and return 0 if success.
  * timeout=0, use default timeout.
  */
-int spnic_cmdq_direct_resp(void *hwdev, enum spnic_mod_type mod, u8 cmd,
+int spnic_cmdq_direct_resp(struct spnic_hwdev *hwdev, enum spnic_mod_type mod, u8 cmd,
 			   struct spnic_cmd_buf *buf_in, u64 *out_param,
 			   u32 timeout);
 
-int spnic_cmdq_detail_resp(void *hwdev, enum spnic_mod_type mod, u8 cmd,
+int spnic_cmdq_detail_resp(struct spnic_hwdev *hwdev, enum spnic_mod_type mod, u8 cmd,
 			   struct spnic_cmd_buf *buf_in,
 			   struct spnic_cmd_buf *buf_out, u32 timeout);
 
diff --git a/drivers/net/spnic/base/spnic_hw_cfg.c b/drivers/net/spnic/base/spnic_hw_cfg.c
index 36e87ffe40..cbc8b60779 100644
--- a/drivers/net/spnic/base/spnic_hw_cfg.c
+++ b/drivers/net/spnic/base/spnic_hw_cfg.c
@@ -58,15 +58,15 @@ static void parse_l2nic_res_cap(struct service_cap *cap,
 		    nic_cap->max_sqs, nic_cap->max_rqs);
 }
 
-static void parse_dev_cap(struct spnic_hwdev *dev,
+static void parse_dev_cap(struct spnic_hwdev *hwdev,
 			  struct spnic_cfg_cmd_dev_cap *dev_cap,
 			  enum func_type type)
 {
-	struct service_cap *cap = &dev->cfg_mgmt->svc_cap;
+	struct service_cap *cap = &hwdev->cfg_mgmt->svc_cap;
 
 	parse_pub_res_cap(cap, dev_cap, type);
 
-	if (IS_NIC_TYPE(dev))
+	if (IS_NIC_TYPE(hwdev))
 		parse_l2nic_res_cap(cap, dev_cap);
 }
 
@@ -112,13 +112,11 @@ static int get_dev_cap(struct spnic_hwdev *hwdev)
 	return 0;
 }
 
-int spnic_cfg_mbx_vf_proc_msg(void *hwdev, __rte_unused void *pri_handle, u16 cmd,
+int spnic_cfg_mbx_vf_proc_msg(struct spnic_hwdev *hwdev, __rte_unused void *pri_handle, u16 cmd,
 			__rte_unused void *buf_in, __rte_unused u16 in_size,
 			__rte_unused void *buf_out, __rte_unused u16 *out_size)
 {
-	struct spnic_hwdev *dev = hwdev;
-
-	if (!dev)
+	if (!hwdev)
 		return -EINVAL;
 
 	PMD_DRV_LOG(WARNING,
@@ -127,9 +125,8 @@ int spnic_cfg_mbx_vf_proc_msg(void *hwdev, __rte_unused void *pri_handle, u16 cm
 	return 0;
 }
 
-int spnic_init_capability(void *dev)
+int spnic_init_capability(struct spnic_hwdev *hwdev)
 {
-	struct spnic_hwdev *hwdev = (struct spnic_hwdev *)dev;
 	struct cfg_mgmt_info *cfg_mgmt = NULL;
 	int err;
 
@@ -151,9 +148,9 @@ int spnic_init_capability(void *dev)
 	return err;
 }
 
-void spnic_free_capability(void *dev)
+void spnic_free_capability(struct spnic_hwdev *hwdev)
 {
-	rte_free(((struct spnic_hwdev *)dev)->cfg_mgmt);
+	rte_free(hwdev->cfg_mgmt);
 }
 
 /* *
@@ -162,51 +159,43 @@ void spnic_free_capability(void *dev)
  * @retval true: function support nic
  * @retval false: function not support nic
  */
-bool spnic_support_nic(void *hwdev)
+bool spnic_support_nic(struct spnic_hwdev *hwdev)
 {
-	struct spnic_hwdev *dev = (struct spnic_hwdev *)hwdev;
-
 	if (!hwdev)
 		return false;
 
-	if (!IS_NIC_TYPE(dev))
+	if (!IS_NIC_TYPE(hwdev))
 		return false;
 
 	return true;
 }
 
-u16 spnic_func_max_sqs(void *hwdev)
+u16 spnic_func_max_sqs(struct spnic_hwdev *hwdev)
 {
-	struct spnic_hwdev *dev = hwdev;
-
-	if (!dev) {
+	if (!hwdev) {
 		PMD_DRV_LOG(INFO, "Hwdev is NULL for getting max_sqs");
 		return 0;
 	}
 
-	return dev->cfg_mgmt->svc_cap.nic_cap.max_sqs;
+	return hwdev->cfg_mgmt->svc_cap.nic_cap.max_sqs;
 }
 
-u16 spnic_func_max_rqs(void *hwdev)
+u16 spnic_func_max_rqs(struct spnic_hwdev *hwdev)
 {
-	struct spnic_hwdev *dev = hwdev;
-
-	if (!dev) {
+	if (!hwdev) {
 		PMD_DRV_LOG(INFO, "Hwdev is NULL for getting max_rqs");
 		return 0;
 	}
 
-	return dev->cfg_mgmt->svc_cap.nic_cap.max_rqs;
+	return hwdev->cfg_mgmt->svc_cap.nic_cap.max_rqs;
 }
 
-u8 spnic_physical_port_id(void *hwdev)
+u8 spnic_physical_port_id(struct spnic_hwdev *hwdev)
 {
-	struct spnic_hwdev *dev = hwdev;
-
-	if (!dev) {
+	if (!hwdev) {
 		PMD_DRV_LOG(INFO, "Hwdev is NULL for getting physical port id");
 		return 0;
 	}
 
-	return dev->cfg_mgmt->svc_cap.port_id;
+	return hwdev->cfg_mgmt->svc_cap.port_id;
 }
diff --git a/drivers/net/spnic/base/spnic_hw_cfg.h b/drivers/net/spnic/base/spnic_hw_cfg.h
index cf2b2ded01..4fbed02574 100644
--- a/drivers/net/spnic/base/spnic_hw_cfg.h
+++ b/drivers/net/spnic/base/spnic_hw_cfg.h
@@ -60,7 +60,7 @@ struct service_cap {
 };
 
 struct cfg_mgmt_info {
-	void *hwdev;
+	struct spnic_hwdev *hwdev;
 	struct service_cap svc_cap;
 };
 
@@ -109,17 +109,17 @@ struct spnic_cfg_cmd_dev_cap {
 #define IS_NIC_TYPE(dev) \
 	(((u32)(dev)->cfg_mgmt->svc_cap.chip_svc_type) & CFG_SVC_NIC_BIT0)
 
-int spnic_init_capability(void *dev);
-void spnic_free_capability(void *dev);
+int spnic_init_capability(struct spnic_hwdev *hwdev);
+void spnic_free_capability(struct spnic_hwdev *hwdev);
 
-u16 spnic_func_max_sqs(void *hwdev);
-u16 spnic_func_max_rqs(void *hwdev);
+u16 spnic_func_max_sqs(struct spnic_hwdev *hwdev);
+u16 spnic_func_max_rqs(struct spnic_hwdev *hwdev);
 
-u8 spnic_physical_port_id(void *hwdev);
+u8 spnic_physical_port_id(struct spnic_hwdev *hwdev);
 
-int spnic_cfg_mbx_vf_proc_msg(void *hwdev, void *pri_handle, u16 cmd, void *buf_in,
+int spnic_cfg_mbx_vf_proc_msg(struct spnic_hwdev *hwdev, void *pri_handle, u16 cmd, void *buf_in,
 			u16 in_size, void *buf_out, u16 *out_size);
 
-bool spnic_support_nic(void *hwdev);
+bool spnic_support_nic(struct spnic_hwdev *hwdev);
 
 #endif /* _SPNIC_HW_CFG_H_ */
diff --git a/drivers/net/spnic/base/spnic_hw_comm.c b/drivers/net/spnic/base/spnic_hw_comm.c
index 1c751f2403..0dbff45472 100644
--- a/drivers/net/spnic/base/spnic_hw_comm.c
+++ b/drivers/net/spnic/base/spnic_hw_comm.c
@@ -69,9 +69,8 @@ const u32 spnic_hw_rx_buf_size[] = {
 	SPNIC_RX_BUF_SIZE_16K,
 };
 
-int spnic_get_interrupt_cfg(void *dev, struct interrupt_info *info)
+int spnic_get_interrupt_cfg(struct spnic_hwdev *hwdev, struct interrupt_info *info)
 {
-	struct spnic_hwdev *hwdev = dev;
 	struct spnic_cmd_msix_config msix_cfg;
 	u16 out_size = sizeof(msix_cfg);
 	int err;
@@ -107,17 +106,16 @@ int spnic_get_interrupt_cfg(void *dev, struct interrupt_info *info)
 /**
  * Set interrupt cfg
  *
- * @param[in] dev
- *   The pointer to the private hardware device object
+ * @param[in] hwdev
+ *   The device pointer to hwdev
  * @param[in] info
  *   Interrupt info
  *
  * @retval zero : Success
  * @retval negative : Failure.
  */
-int spnic_set_interrupt_cfg(void *dev, struct interrupt_info info)
+int spnic_set_interrupt_cfg(struct spnic_hwdev *hwdev, struct interrupt_info info)
 {
-	struct spnic_hwdev *hwdev = dev;
 	struct spnic_cmd_msix_config msix_cfg;
 	struct interrupt_info temp_info;
 	u16 out_size = sizeof(msix_cfg);
@@ -167,7 +165,7 @@ int spnic_set_interrupt_cfg(void *dev, struct interrupt_info info)
 	return 0;
 }
 
-int spnic_set_wq_page_size(void *hwdev, u16 func_idx, u32 page_size)
+int spnic_set_wq_page_size(struct spnic_hwdev *hwdev, u16 func_idx, u32 page_size)
 {
 	struct spnic_cmd_wq_page_size page_size_info;
 	u16 out_size = sizeof(page_size_info);
@@ -192,10 +190,10 @@ int spnic_set_wq_page_size(void *hwdev, u16 func_idx, u32 page_size)
 	return 0;
 }
 
-int spnic_func_reset(void *hwdev, u64 reset_flag)
+int spnic_func_reset(struct spnic_hwdev *hwdev, u64 reset_flag)
 {
 	struct spnic_reset func_reset;
-	struct spnic_hwif *hwif = ((struct spnic_hwdev *)hwdev)->hwif;
+	struct spnic_hwif *hwif = hwdev->hwif;
 	u16 out_size = sizeof(func_reset);
 	int err = 0;
 
@@ -264,7 +262,7 @@ static u16 get_hw_rx_buf_size(u32 rx_buf_sz)
 	return DEFAULT_RX_BUF_SIZE; /* Default 2K */
 }
 
-int spnic_set_root_ctxt(void *hwdev, u32 rq_depth, u32 sq_depth, u16 rx_buf_sz)
+int spnic_set_root_ctxt(struct spnic_hwdev *hwdev, u32 rq_depth, u32 sq_depth, u16 rx_buf_sz)
 {
 	struct spnic_cmd_root_ctxt root_ctxt;
 	u16 out_size = sizeof(root_ctxt);
@@ -294,7 +292,7 @@ int spnic_set_root_ctxt(void *hwdev, u32 rq_depth, u32 sq_depth, u16 rx_buf_sz)
 	return 0;
 }
 
-int spnic_clean_root_ctxt(void *hwdev)
+int spnic_clean_root_ctxt(struct spnic_hwdev *hwdev)
 {
 	struct spnic_cmd_root_ctxt root_ctxt;
 	u16 out_size = sizeof(root_ctxt);
@@ -318,7 +316,7 @@ int spnic_clean_root_ctxt(void *hwdev)
 	return 0;
 }
 
-int spnic_set_cmdq_depth(void *hwdev, u16 cmdq_depth)
+int spnic_set_cmdq_depth(struct spnic_hwdev *hwdev, u16 cmdq_depth)
 {
 	struct spnic_cmd_root_ctxt root_ctxt;
 	u16 out_size = sizeof(root_ctxt);
@@ -388,7 +386,7 @@ int spnic_set_dma_attr_tbl(struct spnic_hwdev *hwdev, u32 entry_idx, u8 st,
 	return 0;
 }
 
-int spnic_get_mgmt_version(void *hwdev, char *mgmt_ver, int max_mgmt_len)
+int spnic_get_mgmt_version(struct spnic_hwdev *hwdev, char *mgmt_ver, int max_mgmt_len)
 {
 	struct spnic_cmd_get_fw_version fw_ver;
 	u16 out_size = sizeof(fw_ver);
@@ -415,7 +413,7 @@ int spnic_get_mgmt_version(void *hwdev, char *mgmt_ver, int max_mgmt_len)
 	return 0;
 }
 
-int spnic_get_board_info(void *hwdev, struct spnic_board_info *info)
+int spnic_get_board_info(struct spnic_hwdev *hwdev, struct spnic_board_info *info)
 {
 	struct spnic_cmd_board_info board_info;
 	u16 out_size = sizeof(board_info);
@@ -440,7 +438,7 @@ int spnic_get_board_info(void *hwdev, struct spnic_board_info *info)
 	return 0;
 }
 
-static int spnic_comm_features_nego(void *hwdev, u8 opcode, u64 *s_feature,
+static int spnic_comm_features_nego(struct spnic_hwdev *hwdev, u8 opcode, u64 *s_feature,
 				     u16 size)
 {
 	struct comm_cmd_feature_nego feature_nego;
@@ -472,13 +470,13 @@ static int spnic_comm_features_nego(void *hwdev, u8 opcode, u64 *s_feature,
 	return 0;
 }
 
-int spnic_get_comm_features(void *hwdev, u64 *s_feature, u16 size)
+int spnic_get_comm_features(struct spnic_hwdev *hwdev, u64 *s_feature, u16 size)
 {
 	return spnic_comm_features_nego(hwdev, MGMT_MSG_CMD_OP_GET, s_feature,
 					 size);
 }
 
-int spnic_set_comm_features(void *hwdev, u64 *s_feature, u16 size)
+int spnic_set_comm_features(struct spnic_hwdev *hwdev, u64 *s_feature, u16 size)
 {
 	return spnic_comm_features_nego(hwdev, MGMT_MSG_CMD_OP_SET, s_feature,
 					 size);
diff --git a/drivers/net/spnic/base/spnic_hw_comm.h b/drivers/net/spnic/base/spnic_hw_comm.h
index 4573595a89..5ceb838022 100644
--- a/drivers/net/spnic/base/spnic_hw_comm.h
+++ b/drivers/net/spnic/base/spnic_hw_comm.h
@@ -174,29 +174,29 @@ struct interrupt_info {
 	u8 resend_timer_cfg;
 };
 
-int spnic_func_reset(void *hwdev, u64 reset_flag);
+int spnic_func_reset(struct spnic_hwdev *hwdev, u64 reset_flag);
 
-int spnic_get_mgmt_version(void *hwdev, char *mgmt_ver, int max_mgmt_len);
+int spnic_get_mgmt_version(struct spnic_hwdev *hwdev, char *mgmt_ver, int max_mgmt_len);
 
-int spnic_get_board_info(void *hwdev, struct spnic_board_info *info);
+int spnic_get_board_info(struct spnic_hwdev *hwdev, struct spnic_board_info *info);
 
-int spnic_set_root_ctxt(void *hwdev, u32 rq_depth, u32 sq_depth, u16 rx_buf_sz);
+int spnic_set_root_ctxt(struct spnic_hwdev *hwdev, u32 rq_depth, u32 sq_depth, u16 rx_buf_sz);
 
-int spnic_clean_root_ctxt(void *hwdev);
+int spnic_clean_root_ctxt(struct spnic_hwdev *hwdev);
 
-int spnic_get_interrupt_cfg(void *dev, struct interrupt_info *info);
+int spnic_get_interrupt_cfg(struct spnic_hwdev *hwdev, struct interrupt_info *info);
 
-int spnic_set_interrupt_cfg(void *dev, struct interrupt_info info);
+int spnic_set_interrupt_cfg(struct spnic_hwdev *hwdev, struct interrupt_info info);
 
-int spnic_set_wq_page_size(void *hwdev, u16 func_idx, u32 page_size);
+int spnic_set_wq_page_size(struct spnic_hwdev *hwdev, u16 func_idx, u32 page_size);
 
-int spnic_set_cmdq_depth(void *hwdev, u16 cmdq_depth);
+int spnic_set_cmdq_depth(struct spnic_hwdev *hwdev, u16 cmdq_depth);
 
 int spnic_convert_rx_buf_size(u32 rx_buf_sz, u32 *match_sz);
 
-int spnic_get_comm_features(void *hwdev, u64 *s_feature, u16 size);
+int spnic_get_comm_features(struct spnic_hwdev *hwdev, u64 *s_feature, u16 size);
 
-int spnic_set_comm_features(void *hwdev, u64 *s_feature, u16 size);
+int spnic_set_comm_features(struct spnic_hwdev *hwdev, u64 *s_feature, u16 size);
 
 int spnic_set_dma_attr_tbl(struct spnic_hwdev *hwdev, u32 entry_idx, u8 st,
 			   u8 at, u8 ph, u8 no_snooping, u8 tph_en);
diff --git a/drivers/net/spnic/base/spnic_hwdev.c b/drivers/net/spnic/base/spnic_hwdev.c
index 9dc4fdc2d6..2dd434b0b5 100644
--- a/drivers/net/spnic/base/spnic_hwdev.c
+++ b/drivers/net/spnic/base/spnic_hwdev.c
@@ -4,7 +4,6 @@
 
 #include "spnic_compat.h"
 #include "spnic_csr.h"
-#include "spnic_hwif.h"
 #include "spnic_eqs.h"
 #include "spnic_mgmt.h"
 #include "spnic_cmd.h"
@@ -13,6 +12,7 @@
 #include "spnic_cmdq.h"
 #include "spnic_hw_cfg.h"
 #include "spnic_hwdev.h"
+#include "spnic_hwif.h"
 #include "spnic_hw_comm.h"
 
 enum spnic_pcie_nosnoop {
@@ -70,7 +70,7 @@ enum spnic_pcie_tph {
 #define SPNIC_DEAULT_EQ_MSIX_COALESC_TIMER_CFG	0xFF
 #define SPNIC_DEAULT_EQ_MSIX_RESEND_TIMER_CFG	7
 
-typedef void (*mgmt_event_cb)(void *handle, void *buf_in, u16 in_size,
+typedef void (*mgmt_event_cb)(struct spnic_hwdev *hwdev, void *buf_in, u16 in_size,
 			      void *buf_out, u16 *out_size);
 
 struct mgmt_event_handle {
@@ -93,7 +93,7 @@ int spnic_vf_handle_pf_comm_mbox(void *handle, __rte_unused void *pri_handle,
 	return 0;
 }
 
-static void fault_event_handler(__rte_unused void *hwdev,
+static void fault_event_handler(__rte_unused struct spnic_hwdev *hwdev,
 				__rte_unused void *buf_in,
 				__rte_unused u16 in_size,
 				__rte_unused void *buf_out,
@@ -102,7 +102,7 @@ static void fault_event_handler(__rte_unused void *hwdev,
 	PMD_DRV_LOG(WARNING, "Unsupported fault event handler");
 }
 
-static void ffm_event_msg_handler(__rte_unused void *hwdev,
+static void ffm_event_msg_handler(__rte_unused struct spnic_hwdev *hwdev,
 				  void *buf_in, u16 in_size,
 				  __rte_unused void *buf_out, u16 *out_size)
 {
diff --git a/drivers/net/spnic/base/spnic_hwif.c b/drivers/net/spnic/base/spnic_hwif.c
index d61061ccfa..bcf0094c6b 100644
--- a/drivers/net/spnic/base/spnic_hwif.c
+++ b/drivers/net/spnic/base/spnic_hwif.c
@@ -457,7 +457,7 @@ static void free_db_idx(struct spnic_hwif *hwif, u32 idx)
 	rte_spinlock_unlock(&free_db_area->idx_lock);
 }
 
-void spnic_free_db_addr(void *hwdev, const void *db_base,
+void spnic_free_db_addr(struct spnic_hwdev *hwdev, const void *db_base,
 			 __rte_unused void *dwqe_base)
 {
 	struct spnic_hwif *hwif = NULL;
@@ -466,13 +466,13 @@ void spnic_free_db_addr(void *hwdev, const void *db_base,
 	if (!hwdev || !db_base)
 		return;
 
-	hwif = ((struct spnic_hwdev *)hwdev)->hwif;
+	hwif = hwdev->hwif;
 	idx = DB_IDX(db_base, hwif->db_base);
 
 	free_db_idx(hwif, idx);
 }
 
-int spnic_alloc_db_addr(void *hwdev, void **db_base, void **dwqe_base)
+int spnic_alloc_db_addr(struct spnic_hwdev *hwdev, void **db_base, void **dwqe_base)
 {
 	struct spnic_hwif *hwif = NULL;
 	u32 idx;
@@ -481,7 +481,7 @@ int spnic_alloc_db_addr(void *hwdev, void **db_base, void **dwqe_base)
 	if (!hwdev || !db_base)
 		return -EINVAL;
 
-	hwif = ((struct spnic_hwdev *)hwdev)->hwif;
+	hwif = hwdev->hwif;
 
 	err = get_db_idx(hwif, &idx);
 	if (err)
@@ -501,13 +501,13 @@ int spnic_alloc_db_addr(void *hwdev, void **db_base, void **dwqe_base)
  * Set msix state
  *
  * @param[in] hwdev
- *   The pointer to the private hardware device object
+ *   The device pointer to hwdev
  * @param[in] msix_idx
  *   MSIX index
  * @param[in] flag
  *   MSIX state flag, 0-enable, 1-disable
  */
-void spnic_set_msix_state(void *hwdev, u16 msix_idx, enum spnic_msix_state flag)
+void spnic_set_msix_state(struct spnic_hwdev *hwdev, u16 msix_idx, enum spnic_msix_state flag)
 {
 	struct spnic_hwif *hwif = NULL;
 	u32 mask_bits;
@@ -517,7 +517,7 @@ void spnic_set_msix_state(void *hwdev, u16 msix_idx, enum spnic_msix_state flag)
 	if (!hwdev)
 		return;
 
-	hwif = ((struct spnic_hwdev *)hwdev)->hwif;
+	hwif = hwdev->hwif;
 
 	if (flag)
 		mask_bits = SPNIC_MSI_CLR_INDIR_SET(int_msk, INT_MSK_SET);
@@ -539,7 +539,7 @@ static void disable_all_msix(struct spnic_hwdev *hwdev)
 		spnic_set_msix_state(hwdev, i, SPNIC_MSIX_DISABLE);
 }
 
-void spnic_misx_intr_clear_resend_bit(void *hwdev, u16 msix_idx,
+void spnic_misx_intr_clear_resend_bit(struct spnic_hwdev *hwdev, u16 msix_idx,
 					      u8 clear_resend_en)
 {
 	struct spnic_hwif *hwif = NULL;
@@ -548,7 +548,7 @@ void spnic_misx_intr_clear_resend_bit(void *hwdev, u16 msix_idx,
 	if (!hwdev)
 		return;
 
-	hwif = ((struct spnic_hwdev *)hwdev)->hwif;
+	hwif = hwdev->hwif;
 
 	msix_ctrl = SPNIC_MSI_CLR_INDIR_SET(msix_idx, SIMPLE_INDIR_IDX) |
 		    SPNIC_MSI_CLR_INDIR_SET(clear_resend_en, RESEND_TIMER_CLR);
@@ -636,14 +636,13 @@ static void spnic_get_bar_addr(struct spnic_hwdev *hwdev)
  * Initialize the hw interface
  *
  * @param[in] hwdev
- *   The pointer to the private hardware device object
+ *   The device pointer to hwdev
  *
  * @retval zero : Success
  * @retval non-zero : Failure.
  */
-int spnic_init_hwif(void *dev)
+int spnic_init_hwif(struct spnic_hwdev *hwdev)
 {
-	struct spnic_hwdev *hwdev = NULL;
 	struct spnic_hwif *hwif;
 	int err;
 
@@ -652,7 +651,6 @@ int spnic_init_hwif(void *dev)
 	if (!hwif)
 		return -ENOMEM;
 
-	hwdev = (struct spnic_hwdev *)dev;
 	hwdev->hwif = hwif;
 
 	spnic_get_bar_addr(hwdev);
@@ -703,72 +701,70 @@ int spnic_init_hwif(void *dev)
 /**
  * Free the hw interface
  *
- * @param[in] dev
- *   The pointer to the private hardware device object
+ * @param[in] hwdev
+ *   The device pointer to hwdev
  */
-void spnic_free_hwif(void *dev)
+void spnic_free_hwif(struct spnic_hwdev *hwdev)
 {
-	struct spnic_hwdev *hwdev = (struct spnic_hwdev *)dev;
-
 	rte_free(hwdev->hwif);
 }
 
-u16 spnic_global_func_id(void *hwdev)
+u16 spnic_global_func_id(struct spnic_hwdev *hwdev)
 {
 	struct spnic_hwif *hwif = NULL;
 
 	if (!hwdev)
 		return 0;
 
-	hwif = ((struct spnic_hwdev *)hwdev)->hwif;
+	hwif = hwdev->hwif;
 
 	return hwif->attr.func_global_idx;
 }
 
-u8 spnic_pf_id_of_vf(void *hwdev)
+u8 spnic_pf_id_of_vf(struct spnic_hwdev *hwdev)
 {
 	struct spnic_hwif *hwif = NULL;
 
 	if (!hwdev)
 		return 0;
 
-	hwif = ((struct spnic_hwdev *)hwdev)->hwif;
+	hwif = hwdev->hwif;
 
 	return hwif->attr.port_to_port_idx;
 }
 
-u8 spnic_pcie_itf_id(void *hwdev)
+u8 spnic_pcie_itf_id(struct spnic_hwdev *hwdev)
 {
 	struct spnic_hwif *hwif = NULL;
 
 	if (!hwdev)
 		return 0;
 
-	hwif = ((struct spnic_hwdev *)hwdev)->hwif;
+	hwif = hwdev->hwif;
 
 	return hwif->attr.pci_intf_idx;
 }
 
-enum func_type spnic_func_type(void *hwdev)
+enum func_type spnic_func_type(struct spnic_hwdev *hwdev)
 {
 	struct spnic_hwif *hwif = NULL;
 
 	if (!hwdev)
 		return 0;
 
-	hwif = ((struct spnic_hwdev *)hwdev)->hwif;
+	hwif = hwdev->hwif;
 
 	return hwif->attr.func_type;
 }
 
-u16 spnic_glb_pf_vf_offset(void *hwdev)
+u16 spnic_glb_pf_vf_offset(struct spnic_hwdev *hwdev)
 {
 	struct spnic_hwif *hwif = NULL;
 
 	if (!hwdev)
 		return 0;
 
-	hwif = ((struct spnic_hwdev *)hwdev)->hwif;
+	hwif = hwdev->hwif;
 
 	return hwif->attr.global_vf_id_of_pf;
 }
diff --git a/drivers/net/spnic/base/spnic_hwif.h b/drivers/net/spnic/base/spnic_hwif.h
index e2be026cba..07c50278cb 100644
--- a/drivers/net/spnic/base/spnic_hwif.h
+++ b/drivers/net/spnic/base/spnic_hwif.h
@@ -118,38 +118,38 @@ u32 spnic_hwif_read_reg(struct spnic_hwif *hwif, u32 reg);
 
 void spnic_hwif_write_reg(struct spnic_hwif *hwif, u32 reg, u32 val);
 
-void spnic_set_msix_state(void *hwdev, u16 msix_idx,
+void spnic_set_msix_state(struct spnic_hwdev *hwdev, u16 msix_idx,
 			  enum spnic_msix_state flag);
 
-void spnic_misx_intr_clear_resend_bit(void *hwdev, u16 msix_idx,
+void spnic_misx_intr_clear_resend_bit(struct spnic_hwdev *hwdev, u16 msix_idx,
 				       u8 clear_resend_en);
 
-u16 spnic_global_func_id(void *hwdev);
+u16 spnic_global_func_id(struct spnic_hwdev *hwdev);
 
-u8 spnic_pf_id_of_vf(void *hwdev);
+u8 spnic_pf_id_of_vf(struct spnic_hwdev *hwdev);
 
-u8 spnic_pcie_itf_id(void *hwdev);
+u8 spnic_pcie_itf_id(struct spnic_hwdev *hwdev);
 
-enum func_type spnic_func_type(void *hwdev);
+enum func_type spnic_func_type(struct spnic_hwdev *hwdev);
 
-u16 spnic_glb_pf_vf_offset(void *hwdev);
+u16 spnic_glb_pf_vf_offset(struct spnic_hwdev *hwdev);
 
 void spnic_set_pf_status(struct spnic_hwif *hwif,
 			 enum spnic_pf_status status);
 
 enum spnic_pf_status spnic_get_pf_status(struct spnic_hwif *hwif);
 
-int spnic_alloc_db_addr(void *hwdev, void **db_base, void **dwqe_base);
+int spnic_alloc_db_addr(struct spnic_hwdev *hwdev, void **db_base, void **dwqe_base);
 
-void spnic_free_db_addr(void *hwdev, const void *db_base,
+void spnic_free_db_addr(struct spnic_hwdev *hwdev, const void *db_base,
 			__rte_unused void *dwqe_base);
 
 void spnic_disable_doorbell(struct spnic_hwif *hwif);
 
 void spnic_enable_doorbell(struct spnic_hwif *hwif);
 
-int spnic_init_hwif(void *dev);
+int spnic_init_hwif(struct spnic_hwdev *hwdev);
 
-void spnic_free_hwif(void *dev);
+void spnic_free_hwif(struct spnic_hwdev *hwdev);
 
 #endif /* _SPNIC_HWIF_H_ */
diff --git a/drivers/net/spnic/base/spnic_mgmt.c b/drivers/net/spnic/base/spnic_mgmt.c
index 98f58867e7..08ae1a2feb 100644
--- a/drivers/net/spnic/base/spnic_mgmt.c
+++ b/drivers/net/spnic/base/spnic_mgmt.c
@@ -35,7 +35,7 @@
 
 #define MGMT_MSG_TIMEOUT			300000 /* Millisecond */
 
-int spnic_msg_to_mgmt_sync(void *hwdev, enum spnic_mod_type mod, u16 cmd,
+int spnic_msg_to_mgmt_sync(struct spnic_hwdev *hwdev, enum spnic_mod_type mod, u16 cmd,
 			   void *buf_in, u16 in_size, void *buf_out,
 			   u16 *out_size, u32 timeout)
 {
@@ -186,7 +186,7 @@ static int recv_mgmt_msg_handler(struct spnic_msg_pf_to_mgmt *pf_to_mgmt,
  * Handler for a mgmt message event
  *
  * @param[in] hwdev
- *   The pointer to the private hardware device object
+ *   The device pointer to hwdev
  * @param[in] header
  *   The header of the message
  * @param[in] size
@@ -197,9 +197,8 @@ static int recv_mgmt_msg_handler(struct spnic_msg_pf_to_mgmt *pf_to_mgmt,
  * @retval zero : When aeqe is response message
  * @retval negative : When wrong message or not last message.
  */
-int spnic_mgmt_msg_aeqe_handler(void *hwdev, u8 *header, u8 size, void *param)
+int spnic_mgmt_msg_aeqe_handler(struct spnic_hwdev *hwdev, u8 *header, u8 size, void *param)
 {
-	struct spnic_hwdev *dev = (struct spnic_hwdev *)hwdev;
 	struct spnic_msg_pf_to_mgmt *pf_to_mgmt = NULL;
 	struct spnic_recv_msg *recv_msg = NULL;
 	bool is_send_dir = false;
@@ -209,7 +208,7 @@ int spnic_mgmt_msg_aeqe_handler(void *hwdev, u8 *header, u8 size, void *param)
 		return spnic_mbox_func_aeqe_handler(hwdev, header, size, param);
 	}
 
-	pf_to_mgmt = dev->pf_to_mgmt;
+	pf_to_mgmt = hwdev->pf_to_mgmt;
 
 	is_send_dir = (SPNIC_MSG_HEADER_GET(*(u64 *)header, DIRECTION) ==
 		       SPNIC_MSG_DIRECT_SEND) ? true : false;
diff --git a/drivers/net/spnic/base/spnic_mgmt.h b/drivers/net/spnic/base/spnic_mgmt.h
index 7325fc4d03..8250a32267 100644
--- a/drivers/net/spnic/base/spnic_mgmt.h
+++ b/drivers/net/spnic/base/spnic_mgmt.h
@@ -97,13 +97,13 @@ struct spnic_msg_pf_to_mgmt {
 	u16 sync_msg_id;
 };
 
-int spnic_mgmt_msg_aeqe_handler(void *hwdev, u8 *header, u8 size, void *param);
+int spnic_mgmt_msg_aeqe_handler(struct spnic_hwdev *hwdev, u8 *header, u8 size, void *param);
 
 int spnic_pf_to_mgmt_init(struct spnic_hwdev *hwdev);
 
 void spnic_pf_to_mgmt_free(struct spnic_hwdev *hwdev);
 
-int spnic_msg_to_mgmt_sync(void *hwdev, enum spnic_mod_type mod, u16 cmd,
+int spnic_msg_to_mgmt_sync(struct spnic_hwdev *hwdev, enum spnic_mod_type mod, u16 cmd,
 			   void *buf_in, u16 in_size, void *buf_out,
 			   u16 *out_size, u32 timeout);
 
diff --git a/drivers/net/spnic/base/spnic_nic_cfg.c b/drivers/net/spnic/base/spnic_nic_cfg.c
index 78561a5c64..0d6200580c 100644
--- a/drivers/net/spnic/base/spnic_nic_cfg.c
+++ b/drivers/net/spnic/base/spnic_nic_cfg.c
@@ -50,10 +50,10 @@ static const struct vf_msg_handler vf_mag_cmd_handler[] = {
 	},
 };
 
-static int mag_msg_to_mgmt_sync(void *hwdev, u16 cmd, void *buf_in, u16 in_size,
+static int mag_msg_to_mgmt_sync(struct spnic_hwdev *hwdev, u16 cmd, void *buf_in, u16 in_size,
 				void *buf_out, u16 *out_size);
 
-int spnic_l2nic_msg_to_mgmt_sync(void *hwdev, u16 cmd, void *buf_in, u16 in_size,
+int spnic_l2nic_msg_to_mgmt_sync(struct spnic_hwdev *hwdev, u16 cmd, void *buf_in, u16 in_size,
 			   void *buf_out, u16 *out_size)
 {
 	u32 i, cmd_cnt = ARRAY_LEN(vf_cmd_handler);
@@ -75,7 +75,7 @@ int spnic_l2nic_msg_to_mgmt_sync(void *hwdev, u16 cmd, void *buf_in, u16 in_size
 				      in_size, buf_out, out_size, 0);
 }
 
-int spnic_set_ci_table(void *hwdev, struct spnic_sq_attr *attr)
+int spnic_set_ci_table(struct spnic_hwdev *hwdev, struct spnic_sq_attr *attr)
 {
 	struct spnic_cmd_cons_idx_attr cons_idx_attr;
 	u16 out_size = sizeof(cons_idx_attr);
@@ -124,7 +124,7 @@ static int spnic_check_mac_info(u8 status, u16 vlan_id)
 
 #define VLAN_N_VID		4096
 
-int spnic_set_mac(void *hwdev, const u8 *mac_addr, u16 vlan_id, u16 func_id)
+int spnic_set_mac(struct spnic_hwdev *hwdev, const u8 *mac_addr, u16 vlan_id, u16 func_id)
 {
 	struct spnic_port_mac_set mac_info;
 	u16 out_size = sizeof(mac_info);
@@ -166,7 +166,7 @@ int spnic_set_mac(void *hwdev, const u8 *mac_addr, u16 vlan_id, u16 func_id)
 	return 0;
 }
 
-int spnic_del_mac(void *hwdev, const u8 *mac_addr, u16 vlan_id, u16 func_id)
+int spnic_del_mac(struct spnic_hwdev *hwdev, const u8 *mac_addr, u16 vlan_id, u16 func_id)
 {
 	struct spnic_port_mac_set mac_info;
 	u16 out_size = sizeof(mac_info);
@@ -202,7 +202,7 @@ int spnic_del_mac(void *hwdev, const u8 *mac_addr, u16 vlan_id, u16 func_id)
 	return 0;
 }
 
-int spnic_update_mac(void *hwdev, u8 *old_mac, u8 *new_mac, u16 vlan_id,
+int spnic_update_mac(struct spnic_hwdev *hwdev, u8 *old_mac, u8 *new_mac, u16 vlan_id,
 		     u16 func_id)
 {
 	struct spnic_port_mac_update mac_info;
@@ -245,7 +245,7 @@ int spnic_update_mac(void *hwdev, u8 *old_mac, u8 *new_mac, u16 vlan_id,
 	return 0;
 }
 
-int spnic_get_default_mac(void *hwdev, u8 *mac_addr, int ether_len)
+int spnic_get_default_mac(struct spnic_hwdev *hwdev, u8 *mac_addr, int ether_len)
 {
 	struct spnic_port_mac_set mac_info;
 	u16 out_size = sizeof(mac_info);
@@ -271,7 +271,7 @@ int spnic_get_default_mac(void *hwdev, u8 *mac_addr, int ether_len)
 	return 0;
 }
 
-static int spnic_config_vlan(void *hwdev, u8 opcode, u16 vlan_id, u16 func_id)
+static int spnic_config_vlan(struct spnic_hwdev *hwdev, u8 opcode, u16 vlan_id, u16 func_id)
 {
 	struct spnic_cmd_vlan_config vlan_info;
 	u16 out_size = sizeof(vlan_info);
@@ -294,7 +294,7 @@ static int spnic_config_vlan(void *hwdev, u8 opcode, u16 vlan_id, u16 func_id)
 	return 0;
 }
 
-int spnic_add_vlan(void *hwdev, u16 vlan_id, u16 func_id)
+int spnic_add_vlan(struct spnic_hwdev *hwdev, u16 vlan_id, u16 func_id)
 {
 	if (!hwdev)
 		return -EINVAL;
@@ -302,7 +302,7 @@ int spnic_add_vlan(void *hwdev, u16 vlan_id, u16 func_id)
 	return spnic_config_vlan(hwdev, SPNIC_CMD_OP_ADD, vlan_id, func_id);
 }
 
-int spnic_del_vlan(void *hwdev, u16 vlan_id, u16 func_id)
+int spnic_del_vlan(struct spnic_hwdev *hwdev, u16 vlan_id, u16 func_id)
 {
 	if (!hwdev)
 		return -EINVAL;
@@ -310,7 +310,7 @@ int spnic_del_vlan(void *hwdev, u16 vlan_id, u16 func_id)
 	return spnic_config_vlan(hwdev, SPNIC_CMD_OP_DEL, vlan_id, func_id);
 }
 
-int spnic_get_port_info(void *hwdev, struct nic_port_info *port_info)
+int spnic_get_port_info(struct spnic_hwdev *hwdev, struct nic_port_info *port_info)
 {
 	struct spnic_cmd_port_info port_msg;
 	u16 out_size = sizeof(port_msg);
@@ -341,7 +341,7 @@ int spnic_get_port_info(void *hwdev, struct nic_port_info *port_info)
 }
 
 
-int spnic_get_link_state(void *hwdev, u8 *link_state)
+int spnic_get_link_state(struct spnic_hwdev *hwdev, u8 *link_state)
 {
 	struct spnic_cmd_link_state get_link;
 	u16 out_size = sizeof(get_link);
@@ -365,7 +365,7 @@ int spnic_get_link_state(void *hwdev, u8 *link_state)
 	return 0;
 }
 
-int spnic_set_vport_enable(void *hwdev, bool enable)
+int spnic_set_vport_enable(struct spnic_hwdev *hwdev, bool enable)
 {
 	struct spnic_vport_state en_state;
 	u16 out_size = sizeof(en_state);
@@ -389,7 +389,7 @@ int spnic_set_vport_enable(void *hwdev, bool enable)
 	return 0;
 }
 
-int spnic_set_port_enable(void *hwdev, bool enable)
+int spnic_set_port_enable(struct spnic_hwdev *hwdev, bool enable)
 {
 	struct mag_cmd_set_port_enable en_state;
 	u16 out_size = sizeof(en_state);
@@ -417,7 +417,7 @@ int spnic_set_port_enable(void *hwdev, bool enable)
 	return 0;
 }
 
-int spnic_flush_qps_res(void *hwdev)
+int spnic_flush_qps_res(struct spnic_hwdev *hwdev)
 {
 	struct spnic_cmd_clear_qp_resource sq_res;
 	u16 out_size = sizeof(sq_res);
@@ -440,7 +440,7 @@ int spnic_flush_qps_res(void *hwdev)
 	return 0;
 }
 
-static int spnic_cfg_hw_pause(void *hwdev, u8 opcode,
+static int spnic_cfg_hw_pause(struct spnic_hwdev *hwdev, u8 opcode,
 			       struct nic_pause_config *nic_pause)
 {
 	struct spnic_cmd_pause_config pause_info;
@@ -476,7 +476,7 @@ static int spnic_cfg_hw_pause(void *hwdev, u8 opcode,
 	return 0;
 }
 
-int spnic_set_pause_info(void *hwdev, struct nic_pause_config nic_pause)
+int spnic_set_pause_info(struct spnic_hwdev *hwdev, struct nic_pause_config nic_pause)
 {
 	if (!hwdev)
 		return -EINVAL;
@@ -484,7 +484,7 @@ int spnic_set_pause_info(void *hwdev, struct nic_pause_config nic_pause)
 	return spnic_cfg_hw_pause(hwdev, SPNIC_CMD_OP_SET, &nic_pause);
 }
 
-int spnic_get_pause_info(void *hwdev, struct nic_pause_config *nic_pause)
+int spnic_get_pause_info(struct spnic_hwdev *hwdev, struct nic_pause_config *nic_pause)
 {
 	if (!hwdev || !nic_pause)
 		return -EINVAL;
@@ -493,7 +493,7 @@ int spnic_get_pause_info(void *hwdev, struct nic_pause_config *nic_pause)
 	return spnic_cfg_hw_pause(hwdev, SPNIC_CMD_OP_GET, nic_pause);
 }
 
-int spnic_get_vport_stats(void *hwdev, struct spnic_vport_stats *stats)
+int spnic_get_vport_stats(struct spnic_hwdev *hwdev, struct spnic_vport_stats *stats)
 {
 	struct spnic_port_stats_info stats_info;
 	struct spnic_cmd_vport_stats vport_stats;
@@ -522,7 +522,7 @@ int spnic_get_vport_stats(void *hwdev, struct spnic_vport_stats *stats)
 	return 0;
 }
 
-int spnic_get_phy_port_stats(void *hwdev, struct mag_phy_port_stats *stats)
+int spnic_get_phy_port_stats(struct spnic_hwdev *hwdev, struct mag_phy_port_stats *stats)
 {
 	struct mag_cmd_get_port_stat *port_stats = NULL;
 	struct mag_cmd_port_stats_info stats_info;
@@ -555,7 +555,7 @@ int spnic_get_phy_port_stats(void *hwdev, struct mag_phy_port_stats *stats)
 	return err;
 }
 
-int spnic_clear_vport_stats(void *hwdev)
+int spnic_clear_vport_stats(struct spnic_hwdev *hwdev)
 {
 	struct spnic_cmd_clear_vport_stats clear_vport_stats;
 	u16 out_size = sizeof(clear_vport_stats);
@@ -582,7 +582,7 @@ int spnic_clear_vport_stats(void *hwdev)
 	return 0;
 }
 
-int spnic_clear_phy_port_stats(void *hwdev)
+int spnic_clear_phy_port_stats(struct spnic_hwdev *hwdev)
 {
 	struct mag_cmd_clr_port_stat *port_stats = NULL;
 	u16 out_size = sizeof(*port_stats);
@@ -611,7 +611,7 @@ int spnic_clear_phy_port_stats(void *hwdev)
 	return err;
 }
 
-static int spnic_set_function_table(void *hwdev, u32 cfg_bitmap,
+static int spnic_set_function_table(struct spnic_hwdev *hwdev, u32 cfg_bitmap,
 				     struct spnic_func_tbl_cfg *cfg)
 {
 	struct spnic_cmd_set_func_tbl cmd_func_tbl;
@@ -636,7 +636,7 @@ static int spnic_set_function_table(void *hwdev, u32 cfg_bitmap,
 	return 0;
 }
 
-int spnic_init_function_table(void *hwdev, u16 rx_buff_len)
+int spnic_init_function_table(struct spnic_hwdev *hwdev, u16 rx_buff_len)
 {
 	struct spnic_func_tbl_cfg func_tbl_cfg;
 	u32 cfg_bitmap = BIT(FUNC_CFG_INIT) | BIT(FUNC_CFG_MTU) |
@@ -649,7 +649,7 @@ int spnic_init_function_table(void *hwdev, u16 rx_buff_len)
 	return spnic_set_function_table(hwdev, cfg_bitmap, &func_tbl_cfg);
 }
 
-int spnic_set_port_mtu(void *hwdev, u16 new_mtu)
+int spnic_set_port_mtu(struct spnic_hwdev *hwdev, u16 new_mtu)
 {
 	struct spnic_func_tbl_cfg func_tbl_cfg;
 
@@ -675,7 +675,7 @@ int spnic_set_port_mtu(void *hwdev, u16 new_mtu)
 					&func_tbl_cfg);
 }
 
-static int nic_feature_nego(void *hwdev, u8 opcode, u64 *s_feature, u16 size)
+static int nic_feature_nego(struct spnic_hwdev *hwdev, u8 opcode, u64 *s_feature, u16 size)
 {
 	struct spnic_cmd_feature_nego feature_nego;
 	u16 out_size = sizeof(feature_nego);
@@ -705,17 +705,17 @@ static int nic_feature_nego(void *hwdev, u8 opcode, u64 *s_feature, u16 size)
 	return 0;
 }
 
-int spnic_get_feature_from_hw(void *hwdev, u64 *s_feature, u16 size)
+int spnic_get_feature_from_hw(struct spnic_hwdev *hwdev, u64 *s_feature, u16 size)
 {
 	return nic_feature_nego(hwdev, SPNIC_CMD_OP_GET, s_feature, size);
 }
 
-int spnic_set_feature_to_hw(void *hwdev, u64 *s_feature, u16 size)
+int spnic_set_feature_to_hw(struct spnic_hwdev *hwdev, u64 *s_feature, u16 size)
 {
 	return nic_feature_nego(hwdev, SPNIC_CMD_OP_SET, s_feature, size);
 }
 
-static int spnic_vf_func_init(void *hwdev)
+static int spnic_vf_func_init(struct spnic_hwdev *hwdev)
 {
 	struct spnic_cmd_register_vf register_info;
 	u16 out_size = sizeof(register_info);
@@ -738,7 +738,7 @@ static int spnic_vf_func_init(void *hwdev)
 	return 0;
 }
 
-static int spnic_vf_func_free(void *hwdev)
+static int spnic_vf_func_free(struct spnic_hwdev *hwdev)
 {
 	struct spnic_cmd_register_vf unregister;
 	u16 out_size = sizeof(unregister);
@@ -761,12 +761,12 @@ static int spnic_vf_func_free(void *hwdev)
 	return 0;
 }
 
-int spnic_init_nic_hwdev(void *hwdev)
+int spnic_init_nic_hwdev(struct spnic_hwdev *hwdev)
 {
 	return spnic_vf_func_init(hwdev);
 }
 
-void spnic_free_nic_hwdev(void *hwdev)
+void spnic_free_nic_hwdev(struct spnic_hwdev *hwdev)
 {
 	if (!hwdev)
 		return;
@@ -774,7 +774,7 @@ void spnic_free_nic_hwdev(void *hwdev)
 	spnic_vf_func_free(hwdev);
 }
 
-int spnic_set_rx_mode(void *hwdev, u32 enable)
+int spnic_set_rx_mode(struct spnic_hwdev *hwdev, u32 enable)
 {
 	struct spnic_rx_mode_config rx_mode_cfg;
 	u16 out_size = sizeof(rx_mode_cfg);
@@ -799,7 +799,7 @@ int spnic_set_rx_mode(void *hwdev, u32 enable)
 	return 0;
 }
 
-int spnic_set_rx_vlan_offload(void *hwdev, u8 en)
+int spnic_set_rx_vlan_offload(struct spnic_hwdev *hwdev, u8 en)
 {
 	struct spnic_cmd_vlan_offload vlan_cfg;
 	u16 out_size = sizeof(vlan_cfg);
@@ -824,7 +824,7 @@ int spnic_set_rx_vlan_offload(void *hwdev, u8 en)
 	return 0;
 }
 
-int spnic_set_vlan_fliter(void *hwdev, u32 vlan_filter_ctrl)
+int spnic_set_vlan_fliter(struct spnic_hwdev *hwdev, u32 vlan_filter_ctrl)
 {
 	struct spnic_cmd_set_vlan_filter vlan_filter;
 	u16 out_size = sizeof(vlan_filter);
@@ -849,7 +849,7 @@ int spnic_set_vlan_fliter(void *hwdev, u32 vlan_filter_ctrl)
 	return 0;
 }
 
-static int spnic_set_rx_lro(void *hwdev, u8 ipv4_en, u8 ipv6_en,
+static int spnic_set_rx_lro(struct spnic_hwdev *hwdev, u8 ipv4_en, u8 ipv6_en,
 			    u8 lro_max_pkt_len)
 {
 	struct spnic_cmd_lro_config lro_cfg;
@@ -877,7 +877,7 @@ static int spnic_set_rx_lro(void *hwdev, u8 ipv4_en, u8 ipv6_en,
 	return 0;
 }
 
-static int spnic_set_rx_lro_timer(void *hwdev, u32 timer_value)
+static int spnic_set_rx_lro_timer(struct spnic_hwdev *hwdev, u32 timer_value)
 {
 	struct spnic_cmd_lro_timer lro_timer;
 	u16 out_size = sizeof(lro_timer);
@@ -902,7 +902,7 @@ static int spnic_set_rx_lro_timer(void *hwdev, u32 timer_value)
 	return 0;
 }
 
-int spnic_set_rx_lro_state(void *hwdev, u8 lro_en, u32 lro_timer,
+int spnic_set_rx_lro_state(struct spnic_hwdev *hwdev, u8 lro_en, u32 lro_timer,
 			    u32 lro_max_pkt_len)
 {
 	u8 ipv4_en = 0, ipv6_en = 0;
@@ -931,7 +931,7 @@ int spnic_set_rx_lro_state(void *hwdev, u8 lro_en, u32 lro_timer,
 }
 
 /* RSS config */
-int spnic_rss_template_alloc(void *hwdev)
+int spnic_rss_template_alloc(struct spnic_hwdev *hwdev)
 {
 	struct spnic_rss_template_mgmt template_mgmt;
 	u16 out_size = sizeof(template_mgmt);
@@ -962,7 +962,7 @@ int spnic_rss_template_alloc(void *hwdev)
 	return 0;
 }
 
-int spnic_rss_template_free(void *hwdev)
+int spnic_rss_template_free(struct spnic_hwdev *hwdev)
 {
 	struct spnic_rss_template_mgmt template_mgmt;
 	u16 out_size = sizeof(template_mgmt);
@@ -988,7 +988,7 @@ int spnic_rss_template_free(void *hwdev)
 	return 0;
 }
 
-static int spnic_rss_cfg_hash_key(void *hwdev, u8 opcode, u8 *key)
+static int spnic_rss_cfg_hash_key(struct spnic_hwdev *hwdev, u8 opcode, u8 *key)
 {
 	struct spnic_cmd_rss_hash_key hash_key;
 	u16 out_size = sizeof(hash_key);
@@ -1020,7 +1020,7 @@ static int spnic_rss_cfg_hash_key(void *hwdev, u8 opcode, u8 *key)
 	return 0;
 }
 
-int spnic_rss_set_hash_key(void *hwdev, u8 *key)
+int spnic_rss_set_hash_key(struct spnic_hwdev *hwdev, u8 *key)
 {
 	if (!hwdev || !key)
 		return -EINVAL;
@@ -1028,7 +1028,7 @@ int spnic_rss_set_hash_key(void *hwdev, u8 *key)
 	return spnic_rss_cfg_hash_key(hwdev, SPNIC_CMD_OP_SET, key);
 }
 
-int spnic_rss_get_hash_key(void *hwdev, u8 *key)
+int spnic_rss_get_hash_key(struct spnic_hwdev *hwdev, u8 *key)
 {
 	if (!hwdev || !key)
 		return -EINVAL;
@@ -1036,7 +1036,7 @@ int spnic_rss_get_hash_key(void *hwdev, u8 *key)
 	return spnic_rss_cfg_hash_key(hwdev, SPNIC_CMD_OP_GET, key);
 }
 
-int spnic_rss_get_indir_tbl(void *hwdev, u32 *indir_table)
+int spnic_rss_get_indir_tbl(struct spnic_hwdev *hwdev, u32 *indir_table)
 {
 	struct spnic_cmd_buf *cmd_buf = NULL;
 	u16 *indir_tbl = NULL;
@@ -1069,7 +1069,7 @@ int spnic_rss_get_indir_tbl(void *hwdev, u32 *indir_table)
 	return 0;
 }
 
-int spnic_rss_set_indir_tbl(void *hwdev, const u32 *indir_table)
+int spnic_rss_set_indir_tbl(struct spnic_hwdev *hwdev, const u32 *indir_table)
 {
 	struct nic_rss_indirect_tbl *indir_tbl = NULL;
 	struct spnic_cmd_buf *cmd_buf = NULL;
@@ -1111,7 +1111,7 @@ int spnic_rss_set_indir_tbl(void *hwdev, const u32 *indir_table)
 	return err;
 }
 
-int spnic_set_rss_type(void *hwdev, struct spnic_rss_type rss_type)
+int spnic_set_rss_type(struct spnic_hwdev *hwdev, struct spnic_rss_type rss_type)
 {
 	struct nic_rss_context_tbl *ctx_tbl = NULL;
 	struct spnic_cmd_buf *cmd_buf = NULL;
@@ -1158,7 +1158,7 @@ int spnic_set_rss_type(void *hwdev, struct spnic_rss_type rss_type)
 	return 0;
 }
 
-int spnic_get_rss_type(void *hwdev, struct spnic_rss_type *rss_type)
+int spnic_get_rss_type(struct spnic_hwdev *hwdev, struct spnic_rss_type *rss_type)
 {
 	struct spnic_rss_context_table ctx_tbl;
 	u16 out_size = sizeof(ctx_tbl);
@@ -1192,7 +1192,7 @@ int spnic_get_rss_type(void *hwdev, struct spnic_rss_type *rss_type)
 	return 0;
 }
 
-static int spnic_rss_cfg_hash_engine(void *hwdev, u8 opcode, u8 *type)
+static int spnic_rss_cfg_hash_engine(struct spnic_hwdev *hwdev, u8 opcode, u8 *type)
 {
 	struct spnic_cmd_rss_engine_type hash_type;
 	u16 out_size = sizeof(hash_type);
@@ -1224,7 +1224,7 @@ static int spnic_rss_cfg_hash_engine(void *hwdev, u8 opcode, u8 *type)
 	return 0;
 }
 
-int spnic_rss_get_hash_engine(void *hwdev, u8 *type)
+int spnic_rss_get_hash_engine(struct spnic_hwdev *hwdev, u8 *type)
 {
 	if (!hwdev || !type)
 		return -EINVAL;
@@ -1232,7 +1232,7 @@ int spnic_rss_get_hash_engine(void *hwdev, u8 *type)
 	return spnic_rss_cfg_hash_engine(hwdev, SPNIC_CMD_OP_GET, type);
 }
 
-int spnic_rss_set_hash_engine(void *hwdev, u8 type)
+int spnic_rss_set_hash_engine(struct spnic_hwdev *hwdev, u8 type)
 {
 	if (!hwdev)
 		return -EINVAL;
@@ -1240,7 +1240,7 @@ int spnic_rss_set_hash_engine(void *hwdev, u8 type)
 	return spnic_rss_cfg_hash_engine(hwdev, SPNIC_CMD_OP_SET, &type);
 }
 
-int spnic_rss_cfg(void *hwdev, u8 rss_en, u8 tc_num, u8 *prio_tc)
+int spnic_rss_cfg(struct spnic_hwdev *hwdev, u8 rss_en, u8 tc_num, u8 *prio_tc)
 {
 	struct spnic_cmd_rss_config rss_cfg;
 	u16 out_size = sizeof(rss_cfg);
@@ -1268,7 +1268,7 @@ int spnic_rss_cfg(void *hwdev, u8 rss_en, u8 tc_num, u8 *prio_tc)
 	return 0;
 }
 
-int spnic_vf_get_default_cos(void *hwdev, u8 *cos_id)
+int spnic_vf_get_default_cos(struct spnic_hwdev *hwdev, u8 *cos_id)
 {
 	struct spnic_cmd_vf_dcb_state vf_dcb;
 	u16 out_size = sizeof(vf_dcb);
@@ -1289,7 +1289,7 @@ int spnic_vf_get_default_cos(void *hwdev, u8 *cos_id)
 	return 0;
 }
 
-int spnic_set_rq_flush(void *hwdev, u16 q_id)
+int spnic_set_rq_flush(struct spnic_hwdev *hwdev, u16 q_id)
 {
 	struct spnic_cmd_set_rq_flush *rq_flush_msg = NULL;
 	struct spnic_cmd_buf *cmd_buf = NULL;
@@ -1322,7 +1322,7 @@ int spnic_set_rq_flush(void *hwdev, u16 q_id)
 	return err;
 }
 
-static int _mag_msg_to_mgmt_sync(void *hwdev, u16 cmd, void *buf_in,
+static int _mag_msg_to_mgmt_sync(struct spnic_hwdev *hwdev, u16 cmd, void *buf_in,
 				 u16 in_size, void *buf_out, u16 *out_size)
 {
 	u32 i, cmd_cnt = ARRAY_LEN(vf_mag_cmd_handler);
@@ -1340,7 +1340,7 @@ static int _mag_msg_to_mgmt_sync(void *hwdev, u16 cmd, void *buf_in,
 				      in_size, buf_out, out_size, 0);
 }
 
-static int mag_msg_to_mgmt_sync(void *hwdev, u16 cmd, void *buf_in, u16 in_size,
+static int mag_msg_to_mgmt_sync(struct spnic_hwdev *hwdev, u16 cmd, void *buf_in, u16 in_size,
 				void *buf_out, u16 *out_size)
 {
 	return _mag_msg_to_mgmt_sync(hwdev, cmd, buf_in, in_size, buf_out,
diff --git a/drivers/net/spnic/base/spnic_nic_cfg.h b/drivers/net/spnic/base/spnic_nic_cfg.h
index c73191dc81..9f83808839 100644
--- a/drivers/net/spnic/base/spnic_nic_cfg.h
+++ b/drivers/net/spnic/base/spnic_nic_cfg.h
@@ -577,10 +577,10 @@ struct spnic_cmd_set_rq_flush {
 	};
 };
 
-int spnic_l2nic_msg_to_mgmt_sync(void *hwdev, u16 cmd, void *buf_in, u16 in_size,
+int spnic_l2nic_msg_to_mgmt_sync(struct spnic_hwdev *hwdev, u16 cmd, void *buf_in, u16 in_size,
 			   void *buf_out, u16 *out_size);
 
-int spnic_set_ci_table(void *hwdev, struct spnic_sq_attr *attr);
+int spnic_set_ci_table(struct spnic_hwdev *hwdev, struct spnic_sq_attr *attr);
 
 /**
  * Update MAC address to hardware
@@ -599,7 +599,7 @@ int spnic_set_ci_table(void *hwdev, struct spnic_sq_attr *attr);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_update_mac(void *hwdev, u8 *old_mac, u8 *new_mac, u16 vlan_id,
+int spnic_update_mac(struct spnic_hwdev *hwdev, u8 *old_mac, u8 *new_mac, u16 vlan_id,
 		     u16 func_id);
 
 /**
@@ -615,7 +615,7 @@ int spnic_update_mac(void *hwdev, u8 *old_mac, u8 *new_mac, u16 vlan_id,
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_get_default_mac(void *hwdev, u8 *mac_addr, int ether_len);
+int spnic_get_default_mac(struct spnic_hwdev *hwdev, u8 *mac_addr, int ether_len);
 
 /**
  * Set mac address
@@ -632,7 +632,7 @@ int spnic_get_default_mac(void *hwdev, u8 *mac_addr, int ether_len);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_set_mac(void *hwdev, const u8 *mac_addr, u16 vlan_id, u16 func_id);
+int spnic_set_mac(struct spnic_hwdev *hwdev, const u8 *mac_addr, u16 vlan_id, u16 func_id);
 
 /**
  * Delete MAC address
@@ -649,7 +649,7 @@ int spnic_set_mac(void *hwdev, const u8 *mac_addr, u16 vlan_id, u16 func_id);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_del_mac(void *hwdev, const u8 *mac_addr, u16 vlan_id, u16 func_id);
+int spnic_del_mac(struct spnic_hwdev *hwdev, const u8 *mac_addr, u16 vlan_id, u16 func_id);
 
 /**
  * Set function mtu
@@ -662,7 +662,7 @@ int spnic_del_mac(void *hwdev, const u8 *mac_addr, u16 vlan_id, u16 func_id);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_set_port_mtu(void *hwdev, u16 new_mtu);
+int spnic_set_port_mtu(struct spnic_hwdev *hwdev, u16 new_mtu);
 
 /**
  * Set function valid status
@@ -675,7 +675,7 @@ int spnic_set_port_mtu(void *hwdev, u16 new_mtu);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_set_vport_enable(void *hwdev, bool enable);
+int spnic_set_vport_enable(struct spnic_hwdev *hwdev, bool enable);
 
 /**
  * Set port status
@@ -688,7 +688,7 @@ int spnic_set_vport_enable(void *hwdev, bool enable);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_set_port_enable(void *hwdev, bool enable);
+int spnic_set_port_enable(struct spnic_hwdev *hwdev, bool enable);
 
 /**
  * Get link state
@@ -701,7 +701,7 @@ int spnic_set_port_enable(void *hwdev, bool enable);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_get_link_state(void *hwdev, u8 *link_state);
+int spnic_get_link_state(struct spnic_hwdev *hwdev, u8 *link_state);
 
 /**
  * Flush queue pairs resource in hardware
@@ -712,7 +712,7 @@ int spnic_get_link_state(void *hwdev, u8 *link_state);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_flush_qps_res(void *hwdev);
+int spnic_flush_qps_res(struct spnic_hwdev *hwdev);
 
 /**
  * Set pause info
@@ -725,7 +725,7 @@ int spnic_flush_qps_res(void *hwdev);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_set_pause_info(void *hwdev, struct nic_pause_config nic_pause);
+int spnic_set_pause_info(struct spnic_hwdev *hwdev, struct nic_pause_config nic_pause);
 
 /**
  * Get pause info
@@ -738,7 +738,7 @@ int spnic_set_pause_info(void *hwdev, struct nic_pause_config nic_pause);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_get_pause_info(void *hwdev, struct nic_pause_config *nic_pause);
+int spnic_get_pause_info(struct spnic_hwdev *hwdev, struct nic_pause_config *nic_pause);
 
 /**
  * Get function stats
@@ -751,7 +751,7 @@ int spnic_get_pause_info(void *hwdev, struct nic_pause_config *nic_pause);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_get_vport_stats(void *hwdev, struct spnic_vport_stats *stats);
+int spnic_get_vport_stats(struct spnic_hwdev *hwdev, struct spnic_vport_stats *stats);
 
 /**
  * Get port stats
@@ -764,7 +764,7 @@ int spnic_get_vport_stats(void *hwdev, struct spnic_vport_stats *stats);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_get_phy_port_stats(void *hwdev, struct mag_phy_port_stats *stats);
+int spnic_get_phy_port_stats(struct spnic_hwdev *hwdev, struct mag_phy_port_stats *stats);
 
 /**
  * Clear function stats
@@ -777,7 +777,7 @@ int spnic_get_phy_port_stats(void *hwdev, struct mag_phy_port_stats *stats);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_clear_vport_stats(void *hwdev);
+int spnic_clear_vport_stats(struct spnic_hwdev *hwdev);
 
 /**
  * Clear port stats
@@ -790,7 +790,7 @@ int spnic_clear_vport_stats(void *hwdev);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_clear_phy_port_stats(void *hwdev);
+int spnic_clear_phy_port_stats(struct spnic_hwdev *hwdev);
 
 /**
  * Init nic hwdev
@@ -801,7 +801,7 @@ int spnic_clear_phy_port_stats(void *hwdev);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_init_nic_hwdev(void *hwdev);
+int spnic_init_nic_hwdev(struct spnic_hwdev *hwdev);
 
 /**
  * Free nic hwdev
@@ -809,7 +809,7 @@ int spnic_init_nic_hwdev(void *hwdev);
  * @param[in] hwdev
  *   Device pointer to hwdev
  */
-void spnic_free_nic_hwdev(void *hwdev);
+void spnic_free_nic_hwdev(struct spnic_hwdev *hwdev);
 
 /**
  * Set function rx mode
@@ -822,7 +822,7 @@ void spnic_free_nic_hwdev(void *hwdev);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_set_rx_mode(void *hwdev, u32 enable);
+int spnic_set_rx_mode(struct spnic_hwdev *hwdev, u32 enable);
 
 /**
  * Set function vlan offload valid state
@@ -835,7 +835,7 @@ int spnic_set_rx_mode(void *hwdev, u32 enable);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_set_rx_vlan_offload(void *hwdev, u8 en);
+int spnic_set_rx_vlan_offload(struct spnic_hwdev *hwdev, u8 en);
 
 /**
  * Set rx LRO configuration
@@ -852,7 +852,7 @@ int spnic_set_rx_vlan_offload(void *hwdev, u8 en);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_set_rx_lro_state(void *hwdev, u8 lro_en, u32 lro_timer,
+int spnic_set_rx_lro_state(struct spnic_hwdev *hwdev, u8 lro_en, u32 lro_timer,
 			   u32 lro_max_pkt_len);
 
 /**
@@ -866,9 +866,9 @@ int spnic_set_rx_lro_state(void *hwdev, u8 lro_en, u32 lro_timer,
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_get_port_info(void *hwdev, struct nic_port_info *port_info);
+int spnic_get_port_info(struct spnic_hwdev *hwdev, struct nic_port_info *port_info);
 
-int spnic_init_function_table(void *hwdev, u16 rx_buff_len);
+int spnic_init_function_table(struct spnic_hwdev *hwdev, u16 rx_buff_len);
 
 /**
  * Alloc RSS template table
@@ -879,7 +879,7 @@ int spnic_init_function_table(void *hwdev, u16 rx_buff_len);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_rss_template_alloc(void *hwdev);
+int spnic_rss_template_alloc(struct spnic_hwdev *hwdev);
 
 /**
  * Free RSS template table
@@ -890,7 +890,7 @@ int spnic_rss_template_alloc(void *hwdev);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_rss_template_free(void *hwdev);
+int spnic_rss_template_free(struct spnic_hwdev *hwdev);
 
 /**
  * Set RSS indirect table
@@ -903,7 +903,7 @@ int spnic_rss_template_free(void *hwdev);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_rss_set_indir_tbl(void *hwdev, const u32 *indir_table);
+int spnic_rss_set_indir_tbl(struct spnic_hwdev *hwdev, const u32 *indir_table);
 
 /**
  * Get RSS indirect table
@@ -916,7 +916,7 @@ int spnic_rss_set_indir_tbl(void *hwdev, const u32 *indir_table);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_rss_get_indir_tbl(void *hwdev, u32 *indir_table);
+int spnic_rss_get_indir_tbl(struct spnic_hwdev *hwdev, u32 *indir_table);
 
 /**
  * Set RSS type
@@ -929,7 +929,7 @@ int spnic_rss_get_indir_tbl(void *hwdev, u32 *indir_table);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_set_rss_type(void *hwdev, struct spnic_rss_type rss_type);
+int spnic_set_rss_type(struct spnic_hwdev *hwdev, struct spnic_rss_type rss_type);
 
 /**
  * Get RSS type
@@ -942,7 +942,7 @@ int spnic_set_rss_type(void *hwdev, struct spnic_rss_type rss_type);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_get_rss_type(void *hwdev, struct spnic_rss_type *rss_type);
+int spnic_get_rss_type(struct spnic_hwdev *hwdev, struct spnic_rss_type *rss_type);
 
 /**
  * Get RSS hash engine
@@ -955,7 +955,7 @@ int spnic_get_rss_type(void *hwdev, struct spnic_rss_type *rss_type);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_rss_get_hash_engine(void *hwdev, u8 *type);
+int spnic_rss_get_hash_engine(struct spnic_hwdev *hwdev, u8 *type);
 
 /**
  * Set RSS hash engine
@@ -968,7 +968,7 @@ int spnic_rss_get_hash_engine(void *hwdev, u8 *type);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_rss_set_hash_engine(void *hwdev, u8 type);
+int spnic_rss_set_hash_engine(struct spnic_hwdev *hwdev, u8 type);
 
 /**
  * Set RSS configuration
@@ -985,7 +985,7 @@ int spnic_rss_set_hash_engine(void *hwdev, u8 type);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_rss_cfg(void *hwdev, u8 rss_en, u8 tc_num, u8 *prio_tc);
+int spnic_rss_cfg(struct spnic_hwdev *hwdev, u8 rss_en, u8 tc_num, u8 *prio_tc);
 
 /**
  * Set RSS hash key
@@ -998,7 +998,7 @@ int spnic_rss_cfg(void *hwdev, u8 rss_en, u8 tc_num, u8 *prio_tc);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_rss_set_hash_key(void *hwdev, u8 *key);
+int spnic_rss_set_hash_key(struct spnic_hwdev *hwdev, u8 *key);
 
 /**
  * Get RSS hash key
@@ -1011,7 +1011,7 @@ int spnic_rss_set_hash_key(void *hwdev, u8 *key);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_rss_get_hash_key(void *hwdev, u8 *key);
+int spnic_rss_get_hash_key(struct spnic_hwdev *hwdev, u8 *key);
 
 /**
  * Add vlan to hardware
@@ -1026,7 +1026,7 @@ int spnic_rss_get_hash_key(void *hwdev, u8 *key);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_add_vlan(void *hwdev, u16 vlan_id, u16 func_id);
+int spnic_add_vlan(struct spnic_hwdev *hwdev, u16 vlan_id, u16 func_id);
 
 /**
  * Delete vlan
@@ -1041,7 +1041,7 @@ int spnic_add_vlan(void *hwdev, u16 vlan_id, u16 func_id);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_del_vlan(void *hwdev, u16 vlan_id, u16 func_id);
+int spnic_del_vlan(struct spnic_hwdev *hwdev, u16 vlan_id, u16 func_id);
 
 /**
  * Set vlan filter
@@ -1054,7 +1054,7 @@ int spnic_del_vlan(void *hwdev, u16 vlan_id, u16 func_id);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_set_vlan_fliter(void *hwdev, u32 vlan_filter_ctrl);
+int spnic_set_vlan_fliter(struct spnic_hwdev *hwdev, u32 vlan_filter_ctrl);
 
 /**
  * Get VF function default cos
@@ -1067,7 +1067,7 @@ int spnic_set_vlan_fliter(void *hwdev, u32 vlan_filter_ctrl);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_vf_get_default_cos(void *hwdev, u8 *cos_id);
+int spnic_vf_get_default_cos(struct spnic_hwdev *hwdev, u8 *cos_id);
 
 /**
  * Flush rx queue resource
@@ -1080,7 +1080,7 @@ int spnic_vf_get_default_cos(void *hwdev, u8 *cos_id);
  * @retval zero : Success
  * @retval non-zero : Failure
  */
-int spnic_set_rq_flush(void *hwdev, u16 q_id);
+int spnic_set_rq_flush(struct spnic_hwdev *hwdev, u16 q_id);
 
 /**
  * Get service feature HW supported
@@ -1094,7 +1094,7 @@ int spnic_set_rq_flush(void *hwdev, u16 q_id);
  * @retval zero: Success
  * @retval non-zero: Failure
  */
-int spnic_get_feature_from_hw(void *hwdev, u64 *s_feature, u16 size);
+int spnic_get_feature_from_hw(struct spnic_hwdev *hwdev, u64 *s_feature, u16 size);
 
 /**
  * Set service feature driver supported to hardware
@@ -1105,6 +1105,6 @@ int spnic_get_feature_from_hw(void *hwdev, u64 *s_feature, u16 size);
  * @retval zero: Success
  * @retval non-zero: Failure
  */
-int spnic_set_feature_to_hw(void *hwdev, u64 *s_feature, u16 size);
+int spnic_set_feature_to_hw(struct spnic_hwdev *hwdev, u64 *s_feature, u16 size);
 
 #endif /* _SPNIC_NIC_CFG_H_ */
diff --git a/drivers/net/spnic/base/spnic_nic_event.c b/drivers/net/spnic/base/spnic_nic_event.c
index 1a8f723a77..9c3d76ce57 100644
--- a/drivers/net/spnic/base/spnic_nic_event.c
+++ b/drivers/net/spnic/base/spnic_nic_event.c
@@ -6,10 +6,10 @@
 
 #include "spnic_compat.h"
 #include "spnic_cmd.h"
-#include "spnic_hwif.h"
 #include "spnic_hwdev.h"
 #include "spnic_mgmt.h"
 #include "spnic_nic_cfg.h"
+#include "spnic_hwif.h"
 #include "spnic_hwdev.h"
 #include "spnic_nic_event.h"
 
@@ -45,9 +45,8 @@ void spnic_get_port_link_info(struct spnic_hwdev *hwdev, u8 link_state,
 	}
 }
 
-static void spnic_link_event_stats(void *dev, u8 link)
+static void spnic_link_event_stats(struct spnic_hwdev *hwdev, u8 link)
 {
-	struct spnic_hwdev *hwdev = dev;
 	struct link_event_stats *stats = &hwdev->hw_stats.link_event_stats;
 
 	if (link)
@@ -56,14 +55,13 @@ static void spnic_link_event_stats(void *dev, u8 link)
 		__atomic_fetch_add(&stats->link_down_stats, 1, __ATOMIC_RELAXED);
 }
 
-static void link_status_event_handler(void *hwdev, void *buf_in,
+static void link_status_event_handler(struct spnic_hwdev *hwdev, void *buf_in,
 				      __rte_unused u16 in_size,
 				      __rte_unused void *buf_out,
 				      __rte_unused u16 *out_size)
 {
 	struct spnic_cmd_link_state *link_status = NULL;
 	struct rte_eth_link link;
-	struct spnic_hwdev *dev = hwdev;
 	int err;
 
 	link_status = buf_in;
@@ -74,24 +72,24 @@ static void link_status_event_handler(void *hwdev, void *buf_in,
 	spnic_link_event_stats(hwdev, link_status->state);
 
 	/* Link event reported only after set vport enable */
-	spnic_get_port_link_info(dev, link_status->state, &link);
-	err = rte_eth_linkstatus_set((struct rte_eth_dev *)(dev->eth_dev),
+	spnic_get_port_link_info(hwdev, link_status->state, &link);
+	err = rte_eth_linkstatus_set((struct rte_eth_dev *)(hwdev->eth_dev),
 				     &link);
 	if (!err)
-		rte_eth_dev_callback_process(dev->eth_dev,
+		rte_eth_dev_callback_process(hwdev->eth_dev,
 					      RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
 struct nic_event_handler {
 	u16 cmd;
-	void (*handler)(void *hwdev, void *buf_in, u16 in_size,
+	void (*handler)(struct spnic_hwdev *hwdev, void *buf_in, u16 in_size,
 			void *buf_out, u16 *out_size);
 };
 
 struct nic_event_handler nic_cmd_handler[] = {
 };
 
-static void nic_event_handler(void *hwdev, u16 cmd, void *buf_in, u16 in_size,
+static void nic_event_handler(struct spnic_hwdev *hwdev, u16 cmd, void *buf_in, u16 in_size,
 			      void *buf_out, u16 *out_size)
 {
 	u32 i, size = ARRAY_LEN(nic_cmd_handler);
@@ -119,7 +117,7 @@ static void nic_event_handler(void *hwdev, u16 cmd, void *buf_in, u16 in_size,
  * VF link change event
  * VF fault report event
  */
-int spnic_vf_event_handler(void *hwdev, __rte_unused void *pri_handle,
+int spnic_vf_event_handler(struct spnic_hwdev *hwdev, __rte_unused void *pri_handle,
 			   u16 cmd, void *buf_in, u16 in_size,
 			   void *buf_out, u16 *out_size)
 {
@@ -128,7 +126,7 @@ int spnic_vf_event_handler(void *hwdev, __rte_unused void *pri_handle,
 }
 
 /*  NIC event of PF/PPF handler reported by mgmt cpu */
-void spnic_pf_event_handler(void *hwdev, __rte_unused void *pri_handle,
+void spnic_pf_event_handler(struct spnic_hwdev *hwdev, __rte_unused void *pri_handle,
 			    u16 cmd, void *buf_in, u16 in_size,
 			    void *buf_out, u16 *out_size)
 {
@@ -142,7 +140,7 @@ static struct nic_event_handler mag_cmd_handler[] = {
 	},
 };
 
-static int spnic_mag_event_handler(void *hwdev, u16 cmd, void *buf_in,
+static int spnic_mag_event_handler(struct spnic_hwdev *hwdev, u16 cmd, void *buf_in,
 				   u16 in_size, void *buf_out,
 				   u16 *out_size)
 {
@@ -168,14 +166,14 @@ static int spnic_mag_event_handler(void *hwdev, u16 cmd, void *buf_in,
 	return 0;
 }
 
-int spnic_vf_mag_event_handler(void *hwdev, u16 cmd, void *buf_in, u16 in_size, void *buf_out,
-			       u16 *out_size)
+int spnic_vf_mag_event_handler(struct spnic_hwdev *hwdev, u16 cmd, void *buf_in,
+			       u16 in_size, void *buf_out, u16 *out_size)
 {
 	return spnic_mag_event_handler(hwdev, cmd, buf_in, in_size, buf_out,
 				       out_size);
 }
 
-u8 spnic_nic_sw_aeqe_handler(__rte_unused void *hwdev, u8 event, u8 *data)
+u8 spnic_nic_sw_aeqe_handler(__rte_unused struct spnic_hwdev *hwdev, u8 event, u8 *data)
 {
 	PMD_DRV_LOG(ERR,
 		    "Received nic ucode aeq event type: 0x%x, data: %" PRIu64 "",
diff --git a/drivers/net/spnic/base/spnic_nic_event.h b/drivers/net/spnic/base/spnic_nic_event.h
index 89d09a2b24..4859481be1 100644
--- a/drivers/net/spnic/base/spnic_nic_event.h
+++ b/drivers/net/spnic/base/spnic_nic_event.h
@@ -8,17 +8,17 @@
 void spnic_get_port_link_info(struct spnic_hwdev *hwdev, u8 link_state,
 		   struct rte_eth_link *link);
 
-void spnic_pf_event_handler(void *hwdev, __rte_unused void *pri_handle,
+void spnic_pf_event_handler(struct spnic_hwdev *hwdev, __rte_unused void *pri_handle,
 			    u16 cmd, void *buf_in, u16 in_size,
 			    void *buf_out, u16 *out_size);
 
-int spnic_vf_event_handler(void *hwdev, __rte_unused void *pri_handle,
+int spnic_vf_event_handler(struct spnic_hwdev *hwdev, __rte_unused void *pri_handle,
 			   u16 cmd, void *buf_in, u16 in_size,
 			   void *buf_out, u16 *out_size);
 
-int spnic_vf_mag_event_handler(void *hwdev, u16 cmd, void *buf_in, u16 in_size, void *buf_out,
-			       u16 *out_size);
+int spnic_vf_mag_event_handler(struct spnic_hwdev *hwdev, u16 cmd, void *buf_in,
+			       u16 in_size, void *buf_out, u16 *out_size);
 
-u8 spnic_nic_sw_aeqe_handler(__rte_unused void *hwdev, u8 event, u8 *data);
+u8 spnic_nic_sw_aeqe_handler(__rte_unused struct spnic_hwdev *hwdev, u8 event, u8 *data);
 
 #endif /* _SPNIC_NIC_EVENT_H_ */
diff --git a/drivers/net/spnic/base/spnic_wq.c b/drivers/net/spnic/base/spnic_wq.c
index fced7eb0ab..1aac74566f 100644
--- a/drivers/net/spnic/base/spnic_wq.c
+++ b/drivers/net/spnic/base/spnic_wq.c
@@ -67,10 +67,9 @@ void *spnic_read_wqe(struct spnic_wq *wq, int num_wqebbs, u16 *cons_idx)
 	return WQ_WQE_ADDR(wq, (u32)(*cons_idx));
 }
 
-int spnic_cmdq_alloc(struct spnic_wq *wq, void *dev, int cmdq_blocks,
+int spnic_cmdq_alloc(struct spnic_wq *wq, struct spnic_hwdev *hwdev, int cmdq_blocks,
 		     u32 wq_buf_size, u32 wqebb_shift, u16 q_depth)
 {
-	struct spnic_hwdev *hwdev = (struct spnic_hwdev *)dev;
 	int i, j;
 	int err;
 
diff --git a/drivers/net/spnic/base/spnic_wq.h b/drivers/net/spnic/base/spnic_wq.h
index 19f604a79e..b8fbf9886d 100644
--- a/drivers/net/spnic/base/spnic_wq.h
+++ b/drivers/net/spnic/base/spnic_wq.h
@@ -107,7 +107,7 @@ struct spnic_wq {
 
 void spnic_wq_wqe_pg_clear(struct spnic_wq *wq);
 
-int spnic_cmdq_alloc(struct spnic_wq *wq, void *dev, int cmdq_blocks,
+int spnic_cmdq_alloc(struct spnic_wq *wq, struct spnic_hwdev *hwdev, int cmdq_blocks,
 		      u32 wq_buf_size, u32 wqebb_shift, u16 q_depth);
 
 void spnic_cmdq_free(struct spnic_wq *wq, int cmdq_blocks);
diff --git a/drivers/net/spnic/spnic_ethdev.c b/drivers/net/spnic/spnic_ethdev.c
index 035ad0d1e7..dcc5bce9b7 100644
--- a/drivers/net/spnic/spnic_ethdev.c
+++ b/drivers/net/spnic/spnic_ethdev.c
@@ -15,20 +15,20 @@
 #include "base/spnic_compat.h"
 #include "base/spnic_cmd.h"
 #include "base/spnic_csr.h"
+#include "base/spnic_hwdev.h"
 #include "base/spnic_wq.h"
 #include "base/spnic_eqs.h"
 #include "base/spnic_mgmt.h"
 #include "base/spnic_cmdq.h"
-#include "base/spnic_hwdev.h"
 #include "base/spnic_hwif.h"
 #include "base/spnic_hw_cfg.h"
 #include "base/spnic_hw_comm.h"
 #include "base/spnic_nic_cfg.h"
 #include "base/spnic_nic_event.h"
+#include "spnic_ethdev.h"
 #include "spnic_io.h"
 #include "spnic_tx.h"
 #include "spnic_rx.h"
-#include "spnic_ethdev.h"
 
 #define SPNIC_MIN_RX_BUF_SIZE		1024
 
@@ -1252,7 +1252,7 @@ static void spnic_enable_interrupt(struct rte_eth_dev *dev)
 #define SPNIC_TXRX_MSIX_COALESC_TIMER       2
 #define SPNIC_TXRX_MSIX_RESEND_TIMER_CFG    7
 
-static int spnic_init_rxq_msix_attr(void *hwdev, u16 msix_index)
+static int spnic_init_rxq_msix_attr(struct spnic_hwdev *hwdev, u16 msix_index)
 {
 	struct interrupt_info info = { 0 };
 	int err;
@@ -1400,9 +1400,9 @@ static int spnic_dev_start(struct rte_eth_dev *eth_dev)
 		goto init_func_tbl_fail;
 	}
 
-	nic_features = spnic_get_driver_feature(nic_dev->hwdev);
+	nic_features = spnic_get_driver_feature(nic_dev);
 	nic_features &= DEFAULT_DRV_FEATURE;
-	spnic_update_driver_feature(nic_dev->hwdev, nic_features);
+	spnic_update_driver_feature(nic_dev, nic_features);
 
 	err = spnic_set_feature_to_hw(nic_dev->hwdev, &nic_dev->feature_cap, 1);
 	if (err) {
diff --git a/drivers/net/spnic/spnic_io.c b/drivers/net/spnic/spnic_io.c
index 3603d83e5f..b0866774dc 100644
--- a/drivers/net/spnic/spnic_io.c
+++ b/drivers/net/spnic/spnic_io.c
@@ -17,17 +17,17 @@
 
 #include "base/spnic_compat.h"
 #include "base/spnic_cmd.h"
-#include "base/spnic_wq.h"
 #include "base/spnic_mgmt.h"
-#include "base/spnic_cmdq.h"
 #include "base/spnic_hwdev.h"
+#include "base/spnic_wq.h"
+#include "base/spnic_cmdq.h"
 #include "base/spnic_hw_comm.h"
 #include "base/spnic_nic_cfg.h"
 #include "base/spnic_hw_cfg.h"
-#include "spnic_io.h"
 #include "spnic_tx.h"
-#include "spnic_rx.h"
 #include "spnic_ethdev.h"
+#include "spnic_io.h"
+#include "spnic_rx.h"
 
 #define SPNIC_DEAULT_TX_CI_PENDING_LIMIT	0
 #define SPNIC_DEAULT_TX_CI_COALESCING_TIME	0
@@ -616,9 +616,8 @@ static int clean_qp_offload_ctxt(struct spnic_nic_dev *nic_dev)
 		clean_queue_offload_ctxt(nic_dev, SPNIC_QP_CTXT_TYPE_RQ));
 }
 
-void spnic_get_func_rx_buf_size(void *dev)
+void spnic_get_func_rx_buf_size(struct spnic_nic_dev *nic_dev)
 {
-	struct spnic_nic_dev *nic_dev = (struct spnic_nic_dev *)dev;
 	struct spnic_rxq *rxq = NULL;
 	u16 q_id;
 	u16 buf_size = 0;
@@ -639,19 +638,17 @@ void spnic_get_func_rx_buf_size(void *dev)
 }
 
 /* Init qps ctxt and set sq ci attr and arm all sq */
-int spnic_init_qp_ctxts(void *dev)
+int spnic_init_qp_ctxts(struct spnic_nic_dev *nic_dev)
 {
-	struct spnic_nic_dev *nic_dev = NULL;
 	struct spnic_hwdev *hwdev = NULL;
 	struct spnic_sq_attr sq_attr;
 	u32 rq_depth;
 	u16 q_id;
 	int err;
 
-	if (!dev)
+	if (!nic_dev)
 		return -EINVAL;
 
-	nic_dev = (struct spnic_nic_dev *)dev;
 	hwdev = nic_dev->hwdev;
 
 	err = init_sq_ctxts(nic_dev);
@@ -703,7 +700,7 @@ int spnic_init_qp_ctxts(void *dev)
 	return err;
 }
 
-void spnic_free_qp_ctxts(void *hwdev)
+void spnic_free_qp_ctxts(struct spnic_hwdev *hwdev)
 {
 	if (!hwdev)
 		return;
@@ -711,28 +708,21 @@ void spnic_free_qp_ctxts(void *hwdev)
 	spnic_clean_root_ctxt(hwdev);
 }
 
-void spnic_update_driver_feature(void *dev, u64 s_feature)
+void spnic_update_driver_feature(struct spnic_nic_dev *nic_dev, u64 s_feature)
 {
-	struct spnic_nic_dev *nic_dev = NULL;
-
-	if (!dev)
+	if (!nic_dev)
 		return;
 
-	nic_dev = (struct spnic_nic_dev *)dev;
 	nic_dev->feature_cap = s_feature;
 
 	PMD_DRV_LOG(INFO, "Update nic feature to %" PRIu64 "\n",
 		    nic_dev->feature_cap);
 }
 
-u64 spnic_get_driver_feature(void *dev)
+u64 spnic_get_driver_feature(struct spnic_nic_dev *nic_dev)
 {
-	struct spnic_nic_dev *nic_dev = NULL;
-
-	if (!dev)
+	if (!nic_dev)
 		return -EINVAL;
 
-	nic_dev = (struct spnic_nic_dev *)dev;
-
 	return nic_dev->feature_cap;
 }
diff --git a/drivers/net/spnic/spnic_io.h b/drivers/net/spnic/spnic_io.h
index ccb8044481..6e4062d712 100644
--- a/drivers/net/spnic/spnic_io.h
+++ b/drivers/net/spnic/spnic_io.h
@@ -107,7 +107,7 @@ static inline void spnic_write_db(void *db_addr, u16 q_id, int cos, u8 cflag,
 	rte_write64(*((u64 *)&db), DB_ADDR(db_addr, pi));
 }
 
-void spnic_get_func_rx_buf_size(void *dev);
+void spnic_get_func_rx_buf_size(struct spnic_nic_dev *nic_dev);
 
 /**
  * Init queue pair context
@@ -118,7 +118,7 @@ void spnic_get_func_rx_buf_size(void *dev);
  * @retval zero: Success
  * @retval non-zero: Failure
  */
-int spnic_init_qp_ctxts(void *dev);
+int spnic_init_qp_ctxts(struct spnic_nic_dev *nic_dev);
 
 /**
  * Free queue pair context
@@ -126,7 +126,7 @@ int spnic_init_qp_ctxts(void *dev);
  * @param[in] hwdev
  *   Device pointer to hwdev
  */
-void spnic_free_qp_ctxts(void *hwdev);
+void spnic_free_qp_ctxts(struct spnic_hwdev *hwdev);
 
 /**
  * Update service feature driver supported
@@ -138,7 +138,7 @@ void spnic_free_qp_ctxts(void *hwdev);
  * @retval zero: Success
  * @retval non-zero: Failure
  */
-void spnic_update_driver_feature(void *dev, u64 s_feature);
+void spnic_update_driver_feature(struct spnic_nic_dev *nic_dev, u64 s_feature);
 
 /**
  * Get service feature driver supported
@@ -150,5 +150,5 @@ void spnic_update_driver_feature(void *dev, u64 s_feature);
  * @retval zero: Success
  * @retval non-zero: Failure
  */
-u64 spnic_get_driver_feature(void *dev);
+u64 spnic_get_driver_feature(struct spnic_nic_dev *nic_dev);
 #endif /* _SPNIC_IO_H_ */
diff --git a/drivers/net/spnic/spnic_rx.c b/drivers/net/spnic/spnic_rx.c
index 8d307ef7a0..692dc18146 100644
--- a/drivers/net/spnic/spnic_rx.c
+++ b/drivers/net/spnic/spnic_rx.c
@@ -8,14 +8,14 @@
 
 #include "base/spnic_compat.h"
 #include "base/spnic_cmd.h"
-#include "base/spnic_hwif.h"
 #include "base/spnic_hwdev.h"
+#include "base/spnic_hwif.h"
 #include "base/spnic_wq.h"
 #include "base/spnic_mgmt.h"
 #include "base/spnic_nic_cfg.h"
+#include "spnic_ethdev.h"
 #include "spnic_io.h"
 #include "spnic_rx.h"
-#include "spnic_ethdev.h"
 
 /**
  * Get receive queue wqe
diff --git a/drivers/net/spnic/spnic_tx.c b/drivers/net/spnic/spnic_tx.c
index f893d6cb26..b3361a0178 100644
--- a/drivers/net/spnic/spnic_tx.c
+++ b/drivers/net/spnic/spnic_tx.c
@@ -9,13 +9,13 @@
 
 #include "base/spnic_compat.h"
 #include "base/spnic_cmd.h"
+#include "base/spnic_hwdev.h"
 #include "base/spnic_wq.h"
 #include "base/spnic_mgmt.h"
-#include "base/spnic_hwdev.h"
 #include "base/spnic_nic_cfg.h"
-#include "spnic_io.h"
 #include "spnic_tx.h"
 #include "spnic_ethdev.h"
+#include "spnic_io.h"
 
 #define SPNIC_TX_TASK_WRAPPED		1
 #define SPNIC_TX_BD_DESC_WRAPPED	2
-- 
2.32.0


  parent reply	other threads:[~2021-12-30  6:12 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-30  6:08 [PATCH v6 00/26] Net/SPNIC: support SPNIC into DPDK 22.03 Yanling Song
2021-12-30  6:08 ` [PATCH v6 01/26] drivers/net: introduce a new PMD driver Yanling Song
2022-01-19 16:58   ` Ferruh Yigit
2021-12-30  6:08 ` [PATCH v6 02/26] net/spnic: initialize the HW interface Yanling Song
2022-01-19 17:05   ` Ferruh Yigit
2022-01-21  9:32     ` Yanling Song
2021-12-30  6:08 ` [PATCH v6 03/26] net/spnic: add mbox message channel Yanling Song
2021-12-30  6:08 ` [PATCH v6 04/26] net/spnic: introduce event queue Yanling Song
2021-12-30  6:08 ` [PATCH v6 05/26] net/spnic: add mgmt module Yanling Song
2022-01-19 17:22   ` Ferruh Yigit
2022-01-21  9:33     ` Yanling Song
2021-12-30  6:08 ` [PATCH v6 06/26] net/spnic: add cmdq and work queue Yanling Song
2021-12-30  6:08 ` [PATCH v6 07/26] net/spnic: add interface handling cmdq message Yanling Song
2021-12-30  6:08 ` [PATCH v6 08/26] net/spnic: add hardware info initialization Yanling Song
2021-12-30  6:08 ` [PATCH v6 09/26] net/spnic: support MAC and link event handling Yanling Song
2022-01-19 17:26   ` Ferruh Yigit
2022-01-21  9:36     ` Yanling Song
2021-12-30  6:08 ` [PATCH v6 10/26] net/spnic: add function info initialization Yanling Song
2021-12-30  6:08 ` [PATCH v6 11/26] net/spnic: add queue pairs context initialization Yanling Song
2021-12-30  6:08 ` [PATCH v6 12/26] net/spnic: support mbuf handling of Tx/Rx Yanling Song
2021-12-30  6:08 ` [PATCH v6 13/26] net/spnic: support Rx congfiguration Yanling Song
2021-12-30  6:08 ` [PATCH v6 14/26] net/spnic: add port/vport enable Yanling Song
2021-12-30  6:08 ` [PATCH v6 15/26] net/spnic: support IO packets handling Yanling Song
2021-12-30  6:08 ` [PATCH v6 16/26] net/spnic: add device configure/version/info Yanling Song
2021-12-30  6:08 ` [PATCH v6 17/26] net/spnic: support RSS configuration update and get Yanling Song
2021-12-30  6:08 ` [PATCH v6 18/26] net/spnic: support VLAN filtering and offloading Yanling Song
2021-12-30  6:08 ` [PATCH v6 19/26] net/spnic: support promiscuous and allmulticast Rx modes Yanling Song
2021-12-30  6:08 ` [PATCH v6 20/26] net/spnic: support flow control Yanling Song
2021-12-30  6:08 ` [PATCH v6 21/26] net/spnic: support getting Tx/Rx queues info Yanling Song
2021-12-30  6:09 ` [PATCH v6 22/26] net/spnic: net/spnic: support xstats statistics Yanling Song
2021-12-30  6:09 ` [PATCH v6 23/26] net/spnic: support VFIO interrupt Yanling Song
2021-12-30  6:09 ` [PATCH v6 24/26] net/spnic: support Tx/Rx queue start/stop Yanling Song
2021-12-30  6:09 ` [PATCH v6 25/26] net/spnic: add doc infrastructure Yanling Song
2022-01-19 17:27   ` Ferruh Yigit
2022-01-21  9:39     ` Yanling Song
2021-12-30  6:09 ` Yanling Song [this message]
2022-01-19 17:28   ` [PATCH v6 26/26] net/spnic: fixes unsafe C style code Ferruh Yigit
2022-01-21  9:40     ` Yanling Song
2022-01-19 16:56 ` [PATCH v6 00/26] Net/SPNIC: support SPNIC into DPDK 22.03 Ferruh Yigit
2022-01-21  9:27   ` Yanling Song
2022-01-21 10:22     ` Ferruh Yigit
2022-01-24  5:12       ` Hemant Agrawal
2022-02-12 14:01       ` Yanling Song
2022-02-13 18:07         ` Thomas Monjalon
2022-02-18  9:30           ` Yanling Song
2023-04-13  9:02             ` Ferruh Yigit
2023-07-31 14:08               ` Thomas Monjalon
2022-02-16 14:19         ` 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=d47e28231b651c7139b656089a08df02a226eb2f.1640838702.git.songyl@ramaxel.com \
    --to=songyl@ramaxel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=lihuisong@huawei.com \
    --cc=stephen@networkplumber.org \
    --cc=xuyun@ramaxel.com \
    --cc=yanggan@ramaxel.com \
    --cc=yanling.song@linux.dev \
    /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).