Skip to contentSkip to conversation

RDMA/irdma: do some cleanups

PATCH Applied [email protected] 4 participants 8 messages Jul 13, 2021 – Jul 18, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover RDMA/irdma: do some cleanups

From: Zhu Yanjun <[email protected]>

Since the functions irdma_sc_repost_aeq_entries, irdma_set_hw_rsrc and irdma_setup_virt_qp always return 0, remove the returned value check and change the returned type to void.

Zhu Yanjun (3):
RDMA/irdma: change the returned type of irdma_sc_repost_aeq_entries to
void
RDMA/irdma: change the returned type of irdma_set_hw_rsrc to void RDMA/irdma: change returned type of irdma_setup_virt_qp to void

 drivers/infiniband/hw/irdma/ctrl.c  |  4 +---
 drivers/infiniband/hw/irdma/hw.c    | 11 ++---------
 drivers/infiniband/hw/irdma/type.h  |  3 +--
 drivers/infiniband/hw/irdma/verbs.c |  6 ++----
 4 files changed, 6 insertions(+), 18 deletions(-)
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/3 RDMA/irdma: change the returned type of irdma_sc_repost_aeq_entries to void

From: Zhu Yanjun <[email protected]>

The function irdma_sc_repost_aeq_entries always returns zero. So the returned type is changed to void.

---
 drivers/infiniband/hw/irdma/ctrl.c | 4 +---
 drivers/infiniband/hw/irdma/type.h | 3 +--
 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/infiniband/hw/irdma/ctrl.c +1 -3
index b1023a7d0bd1..777e35620635 100644
@@ -4187,11 +4187,9 @@ enum irdma_status_code irdma_sc_get_next_aeqe(struct irdma_sc_aeq *aeq,
  * @dev: sc device struct
  * @count: allocate count
  */
-enum irdma_status_code irdma_sc_repost_aeq_entries(struct irdma_sc_dev *dev, u32 count)
+void irdma_sc_repost_aeq_entries(struct irdma_sc_dev *dev, u32 count)
 {
 	writel(count, dev->hw_regs[IRDMA_AEQALLOC]);
-
-	return 0;
 }
 
 /**
drivers/infiniband/hw/irdma/type.h +1 -2
index 7387b83e826d..874bc25a938b 100644
@@ -1222,8 +1222,7 @@ enum irdma_status_code irdma_sc_aeq_init(struct irdma_sc_aeq *aeq,
 					 struct irdma_aeq_init_info *info);
 enum irdma_status_code irdma_sc_get_next_aeqe(struct irdma_sc_aeq *aeq,
 					      struct irdma_aeqe_info *info);
-enum irdma_status_code irdma_sc_repost_aeq_entries(struct irdma_sc_dev *dev,
-						   u32 count);
+void irdma_sc_repost_aeq_entries(struct irdma_sc_dev *dev, u32 count);
 
 void irdma_sc_pd_init(struct irdma_sc_dev *dev, struct irdma_sc_pd *pd, u32 pd_id,
 		      int abi_ver);
Signature · 1 line
2.27.0
#2 lore raw

Re: [PATCH 1/3] RDMA/irdma: change the returned type of irdma_sc_repost_aeq_entries to void

Quoted 10 lines · On Tue, Jul 13, 2021 at 11:11:28PM -0400, [email protected] wrote:

From: Zhu Yanjun <[email protected]>

The function irdma_sc_repost_aeq_entries always returns zero. So the returned type is changed to void.

---
 drivers/infiniband/hw/irdma/ctrl.c | 4 +---
 drivers/infiniband/hw/irdma/type.h | 3 +--
 2 files changed, 2 insertions(+), 5 deletions(-)

<...>

drivers/infiniband/hw/irdma/type.h enum irdma_status_code irdma_sc_aeq_init(struct irdma_sc_aeq *aeq, · line 1226

Quoted 2 lines
drivers/infiniband/hw/irdma/type.h +0 -2
-enum irdma_status_code irdma_sc_repost_aeq_entries(struct irdma_sc_dev *dev,
-						   u32 count);

I clearly remember that Jakub asked for more than once to remo remove custom ice/irdma error codes. Did it happen? Can we get rid from them in RDMA too?

Thanks

#3 lore raw

Re: [PATCH 1/3] RDMA/irdma: change the returned type of irdma_sc_repost_aeq_entries to void

Quoted 13 lines · Leon Romanovsky
Quoted 10 lines · On Tue, Jul 13, 2021 at 11:11:28PM -0400, [email protected] wrote:

From: Zhu Yanjun <[email protected]>

The function irdma_sc_repost_aeq_entries always returns zero. So the returned type is changed to void.

---
 drivers/infiniband/hw/irdma/ctrl.c | 4 +---
 drivers/infiniband/hw/irdma/type.h | 3 +--
 2 files changed, 2 insertions(+), 5 deletions(-)
Quoted 8 lines

<...>

drivers/infiniband/hw/irdma/type.h enum irdma_status_code irdma_sc_aeq_init(struct irdma_sc_aeq *aeq, · line 1226

Quoted 2 lines
drivers/infiniband/hw/irdma/type.h +0 -2
-enum irdma_status_code irdma_sc_repost_aeq_entries(struct irdma_sc_dev *dev,
-                                                u32 count);

I clearly remember that Jakub asked for more than once to remo remove custom ice/irdma error codes. Did it happen? Can we get rid from them in RDMA too?

No. This is not related with custom ice/irdma error codes.

This is related with the returned type of the function.
If a function always returns 0, change the function returned type to void. And remove the related returned value check.

Zhu Yanjun

Quoted 2 lines

Thanks

#4 lore raw

Re: [PATCH 1/3] RDMA/irdma: change the returned type of irdma_sc_repost_aeq_entries to void

Quoted 16 lines · Zhu Yanjun
Quoted 15 lines · Leon Romanovsky
Quoted 10 lines · On Tue, Jul 13, 2021 at 11:11:28PM -0400, [email protected] wrote:

From: Zhu Yanjun <[email protected]>

The function irdma_sc_repost_aeq_entries always returns zero. So the returned type is changed to void.

---
 drivers/infiniband/hw/irdma/ctrl.c | 4 +---
 drivers/infiniband/hw/irdma/type.h | 3 +--
 2 files changed, 2 insertions(+), 5 deletions(-)

<...>

Quoted 8 lines
Quoted 6 lines

drivers/infiniband/hw/irdma/type.h enum irdma_status_code irdma_sc_aeq_init(struct irdma_sc_aeq *aeq, · line 1226

Quoted 2 lines
drivers/infiniband/hw/irdma/type.h +0 -2
-enum irdma_status_code irdma_sc_repost_aeq_entries(struct irdma_sc_dev *dev,
-                                                u32 count);

I clearly remember that Jakub asked for more than once to remo remove custom ice/irdma error codes. Did it happen? Can we get rid from them in RDMA too?

No. This is not related with custom ice/irdma error codes.

I'm not talking about your specific change, but pointed to the fact that custom error codes are not cleaned despite multiple requests.

Thanks

#5 lore raw

PATCH 2/3 RDMA/irdma: change the returned type of irdma_set_hw_rsrc to void

In reply to [email protected]

From: Zhu Yanjun <[email protected]>

Since the function irdma_set_hw_rsrc always returns zero, change the returned type to void and remove all the related source code.

---
 drivers/infiniband/hw/irdma/hw.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/infiniband/hw/irdma/hw.c +2 -9
index 7afb8a6a0526..00de5ee9a260 100644
@@ -1920,7 +1920,7 @@ enum irdma_status_code irdma_ctrl_init_hw(struct irdma_pci_f *rf)
  * irdma_set_hw_rsrc - set hw memory resources.
  * @rf: RDMA PCI function
  */
-static u32 irdma_set_hw_rsrc(struct irdma_pci_f *rf)
+static void irdma_set_hw_rsrc(struct irdma_pci_f *rf)
 {
 	rf->allocated_qps = (void *)(rf->mem_rsrc +
 		   (sizeof(struct irdma_arp_entry) * rf->arp_table_size));
@@ -1937,8 +1937,6 @@ static u32 irdma_set_hw_rsrc(struct irdma_pci_f *rf)
 	spin_lock_init(&rf->arp_lock);
 	spin_lock_init(&rf->qptable_lock);
 	spin_lock_init(&rf->qh_list_lock);
-
-	return 0;
 }
 
 /**
@@ -2000,9 +1998,7 @@ u32 irdma_initialize_hw_rsrc(struct irdma_pci_f *rf)
 
 	rf->arp_table = (struct irdma_arp_entry *)rf->mem_rsrc;
 
-	ret = irdma_set_hw_rsrc(rf);
-	if (ret)
-		goto set_hw_rsrc_fail;
+	irdma_set_hw_rsrc(rf);
 
 	set_bit(0, rf->allocated_mrs);
 	set_bit(0, rf->allocated_qps);
@@ -2025,9 +2021,6 @@ u32 irdma_initialize_hw_rsrc(struct irdma_pci_f *rf)
 
 	return 0;
 
-set_hw_rsrc_fail:
-	kfree(rf->mem_rsrc);
-	rf->mem_rsrc = NULL;
 mem_rsrc_kzalloc_fail:
 	kfree(rf->allocated_ws_nodes);
 	rf->allocated_ws_nodes = NULL;
Signature · 1 line
2.27.0
#6 lore raw

PATCH 3/3 RDMA/irdma: change returned type of irdma_setup_virt_qp to void

In reply to [email protected]

From: Zhu Yanjun <[email protected]>

Since the returned value of the function irdma_setup_virt_qp is always 0, remove the returned value check and change the returned type to void.

---
 drivers/infiniband/hw/irdma/verbs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/infiniband/hw/irdma/verbs.c +2 -4
index 9712f6902ba8..717147ed0519 100644
@@ -557,7 +557,7 @@ static int irdma_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
  * @iwqp: qp ptr
  * @init_info: initialize info to return
  */
-static int irdma_setup_virt_qp(struct irdma_device *iwdev,
+static void irdma_setup_virt_qp(struct irdma_device *iwdev,
 			       struct irdma_qp *iwqp,
 			       struct irdma_qp_init_info *init_info)
 {
@@ -574,8 +574,6 @@ static int irdma_setup_virt_qp(struct irdma_device *iwdev,
 		init_info->sq_pa = qpmr->sq_pbl.addr;
 		init_info->rq_pa = qpmr->rq_pbl.addr;
 	}
-
-	return 0;
 }
 
 /**
@@ -914,7 +912,7 @@ static struct ib_qp *irdma_create_qp(struct ib_pd *ibpd,
 			}
 		}
 		init_info.qp_uk_init_info.abi_ver = iwpd->sc_pd.abi_ver;
-		err_code = irdma_setup_virt_qp(iwdev, iwqp, &init_info);
+		irdma_setup_virt_qp(iwdev, iwqp, &init_info);
 	} else {
 		init_info.qp_uk_init_info.abi_ver = IRDMA_ABI_VER;
 		err_code = irdma_setup_kmode_qp(iwdev, iwqp, &init_info, init_attr);
Signature · 1 line
2.27.0
maintainer Applied
#7 lore raw
In reply to [email protected]
Quoted 11 lines · On Tue, Jul 13, 2021 at 11:11:27PM -0400, [email protected] wrote:

From: Zhu Yanjun <[email protected]>

Since the functions irdma_sc_repost_aeq_entries, irdma_set_hw_rsrc and irdma_setup_virt_qp always return 0, remove the returned value check and change the returned type to void.

Zhu Yanjun (3):
RDMA/irdma: change the returned type of irdma_sc_repost_aeq_entries to
void
RDMA/irdma: change the returned type of irdma_set_hw_rsrc to void RDMA/irdma: change returned type of irdma_setup_virt_qp to void

Applied to for-next, thanks

Jason