Lines Matching +full:p +full:- +full:states

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2009-2013, 2016 Chelsio, Inc. All rights reserved.
16 * - Redistributions of source code must retain the above
20 * - Redistributions in binary form must reproduce the above
69 #define TOEPCB(so) ((struct toepcb *)(sototcpcb((so))->t_toe))
134 CTR3(KTR_IW_CXGBE, "start_ep_timer (%s:%d) ep %p", \
141 CTR3(KTR_IW_CXGBE, "stop_ep_timer (%s:%d) ep %p", \
150 ("GET_LOCAL_ADDR(%s):so:%p, inp = NULL", __func__, so)); \
151 if (__inp->inp_vflag & INP_IPV4) \
161 ("GET_REMOTE_ADDR(%s):so:%p, inp = NULL", __func__, so)); \
162 if (__inp->inp_vflag & INP_IPV4) \
168 static char *states[] = { variable
186 epc->cm_id->rem_ref(epc->cm_id); in deref_cm_id()
187 epc->cm_id = NULL; in deref_cm_id()
188 set_bit(CM_ID_DEREFED, &epc->history); in deref_cm_id()
193 set_bit(CM_ID_REFED, &epc->history); in ref_cm_id()
194 epc->cm_id->add_ref(epc->cm_id); in ref_cm_id()
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()
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()
225 * |------------------|
227 * |------------------|
229 * | |-----------| |-----------|
231 * |--------------|-list------|-------|-list------|-------....
232 * | lep_list----| | lep_list----|
236 * |-----------| | |-----------| |
241 … | | |----------------| |----------------|
242 …* | |----| listen_ep_list |----| listen_…
243 … | |----------------| |----------------|
247 * | |----------------| |----------------|
248 * |---| listen_ep_list |----| listen_ep_list |
249 * |----------------| |----------------|
263 struct sockaddr_storage *laddr = &lep->com.local_addr; in add_ep_to_listenlist()
265 port = (laddr->ss_family == AF_INET) ? in add_ep_to_listenlist()
266 ((struct sockaddr_in *)laddr)->sin_port : in add_ep_to_listenlist()
267 ((struct sockaddr_in6 *)laddr)->sin6_port; in add_ep_to_listenlist()
272 if (port_info->port_num == port) in add_ep_to_listenlist()
276 port_info->port_num = port; in add_ep_to_listenlist()
277 port_info->refcnt = 0; in add_ep_to_listenlist()
279 list_add_tail(&port_info->list, &listen_port_list); in add_ep_to_listenlist()
280 INIT_LIST_HEAD(&port_info->lep_list); in add_ep_to_listenlist()
283 port_info->refcnt++; in add_ep_to_listenlist()
284 list_add_tail(&lep->listen_ep_list, &port_info->lep_list); in add_ep_to_listenlist()
294 struct sockaddr_storage *laddr = &lep->com.local_addr; in rem_ep_from_listenlist()
297 port = (laddr->ss_family == AF_INET) ? in rem_ep_from_listenlist()
298 ((struct sockaddr_in *)laddr)->sin_port : in rem_ep_from_listenlist()
299 ((struct sockaddr_in6 *)laddr)->sin6_port; in rem_ep_from_listenlist()
305 if (port_info->port_num == port) { in rem_ep_from_listenlist()
306 port_info->refcnt--; in rem_ep_from_listenlist()
307 refcnt = port_info->refcnt; in rem_ep_from_listenlist()
309 list_del(&lep->listen_ep_list); in rem_ep_from_listenlist()
310 if (port_info->refcnt == 0) { in rem_ep_from_listenlist()
314 list_del(&port_info->list); in rem_ep_from_listenlist()
342 ifp = TOEPCB(so)->l2te->ifp; in find_real_listen_ep()
347 "vlan ifnet %p, sock %p, master_lep %p", in find_real_listen_ep()
355 port = (master_lep->com.local_addr.ss_family == AF_INET) ? in find_real_listen_ep()
356 ((struct sockaddr_in *)&master_lep->com.local_addr)->sin_port : in find_real_listen_ep()
357 ((struct sockaddr_in6 *)&master_lep->com.local_addr)->sin6_port; in find_real_listen_ep()
362 if (port_info->port_num == port) { in find_real_listen_ep()
373 list_for_each_entry(lep, &port_info->lep_list, listen_ep_list) { in find_real_listen_ep()
374 adap = lep->com.dev->rdev.adap; in find_real_listen_ep()
376 if (hw_ifp == adap->port[i]->vi[0].ifp) { in find_real_listen_ep()
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()
418 * So we silently do nothing for these states. 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()
429 c4iw_put_ep(&ep->com); in process_timeout()
450 tmp->next = tmp->prev = NULL; in process_err_cqes()
453 c4iw_ev_dispatch(cle->rhp, &cle->err_cqe); in process_err_cqes()
474 epc->entry.tqe_prev = NULL; in process_req()
475 ep_events = epc->ep_events; in process_req()
476 epc->ep_events = 0; in process_req()
478 mutex_lock(&epc->mutex); in process_req()
479 CTR5(KTR_IW_CXGBE, "%s: so %p, ep %p, ep_state %s events 0x%x", in process_req()
480 __func__, epc->so, epc, states[epc->state], ep_events); in process_req()
487 mutex_unlock(&epc->mutex); in process_req()
503 struct socket *so = ep->com.so; in set_tcpinfo()
511 if ((tp->t_flags & TF_TOE) == 0) { in set_tcpinfo()
513 log(LOG_ERR, "%s: connection not offloaded (so %p, ep %p)\n", 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()
533 if (raddr->ss_family == AF_INET) { in get_ifnet_from_raddr()
536 nh = fib4_lookup(RT_DEFAULT_FIB, raddr4->sin_addr, 0, in get_ifnet_from_raddr()
544 in6_splitscope((struct in6_addr *)&raddr6->sin6_addr, in get_ifnet_from_raddr()
553 *ifp = nh->nh_ifp; in get_ifnet_from_raddr()
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()
578 CTR2(KTR_IW_CXGBE, "%s:ppc1 %p MPA_REQ_WAIT DEAD", in process_peer_close()
582 CTR2(KTR_IW_CXGBE, "%s:ppc2 %p MPA_REQ_SENT DEAD", in process_peer_close()
584 ep->com.state = DEAD; in process_peer_close()
585 connect_reply_upcall(ep, -ECONNABORTED); in process_peer_close()
589 close_socket(ep->com.so); in process_peer_close()
590 deref_cm_id(&ep->com); in process_peer_close()
601 CTR2(KTR_IW_CXGBE, "%s:ppc3 %p MPA_REQ_RCVD CLOSING", in process_peer_close()
603 ep->com.state = CLOSING; in process_peer_close()
607 CTR2(KTR_IW_CXGBE, "%s:ppc4 %p MPA_REP_SENT CLOSING", in process_peer_close()
609 ep->com.state = CLOSING; in process_peer_close()
613 CTR2(KTR_IW_CXGBE, "%s:ppc5 %p FPDU_MODE CLOSING", 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()
624 CTR2(KTR_IW_CXGBE, "%s:ppc6 %p ABORTING (disconn)", in process_peer_close()
630 CTR2(KTR_IW_CXGBE, "%s:ppc7 %p CLOSING MORIBUND", in process_peer_close()
632 ep->com.state = MORIBUND; in process_peer_close()
637 CTR2(KTR_IW_CXGBE, "%s:ppc8 %p MORIBUND DEAD", __func__, 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()
647 ep->com.state = DEAD; in process_peer_close()
653 CTR2(KTR_IW_CXGBE, "%s:ppc9 %p DEAD (disconn)", 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()
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()
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()
695 c4iw_put_ep(&ep->parent_ep->com); 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()
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()
725 "%s - qp <- error failed!\n", 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()
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()
768 CTR2(KTR_IW_CXGBE, "%s:pcc1 %p CLOSING MORIBUND", in process_close_complete()
770 ep->com.state = MORIBUND; in process_close_complete()
774 CTR2(KTR_IW_CXGBE, "%s:pcc1 %p MORIBUND DEAD", __func__, in process_close_complete()
778 if ((ep->com.cm_id) && (ep->com.qp)) { in process_close_complete()
780 CTR2(KTR_IW_CXGBE, "%s:pcc2 %p QP_STATE_IDLE", 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()
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()
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()
814 CTR2(KTR_IW_CXGBE, "%s:pccE %p", __func__, ep); in process_close_complete()
831 rc = -sosetopt(so, &sopt); in setiwsockopt()
833 log(LOG_ERR, "%s: can't set TCP_NODELAY on so %p (%d)\n", in setiwsockopt()
844 so->so_state |= SS_NBIO; in init_iwarp_socket()
847 SOCKBUF_LOCK(&so->so_rcv); in init_iwarp_socket()
849 so->so_state |= SS_NBIO; in init_iwarp_socket()
850 SOCKBUF_UNLOCK(&so->so_rcv); in init_iwarp_socket()
862 SOCKBUF_LOCK(&so->so_rcv); in uninit_iwarp_socket()
864 SOCKBUF_UNLOCK(&so->so_rcv); in uninit_iwarp_socket()
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()
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()
893 if (ret != -EINPROGRESS) in process_data()
897 log(LOG_ERR, "%s: Unexpected streaming data. ep %p, " in process_data()
898 "state %d, so %p, so_state 0x%x, sbused %u\n", 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()
911 struct socket *so = ep->com.so; in process_connected()
913 if ((so->so_state & SS_ISCONNECTED) && !so->so_error) { 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()
932 if (addr->sa_family == AF_INET) in c4iw_zero_addr()
933 return (((struct sockaddr_in *)addr)->sin_addr.s_addr == 0); in c4iw_zero_addr()
935 ip6 = &((struct sockaddr_in6 *) addr)->sin6_addr; in c4iw_zero_addr()
936 return (ip6->s6_addr32[0] | ip6->s6_addr32[1] | in c4iw_zero_addr()
937 ip6->s6_addr32[2] | ip6->s6_addr32[3]) == 0; in c4iw_zero_addr()
946 if (addr->sa_family == AF_INET) { in c4iw_loopback_addr()
948 ret = _IN_LOOPBACK(ntohl(((struct sockaddr_in *) addr)->sin_addr.s_addr)); in c4iw_loopback_addr()
951 ret = IN_LOOPBACK(ntohl(((struct sockaddr_in *) addr)->sin_addr.s_addr)); in c4iw_loopback_addr()
955 ret = IN6_IS_ADDR_LOOPBACK(&((struct sockaddr_in6 *) addr)->sin6_addr); in c4iw_loopback_addr()
976 if (c4iw_any_addr((struct sockaddr *)&master_lep->com.local_addr, in process_newconn()
977 new_so->so_vnet)) { in process_newconn()
985 "ep for sock: %p", __func__, new_so); in process_newconn()
987 "sock: %p\n", __func__, new_so); in process_newconn()
994 } else /* for Non-Wildcard address, master_lep is always the real_lep */ in process_newconn()
999 CTR6(KTR_IW_CXGBE, "%s: master_lep %p, real_lep: %p, new ep %p, " in process_newconn()
1000 "listening so %p, new so %p", __func__, master_lep, real_lep, in process_newconn()
1001 new_ep, master_lep->com.so, new_so); in process_newconn()
1003 new_ep->com.dev = real_lep->com.dev; in process_newconn()
1004 new_ep->com.so = new_so; in process_newconn()
1005 new_ep->com.cm_id = NULL; in process_newconn()
1006 new_ep->com.thread = real_lep->com.thread; in process_newconn()
1007 new_ep->parent_ep = real_lep; in process_newconn()
1009 GET_LOCAL_ADDR(&new_ep->com.local_addr, new_so); in process_newconn()
1010 GET_REMOTE_ADDR(&new_ep->com.remote_addr, new_so); in process_newconn()
1011 c4iw_get_ep(&real_lep->com); in process_newconn()
1012 init_timer(&new_ep->timer); in process_newconn()
1013 new_ep->com.state = MPA_REQ_WAIT; in process_newconn()
1019 "%s:listen sock:%p, new sock:%p, ret:%d", in process_newconn()
1020 __func__, master_lep->com.so, new_so, ret); in process_newconn()
1022 c4iw_put_ep(&new_ep->com); in process_newconn()
1023 c4iw_put_ep(&real_lep->com); in process_newconn()
1033 c4iw_get_ep(&new_ep->com); /* Dereferenced at the end below, this is to in process_newconn()
1035 mutex_lock(&new_ep->com.mutex); in process_newconn()
1036 init_iwarp_socket(new_so, &new_ep->com); in process_newconn()
1042 c4iw_put_ep(&real_lep->com); in process_newconn()
1044 mutex_unlock(&new_ep->com.mutex); in process_newconn()
1045 c4iw_put_ep(&new_ep->com); in process_newconn()
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()
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()
1094 struct adapter *sc = iq->adapter; in terminate()
1101 INP_WLOCK(toep->inp); in terminate()
1102 so = inp_inpcbtosocket(toep->inp); in terminate()
1103 ep = so->so_rcv.sb_upcallarg; in terminate()
1104 INP_WUNLOCK(toep->inp); in terminate()
1106 CTR3(KTR_IW_CXGBE, "%s: so %p, ep %p", __func__, so, ep); in terminate()
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()
1124 CTR6(KTR_IW_CXGBE, "process_socket_event: so %p, so_state 0x%x, " 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()
1143 CTR4(KTR_IW_CXGBE, "%s: lep %p listen_so %p " in process_socket_event()
1154 } while (listen_so->sol_qlen); in process_socket_event()
1161 if (so->so_error) { in process_socket_event()
1167 if ((so->so_rcv.sb_state & SBS_CANTRCVMORE) && state <= CLOSING) { in process_socket_event()
1173 if (!(so->so_state & SS_ISDISCONNECTED)) in process_socket_event()
1178 if (so->so_state & SS_ISDISCONNECTED) { in process_socket_event()
1184 if (sbused(&ep->com.so->so_rcv)) { 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()
1197 log(LOG_ERR, "%s: Unprocessed socket event so %p, " 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()
1199 __func__, so, so->so_state, so->so_error, so->so_rcv.sb_state, in process_socket_event()
1200 ep, states[state]); in process_socket_event()
1213 "Per-connection max ORD/IRD (default = 8)");
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()
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()
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()
1314 kref_init(&epc->kref); in alloc_ep()
1315 mutex_init(&epc->mutex); in alloc_ep()
1316 c4iw_init_wr_wait(&epc->wr_wait); in alloc_ep()
1330 epc = &ep->com; in _c4iw_free_ep()
1332 KASSERT(!epc->entry.tqe_prev, ("%s epc %p still on req list", in _c4iw_free_ep()
1334 if (test_bit(QP_REFERENCED, &ep->com.flags)) 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()
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()
1359 if (ep->retry_with_mpa_v1) in send_mpa_req()
1361 mpalen = sizeof(*mpa) + ep->plen; in send_mpa_req()
1367 err = -ENOMEM; in send_mpa_req()
1368 CTR3(KTR_IW_CXGBE, "%s:smr1 ep: %p , error: %d", in send_mpa_req()
1374 memcpy(mpa->key, MPA_KEY_REQ, sizeof(mpa->key)); in send_mpa_req()
1375 mpa->flags = (crc_enabled ? MPA_CRC : 0) | in send_mpa_req()
1378 mpa->private_data_size = htons(ep->plen); in send_mpa_req()
1379 mpa->revision = mpa_rev_to_use; 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()
1387 mpa->private_data_size = htons(ntohs(mpa->private_data_size) + 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()
1403 memcpy(mpa->private_data, &mpa_v2_params, in send_mpa_req()
1406 if (ep->plen) { in send_mpa_req()
1408 memcpy(mpa->private_data + in send_mpa_req()
1410 ep->mpa_pkt + sizeof(*mpa), ep->plen); in send_mpa_req()
1414 if (ep->plen) in send_mpa_req()
1415 memcpy(mpa->private_data, 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()
1422 err = -ENOMEM; in send_mpa_req()
1423 CTR3(KTR_IW_CXGBE, "%s:smr2 ep: %p , error: %d", 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()
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()
1446 CTR3(KTR_IW_CXGBE, "%s:smrE %p, error: %d", __func__, ep, err); in send_mpa_req()
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()
1472 return (-ENOMEM); in send_mpa_reject()
1475 memcpy(mpa->key, MPA_KEY_REP, sizeof(mpa->key)); in send_mpa_reject()
1476 mpa->flags = MPA_REJECT; in send_mpa_reject()
1477 mpa->revision = mpa_rev; in send_mpa_reject()
1478 mpa->private_data_size = htons(plen); in send_mpa_reject()
1480 if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) { in send_mpa_reject()
1482 mpa->flags |= MPA_ENHANCED_RDMA_CONN; in send_mpa_reject()
1483 mpa->private_data_size = htons(ntohs(mpa->private_data_size) + 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()
1494 memcpy(mpa->private_data, &mpa_v2_params, in send_mpa_reject()
1497 if (ep->plen) in send_mpa_reject()
1498 memcpy(mpa->private_data + 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()
1504 memcpy(mpa->private_data, pdata, plen); in send_mpa_reject()
1509 return (-ENOMEM); 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()
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()
1542 return (-ENOMEM); in send_mpa_reply()
1545 memcpy(mpa->key, MPA_KEY_REP, sizeof(mpa->key)); 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()
1549 mpa->private_data_size = htons(plen); in send_mpa_reply()
1551 if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) { in send_mpa_reply()
1553 mpa->flags |= MPA_ENHANCED_RDMA_CONN; in send_mpa_reply()
1554 mpa->private_data_size += 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()
1570 CTR5(KTR_IW_CXGBE, "%s:smrep4 %p %d %d %d", in send_mpa_reply()
1578 CTR5(KTR_IW_CXGBE, "%s:smrep5 %p %d %d %d", in send_mpa_reply()
1584 memcpy(mpa->private_data, &mpa_v2_params, in send_mpa_reply()
1587 if (ep->plen) in send_mpa_reply()
1588 memcpy(mpa->private_data + in send_mpa_reply()
1592 memcpy(mpa->private_data, pdata, plen); in send_mpa_reply()
1597 return (-ENOMEM); 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()
1617 CTR2(KTR_IW_CXGBE, "%s:ccuB %p", __func__, ep); in close_complete_upcall()
1622 if (ep->com.cm_id) { 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()
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()
1653 rc = -sosetopt(so, &sopt); in send_abort()
1655 log(LOG_ERR, "%s: sosetopt(%p, linger = 0) failed with %d.\n", in send_abort()
1661 set_bit(ABORT_CONN, &ep->com.history); in send_abort()
1666 * this ABORT reply event (via do_abort_rpl) to iw_cxgbe. So as a work- in send_abort()
1667 * around de-refererece 'ep' here instead of doing it in abort_rpl() in send_abort()
1671 ep->com.state = DEAD; in send_abort()
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()
1697 CTR2(KTR_IW_CXGBE, "%s:pauB %p", __func__, ep); in peer_abort_upcall()
1700 event.status = -ECONNRESET; 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()
1716 CTR3(KTR_IW_CXGBE, "%s:cruB %p, status: %d", __func__, ep, status); in connect_reply_upcall()
1719 event.status = ((status == -ECONNABORTED) || (status == -EPIPE)) ? in connect_reply_upcall()
1720 -ECONNRESET : 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()
1724 if ((status == 0) || (status == -ECONNREFUSED)) { 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()
1756 if(status == -ECONNABORTED) { 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()
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()
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()
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()
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()
1843 * process_mpa_reply - process streaming mode MPA reply
1869 CTR2(KTR_IW_CXGBE, "%s:pmrB %p", __func__, 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()
1891 err = -err; 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()
1899 printf("%s data after soreceive called! so %p sb_mb %p top %p\n", 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()
1916 err = (-EINVAL); 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()
1925 if (!m->m_next) in process_mpa_reply()
1926 m = m->m_nextpkt; in process_mpa_reply()
1928 m = m->m_next; 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()
1941 if (mpa->revision > mpa_rev) { in process_mpa_reply()
1943 CTR4(KTR_IW_CXGBE, "%s:pmr6 %p %d %d", __func__, ep, in process_mpa_reply()
1944 mpa->revision, mpa_rev); in process_mpa_reply()
1946 " Received = %d\n", __func__, mpa_rev, mpa->revision); in process_mpa_reply()
1947 err = -EPROTO; in process_mpa_reply()
1951 if (memcmp(mpa->key, MPA_KEY_REP, sizeof(mpa->key))) { in process_mpa_reply()
1953 CTR2(KTR_IW_CXGBE, "%s:pmr7 %p", __func__, ep); in process_mpa_reply()
1954 err = -EPROTO; in process_mpa_reply()
1958 plen = ntohs(mpa->private_data_size); in process_mpa_reply()
1965 CTR2(KTR_IW_CXGBE, "%s:pmr8 %p", __func__, ep); in process_mpa_reply()
1966 err = -EPROTO; 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()
1977 err = -EPROTO; 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()
1993 if (mpa->flags & MPA_REJECT) { in process_mpa_reply()
1995 CTR2(KTR_IW_CXGBE, "%s:pmrb %p", __func__, ep); in process_mpa_reply()
1996 err = -ECONNREFUSED; 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()
2012 if (mpa->revision == 2) { 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()
2016 mpa->flags & MPA_ENHANCED_RDMA_CONN ? 1 : 0; 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()
2023 resp_ird = ntohs(mpa_v2_params->ird) & in process_mpa_reply()
2025 resp_ord = ntohs(mpa_v2_params->ord) & in process_mpa_reply()
2029 * This is a double-check. Ideally, below checks are 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()
2049 err = -ENOMEM; in process_mpa_reply()
2050 ep->ird = resp_ord; in process_mpa_reply()
2051 ep->ord = resp_ird; in process_mpa_reply()
2054 if (ntohs(mpa_v2_params->ird) & in process_mpa_reply()
2057 CTR2(KTR_IW_CXGBE, "%s:pmrf %p", __func__, ep); in process_mpa_reply()
2058 if (ntohs(mpa_v2_params->ord) & 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()
2065 else if (ntohs(mpa_v2_params->ord) & 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()
2078 if (mpa->revision == 1) { 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()
2092 CTR2(KTR_IW_CXGBE, "%s:pmrl %p", __func__, ep); in process_mpa_reply()
2094 err = -ECONNRESET; in process_mpa_reply()
2098 CTR6(KTR_IW_CXGBE, "%s - crc_enabled = %d, recv_marker_enabled = %d, " 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()
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()
2153 err = -ENOMEM; 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()
2175 err = -ENOMEM; in process_mpa_reply()
2186 CTR2(KTR_IW_CXGBE, "%s:pmrE %p", __func__, ep); in process_mpa_reply()
2191 * process_mpa_request - process streaming mode MPA request
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()
2235 KASSERT(uio.uio_offset > 0, ("%s: sorecieve on so %p read no data", 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()
2241 * fail this connection. XXX: check so_rcv->sb_cc, or peek with another 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()
2254 if (mpa->revision > mpa_rev) { in process_mpa_request()
2256 " Received = %d\n", __func__, mpa_rev, mpa->revision); in process_mpa_request()
2260 if (memcmp(mpa->key, MPA_KEY_REQ, sizeof(mpa->key))) in process_mpa_request()
2266 plen = ntohs(mpa->private_data_size); 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()
2293 if (mpa->revision == 1) 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()
2297 if (mpa->revision == 2) { in process_mpa_request()
2298 ep->mpa_attr.enhanced_rdma_conn = in process_mpa_request()
2299 mpa->flags & MPA_ENHANCED_RDMA_CONN ? 1 : 0; 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()
2313 if (ntohs(mpa_v2_params->ird) & MPA_V2_PEER2PEER_MODEL) in process_mpa_request()
2315 if (ntohs(mpa_v2_params->ord) & in process_mpa_request()
2317 ep->mpa_attr.p2p_type = in process_mpa_request()
2319 else if (ntohs(mpa_v2_params->ord) & in process_mpa_request()
2321 ep->mpa_attr.p2p_type = in process_mpa_request()
2325 } else if (mpa->revision == 1 && peer2peer) in process_mpa_request()
2326 ep->mpa_attr.p2p_type = p2p_type; 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()
2340 if (ep->parent_ep->com.state != DEAD) in process_mpa_request()
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()
2373 return -ECONNRESET; 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()
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()
2405 struct c4iw_dev *h = to_c4iw_dev(cm_id->device); in c4iw_accept_cr()
2406 struct c4iw_qp *qp = get_qhp(h, conn_param->qpn); in c4iw_accept_cr()
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()
2416 err = -ECONNRESET; in c4iw_accept_cr()
2422 set_bit(ULP_ACCEPT, &ep->com.history); in c4iw_accept_cr()
2424 if ((conn_param->ord > c4iw_max_read_depth) || in c4iw_accept_cr()
2425 (conn_param->ird > c4iw_max_read_depth)) { in c4iw_accept_cr()
2427 CTR2(KTR_IW_CXGBE, "%s:cac2 %p", __func__, ep); in c4iw_accept_cr()
2428 err = -EINVAL; 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()
2443 conn_param->private_data_len); in c4iw_accept_cr()
2444 err = -ENOMEM; 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()
2453 err = -ENOMEM; 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()
2478 //ep->ofld_txq = TOEPCB(ep->com.so)->ofld_txq; 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()
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()
2501 conn_param->private_data_len); 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()
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()
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()
2534 ret = sock_create_kern(laddr->ss_family, in c4iw_sock_create()
2550 ret = -sosetopt(sock, &sopt); in c4iw_sock_create()
2552 log(LOG_ERR, "%s: sosetopt(%p, SO_REUSEADDR) " in c4iw_sock_create()
2562 ret = -sosetopt(sock, &sopt); in c4iw_sock_create()
2564 log(LOG_ERR, "%s: sosetopt(%p, SO_REUSEPORT) " in c4iw_sock_create()
2569 ret = -sobind(sock, (struct sockaddr *)laddr, curthread); in c4iw_sock_create()
2571 CTR2(KTR_IW_CXGBE, "%s:Failed to bind socket. err %p", in c4iw_sock_create()
2577 size = laddr->ss_family == AF_INET6 ? in c4iw_sock_create()
2581 CTR2(KTR_IW_CXGBE, "%s:sock_getname failed. err %p", in c4iw_sock_create()
2594 struct c4iw_dev *dev = to_c4iw_dev(cm_id->device); in c4iw_connect()
2599 struct rdma_cm_id *rdma_id = (struct rdma_cm_id*)cm_id->context; in c4iw_connect()
2600 struct vnet *vnet = rdma_id->route.addr.dev_addr.net; in c4iw_connect()
2603 CTR2(KTR_IW_CXGBE, "%s:ccB %p", __func__, cm_id); in c4iw_connect()
2605 if (__predict_false(c4iw_stopped(&dev->rdev))) in c4iw_connect()
2606 return -EIO; in c4iw_connect()
2608 if ((conn_param->ord > c4iw_max_read_depth) || in c4iw_connect()
2609 (conn_param->ird > c4iw_max_read_depth)) { in c4iw_connect()
2611 CTR2(KTR_IW_CXGBE, "%s:cc1 %p", __func__, cm_id); in c4iw_connect()
2612 err = -EINVAL; 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()
2644 err = -EINVAL; in c4iw_connect()
2648 ep->com.thread = curthread; in c4iw_connect()
2652 err = get_ifnet_from_raddr(&cm_id->remote_addr, &nh_ifp); in c4iw_connect()
2658 CTR2(KTR_IW_CXGBE, "%s:cc7 %p", __func__, ep); in c4iw_connect()
2659 printk(KERN_ERR MOD "%s - cannot find route.\n", __func__); in c4iw_connect()
2660 return -EHOSTUNREACH; in c4iw_connect()
2665 err = -ENOPROTOOPT; 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()
2700 * iwcm->create_listen. Returns -errno on failure.
2705 struct c4iw_dev *dev = to_c4iw_dev(cm_id->device); in c4iw_create_listen()
2710 CTR3(KTR_IW_CXGBE, "%s: cm_id %p, backlog %d", __func__, cm_id, in c4iw_create_listen()
2712 if (c4iw_stopped(&dev->rdev)) { in c4iw_create_listen()
2713 CTR2(KTR_IW_CXGBE, "%s: cm_id %p, stopped", __func__, cm_id); in c4iw_create_listen()
2714 return -EIO; in c4iw_create_listen()
2717 lep->com.cm_id = cm_id; in c4iw_create_listen()
2718 ref_cm_id(&lep->com); in c4iw_create_listen()
2719 lep->com.dev = dev; in c4iw_create_listen()
2720 lep->backlog = backlog; in c4iw_create_listen()
2721 lep->com.local_addr = cm_id->local_addr; in c4iw_create_listen()
2722 lep->com.thread = curthread; in c4iw_create_listen()
2723 cm_id->provider_data = lep; in c4iw_create_listen()
2724 lep->com.state = LISTEN; in c4iw_create_listen()
2737 if (c4iw_any_addr((struct sockaddr *)&lep->com.local_addr, NULL)) { in c4iw_create_listen()
2742 if (port_info->refcnt > 1) { in c4iw_create_listen()
2748 container_of(port_info->lep_list.next, in c4iw_create_listen()
2750 lep->com.so = head_lep->com.so; in c4iw_create_listen()
2754 rc = c4iw_sock_create(&cm_id->local_addr, &lep->com.so); in c4iw_create_listen()
2761 rc = -solisten(lep->com.so, backlog, curthread); in c4iw_create_listen()
2763 CTR3(KTR_IW_CXGBE, "%s:Failed to listen on sock:%p. err %d", in c4iw_create_listen()
2764 __func__, lep->com.so, rc); in c4iw_create_listen()
2767 init_iwarp_socket(lep->com.so, &lep->com); in c4iw_create_listen()
2772 sock_release(lep->com.so); in c4iw_create_listen()
2776 deref_cm_id(&lep->com); in c4iw_create_listen()
2777 c4iw_put_ep(&lep->com); in c4iw_create_listen()
2786 mutex_lock(&lep->com.mutex); in c4iw_destroy_listen()
2787 CTR3(KTR_IW_CXGBE, "%s: cm_id %p, state %s", __func__, cm_id, in c4iw_destroy_listen()
2788 states[lep->com.state]); in c4iw_destroy_listen()
2790 lep->com.state = DEAD; in c4iw_destroy_listen()
2791 if (c4iw_any_addr((struct sockaddr *)&lep->com.local_addr, in c4iw_destroy_listen()
2792 lep->com.so->so_vnet)) { in c4iw_destroy_listen()
2795 close_socket(lep->com.so); in c4iw_destroy_listen()
2797 close_socket(lep->com.so); in c4iw_destroy_listen()
2798 deref_cm_id(&lep->com); in c4iw_destroy_listen()
2799 mutex_unlock(&lep->com.mutex); in c4iw_destroy_listen()
2800 c4iw_put_ep(&lep->com); in c4iw_destroy_listen()
2807 mutex_lock(&ep->com.mutex); in __c4iw_ep_disconnect()
2809 mutex_unlock(&ep->com.mutex); in __c4iw_ep_disconnect()
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()
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()
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()
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()
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()
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()
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()
2922 CTR3(KTR_IW_CXGBE, "%s:ced7 %p ret %d", 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()
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()
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()
2979 CTR3(KTR_IW_CXGBE, "%s wr_waitp %p ret %u", __func__, wr_waitp, ret); in fw6_wr_rpl()
2981 c4iw_wake_up(wr_waitp, ret ? -ret : 0); in fw6_wr_rpl()
2992 cle->rhp = sc->iwarp_softc; in fw6_cqe_handler()
2993 cle->err_cqe = *(const struct t4_cqe *)(&rpl[0]); in fw6_cqe_handler()
2996 list_add_tail(&cle->entry, &err_cqe_list); in fw6_cqe_handler()
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()
3019 ep->hwtid); in process_terminate()
3020 CTR2(KTR_IW_CXGBE, "%s:tE %p %d", __func__, ep); in process_terminate()
3042 return -ENOMEM; in c4iw_cm_init()