From b62b67004939b407a1a02d01412e04ef53b7d0eb Mon Sep 17 00:00:00 2001 From: np Date: Sun, 31 May 2015 23:47:08 +0000 Subject: MFC r273480, r273750, r273753, r273797, and r274461. r273480: cxgbe/iw_cxgbe: wake up waiters after flushing the qp. r273750: Some cxgbe/iw_cxgbe fixes: - Free rt in c4iw_connect only if it is allocated. - Call soclose instead of so_shutdown if there is an abort from the peer. - Close socket and return failure if TOE is not enabled. r273753: iwcm_event status needs to be populated for close_complete_upcall r273797: Always request a completion for every work request for iWARP. The initial MPA exchange must be tracked this way so that t4_tom's state for the tid is all clean at the time the tid transitions to RDMA mode. Once it does, t4_tom is out of the way and iw_cxgbe uses the qp endpoints directly. r274461: iw_cxgbe: don't forget to close the socket in c4iw_connect if soconnect fails. --- sys/dev/cxgbe/iw_cxgbe/cm.c | 26 +++++++++++++++----------- sys/dev/cxgbe/iw_cxgbe/qp.c | 2 +- sys/dev/cxgbe/tom/t4_cpl_io.c | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/sys/dev/cxgbe/iw_cxgbe/cm.c b/sys/dev/cxgbe/iw_cxgbe/cm.c index 7fdbb05..4539daa 100644 --- a/sys/dev/cxgbe/iw_cxgbe/cm.c +++ b/sys/dev/cxgbe/iw_cxgbe/cm.c @@ -94,7 +94,7 @@ static void abort_socket(struct c4iw_ep *ep); static void send_mpa_req(struct c4iw_ep *ep); static int send_mpa_reject(struct c4iw_ep *ep, const void *pdata, u8 plen); static int send_mpa_reply(struct c4iw_ep *ep, const void *pdata, u8 plen); -static void close_complete_upcall(struct c4iw_ep *ep); +static void close_complete_upcall(struct c4iw_ep *ep, int status); static int abort_connection(struct c4iw_ep *ep); static void peer_close_upcall(struct c4iw_ep *ep); static void peer_abort_upcall(struct c4iw_ep *ep); @@ -366,7 +366,7 @@ process_peer_close(struct c4iw_ep *ep) C4IW_QP_ATTR_NEXT_STATE, &attrs, 1); } close_socket(&ep->com, 0); - close_complete_upcall(ep); + close_complete_upcall(ep, 0); __state_set(&ep->com, DEAD); release = 1; disconnect = 0; @@ -474,7 +474,7 @@ process_conn_error(struct c4iw_ep *ep) if (state != ABORTING) { CTR2(KTR_IW_CXGBE, "%s:pce1 %p", __func__, ep); - close_socket(&ep->com, 0); + close_socket(&ep->com, 1); state_set(&ep->com, DEAD); c4iw_put_ep(&ep->com); } @@ -528,7 +528,7 @@ process_close_complete(struct c4iw_ep *ep) CTR2(KTR_IW_CXGBE, "%s:pcc4 %p", __func__, ep); close_socket(&ep->com, 0); } - close_complete_upcall(ep); + close_complete_upcall(ep, 0); __state_set(&ep->com, DEAD); release = 1; break; @@ -1206,13 +1206,14 @@ static int send_mpa_reply(struct c4iw_ep *ep, const void *pdata, u8 plen) -static void close_complete_upcall(struct c4iw_ep *ep) +static void close_complete_upcall(struct c4iw_ep *ep, int status) { struct iw_cm_event event; CTR2(KTR_IW_CXGBE, "%s:ccuB %p", __func__, ep); memset(&event, 0, sizeof(event)); event.event = IW_CM_EVENT_CLOSE; + event.status = status; if (ep->com.cm_id) { @@ -1231,7 +1232,7 @@ static int abort_connection(struct c4iw_ep *ep) int err; CTR2(KTR_IW_CXGBE, "%s:abB %p", __func__, ep); - close_complete_upcall(ep); + close_complete_upcall(ep, -ECONNRESET); state_set(&ep->com, ABORTING); abort_socket(ep); err = close_socket(&ep->com, 0); @@ -2098,14 +2099,15 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) CTR2(KTR_IW_CXGBE, "%s:cc7 %p", __func__, ep); printk(KERN_ERR MOD "%s - cannot find route.\n", __func__); err = -EHOSTUNREACH; - goto fail3; + goto fail2; } - - if (!(rt->rt_ifp->if_flags & IFCAP_TOE)) { + if (!(rt->rt_ifp->if_capenable & IFCAP_TOE)) { CTR2(KTR_IW_CXGBE, "%s:cc8 %p", __func__, ep); printf("%s - interface not TOE capable.\n", __func__); + close_socket(&ep->com, 0); + err = -ENOPROTOOPT; goto fail3; } tdev = TOEDEV(rt->rt_ifp); @@ -2126,9 +2128,11 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ep->com.thread); if (!err) { - CTR2(KTR_IW_CXGBE, "%s:cca %p", __func__, ep); goto out; + } else { + close_socket(&ep->com, 0); + goto fail2; } fail3: @@ -2225,7 +2229,7 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp) CTR2(KTR_IW_CXGBE, "%s:ced1 %p", __func__, ep); fatal = 1; - close_complete_upcall(ep); + close_complete_upcall(ep, -EIO); ep->com.state = DEAD; } CTR3(KTR_IW_CXGBE, "%s:ced2 %p %s", __func__, ep, diff --git a/sys/dev/cxgbe/iw_cxgbe/qp.c b/sys/dev/cxgbe/iw_cxgbe/qp.c index 44ad9cd..cf74760 100644 --- a/sys/dev/cxgbe/iw_cxgbe/qp.c +++ b/sys/dev/cxgbe/iw_cxgbe/qp.c @@ -1359,9 +1359,9 @@ err: qhp->ep = NULL; set_state(qhp, C4IW_QP_STATE_ERROR); free = 1; - wake_up(&qhp->wait); BUG_ON(!ep); flush_qp(qhp); + wake_up(&qhp->wait); out: mutex_unlock(&qhp->mutex); diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index 317c655..3daf056 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -769,7 +769,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop) toep->tx_nocompl >= toep->tx_total / 4) compl = 1; - if (compl) { + if (compl || toep->ulp_mode == ULP_MODE_RDMA) { txwr->op_to_immdlen |= htobe32(F_FW_WR_COMPL); toep->tx_nocompl = 0; toep->plen_nocompl = 0; -- cgit v1.1