Lines Matching full:ep
88 static void start_ep_timer(struct c4iw_ep *ep);
89 static int stop_ep_timer(struct c4iw_ep *ep);
90 static int set_tcpinfo(struct c4iw_ep *ep);
91 static void process_timeout(struct c4iw_ep *ep);
95 static int send_mpa_req(struct c4iw_ep *ep);
96 static int send_mpa_reject(struct c4iw_ep *ep, const void *pdata, u8 plen);
97 static int send_mpa_reply(struct c4iw_ep *ep, const void *pdata, u8 plen);
98 static void close_complete_upcall(struct c4iw_ep *ep, int status);
99 static int send_abort(struct c4iw_ep *ep);
100 static void peer_close_upcall(struct c4iw_ep *ep);
101 static void peer_abort_upcall(struct c4iw_ep *ep);
102 static void connect_reply_upcall(struct c4iw_ep *ep, int status);
103 static int connect_request_upcall(struct c4iw_ep *ep);
104 static void established_upcall(struct c4iw_ep *ep);
105 static int process_mpa_reply(struct c4iw_ep *ep);
106 static int process_mpa_request(struct c4iw_ep *ep);
107 static void process_peer_close(struct c4iw_ep *ep);
108 static void process_conn_error(struct c4iw_ep *ep);
109 static void process_close_complete(struct c4iw_ep *ep);
114 static void process_data(struct c4iw_ep *ep);
115 static void process_connected(struct c4iw_ep *ep);
117 static void process_socket_event(struct c4iw_ep *ep);
118 static void release_ep_resources(struct c4iw_ep *ep);
119 static int process_terminate(struct c4iw_ep *ep);
122 static int add_ep_to_req_list(struct c4iw_ep *ep, int ep_events);
132 #define START_EP_TIMER(ep) \ argument
134 CTR3(KTR_IW_CXGBE, "start_ep_timer (%s:%d) ep %p", \
135 __func__, __LINE__, (ep)); \
136 start_ep_timer(ep); \
139 #define STOP_EP_TIMER(ep) \ argument
141 CTR3(KTR_IW_CXGBE, "stop_ep_timer (%s:%d) ep %p", \
142 __func__, __LINE__, (ep)); \
143 stop_ep_timer(ep); \
197 static void deref_qp(struct c4iw_ep *ep) in deref_qp() argument
199 c4iw_qp_rem_ref(&ep->com.qp->ibqp); in deref_qp()
200 clear_bit(QP_REFERENCED, &ep->com.flags); in deref_qp()
201 set_bit(QP_DEREFED, &ep->com.history); in deref_qp()
204 static void ref_qp(struct c4iw_ep *ep) in ref_qp() argument
206 set_bit(QP_REFERENCED, &ep->com.flags); in ref_qp()
207 set_bit(QP_REFED, &ep->com.history); in ref_qp()
208 c4iw_qp_add_ref(&ep->com.qp->ibqp); in ref_qp()
387 static void process_timeout(struct c4iw_ep *ep) in process_timeout() argument
392 CTR4(KTR_IW_CXGBE, "%s ep :%p, tid:%u, state %d", __func__, in process_timeout()
393 ep, ep->hwtid, ep->com.state); in process_timeout()
394 set_bit(TIMEDOUT, &ep->com.history); in process_timeout()
395 switch (ep->com.state) { in process_timeout()
397 connect_reply_upcall(ep, -ETIMEDOUT); in process_timeout()
406 if (ep->com.cm_id && ep->com.qp) { in process_timeout()
408 c4iw_modify_qp(ep->com.dev, ep->com.qp, in process_timeout()
411 close_complete_upcall(ep, -ETIMEDOUT); in process_timeout()
416 * These states are expected if the ep timed out at the same in process_timeout()
423 CTR4(KTR_IW_CXGBE, "%s unexpected state ep %p tid %u state %u" in process_timeout()
424 , __func__, ep, ep->hwtid, ep->com.state); in process_timeout()
428 c4iw_ep_disconnect(ep, 1, GFP_KERNEL); in process_timeout()
429 c4iw_put_ep(&ep->com); in process_timeout()
479 CTR5(KTR_IW_CXGBE, "%s: so %p, ep %p, ep_state %s events 0x%x", in process_req()
501 set_tcpinfo(struct c4iw_ep *ep) in set_tcpinfo() argument
503 struct socket *so = ep->com.so; in set_tcpinfo()
513 log(LOG_ERR, "%s: connection not offloaded (so %p, ep %p)\n", in set_tcpinfo()
514 __func__, so, ep); in set_tcpinfo()
519 ep->hwtid = toep->tid; in set_tcpinfo()
520 ep->snd_seq = tp->snd_nxt; in set_tcpinfo()
521 ep->rcv_seq = tp->rcv_nxt; in set_tcpinfo()
566 process_peer_close(struct c4iw_ep *ep) in process_peer_close() argument
572 CTR4(KTR_IW_CXGBE, "%s:ppcB ep %p so %p state %s", __func__, ep, in process_peer_close()
573 ep->com.so, states[ep->com.state]); in process_peer_close()
575 switch (ep->com.state) { in process_peer_close()
579 __func__, ep); in process_peer_close()
583 __func__, ep); in process_peer_close()
584 ep->com.state = DEAD; in process_peer_close()
585 connect_reply_upcall(ep, -ECONNABORTED); in process_peer_close()
588 STOP_EP_TIMER(ep); in process_peer_close()
589 close_socket(ep->com.so); in process_peer_close()
590 deref_cm_id(&ep->com); in process_peer_close()
602 __func__, ep); in process_peer_close()
603 ep->com.state = CLOSING; in process_peer_close()
608 __func__, ep); in process_peer_close()
609 ep->com.state = CLOSING; in process_peer_close()
614 __func__, ep); in process_peer_close()
615 START_EP_TIMER(ep); in process_peer_close()
616 ep->com.state = CLOSING; in process_peer_close()
618 c4iw_modify_qp(ep->com.dev, ep->com.qp, in process_peer_close()
620 peer_close_upcall(ep); in process_peer_close()
625 __func__, ep); in process_peer_close()
631 __func__, ep); in process_peer_close()
632 ep->com.state = MORIBUND; in process_peer_close()
638 ep); in process_peer_close()
639 STOP_EP_TIMER(ep); in process_peer_close()
640 if (ep->com.cm_id && ep->com.qp) { in process_peer_close()
642 c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, in process_peer_close()
645 close_socket(ep->com.so); in process_peer_close()
646 close_complete_upcall(ep, 0); in process_peer_close()
647 ep->com.state = DEAD; in process_peer_close()
654 __func__, ep); in process_peer_close()
659 panic("%s: ep %p state %d", __func__, ep, in process_peer_close()
660 ep->com.state); in process_peer_close()
667 CTR2(KTR_IW_CXGBE, "%s:ppca %p", __func__, ep); in process_peer_close()
668 c4iw_ep_disconnect(ep, 0, M_NOWAIT); in process_peer_close()
672 CTR2(KTR_IW_CXGBE, "%s:ppcb %p", __func__, ep); in process_peer_close()
673 c4iw_put_ep(&ep->com); in process_peer_close()
675 CTR2(KTR_IW_CXGBE, "%s:ppcE %p", __func__, ep); in process_peer_close()
680 process_conn_error(struct c4iw_ep *ep) in process_conn_error() argument
686 state = ep->com.state; in process_conn_error()
687 CTR5(KTR_IW_CXGBE, "%s:pceB ep %p so %p so->so_error %u state %s", in process_conn_error()
688 __func__, ep, ep->com.so, ep->com.so->so_error, in process_conn_error()
689 states[ep->com.state]); in process_conn_error()
694 STOP_EP_TIMER(ep); in process_conn_error()
695 c4iw_put_ep(&ep->parent_ep->com); in process_conn_error()
699 STOP_EP_TIMER(ep); in process_conn_error()
700 connect_reply_upcall(ep, -ECONNRESET); in process_conn_error()
704 ep->com.rpl_err = ECONNRESET; in process_conn_error()
705 CTR1(KTR_IW_CXGBE, "waking up ep %p", ep); in process_conn_error()
713 STOP_EP_TIMER(ep); in process_conn_error()
717 if (ep->com.cm_id && ep->com.qp) { in process_conn_error()
720 ret = c4iw_modify_qp(ep->com.qp->rhp, in process_conn_error()
721 ep->com.qp, C4IW_QP_ATTR_NEXT_STATE, in process_conn_error()
728 peer_abort_upcall(ep); in process_conn_error()
736 __func__, ep->com.so->so_error); in process_conn_error()
740 panic("%s: ep %p state %d", __func__, ep, state); in process_conn_error()
745 close_socket(ep->com.so); in process_conn_error()
746 ep->com.state = DEAD; in process_conn_error()
747 c4iw_put_ep(&ep->com); in process_conn_error()
749 CTR2(KTR_IW_CXGBE, "%s:pceE %p", __func__, ep); in process_conn_error()
754 process_close_complete(struct c4iw_ep *ep) in process_close_complete() argument
759 CTR4(KTR_IW_CXGBE, "%s:pccB ep %p so %p state %s", __func__, ep, in process_close_complete()
760 ep->com.so, states[ep->com.state]); in process_close_complete()
763 set_bit(CLOSE_CON_RPL, &ep->com.history); in process_close_complete()
765 switch (ep->com.state) { in process_close_complete()
769 __func__, ep); in process_close_complete()
770 ep->com.state = MORIBUND; in process_close_complete()
775 ep); in process_close_complete()
776 STOP_EP_TIMER(ep); in process_close_complete()
778 if ((ep->com.cm_id) && (ep->com.qp)) { in process_close_complete()
781 __func__, ep); in process_close_complete()
783 c4iw_modify_qp(ep->com.dev, in process_close_complete()
784 ep->com.qp, in process_close_complete()
789 close_socket(ep->com.so); in process_close_complete()
790 close_complete_upcall(ep, 0); in process_close_complete()
791 ep->com.state = DEAD; in process_close_complete()
796 CTR2(KTR_IW_CXGBE, "%s:pcc5 %p ABORTING", __func__, ep); in process_close_complete()
800 CTR2(KTR_IW_CXGBE, "%s:pcc6 %p DEAD", __func__, ep); in process_close_complete()
803 CTR2(KTR_IW_CXGBE, "%s:pcc7 %p unknown ep state", in process_close_complete()
804 __func__, ep); in process_close_complete()
805 panic("%s:pcc6 %p unknown ep state", __func__, ep); in process_close_complete()
811 CTR2(KTR_IW_CXGBE, "%s:pcc8 %p", __func__, ep); in process_close_complete()
812 release_ep_resources(ep); in process_close_complete()
814 CTR2(KTR_IW_CXGBE, "%s:pccE %p", __func__, ep); in process_close_complete()
869 process_data(struct c4iw_ep *ep) in process_data() argument
875 CTR5(KTR_IW_CXGBE, "%s: so %p, ep %p, state %s, sbused %d", __func__, in process_data()
876 ep->com.so, ep, states[ep->com.state], sbused(&ep->com.so->so_rcv)); in process_data()
878 switch (ep->com.state) { in process_data()
880 disconnect = process_mpa_reply(ep); in process_data()
883 disconnect = process_mpa_request(ep); in process_data()
886 c4iw_put_ep(&ep->parent_ep->com); in process_data()
889 MPASS(ep->com.qp != NULL); in process_data()
891 ret = c4iw_modify_qp(ep->com.dev, ep->com.qp, in process_data()
897 log(LOG_ERR, "%s: Unexpected streaming data. ep %p, " in process_data()
899 __func__, ep, ep->com.state, ep->com.so, in process_data()
900 ep->com.so->so_state, sbused(&ep->com.so->so_rcv)); in process_data()
904 c4iw_ep_disconnect(ep, disconnect == 2, GFP_KERNEL); in process_data()
909 process_connected(struct c4iw_ep *ep) in process_connected() argument
911 struct socket *so = ep->com.so; in process_connected()
914 if (send_mpa_req(ep)) in process_connected()
917 connect_reply_upcall(ep, -so->so_error); in process_connected()
923 ep->com.state = DEAD; in process_connected()
924 c4iw_put_ep(&ep->com); in process_connected()
980 * created 'ep' can be attached to the real 'lep'. in process_newconn()
985 "ep for sock: %p", __func__, new_so); in process_newconn()
986 log(LOG_ERR,"%s: Could not find the real listen ep for " in process_newconn()
999 CTR6(KTR_IW_CXGBE, "%s: master_lep %p, real_lep: %p, new ep %p, " in process_newconn()
1034 avoid freeing of ep before ep unlock. */ in process_newconn()
1050 add_ep_to_req_list(struct c4iw_ep *ep, int new_ep_event) in add_ep_to_req_list() argument
1055 if (ep && ep->com.so) { in add_ep_to_req_list()
1056 ep->com.ep_events |= new_ep_event; in add_ep_to_req_list()
1057 if (!ep->com.entry.tqe_prev) { in add_ep_to_req_list()
1058 c4iw_get_ep(&ep->com); in add_ep_to_req_list()
1059 TAILQ_INSERT_TAIL(&req_list, &ep->com, entry); in add_ep_to_req_list()
1071 struct c4iw_ep *ep = arg; in c4iw_so_upcall() local
1074 "%s: so %p, so_state 0x%x, ep %p, ep_state %s, tqe_prev %p", in c4iw_so_upcall()
1075 __func__, so, so->so_state, ep, states[ep->com.state], in c4iw_so_upcall()
1076 ep->com.entry.tqe_prev); in c4iw_so_upcall()
1078 MPASS(ep->com.so == so); in c4iw_so_upcall()
1083 if (so->so_error || c4iw_stopped(&ep->com.dev->rdev)) in c4iw_so_upcall()
1084 c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET); in c4iw_so_upcall()
1085 add_ep_to_req_list(ep, C4IW_EVENT_SOCKET); in c4iw_so_upcall()
1099 struct c4iw_ep *ep; in terminate() local
1103 ep = so->so_rcv.sb_upcallarg; in terminate()
1106 CTR3(KTR_IW_CXGBE, "%s: so %p, ep %p", __func__, so, ep); in terminate()
1107 add_ep_to_req_list(ep, C4IW_EVENT_TERM); in terminate()
1113 process_socket_event(struct c4iw_ep *ep) in process_socket_event() argument
1115 int state = ep->com.state; in process_socket_event()
1116 struct socket *so = ep->com.so; in process_socket_event()
1118 if (ep->com.state == DEAD) { in process_socket_event()
1120 "ep %p ep_state %s", __func__, ep, states[state]); in process_socket_event()
1125 "so_err %d, sb_state 0x%x, ep %p, ep_state %s", so, so->so_state, in process_socket_event()
1126 so->so_error, so->so_rcv.sb_state, ep, states[state]); in process_socket_event()
1129 process_connected(ep); in process_socket_event()
1134 struct c4iw_listen_ep *lep = (struct c4iw_listen_ep *)ep; in process_socket_event()
1162 process_conn_error(ep); in process_socket_event()
1168 process_peer_close(ep); in process_socket_event()
1179 process_close_complete(ep); in process_socket_event()
1184 if (sbused(&ep->com.so->so_rcv)) { in process_socket_event()
1185 process_data(ep); in process_socket_event()
1194 MPASS((ep->com.state == MPA_REQ_RCVD) || (ep->com.state == MORIBUND)); in process_socket_event()
1196 if ((ep->com.state != MPA_REQ_RCVD) && (ep->com.state != MORIBUND)) in process_socket_event()
1198 "so_state 0x%x, so_err %d, sb_state 0x%x, ep %p, ep_state %s\n", in process_socket_event()
1200 ep, states[state]); in process_socket_event()
1276 start_ep_timer(struct c4iw_ep *ep) in start_ep_timer() argument
1279 if (timer_pending(&ep->timer)) { in start_ep_timer()
1280 CTR2(KTR_IW_CXGBE, "%s: ep %p, already started", __func__, ep); in start_ep_timer()
1281 printk(KERN_ERR "%s timer already started! ep %p\n", __func__, in start_ep_timer()
1282 ep); in start_ep_timer()
1285 clear_bit(TIMEOUT, &ep->com.flags); in start_ep_timer()
1286 c4iw_get_ep(&ep->com); in start_ep_timer()
1287 ep->timer.expires = jiffies + ep_timeout_secs * HZ; in start_ep_timer()
1288 ep->timer.data = (unsigned long)ep; in start_ep_timer()
1289 ep->timer.function = ep_timeout; in start_ep_timer()
1290 add_timer(&ep->timer); in start_ep_timer()
1294 stop_ep_timer(struct c4iw_ep *ep) in stop_ep_timer() argument
1297 del_timer_sync(&ep->timer); in stop_ep_timer()
1298 if (!test_and_set_bit(TIMEOUT, &ep->com.flags)) { in stop_ep_timer()
1299 c4iw_put_ep(&ep->com); in stop_ep_timer()
1323 struct c4iw_ep *ep; in _c4iw_free_ep() local
1328 ep = container_of(kref, struct c4iw_ep, com.kref); in _c4iw_free_ep()
1330 epc = &ep->com; in _c4iw_free_ep()
1334 if (test_bit(QP_REFERENCED, &ep->com.flags)) in _c4iw_free_ep()
1335 deref_qp(ep); in _c4iw_free_ep()
1336 CTR4(KTR_IW_CXGBE, "%s: ep %p, history 0x%lx, flags 0x%lx", in _c4iw_free_ep()
1337 __func__, ep, epc->history, epc->flags); in _c4iw_free_ep()
1338 kfree(ep); in _c4iw_free_ep()
1341 static void release_ep_resources(struct c4iw_ep *ep) in release_ep_resources() argument
1343 CTR2(KTR_IW_CXGBE, "%s:rerB %p", __func__, ep); in release_ep_resources()
1344 set_bit(RELEASE_RESOURCES, &ep->com.flags); in release_ep_resources()
1345 c4iw_put_ep(&ep->com); in release_ep_resources()
1346 CTR2(KTR_IW_CXGBE, "%s:rerE %p", __func__, ep); in release_ep_resources()
1350 send_mpa_req(struct c4iw_ep *ep) in send_mpa_req() argument
1359 if (ep->retry_with_mpa_v1) in send_mpa_req()
1361 mpalen = sizeof(*mpa) + ep->plen; in send_mpa_req()
1368 CTR3(KTR_IW_CXGBE, "%s:smr1 ep: %p , error: %d", in send_mpa_req()
1369 __func__, ep, err); in send_mpa_req()
1378 mpa->private_data_size = htons(ep->plen); in send_mpa_req()
1382 ep->tried_with_mpa_v1 = 1; in send_mpa_req()
1383 ep->retry_with_mpa_v1 = 0; in send_mpa_req()
1389 mpa_v2_params.ird = htons((u16)ep->ird); in send_mpa_req()
1390 mpa_v2_params.ord = htons((u16)ep->ord); in send_mpa_req()
1406 if (ep->plen) { in send_mpa_req()
1410 ep->mpa_pkt + sizeof(*mpa), ep->plen); in send_mpa_req()
1414 if (ep->plen) in send_mpa_req()
1416 ep->mpa_pkt + sizeof(*mpa), ep->plen); in send_mpa_req()
1417 CTR2(KTR_IW_CXGBE, "%s:smr7 %p", __func__, ep); in send_mpa_req()
1423 CTR3(KTR_IW_CXGBE, "%s:smr2 ep: %p , error: %d", in send_mpa_req()
1424 __func__, ep, err); in send_mpa_req()
1431 err = -sosend(ep->com.so, NULL, NULL, m, NULL, MSG_DONTWAIT, in send_mpa_req()
1432 ep->com.thread); in send_mpa_req()
1434 CTR3(KTR_IW_CXGBE, "%s:smr3 ep: %p , error: %d", in send_mpa_req()
1435 __func__, ep, err); in send_mpa_req()
1439 START_EP_TIMER(ep); in send_mpa_req()
1440 ep->com.state = MPA_REQ_SENT; in send_mpa_req()
1441 ep->mpa_attr.initiator = 1; in send_mpa_req()
1442 CTR3(KTR_IW_CXGBE, "%s:smrE %p, error: %d", __func__, ep, err); in send_mpa_req()
1445 connect_reply_upcall(ep, err); in send_mpa_req()
1446 CTR3(KTR_IW_CXGBE, "%s:smrE %p, error: %d", __func__, ep, err); in send_mpa_req()
1450 static int send_mpa_reject(struct c4iw_ep *ep, const void *pdata, u8 plen) in send_mpa_reject() argument
1458 CTR4(KTR_IW_CXGBE, "%s:smrejB %p %u %d", __func__, ep, ep->hwtid, in send_mpa_reject()
1459 ep->plen); in send_mpa_reject()
1463 if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) { in send_mpa_reject()
1466 CTR4(KTR_IW_CXGBE, "%s:smrej1 %p %u %d", __func__, ep, in send_mpa_reject()
1467 ep->mpa_attr.version, mpalen); in send_mpa_reject()
1480 if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) { in send_mpa_reject()
1485 mpa_v2_params.ird = htons(((u16)ep->ird) | in send_mpa_reject()
1488 mpa_v2_params.ord = htons(((u16)ep->ord) | (peer2peer ? in send_mpa_reject()
1497 if (ep->plen) in send_mpa_reject()
1500 CTR5(KTR_IW_CXGBE, "%s:smrej3 %p %d %d %d", __func__, ep, in send_mpa_reject()
1501 mpa_v2_params.ird, mpa_v2_params.ord, ep->plen); in send_mpa_reject()
1514 err = -sosend(ep->com.so, NULL, NULL, m, NULL, MSG_DONTWAIT, ep->com.thread); in send_mpa_reject()
1516 ep->snd_seq += mpalen; in send_mpa_reject()
1517 CTR4(KTR_IW_CXGBE, "%s:smrejE %p %u %d", __func__, ep, ep->hwtid, err); in send_mpa_reject()
1521 static int send_mpa_reply(struct c4iw_ep *ep, const void *pdata, u8 plen) in send_mpa_reply() argument
1529 CTR2(KTR_IW_CXGBE, "%s:smrepB %p", __func__, ep); in send_mpa_reply()
1533 if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) { in send_mpa_reply()
1535 CTR3(KTR_IW_CXGBE, "%s:smrep1 %p %d", __func__, ep, in send_mpa_reply()
1536 ep->mpa_attr.version); in send_mpa_reply()
1546 mpa->flags = (ep->mpa_attr.crc_enabled ? MPA_CRC : 0) | in send_mpa_reply()
1548 mpa->revision = ep->mpa_attr.version; in send_mpa_reply()
1551 if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) { in send_mpa_reply()
1556 mpa_v2_params.ird = htons((u16)ep->ird); in send_mpa_reply()
1557 mpa_v2_params.ord = htons((u16)ep->ord); in send_mpa_reply()
1558 CTR5(KTR_IW_CXGBE, "%s:smrep3 %p %d %d %d", __func__, ep, in send_mpa_reply()
1559 ep->mpa_attr.version, mpa_v2_params.ird, mpa_v2_params.ord); in send_mpa_reply()
1561 if (peer2peer && (ep->mpa_attr.p2p_type != in send_mpa_reply()
1571 __func__, ep, p2p_type, mpa_v2_params.ird, in send_mpa_reply()
1579 __func__, ep, p2p_type, mpa_v2_params.ird, in send_mpa_reply()
1587 if (ep->plen) in send_mpa_reply()
1603 ep->com.state = MPA_REP_SENT; in send_mpa_reply()
1604 ep->snd_seq += mpalen; in send_mpa_reply()
1605 err = -sosend(ep->com.so, NULL, NULL, m, NULL, MSG_DONTWAIT, in send_mpa_reply()
1606 ep->com.thread); in send_mpa_reply()
1607 CTR3(KTR_IW_CXGBE, "%s:smrepE %p %d", __func__, ep, err); in send_mpa_reply()
1613 static void close_complete_upcall(struct c4iw_ep *ep, int status) in close_complete_upcall() argument
1617 CTR2(KTR_IW_CXGBE, "%s:ccuB %p", __func__, ep); in close_complete_upcall()
1622 if (ep->com.cm_id) { in close_complete_upcall()
1624 CTR2(KTR_IW_CXGBE, "%s:ccu1 %1", __func__, ep); in close_complete_upcall()
1625 ep->com.cm_id->event_handler(ep->com.cm_id, &event); in close_complete_upcall()
1626 deref_cm_id(&ep->com); in close_complete_upcall()
1627 set_bit(CLOSE_UPCALL, &ep->com.history); in close_complete_upcall()
1629 CTR2(KTR_IW_CXGBE, "%s:ccuE %p", __func__, ep); in close_complete_upcall()
1633 send_abort(struct c4iw_ep *ep) in send_abort() argument
1635 struct socket *so = ep->com.so; in send_abort()
1640 CTR5(KTR_IW_CXGBE, "%s ep %p so %p state %s tid %d", __func__, ep, so, in send_abort()
1641 states[ep->com.state], ep->hwtid); in send_abort()
1661 set_bit(ABORT_CONN, &ep->com.history); in send_abort()
1667 * around de-refererece 'ep' here instead of doing it in abort_rpl() in send_abort()
1670 release_ep_resources(ep); in send_abort()
1671 ep->com.state = DEAD; in send_abort()
1676 static void peer_close_upcall(struct c4iw_ep *ep) in peer_close_upcall() argument
1680 CTR2(KTR_IW_CXGBE, "%s:pcuB %p", __func__, ep); in peer_close_upcall()
1684 if (ep->com.cm_id) { in peer_close_upcall()
1686 CTR2(KTR_IW_CXGBE, "%s:pcu1 %p", __func__, ep); in peer_close_upcall()
1687 ep->com.cm_id->event_handler(ep->com.cm_id, &event); in peer_close_upcall()
1688 set_bit(DISCONN_UPCALL, &ep->com.history); in peer_close_upcall()
1690 CTR2(KTR_IW_CXGBE, "%s:pcuE %p", __func__, ep); in peer_close_upcall()
1693 static void peer_abort_upcall(struct c4iw_ep *ep) in peer_abort_upcall() argument
1697 CTR2(KTR_IW_CXGBE, "%s:pauB %p", __func__, ep); in peer_abort_upcall()
1702 if (ep->com.cm_id) { in peer_abort_upcall()
1704 CTR2(KTR_IW_CXGBE, "%s:pau1 %p", __func__, ep); in peer_abort_upcall()
1705 ep->com.cm_id->event_handler(ep->com.cm_id, &event); in peer_abort_upcall()
1706 deref_cm_id(&ep->com); in peer_abort_upcall()
1707 set_bit(ABORT_UPCALL, &ep->com.history); in peer_abort_upcall()
1709 CTR2(KTR_IW_CXGBE, "%s:pauE %p", __func__, ep); in peer_abort_upcall()
1712 static void connect_reply_upcall(struct c4iw_ep *ep, int status) in connect_reply_upcall() argument
1716 CTR3(KTR_IW_CXGBE, "%s:cruB %p, status: %d", __func__, ep, status); in connect_reply_upcall()
1721 event.local_addr = ep->com.local_addr; in connect_reply_upcall()
1722 event.remote_addr = ep->com.remote_addr; in connect_reply_upcall()
1726 if (!ep->tried_with_mpa_v1) { in connect_reply_upcall()
1728 CTR2(KTR_IW_CXGBE, "%s:cru1 %p", __func__, ep); in connect_reply_upcall()
1730 event.ord = ep->ird; in connect_reply_upcall()
1731 event.ird = ep->ord; in connect_reply_upcall()
1732 event.private_data_len = ep->plen - in connect_reply_upcall()
1734 event.private_data = ep->mpa_pkt + in connect_reply_upcall()
1739 CTR2(KTR_IW_CXGBE, "%s:cru2 %p", __func__, ep); in connect_reply_upcall()
1743 event.private_data_len = ep->plen; in connect_reply_upcall()
1744 event.private_data = ep->mpa_pkt + in connect_reply_upcall()
1749 if (ep->com.cm_id) { in connect_reply_upcall()
1751 CTR2(KTR_IW_CXGBE, "%s:cru3 %p", __func__, ep); in connect_reply_upcall()
1752 set_bit(CONN_RPL_UPCALL, &ep->com.history); in connect_reply_upcall()
1753 ep->com.cm_id->event_handler(ep->com.cm_id, &event); in connect_reply_upcall()
1758 CTR3(KTR_IW_CXGBE, "%s:cruE %p %d", __func__, ep, status); in connect_reply_upcall()
1764 CTR3(KTR_IW_CXGBE, "%s:cru4 %p %d", __func__, ep, status); in connect_reply_upcall()
1765 deref_cm_id(&ep->com); in connect_reply_upcall()
1768 CTR2(KTR_IW_CXGBE, "%s:cruE %p", __func__, ep); in connect_reply_upcall()
1771 static int connect_request_upcall(struct c4iw_ep *ep) in connect_request_upcall() argument
1776 CTR3(KTR_IW_CXGBE, "%s: ep %p, mpa_v1 %d", __func__, ep, in connect_request_upcall()
1777 ep->tried_with_mpa_v1); in connect_request_upcall()
1781 event.local_addr = ep->com.local_addr; in connect_request_upcall()
1782 event.remote_addr = ep->com.remote_addr; in connect_request_upcall()
1783 event.provider_data = ep; in connect_request_upcall()
1785 if (!ep->tried_with_mpa_v1) { in connect_request_upcall()
1787 event.ord = ep->ord; in connect_request_upcall()
1788 event.ird = ep->ird; in connect_request_upcall()
1789 event.private_data_len = ep->plen - in connect_request_upcall()
1791 event.private_data = ep->mpa_pkt + sizeof(struct mpa_message) + in connect_request_upcall()
1798 event.private_data_len = ep->plen; in connect_request_upcall()
1799 event.private_data = ep->mpa_pkt + sizeof(struct mpa_message); in connect_request_upcall()
1802 c4iw_get_ep(&ep->com); in connect_request_upcall()
1803 ret = ep->parent_ep->com.cm_id->event_handler(ep->parent_ep->com.cm_id, in connect_request_upcall()
1806 CTR3(KTR_IW_CXGBE, "%s: ep %p, Failure while notifying event to" in connect_request_upcall()
1807 " IWCM, err:%d", __func__, ep, ret); in connect_request_upcall()
1808 c4iw_put_ep(&ep->com); in connect_request_upcall()
1814 c4iw_put_ep(&ep->parent_ep->com); in connect_request_upcall()
1816 set_bit(CONNREQ_UPCALL, &ep->com.history); in connect_request_upcall()
1820 static void established_upcall(struct c4iw_ep *ep) in established_upcall() argument
1824 CTR2(KTR_IW_CXGBE, "%s:euB %p", __func__, ep); in established_upcall()
1827 event.ird = ep->ord; in established_upcall()
1828 event.ord = ep->ird; in established_upcall()
1830 if (ep->com.cm_id) { in established_upcall()
1832 CTR2(KTR_IW_CXGBE, "%s:eu1 %p", __func__, ep); in established_upcall()
1833 ep->com.cm_id->event_handler(ep->com.cm_id, &event); in established_upcall()
1834 set_bit(ESTAB_UPCALL, &ep->com.history); in established_upcall()
1836 CTR2(KTR_IW_CXGBE, "%s:euE %p", __func__, ep); in established_upcall()
1854 static int process_mpa_reply(struct c4iw_ep *ep) in process_mpa_reply() argument
1869 CTR2(KTR_IW_CXGBE, "%s:pmrB %p", __func__, ep); in process_mpa_reply()
1876 if (STOP_EP_TIMER(ep)) in process_mpa_reply()
1880 uio.uio_td = ep->com.thread; in process_mpa_reply()
1881 err = soreceive(ep->com.so, NULL, &uio, &top, NULL, &flags); in process_mpa_reply()
1887 CTR2(KTR_IW_CXGBE, "%s:pmr1 %p", __func__, ep); in process_mpa_reply()
1888 START_EP_TIMER(ep); in process_mpa_reply()
1892 CTR2(KTR_IW_CXGBE, "%s:pmr2 %p", __func__, ep); in process_mpa_reply()
1896 if (ep->com.so->so_rcv.sb_mb) { in process_mpa_reply()
1898 CTR2(KTR_IW_CXGBE, "%s:pmr3 %p", __func__, ep); in process_mpa_reply()
1900 __func__, ep->com.so, ep->com.so->so_rcv.sb_mb, top); in process_mpa_reply()
1907 CTR2(KTR_IW_CXGBE, "%s:pmr4 %p", __func__, ep); in process_mpa_reply()
1912 if (ep->mpa_pkt_len + m->m_len > sizeof(ep->mpa_pkt)) { in process_mpa_reply()
1914 CTR3(KTR_IW_CXGBE, "%s:pmr5 %p %d", __func__, ep, in process_mpa_reply()
1915 ep->mpa_pkt_len + m->m_len); in process_mpa_reply()
1923 m_copydata(m, 0, m->m_len, &(ep->mpa_pkt[ep->mpa_pkt_len])); in process_mpa_reply()
1924 ep->mpa_pkt_len += m->m_len; in process_mpa_reply()
1935 if (ep->mpa_pkt_len < sizeof(*mpa)) { in process_mpa_reply()
1938 mpa = (struct mpa_message *) ep->mpa_pkt; in process_mpa_reply()
1943 CTR4(KTR_IW_CXGBE, "%s:pmr6 %p %d %d", __func__, ep, in process_mpa_reply()
1953 CTR2(KTR_IW_CXGBE, "%s:pmr7 %p", __func__, ep); in process_mpa_reply()
1965 CTR2(KTR_IW_CXGBE, "%s:pmr8 %p", __func__, ep); in process_mpa_reply()
1973 if (ep->mpa_pkt_len > (sizeof(*mpa) + plen)) { in process_mpa_reply()
1975 CTR2(KTR_IW_CXGBE, "%s:pmr9 %p", __func__, ep); in process_mpa_reply()
1976 STOP_EP_TIMER(ep); in process_mpa_reply()
1981 ep->plen = (u8) plen; in process_mpa_reply()
1987 if (ep->mpa_pkt_len < (sizeof(*mpa) + plen)) { in process_mpa_reply()
1989 CTR2(KTR_IW_CXGBE, "%s:pmra %p", __func__, ep); in process_mpa_reply()
1995 CTR2(KTR_IW_CXGBE, "%s:pmrb %p", __func__, ep); in process_mpa_reply()
2005 ep->com.state = FPDU_MODE; in process_mpa_reply()
2006 ep->mpa_attr.crc_enabled = (mpa->flags & MPA_CRC) | crc_enabled ? 1 : 0; in process_mpa_reply()
2007 ep->mpa_attr.recv_marker_enabled = markers_enabled; in process_mpa_reply()
2008 ep->mpa_attr.xmit_marker_enabled = mpa->flags & MPA_MARKERS ? 1 : 0; in process_mpa_reply()
2009 ep->mpa_attr.version = mpa->revision; in process_mpa_reply()
2010 ep->mpa_attr.p2p_type = FW_RI_INIT_P2PTYPE_DISABLED; in process_mpa_reply()
2014 CTR2(KTR_IW_CXGBE, "%s:pmrc %p", __func__, ep); in process_mpa_reply()
2015 ep->mpa_attr.enhanced_rdma_conn = in process_mpa_reply()
2018 if (ep->mpa_attr.enhanced_rdma_conn) { in process_mpa_reply()
2020 CTR2(KTR_IW_CXGBE, "%s:pmrd %p", __func__, ep); in process_mpa_reply()
2022 (ep->mpa_pkt + sizeof(*mpa)); in process_mpa_reply()
2033 if (ep->ird < resp_ord) { in process_mpa_reply()
2035 ep->com.dev->rdev.adap->params.max_ordird_qp) in process_mpa_reply()
2036 ep->ird = resp_ord; in process_mpa_reply()
2039 } else if (ep->ird > resp_ord) { in process_mpa_reply()
2040 ep->ird = resp_ord; in process_mpa_reply()
2042 if (ep->ord > resp_ird) { in process_mpa_reply()
2044 ep->ord = resp_ird; in process_mpa_reply()
2050 ep->ird = resp_ord; in process_mpa_reply()
2051 ep->ord = resp_ird; in process_mpa_reply()
2057 CTR2(KTR_IW_CXGBE, "%s:pmrf %p", __func__, ep); in process_mpa_reply()
2061 CTR2(KTR_IW_CXGBE, "%s:pmrg %p", __func__, ep); in process_mpa_reply()
2062 ep->mpa_attr.p2p_type = in process_mpa_reply()
2068 CTR2(KTR_IW_CXGBE, "%s:pmrh %p", __func__, ep); in process_mpa_reply()
2069 ep->mpa_attr.p2p_type = in process_mpa_reply()
2076 CTR2(KTR_IW_CXGBE, "%s:pmri %p", __func__, ep); in process_mpa_reply()
2080 CTR2(KTR_IW_CXGBE, "%s:pmrj %p", __func__, ep); in process_mpa_reply()
2084 CTR2(KTR_IW_CXGBE, "%s:pmrk %p", __func__, ep); in process_mpa_reply()
2085 ep->mpa_attr.p2p_type = p2p_type; in process_mpa_reply()
2090 if (set_tcpinfo(ep)) { in process_mpa_reply()
2092 CTR2(KTR_IW_CXGBE, "%s:pmrl %p", __func__, ep); in process_mpa_reply()
2100 ep->mpa_attr.crc_enabled, ep->mpa_attr.recv_marker_enabled, in process_mpa_reply()
2101 ep->mpa_attr.xmit_marker_enabled, ep->mpa_attr.version, in process_mpa_reply()
2102 ep->mpa_attr.p2p_type); in process_mpa_reply()
2110 if ((ep->mpa_attr.version == 2) && peer2peer && in process_mpa_reply()
2111 (ep->mpa_attr.p2p_type != p2p_type)) { in process_mpa_reply()
2113 CTR2(KTR_IW_CXGBE, "%s:pmrm %p", __func__, ep); in process_mpa_reply()
2114 ep->mpa_attr.p2p_type = FW_RI_INIT_P2PTYPE_DISABLED; in process_mpa_reply()
2119 //ep->ofld_txq = TOEPCB(ep->com.so)->ofld_txq; in process_mpa_reply()
2120 attrs.mpa_attr = ep->mpa_attr; in process_mpa_reply()
2121 attrs.max_ird = ep->ird; in process_mpa_reply()
2122 attrs.max_ord = ep->ord; in process_mpa_reply()
2123 attrs.llp_stream_handle = ep; in process_mpa_reply()
2131 err = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, mask, &attrs, 1); in process_mpa_reply()
2135 CTR2(KTR_IW_CXGBE, "%s:pmrn %p", __func__, ep); in process_mpa_reply()
2145 CTR2(KTR_IW_CXGBE, "%s:pmro %p", __func__, ep); in process_mpa_reply()
2151 err = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, in process_mpa_reply()
2166 CTR2(KTR_IW_CXGBE, "%s:pmrp %p", __func__, ep); in process_mpa_reply()
2173 err = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, in process_mpa_reply()
2181 STOP_EP_TIMER(ep); in process_mpa_reply()
2185 connect_reply_upcall(ep, err); in process_mpa_reply()
2186 CTR2(KTR_IW_CXGBE, "%s:pmrE %p", __func__, ep); in process_mpa_reply()
2203 process_mpa_request(struct c4iw_ep *ep) in process_mpa_request() argument
2212 enum c4iw_ep_state state = ep->com.state; in process_mpa_request()
2214 CTR3(KTR_IW_CXGBE, "%s: ep %p, state %s", __func__, ep, states[state]); in process_mpa_request()
2219 iov.iov_base = &ep->mpa_pkt[ep->mpa_pkt_len]; in process_mpa_request()
2220 iov.iov_len = sizeof(ep->mpa_pkt) - ep->mpa_pkt_len; in process_mpa_request()
2224 uio.uio_resid = sizeof(ep->mpa_pkt) - ep->mpa_pkt_len; in process_mpa_request()
2227 uio.uio_td = NULL; /* uio.uio_td = ep->com.thread; */ in process_mpa_request()
2229 rc = soreceive(ep->com.so, NULL, &uio, NULL, NULL, &flags); in process_mpa_request()
2236 __func__, ep->com.so)); in process_mpa_request()
2237 ep->mpa_pkt_len += uio.uio_offset; in process_mpa_request()
2247 if (ep->mpa_pkt_len < sizeof(*mpa)) in process_mpa_request()
2249 mpa = (struct mpa_message *) ep->mpa_pkt; in process_mpa_request()
2273 if (ep->mpa_pkt_len > (sizeof(*mpa) + plen)) in process_mpa_request()
2276 ep->plen = (u8) plen; in process_mpa_request()
2281 if (ep->mpa_pkt_len < (sizeof(*mpa) + plen)) in process_mpa_request()
2288 ep->mpa_attr.initiator = 0; in process_mpa_request()
2289 ep->mpa_attr.crc_enabled = (mpa->flags & MPA_CRC) | crc_enabled ? 1 : 0; in process_mpa_request()
2290 ep->mpa_attr.recv_marker_enabled = markers_enabled; in process_mpa_request()
2291 ep->mpa_attr.xmit_marker_enabled = mpa->flags & MPA_MARKERS ? 1 : 0; in process_mpa_request()
2292 ep->mpa_attr.version = mpa->revision; in process_mpa_request()
2294 ep->tried_with_mpa_v1 = 1; in process_mpa_request()
2295 ep->mpa_attr.p2p_type = FW_RI_INIT_P2PTYPE_DISABLED; in process_mpa_request()
2298 ep->mpa_attr.enhanced_rdma_conn = in process_mpa_request()
2300 if (ep->mpa_attr.enhanced_rdma_conn) { in process_mpa_request()
2302 (ep->mpa_pkt + sizeof(*mpa)); in process_mpa_request()
2303 ep->ird = ntohs(mpa_v2_params->ird) & in process_mpa_request()
2305 ep->ird = min_t(u32, ep->ird, in process_mpa_request()
2306 cur_max_read_depth(ep->com.dev)); in process_mpa_request()
2307 ep->ord = ntohs(mpa_v2_params->ord) & in process_mpa_request()
2309 ep->ord = min_t(u32, ep->ord, in process_mpa_request()
2310 cur_max_read_depth(ep->com.dev)); in process_mpa_request()
2312 __func__, ep->ird, ep->ord); in process_mpa_request()
2317 ep->mpa_attr.p2p_type = in process_mpa_request()
2321 ep->mpa_attr.p2p_type = in process_mpa_request()
2326 ep->mpa_attr.p2p_type = p2p_type; in process_mpa_request()
2328 if (set_tcpinfo(ep)) in process_mpa_request()
2333 ep->mpa_attr.crc_enabled, ep->mpa_attr.recv_marker_enabled, in process_mpa_request()
2334 ep->mpa_attr.xmit_marker_enabled, ep->mpa_attr.version); in process_mpa_request()
2336 ep->com.state = MPA_REQ_RCVD; in process_mpa_request()
2337 STOP_EP_TIMER(ep); in process_mpa_request()
2340 if (ep->parent_ep->com.state != DEAD) in process_mpa_request()
2341 if (connect_request_upcall(ep)) in process_mpa_request()
2346 STOP_EP_TIMER(ep); in process_mpa_request()
2361 struct c4iw_ep *ep = to_ep(cm_id); in c4iw_reject_cr() local
2364 mutex_lock(&ep->com.mutex); in c4iw_reject_cr()
2365 CTR2(KTR_IW_CXGBE, "%s:crcB %p", __func__, ep); in c4iw_reject_cr()
2367 if ((ep->com.state == DEAD) || in c4iw_reject_cr()
2368 (ep->com.state != MPA_REQ_RCVD)) { in c4iw_reject_cr()
2370 CTR2(KTR_IW_CXGBE, "%s:crc1 %p", __func__, ep); in c4iw_reject_cr()
2371 mutex_unlock(&ep->com.mutex); in c4iw_reject_cr()
2372 c4iw_put_ep(&ep->com); in c4iw_reject_cr()
2375 set_bit(ULP_REJECT, &ep->com.history); in c4iw_reject_cr()
2379 CTR2(KTR_IW_CXGBE, "%s:crc2 %p", __func__, ep); in c4iw_reject_cr()
2384 CTR2(KTR_IW_CXGBE, "%s:crc3 %p", __func__, ep); in c4iw_reject_cr()
2385 abort = send_mpa_reject(ep, pdata, pdata_len); in c4iw_reject_cr()
2387 STOP_EP_TIMER(ep); in c4iw_reject_cr()
2389 err = c4iw_ep_disconnect(ep, abort != 0, GFP_KERNEL); in c4iw_reject_cr()
2391 c4iw_ep_disconnect(ep, abort != 0, GFP_KERNEL); in c4iw_reject_cr()
2393 mutex_unlock(&ep->com.mutex); in c4iw_reject_cr()
2394 c4iw_put_ep(&ep->com); in c4iw_reject_cr()
2395 CTR3(KTR_IW_CXGBE, "%s:crc4 %p, err: %d", __func__, ep, err); in c4iw_reject_cr()
2404 struct c4iw_ep *ep = to_ep(cm_id); in c4iw_accept_cr() local
2409 mutex_lock(&ep->com.mutex); in c4iw_accept_cr()
2410 CTR2(KTR_IW_CXGBE, "%s:cacB %p", __func__, ep); in c4iw_accept_cr()
2412 if ((ep->com.state == DEAD) || in c4iw_accept_cr()
2413 (ep->com.state != MPA_REQ_RCVD)) { in c4iw_accept_cr()
2415 CTR2(KTR_IW_CXGBE, "%s:cac1 %p", __func__, ep); in c4iw_accept_cr()
2422 set_bit(ULP_ACCEPT, &ep->com.history); in c4iw_accept_cr()
2427 CTR2(KTR_IW_CXGBE, "%s:cac2 %p", __func__, ep); in c4iw_accept_cr()
2432 if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) { in c4iw_accept_cr()
2434 CTR2(KTR_IW_CXGBE, "%s:cac3 %p", __func__, ep); in c4iw_accept_cr()
2436 if (conn_param->ord > ep->ird) { in c4iw_accept_cr()
2438 conn_param->ord = ep->ird; in c4iw_accept_cr()
2440 ep->ird = conn_param->ird; in c4iw_accept_cr()
2441 ep->ord = conn_param->ord; in c4iw_accept_cr()
2442 send_mpa_reject(ep, conn_param->private_data, in c4iw_accept_cr()
2448 if (conn_param->ird < ep->ord) { in c4iw_accept_cr()
2450 ep->ord <= h->rdev.adap->params.max_ordird_qp) { in c4iw_accept_cr()
2451 conn_param->ird = ep->ord; in c4iw_accept_cr()
2458 ep->ird = conn_param->ird; in c4iw_accept_cr()
2459 ep->ord = conn_param->ord; in c4iw_accept_cr()
2461 if (ep->mpa_attr.version == 1) { in c4iw_accept_cr()
2462 if (peer2peer && ep->ird == 0) in c4iw_accept_cr()
2463 ep->ird = 1; in c4iw_accept_cr()
2466 (ep->mpa_attr.p2p_type != FW_RI_INIT_P2PTYPE_DISABLED) && in c4iw_accept_cr()
2467 (p2p_type == FW_RI_INIT_P2PTYPE_READ_REQ) && ep->ird == 0) in c4iw_accept_cr()
2468 ep->ird = 1; in c4iw_accept_cr()
2472 ep->ird, ep->ord); in c4iw_accept_cr()
2474 ep->com.cm_id = cm_id; in c4iw_accept_cr()
2475 ref_cm_id(&ep->com); in c4iw_accept_cr()
2476 ep->com.qp = qp; in c4iw_accept_cr()
2477 ref_qp(ep); in c4iw_accept_cr()
2478 //ep->ofld_txq = TOEPCB(ep->com.so)->ofld_txq; in c4iw_accept_cr()
2480 /* bind QP to EP and move to RTS */ in c4iw_accept_cr()
2481 attrs.mpa_attr = ep->mpa_attr; in c4iw_accept_cr()
2482 attrs.max_ird = ep->ird; in c4iw_accept_cr()
2483 attrs.max_ord = ep->ord; in c4iw_accept_cr()
2484 attrs.llp_stream_handle = ep; in c4iw_accept_cr()
2494 err = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, mask, &attrs, 1); in c4iw_accept_cr()
2496 CTR3(KTR_IW_CXGBE, "%s:caca %p, err: %d", __func__, ep, err); in c4iw_accept_cr()
2500 err = send_mpa_reply(ep, conn_param->private_data, in c4iw_accept_cr()
2503 CTR3(KTR_IW_CXGBE, "%s:cacb %p, err: %d", __func__, ep, err); in c4iw_accept_cr()
2507 ep->com.state = FPDU_MODE; in c4iw_accept_cr()
2508 established_upcall(ep); in c4iw_accept_cr()
2509 mutex_unlock(&ep->com.mutex); in c4iw_accept_cr()
2510 c4iw_put_ep(&ep->com); in c4iw_accept_cr()
2511 CTR2(KTR_IW_CXGBE, "%s:cacE %p", __func__, ep); in c4iw_accept_cr()
2514 deref_cm_id(&ep->com); in c4iw_accept_cr()
2519 c4iw_ep_disconnect(ep, 1, GFP_KERNEL); in c4iw_accept_cr()
2520 mutex_unlock(&ep->com.mutex); in c4iw_accept_cr()
2521 c4iw_put_ep(&ep->com); in c4iw_accept_cr()
2522 CTR2(KTR_IW_CXGBE, "%s:cacE err %p", __func__, ep); in c4iw_accept_cr()
2595 struct c4iw_ep *ep = NULL; in c4iw_connect() local
2615 ep = alloc_ep(sizeof(*ep), GFP_KERNEL); in c4iw_connect()
2616 cm_id->provider_data = ep; in c4iw_connect()
2618 init_timer(&ep->timer); in c4iw_connect()
2619 ep->plen = conn_param->private_data_len; in c4iw_connect()
2621 if (ep->plen) { in c4iw_connect()
2623 CTR2(KTR_IW_CXGBE, "%s:cc3 %p", __func__, ep); in c4iw_connect()
2624 memcpy(ep->mpa_pkt + sizeof(struct mpa_message), in c4iw_connect()
2625 conn_param->private_data, ep->plen); in c4iw_connect()
2627 ep->ird = conn_param->ird; in c4iw_connect()
2628 ep->ord = conn_param->ord; in c4iw_connect()
2630 if (peer2peer && ep->ord == 0) { in c4iw_connect()
2632 CTR2(KTR_IW_CXGBE, "%s:cc4 %p", __func__, ep); in c4iw_connect()
2633 ep->ord = 1; in c4iw_connect()
2636 ep->com.dev = dev; in c4iw_connect()
2637 ep->com.cm_id = cm_id; in c4iw_connect()
2638 ref_cm_id(&ep->com); in c4iw_connect()
2639 ep->com.qp = get_qhp(dev, conn_param->qpn); in c4iw_connect()
2641 if (!ep->com.qp) { in c4iw_connect()
2643 CTR2(KTR_IW_CXGBE, "%s:cc5 %p", __func__, ep); in c4iw_connect()
2647 ref_qp(ep); in c4iw_connect()
2648 ep->com.thread = curthread; in c4iw_connect()
2658 CTR2(KTR_IW_CXGBE, "%s:cc7 %p", __func__, ep); in c4iw_connect()
2668 ep->com.state = CONNECTING; in c4iw_connect()
2669 ep->tos = 0; in c4iw_connect()
2670 ep->com.local_addr = cm_id->local_addr; in c4iw_connect()
2671 ep->com.remote_addr = cm_id->remote_addr; in c4iw_connect()
2673 err = c4iw_sock_create(&cm_id->local_addr, &ep->com.so); in c4iw_connect()
2677 setiwsockopt(ep->com.so); in c4iw_connect()
2678 init_iwarp_socket(ep->com.so, &ep->com); in c4iw_connect()
2679 err = -soconnect(ep->com.so, (struct sockaddr *)&ep->com.remote_addr, in c4iw_connect()
2680 ep->com.thread); in c4iw_connect()
2683 CTR2(KTR_IW_CXGBE, "%s:ccE, ep %p", __func__, ep); in c4iw_connect()
2687 uninit_iwarp_socket(ep->com.so); in c4iw_connect()
2688 ep->com.state = DEAD; in c4iw_connect()
2689 sock_release(ep->com.so); in c4iw_connect()
2691 deref_cm_id(&ep->com); in c4iw_connect()
2692 c4iw_put_ep(&ep->com); in c4iw_connect()
2693 ep = NULL; in c4iw_connect()
2804 int __c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp) in __c4iw_ep_disconnect() argument
2807 mutex_lock(&ep->com.mutex); in __c4iw_ep_disconnect()
2808 ret = c4iw_ep_disconnect(ep, abrupt, gfp); in __c4iw_ep_disconnect()
2809 mutex_unlock(&ep->com.mutex); in __c4iw_ep_disconnect()
2813 int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp) in c4iw_ep_disconnect() argument
2820 CTR2(KTR_IW_CXGBE, "%s:cedB %p", __func__, ep); in c4iw_ep_disconnect()
2822 rdev = &ep->com.dev->rdev; in c4iw_ep_disconnect()
2825 CTR3(KTR_IW_CXGBE, "%s:ced1 stopped %p %s", __func__, ep, in c4iw_ep_disconnect()
2826 states[ep->com.state]); in c4iw_ep_disconnect()
2827 if (ep->com.state != DEAD) { in c4iw_ep_disconnect()
2828 send_abort(ep); in c4iw_ep_disconnect()
2829 ep->com.state = DEAD; in c4iw_ep_disconnect()
2831 close_complete_upcall(ep, -ECONNRESET); in c4iw_ep_disconnect()
2834 CTR3(KTR_IW_CXGBE, "%s:ced2 %p %s", __func__, ep, in c4iw_ep_disconnect()
2835 states[ep->com.state]); in c4iw_ep_disconnect()
2838 * Ref the ep here in case we have fatal errors causing the in c4iw_ep_disconnect()
2839 * ep to be released and freed. in c4iw_ep_disconnect()
2841 c4iw_get_ep(&ep->com); in c4iw_ep_disconnect()
2842 switch (ep->com.state) { in c4iw_ep_disconnect()
2851 ep->com.state = ABORTING; in c4iw_ep_disconnect()
2853 ep->com.state = CLOSING; in c4iw_ep_disconnect()
2854 START_EP_TIMER(ep); in c4iw_ep_disconnect()
2856 set_bit(CLOSE_SENT, &ep->com.flags); in c4iw_ep_disconnect()
2861 if (!test_and_set_bit(CLOSE_SENT, &ep->com.flags)) { in c4iw_ep_disconnect()
2865 STOP_EP_TIMER(ep); in c4iw_ep_disconnect()
2866 ep->com.state = ABORTING; in c4iw_ep_disconnect()
2868 ep->com.state = MORIBUND; in c4iw_ep_disconnect()
2876 "%s ignoring disconnect ep %p state %u", __func__, in c4iw_ep_disconnect()
2877 ep, ep->com.state); in c4iw_ep_disconnect()
2888 CTR2(KTR_IW_CXGBE, "%s:ced3 %p", __func__, ep); in c4iw_ep_disconnect()
2892 CTR2(KTR_IW_CXGBE, "%s:ced4 %p", __func__, ep); in c4iw_ep_disconnect()
2893 set_bit(EP_DISC_ABORT, &ep->com.history); in c4iw_ep_disconnect()
2894 close_complete_upcall(ep, -ECONNRESET); in c4iw_ep_disconnect()
2895 send_abort(ep); in c4iw_ep_disconnect()
2898 CTR2(KTR_IW_CXGBE, "%s:ced5 %p", __func__, ep); in c4iw_ep_disconnect()
2899 set_bit(EP_DISC_CLOSE, &ep->com.history); in c4iw_ep_disconnect()
2901 if (!ep->parent_ep) in c4iw_ep_disconnect()
2902 ep->com.state = MORIBUND; in c4iw_ep_disconnect()
2904 CURVNET_SET(ep->com.so->so_vnet); in c4iw_ep_disconnect()
2905 ret = sodisconnect(ep->com.so); in c4iw_ep_disconnect()
2908 CTR2(KTR_IW_CXGBE, "%s:ced6 %p", __func__, ep); in c4iw_ep_disconnect()
2909 STOP_EP_TIMER(ep); in c4iw_ep_disconnect()
2910 send_abort(ep); in c4iw_ep_disconnect()
2911 ep->com.state = DEAD; in c4iw_ep_disconnect()
2912 close_complete_upcall(ep, -ECONNRESET); in c4iw_ep_disconnect()
2913 set_bit(EP_DISC_FAIL, &ep->com.history); in c4iw_ep_disconnect()
2914 if (ep->com.qp) { in c4iw_ep_disconnect()
2919 ep->com.dev, ep->com.qp, in c4iw_ep_disconnect()
2923 __func__, ep, ret); in c4iw_ep_disconnect()
2928 c4iw_put_ep(&ep->com); in c4iw_ep_disconnect()
2929 CTR2(KTR_IW_CXGBE, "%s:cedE %p", __func__, ep); in c4iw_ep_disconnect()
2937 struct c4iw_ep *ep = ctx; in c4iw_ep_redirect() local
2939 if (ep->dst != old) in c4iw_ep_redirect()
2942 PDBG("%s ep %p redirect to dst %p l2t %p\n", __func__, ep, new, in c4iw_ep_redirect()
2945 cxgb4_l2t_release(ep->l2t); in c4iw_ep_redirect()
2946 ep->l2t = l2t; in c4iw_ep_redirect()
2948 ep->dst = new; in c4iw_ep_redirect()
2957 struct c4iw_ep *ep = (struct c4iw_ep *)arg; in ep_timeout() local
2959 if (!test_and_set_bit(TIMEOUT, &ep->com.flags)) { in ep_timeout()
2964 if (!(ep->com.ep_events & C4IW_EVENT_TIMEOUT)) { in ep_timeout()
2965 CTR2(KTR_IW_CXGBE, "%s:et1 %p", __func__, ep); in ep_timeout()
2966 add_ep_to_req_list(ep, C4IW_EVENT_TIMEOUT); in ep_timeout()
3004 process_terminate(struct c4iw_ep *ep) in process_terminate() argument
3008 CTR2(KTR_IW_CXGBE, "%s:tB %p %d", __func__, ep); in process_terminate()
3010 if (ep && ep->com.qp) { in process_terminate()
3013 ep->hwtid, ep->com.qp->wq.sq.qid); in process_terminate()
3015 c4iw_modify_qp(ep->com.dev, ep->com.qp, C4IW_QP_ATTR_NEXT_STATE, &attrs, in process_terminate()
3018 printk(KERN_WARNING MOD "TERM received tid %u no ep/qp\n", in process_terminate()
3019 ep->hwtid); in process_terminate()
3020 CTR2(KTR_IW_CXGBE, "%s:tE %p %d", __func__, ep); in process_terminate()