Skip to contentSkip to conversation

RDMA/irdma: Cleanups and improvements

PATCH Applied Kamal Heib 2 participants 5 messages May 15, 2023 – May 17, 2023

Subsystems (2)
lore
Share & tools
lore

Kamal Heib

author
#0 lore raw

v2 cover RDMA/irdma: Cleanups and improvements

This series includes a few cleanup patches for the irdma driver.

v2:
- all: Fix subject.
- patch1: Make checkpatch.pl happy.

Kamal Heib (3):
RDMA/irdma: Return void from irdma_init_iw_device() RDMA/irdma: Return void from irdma_init_rdma_device() RDMA/irdma: Move iw device ops initialization

 drivers/infiniband/hw/irdma/verbs.c | 41 +++++++++++------------------
 1 file changed, 16 insertions(+), 25 deletions(-)
Signature · 1 line
2.40.1
author
#1 lore raw

PATCH v2 1/3 RDMA/irdma: Return void from irdma_init_iw_device()

The return value from irdma_init_iw_device() is always 0 - change it to be void.

---
 drivers/infiniband/hw/irdma/verbs.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/infiniband/hw/irdma/verbs.c +5 -10
index ab5cdf782785..baaef6ce195c 100644
@@ -4515,7 +4515,7 @@ static void irdma_init_roce_device(struct irdma_device *iwdev)
  * irdma_init_iw_device - initialization of iwarp rdma device
  * @iwdev: irdma device
  */
-static int irdma_init_iw_device(struct irdma_device *iwdev)
+static void irdma_init_iw_device(struct irdma_device *iwdev)
 {
 	struct net_device *netdev = iwdev->netdev;
 
@@ -4533,8 +4533,6 @@ static int irdma_init_iw_device(struct irdma_device *iwdev)
 	memcpy(iwdev->ibdev.iw_ifname, netdev->name,
 	       sizeof(iwdev->ibdev.iw_ifname));
 	ib_set_device_ops(&iwdev->ibdev, &irdma_iw_dev_ops);
-
-	return 0;
 }
 
 /**
@@ -4544,15 +4542,12 @@ static int irdma_init_iw_device(struct irdma_device *iwdev)
 static int irdma_init_rdma_device(struct irdma_device *iwdev)
 {
 	struct pci_dev *pcidev = iwdev->rf->pcidev;
-	int ret;
 
-	if (iwdev->roce_mode) {
+	if (iwdev->roce_mode)
 		irdma_init_roce_device(iwdev);
-	} else {
-		ret = irdma_init_iw_device(iwdev);
-		if (ret)
-			return ret;
-	}
+	else
+		irdma_init_iw_device(iwdev);
+
 	iwdev->ibdev.phys_port_cnt = 1;
 	iwdev->ibdev.num_comp_vectors = iwdev->rf->ceqs_count;
 	iwdev->ibdev.dev.parent = &pcidev->dev;
Signature · 1 line
2.40.1
author
#2 lore raw

PATCH v2 2/3 RDMA/irdma: Return void from irdma_init_rdma_device()

The return value from irdma_init_rdma_device() is always 0 - change it to be void.

---
 drivers/infiniband/hw/irdma/verbs.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/infiniband/hw/irdma/verbs.c +2 -6
index baaef6ce195c..9ff06feda872 100644
@@ -4539,7 +4539,7 @@ static void irdma_init_iw_device(struct irdma_device *iwdev)
  * irdma_init_rdma_device - initialization of rdma device
  * @iwdev: irdma device
  */
-static int irdma_init_rdma_device(struct irdma_device *iwdev)
+static void irdma_init_rdma_device(struct irdma_device *iwdev)
 {
 	struct pci_dev *pcidev = iwdev->rf->pcidev;
 
@@ -4552,8 +4552,6 @@ static int irdma_init_rdma_device(struct irdma_device *iwdev)
 	iwdev->ibdev.num_comp_vectors = iwdev->rf->ceqs_count;
 	iwdev->ibdev.dev.parent = &pcidev->dev;
 	ib_set_device_ops(&iwdev->ibdev, &irdma_dev_ops);
-
-	return 0;
 }
 
 /**
@@ -4591,9 +4589,7 @@ int irdma_ib_register_device(struct irdma_device *iwdev)
 {
 	int ret;
 
-	ret = irdma_init_rdma_device(iwdev);
-	if (ret)
-		return ret;
+	irdma_init_rdma_device(iwdev);
 
 	ret = ib_device_set_netdev(&iwdev->ibdev, iwdev->netdev, 1);
 	if (ret)
Signature · 1 line
2.40.1
author
#3 lore raw

PATCH v2 3/3 RDMA/irdma: Move iw device ops initialization

Move the initialization of the iw device ops to be under the declaration of the irdma_iw_dev_ops.

---
 drivers/infiniband/hw/irdma/verbs.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/infiniband/hw/irdma/verbs.c +9 -9
index 9ff06feda872..6242ab6af77f 100644
@@ -4450,8 +4450,16 @@ static const struct ib_device_ops irdma_roce_dev_ops = {
 };
 
 static const struct ib_device_ops irdma_iw_dev_ops = {
-	.modify_qp = irdma_modify_qp,
 	.get_port_immutable = irdma_iw_port_immutable,
+	.iw_accept = irdma_accept,
+	.iw_add_ref = irdma_qp_add_ref,
+	.iw_connect = irdma_connect,
+	.iw_create_listen = irdma_create_listen,
+	.iw_destroy_listen = irdma_destroy_listen,
+	.iw_get_qp = irdma_get_qp,
+	.iw_reject = irdma_reject,
+	.iw_rem_ref = irdma_qp_rem_ref,
+	.modify_qp = irdma_modify_qp,
 	.query_gid = irdma_query_gid,
 };
 
@@ -4522,14 +4530,6 @@ static void irdma_init_iw_device(struct irdma_device *iwdev)
 	iwdev->ibdev.node_type = RDMA_NODE_RNIC;
 	addrconf_addr_eui48((u8 *)&iwdev->ibdev.node_guid,
 			    netdev->dev_addr);
-	iwdev->ibdev.ops.iw_add_ref = irdma_qp_add_ref;
-	iwdev->ibdev.ops.iw_rem_ref = irdma_qp_rem_ref;
-	iwdev->ibdev.ops.iw_get_qp = irdma_get_qp;
-	iwdev->ibdev.ops.iw_connect = irdma_connect;
-	iwdev->ibdev.ops.iw_accept = irdma_accept;
-	iwdev->ibdev.ops.iw_reject = irdma_reject;
-	iwdev->ibdev.ops.iw_create_listen = irdma_create_listen;
-	iwdev->ibdev.ops.iw_destroy_listen = irdma_destroy_listen;
 	memcpy(iwdev->ibdev.iw_ifname, netdev->name,
 	       sizeof(iwdev->ibdev.iw_ifname));
 	ib_set_device_ops(&iwdev->ibdev, &irdma_iw_dev_ops);
Signature · 1 line
2.40.1
maintainer Applied
#4 lore raw
In reply to Kamal Heib
Quoted 10 lines · Kamal Heib

This series includes a few cleanup patches for the irdma driver.

v2:
- all: Fix subject.
- patch1: Make checkpatch.pl happy.

Kamal Heib (3):
RDMA/irdma: Return void from irdma_init_iw_device() RDMA/irdma: Return void from irdma_init_rdma_device() RDMA/irdma: Move iw device ops initialization

Applied to for-next

Please fix your threading option, thread under cover letter not chain each patch.

Thanks,
Jason