Skip to contentSkip to conversation

RDMA/cxgb3: Don't ignore insert_handle() failures.

PATCH In review Steve Wise 2 participants 3 messages Sep 8, 2009 – Sep 9, 2009 2 messages not in the archive InfiniBand

lore
Share & tools
lore

Steve Wise

author
#0 lore raw

PATCH 1/2 RDMA/cxgb3: Don't ignore insert_handle() failures.

---

 drivers/infiniband/hw/cxgb3/iwch_mem.c      |   21 ++++++++---
 drivers/infiniband/hw/cxgb3/iwch_provider.c |   50 +++++++++++++++++++--------
 2 files changed, 49 insertions(+), 22 deletions(-)
drivers/infiniband/hw/cxgb3/iwch_mem.c +14 -7
index ec49a5c..e1ec65e 100644
@@ -39,7 +39,7 @@
 #include "iwch.h"
 #include "iwch_provider.h"
 
-static void iwch_finish_mem_reg(struct iwch_mr *mhp, u32 stag)
+static int iwch_finish_mem_reg(struct iwch_mr *mhp, u32 stag)
 {
 	u32 mmid;
 
@@ -47,14 +47,15 @@ static void iwch_finish_mem_reg(struct iwch_mr *mhp, u32 stag)
 	mhp->attr.stag = stag;
 	mmid = stag >> 8;
 	mhp->ibmr.rkey = mhp->ibmr.lkey = stag;
-	insert_handle(mhp->rhp, &mhp->rhp->mmidr, mhp, mmid);
 	PDBG("%s mmid 0x%x mhp %p\n", __func__, mmid, mhp);
+	return insert_handle(mhp->rhp, &mhp->rhp->mmidr, mhp, mmid);
 }
 
 int iwch_register_mem(struct iwch_dev *rhp, struct iwch_pd *php,
 		      struct iwch_mr *mhp, int shift)
 {
 	u32 stag;
+	int ret;
 
 	if (cxio_register_phys_mem(&rhp->rdev,
 				   &stag, mhp->attr.pdid,
@@ -66,9 +67,11 @@ int iwch_register_mem(struct iwch_dev *rhp, struct iwch_pd *php,
 				   mhp->attr.pbl_size, mhp->attr.pbl_addr))
 		return -ENOMEM;
 
-	iwch_finish_mem_reg(mhp, stag);
-
-	return 0;
+	ret = iwch_finish_mem_reg(mhp, stag);
+	if (ret)
+		cxio_dereg_mem(&rhp->rdev, mhp->attr.stag, mhp->attr.pbl_size,
+		       mhp->attr.pbl_addr);
+	return ret;
 }
 
 int iwch_reregister_mem(struct iwch_dev *rhp, struct iwch_pd *php,
@@ -77,6 +80,7 @@ int iwch_reregister_mem(struct iwch_dev *rhp, struct iwch_pd *php,
 					int npages)
 {
 	u32 stag;
+	int ret;
 
 	/* We could support this... */
 	if (npages > mhp->attr.pbl_size)
@@ -93,9 +97,12 @@ int iwch_reregister_mem(struct iwch_dev *rhp, struct iwch_pd *php,
 				   mhp->attr.pbl_size, mhp->attr.pbl_addr))
 		return -ENOMEM;
 
-	iwch_finish_mem_reg(mhp, stag);
+	ret = iwch_finish_mem_reg(mhp, stag);
+	if (ret)
+		cxio_dereg_mem(&rhp->rdev, mhp->attr.stag, mhp->attr.pbl_size,
+		       mhp->attr.pbl_addr);
 
-	return 0;
+	return ret;
 }
 
 int iwch_alloc_pbl(struct iwch_mr *mhp, int npages)
drivers/infiniband/hw/cxgb3/iwch_provider.c +35 -15

93 lines not on this page · raw message

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20090908213001.15369.15629.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org

author
#2 lore raw

PATCH 2/2 RDMA/cxgb3: clean up properly on FW mismatch failures.

FW mismatches can cause a crash in the iw_cxgb3 event handler.

- NULL the t3cdev->ulp pointer on failures in cxio_rdev_open()

- Silently ignore events with the ulp ptr is null in iwch_err_handler()

---

 drivers/infiniband/hw/cxgb3/cxio_hal.c |    1 +
 drivers/infiniband/hw/cxgb3/iwch.c     |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletions(-)
drivers/infiniband/hw/cxgb3/cxio_hal.c +1 -0
index 4dec515..68955f8 100644
@@ -1034,6 +1034,7 @@ err3:
 err2:
 	cxio_hal_destroy_ctrl_qp(rdev_p);
 err1:
+	rdev_p->t3cdev_p->ulp = (void *) NULL;
 	list_del(&rdev_p->entry);
 	return err;
 }
drivers/infiniband/hw/cxgb3/iwch.c +4 -1
index 5796170..3f0c99d 100644
@@ -165,10 +165,13 @@ static void close_rnic_dev(struct t3cdev *tdev)
 static void iwch_event_handler(struct t3cdev *tdev, u32 evt, u32 port_id)
 {
 	struct cxio_rdev *rdev = tdev->ulp;
-	struct iwch_dev *rnicp = rdev_to_iwch_dev(rdev);
+	struct iwch_dev *rnicp;
 	struct ib_event event;
 	u32    portnum = port_id + 1;
 
+	if (!rdev)
+		return;
+	rnicp = rdev_to_iwch_dev(rdev);
 	switch (evt) {
 	case OFFLOAD_STATUS_DOWN: {
 		rdev->flags = CXIO_ERROR_FATAL;

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20090908213006.15369.19707.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org