aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorSteve Wise <swise@opengridcomputing.com>2011-06-14 16:59:27 -0400
committerRoland Dreier <roland@purestorage.com>2011-06-17 14:54:56 -0400
commit8da7e7a55231543b84ac84e93ad5ca9d340773d7 (patch)
tree4f1b15e211a42879b18353b5f2f8c0d164250c7c /drivers/infiniband
parent301c2c3f039a1f9478f6cbef60f2ccd4da9bd4a1 (diff)
RDMA/cxgb4: Couple of abort fixes
- fix a race where the driver could end up sending a close_con_req after an abort_rpl. In c4iw_ep_disconnect(), send abort or close request with the ep mutex held. - fix a hang where driver fails to wake up when a connection is reset during a normal close. Wake up any waiters in the interrupt path, and correctly cleanup after rdma_fini() failures. Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/cxgb4/cm.c46
-rw-r--r--drivers/infiniband/hw/cxgb4/qp.c5
2 files changed, 38 insertions, 13 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index f660cd04ec2f..31fb44085c9b 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -1463,9 +1463,9 @@ static int peer_close(struct c4iw_dev *dev, struct sk_buff *skb)
1463 struct c4iw_qp_attributes attrs; 1463 struct c4iw_qp_attributes attrs;
1464 int disconnect = 1; 1464 int disconnect = 1;
1465 int release = 0; 1465 int release = 0;
1466 int abort = 0;
1467 struct tid_info *t = dev->rdev.lldi.tids; 1466 struct tid_info *t = dev->rdev.lldi.tids;
1468 unsigned int tid = GET_TID(hdr); 1467 unsigned int tid = GET_TID(hdr);
1468 int ret;
1469 1469
1470 ep = lookup_tid(t, tid); 1470 ep = lookup_tid(t, tid);
1471 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); 1471 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid);
@@ -1501,10 +1501,12 @@ static int peer_close(struct c4iw_dev *dev, struct sk_buff *skb)
1501 start_ep_timer(ep); 1501 start_ep_timer(ep);
1502 __state_set(&ep->com, CLOSING); 1502 __state_set(&ep->com, CLOSING);
1503 attrs.next_state = C4IW_QP_STATE_CLOSING; 1503 attrs.next_state = C4IW_QP_STATE_CLOSING;
1504 abort = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, 1504 ret = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp,
1505 C4IW_QP_ATTR_NEXT_STATE, &attrs, 1); 1505 C4IW_QP_ATTR_NEXT_STATE, &attrs, 1);
1506 peer_close_upcall(ep); 1506 if (ret != -ECONNRESET) {
1507 disconnect = 1; 1507 peer_close_upcall(ep);
1508 disconnect = 1;
1509 }
1508 break; 1510 break;
1509 case ABORTING: 1511 case ABORTING:
1510 disconnect = 0; 1512 disconnect = 0;
@@ -2109,15 +2111,16 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp)
2109 break; 2111 break;
2110 } 2112 }
2111 2113
2112 mutex_unlock(&ep->com.mutex);
2113 if (close) { 2114 if (close) {
2114 if (abrupt) 2115 if (abrupt) {
2115 ret = abort_connection(ep, NULL, gfp); 2116 close_complete_upcall(ep);
2116 else 2117 ret = send_abort(ep, NULL, gfp);
2118 } else
2117 ret = send_halfclose(ep, gfp); 2119 ret = send_halfclose(ep, gfp);
2118 if (ret) 2120 if (ret)
2119 fatal = 1; 2121 fatal = 1;
2120 } 2122 }
2123 mutex_unlock(&ep->com.mutex);
2121 if (fatal) 2124 if (fatal)
2122 release_ep_resources(ep); 2125 release_ep_resources(ep);
2123 return ret; 2126 return ret;
@@ -2301,6 +2304,31 @@ static int fw6_msg(struct c4iw_dev *dev, struct sk_buff *skb)
2301 return 0; 2304 return 0;
2302} 2305}
2303 2306
2307static int peer_abort_intr(struct c4iw_dev *dev, struct sk_buff *skb)
2308{
2309 struct cpl_abort_req_rss *req = cplhdr(skb);
2310 struct c4iw_ep *ep;
2311 struct tid_info *t = dev->rdev.lldi.tids;
2312 unsigned int tid = GET_TID(req);
2313
2314 ep = lookup_tid(t, tid);
2315 if (is_neg_adv_abort(req->status)) {
2316 PDBG("%s neg_adv_abort ep %p tid %u\n", __func__, ep,
2317 ep->hwtid);
2318 kfree_skb(skb);
2319 return 0;
2320 }
2321 PDBG("%s ep %p tid %u state %u\n", __func__, ep, ep->hwtid,
2322 ep->com.state);
2323
2324 /*
2325 * Wake up any threads in rdma_init() or rdma_fini().
2326 */
2327 c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET);
2328 sched(dev, skb);
2329 return 0;
2330}
2331
2304/* 2332/*
2305 * Most upcalls from the T4 Core go to sched() to 2333 * Most upcalls from the T4 Core go to sched() to
2306 * schedule the processing on a work queue. 2334 * schedule the processing on a work queue.
@@ -2317,7 +2345,7 @@ c4iw_handler_func c4iw_handlers[NUM_CPL_CMDS] = {
2317 [CPL_PASS_ESTABLISH] = sched, 2345 [CPL_PASS_ESTABLISH] = sched,
2318 [CPL_PEER_CLOSE] = sched, 2346 [CPL_PEER_CLOSE] = sched,
2319 [CPL_CLOSE_CON_RPL] = sched, 2347 [CPL_CLOSE_CON_RPL] = sched,
2320 [CPL_ABORT_REQ_RSS] = sched, 2348 [CPL_ABORT_REQ_RSS] = peer_abort_intr,
2321 [CPL_RDMA_TERMINATE] = sched, 2349 [CPL_RDMA_TERMINATE] = sched,
2322 [CPL_FW4_ACK] = sched, 2350 [CPL_FW4_ACK] = sched,
2323 [CPL_SET_TCB_RPL] = set_tcb_rpl, 2351 [CPL_SET_TCB_RPL] = set_tcb_rpl,
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index 3b773b05a898..a41578e48c7b 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -1207,11 +1207,8 @@ int c4iw_modify_qp(struct c4iw_dev *rhp, struct c4iw_qp *qhp,
1207 c4iw_get_ep(&qhp->ep->com); 1207 c4iw_get_ep(&qhp->ep->com);
1208 } 1208 }
1209 ret = rdma_fini(rhp, qhp, ep); 1209 ret = rdma_fini(rhp, qhp, ep);
1210 if (ret) { 1210 if (ret)
1211 if (internal)
1212 c4iw_get_ep(&qhp->ep->com);
1213 goto err; 1211 goto err;
1214 }
1215 break; 1212 break;
1216 case C4IW_QP_STATE_TERMINATE: 1213 case C4IW_QP_STATE_TERMINATE:
1217 set_state(qhp, C4IW_QP_STATE_TERMINATE); 1214 set_state(qhp, C4IW_QP_STATE_TERMINATE);