diff mbox series

[v2,4/6] bnxt_en: Use direct API instead of indirection

Message ID 20221025173110.33192-5-ajit.khaparde@broadcom.com (mailing list archive)
State Superseded
Headers show
Series [v2,1/6] bnxt_en: Add auxiliary driver support | expand

Commit Message

Ajit Khaparde Oct. 25, 2022, 5:31 p.m. UTC
For a single ULP user there is no need for complicating function
indirection calls. Remove all this complexity in favour of direct
function calls exported by the bnxt_en driver. This allows to
simplify the code greatly.

Suggested-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/infiniband/hw/bnxt_re/main.c          | 71 +++++--------------
 drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 64 +++++------------
 drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | 24 +++----
 3 files changed, 43 insertions(+), 116 deletions(-)

Comments

kernel test robot Oct. 27, 2022, 5:56 p.m. UTC | #1
Hi Ajit,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.1-rc2 next-20221027]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ajit-Khaparde/bnxt_en-Add-auxiliary-driver-support/20221026-023141
patch link:    https://lore.kernel.org/r/20221025173110.33192-5-ajit.khaparde%40broadcom.com
patch subject: [PATCH v2 4/6] bnxt_en: Use direct API instead of indirection
config: alpha-randconfig-s043-20221027
compiler: alpha-linux-gcc (GCC) 12.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://github.com/intel-lab-lkp/linux/commit/8a686d1e144cadf339178010e72fa69287954a6a
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Ajit-Khaparde/bnxt_en-Add-auxiliary-driver-support/20221026-023141
        git checkout 8a686d1e144cadf339178010e72fa69287954a6a
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=alpha SHELL=/bin/bash drivers/net/ethernet/broadcom/bnxt/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:51:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
>> drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:51:9: sparse:    struct bnxt_ulp_ops [noderef] __rcu *
>> drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:51:9: sparse:    struct bnxt_ulp_ops *
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:282:15: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:282:15: sparse:    struct bnxt_ulp_ops [noderef] __rcu *
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:282:15: sparse:    struct bnxt_ulp_ops *
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:303:15: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:303:15: sparse:    struct bnxt_ulp_ops [noderef] __rcu *
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:303:15: sparse:    struct bnxt_ulp_ops *
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:318:15: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:318:15: sparse:    struct bnxt_ulp_ops [noderef] __rcu *
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:318:15: sparse:    struct bnxt_ulp_ops *
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:341:23: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:341:23: sparse:    struct bnxt_ulp_ops [noderef] __rcu *
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:341:23: sparse:    struct bnxt_ulp_ops *
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:363:23: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:363:23: sparse:    struct bnxt_ulp_ops [noderef] __rcu *
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:363:23: sparse:    struct bnxt_ulp_ops *
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:391:15: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:391:15: sparse:    struct bnxt_ulp_ops [noderef] __rcu *
   drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c:391:15: sparse:    struct bnxt_ulp_ops *

vim +51 drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c

ad26653f2a74a0 Ajit Khaparde 2022-10-25  30  
8a686d1e144cad Ajit Khaparde 2022-10-25  31  int bnxt_register_dev(struct bnxt_en_dev *edev,
92c7d0e64af8a4 Ajit Khaparde 2022-10-25  32  		      struct bnxt_ulp_ops *ulp_ops,
92c7d0e64af8a4 Ajit Khaparde 2022-10-25  33  		      void *handle)
a588e4580a7ecb Michael Chan  2016-12-07  34  {
a588e4580a7ecb Michael Chan  2016-12-07  35  	struct net_device *dev = edev->net;
a588e4580a7ecb Michael Chan  2016-12-07  36  	struct bnxt *bp = netdev_priv(dev);
a588e4580a7ecb Michael Chan  2016-12-07  37  	unsigned int max_stat_ctxs;
92c7d0e64af8a4 Ajit Khaparde 2022-10-25  38  	struct bnxt_ulp *ulp;
a588e4580a7ecb Michael Chan  2016-12-07  39  
a588e4580a7ecb Michael Chan  2016-12-07  40  	max_stat_ctxs = bnxt_get_max_func_stat_ctxs(bp);
a588e4580a7ecb Michael Chan  2016-12-07  41  	if (max_stat_ctxs <= BNXT_MIN_ROCE_STAT_CTXS ||
92c7d0e64af8a4 Ajit Khaparde 2022-10-25  42  	    bp->cp_nr_rings == max_stat_ctxs)
92c7d0e64af8a4 Ajit Khaparde 2022-10-25  43  		return -ENOMEM;
92c7d0e64af8a4 Ajit Khaparde 2022-10-25  44  
92c7d0e64af8a4 Ajit Khaparde 2022-10-25  45  	ulp = kzalloc(sizeof(*ulp), GFP_KERNEL);
92c7d0e64af8a4 Ajit Khaparde 2022-10-25  46  	if (!ulp)
92c7d0e64af8a4 Ajit Khaparde 2022-10-25  47  		return -ENOMEM;
a588e4580a7ecb Michael Chan  2016-12-07  48  
92c7d0e64af8a4 Ajit Khaparde 2022-10-25  49  	edev->ulp_tbl = ulp;
a588e4580a7ecb Michael Chan  2016-12-07  50  	ulp->handle = handle;
a588e4580a7ecb Michael Chan  2016-12-07 @51  	rcu_assign_pointer(ulp->ulp_ops, ulp_ops);
a588e4580a7ecb Michael Chan  2016-12-07  52  
a588e4580a7ecb Michael Chan  2016-12-07  53  	if (test_bit(BNXT_STATE_OPEN, &bp->state))
a588e4580a7ecb Michael Chan  2016-12-07  54  		bnxt_hwrm_vnic_cfg(bp, 0);
a588e4580a7ecb Michael Chan  2016-12-07  55  
92c7d0e64af8a4 Ajit Khaparde 2022-10-25  56  	return 0;
a588e4580a7ecb Michael Chan  2016-12-07  57  }
8a686d1e144cad Ajit Khaparde 2022-10-25  58  EXPORT_SYMBOL(bnxt_register_dev);
a588e4580a7ecb Michael Chan  2016-12-07  59
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
index 755821c68020..67872e9bfd63 100644
--- a/drivers/infiniband/hw/bnxt_re/main.c
+++ b/drivers/infiniband/hw/bnxt_re/main.c
@@ -353,23 +353,6 @@  static struct bnxt_ulp_ops bnxt_re_ulp_ops = {
 
 /* RoCE -> Net driver */
 
-/* Driver registration routines used to let the networking driver (bnxt_en)
- * to know that the RoCE driver is now installed
- */
-static int bnxt_re_unregister_netdev(struct bnxt_re_dev *rdev)
-{
-	struct bnxt_en_dev *en_dev;
-	int rc;
-
-	if (!rdev)
-		return -EINVAL;
-
-	en_dev = rdev->en_dev;
-
-	rc = en_dev->en_ops->bnxt_unregister_device(rdev->en_dev);
-	return rc;
-}
-
 static int bnxt_re_register_netdev(struct bnxt_re_dev *rdev)
 {
 	struct bnxt_en_dev *en_dev;
@@ -380,26 +363,12 @@  static int bnxt_re_register_netdev(struct bnxt_re_dev *rdev)
 
 	en_dev = rdev->en_dev;
 
-	rc = en_dev->en_ops->bnxt_register_device(en_dev,
-						  &bnxt_re_ulp_ops, rdev);
-	rdev->qplib_res.pdev = rdev->en_dev->pdev;
+	rc = bnxt_register_dev(en_dev, &bnxt_re_ulp_ops, rdev);
+	if (!rc)
+		rdev->qplib_res.pdev = rdev->en_dev->pdev;
 	return rc;
 }
 
-static int bnxt_re_free_msix(struct bnxt_re_dev *rdev)
-{
-	struct bnxt_en_dev *en_dev;
-
-	if (!rdev)
-		return -EINVAL;
-
-	en_dev = rdev->en_dev;
-
-	en_dev->en_ops->bnxt_free_msix(rdev->en_dev);
-
-	return 0;
-}
-
 static int bnxt_re_request_msix(struct bnxt_re_dev *rdev)
 {
 	int rc = 0, num_msix_want = BNXT_RE_MAX_MSIX, num_msix_got;
@@ -412,9 +381,9 @@  static int bnxt_re_request_msix(struct bnxt_re_dev *rdev)
 
 	num_msix_want = min_t(u32, BNXT_RE_MAX_MSIX, num_online_cpus());
 
-	num_msix_got = en_dev->en_ops->bnxt_request_msix(en_dev,
-							 rdev->msix_entries,
-							 num_msix_want);
+	num_msix_got = bnxt_req_msix_vecs(en_dev,
+					  rdev->msix_entries,
+					  num_msix_want);
 	if (num_msix_got < BNXT_RE_MIN_MSIX) {
 		rc = -EINVAL;
 		goto done;
@@ -475,7 +444,7 @@  static int bnxt_re_net_ring_free(struct bnxt_re_dev *rdev,
 	req.ring_id = cpu_to_le16(fw_ring_id);
 	bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp,
 			    sizeof(resp), DFLT_HWRM_CMD_TIMEOUT);
-	rc = en_dev->en_ops->bnxt_send_fw_msg(en_dev, &fw_msg);
+	rc = bnxt_send_msg(en_dev, &fw_msg);
 	if (rc)
 		ibdev_err(&rdev->ibdev, "Failed to free HW ring:%d :%#x",
 			  req.ring_id, rc);
@@ -512,7 +481,7 @@  static int bnxt_re_net_ring_alloc(struct bnxt_re_dev *rdev,
 	req.int_mode = ring_attr->mode;
 	bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp,
 			    sizeof(resp), DFLT_HWRM_CMD_TIMEOUT);
-	rc = en_dev->en_ops->bnxt_send_fw_msg(en_dev, &fw_msg);
+	rc = bnxt_send_msg(en_dev, &fw_msg);
 	if (!rc)
 		*fw_ring_id = le16_to_cpu(resp.ring_id);
 
@@ -540,7 +509,7 @@  static int bnxt_re_net_stats_ctx_free(struct bnxt_re_dev *rdev,
 	req.stat_ctx_id = cpu_to_le32(fw_stats_ctx_id);
 	bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp,
 			    sizeof(resp), DFLT_HWRM_CMD_TIMEOUT);
-	rc = en_dev->en_ops->bnxt_send_fw_msg(en_dev, &fw_msg);
+	rc = bnxt_send_msg(en_dev, &fw_msg);
 	if (rc)
 		ibdev_err(&rdev->ibdev, "Failed to free HW stats context %#x",
 			  rc);
@@ -573,7 +542,7 @@  static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev,
 	req.stat_ctx_flags = STAT_CTX_ALLOC_REQ_STAT_CTX_FLAGS_ROCE;
 	bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp,
 			    sizeof(resp), DFLT_HWRM_CMD_TIMEOUT);
-	rc = en_dev->en_ops->bnxt_send_fw_msg(en_dev, &fw_msg);
+	rc = bnxt_send_msg(en_dev, &fw_msg);
 	if (!rc)
 		*fw_stats_ctx_id = le32_to_cpu(resp.stat_ctx_id);
 
@@ -1079,7 +1048,7 @@  static int bnxt_re_query_hwrm_pri2cos(struct bnxt_re_dev *rdev, u8 dir,
 
 	bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp,
 			    sizeof(resp), DFLT_HWRM_CMD_TIMEOUT);
-	rc = en_dev->en_ops->bnxt_send_fw_msg(en_dev, &fw_msg);
+	rc = bnxt_send_msg(en_dev, &fw_msg);
 	if (rc)
 		return rc;
 
@@ -1265,7 +1234,7 @@  static void bnxt_re_query_hwrm_intf_version(struct bnxt_re_dev *rdev)
 	req.hwrm_intf_upd = HWRM_VERSION_UPDATE;
 	bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp,
 			    sizeof(resp), DFLT_HWRM_CMD_TIMEOUT);
-	rc = en_dev->en_ops->bnxt_send_fw_msg(en_dev, &fw_msg);
+	rc = bnxt_send_msg(en_dev, &fw_msg);
 	if (rc) {
 		ibdev_err(&rdev->ibdev, "Failed to query HW version, rc = 0x%x",
 			  rc);
@@ -1328,20 +1297,12 @@  static void bnxt_re_dev_uninit(struct bnxt_re_dev *rdev)
 		bnxt_re_net_ring_free(rdev, rdev->rcfw.creq.ring_id, type);
 		bnxt_qplib_free_rcfw_channel(&rdev->rcfw);
 	}
-	if (test_and_clear_bit(BNXT_RE_FLAG_GOT_MSIX, &rdev->flags)) {
-		rc = bnxt_re_free_msix(rdev);
-		if (rc)
-			ibdev_warn(&rdev->ibdev,
-				   "Failed to free MSI-X vectors: %#x", rc);
-	}
+	if (test_and_clear_bit(BNXT_RE_FLAG_GOT_MSIX, &rdev->flags))
+		bnxt_free_msix_vecs(rdev->en_dev);
 
 	bnxt_re_destroy_chip_ctx(rdev);
-	if (test_and_clear_bit(BNXT_RE_FLAG_NETDEV_REGISTERED, &rdev->flags)) {
-		rc = bnxt_re_unregister_netdev(rdev);
-		if (rc)
-			ibdev_warn(&rdev->ibdev,
-				   "Failed to unregister with netdev: %#x", rc);
-	}
+	if (test_and_clear_bit(BNXT_RE_FLAG_NETDEV_REGISTERED, &rdev->flags))
+		bnxt_unregister_dev(rdev->en_dev);
 }
 
 /* worker thread for polling periodic events. Now used for QoS programming*/
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
index 5fa653c2458a..dbb1fa086013 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
@@ -28,9 +28,9 @@ 
 
 static DEFINE_IDA(bnxt_aux_dev_ids);
 
-static int bnxt_register_dev(struct bnxt_en_dev *edev,
-			     struct bnxt_ulp_ops *ulp_ops,
-			     void *handle)
+int bnxt_register_dev(struct bnxt_en_dev *edev,
+		      struct bnxt_ulp_ops *ulp_ops,
+		      void *handle)
 {
 	struct net_device *dev = edev->net;
 	struct bnxt *bp = netdev_priv(dev);
@@ -55,8 +55,9 @@  static int bnxt_register_dev(struct bnxt_en_dev *edev,
 
 	return 0;
 }
+EXPORT_SYMBOL(bnxt_register_dev);
 
-static int bnxt_unregister_dev(struct bnxt_en_dev *edev)
+void bnxt_unregister_dev(struct bnxt_en_dev *edev)
 {
 	struct net_device *dev = edev->net;
 	struct bnxt *bp = netdev_priv(dev);
@@ -65,7 +66,7 @@  static int bnxt_unregister_dev(struct bnxt_en_dev *edev)
 
 	ulp = edev->ulp_tbl;
 	if (ulp->msix_requested)
-		edev->en_ops->bnxt_free_msix(edev);
+		bnxt_free_msix_vecs(edev);
 
 	if (ulp->max_async_event_id)
 		bnxt_hwrm_func_drv_rgtr(bp, NULL, 0, true);
@@ -78,8 +79,9 @@  static int bnxt_unregister_dev(struct bnxt_en_dev *edev)
 	}
 	kfree(ulp);
 	edev->ulp_tbl = NULL;
-	return 0;
+	return;
 }
+EXPORT_SYMBOL(bnxt_unregister_dev);
 
 static void bnxt_fill_msix_vecs(struct bnxt *bp, struct bnxt_msix_entry *ent)
 {
@@ -101,7 +103,7 @@  static void bnxt_fill_msix_vecs(struct bnxt *bp, struct bnxt_msix_entry *ent)
 	}
 }
 
-static int bnxt_req_msix_vecs(struct bnxt_en_dev *edev,
+int bnxt_req_msix_vecs(struct bnxt_en_dev *edev,
 			      struct bnxt_msix_entry *ent,
 			      int num_msix)
 {
@@ -164,8 +166,9 @@  static int bnxt_req_msix_vecs(struct bnxt_en_dev *edev,
 	edev->flags |= BNXT_EN_FLAG_MSIX_REQUESTED;
 	return avail_msix;
 }
+EXPORT_SYMBOL(bnxt_req_msix_vecs);
 
-static void bnxt_free_msix_vecs(struct bnxt_en_dev *edev)
+void bnxt_free_msix_vecs(struct bnxt_en_dev *edev)
 {
 	struct net_device *dev = edev->net;
 	struct bnxt *bp = netdev_priv(dev);
@@ -184,6 +187,7 @@  static void bnxt_free_msix_vecs(struct bnxt_en_dev *edev)
 
 	return;
 }
+EXPORT_SYMBOL(bnxt_free_msix_vecs);
 
 int bnxt_get_ulp_msix_num(struct bnxt *bp)
 {
@@ -218,7 +222,7 @@  int bnxt_get_ulp_stat_ctxs(struct bnxt *bp)
 	return 0;
 }
 
-static int bnxt_send_msg(struct bnxt_en_dev *edev,
+int bnxt_send_msg(struct bnxt_en_dev *edev,
 			 struct bnxt_fw_msg *fw_msg)
 {
 	struct net_device *dev = edev->net;
@@ -252,6 +256,7 @@  static int bnxt_send_msg(struct bnxt_en_dev *edev,
 	hwrm_req_drop(bp, req);
 	return rc;
 }
+EXPORT_SYMBOL(bnxt_send_msg);
 
 static void bnxt_ulp_get(struct bnxt_ulp *ulp)
 {
@@ -310,14 +315,11 @@  void bnxt_ulp_sriov_cfg(struct bnxt *bp, int num_vfs)
 	if (!edev)
 		return;
 
-	rcu_read_lock();
-	ops = rcu_dereference(ulp->ulp_ops);
-	if (!ops || !ops->ulp_sriov_config) {
-		rcu_read_unlock();
+	ops = rtnl_dereference(ulp->ulp_ops);
+	if (!ops || !ops->ulp_sriov_config)
 		return;
-	}
+
 	bnxt_ulp_get(ulp);
-	rcu_read_unlock();
 	ops->ulp_sriov_config(ulp->handle, num_vfs);
 	bnxt_ulp_put(ulp);
 }
@@ -384,10 +386,9 @@  void bnxt_ulp_async_events(struct bnxt *bp, struct hwrm_async_event_cmpl *cmpl)
 	if (!edev)
 		return;
 
-	rcu_read_lock();
 	ulp = edev->ulp_tbl;
 
-	ops = rcu_dereference(ulp->ulp_ops);
+	ops = rtnl_dereference(ulp->ulp_ops);
 	if (!ops || !ops->ulp_async_notifier)
 		return;
 	if (!ulp->async_events_bmap || event_id > ulp->max_async_event_id)
@@ -397,35 +398,8 @@  void bnxt_ulp_async_events(struct bnxt *bp, struct hwrm_async_event_cmpl *cmpl)
 	smp_rmb();
 	if (test_bit(event_id, ulp->async_events_bmap))
 		ops->ulp_async_notifier(ulp->handle, cmpl);
-	rcu_read_unlock();
-}
-
-static int bnxt_register_async_events(struct bnxt_en_dev *edev,
-				      unsigned long *events_bmap,
-				      u16 max_id)
-{
-	struct net_device *dev = edev->net;
-	struct bnxt *bp = netdev_priv(dev);
-	struct bnxt_ulp *ulp;
-
-	ulp = edev->ulp_tbl;
-	ulp->async_events_bmap = events_bmap;
-	/* Make sure bnxt_ulp_async_events() sees this order */
-	smp_wmb();
-	ulp->max_async_event_id = max_id;
-	bnxt_hwrm_func_drv_rgtr(bp, events_bmap, max_id + 1, true);
-	return 0;
 }
 
-static const struct bnxt_en_ops bnxt_en_ops_tbl = {
-	.bnxt_register_device	= bnxt_register_dev,
-	.bnxt_unregister_device	= bnxt_unregister_dev,
-	.bnxt_request_msix	= bnxt_req_msix_vecs,
-	.bnxt_free_msix		= bnxt_free_msix_vecs,
-	.bnxt_send_fw_msg	= bnxt_send_msg,
-	.bnxt_register_fw_async_events	= bnxt_register_async_events,
-};
-
 void bnxt_aux_dev_free(struct bnxt *bp)
 {
 	kfree(bp->aux_dev);
@@ -494,7 +468,6 @@  void bnxt_aux_dev_release(struct device *dev)
 		container_of(dev, struct bnxt_aux_dev, aux_dev.dev);
 	struct bnxt *bp = netdev_priv(bnxt_adev->edev->net);
 
-	bnxt_adev->edev->en_ops = NULL;
 	kfree(bnxt_adev->edev);
 	bnxt_adev->edev = NULL;
 	bp->edev = NULL;
@@ -502,7 +475,6 @@  void bnxt_aux_dev_release(struct device *dev)
 
 static inline void bnxt_set_edev_info(struct bnxt_en_dev *edev, struct bnxt *bp)
 {
-	edev->en_ops = &bnxt_en_ops_tbl;
 	edev->net = bp->dev;
 	edev->pdev = bp->pdev;
 	edev->l2_db_size = bp->db_size;
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h
index 357f8fde5d61..42e324635e6b 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h
@@ -47,7 +47,7 @@  struct bnxt_fw_msg {
 
 struct bnxt_ulp {
 	void		*handle;
-	struct bnxt_ulp_ops __rcu *ulp_ops;
+	struct bnxt_ulp_ops *ulp_ops;
 	unsigned long	*async_events_bmap;
 	u16		max_async_event_id;
 	u16		msix_requested;
@@ -65,7 +65,6 @@  struct bnxt_en_dev {
 						 BNXT_EN_FLAG_ROCEV2_CAP)
 	#define BNXT_EN_FLAG_MSIX_REQUESTED	0x4
 	#define BNXT_EN_FLAG_ULP_STOPPED	0x8
-	const struct bnxt_en_ops	*en_ops;
 	struct bnxt_ulp			*ulp_tbl;
 	int				l2_db_size;	/* Doorbell BAR size in
 							 * bytes mapped by L2
@@ -77,19 +76,6 @@  struct bnxt_en_dev {
 							 */
 };
 
-struct bnxt_en_ops {
-	int (*bnxt_register_device)(struct bnxt_en_dev *edev,
-				    struct bnxt_ulp_ops *ulp_ops, void *handle);
-	int (*bnxt_unregister_device)(struct bnxt_en_dev *edev);
-	int (*bnxt_request_msix)(struct bnxt_en_dev *edev,
-				 struct bnxt_msix_entry *ent, int num_msix);
-	void (*bnxt_free_msix)(struct bnxt_en_dev *edev);
-	int (*bnxt_send_fw_msg)(struct bnxt_en_dev *edev,
-				struct bnxt_fw_msg *fw_msg);
-	int (*bnxt_register_fw_async_events)(struct bnxt_en_dev *edev,
-					     unsigned long *events_bmap, u16 max_id);
-};
-
 static inline bool bnxt_ulp_registered(struct bnxt_en_dev *edev)
 {
 	if (edev && edev->ulp_tbl)
@@ -112,4 +98,12 @@  int bnxt_rdma_aux_device_add(struct bnxt *bp);
 void bnxt_rdma_aux_device_uninit(struct bnxt_aux_dev *bnxt_adev);
 void bnxt_rdma_aux_device_init(struct bnxt *bp);
 void bnxt_aux_dev_free(struct bnxt *bp);
+
+int bnxt_register_dev(struct bnxt_en_dev *edev, struct bnxt_ulp_ops *ulp_ops,
+		      void *handle);
+void bnxt_unregister_dev(struct bnxt_en_dev *edev);
+int bnxt_req_msix_vecs(struct bnxt_en_dev *edev, struct bnxt_msix_entry *ent,
+		       int num_msix);
+void bnxt_free_msix_vecs(struct bnxt_en_dev *edev);
+int bnxt_send_msg(struct bnxt_en_dev *edev, struct bnxt_fw_msg *fw_msg);
 #endif