Lines Matching refs:ep

147 static void connect_reply_upcall(struct c4iw_ep *ep, int status);
152 static void deref_qp(struct c4iw_ep *ep) in deref_qp() argument
154 c4iw_qp_rem_ref(&ep->com.qp->ibqp); in deref_qp()
155 clear_bit(QP_REFERENCED, &ep->com.flags); in deref_qp()
158 static void ref_qp(struct c4iw_ep *ep) in ref_qp() argument
160 set_bit(QP_REFERENCED, &ep->com.flags); in ref_qp()
161 c4iw_qp_add_ref(&ep->com.qp->ibqp); in ref_qp()
164 static void start_ep_timer(struct c4iw_ep *ep) in start_ep_timer() argument
166 PDBG("%s ep %p\n", __func__, ep); in start_ep_timer()
167 if (timer_pending(&ep->timer)) { in start_ep_timer()
169 __func__, ep); in start_ep_timer()
172 clear_bit(TIMEOUT, &ep->com.flags); in start_ep_timer()
173 c4iw_get_ep(&ep->com); in start_ep_timer()
174 ep->timer.expires = jiffies + ep_timeout_secs * HZ; in start_ep_timer()
175 ep->timer.data = (unsigned long)ep; in start_ep_timer()
176 ep->timer.function = ep_timeout; in start_ep_timer()
177 add_timer(&ep->timer); in start_ep_timer()
180 static int stop_ep_timer(struct c4iw_ep *ep) in stop_ep_timer() argument
182 PDBG("%s ep %p stopping\n", __func__, ep); in stop_ep_timer()
183 del_timer_sync(&ep->timer); in stop_ep_timer()
184 if (!test_and_set_bit(TIMEOUT, &ep->com.flags)) { in stop_ep_timer()
185 c4iw_put_ep(&ep->com); in stop_ep_timer()
237 static void set_emss(struct c4iw_ep *ep, u16 opt) in set_emss() argument
239 ep->emss = ep->com.dev->rdev.lldi.mtus[TCPOPT_MSS_G(opt)] - in set_emss()
240 ((AF_INET == ep->com.remote_addr.ss_family) ? in set_emss()
243 ep->mss = ep->emss; in set_emss()
245 ep->emss -= round_up(TCPOLEN_TIMESTAMP, 4); in set_emss()
246 if (ep->emss < 128) in set_emss()
247 ep->emss = 128; in set_emss()
248 if (ep->emss & 7) in set_emss()
250 TCPOPT_MSS_G(opt), ep->mss, ep->emss); in set_emss()
252 ep->mss, ep->emss); in set_emss()
295 struct c4iw_ep *ep; in _c4iw_free_ep() local
297 ep = container_of(kref, struct c4iw_ep, com.kref); in _c4iw_free_ep()
298 PDBG("%s ep %p state %s\n", __func__, ep, states[state_read(&ep->com)]); in _c4iw_free_ep()
299 if (test_bit(QP_REFERENCED, &ep->com.flags)) in _c4iw_free_ep()
300 deref_qp(ep); in _c4iw_free_ep()
301 if (test_bit(RELEASE_RESOURCES, &ep->com.flags)) { in _c4iw_free_ep()
302 if (ep->com.remote_addr.ss_family == AF_INET6) { in _c4iw_free_ep()
305 &ep->com.mapped_local_addr; in _c4iw_free_ep()
308 ep->com.dev->rdev.lldi.ports[0], in _c4iw_free_ep()
312 remove_handle(ep->com.dev, &ep->com.dev->hwtid_idr, ep->hwtid); in _c4iw_free_ep()
313 cxgb4_remove_tid(ep->com.dev->rdev.lldi.tids, 0, ep->hwtid); in _c4iw_free_ep()
314 dst_release(ep->dst); in _c4iw_free_ep()
315 cxgb4_l2t_release(ep->l2t); in _c4iw_free_ep()
317 if (test_bit(RELEASE_MAPINFO, &ep->com.flags)) { in _c4iw_free_ep()
318 print_addr(&ep->com, __func__, "remove_mapinfo/mapping"); in _c4iw_free_ep()
319 iwpm_remove_mapinfo(&ep->com.local_addr, in _c4iw_free_ep()
320 &ep->com.mapped_local_addr); in _c4iw_free_ep()
321 iwpm_remove_mapping(&ep->com.local_addr, RDMA_NL_C4IW); in _c4iw_free_ep()
323 kfree(ep); in _c4iw_free_ep()
326 static void release_ep_resources(struct c4iw_ep *ep) in release_ep_resources() argument
328 set_bit(RELEASE_RESOURCES, &ep->com.flags); in release_ep_resources()
329 c4iw_put_ep(&ep->com); in release_ep_resources()
450 struct c4iw_ep *ep = handle; in act_open_req_arp_failure() local
454 connect_reply_upcall(ep, -EHOSTUNREACH); in act_open_req_arp_failure()
455 state_set(&ep->com, DEAD); in act_open_req_arp_failure()
456 if (ep->com.remote_addr.ss_family == AF_INET6) { in act_open_req_arp_failure()
458 (struct sockaddr_in6 *)&ep->com.mapped_local_addr; in act_open_req_arp_failure()
459 cxgb4_clip_release(ep->com.dev->rdev.lldi.ports[0], in act_open_req_arp_failure()
462 remove_handle(ep->com.dev, &ep->com.dev->atid_idr, ep->atid); in act_open_req_arp_failure()
463 cxgb4_free_atid(ep->com.dev->rdev.lldi.tids, ep->atid); in act_open_req_arp_failure()
464 dst_release(ep->dst); in act_open_req_arp_failure()
465 cxgb4_l2t_release(ep->l2t); in act_open_req_arp_failure()
466 c4iw_put_ep(&ep->com); in act_open_req_arp_failure()
483 static void send_flowc(struct c4iw_ep *ep, struct sk_buff *skb) in send_flowc() argument
495 16)) | FW_WR_FLOWID_V(ep->hwtid)); in send_flowc()
499 (ep->com.dev->rdev.lldi.pf)); in send_flowc()
501 flowc->mnemval[1].val = cpu_to_be32(ep->tx_chan); in send_flowc()
503 flowc->mnemval[2].val = cpu_to_be32(ep->tx_chan); in send_flowc()
505 flowc->mnemval[3].val = cpu_to_be32(ep->rss_qid); in send_flowc()
507 flowc->mnemval[4].val = cpu_to_be32(ep->snd_seq); in send_flowc()
509 flowc->mnemval[5].val = cpu_to_be32(ep->rcv_seq); in send_flowc()
511 flowc->mnemval[6].val = cpu_to_be32(ep->snd_win); in send_flowc()
513 flowc->mnemval[7].val = cpu_to_be32(ep->emss); in send_flowc()
523 set_wr_txq(skb, CPL_PRIORITY_DATA, ep->txq_idx); in send_flowc()
524 c4iw_ofld_send(&ep->com.dev->rdev, skb); in send_flowc()
527 static int send_halfclose(struct c4iw_ep *ep, gfp_t gfp) in send_halfclose() argument
533 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in send_halfclose()
539 set_wr_txq(skb, CPL_PRIORITY_DATA, ep->txq_idx); in send_halfclose()
543 INIT_TP_WR(req, ep->hwtid); in send_halfclose()
545 ep->hwtid)); in send_halfclose()
546 return c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t); in send_halfclose()
549 static int send_abort(struct c4iw_ep *ep, struct sk_buff *skb, gfp_t gfp) in send_abort() argument
554 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in send_abort()
561 set_wr_txq(skb, CPL_PRIORITY_DATA, ep->txq_idx); in send_abort()
562 t4_set_arp_err_handler(skb, &ep->com.dev->rdev, abort_arp_failure); in send_abort()
565 INIT_TP_WR(req, ep->hwtid); in send_abort()
566 OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ABORT_REQ, ep->hwtid)); in send_abort()
568 return c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t); in send_abort()
574 static void c4iw_form_pm_msg(struct c4iw_ep *ep, in c4iw_form_pm_msg() argument
577 memcpy(&pm_msg->loc_addr, &ep->com.local_addr, in c4iw_form_pm_msg()
578 sizeof(ep->com.local_addr)); in c4iw_form_pm_msg()
579 memcpy(&pm_msg->rem_addr, &ep->com.remote_addr, in c4iw_form_pm_msg()
580 sizeof(ep->com.remote_addr)); in c4iw_form_pm_msg()
594 static void c4iw_record_pm_msg(struct c4iw_ep *ep, in c4iw_record_pm_msg() argument
597 memcpy(&ep->com.mapped_local_addr, &pm_msg->mapped_loc_addr, in c4iw_record_pm_msg()
598 sizeof(ep->com.mapped_local_addr)); in c4iw_record_pm_msg()
599 memcpy(&ep->com.mapped_remote_addr, &pm_msg->mapped_rem_addr, in c4iw_record_pm_msg()
600 sizeof(ep->com.mapped_remote_addr)); in c4iw_record_pm_msg()
633 static int send_connect(struct c4iw_ep *ep) in send_connect() argument
648 &ep->com.mapped_local_addr; in send_connect()
650 &ep->com.mapped_remote_addr; in send_connect()
652 &ep->com.mapped_local_addr; in send_connect()
654 &ep->com.mapped_remote_addr; in send_connect()
656 enum chip_type adapter_type = ep->com.dev->rdev.lldi.adapter_type; in send_connect()
678 wrlen = (ep->com.remote_addr.ss_family == AF_INET) ? in send_connect()
682 PDBG("%s ep %p atid %u\n", __func__, ep, ep->atid); in send_connect()
690 set_wr_txq(skb, CPL_PRIORITY_SETUP, ep->ctrlq_idx); in send_connect()
692 best_mtu(ep->com.dev->rdev.lldi.mtus, ep->mtu, &mtu_idx, in send_connect()
694 (AF_INET == ep->com.remote_addr.ss_family) ? 0 : 1); in send_connect()
701 win = ep->rcv_win >> 10; in send_connect()
710 L2T_IDX_V(ep->l2t->idx) | in send_connect()
711 TX_CHAN_V(ep->tx_chan) | in send_connect()
712 SMAC_SEL_V(ep->smac_idx) | in send_connect()
713 DSCP_V(ep->tos) | in send_connect()
718 RSS_QUEUE_VALID_F | RSS_QUEUE_V(ep->rss_qid); in send_connect()
734 if (ep->com.remote_addr.ss_family == AF_INET6) in send_connect()
735 cxgb4_clip_get(ep->com.dev->rdev.lldi.ports[0], in send_connect()
738 t4_set_arp_err_handler(skb, ep, act_open_req_arp_failure); in send_connect()
740 if (ep->com.remote_addr.ss_family == AF_INET) { in send_connect()
767 ((ep->rss_qid<<14) | ep->atid))); in send_connect()
774 if (is_t4(ep->com.dev->rdev.lldi.adapter_type)) { in send_connect()
776 ep->com.dev->rdev.lldi.ports[0], in send_connect()
777 ep->l2t)); in send_connect()
782 ep->com.dev->rdev.lldi.ports[0], in send_connect()
783 ep->l2t))); in send_connect()
815 ((ep->rss_qid<<14)|ep->atid))); in send_connect()
824 if (is_t4(ep->com.dev->rdev.lldi.adapter_type)) { in send_connect()
826 ep->com.dev->rdev.lldi.ports[0], in send_connect()
827 ep->l2t)); in send_connect()
832 ep->com.dev->rdev.lldi.ports[0], in send_connect()
833 ep->l2t))); in send_connect()
840 set_bit(ACT_OPEN_REQ, &ep->com.history); in send_connect()
841 ret = c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t); in send_connect()
843 if (ret && ep->com.remote_addr.ss_family == AF_INET6) in send_connect()
844 cxgb4_clip_release(ep->com.dev->rdev.lldi.ports[0], in send_connect()
849 static void send_mpa_req(struct c4iw_ep *ep, struct sk_buff *skb, in send_mpa_req() argument
857 PDBG("%s ep %p tid %u pd_len %d\n", __func__, ep, ep->hwtid, ep->plen); in send_mpa_req()
861 mpalen = sizeof(*mpa) + ep->plen; in send_mpa_req()
867 connect_reply_upcall(ep, -ENOMEM); in send_mpa_req()
870 set_wr_txq(skb, CPL_PRIORITY_DATA, ep->txq_idx); in send_mpa_req()
879 FW_WR_FLOWID_V(ep->hwtid) | in send_mpa_req()
891 mpa->private_data_size = htons(ep->plen); in send_mpa_req()
894 ep->tried_with_mpa_v1 = 1; in send_mpa_req()
895 ep->retry_with_mpa_v1 = 0; in send_mpa_req()
901 PDBG("%s initiator ird %u ord %u\n", __func__, ep->ird, in send_mpa_req()
902 ep->ord); in send_mpa_req()
903 mpa_v2_params.ird = htons((u16)ep->ird); in send_mpa_req()
904 mpa_v2_params.ord = htons((u16)ep->ord); in send_mpa_req()
918 if (ep->plen) in send_mpa_req()
921 ep->mpa_pkt + sizeof(*mpa), ep->plen); in send_mpa_req()
923 if (ep->plen) in send_mpa_req()
925 ep->mpa_pkt + sizeof(*mpa), ep->plen); in send_mpa_req()
934 BUG_ON(ep->mpa_skb); in send_mpa_req()
935 ep->mpa_skb = skb; in send_mpa_req()
936 c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t); in send_mpa_req()
937 start_ep_timer(ep); in send_mpa_req()
938 __state_set(&ep->com, MPA_REQ_SENT); in send_mpa_req()
939 ep->mpa_attr.initiator = 1; in send_mpa_req()
940 ep->snd_seq += mpalen; in send_mpa_req()
944 static int send_mpa_reject(struct c4iw_ep *ep, const void *pdata, u8 plen) in send_mpa_reject() argument
952 PDBG("%s ep %p tid %u pd_len %d\n", __func__, ep, ep->hwtid, ep->plen); in send_mpa_reject()
955 if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) in send_mpa_reject()
964 set_wr_txq(skb, CPL_PRIORITY_DATA, ep->txq_idx); in send_mpa_reject()
973 FW_WR_FLOWID_V(ep->hwtid) | in send_mpa_reject()
984 mpa->revision = ep->mpa_attr.version; in send_mpa_reject()
987 if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) { in send_mpa_reject()
991 mpa_v2_params.ird = htons(((u16)ep->ird) | in send_mpa_reject()
994 mpa_v2_params.ord = htons(((u16)ep->ord) | (peer2peer ? in send_mpa_reject()
1003 if (ep->plen) in send_mpa_reject()
1016 set_wr_txq(skb, CPL_PRIORITY_DATA, ep->txq_idx); in send_mpa_reject()
1018 BUG_ON(ep->mpa_skb); in send_mpa_reject()
1019 ep->mpa_skb = skb; in send_mpa_reject()
1020 ep->snd_seq += mpalen; in send_mpa_reject()
1021 return c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t); in send_mpa_reject()
1024 static int send_mpa_reply(struct c4iw_ep *ep, const void *pdata, u8 plen) in send_mpa_reply() argument
1032 PDBG("%s ep %p tid %u pd_len %d\n", __func__, ep, ep->hwtid, ep->plen); in send_mpa_reply()
1035 if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) in send_mpa_reply()
1044 set_wr_txq(skb, CPL_PRIORITY_DATA, ep->txq_idx); in send_mpa_reply()
1053 FW_WR_FLOWID_V(ep->hwtid) | in send_mpa_reply()
1063 mpa->flags = (ep->mpa_attr.crc_enabled ? MPA_CRC : 0) | in send_mpa_reply()
1065 mpa->revision = ep->mpa_attr.version; in send_mpa_reply()
1068 if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) { in send_mpa_reply()
1072 mpa_v2_params.ird = htons((u16)ep->ird); in send_mpa_reply()
1073 mpa_v2_params.ord = htons((u16)ep->ord); in send_mpa_reply()
1074 if (peer2peer && (ep->mpa_attr.p2p_type != in send_mpa_reply()
1089 if (ep->plen) in send_mpa_reply()
1103 ep->mpa_skb = skb; in send_mpa_reply()
1104 __state_set(&ep->com, MPA_REP_SENT); in send_mpa_reply()
1105 ep->snd_seq += mpalen; in send_mpa_reply()
1106 return c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t); in send_mpa_reply()
1111 struct c4iw_ep *ep; in act_establish() local
1117 ep = lookup_atid(t, atid); in act_establish()
1119 PDBG("%s ep %p tid %u snd_isn %u rcv_isn %u\n", __func__, ep, tid, in act_establish()
1122 mutex_lock(&ep->com.mutex); in act_establish()
1123 dst_confirm(ep->dst); in act_establish()
1126 ep->hwtid = tid; in act_establish()
1127 cxgb4_insert_tid(t, ep, tid); in act_establish()
1128 insert_handle(dev, &dev->hwtid_idr, ep, ep->hwtid); in act_establish()
1130 ep->snd_seq = be32_to_cpu(req->snd_isn); in act_establish()
1131 ep->rcv_seq = be32_to_cpu(req->rcv_isn); in act_establish()
1133 set_emss(ep, ntohs(req->tcp_opt)); in act_establish()
1136 remove_handle(ep->com.dev, &ep->com.dev->atid_idr, atid); in act_establish()
1138 set_bit(ACT_ESTAB, &ep->com.history); in act_establish()
1141 send_flowc(ep, NULL); in act_establish()
1142 if (ep->retry_with_mpa_v1) in act_establish()
1143 send_mpa_req(ep, skb, 1); in act_establish()
1145 send_mpa_req(ep, skb, mpa_rev); in act_establish()
1146 mutex_unlock(&ep->com.mutex); in act_establish()
1150 static void close_complete_upcall(struct c4iw_ep *ep, int status) in close_complete_upcall() argument
1154 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in close_complete_upcall()
1158 if (ep->com.cm_id) { in close_complete_upcall()
1160 ep, ep->com.cm_id, ep->hwtid); in close_complete_upcall()
1161 ep->com.cm_id->event_handler(ep->com.cm_id, &event); in close_complete_upcall()
1162 ep->com.cm_id->rem_ref(ep->com.cm_id); in close_complete_upcall()
1163 ep->com.cm_id = NULL; in close_complete_upcall()
1164 set_bit(CLOSE_UPCALL, &ep->com.history); in close_complete_upcall()
1168 static int abort_connection(struct c4iw_ep *ep, struct sk_buff *skb, gfp_t gfp) in abort_connection() argument
1170 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in abort_connection()
1171 __state_set(&ep->com, ABORTING); in abort_connection()
1172 set_bit(ABORT_CONN, &ep->com.history); in abort_connection()
1173 return send_abort(ep, skb, gfp); in abort_connection()
1176 static void peer_close_upcall(struct c4iw_ep *ep) in peer_close_upcall() argument
1180 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in peer_close_upcall()
1183 if (ep->com.cm_id) { in peer_close_upcall()
1185 ep, ep->com.cm_id, ep->hwtid); in peer_close_upcall()
1186 ep->com.cm_id->event_handler(ep->com.cm_id, &event); in peer_close_upcall()
1187 set_bit(DISCONN_UPCALL, &ep->com.history); in peer_close_upcall()
1191 static void peer_abort_upcall(struct c4iw_ep *ep) in peer_abort_upcall() argument
1195 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in peer_abort_upcall()
1199 if (ep->com.cm_id) { in peer_abort_upcall()
1200 PDBG("abort delivered ep %p cm_id %p tid %u\n", ep, in peer_abort_upcall()
1201 ep->com.cm_id, ep->hwtid); in peer_abort_upcall()
1202 ep->com.cm_id->event_handler(ep->com.cm_id, &event); in peer_abort_upcall()
1203 ep->com.cm_id->rem_ref(ep->com.cm_id); in peer_abort_upcall()
1204 ep->com.cm_id = NULL; in peer_abort_upcall()
1205 set_bit(ABORT_UPCALL, &ep->com.history); in peer_abort_upcall()
1209 static void connect_reply_upcall(struct c4iw_ep *ep, int status) in connect_reply_upcall() argument
1213 PDBG("%s ep %p tid %u status %d\n", __func__, ep, ep->hwtid, status); in connect_reply_upcall()
1217 memcpy(&event.local_addr, &ep->com.local_addr, in connect_reply_upcall()
1218 sizeof(ep->com.local_addr)); in connect_reply_upcall()
1219 memcpy(&event.remote_addr, &ep->com.remote_addr, in connect_reply_upcall()
1220 sizeof(ep->com.remote_addr)); in connect_reply_upcall()
1223 if (!ep->tried_with_mpa_v1) { in connect_reply_upcall()
1225 event.ord = ep->ird; in connect_reply_upcall()
1226 event.ird = ep->ord; in connect_reply_upcall()
1227 event.private_data_len = ep->plen - in connect_reply_upcall()
1229 event.private_data = ep->mpa_pkt + in connect_reply_upcall()
1234 event.ord = cur_max_read_depth(ep->com.dev); in connect_reply_upcall()
1235 event.ird = cur_max_read_depth(ep->com.dev); in connect_reply_upcall()
1236 event.private_data_len = ep->plen; in connect_reply_upcall()
1237 event.private_data = ep->mpa_pkt + in connect_reply_upcall()
1242 PDBG("%s ep %p tid %u status %d\n", __func__, ep, in connect_reply_upcall()
1243 ep->hwtid, status); in connect_reply_upcall()
1244 set_bit(CONN_RPL_UPCALL, &ep->com.history); in connect_reply_upcall()
1245 ep->com.cm_id->event_handler(ep->com.cm_id, &event); in connect_reply_upcall()
1248 ep->com.cm_id->rem_ref(ep->com.cm_id); in connect_reply_upcall()
1249 ep->com.cm_id = NULL; in connect_reply_upcall()
1253 static int connect_request_upcall(struct c4iw_ep *ep) in connect_request_upcall() argument
1258 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in connect_request_upcall()
1261 memcpy(&event.local_addr, &ep->com.local_addr, in connect_request_upcall()
1262 sizeof(ep->com.local_addr)); in connect_request_upcall()
1263 memcpy(&event.remote_addr, &ep->com.remote_addr, in connect_request_upcall()
1264 sizeof(ep->com.remote_addr)); in connect_request_upcall()
1265 event.provider_data = ep; in connect_request_upcall()
1266 if (!ep->tried_with_mpa_v1) { in connect_request_upcall()
1268 event.ord = ep->ord; in connect_request_upcall()
1269 event.ird = ep->ird; in connect_request_upcall()
1270 event.private_data_len = ep->plen - in connect_request_upcall()
1272 event.private_data = ep->mpa_pkt + sizeof(struct mpa_message) + in connect_request_upcall()
1276 event.ord = cur_max_read_depth(ep->com.dev); in connect_request_upcall()
1277 event.ird = cur_max_read_depth(ep->com.dev); in connect_request_upcall()
1278 event.private_data_len = ep->plen; in connect_request_upcall()
1279 event.private_data = ep->mpa_pkt + sizeof(struct mpa_message); in connect_request_upcall()
1281 c4iw_get_ep(&ep->com); in connect_request_upcall()
1282 ret = ep->parent_ep->com.cm_id->event_handler(ep->parent_ep->com.cm_id, in connect_request_upcall()
1285 c4iw_put_ep(&ep->com); in connect_request_upcall()
1286 set_bit(CONNREQ_UPCALL, &ep->com.history); in connect_request_upcall()
1287 c4iw_put_ep(&ep->parent_ep->com); in connect_request_upcall()
1291 static void established_upcall(struct c4iw_ep *ep) in established_upcall() argument
1295 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in established_upcall()
1298 event.ird = ep->ord; in established_upcall()
1299 event.ord = ep->ird; in established_upcall()
1300 if (ep->com.cm_id) { in established_upcall()
1301 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in established_upcall()
1302 ep->com.cm_id->event_handler(ep->com.cm_id, &event); in established_upcall()
1303 set_bit(ESTAB_UPCALL, &ep->com.history); in established_upcall()
1307 static int update_rx_credits(struct c4iw_ep *ep, u32 credits) in update_rx_credits() argument
1313 PDBG("%s ep %p tid %u credits %u\n", __func__, ep, ep->hwtid, credits); in update_rx_credits()
1325 if (ep->rcv_win > RCV_BUFSIZ_M * 1024) in update_rx_credits()
1326 credits += ep->rcv_win - RCV_BUFSIZ_M * 1024; in update_rx_credits()
1330 INIT_TP_WR(req, ep->hwtid); in update_rx_credits()
1332 ep->hwtid)); in update_rx_credits()
1336 set_wr_txq(skb, CPL_PRIORITY_ACK, ep->ctrlq_idx); in update_rx_credits()
1337 c4iw_ofld_send(&ep->com.dev->rdev, skb); in update_rx_credits()
1343 static int process_mpa_reply(struct c4iw_ep *ep, struct sk_buff *skb) in process_mpa_reply() argument
1355 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in process_mpa_reply()
1362 if (stop_ep_timer(ep)) in process_mpa_reply()
1369 if (ep->mpa_pkt_len + skb->len > sizeof(ep->mpa_pkt)) { in process_mpa_reply()
1377 skb_copy_from_linear_data(skb, &(ep->mpa_pkt[ep->mpa_pkt_len]), in process_mpa_reply()
1379 ep->mpa_pkt_len += skb->len; in process_mpa_reply()
1384 if (ep->mpa_pkt_len < sizeof(*mpa)) in process_mpa_reply()
1386 mpa = (struct mpa_message *) ep->mpa_pkt; in process_mpa_reply()
1413 if (ep->mpa_pkt_len > (sizeof(*mpa) + plen)) { in process_mpa_reply()
1418 ep->plen = (u8) plen; in process_mpa_reply()
1424 if (ep->mpa_pkt_len < (sizeof(*mpa) + plen)) in process_mpa_reply()
1437 __state_set(&ep->com, FPDU_MODE); in process_mpa_reply()
1438 ep->mpa_attr.crc_enabled = (mpa->flags & MPA_CRC) | crc_enabled ? 1 : 0; in process_mpa_reply()
1439 ep->mpa_attr.recv_marker_enabled = markers_enabled; in process_mpa_reply()
1440 ep->mpa_attr.xmit_marker_enabled = mpa->flags & MPA_MARKERS ? 1 : 0; in process_mpa_reply()
1441 ep->mpa_attr.version = mpa->revision; in process_mpa_reply()
1442 ep->mpa_attr.p2p_type = FW_RI_INIT_P2PTYPE_DISABLED; in process_mpa_reply()
1445 ep->mpa_attr.enhanced_rdma_conn = in process_mpa_reply()
1447 if (ep->mpa_attr.enhanced_rdma_conn) { in process_mpa_reply()
1449 (ep->mpa_pkt + sizeof(*mpa)); in process_mpa_reply()
1455 __func__, resp_ird, resp_ord, ep->ird, ep->ord); in process_mpa_reply()
1462 if (ep->ird < resp_ord) { in process_mpa_reply()
1464 ep->com.dev->rdev.lldi.max_ordird_qp) in process_mpa_reply()
1465 ep->ird = resp_ord; in process_mpa_reply()
1468 } else if (ep->ird > resp_ord) { in process_mpa_reply()
1469 ep->ird = resp_ord; in process_mpa_reply()
1471 if (ep->ord > resp_ird) { in process_mpa_reply()
1473 ep->ord = resp_ird; in process_mpa_reply()
1479 ep->ird = resp_ord; in process_mpa_reply()
1480 ep->ord = resp_ird; in process_mpa_reply()
1487 ep->mpa_attr.p2p_type = in process_mpa_reply()
1491 ep->mpa_attr.p2p_type = in process_mpa_reply()
1497 ep->mpa_attr.p2p_type = p2p_type; in process_mpa_reply()
1501 "%d\n", __func__, ep->mpa_attr.crc_enabled, in process_mpa_reply()
1502 ep->mpa_attr.recv_marker_enabled, in process_mpa_reply()
1503 ep->mpa_attr.xmit_marker_enabled, ep->mpa_attr.version, in process_mpa_reply()
1504 ep->mpa_attr.p2p_type, p2p_type); in process_mpa_reply()
1512 if ((ep->mpa_attr.version == 2) && peer2peer && in process_mpa_reply()
1513 (ep->mpa_attr.p2p_type != p2p_type)) { in process_mpa_reply()
1514 ep->mpa_attr.p2p_type = FW_RI_INIT_P2PTYPE_DISABLED; in process_mpa_reply()
1518 attrs.mpa_attr = ep->mpa_attr; in process_mpa_reply()
1519 attrs.max_ird = ep->ird; in process_mpa_reply()
1520 attrs.max_ord = ep->ord; in process_mpa_reply()
1521 attrs.llp_stream_handle = ep; in process_mpa_reply()
1529 err = c4iw_modify_qp(ep->com.qp->rhp, in process_mpa_reply()
1530 ep->com.qp, mask, &attrs, 1); in process_mpa_reply()
1544 err = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, in process_mpa_reply()
1564 err = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, in process_mpa_reply()
1572 __state_set(&ep->com, ABORTING); in process_mpa_reply()
1573 send_abort(ep, skb, GFP_KERNEL); in process_mpa_reply()
1575 connect_reply_upcall(ep, err); in process_mpa_reply()
1579 static void process_mpa_request(struct c4iw_ep *ep, struct sk_buff *skb) in process_mpa_request() argument
1585 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in process_mpa_request()
1591 if (ep->mpa_pkt_len + skb->len > sizeof(ep->mpa_pkt)) { in process_mpa_request()
1592 (void)stop_ep_timer(ep); in process_mpa_request()
1593 abort_connection(ep, skb, GFP_KERNEL); in process_mpa_request()
1602 skb_copy_from_linear_data(skb, &(ep->mpa_pkt[ep->mpa_pkt_len]), in process_mpa_request()
1604 ep->mpa_pkt_len += skb->len; in process_mpa_request()
1610 if (ep->mpa_pkt_len < sizeof(*mpa)) in process_mpa_request()
1614 mpa = (struct mpa_message *) ep->mpa_pkt; in process_mpa_request()
1622 (void)stop_ep_timer(ep); in process_mpa_request()
1623 abort_connection(ep, skb, GFP_KERNEL); in process_mpa_request()
1628 (void)stop_ep_timer(ep); in process_mpa_request()
1629 abort_connection(ep, skb, GFP_KERNEL); in process_mpa_request()
1639 (void)stop_ep_timer(ep); in process_mpa_request()
1640 abort_connection(ep, skb, GFP_KERNEL); in process_mpa_request()
1647 if (ep->mpa_pkt_len > (sizeof(*mpa) + plen)) { in process_mpa_request()
1648 (void)stop_ep_timer(ep); in process_mpa_request()
1649 abort_connection(ep, skb, GFP_KERNEL); in process_mpa_request()
1652 ep->plen = (u8) plen; in process_mpa_request()
1657 if (ep->mpa_pkt_len < (sizeof(*mpa) + plen)) in process_mpa_request()
1664 ep->mpa_attr.initiator = 0; in process_mpa_request()
1665 ep->mpa_attr.crc_enabled = (mpa->flags & MPA_CRC) | crc_enabled ? 1 : 0; in process_mpa_request()
1666 ep->mpa_attr.recv_marker_enabled = markers_enabled; in process_mpa_request()
1667 ep->mpa_attr.xmit_marker_enabled = mpa->flags & MPA_MARKERS ? 1 : 0; in process_mpa_request()
1668 ep->mpa_attr.version = mpa->revision; in process_mpa_request()
1670 ep->tried_with_mpa_v1 = 1; in process_mpa_request()
1671 ep->mpa_attr.p2p_type = FW_RI_INIT_P2PTYPE_DISABLED; in process_mpa_request()
1674 ep->mpa_attr.enhanced_rdma_conn = in process_mpa_request()
1676 if (ep->mpa_attr.enhanced_rdma_conn) { in process_mpa_request()
1678 (ep->mpa_pkt + sizeof(*mpa)); in process_mpa_request()
1679 ep->ird = ntohs(mpa_v2_params->ird) & in process_mpa_request()
1681 ep->ord = ntohs(mpa_v2_params->ord) & in process_mpa_request()
1683 PDBG("%s initiator ird %u ord %u\n", __func__, ep->ird, in process_mpa_request()
1684 ep->ord); in process_mpa_request()
1689 ep->mpa_attr.p2p_type = in process_mpa_request()
1693 ep->mpa_attr.p2p_type = in process_mpa_request()
1699 ep->mpa_attr.p2p_type = p2p_type; in process_mpa_request()
1703 ep->mpa_attr.crc_enabled, ep->mpa_attr.recv_marker_enabled, in process_mpa_request()
1704 ep->mpa_attr.xmit_marker_enabled, ep->mpa_attr.version, in process_mpa_request()
1705 ep->mpa_attr.p2p_type); in process_mpa_request()
1712 if (!stop_ep_timer(ep)) { in process_mpa_request()
1713 __state_set(&ep->com, MPA_REQ_RCVD); in process_mpa_request()
1716 mutex_lock_nested(&ep->parent_ep->com.mutex, in process_mpa_request()
1718 if (ep->parent_ep->com.state != DEAD) { in process_mpa_request()
1719 if (connect_request_upcall(ep)) in process_mpa_request()
1720 abort_connection(ep, skb, GFP_KERNEL); in process_mpa_request()
1722 abort_connection(ep, skb, GFP_KERNEL); in process_mpa_request()
1724 mutex_unlock(&ep->parent_ep->com.mutex); in process_mpa_request()
1731 struct c4iw_ep *ep; in rx_data() local
1739 ep = lookup_tid(t, tid); in rx_data()
1740 if (!ep) in rx_data()
1742 PDBG("%s ep %p tid %u dlen %u\n", __func__, ep, ep->hwtid, dlen); in rx_data()
1745 mutex_lock(&ep->com.mutex); in rx_data()
1748 update_rx_credits(ep, dlen); in rx_data()
1750 switch (ep->com.state) { in rx_data()
1752 ep->rcv_seq += dlen; in rx_data()
1753 disconnect = process_mpa_reply(ep, skb); in rx_data()
1756 ep->rcv_seq += dlen; in rx_data()
1757 process_mpa_request(ep, skb); in rx_data()
1761 BUG_ON(!ep->com.qp); in rx_data()
1765 __func__, ep->com.qp->wq.sq.qid, ep, in rx_data()
1766 ep->com.state, ep->hwtid, status); in rx_data()
1768 c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, in rx_data()
1776 mutex_unlock(&ep->com.mutex); in rx_data()
1778 c4iw_ep_disconnect(ep, 0, GFP_KERNEL); in rx_data()
1784 struct c4iw_ep *ep; in abort_rpl() local
1790 ep = lookup_tid(t, tid); in abort_rpl()
1791 if (!ep) { in abort_rpl()
1795 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in abort_rpl()
1796 mutex_lock(&ep->com.mutex); in abort_rpl()
1797 switch (ep->com.state) { in abort_rpl()
1799 c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET); in abort_rpl()
1800 __state_set(&ep->com, DEAD); in abort_rpl()
1805 __func__, ep, ep->com.state); in abort_rpl()
1808 mutex_unlock(&ep->com.mutex); in abort_rpl()
1811 release_ep_resources(ep); in abort_rpl()
1815 static void send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid) in send_fw_act_open_req() argument
1830 ep->com.dev->rdev.lldi.ports[0], in send_fw_act_open_req()
1831 ep->l2t)); in send_fw_act_open_req()
1832 sin = (struct sockaddr_in *)&ep->com.mapped_local_addr; in send_fw_act_open_req()
1835 sin = (struct sockaddr_in *)&ep->com.mapped_remote_addr; in send_fw_act_open_req()
1845 best_mtu(ep->com.dev->rdev.lldi.mtus, ep->mtu, &mtu_idx, in send_fw_act_open_req()
1847 (AF_INET == ep->com.remote_addr.ss_family) ? 0 : 1); in send_fw_act_open_req()
1854 win = ep->rcv_win >> 10; in send_fw_act_open_req()
1864 L2T_IDX_V(ep->l2t->idx) | in send_fw_act_open_req()
1865 TX_CHAN_V(ep->tx_chan) | in send_fw_act_open_req()
1866 SMAC_SEL_V(ep->smac_idx) | in send_fw_act_open_req()
1867 DSCP_V(ep->tos) | in send_fw_act_open_req()
1871 TX_QUEUE_V(ep->com.dev->rdev.lldi.tx_modq[ep->tx_chan]) | in send_fw_act_open_req()
1874 RSS_QUEUE_VALID_F | RSS_QUEUE_V(ep->rss_qid)); in send_fw_act_open_req()
1883 set_wr_txq(skb, CPL_PRIORITY_CONTROL, ep->ctrlq_idx); in send_fw_act_open_req()
1884 set_bit(ACT_OFLD_CONN, &ep->com.history); in send_fw_act_open_req()
1885 c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t); in send_fw_act_open_req()
1920 static void set_tcp_window(struct c4iw_ep *ep, struct port_info *pi) in set_tcp_window() argument
1922 ep->snd_win = snd_win; in set_tcp_window()
1923 ep->rcv_win = rcv_win; in set_tcp_window()
1924 PDBG("%s snd_win %d rcv_win %d\n", __func__, ep->snd_win, ep->rcv_win); in set_tcp_window()
1929 static int import_ep(struct c4iw_ep *ep, int iptype, __u8 *peer_ip, in import_ep() argument
1960 ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t, in import_ep()
1962 if (!ep->l2t) in import_ep()
1964 ep->mtu = pdev->mtu; in import_ep()
1965 ep->tx_chan = cxgb4_port_chan(pdev); in import_ep()
1966 ep->smac_idx = cxgb4_tp_smt_idx(adapter_type, in import_ep()
1970 ep->txq_idx = cxgb4_port_idx(pdev) * step; in import_ep()
1973 ep->ctrlq_idx = cxgb4_port_idx(pdev); in import_ep()
1974 ep->rss_qid = cdev->rdev.lldi.rxq_ids[ in import_ep()
1976 set_tcp_window(ep, (struct port_info *)netdev_priv(pdev)); in import_ep()
1980 ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t, in import_ep()
1982 if (!ep->l2t) in import_ep()
1984 ep->mtu = dst_mtu(dst); in import_ep()
1985 ep->tx_chan = cxgb4_port_chan(pdev); in import_ep()
1986 ep->smac_idx = cxgb4_tp_smt_idx(adapter_type, in import_ep()
1990 ep->txq_idx = cxgb4_port_idx(pdev) * step; in import_ep()
1991 ep->ctrlq_idx = cxgb4_port_idx(pdev); in import_ep()
1994 ep->rss_qid = cdev->rdev.lldi.rxq_ids[ in import_ep()
1996 set_tcp_window(ep, (struct port_info *)netdev_priv(pdev)); in import_ep()
1999 ep->retry_with_mpa_v1 = 0; in import_ep()
2000 ep->tried_with_mpa_v1 = 0; in import_ep()
2012 static int c4iw_reconnect(struct c4iw_ep *ep) in c4iw_reconnect() argument
2016 &ep->com.cm_id->local_addr; in c4iw_reconnect()
2018 &ep->com.cm_id->remote_addr; in c4iw_reconnect()
2020 &ep->com.cm_id->local_addr; in c4iw_reconnect()
2022 &ep->com.cm_id->remote_addr; in c4iw_reconnect()
2026 PDBG("%s qp %p cm_id %p\n", __func__, ep->com.qp, ep->com.cm_id); in c4iw_reconnect()
2027 init_timer(&ep->timer); in c4iw_reconnect()
2032 ep->atid = cxgb4_alloc_atid(ep->com.dev->rdev.lldi.tids, ep); in c4iw_reconnect()
2033 if (ep->atid == -1) { in c4iw_reconnect()
2038 insert_handle(ep->com.dev, &ep->com.dev->atid_idr, ep, ep->atid); in c4iw_reconnect()
2041 if (ep->com.cm_id->local_addr.ss_family == AF_INET) { in c4iw_reconnect()
2042 ep->dst = find_route(ep->com.dev, laddr->sin_addr.s_addr, in c4iw_reconnect()
2048 ep->dst = find_route6(ep->com.dev, laddr6->sin6_addr.s6_addr, in c4iw_reconnect()
2055 if (!ep->dst) { in c4iw_reconnect()
2060 err = import_ep(ep, iptype, ra, ep->dst, ep->com.dev, false, in c4iw_reconnect()
2061 ep->com.dev->rdev.lldi.adapter_type); in c4iw_reconnect()
2068 __func__, ep->txq_idx, ep->tx_chan, ep->smac_idx, ep->rss_qid, in c4iw_reconnect()
2069 ep->l2t->idx); in c4iw_reconnect()
2071 state_set(&ep->com, CONNECTING); in c4iw_reconnect()
2072 ep->tos = 0; in c4iw_reconnect()
2075 err = send_connect(ep); in c4iw_reconnect()
2079 cxgb4_l2t_release(ep->l2t); in c4iw_reconnect()
2081 dst_release(ep->dst); in c4iw_reconnect()
2083 remove_handle(ep->com.dev, &ep->com.dev->atid_idr, ep->atid); in c4iw_reconnect()
2084 cxgb4_free_atid(ep->com.dev->rdev.lldi.tids, ep->atid); in c4iw_reconnect()
2092 connect_reply_upcall(ep, -ECONNRESET); in c4iw_reconnect()
2093 c4iw_put_ep(&ep->com); in c4iw_reconnect()
2100 struct c4iw_ep *ep; in act_open_rpl() local
2111 ep = lookup_atid(t, atid); in act_open_rpl()
2112 la = (struct sockaddr_in *)&ep->com.mapped_local_addr; in act_open_rpl()
2113 ra = (struct sockaddr_in *)&ep->com.mapped_remote_addr; in act_open_rpl()
2114 la6 = (struct sockaddr_in6 *)&ep->com.mapped_local_addr; in act_open_rpl()
2115 ra6 = (struct sockaddr_in6 *)&ep->com.mapped_remote_addr; in act_open_rpl()
2117 PDBG("%s ep %p atid %u status %u errno %d\n", __func__, ep, atid, in act_open_rpl()
2123 ep->stats.connect_neg_adv++; in act_open_rpl()
2130 set_bit(ACT_OPEN_RPL, &ep->com.history); in act_open_rpl()
2143 if (ep->com.local_addr.ss_family == AF_INET && in act_open_rpl()
2145 send_fw_act_open_req(ep, in act_open_rpl()
2152 if (ep->retry_count++ < ACT_OPEN_RETRY_COUNT) { in act_open_rpl()
2153 set_bit(ACT_RETRY_INUSE, &ep->com.history); in act_open_rpl()
2154 if (ep->com.remote_addr.ss_family == AF_INET6) { in act_open_rpl()
2157 &ep->com.mapped_local_addr; in act_open_rpl()
2159 ep->com.dev->rdev.lldi.ports[0], in act_open_rpl()
2163 remove_handle(ep->com.dev, &ep->com.dev->atid_idr, in act_open_rpl()
2166 dst_release(ep->dst); in act_open_rpl()
2167 cxgb4_l2t_release(ep->l2t); in act_open_rpl()
2168 c4iw_reconnect(ep); in act_open_rpl()
2173 if (ep->com.local_addr.ss_family == AF_INET) { in act_open_rpl()
2187 connect_reply_upcall(ep, status2errno(status)); in act_open_rpl()
2188 state_set(&ep->com, DEAD); in act_open_rpl()
2190 if (ep->com.remote_addr.ss_family == AF_INET6) { in act_open_rpl()
2192 (struct sockaddr_in6 *)&ep->com.mapped_local_addr; in act_open_rpl()
2193 cxgb4_clip_release(ep->com.dev->rdev.lldi.ports[0], in act_open_rpl()
2197 cxgb4_remove_tid(ep->com.dev->rdev.lldi.tids, 0, GET_TID(rpl)); in act_open_rpl()
2199 remove_handle(ep->com.dev, &ep->com.dev->atid_idr, atid); in act_open_rpl()
2201 dst_release(ep->dst); in act_open_rpl()
2202 cxgb4_l2t_release(ep->l2t); in act_open_rpl()
2203 c4iw_put_ep(&ep->com); in act_open_rpl()
2213 struct c4iw_listen_ep *ep = lookup_stid(t, stid); in pass_open_rpl() local
2215 if (!ep) { in pass_open_rpl()
2219 PDBG("%s ep %p status %d error %d\n", __func__, ep, in pass_open_rpl()
2221 c4iw_wake_up(&ep->com.wr_wait, status2errno(rpl->status)); in pass_open_rpl()
2232 struct c4iw_listen_ep *ep = lookup_stid(t, stid); in close_listsrv_rpl() local
2234 PDBG("%s ep %p\n", __func__, ep); in close_listsrv_rpl()
2235 c4iw_wake_up(&ep->com.wr_wait, status2errno(rpl->status)); in close_listsrv_rpl()
2239 static void accept_cr(struct c4iw_ep *ep, struct sk_buff *skb, in accept_cr() argument
2249 enum chip_type adapter_type = ep->com.dev->rdev.lldi.adapter_type; in accept_cr()
2251 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in accept_cr()
2259 INIT_TP_WR(rpl5, ep->hwtid); in accept_cr()
2262 INIT_TP_WR(rpl, ep->hwtid); in accept_cr()
2265 ep->hwtid)); in accept_cr()
2267 best_mtu(ep->com.dev->rdev.lldi.mtus, ep->mtu, &mtu_idx, in accept_cr()
2269 (AF_INET == ep->com.remote_addr.ss_family) ? 0 : 1); in accept_cr()
2276 win = ep->rcv_win >> 10; in accept_cr()
2284 L2T_IDX_V(ep->l2t->idx) | in accept_cr()
2285 TX_CHAN_V(ep->tx_chan) | in accept_cr()
2286 SMAC_SEL_V(ep->smac_idx) | in accept_cr()
2287 DSCP_V(ep->tos >> 2) | in accept_cr()
2291 RSS_QUEUE_VALID_F | RSS_QUEUE_V(ep->rss_qid); in accept_cr()
2327 set_wr_txq(skb, CPL_PRIORITY_SETUP, ep->ctrlq_idx); in accept_cr()
2329 c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t); in accept_cr()
2538 struct c4iw_ep *ep; in pass_establish() local
2543 ep = lookup_tid(t, tid); in pass_establish()
2544 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in pass_establish()
2545 ep->snd_seq = be32_to_cpu(req->snd_isn); in pass_establish()
2546 ep->rcv_seq = be32_to_cpu(req->rcv_isn); in pass_establish()
2548 PDBG("%s ep %p hwtid %u tcp_opt 0x%02x\n", __func__, ep, tid, in pass_establish()
2551 set_emss(ep, ntohs(req->tcp_opt)); in pass_establish()
2553 dst_confirm(ep->dst); in pass_establish()
2554 state_set(&ep->com, MPA_REQ_WAIT); in pass_establish()
2555 start_ep_timer(ep); in pass_establish()
2556 send_flowc(ep, skb); in pass_establish()
2557 set_bit(PASS_ESTAB, &ep->com.history); in pass_establish()
2565 struct c4iw_ep *ep; in peer_close() local
2573 ep = lookup_tid(t, tid); in peer_close()
2574 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in peer_close()
2575 dst_confirm(ep->dst); in peer_close()
2577 set_bit(PEER_CLOSE, &ep->com.history); in peer_close()
2578 mutex_lock(&ep->com.mutex); in peer_close()
2579 switch (ep->com.state) { in peer_close()
2581 __state_set(&ep->com, CLOSING); in peer_close()
2584 __state_set(&ep->com, CLOSING); in peer_close()
2585 connect_reply_upcall(ep, -ECONNRESET); in peer_close()
2595 __state_set(&ep->com, CLOSING); in peer_close()
2596 PDBG("waking up ep %p tid %u\n", ep, ep->hwtid); in peer_close()
2597 c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET); in peer_close()
2600 __state_set(&ep->com, CLOSING); in peer_close()
2601 PDBG("waking up ep %p tid %u\n", ep, ep->hwtid); in peer_close()
2602 c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET); in peer_close()
2605 start_ep_timer(ep); in peer_close()
2606 __state_set(&ep->com, CLOSING); in peer_close()
2608 ret = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, in peer_close()
2611 peer_close_upcall(ep); in peer_close()
2619 __state_set(&ep->com, MORIBUND); in peer_close()
2623 (void)stop_ep_timer(ep); in peer_close()
2624 if (ep->com.cm_id && ep->com.qp) { in peer_close()
2626 c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, in peer_close()
2629 close_complete_upcall(ep, 0); in peer_close()
2630 __state_set(&ep->com, DEAD); in peer_close()
2640 mutex_unlock(&ep->com.mutex); in peer_close()
2642 c4iw_ep_disconnect(ep, 0, GFP_KERNEL); in peer_close()
2644 release_ep_resources(ep); in peer_close()
2651 struct c4iw_ep *ep; in peer_abort() local
2660 ep = lookup_tid(t, tid); in peer_abort()
2663 __func__, ep->hwtid, req->status, in peer_abort()
2665 ep->stats.abort_neg_adv++; in peer_abort()
2671 PDBG("%s ep %p tid %u state %u\n", __func__, ep, ep->hwtid, in peer_abort()
2672 ep->com.state); in peer_abort()
2673 set_bit(PEER_ABORT, &ep->com.history); in peer_abort()
2680 if (ep->com.state != MPA_REQ_SENT) in peer_abort()
2681 c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET); in peer_abort()
2683 mutex_lock(&ep->com.mutex); in peer_abort()
2684 switch (ep->com.state) { in peer_abort()
2688 (void)stop_ep_timer(ep); in peer_abort()
2691 (void)stop_ep_timer(ep); in peer_abort()
2692 if (mpa_rev == 1 || (mpa_rev == 2 && ep->tried_with_mpa_v1)) in peer_abort()
2693 connect_reply_upcall(ep, -ECONNRESET); in peer_abort()
2705 ep->retry_with_mpa_v1 = 1; in peer_abort()
2714 stop_ep_timer(ep); in peer_abort()
2717 if (ep->com.cm_id && ep->com.qp) { in peer_abort()
2719 ret = c4iw_modify_qp(ep->com.qp->rhp, in peer_abort()
2720 ep->com.qp, C4IW_QP_ATTR_NEXT_STATE, in peer_abort()
2727 peer_abort_upcall(ep); in peer_abort()
2733 mutex_unlock(&ep->com.mutex); in peer_abort()
2739 dst_confirm(ep->dst); in peer_abort()
2740 if (ep->com.state != ABORTING) { in peer_abort()
2741 __state_set(&ep->com, DEAD); in peer_abort()
2743 if (!ep->retry_with_mpa_v1) in peer_abort()
2746 mutex_unlock(&ep->com.mutex); in peer_abort()
2755 set_wr_txq(skb, CPL_PRIORITY_DATA, ep->txq_idx); in peer_abort()
2757 INIT_TP_WR(rpl, ep->hwtid); in peer_abort()
2758 OPCODE_TID(rpl) = cpu_to_be32(MK_OPCODE_TID(CPL_ABORT_RPL, ep->hwtid)); in peer_abort()
2760 c4iw_ofld_send(&ep->com.dev->rdev, rpl_skb); in peer_abort()
2763 release_ep_resources(ep); in peer_abort()
2764 else if (ep->retry_with_mpa_v1) { in peer_abort()
2765 if (ep->com.remote_addr.ss_family == AF_INET6) { in peer_abort()
2768 &ep->com.mapped_local_addr; in peer_abort()
2770 ep->com.dev->rdev.lldi.ports[0], in peer_abort()
2774 remove_handle(ep->com.dev, &ep->com.dev->hwtid_idr, ep->hwtid); in peer_abort()
2775 cxgb4_remove_tid(ep->com.dev->rdev.lldi.tids, 0, ep->hwtid); in peer_abort()
2776 dst_release(ep->dst); in peer_abort()
2777 cxgb4_l2t_release(ep->l2t); in peer_abort()
2778 c4iw_reconnect(ep); in peer_abort()
2786 struct c4iw_ep *ep; in close_con_rpl() local
2793 ep = lookup_tid(t, tid); in close_con_rpl()
2795 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in close_con_rpl()
2796 BUG_ON(!ep); in close_con_rpl()
2799 mutex_lock(&ep->com.mutex); in close_con_rpl()
2800 switch (ep->com.state) { in close_con_rpl()
2802 __state_set(&ep->com, MORIBUND); in close_con_rpl()
2805 (void)stop_ep_timer(ep); in close_con_rpl()
2806 if ((ep->com.cm_id) && (ep->com.qp)) { in close_con_rpl()
2808 c4iw_modify_qp(ep->com.qp->rhp, in close_con_rpl()
2809 ep->com.qp, in close_con_rpl()
2813 close_complete_upcall(ep, 0); in close_con_rpl()
2814 __state_set(&ep->com, DEAD); in close_con_rpl()
2824 mutex_unlock(&ep->com.mutex); in close_con_rpl()
2826 release_ep_resources(ep); in close_con_rpl()
2835 struct c4iw_ep *ep; in terminate() local
2838 ep = lookup_tid(t, tid); in terminate()
2839 BUG_ON(!ep); in terminate()
2841 if (ep && ep->com.qp) { in terminate()
2843 ep->com.qp->wq.sq.qid); in terminate()
2845 c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, in terminate()
2860 struct c4iw_ep *ep; in fw4_ack() local
2867 ep = lookup_tid(t, tid); in fw4_ack()
2868 PDBG("%s ep %p tid %u credits %u\n", __func__, ep, ep->hwtid, credits); in fw4_ack()
2871 __func__, ep, ep->hwtid, state_read(&ep->com)); in fw4_ack()
2875 dst_confirm(ep->dst); in fw4_ack()
2876 if (ep->mpa_skb) { in fw4_ack()
2878 "initiator %u freeing skb\n", __func__, ep, ep->hwtid, in fw4_ack()
2879 state_read(&ep->com), ep->mpa_attr.initiator ? 1 : 0); in fw4_ack()
2880 kfree_skb(ep->mpa_skb); in fw4_ack()
2881 ep->mpa_skb = NULL; in fw4_ack()
2890 struct c4iw_ep *ep = to_ep(cm_id); in c4iw_reject_cr() local
2891 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in c4iw_reject_cr()
2893 mutex_lock(&ep->com.mutex); in c4iw_reject_cr()
2894 if (ep->com.state == DEAD) { in c4iw_reject_cr()
2895 mutex_unlock(&ep->com.mutex); in c4iw_reject_cr()
2896 c4iw_put_ep(&ep->com); in c4iw_reject_cr()
2899 set_bit(ULP_REJECT, &ep->com.history); in c4iw_reject_cr()
2900 BUG_ON(ep->com.state != MPA_REQ_RCVD); in c4iw_reject_cr()
2902 abort_connection(ep, NULL, GFP_KERNEL); in c4iw_reject_cr()
2904 err = send_mpa_reject(ep, pdata, pdata_len); in c4iw_reject_cr()
2907 mutex_unlock(&ep->com.mutex); in c4iw_reject_cr()
2909 err = c4iw_ep_disconnect(ep, 0, GFP_KERNEL); in c4iw_reject_cr()
2910 c4iw_put_ep(&ep->com); in c4iw_reject_cr()
2919 struct c4iw_ep *ep = to_ep(cm_id); in c4iw_accept_cr() local
2923 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); in c4iw_accept_cr()
2925 mutex_lock(&ep->com.mutex); in c4iw_accept_cr()
2926 if (ep->com.state == DEAD) { in c4iw_accept_cr()
2931 BUG_ON(ep->com.state != MPA_REQ_RCVD); in c4iw_accept_cr()
2934 set_bit(ULP_ACCEPT, &ep->com.history); in c4iw_accept_cr()
2935 if ((conn_param->ord > cur_max_read_depth(ep->com.dev)) || in c4iw_accept_cr()
2936 (conn_param->ird > cur_max_read_depth(ep->com.dev))) { in c4iw_accept_cr()
2937 abort_connection(ep, NULL, GFP_KERNEL); in c4iw_accept_cr()
2942 if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) { in c4iw_accept_cr()
2943 if (conn_param->ord > ep->ird) { in c4iw_accept_cr()
2945 ep->ord = ep->ird; in c4iw_accept_cr()
2947 ep->ird = conn_param->ird; in c4iw_accept_cr()
2948 ep->ord = conn_param->ord; in c4iw_accept_cr()
2949 send_mpa_reject(ep, conn_param->private_data, in c4iw_accept_cr()
2951 abort_connection(ep, NULL, GFP_KERNEL); in c4iw_accept_cr()
2956 if (conn_param->ird < ep->ord) { in c4iw_accept_cr()
2958 ep->ord <= h->rdev.lldi.max_ordird_qp) { in c4iw_accept_cr()
2959 conn_param->ird = ep->ord; in c4iw_accept_cr()
2961 abort_connection(ep, NULL, GFP_KERNEL); in c4iw_accept_cr()
2967 ep->ird = conn_param->ird; in c4iw_accept_cr()
2968 ep->ord = conn_param->ord; in c4iw_accept_cr()
2970 if (ep->mpa_attr.version == 1) { in c4iw_accept_cr()
2971 if (peer2peer && ep->ird == 0) in c4iw_accept_cr()
2972 ep->ird = 1; in c4iw_accept_cr()
2975 (ep->mpa_attr.p2p_type != FW_RI_INIT_P2PTYPE_DISABLED) && in c4iw_accept_cr()
2976 (p2p_type == FW_RI_INIT_P2PTYPE_READ_REQ) && ep->ird == 0) in c4iw_accept_cr()
2977 ep->ird = 1; in c4iw_accept_cr()
2980 PDBG("%s %d ird %d ord %d\n", __func__, __LINE__, ep->ird, ep->ord); in c4iw_accept_cr()
2983 ep->com.cm_id = cm_id; in c4iw_accept_cr()
2984 ep->com.qp = qp; in c4iw_accept_cr()
2985 ref_qp(ep); in c4iw_accept_cr()
2988 attrs.mpa_attr = ep->mpa_attr; in c4iw_accept_cr()
2989 attrs.max_ird = ep->ird; in c4iw_accept_cr()
2990 attrs.max_ord = ep->ord; in c4iw_accept_cr()
2991 attrs.llp_stream_handle = ep; in c4iw_accept_cr()
3001 err = c4iw_modify_qp(ep->com.qp->rhp, in c4iw_accept_cr()
3002 ep->com.qp, mask, &attrs, 1); in c4iw_accept_cr()
3005 err = send_mpa_reply(ep, conn_param->private_data, in c4iw_accept_cr()
3010 __state_set(&ep->com, FPDU_MODE); in c4iw_accept_cr()
3011 established_upcall(ep); in c4iw_accept_cr()
3012 mutex_unlock(&ep->com.mutex); in c4iw_accept_cr()
3013 c4iw_put_ep(&ep->com); in c4iw_accept_cr()
3016 ep->com.cm_id = NULL; in c4iw_accept_cr()
3017 abort_connection(ep, NULL, GFP_KERNEL); in c4iw_accept_cr()
3020 mutex_unlock(&ep->com.mutex); in c4iw_accept_cr()
3021 c4iw_put_ep(&ep->com); in c4iw_accept_cr()
3089 struct c4iw_ep *ep; in c4iw_connect() local
3106 ep = alloc_ep(sizeof(*ep), GFP_KERNEL); in c4iw_connect()
3107 if (!ep) { in c4iw_connect()
3112 init_timer(&ep->timer); in c4iw_connect()
3113 ep->plen = conn_param->private_data_len; in c4iw_connect()
3114 if (ep->plen) in c4iw_connect()
3115 memcpy(ep->mpa_pkt + sizeof(struct mpa_message), in c4iw_connect()
3116 conn_param->private_data, ep->plen); in c4iw_connect()
3117 ep->ird = conn_param->ird; in c4iw_connect()
3118 ep->ord = conn_param->ord; in c4iw_connect()
3120 if (peer2peer && ep->ord == 0) in c4iw_connect()
3121 ep->ord = 1; in c4iw_connect()
3124 ep->com.dev = dev; in c4iw_connect()
3125 ep->com.cm_id = cm_id; in c4iw_connect()
3126 ep->com.qp = get_qhp(dev, conn_param->qpn); in c4iw_connect()
3127 if (!ep->com.qp) { in c4iw_connect()
3132 ref_qp(ep); in c4iw_connect()
3134 ep->com.qp, cm_id); in c4iw_connect()
3139 ep->atid = cxgb4_alloc_atid(dev->rdev.lldi.tids, ep); in c4iw_connect()
3140 if (ep->atid == -1) { in c4iw_connect()
3145 insert_handle(dev, &dev->atid_idr, ep, ep->atid); in c4iw_connect()
3147 memcpy(&ep->com.local_addr, &cm_id->local_addr, in c4iw_connect()
3148 sizeof(ep->com.local_addr)); in c4iw_connect()
3149 memcpy(&ep->com.remote_addr, &cm_id->remote_addr, in c4iw_connect()
3150 sizeof(ep->com.remote_addr)); in c4iw_connect()
3153 memcpy(&ep->com.mapped_local_addr, &cm_id->local_addr, in c4iw_connect()
3154 sizeof(ep->com.mapped_local_addr)); in c4iw_connect()
3155 memcpy(&ep->com.mapped_remote_addr, &cm_id->remote_addr, in c4iw_connect()
3156 sizeof(ep->com.mapped_remote_addr)); in c4iw_connect()
3165 c4iw_form_pm_msg(ep, &pm_msg); in c4iw_connect()
3171 c4iw_record_pm_msg(ep, &pm_msg); in c4iw_connect()
3173 if (iwpm_create_mapinfo(&ep->com.local_addr, in c4iw_connect()
3174 &ep->com.mapped_local_addr, RDMA_NL_C4IW)) { in c4iw_connect()
3175 iwpm_remove_mapping(&ep->com.local_addr, RDMA_NL_C4IW); in c4iw_connect()
3179 print_addr(&ep->com, __func__, "add_query/create_mapinfo"); in c4iw_connect()
3180 set_bit(RELEASE_MAPINFO, &ep->com.flags); in c4iw_connect()
3182 laddr = (struct sockaddr_in *)&ep->com.mapped_local_addr; in c4iw_connect()
3183 raddr = (struct sockaddr_in *)&ep->com.mapped_remote_addr; in c4iw_connect()
3184 laddr6 = (struct sockaddr_in6 *)&ep->com.mapped_local_addr; in c4iw_connect()
3185 raddr6 = (struct sockaddr_in6 *) &ep->com.mapped_remote_addr; in c4iw_connect()
3204 ep->dst = find_route(dev, laddr->sin_addr.s_addr, in c4iw_connect()
3225 ep->dst = find_route6(dev, laddr6->sin6_addr.s6_addr, in c4iw_connect()
3230 if (!ep->dst) { in c4iw_connect()
3236 err = import_ep(ep, iptype, ra, ep->dst, ep->com.dev, true, in c4iw_connect()
3237 ep->com.dev->rdev.lldi.adapter_type); in c4iw_connect()
3244 __func__, ep->txq_idx, ep->tx_chan, ep->smac_idx, ep->rss_qid, in c4iw_connect()
3245 ep->l2t->idx); in c4iw_connect()
3247 state_set(&ep->com, CONNECTING); in c4iw_connect()
3248 ep->tos = 0; in c4iw_connect()
3251 err = send_connect(ep); in c4iw_connect()
3255 cxgb4_l2t_release(ep->l2t); in c4iw_connect()
3257 dst_release(ep->dst); in c4iw_connect()
3259 remove_handle(ep->com.dev, &ep->com.dev->atid_idr, ep->atid); in c4iw_connect()
3260 cxgb4_free_atid(ep->com.dev->rdev.lldi.tids, ep->atid); in c4iw_connect()
3263 c4iw_put_ep(&ep->com); in c4iw_connect()
3268 static int create_server6(struct c4iw_dev *dev, struct c4iw_listen_ep *ep) in create_server6() argument
3272 &ep->com.mapped_local_addr; in create_server6()
3274 c4iw_init_wr_wait(&ep->com.wr_wait); in create_server6()
3275 err = cxgb4_create_server6(ep->com.dev->rdev.lldi.ports[0], in create_server6()
3276 ep->stid, &sin6->sin6_addr, in create_server6()
3278 ep->com.dev->rdev.lldi.rxq_ids[0]); in create_server6()
3280 err = c4iw_wait_for_reply(&ep->com.dev->rdev, in create_server6()
3281 &ep->com.wr_wait, in create_server6()
3287 err, ep->stid, in create_server6()
3290 cxgb4_clip_get(ep->com.dev->rdev.lldi.ports[0], in create_server6()
3295 static int create_server4(struct c4iw_dev *dev, struct c4iw_listen_ep *ep) in create_server4() argument
3299 &ep->com.mapped_local_addr; in create_server4()
3304 ep->com.dev->rdev.lldi.ports[0], ep->stid, in create_server4()
3306 ep->com.dev->rdev.lldi.rxq_ids[0], 0, 0); in create_server4()
3308 if (c4iw_fatal_error(&ep->com.dev->rdev)) { in create_server4()
3317 c4iw_init_wr_wait(&ep->com.wr_wait); in create_server4()
3318 err = cxgb4_create_server(ep->com.dev->rdev.lldi.ports[0], in create_server4()
3319 ep->stid, sin->sin_addr.s_addr, sin->sin_port, in create_server4()
3320 0, ep->com.dev->rdev.lldi.rxq_ids[0]); in create_server4()
3322 err = c4iw_wait_for_reply(&ep->com.dev->rdev, in create_server4()
3323 &ep->com.wr_wait, in create_server4()
3330 , err, ep->stid, in create_server4()
3339 struct c4iw_listen_ep *ep; in c4iw_create_listen() local
3346 ep = alloc_ep(sizeof(*ep), GFP_KERNEL); in c4iw_create_listen()
3347 if (!ep) { in c4iw_create_listen()
3352 PDBG("%s ep %p\n", __func__, ep); in c4iw_create_listen()
3354 ep->com.cm_id = cm_id; in c4iw_create_listen()
3355 ep->com.dev = dev; in c4iw_create_listen()
3356 ep->backlog = backlog; in c4iw_create_listen()
3357 memcpy(&ep->com.local_addr, &cm_id->local_addr, in c4iw_create_listen()
3358 sizeof(ep->com.local_addr)); in c4iw_create_listen()
3364 ep->com.local_addr.ss_family == AF_INET) in c4iw_create_listen()
3365 ep->stid = cxgb4_alloc_sftid(dev->rdev.lldi.tids, in c4iw_create_listen()
3366 cm_id->local_addr.ss_family, ep); in c4iw_create_listen()
3368 ep->stid = cxgb4_alloc_stid(dev->rdev.lldi.tids, in c4iw_create_listen()
3369 cm_id->local_addr.ss_family, ep); in c4iw_create_listen()
3371 if (ep->stid == -1) { in c4iw_create_listen()
3376 insert_handle(dev, &dev->stid_idr, ep, ep->stid); in c4iw_create_listen()
3379 memcpy(&ep->com.mapped_local_addr, &cm_id->local_addr, in c4iw_create_listen()
3380 sizeof(ep->com.mapped_local_addr)); in c4iw_create_listen()
3389 memcpy(&pm_msg.loc_addr, &ep->com.local_addr, in c4iw_create_listen()
3390 sizeof(ep->com.local_addr)); in c4iw_create_listen()
3396 memcpy(&ep->com.mapped_local_addr, in c4iw_create_listen()
3398 sizeof(ep->com.mapped_local_addr)); in c4iw_create_listen()
3400 if (iwpm_create_mapinfo(&ep->com.local_addr, in c4iw_create_listen()
3401 &ep->com.mapped_local_addr, RDMA_NL_C4IW)) { in c4iw_create_listen()
3405 print_addr(&ep->com, __func__, "add_mapping/create_mapinfo"); in c4iw_create_listen()
3407 set_bit(RELEASE_MAPINFO, &ep->com.flags); in c4iw_create_listen()
3408 state_set(&ep->com, LISTEN); in c4iw_create_listen()
3409 if (ep->com.local_addr.ss_family == AF_INET) in c4iw_create_listen()
3410 err = create_server4(dev, ep); in c4iw_create_listen()
3412 err = create_server6(dev, ep); in c4iw_create_listen()
3414 cm_id->provider_data = ep; in c4iw_create_listen()
3419 cxgb4_free_stid(ep->com.dev->rdev.lldi.tids, ep->stid, in c4iw_create_listen()
3420 ep->com.local_addr.ss_family); in c4iw_create_listen()
3423 c4iw_put_ep(&ep->com); in c4iw_create_listen()
3432 struct c4iw_listen_ep *ep = to_listen_ep(cm_id); in c4iw_destroy_listen() local
3434 PDBG("%s ep %p\n", __func__, ep); in c4iw_destroy_listen()
3437 state_set(&ep->com, DEAD); in c4iw_destroy_listen()
3438 if (ep->com.dev->rdev.lldi.enable_fw_ofld_conn && in c4iw_destroy_listen()
3439 ep->com.local_addr.ss_family == AF_INET) { in c4iw_destroy_listen()
3441 ep->com.dev->rdev.lldi.ports[0], ep->stid, in c4iw_destroy_listen()
3442 ep->com.dev->rdev.lldi.rxq_ids[0], 0); in c4iw_destroy_listen()
3445 c4iw_init_wr_wait(&ep->com.wr_wait); in c4iw_destroy_listen()
3447 ep->com.dev->rdev.lldi.ports[0], ep->stid, in c4iw_destroy_listen()
3448 ep->com.dev->rdev.lldi.rxq_ids[0], 0); in c4iw_destroy_listen()
3451 err = c4iw_wait_for_reply(&ep->com.dev->rdev, &ep->com.wr_wait, in c4iw_destroy_listen()
3453 sin6 = (struct sockaddr_in6 *)&ep->com.mapped_local_addr; in c4iw_destroy_listen()
3454 cxgb4_clip_release(ep->com.dev->rdev.lldi.ports[0], in c4iw_destroy_listen()
3457 remove_handle(ep->com.dev, &ep->com.dev->stid_idr, ep->stid); in c4iw_destroy_listen()
3458 cxgb4_free_stid(ep->com.dev->rdev.lldi.tids, ep->stid, in c4iw_destroy_listen()
3459 ep->com.local_addr.ss_family); in c4iw_destroy_listen()
3462 c4iw_put_ep(&ep->com); in c4iw_destroy_listen()
3466 int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp) in c4iw_ep_disconnect() argument
3473 mutex_lock(&ep->com.mutex); in c4iw_ep_disconnect()
3475 PDBG("%s ep %p state %s, abrupt %d\n", __func__, ep, in c4iw_ep_disconnect()
3476 states[ep->com.state], abrupt); in c4iw_ep_disconnect()
3478 rdev = &ep->com.dev->rdev; in c4iw_ep_disconnect()
3481 close_complete_upcall(ep, -EIO); in c4iw_ep_disconnect()
3482 ep->com.state = DEAD; in c4iw_ep_disconnect()
3484 switch (ep->com.state) { in c4iw_ep_disconnect()
3492 ep->com.state = ABORTING; in c4iw_ep_disconnect()
3494 ep->com.state = CLOSING; in c4iw_ep_disconnect()
3495 start_ep_timer(ep); in c4iw_ep_disconnect()
3497 set_bit(CLOSE_SENT, &ep->com.flags); in c4iw_ep_disconnect()
3500 if (!test_and_set_bit(CLOSE_SENT, &ep->com.flags)) { in c4iw_ep_disconnect()
3503 (void)stop_ep_timer(ep); in c4iw_ep_disconnect()
3504 ep->com.state = ABORTING; in c4iw_ep_disconnect()
3506 ep->com.state = MORIBUND; in c4iw_ep_disconnect()
3513 __func__, ep, ep->com.state); in c4iw_ep_disconnect()
3522 set_bit(EP_DISC_ABORT, &ep->com.history); in c4iw_ep_disconnect()
3523 close_complete_upcall(ep, -ECONNRESET); in c4iw_ep_disconnect()
3524 ret = send_abort(ep, NULL, gfp); in c4iw_ep_disconnect()
3526 set_bit(EP_DISC_CLOSE, &ep->com.history); in c4iw_ep_disconnect()
3527 ret = send_halfclose(ep, gfp); in c4iw_ep_disconnect()
3532 mutex_unlock(&ep->com.mutex); in c4iw_ep_disconnect()
3534 release_ep_resources(ep); in c4iw_ep_disconnect()
3541 struct c4iw_ep *ep; in active_ofld_conn_reply() local
3544 ep = (struct c4iw_ep *)lookup_atid(dev->rdev.lldi.tids, in active_ofld_conn_reply()
3546 if (!ep) in active_ofld_conn_reply()
3551 set_bit(ACT_RETRY_NOMEM, &ep->com.history); in active_ofld_conn_reply()
3552 if (ep->retry_count++ < ACT_OPEN_RETRY_COUNT) { in active_ofld_conn_reply()
3553 send_fw_act_open_req(ep, atid); in active_ofld_conn_reply()
3557 set_bit(ACT_RETRY_INUSE, &ep->com.history); in active_ofld_conn_reply()
3558 if (ep->retry_count++ < ACT_OPEN_RETRY_COUNT) { in active_ofld_conn_reply()
3559 send_fw_act_open_req(ep, atid); in active_ofld_conn_reply()
3573 connect_reply_upcall(ep, status2errno(req->retval)); in active_ofld_conn_reply()
3574 state_set(&ep->com, DEAD); in active_ofld_conn_reply()
3575 if (ep->com.remote_addr.ss_family == AF_INET6) { in active_ofld_conn_reply()
3577 (struct sockaddr_in6 *)&ep->com.mapped_local_addr; in active_ofld_conn_reply()
3578 cxgb4_clip_release(ep->com.dev->rdev.lldi.ports[0], in active_ofld_conn_reply()
3583 dst_release(ep->dst); in active_ofld_conn_reply()
3584 cxgb4_l2t_release(ep->l2t); in active_ofld_conn_reply()
3585 c4iw_put_ep(&ep->com); in active_ofld_conn_reply()
3939 static void process_timeout(struct c4iw_ep *ep) in process_timeout() argument
3944 mutex_lock(&ep->com.mutex); in process_timeout()
3945 PDBG("%s ep %p tid %u state %d\n", __func__, ep, ep->hwtid, in process_timeout()
3946 ep->com.state); in process_timeout()
3947 set_bit(TIMEDOUT, &ep->com.history); in process_timeout()
3948 switch (ep->com.state) { in process_timeout()
3950 __state_set(&ep->com, ABORTING); in process_timeout()
3951 connect_reply_upcall(ep, -ETIMEDOUT); in process_timeout()
3954 __state_set(&ep->com, ABORTING); in process_timeout()
3958 if (ep->com.cm_id && ep->com.qp) { in process_timeout()
3960 c4iw_modify_qp(ep->com.qp->rhp, in process_timeout()
3961 ep->com.qp, C4IW_QP_ATTR_NEXT_STATE, in process_timeout()
3964 __state_set(&ep->com, ABORTING); in process_timeout()
3965 close_complete_upcall(ep, -ETIMEDOUT); in process_timeout()
3979 __func__, ep, ep->hwtid, ep->com.state); in process_timeout()
3983 abort_connection(ep, NULL, GFP_KERNEL); in process_timeout()
3984 mutex_unlock(&ep->com.mutex); in process_timeout()
3985 c4iw_put_ep(&ep->com); in process_timeout()
3990 struct c4iw_ep *ep; in process_timedout_eps() local
4001 ep = list_entry(tmp, struct c4iw_ep, entry); in process_timedout_eps()
4002 process_timeout(ep); in process_timedout_eps()
4034 struct c4iw_ep *ep = (struct c4iw_ep *)arg; in ep_timeout() local
4038 if (!test_and_set_bit(TIMEOUT, &ep->com.flags)) { in ep_timeout()
4042 if (!ep->entry.next) { in ep_timeout()
4043 list_add_tail(&ep->entry, &timeout_list); in ep_timeout()
4116 struct c4iw_ep *ep; in peer_abort_intr() local
4120 ep = lookup_tid(t, tid); in peer_abort_intr()
4121 if (!ep) { in peer_abort_intr()
4129 __func__, ep->hwtid, req->status, in peer_abort_intr()
4131 ep->stats.abort_neg_adv++; in peer_abort_intr()
4136 PDBG("%s ep %p tid %u state %u\n", __func__, ep, ep->hwtid, in peer_abort_intr()
4137 ep->com.state); in peer_abort_intr()
4144 if (mpa_rev == 2 && !ep->tried_with_mpa_v1) { in peer_abort_intr()
4145 if (ep->com.state != MPA_REQ_SENT) in peer_abort_intr()
4146 c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET); in peer_abort_intr()
4148 c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET); in peer_abort_intr()