• Home
  • Raw
  • Download

Lines Matching refs:cm_node

29 static void irdma_record_ird_ord(struct irdma_cm_node *cm_node, u32 conn_ird,  in irdma_record_ird_ord()  argument
32 if (conn_ird > cm_node->dev->hw_attrs.max_hw_ird) in irdma_record_ird_ord()
33 conn_ird = cm_node->dev->hw_attrs.max_hw_ird; in irdma_record_ird_ord()
35 if (conn_ord > cm_node->dev->hw_attrs.max_hw_ord) in irdma_record_ird_ord()
36 conn_ord = cm_node->dev->hw_attrs.max_hw_ord; in irdma_record_ird_ord()
37 else if (!conn_ord && cm_node->send_rdma0_op == SEND_RDMA_READ_ZERO) in irdma_record_ird_ord()
39 cm_node->ird_size = conn_ird; in irdma_record_ird_ord()
40 cm_node->ord_size = conn_ord; in irdma_record_ird_ord()
74 static void irdma_get_addr_info(struct irdma_cm_node *cm_node, in irdma_get_addr_info() argument
78 cm_info->ipv4 = cm_node->ipv4; in irdma_get_addr_info()
79 cm_info->vlan_id = cm_node->vlan_id; in irdma_get_addr_info()
80 memcpy(cm_info->loc_addr, cm_node->loc_addr, sizeof(cm_info->loc_addr)); in irdma_get_addr_info()
81 memcpy(cm_info->rem_addr, cm_node->rem_addr, sizeof(cm_info->rem_addr)); in irdma_get_addr_info()
82 cm_info->loc_port = cm_node->loc_port; in irdma_get_addr_info()
83 cm_info->rem_port = cm_node->rem_port; in irdma_get_addr_info()
91 static inline void irdma_fill_sockaddr4(struct irdma_cm_node *cm_node, in irdma_fill_sockaddr4() argument
100 laddr->sin_port = htons(cm_node->loc_port); in irdma_fill_sockaddr4()
101 raddr->sin_port = htons(cm_node->rem_port); in irdma_fill_sockaddr4()
103 laddr->sin_addr.s_addr = htonl(cm_node->loc_addr[0]); in irdma_fill_sockaddr4()
104 raddr->sin_addr.s_addr = htonl(cm_node->rem_addr[0]); in irdma_fill_sockaddr4()
112 static inline void irdma_fill_sockaddr6(struct irdma_cm_node *cm_node, in irdma_fill_sockaddr6() argument
121 laddr6->sin6_port = htons(cm_node->loc_port); in irdma_fill_sockaddr6()
122 raddr6->sin6_port = htons(cm_node->rem_port); in irdma_fill_sockaddr6()
125 cm_node->loc_addr); in irdma_fill_sockaddr6()
127 cm_node->rem_addr); in irdma_fill_sockaddr6()
136 static inline void irdma_get_cmevent_info(struct irdma_cm_node *cm_node, in irdma_get_cmevent_info() argument
144 if (cm_node) { in irdma_get_cmevent_info()
145 event->private_data = cm_node->pdata_buf; in irdma_get_cmevent_info()
146 event->private_data_len = (u8)cm_node->pdata.size; in irdma_get_cmevent_info()
147 event->ird = cm_node->ird_size; in irdma_get_cmevent_info()
148 event->ord = cm_node->ord_size; in irdma_get_cmevent_info()
159 static int irdma_send_cm_event(struct irdma_cm_node *cm_node, in irdma_send_cm_event() argument
167 trace_irdma_send_cm_event(cm_node, cm_id, type, status, in irdma_send_cm_event()
170 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_send_cm_event()
172 cm_node, cm_id, cm_node->accelerated, cm_node->state, type, in irdma_send_cm_event()
177 if (cm_node->ipv4) in irdma_send_cm_event()
178 irdma_fill_sockaddr4(cm_node, &event); in irdma_send_cm_event()
180 irdma_fill_sockaddr6(cm_node, &event); in irdma_send_cm_event()
181 event.provider_data = cm_node; in irdma_send_cm_event()
182 event.private_data = cm_node->pdata_buf; in irdma_send_cm_event()
183 event.private_data_len = (u8)cm_node->pdata.size; in irdma_send_cm_event()
184 event.ird = cm_node->ird_size; in irdma_send_cm_event()
187 irdma_get_cmevent_info(cm_node, cm_id, &event); in irdma_send_cm_event()
190 event.ird = cm_node->ird_size; in irdma_send_cm_event()
191 event.ord = cm_node->ord_size; in irdma_send_cm_event()
196 if (!cm_node->accelerated) in irdma_send_cm_event()
197 wait_for_completion(&cm_node->establish_comp); in irdma_send_cm_event()
214 struct irdma_cm_node *cm_node; in irdma_timer_list_prep() local
217 hash_for_each_rcu(cm_core->cm_hash_tbl, bkt, cm_node, list) { in irdma_timer_list_prep()
218 if ((cm_node->close_entry || cm_node->send_entry) && in irdma_timer_list_prep()
219 refcount_inc_not_zero(&cm_node->refcnt)) in irdma_timer_list_prep()
220 list_add(&cm_node->timer_entry, timer_list); in irdma_timer_list_prep()
229 static struct irdma_cm_event *irdma_create_event(struct irdma_cm_node *cm_node, in irdma_create_event() argument
234 if (!cm_node->cm_id) in irdma_create_event()
243 event->cm_node = cm_node; in irdma_create_event()
244 memcpy(event->cm_info.rem_addr, cm_node->rem_addr, in irdma_create_event()
246 memcpy(event->cm_info.loc_addr, cm_node->loc_addr, in irdma_create_event()
248 event->cm_info.rem_port = cm_node->rem_port; in irdma_create_event()
249 event->cm_info.loc_port = cm_node->loc_port; in irdma_create_event()
250 event->cm_info.cm_id = cm_node->cm_id; in irdma_create_event()
251 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_create_event()
252 "CM: node=%p event=%p type=%u dst=%pI4 src=%pI4\n", cm_node, in irdma_create_event()
255 trace_irdma_create_event(cm_node, type, __builtin_return_address(0)); in irdma_create_event()
265 static void irdma_free_retrans_entry(struct irdma_cm_node *cm_node) in irdma_free_retrans_entry() argument
267 struct irdma_device *iwdev = cm_node->iwdev; in irdma_free_retrans_entry()
270 send_entry = cm_node->send_entry; in irdma_free_retrans_entry()
274 cm_node->send_entry = NULL; in irdma_free_retrans_entry()
277 refcount_dec(&cm_node->refcnt); in irdma_free_retrans_entry()
284 static void irdma_cleanup_retrans_entry(struct irdma_cm_node *cm_node) in irdma_cleanup_retrans_entry() argument
288 spin_lock_irqsave(&cm_node->retrans_list_lock, flags); in irdma_cleanup_retrans_entry()
289 irdma_free_retrans_entry(cm_node); in irdma_cleanup_retrans_entry()
290 spin_unlock_irqrestore(&cm_node->retrans_list_lock, flags); in irdma_cleanup_retrans_entry()
301 static struct irdma_puda_buf *irdma_form_ah_cm_frame(struct irdma_cm_node *cm_node, in irdma_form_ah_cm_frame() argument
308 struct irdma_sc_vsi *vsi = &cm_node->iwdev->vsi; in irdma_form_ah_cm_frame()
316 if (!cm_node->ah || !cm_node->ah->ah_info.ah_valid) { in irdma_form_ah_cm_frame()
317 ibdev_dbg(&cm_node->iwdev->ibdev, "CM: AH invalid\n"); in irdma_form_ah_cm_frame()
323 ibdev_dbg(&cm_node->iwdev->ibdev, "CM: SQ buf NULL\n"); in irdma_form_ah_cm_frame()
327 sqbuf->ah_id = cm_node->ah->ah_info.ah_idx; in irdma_form_ah_cm_frame()
344 sqbuf->scratch = cm_node; in irdma_form_ah_cm_frame()
349 tcph->source = htons(cm_node->loc_port); in irdma_form_ah_cm_frame()
350 tcph->dest = htons(cm_node->rem_port); in irdma_form_ah_cm_frame()
351 tcph->seq = htonl(cm_node->tcp_cntxt.loc_seq_num); in irdma_form_ah_cm_frame()
354 cm_node->tcp_cntxt.loc_ack_num = cm_node->tcp_cntxt.rcv_nxt; in irdma_form_ah_cm_frame()
355 tcph->ack_seq = htonl(cm_node->tcp_cntxt.loc_ack_num); in irdma_form_ah_cm_frame()
362 cm_node->tcp_cntxt.loc_seq_num++; in irdma_form_ah_cm_frame()
365 cm_node->tcp_cntxt.loc_seq_num += hdr_len + pd_len; in irdma_form_ah_cm_frame()
369 cm_node->tcp_cntxt.loc_seq_num++; in irdma_form_ah_cm_frame()
378 tcph->window = htons(cm_node->tcp_cntxt.rcv_wnd); in irdma_form_ah_cm_frame()
410 static struct irdma_puda_buf *irdma_form_uda_cm_frame(struct irdma_cm_node *cm_node, in irdma_form_uda_cm_frame() argument
417 struct irdma_sc_vsi *vsi = &cm_node->iwdev->vsi; in irdma_form_uda_cm_frame()
447 if (cm_node->vlan_id < VLAN_N_VID) in irdma_form_uda_cm_frame()
450 if (cm_node->ipv4) in irdma_form_uda_cm_frame()
461 sqbuf->scratch = cm_node; in irdma_form_uda_cm_frame()
466 if (cm_node->do_lpb) in irdma_form_uda_cm_frame()
469 if (cm_node->ipv4) { in irdma_form_uda_cm_frame()
477 ether_addr_copy(ethh->h_dest, cm_node->rem_mac); in irdma_form_uda_cm_frame()
478 ether_addr_copy(ethh->h_source, cm_node->loc_mac); in irdma_form_uda_cm_frame()
479 if (cm_node->vlan_id < VLAN_N_VID) { in irdma_form_uda_cm_frame()
482 vtag = (cm_node->user_pri << VLAN_PRIO_SHIFT) | in irdma_form_uda_cm_frame()
483 cm_node->vlan_id; in irdma_form_uda_cm_frame()
494 iph->tos = cm_node->tos; in irdma_form_uda_cm_frame()
496 iph->id = htons(++cm_node->tcp_cntxt.loc_id); in irdma_form_uda_cm_frame()
501 iph->saddr = htonl(cm_node->loc_addr[0]); in irdma_form_uda_cm_frame()
502 iph->daddr = htonl(cm_node->rem_addr[0]); in irdma_form_uda_cm_frame()
510 ether_addr_copy(ethh->h_dest, cm_node->rem_mac); in irdma_form_uda_cm_frame()
511 ether_addr_copy(ethh->h_source, cm_node->loc_mac); in irdma_form_uda_cm_frame()
512 if (cm_node->vlan_id < VLAN_N_VID) { in irdma_form_uda_cm_frame()
515 vtag = (cm_node->user_pri << VLAN_PRIO_SHIFT) | in irdma_form_uda_cm_frame()
516 cm_node->vlan_id; in irdma_form_uda_cm_frame()
524 ip6h->priority = cm_node->tos >> 4; in irdma_form_uda_cm_frame()
525 ip6h->flow_lbl[0] = cm_node->tos << 4; in irdma_form_uda_cm_frame()
532 cm_node->loc_addr); in irdma_form_uda_cm_frame()
534 cm_node->rem_addr); in irdma_form_uda_cm_frame()
537 tcph->source = htons(cm_node->loc_port); in irdma_form_uda_cm_frame()
538 tcph->dest = htons(cm_node->rem_port); in irdma_form_uda_cm_frame()
539 tcph->seq = htonl(cm_node->tcp_cntxt.loc_seq_num); in irdma_form_uda_cm_frame()
542 cm_node->tcp_cntxt.loc_ack_num = cm_node->tcp_cntxt.rcv_nxt; in irdma_form_uda_cm_frame()
543 tcph->ack_seq = htonl(cm_node->tcp_cntxt.loc_ack_num); in irdma_form_uda_cm_frame()
550 cm_node->tcp_cntxt.loc_seq_num++; in irdma_form_uda_cm_frame()
553 cm_node->tcp_cntxt.loc_seq_num += hdr_len + pd_len; in irdma_form_uda_cm_frame()
557 cm_node->tcp_cntxt.loc_seq_num++; in irdma_form_uda_cm_frame()
566 tcph->window = htons(cm_node->tcp_cntxt.rcv_wnd); in irdma_form_uda_cm_frame()
593 int irdma_send_reset(struct irdma_cm_node *cm_node) in irdma_send_reset() argument
598 trace_irdma_send_reset(cm_node, 0, __builtin_return_address(0)); in irdma_send_reset()
599 sqbuf = cm_node->cm_core->form_cm_frame(cm_node, NULL, NULL, NULL, in irdma_send_reset()
604 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_send_reset()
606 __builtin_return_address(0), cm_node, cm_node->cm_id, in irdma_send_reset()
607 cm_node->accelerated, cm_node->state, cm_node->rem_port, in irdma_send_reset()
608 cm_node->loc_port, cm_node->rem_addr, cm_node->loc_addr); in irdma_send_reset()
610 return irdma_schedule_cm_timer(cm_node, sqbuf, IRDMA_TIMER_TYPE_SEND, 0, in irdma_send_reset()
619 static void irdma_active_open_err(struct irdma_cm_node *cm_node, bool reset) in irdma_active_open_err() argument
621 trace_irdma_active_open_err(cm_node, reset, in irdma_active_open_err()
623 irdma_cleanup_retrans_entry(cm_node); in irdma_active_open_err()
624 cm_node->cm_core->stats_connect_errs++; in irdma_active_open_err()
626 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_active_open_err()
627 "CM: cm_node=%p state=%d\n", cm_node, in irdma_active_open_err()
628 cm_node->state); in irdma_active_open_err()
629 refcount_inc(&cm_node->refcnt); in irdma_active_open_err()
630 irdma_send_reset(cm_node); in irdma_active_open_err()
633 cm_node->state = IRDMA_CM_STATE_CLOSED; in irdma_active_open_err()
634 irdma_create_event(cm_node, IRDMA_CM_EVENT_ABORTED); in irdma_active_open_err()
642 static void irdma_passive_open_err(struct irdma_cm_node *cm_node, bool reset) in irdma_passive_open_err() argument
644 irdma_cleanup_retrans_entry(cm_node); in irdma_passive_open_err()
645 cm_node->cm_core->stats_passive_errs++; in irdma_passive_open_err()
646 cm_node->state = IRDMA_CM_STATE_CLOSED; in irdma_passive_open_err()
647 ibdev_dbg(&cm_node->iwdev->ibdev, "CM: cm_node=%p state =%d\n", in irdma_passive_open_err()
648 cm_node, cm_node->state); in irdma_passive_open_err()
649 trace_irdma_passive_open_err(cm_node, reset, in irdma_passive_open_err()
652 irdma_send_reset(cm_node); in irdma_passive_open_err()
654 irdma_rem_ref_cm_node(cm_node); in irdma_passive_open_err()
666 cm_id = event->cm_node->cm_id; in irdma_event_connect_error()
677 irdma_send_cm_event(event->cm_node, cm_id, IW_CM_EVENT_CONNECT_REPLY, in irdma_event_connect_error()
679 irdma_rem_ref_cm_node(event->cm_node); in irdma_event_connect_error()
689 static int irdma_process_options(struct irdma_cm_node *cm_node, u8 *optionsloc, in irdma_process_options() argument
707 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_process_options()
714 if ((cm_node->ipv4 && in irdma_process_options()
716 (!cm_node->ipv4 && in irdma_process_options()
719 if (tmp < cm_node->tcp_cntxt.mss) in irdma_process_options()
720 cm_node->tcp_cntxt.mss = tmp; in irdma_process_options()
723 cm_node->tcp_cntxt.snd_wscale = in irdma_process_options()
727 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_process_options()
735 cm_node->tcp_cntxt.mss = IRDMA_CM_DEFAULT_MSS; in irdma_process_options()
747 static int irdma_handle_tcp_options(struct irdma_cm_node *cm_node, in irdma_handle_tcp_options() argument
755 ret = irdma_process_options(cm_node, optionsloc, optionsize, in irdma_handle_tcp_options()
758 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_handle_tcp_options()
759 "CM: Node %p, Sending Reset\n", cm_node); in irdma_handle_tcp_options()
761 irdma_passive_open_err(cm_node, true); in irdma_handle_tcp_options()
763 irdma_active_open_err(cm_node, true); in irdma_handle_tcp_options()
768 cm_node->tcp_cntxt.snd_wnd = ntohs(tcph->window) in irdma_handle_tcp_options()
769 << cm_node->tcp_cntxt.snd_wscale; in irdma_handle_tcp_options()
771 if (cm_node->tcp_cntxt.snd_wnd > cm_node->tcp_cntxt.max_snd_wnd) in irdma_handle_tcp_options()
772 cm_node->tcp_cntxt.max_snd_wnd = cm_node->tcp_cntxt.snd_wnd; in irdma_handle_tcp_options()
783 static void irdma_build_mpa_v1(struct irdma_cm_node *cm_node, void *start_addr, in irdma_build_mpa_v1() argument
799 mpa_frame->rev = cm_node->mpa_frame_rev; in irdma_build_mpa_v1()
800 mpa_frame->priv_data_len = htons(cm_node->pdata.size); in irdma_build_mpa_v1()
809 static void irdma_build_mpa_v2(struct irdma_cm_node *cm_node, void *start_addr, in irdma_build_mpa_v2() argument
817 irdma_build_mpa_v1(cm_node, start_addr, mpa_key); in irdma_build_mpa_v2()
819 if (cm_node->iwdev->iw_ooo) { in irdma_build_mpa_v2()
821 cm_node->rcv_mark_en = true; in irdma_build_mpa_v2()
827 if (cm_node->mpav2_ird_ord == IETF_NO_IRD_ORD) { in irdma_build_mpa_v2()
831 ctrl_ird = (cm_node->ird_size > IETF_NO_IRD_ORD) ? in irdma_build_mpa_v2()
833 cm_node->ird_size; in irdma_build_mpa_v2()
834 ctrl_ord = (cm_node->ord_size > IETF_NO_IRD_ORD) ? in irdma_build_mpa_v2()
836 cm_node->ord_size; in irdma_build_mpa_v2()
846 switch (cm_node->send_rdma0_op) { in irdma_build_mpa_v2()
868 static int irdma_cm_build_mpa_frame(struct irdma_cm_node *cm_node, in irdma_cm_build_mpa_frame() argument
873 switch (cm_node->mpa_frame_rev) { in irdma_cm_build_mpa_frame()
876 irdma_build_mpa_v1(cm_node, mpa->addr, mpa_key); in irdma_cm_build_mpa_frame()
880 irdma_build_mpa_v2(cm_node, mpa->addr, mpa_key); in irdma_cm_build_mpa_frame()
893 static int irdma_send_mpa_request(struct irdma_cm_node *cm_node) in irdma_send_mpa_request() argument
897 cm_node->mpa_hdr.addr = &cm_node->mpa_v2_frame; in irdma_send_mpa_request()
898 cm_node->mpa_hdr.size = irdma_cm_build_mpa_frame(cm_node, in irdma_send_mpa_request()
899 &cm_node->mpa_hdr, in irdma_send_mpa_request()
901 if (!cm_node->mpa_hdr.size) { in irdma_send_mpa_request()
902 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_send_mpa_request()
903 "CM: mpa size = %d\n", cm_node->mpa_hdr.size); in irdma_send_mpa_request()
907 sqbuf = cm_node->cm_core->form_cm_frame(cm_node, NULL, in irdma_send_mpa_request()
908 &cm_node->mpa_hdr, in irdma_send_mpa_request()
909 &cm_node->pdata, SET_ACK); in irdma_send_mpa_request()
913 return irdma_schedule_cm_timer(cm_node, sqbuf, IRDMA_TIMER_TYPE_SEND, 1, in irdma_send_mpa_request()
923 static int irdma_send_mpa_reject(struct irdma_cm_node *cm_node, in irdma_send_mpa_reject() argument
929 cm_node->mpa_hdr.addr = &cm_node->mpa_v2_frame; in irdma_send_mpa_reject()
930 cm_node->mpa_hdr.size = irdma_cm_build_mpa_frame(cm_node, in irdma_send_mpa_reject()
931 &cm_node->mpa_hdr, in irdma_send_mpa_reject()
934 cm_node->mpa_frame.flags |= IETF_MPA_FLAGS_REJECT; in irdma_send_mpa_reject()
938 sqbuf = cm_node->cm_core->form_cm_frame(cm_node, NULL, in irdma_send_mpa_reject()
939 &cm_node->mpa_hdr, &priv_info, in irdma_send_mpa_reject()
944 cm_node->state = IRDMA_CM_STATE_FIN_WAIT1; in irdma_send_mpa_reject()
946 return irdma_schedule_cm_timer(cm_node, sqbuf, IRDMA_TIMER_TYPE_SEND, 1, in irdma_send_mpa_reject()
955 static int irdma_negotiate_mpa_v2_ird_ord(struct irdma_cm_node *cm_node, in irdma_negotiate_mpa_v2_ird_ord() argument
978 cm_node->mpav2_ird_ord = IETF_NO_IRD_ORD; in irdma_negotiate_mpa_v2_ird_ord()
982 if (cm_node->state != IRDMA_CM_STATE_MPAREQ_SENT) { in irdma_negotiate_mpa_v2_ird_ord()
985 cm_node->ird_size = 1; in irdma_negotiate_mpa_v2_ird_ord()
986 if (cm_node->ord_size > ird_size) in irdma_negotiate_mpa_v2_ird_ord()
987 cm_node->ord_size = ird_size; in irdma_negotiate_mpa_v2_ird_ord()
994 if (cm_node->ord_size > ird_size) in irdma_negotiate_mpa_v2_ird_ord()
995 cm_node->ord_size = ird_size; in irdma_negotiate_mpa_v2_ird_ord()
997 if (cm_node->ird_size < ord_size) in irdma_negotiate_mpa_v2_ird_ord()
1004 cm_node->send_rdma0_op = SEND_RDMA_READ_ZERO; in irdma_negotiate_mpa_v2_ird_ord()
1006 cm_node->send_rdma0_op = SEND_RDMA_WRITE_ZERO; in irdma_negotiate_mpa_v2_ird_ord()
1011 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_negotiate_mpa_v2_ird_ord()
1013 cm_node->ord_size, cm_node->ird_size); in irdma_negotiate_mpa_v2_ird_ord()
1014 trace_irdma_negotiate_mpa_v2(cm_node); in irdma_negotiate_mpa_v2_ird_ord()
1025 static int irdma_parse_mpa(struct irdma_cm_node *cm_node, u8 *buf, u32 *type, in irdma_parse_mpa() argument
1034 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_parse_mpa()
1044 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_parse_mpa()
1050 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_parse_mpa()
1055 if (mpa_frame->rev > cm_node->mpa_frame_rev) { in irdma_parse_mpa()
1056 ibdev_dbg(&cm_node->iwdev->ibdev, "CM: rev %d\n", in irdma_parse_mpa()
1061 cm_node->mpa_frame_rev = mpa_frame->rev; in irdma_parse_mpa()
1062 if (cm_node->state != IRDMA_CM_STATE_MPAREQ_SENT) { in irdma_parse_mpa()
1065 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_parse_mpa()
1072 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_parse_mpa()
1079 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_parse_mpa()
1086 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_parse_mpa()
1094 ret = irdma_negotiate_mpa_v2_ird_ord(cm_node, buf); in irdma_parse_mpa()
1103 memcpy(cm_node->pdata_buf, buf + mpa_hdr_len, priv_data_len); in irdma_parse_mpa()
1104 cm_node->pdata.size = priv_data_len; in irdma_parse_mpa()
1110 cm_node->snd_mark_en = true; in irdma_parse_mpa()
1128 int irdma_schedule_cm_timer(struct irdma_cm_node *cm_node, in irdma_schedule_cm_timer() argument
1133 struct irdma_sc_vsi *vsi = &cm_node->iwdev->vsi; in irdma_schedule_cm_timer()
1134 struct irdma_cm_core *cm_core = cm_node->cm_core; in irdma_schedule_cm_timer()
1156 if (cm_node->close_entry) { in irdma_schedule_cm_timer()
1158 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_schedule_cm_timer()
1163 cm_node->close_entry = new_send; in irdma_schedule_cm_timer()
1165 spin_lock_irqsave(&cm_node->retrans_list_lock, flags); in irdma_schedule_cm_timer()
1166 cm_node->send_entry = new_send; in irdma_schedule_cm_timer()
1167 refcount_inc(&cm_node->refcnt); in irdma_schedule_cm_timer()
1168 spin_unlock_irqrestore(&cm_node->retrans_list_lock, flags); in irdma_schedule_cm_timer()
1174 irdma_cleanup_retrans_entry(cm_node); in irdma_schedule_cm_timer()
1176 irdma_rem_ref_cm_node(cm_node); in irdma_schedule_cm_timer()
1197 static void irdma_retrans_expired(struct irdma_cm_node *cm_node) in irdma_retrans_expired() argument
1199 enum irdma_cm_node_state state = cm_node->state; in irdma_retrans_expired()
1201 cm_node->state = IRDMA_CM_STATE_CLOSED; in irdma_retrans_expired()
1205 irdma_rem_ref_cm_node(cm_node); in irdma_retrans_expired()
1209 irdma_send_reset(cm_node); in irdma_retrans_expired()
1212 refcount_inc(&cm_node->refcnt); in irdma_retrans_expired()
1213 irdma_send_reset(cm_node); in irdma_retrans_expired()
1214 irdma_create_event(cm_node, IRDMA_CM_EVENT_ABORTED); in irdma_retrans_expired()
1224 static void irdma_handle_close_entry(struct irdma_cm_node *cm_node, in irdma_handle_close_entry() argument
1227 struct irdma_timer_entry *close_entry = cm_node->close_entry; in irdma_handle_close_entry()
1248 irdma_rem_ref_cm_node(cm_node); in irdma_handle_close_entry()
1252 cm_node->close_entry = NULL; in irdma_handle_close_entry()
1262 struct irdma_cm_node *cm_node; in irdma_cm_timer_tick() local
1280 cm_node = container_of(list_node, struct irdma_cm_node, in irdma_cm_timer_tick()
1282 close_entry = cm_node->close_entry; in irdma_cm_timer_tick()
1292 irdma_handle_close_entry(cm_node, 1); in irdma_cm_timer_tick()
1296 spin_lock_irqsave(&cm_node->retrans_list_lock, flags); in irdma_cm_timer_tick()
1298 send_entry = cm_node->send_entry; in irdma_cm_timer_tick()
1302 if (cm_node->state != IRDMA_CM_STATE_OFFLOADED) { in irdma_cm_timer_tick()
1309 irdma_free_retrans_entry(cm_node); in irdma_cm_timer_tick()
1314 if (cm_node->state == IRDMA_CM_STATE_OFFLOADED || in irdma_cm_timer_tick()
1315 cm_node->state == IRDMA_CM_STATE_CLOSED) { in irdma_cm_timer_tick()
1316 irdma_free_retrans_entry(cm_node); in irdma_cm_timer_tick()
1321 irdma_free_retrans_entry(cm_node); in irdma_cm_timer_tick()
1323 spin_unlock_irqrestore(&cm_node->retrans_list_lock, in irdma_cm_timer_tick()
1325 irdma_retrans_expired(cm_node); in irdma_cm_timer_tick()
1326 cm_node->state = IRDMA_CM_STATE_CLOSED; in irdma_cm_timer_tick()
1327 spin_lock_irqsave(&cm_node->retrans_list_lock, flags); in irdma_cm_timer_tick()
1330 spin_unlock_irqrestore(&cm_node->retrans_list_lock, flags); in irdma_cm_timer_tick()
1332 vsi = &cm_node->iwdev->vsi; in irdma_cm_timer_tick()
1333 if (!cm_node->ack_rcvd) { in irdma_cm_timer_tick()
1336 cm_node->cm_core->stats_pkt_retrans++; in irdma_cm_timer_tick()
1339 spin_lock_irqsave(&cm_node->retrans_list_lock, flags); in irdma_cm_timer_tick()
1356 irdma_free_retrans_entry(cm_node); in irdma_cm_timer_tick()
1358 irdma_rem_ref_cm_node(cm_node); in irdma_cm_timer_tick()
1361 spin_unlock_irqrestore(&cm_node->retrans_list_lock, flags); in irdma_cm_timer_tick()
1362 irdma_rem_ref_cm_node(cm_node); in irdma_cm_timer_tick()
1380 int irdma_send_syn(struct irdma_cm_node *cm_node, u32 sendack) in irdma_send_syn() argument
1393 if (!cm_node) in irdma_send_syn()
1399 options->mss.mss = htons(cm_node->tcp_cntxt.mss); in irdma_send_syn()
1405 options->windowscale.shiftcount = cm_node->tcp_cntxt.rcv_wscale; in irdma_send_syn()
1416 sqbuf = cm_node->cm_core->form_cm_frame(cm_node, &opts, NULL, NULL, in irdma_send_syn()
1421 return irdma_schedule_cm_timer(cm_node, sqbuf, IRDMA_TIMER_TYPE_SEND, 1, in irdma_send_syn()
1429 void irdma_send_ack(struct irdma_cm_node *cm_node) in irdma_send_ack() argument
1432 struct irdma_sc_vsi *vsi = &cm_node->iwdev->vsi; in irdma_send_ack()
1434 sqbuf = cm_node->cm_core->form_cm_frame(cm_node, NULL, NULL, NULL, in irdma_send_ack()
1444 static int irdma_send_fin(struct irdma_cm_node *cm_node) in irdma_send_fin() argument
1448 sqbuf = cm_node->cm_core->form_cm_frame(cm_node, NULL, NULL, NULL, in irdma_send_fin()
1453 return irdma_schedule_cm_timer(cm_node, sqbuf, IRDMA_TIMER_TYPE_SEND, 1, in irdma_send_fin()
1852 struct irdma_cm_node *cm_node; in irdma_reset_list_prep() local
1855 hash_for_each_rcu(cm_core->cm_hash_tbl, bkt, cm_node, list) { in irdma_reset_list_prep()
1856 if (cm_node->listener == listener && in irdma_reset_list_prep()
1857 !cm_node->accelerated && in irdma_reset_list_prep()
1858 refcount_inc_not_zero(&cm_node->refcnt)) in irdma_reset_list_prep()
1859 list_add(&cm_node->reset_entry, reset_list); in irdma_reset_list_prep()
1877 struct irdma_cm_node *cm_node; in irdma_dec_refcnt_listen() local
1893 cm_node = container_of(list_pos, struct irdma_cm_node, in irdma_dec_refcnt_listen()
1895 if (cm_node->state >= IRDMA_CM_STATE_FIN_WAIT1) { in irdma_dec_refcnt_listen()
1896 irdma_rem_ref_cm_node(cm_node); in irdma_dec_refcnt_listen()
1900 irdma_cleanup_retrans_entry(cm_node); in irdma_dec_refcnt_listen()
1901 err = irdma_send_reset(cm_node); in irdma_dec_refcnt_listen()
1903 cm_node->state = IRDMA_CM_STATE_CLOSED; in irdma_dec_refcnt_listen()
1904 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_dec_refcnt_listen()
1907 old_state = cm_node->state; in irdma_dec_refcnt_listen()
1908 cm_node->state = IRDMA_CM_STATE_LISTENER_DESTROYED; in irdma_dec_refcnt_listen()
1910 irdma_rem_ref_cm_node(cm_node); in irdma_dec_refcnt_listen()
2099 struct irdma_cm_node *cm_node; in irdma_find_node() local
2103 hash_for_each_possible_rcu(cm_core->cm_hash_tbl, cm_node, list, key) { in irdma_find_node()
2104 if (cm_node->vlan_id == vlan_id && in irdma_find_node()
2105 cm_node->loc_port == loc_port && cm_node->rem_port == rem_port && in irdma_find_node()
2106 !memcmp(cm_node->loc_addr, loc_addr, sizeof(cm_node->loc_addr)) && in irdma_find_node()
2107 !memcmp(cm_node->rem_addr, rem_addr, sizeof(cm_node->rem_addr))) { in irdma_find_node()
2108 if (!refcount_inc_not_zero(&cm_node->refcnt)) in irdma_find_node()
2111 trace_irdma_find_node(cm_node, 0, NULL); in irdma_find_node()
2112 return cm_node; in irdma_find_node()
2129 struct irdma_cm_node *cm_node) in irdma_add_hte_node() argument
2132 u32 key = (cm_node->rem_port << 16) | cm_node->loc_port; in irdma_add_hte_node()
2135 hash_add_rcu(cm_core->cm_hash_tbl, &cm_node->list, key); in irdma_add_hte_node()
2168 static int irdma_cm_create_ah(struct irdma_cm_node *cm_node, bool wait) in irdma_cm_create_ah() argument
2171 struct irdma_device *iwdev = cm_node->iwdev; in irdma_cm_create_ah()
2176 ah_info.tc_tos = cm_node->tos; in irdma_cm_create_ah()
2179 if (cm_node->ipv4) { in irdma_cm_create_ah()
2181 ah_info.dest_ip_addr[0] = cm_node->rem_addr[0]; in irdma_cm_create_ah()
2182 ah_info.src_ip_addr[0] = cm_node->loc_addr[0]; in irdma_cm_create_ah()
2186 memcpy(ah_info.dest_ip_addr, cm_node->rem_addr, in irdma_cm_create_ah()
2188 memcpy(ah_info.src_ip_addr, cm_node->loc_addr, in irdma_cm_create_ah()
2194 ah_info.vlan_tag = cm_node->vlan_id; in irdma_cm_create_ah()
2195 if (cm_node->vlan_id < VLAN_N_VID) { in irdma_cm_create_ah()
2197 ah_info.vlan_tag |= cm_node->user_pri << VLAN_PRIO_SHIFT; in irdma_cm_create_ah()
2205 IRDMA_PUDA_RSRC_TYPE_ILQ, cm_node, in irdma_cm_create_ah()
2206 &cm_node->ah)) in irdma_cm_create_ah()
2209 trace_irdma_create_ah(cm_node); in irdma_cm_create_ah()
2217 static void irdma_cm_free_ah(struct irdma_cm_node *cm_node) in irdma_cm_free_ah() argument
2219 struct irdma_device *iwdev = cm_node->iwdev; in irdma_cm_free_ah()
2221 trace_irdma_cm_free_ah(cm_node); in irdma_cm_free_ah()
2222 irdma_puda_free_ah(&iwdev->rf->sc_dev, cm_node->ah); in irdma_cm_free_ah()
2223 cm_node->ah = NULL; in irdma_cm_free_ah()
2238 struct irdma_cm_node *cm_node; in irdma_make_cm_node() local
2244 cm_node = kzalloc(sizeof(*cm_node), GFP_ATOMIC); in irdma_make_cm_node()
2245 if (!cm_node) in irdma_make_cm_node()
2249 cm_node->ipv4 = cm_info->ipv4; in irdma_make_cm_node()
2250 cm_node->vlan_id = cm_info->vlan_id; in irdma_make_cm_node()
2251 if (cm_node->vlan_id >= VLAN_N_VID && iwdev->dcb_vlan_mode) in irdma_make_cm_node()
2252 cm_node->vlan_id = 0; in irdma_make_cm_node()
2253 cm_node->tos = cm_info->tos; in irdma_make_cm_node()
2254 cm_node->user_pri = cm_info->user_pri; in irdma_make_cm_node()
2261 cm_node->user_pri = listener->user_pri; in irdma_make_cm_node()
2263 cm_node->tos = max(listener->tos, cm_info->tos); in irdma_make_cm_node()
2264 cm_node->user_pri = rt_tos2priority(cm_node->tos); in irdma_make_cm_node()
2265 cm_node->user_pri = in irdma_make_cm_node()
2267 cm_node->user_pri, in irdma_make_cm_node()
2271 "DCB: listener: TOS:[%d] UP:[%d]\n", cm_node->tos, in irdma_make_cm_node()
2272 cm_node->user_pri); in irdma_make_cm_node()
2273 trace_irdma_listener_tos(iwdev, cm_node->tos, in irdma_make_cm_node()
2274 cm_node->user_pri); in irdma_make_cm_node()
2276 memcpy(cm_node->loc_addr, cm_info->loc_addr, sizeof(cm_node->loc_addr)); in irdma_make_cm_node()
2277 memcpy(cm_node->rem_addr, cm_info->rem_addr, sizeof(cm_node->rem_addr)); in irdma_make_cm_node()
2278 cm_node->loc_port = cm_info->loc_port; in irdma_make_cm_node()
2279 cm_node->rem_port = cm_info->rem_port; in irdma_make_cm_node()
2281 cm_node->mpa_frame_rev = IRDMA_CM_DEFAULT_MPA_VER; in irdma_make_cm_node()
2282 cm_node->send_rdma0_op = SEND_RDMA_READ_ZERO; in irdma_make_cm_node()
2283 cm_node->iwdev = iwdev; in irdma_make_cm_node()
2284 cm_node->dev = &iwdev->rf->sc_dev; in irdma_make_cm_node()
2286 cm_node->ird_size = cm_node->dev->hw_attrs.max_hw_ird; in irdma_make_cm_node()
2287 cm_node->ord_size = cm_node->dev->hw_attrs.max_hw_ord; in irdma_make_cm_node()
2289 cm_node->listener = listener; in irdma_make_cm_node()
2290 cm_node->cm_id = cm_info->cm_id; in irdma_make_cm_node()
2291 ether_addr_copy(cm_node->loc_mac, netdev->dev_addr); in irdma_make_cm_node()
2292 spin_lock_init(&cm_node->retrans_list_lock); in irdma_make_cm_node()
2293 cm_node->ack_rcvd = false; in irdma_make_cm_node()
2295 init_completion(&cm_node->establish_comp); in irdma_make_cm_node()
2296 refcount_set(&cm_node->refcnt, 1); in irdma_make_cm_node()
2298 cm_node->cm_core = cm_core; in irdma_make_cm_node()
2299 cm_node->tcp_cntxt.loc_id = IRDMA_CM_DEFAULT_LOCAL_ID; in irdma_make_cm_node()
2300 cm_node->tcp_cntxt.rcv_wscale = iwdev->rcv_wscale; in irdma_make_cm_node()
2301 cm_node->tcp_cntxt.rcv_wnd = iwdev->rcv_wnd >> cm_node->tcp_cntxt.rcv_wscale; in irdma_make_cm_node()
2302 if (cm_node->ipv4) { in irdma_make_cm_node()
2303 cm_node->tcp_cntxt.loc_seq_num = secure_tcp_seq(htonl(cm_node->loc_addr[0]), in irdma_make_cm_node()
2304 htonl(cm_node->rem_addr[0]), in irdma_make_cm_node()
2305 htons(cm_node->loc_port), in irdma_make_cm_node()
2306 htons(cm_node->rem_port)); in irdma_make_cm_node()
2307 cm_node->tcp_cntxt.mss = iwdev->vsi.mtu - IRDMA_MTU_TO_MSS_IPV4; in irdma_make_cm_node()
2310 htonl(cm_node->loc_addr[0]), htonl(cm_node->loc_addr[1]), in irdma_make_cm_node()
2311 htonl(cm_node->loc_addr[2]), htonl(cm_node->loc_addr[3]) in irdma_make_cm_node()
2314 htonl(cm_node->rem_addr[0]), htonl(cm_node->rem_addr[1]), in irdma_make_cm_node()
2315 htonl(cm_node->rem_addr[2]), htonl(cm_node->rem_addr[3]) in irdma_make_cm_node()
2317 cm_node->tcp_cntxt.loc_seq_num = secure_tcpv6_seq(loc, rem, in irdma_make_cm_node()
2318 htons(cm_node->loc_port), in irdma_make_cm_node()
2319 htons(cm_node->rem_port)); in irdma_make_cm_node()
2320 cm_node->tcp_cntxt.mss = iwdev->vsi.mtu - IRDMA_MTU_TO_MSS_IPV6; in irdma_make_cm_node()
2323 if ((cm_node->ipv4 && in irdma_make_cm_node()
2324 irdma_ipv4_is_lpb(cm_node->loc_addr[0], cm_node->rem_addr[0])) || in irdma_make_cm_node()
2325 (!cm_node->ipv4 && in irdma_make_cm_node()
2326 irdma_ipv6_is_lpb(cm_node->loc_addr, cm_node->rem_addr))) { in irdma_make_cm_node()
2327 cm_node->do_lpb = true; in irdma_make_cm_node()
2328 arpindex = irdma_arp_table(iwdev->rf, cm_node->rem_addr, in irdma_make_cm_node()
2329 cm_node->ipv4, NULL, in irdma_make_cm_node()
2332 oldarpindex = irdma_arp_table(iwdev->rf, cm_node->rem_addr, in irdma_make_cm_node()
2333 cm_node->ipv4, NULL, in irdma_make_cm_node()
2335 if (cm_node->ipv4) in irdma_make_cm_node()
2352 ether_addr_copy(cm_node->rem_mac, in irdma_make_cm_node()
2354 irdma_add_hte_node(cm_core, cm_node); in irdma_make_cm_node()
2356 return cm_node; in irdma_make_cm_node()
2359 kfree(cm_node); in irdma_make_cm_node()
2364 static void irdma_destroy_connection(struct irdma_cm_node *cm_node) in irdma_destroy_connection() argument
2366 struct irdma_cm_core *cm_core = cm_node->cm_core; in irdma_destroy_connection()
2371 if (!cm_node->accelerated && cm_node->accept_pend) { in irdma_destroy_connection()
2372 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_destroy_connection()
2374 atomic_dec(&cm_node->listener->pend_accepts_cnt); in irdma_destroy_connection()
2376 if (cm_node->close_entry) in irdma_destroy_connection()
2377 irdma_handle_close_entry(cm_node, 0); in irdma_destroy_connection()
2378 if (cm_node->listener) { in irdma_destroy_connection()
2379 irdma_dec_refcnt_listen(cm_core, cm_node->listener, 0, true); in irdma_destroy_connection()
2381 if (cm_node->apbvt_set) { in irdma_destroy_connection()
2382 irdma_del_apbvt(cm_node->iwdev, cm_node->apbvt_entry); in irdma_destroy_connection()
2383 cm_node->apbvt_set = 0; in irdma_destroy_connection()
2385 irdma_get_addr_info(cm_node, &nfo); in irdma_destroy_connection()
2386 if (cm_node->qhash_set) { in irdma_destroy_connection()
2387 nfo.qh_qpid = cm_node->iwdev->vsi.ilq->qp_id; in irdma_destroy_connection()
2388 irdma_manage_qhash(cm_node->iwdev, &nfo, in irdma_destroy_connection()
2392 cm_node->qhash_set = 0; in irdma_destroy_connection()
2396 iwqp = cm_node->iwqp; in irdma_destroy_connection()
2398 cm_node->cm_id->rem_ref(cm_node->cm_id); in irdma_destroy_connection()
2399 cm_node->cm_id = NULL; in irdma_destroy_connection()
2402 cm_node->iwqp = NULL; in irdma_destroy_connection()
2403 } else if (cm_node->qhash_set) { in irdma_destroy_connection()
2404 irdma_get_addr_info(cm_node, &nfo); in irdma_destroy_connection()
2405 nfo.qh_qpid = cm_node->iwdev->vsi.ilq->qp_id; in irdma_destroy_connection()
2406 irdma_manage_qhash(cm_node->iwdev, &nfo, in irdma_destroy_connection()
2409 cm_node->qhash_set = 0; in irdma_destroy_connection()
2412 cm_core->cm_free_ah(cm_node); in irdma_destroy_connection()
2419 void irdma_rem_ref_cm_node(struct irdma_cm_node *cm_node) in irdma_rem_ref_cm_node() argument
2421 struct irdma_cm_core *cm_core = cm_node->cm_core; in irdma_rem_ref_cm_node()
2424 trace_irdma_rem_ref_cm_node(cm_node, 0, __builtin_return_address(0)); in irdma_rem_ref_cm_node()
2427 if (!refcount_dec_and_test(&cm_node->refcnt)) { in irdma_rem_ref_cm_node()
2431 if (cm_node->iwqp) { in irdma_rem_ref_cm_node()
2432 cm_node->iwqp->cm_node = NULL; in irdma_rem_ref_cm_node()
2433 cm_node->iwqp->cm_id = NULL; in irdma_rem_ref_cm_node()
2435 hash_del_rcu(&cm_node->list); in irdma_rem_ref_cm_node()
2436 cm_node->cm_core->stats_nodes_destroyed++; in irdma_rem_ref_cm_node()
2440 irdma_destroy_connection(cm_node); in irdma_rem_ref_cm_node()
2442 kfree_rcu(cm_node, rcu_head); in irdma_rem_ref_cm_node()
2449 static void irdma_handle_fin_pkt(struct irdma_cm_node *cm_node) in irdma_handle_fin_pkt() argument
2451 switch (cm_node->state) { in irdma_handle_fin_pkt()
2456 cm_node->tcp_cntxt.rcv_nxt++; in irdma_handle_fin_pkt()
2457 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_fin_pkt()
2458 cm_node->state = IRDMA_CM_STATE_LAST_ACK; in irdma_handle_fin_pkt()
2459 irdma_send_fin(cm_node); in irdma_handle_fin_pkt()
2462 irdma_create_event(cm_node, IRDMA_CM_EVENT_ABORTED); in irdma_handle_fin_pkt()
2463 cm_node->tcp_cntxt.rcv_nxt++; in irdma_handle_fin_pkt()
2464 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_fin_pkt()
2465 cm_node->state = IRDMA_CM_STATE_CLOSED; in irdma_handle_fin_pkt()
2466 refcount_inc(&cm_node->refcnt); in irdma_handle_fin_pkt()
2467 irdma_send_reset(cm_node); in irdma_handle_fin_pkt()
2470 cm_node->tcp_cntxt.rcv_nxt++; in irdma_handle_fin_pkt()
2471 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_fin_pkt()
2472 cm_node->state = IRDMA_CM_STATE_CLOSING; in irdma_handle_fin_pkt()
2473 irdma_send_ack(cm_node); in irdma_handle_fin_pkt()
2481 cm_node->tcp_cntxt.rcv_nxt++; in irdma_handle_fin_pkt()
2482 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_fin_pkt()
2483 cm_node->state = IRDMA_CM_STATE_TIME_WAIT; in irdma_handle_fin_pkt()
2484 irdma_send_ack(cm_node); in irdma_handle_fin_pkt()
2485 irdma_schedule_cm_timer(cm_node, NULL, IRDMA_TIMER_TYPE_CLOSE, in irdma_handle_fin_pkt()
2489 cm_node->tcp_cntxt.rcv_nxt++; in irdma_handle_fin_pkt()
2490 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_fin_pkt()
2491 cm_node->state = IRDMA_CM_STATE_CLOSED; in irdma_handle_fin_pkt()
2492 irdma_rem_ref_cm_node(cm_node); in irdma_handle_fin_pkt()
2496 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_handle_fin_pkt()
2497 "CM: bad state node state = %d\n", cm_node->state); in irdma_handle_fin_pkt()
2507 static void irdma_handle_rst_pkt(struct irdma_cm_node *cm_node, in irdma_handle_rst_pkt() argument
2510 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_handle_rst_pkt()
2512 __builtin_return_address(0), cm_node, cm_node->state, in irdma_handle_rst_pkt()
2513 cm_node->rem_port, cm_node->loc_port, cm_node->rem_addr, in irdma_handle_rst_pkt()
2514 cm_node->loc_addr); in irdma_handle_rst_pkt()
2516 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_rst_pkt()
2517 switch (cm_node->state) { in irdma_handle_rst_pkt()
2520 switch (cm_node->mpa_frame_rev) { in irdma_handle_rst_pkt()
2523 cm_node->mpa_frame_rev = IETF_MPA_V1; in irdma_handle_rst_pkt()
2525 cm_node->state = IRDMA_CM_STATE_SYN_SENT; in irdma_handle_rst_pkt()
2526 if (irdma_send_syn(cm_node, 0)) in irdma_handle_rst_pkt()
2527 irdma_active_open_err(cm_node, false); in irdma_handle_rst_pkt()
2531 irdma_active_open_err(cm_node, false); in irdma_handle_rst_pkt()
2536 atomic_inc(&cm_node->passive_state); in irdma_handle_rst_pkt()
2541 irdma_passive_open_err(cm_node, false); in irdma_handle_rst_pkt()
2544 irdma_active_open_err(cm_node, false); in irdma_handle_rst_pkt()
2552 cm_node->state = IRDMA_CM_STATE_CLOSED; in irdma_handle_rst_pkt()
2553 irdma_rem_ref_cm_node(cm_node); in irdma_handle_rst_pkt()
2565 static void irdma_handle_rcv_mpa(struct irdma_cm_node *cm_node, in irdma_handle_rcv_mpa() argument
2575 err = irdma_parse_mpa(cm_node, dataloc, &res_type, datasize); in irdma_handle_rcv_mpa()
2577 if (cm_node->state == IRDMA_CM_STATE_MPAREQ_SENT) in irdma_handle_rcv_mpa()
2578 irdma_active_open_err(cm_node, true); in irdma_handle_rcv_mpa()
2580 irdma_passive_open_err(cm_node, true); in irdma_handle_rcv_mpa()
2584 switch (cm_node->state) { in irdma_handle_rcv_mpa()
2587 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_handle_rcv_mpa()
2589 cm_node->state = IRDMA_CM_STATE_MPAREQ_RCVD; in irdma_handle_rcv_mpa()
2591 irdma_send_ack(cm_node); /* ACK received MPA request */ in irdma_handle_rcv_mpa()
2592 atomic_set(&cm_node->passive_state, in irdma_handle_rcv_mpa()
2596 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_rcv_mpa()
2599 cm_node->state = IRDMA_CM_STATE_MPAREJ_RCVD; in irdma_handle_rcv_mpa()
2602 cm_node->state = IRDMA_CM_STATE_OFFLOADED; in irdma_handle_rcv_mpa()
2604 irdma_send_ack(cm_node); in irdma_handle_rcv_mpa()
2607 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_handle_rcv_mpa()
2608 "CM: wrong cm_node state =%d\n", cm_node->state); in irdma_handle_rcv_mpa()
2611 irdma_create_event(cm_node, type); in irdma_handle_rcv_mpa()
2619 static int irdma_check_syn(struct irdma_cm_node *cm_node, struct tcphdr *tcph) in irdma_check_syn() argument
2621 if (ntohl(tcph->ack_seq) != cm_node->tcp_cntxt.loc_seq_num) { in irdma_check_syn()
2622 irdma_active_open_err(cm_node, true); in irdma_check_syn()
2634 static int irdma_check_seq(struct irdma_cm_node *cm_node, struct tcphdr *tcph) in irdma_check_seq() argument
2638 u32 loc_seq_num = cm_node->tcp_cntxt.loc_seq_num; in irdma_check_seq()
2639 u32 rcv_nxt = cm_node->tcp_cntxt.rcv_nxt; in irdma_check_seq()
2645 rcv_wnd = cm_node->tcp_cntxt.rcv_wnd; in irdma_check_seq()
2650 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_check_seq()
2656 void irdma_add_conn_est_qh(struct irdma_cm_node *cm_node) in irdma_add_conn_est_qh() argument
2660 irdma_get_addr_info(cm_node, &nfo); in irdma_add_conn_est_qh()
2661 nfo.qh_qpid = cm_node->iwdev->vsi.ilq->qp_id; in irdma_add_conn_est_qh()
2662 irdma_manage_qhash(cm_node->iwdev, &nfo, in irdma_add_conn_est_qh()
2665 cm_node, false); in irdma_add_conn_est_qh()
2666 cm_node->qhash_set = true; in irdma_add_conn_est_qh()
2674 static void irdma_handle_syn_pkt(struct irdma_cm_node *cm_node, in irdma_handle_syn_pkt() argument
2685 switch (cm_node->state) { in irdma_handle_syn_pkt()
2689 irdma_active_open_err(cm_node, 1); in irdma_handle_syn_pkt()
2693 if (atomic_read(&cm_node->listener->pend_accepts_cnt) > in irdma_handle_syn_pkt()
2694 cm_node->listener->backlog) { in irdma_handle_syn_pkt()
2695 cm_node->cm_core->stats_backlog_drops++; in irdma_handle_syn_pkt()
2696 irdma_passive_open_err(cm_node, false); in irdma_handle_syn_pkt()
2699 err = irdma_handle_tcp_options(cm_node, tcph, optionsize, 1); in irdma_handle_syn_pkt()
2701 irdma_passive_open_err(cm_node, false); in irdma_handle_syn_pkt()
2705 err = cm_node->cm_core->cm_create_ah(cm_node, false); in irdma_handle_syn_pkt()
2707 irdma_passive_open_err(cm_node, false); in irdma_handle_syn_pkt()
2711 cm_node->tcp_cntxt.rcv_nxt = inc_sequence + 1; in irdma_handle_syn_pkt()
2712 cm_node->accept_pend = 1; in irdma_handle_syn_pkt()
2713 atomic_inc(&cm_node->listener->pend_accepts_cnt); in irdma_handle_syn_pkt()
2715 cm_node->state = IRDMA_CM_STATE_SYN_RCVD; in irdma_handle_syn_pkt()
2718 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_syn_pkt()
2719 refcount_inc(&cm_node->refcnt); in irdma_handle_syn_pkt()
2720 irdma_send_reset(cm_node); in irdma_handle_syn_pkt()
2740 static void irdma_handle_synack_pkt(struct irdma_cm_node *cm_node, in irdma_handle_synack_pkt() argument
2750 switch (cm_node->state) { in irdma_handle_synack_pkt()
2752 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_synack_pkt()
2754 if (irdma_check_syn(cm_node, tcph)) { in irdma_handle_synack_pkt()
2755 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_handle_synack_pkt()
2759 cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq); in irdma_handle_synack_pkt()
2761 err = irdma_handle_tcp_options(cm_node, tcph, optionsize, 0); in irdma_handle_synack_pkt()
2763 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_handle_synack_pkt()
2765 cm_node); in irdma_handle_synack_pkt()
2768 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_synack_pkt()
2769 cm_node->tcp_cntxt.rcv_nxt = inc_sequence + 1; in irdma_handle_synack_pkt()
2770 irdma_send_ack(cm_node); /* ACK for the syn_ack */ in irdma_handle_synack_pkt()
2771 err = irdma_send_mpa_request(cm_node); in irdma_handle_synack_pkt()
2773 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_handle_synack_pkt()
2775 cm_node); in irdma_handle_synack_pkt()
2778 cm_node->state = IRDMA_CM_STATE_MPAREQ_SENT; in irdma_handle_synack_pkt()
2781 irdma_passive_open_err(cm_node, true); in irdma_handle_synack_pkt()
2784 cm_node->tcp_cntxt.loc_seq_num = ntohl(tcph->ack_seq); in irdma_handle_synack_pkt()
2785 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_synack_pkt()
2786 cm_node->state = IRDMA_CM_STATE_CLOSED; in irdma_handle_synack_pkt()
2787 irdma_send_reset(cm_node); in irdma_handle_synack_pkt()
2790 cm_node->tcp_cntxt.loc_seq_num = ntohl(tcph->ack_seq); in irdma_handle_synack_pkt()
2791 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_synack_pkt()
2792 refcount_inc(&cm_node->refcnt); in irdma_handle_synack_pkt()
2793 irdma_send_reset(cm_node); in irdma_handle_synack_pkt()
2813 static int irdma_handle_ack_pkt(struct irdma_cm_node *cm_node, in irdma_handle_ack_pkt() argument
2824 if (irdma_check_seq(cm_node, tcph)) in irdma_handle_ack_pkt()
2828 switch (cm_node->state) { in irdma_handle_ack_pkt()
2830 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_ack_pkt()
2831 ret = irdma_handle_tcp_options(cm_node, tcph, optionsize, 1); in irdma_handle_ack_pkt()
2834 cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq); in irdma_handle_ack_pkt()
2835 cm_node->state = IRDMA_CM_STATE_ESTABLISHED; in irdma_handle_ack_pkt()
2837 cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize; in irdma_handle_ack_pkt()
2838 irdma_handle_rcv_mpa(cm_node, rbuf); in irdma_handle_ack_pkt()
2842 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_ack_pkt()
2844 cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize; in irdma_handle_ack_pkt()
2845 irdma_handle_rcv_mpa(cm_node, rbuf); in irdma_handle_ack_pkt()
2849 cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq); in irdma_handle_ack_pkt()
2851 cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize; in irdma_handle_ack_pkt()
2852 cm_node->ack_rcvd = false; in irdma_handle_ack_pkt()
2853 irdma_handle_rcv_mpa(cm_node, rbuf); in irdma_handle_ack_pkt()
2855 cm_node->ack_rcvd = true; in irdma_handle_ack_pkt()
2859 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_ack_pkt()
2860 cm_node->state = IRDMA_CM_STATE_CLOSED; in irdma_handle_ack_pkt()
2861 irdma_send_reset(cm_node); in irdma_handle_ack_pkt()
2864 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_ack_pkt()
2865 refcount_inc(&cm_node->refcnt); in irdma_handle_ack_pkt()
2866 irdma_send_reset(cm_node); in irdma_handle_ack_pkt()
2870 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_ack_pkt()
2871 cm_node->state = IRDMA_CM_STATE_CLOSED; in irdma_handle_ack_pkt()
2872 irdma_rem_ref_cm_node(cm_node); in irdma_handle_ack_pkt()
2875 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_ack_pkt()
2876 cm_node->state = IRDMA_CM_STATE_FIN_WAIT2; in irdma_handle_ack_pkt()
2884 irdma_cleanup_retrans_entry(cm_node); in irdma_handle_ack_pkt()
2896 static void irdma_process_pkt(struct irdma_cm_node *cm_node, in irdma_process_pkt() argument
2918 irdma_handle_syn_pkt(cm_node, rbuf); in irdma_process_pkt()
2921 irdma_handle_synack_pkt(cm_node, rbuf); in irdma_process_pkt()
2924 err = irdma_handle_ack_pkt(cm_node, rbuf); in irdma_process_pkt()
2926 irdma_handle_fin_pkt(cm_node); in irdma_process_pkt()
2929 irdma_handle_rst_pkt(cm_node, rbuf); in irdma_process_pkt()
2933 (!irdma_check_seq(cm_node, (struct tcphdr *)rbuf->tcph))) in irdma_process_pkt()
2934 irdma_handle_fin_pkt(cm_node); in irdma_process_pkt()
3016 struct irdma_cm_node *cm_node; in irdma_create_cm_node() local
3021 cm_node = irdma_make_cm_node(cm_core, iwdev, cm_info, NULL); in irdma_create_cm_node()
3022 if (!cm_node) in irdma_create_cm_node()
3026 cm_node->tcp_cntxt.client = 1; in irdma_create_cm_node()
3027 cm_node->tcp_cntxt.rcv_wscale = IRDMA_CM_DEFAULT_RCV_WND_SCALE; in irdma_create_cm_node()
3029 irdma_record_ird_ord(cm_node, conn_param->ird, conn_param->ord); in irdma_create_cm_node()
3031 cm_node->pdata.size = private_data_len; in irdma_create_cm_node()
3032 cm_node->pdata.addr = cm_node->pdata_buf; in irdma_create_cm_node()
3034 memcpy(cm_node->pdata_buf, private_data, private_data_len); in irdma_create_cm_node()
3035 *caller_cm_node = cm_node; in irdma_create_cm_node()
3046 static int irdma_cm_reject(struct irdma_cm_node *cm_node, const void *pdata, in irdma_cm_reject() argument
3052 if (cm_node->tcp_cntxt.client) in irdma_cm_reject()
3055 irdma_cleanup_retrans_entry(cm_node); in irdma_cm_reject()
3057 passive_state = atomic_add_return(1, &cm_node->passive_state); in irdma_cm_reject()
3059 cm_node->state = IRDMA_CM_STATE_CLOSED; in irdma_cm_reject()
3060 irdma_rem_ref_cm_node(cm_node); in irdma_cm_reject()
3064 if (cm_node->state == IRDMA_CM_STATE_LISTENER_DESTROYED) { in irdma_cm_reject()
3065 irdma_rem_ref_cm_node(cm_node); in irdma_cm_reject()
3069 ret = irdma_send_mpa_reject(cm_node, pdata, plen); in irdma_cm_reject()
3073 cm_node->state = IRDMA_CM_STATE_CLOSED; in irdma_cm_reject()
3074 if (irdma_send_reset(cm_node)) in irdma_cm_reject()
3075 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_cm_reject()
3085 static int irdma_cm_close(struct irdma_cm_node *cm_node) in irdma_cm_close() argument
3087 switch (cm_node->state) { in irdma_cm_close()
3095 irdma_cleanup_retrans_entry(cm_node); in irdma_cm_close()
3096 irdma_send_reset(cm_node); in irdma_cm_close()
3099 cm_node->state = IRDMA_CM_STATE_LAST_ACK; in irdma_cm_close()
3100 irdma_send_fin(cm_node); in irdma_cm_close()
3109 irdma_cleanup_retrans_entry(cm_node); in irdma_cm_close()
3110 irdma_send_reset(cm_node); in irdma_cm_close()
3117 irdma_rem_ref_cm_node(cm_node); in irdma_cm_close()
3120 if (cm_node->send_entry) in irdma_cm_close()
3121 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_cm_close()
3123 irdma_rem_ref_cm_node(cm_node); in irdma_cm_close()
3138 struct irdma_cm_node *cm_node; in irdma_receive_ilq() local
3194 cm_node = irdma_find_node(cm_core, cm_info.rem_port, cm_info.rem_addr, in irdma_receive_ilq()
3197 if (!cm_node) { in irdma_receive_ilq()
3218 cm_node = irdma_make_cm_node(cm_core, iwdev, &cm_info, in irdma_receive_ilq()
3220 if (!cm_node) { in irdma_receive_ilq()
3228 cm_node->state = IRDMA_CM_STATE_LISTENING; in irdma_receive_ilq()
3230 irdma_rem_ref_cm_node(cm_node); in irdma_receive_ilq()
3234 refcount_inc(&cm_node->refcnt); in irdma_receive_ilq()
3235 } else if (cm_node->state == IRDMA_CM_STATE_OFFLOADED) { in irdma_receive_ilq()
3236 irdma_rem_ref_cm_node(cm_node); in irdma_receive_ilq()
3240 irdma_process_pkt(cm_node, rbuf); in irdma_receive_ilq()
3241 irdma_rem_ref_cm_node(cm_node); in irdma_receive_ilq()
3244 static int irdma_add_qh(struct irdma_cm_node *cm_node, bool active) in irdma_add_qh() argument
3247 irdma_add_conn_est_qh(cm_node); in irdma_add_qh()
3251 static void irdma_cm_free_ah_nop(struct irdma_cm_node *cm_node) in irdma_cm_free_ah_nop() argument
3317 static void irdma_init_tcp_ctx(struct irdma_cm_node *cm_node, in irdma_init_tcp_ctx() argument
3321 tcp_info->ipv4 = cm_node->ipv4; in irdma_init_tcp_ctx()
3334 tcp_info->snd_wscale = cm_node->tcp_cntxt.snd_wscale; in irdma_init_tcp_ctx()
3335 tcp_info->rcv_wscale = cm_node->tcp_cntxt.rcv_wscale; in irdma_init_tcp_ctx()
3337 tcp_info->snd_nxt = cm_node->tcp_cntxt.loc_seq_num; in irdma_init_tcp_ctx()
3338 tcp_info->snd_wnd = cm_node->tcp_cntxt.snd_wnd; in irdma_init_tcp_ctx()
3339 tcp_info->rcv_nxt = cm_node->tcp_cntxt.rcv_nxt; in irdma_init_tcp_ctx()
3340 tcp_info->snd_max = cm_node->tcp_cntxt.loc_seq_num; in irdma_init_tcp_ctx()
3342 tcp_info->snd_una = cm_node->tcp_cntxt.loc_seq_num; in irdma_init_tcp_ctx()
3343 tcp_info->cwnd = 2 * cm_node->tcp_cntxt.mss; in irdma_init_tcp_ctx()
3344 tcp_info->snd_wl1 = cm_node->tcp_cntxt.rcv_nxt; in irdma_init_tcp_ctx()
3345 tcp_info->snd_wl2 = cm_node->tcp_cntxt.loc_seq_num; in irdma_init_tcp_ctx()
3346 tcp_info->max_snd_window = cm_node->tcp_cntxt.max_snd_wnd; in irdma_init_tcp_ctx()
3347 tcp_info->rcv_wnd = cm_node->tcp_cntxt.rcv_wnd in irdma_init_tcp_ctx()
3348 << cm_node->tcp_cntxt.rcv_wscale; in irdma_init_tcp_ctx()
3351 tcp_info->snd_mss = (u32)cm_node->tcp_cntxt.mss; in irdma_init_tcp_ctx()
3352 tcp_info->tos = cm_node->tos; in irdma_init_tcp_ctx()
3353 if (cm_node->vlan_id < VLAN_N_VID) { in irdma_init_tcp_ctx()
3355 tcp_info->vlan_tag = cm_node->vlan_id; in irdma_init_tcp_ctx()
3356 tcp_info->vlan_tag |= cm_node->user_pri << VLAN_PRIO_SHIFT; in irdma_init_tcp_ctx()
3358 if (cm_node->ipv4) { in irdma_init_tcp_ctx()
3359 tcp_info->src_port = cm_node->loc_port; in irdma_init_tcp_ctx()
3360 tcp_info->dst_port = cm_node->rem_port; in irdma_init_tcp_ctx()
3362 tcp_info->dest_ip_addr[3] = cm_node->rem_addr[0]; in irdma_init_tcp_ctx()
3363 tcp_info->local_ipaddr[3] = cm_node->loc_addr[0]; in irdma_init_tcp_ctx()
3369 tcp_info->src_port = cm_node->loc_port; in irdma_init_tcp_ctx()
3370 tcp_info->dst_port = cm_node->rem_port; in irdma_init_tcp_ctx()
3371 memcpy(tcp_info->dest_ip_addr, cm_node->rem_addr, in irdma_init_tcp_ctx()
3373 memcpy(tcp_info->local_ipaddr, cm_node->loc_addr, in irdma_init_tcp_ctx()
3389 struct irdma_cm_node *cm_node) in irdma_cm_init_tsa_conn() argument
3401 iwarp_info->ord_size = cm_node->ord_size; in irdma_cm_init_tsa_conn()
3402 iwarp_info->ird_size = cm_node->ird_size; in irdma_cm_init_tsa_conn()
3410 ctx_info->user_pri = cm_node->user_pri; in irdma_cm_init_tsa_conn()
3412 irdma_init_tcp_ctx(cm_node, &iwqp->tcp_info, iwqp); in irdma_cm_init_tsa_conn()
3413 if (cm_node->snd_mark_en) { in irdma_cm_init_tsa_conn()
3416 cm_node->lsmm_size; in irdma_cm_init_tsa_conn()
3419 cm_node->state = IRDMA_CM_STATE_OFFLOADED; in irdma_cm_init_tsa_conn()
3423 if (cm_node->rcv_mark_en) { in irdma_cm_init_tsa_conn()
3477 irdma_cm_close(iwqp->cm_node); in irdma_qp_disconnect()
3566 if (!iwqp->cm_node) { in irdma_cm_disconn_true()
3570 refcount_inc(&iwqp->cm_node->refcnt); in irdma_cm_disconn_true()
3575 err = irdma_send_cm_event(iwqp->cm_node, cm_id, in irdma_cm_disconn_true()
3585 err = irdma_send_cm_event(iwqp->cm_node, cm_id, in irdma_cm_disconn_true()
3593 irdma_rem_ref_cm_node(iwqp->cm_node); in irdma_cm_disconn_true()
3641 struct irdma_cm_node *cm_node; in irdma_accept() local
3659 cm_node = cm_id->provider_data; in irdma_accept()
3662 cm_node->ipv4 = true; in irdma_accept()
3663 cm_node->vlan_id = irdma_get_vlan_ipv4(cm_node->loc_addr); in irdma_accept()
3665 cm_node->ipv4 = false; in irdma_accept()
3666 irdma_get_vlan_mac_ipv6(cm_node->loc_addr, &cm_node->vlan_id, in irdma_accept()
3670 cm_node->vlan_id); in irdma_accept()
3672 trace_irdma_accept(cm_node, 0, NULL); in irdma_accept()
3674 if (cm_node->state == IRDMA_CM_STATE_LISTENER_DESTROYED) { in irdma_accept()
3679 passive_state = atomic_add_return(1, &cm_node->passive_state); in irdma_accept()
3695 cm_node->pdata.size = conn_param->private_data_len; in irdma_accept()
3697 accept.size = irdma_cm_build_mpa_frame(cm_node, &accept, MPA_KEY_REPLY); in irdma_accept()
3701 if (cm_node->dev->ws_add(iwqp->sc_qp.vsi, cm_node->user_pri)) { in irdma_accept()
3705 iwqp->sc_qp.user_pri = cm_node->user_pri; in irdma_accept()
3723 cm_node->lsmm_size = accept.size + conn_param->private_data_len; in irdma_accept()
3724 irdma_sc_send_lsmm(&iwqp->sc_qp, iwqp->ietf_mem.va, cm_node->lsmm_size, in irdma_accept()
3731 cm_node->cm_id = cm_id; in irdma_accept()
3735 iwqp->cm_node = cm_node; in irdma_accept()
3736 cm_node->iwqp = iwqp; in irdma_accept()
3737 irdma_cm_init_tsa_conn(iwqp, cm_node); in irdma_accept()
3742 cm_node->qhash_set = false; in irdma_accept()
3743 cm_node->cm_core->cm_free_ah(cm_node); in irdma_accept()
3753 cm_node, cm_node->loc_port, in irdma_accept()
3754 cm_node->rem_port, cm_node->cm_id); in irdma_accept()
3760 irdma_send_cm_event(cm_node, cm_id, IW_CM_EVENT_ESTABLISHED, 0); in irdma_accept()
3761 cm_node->accelerated = true; in irdma_accept()
3762 complete(&cm_node->establish_comp); in irdma_accept()
3764 if (cm_node->accept_pend) { in irdma_accept()
3765 atomic_dec(&cm_node->listener->pend_accepts_cnt); in irdma_accept()
3766 cm_node->accept_pend = 0; in irdma_accept()
3771 cm_node->rem_port, cm_node->loc_port, cm_node->rem_addr, in irdma_accept()
3772 cm_node->loc_addr, cm_node, cm_id, ibqp->qp_num); in irdma_accept()
3773 cm_node->cm_core->stats_accepts++; in irdma_accept()
3778 irdma_rem_ref_cm_node(cm_node); in irdma_accept()
3792 struct irdma_cm_node *cm_node; in irdma_reject() local
3794 cm_node = cm_id->provider_data; in irdma_reject()
3795 cm_node->pdata.size = pdata_len; in irdma_reject()
3797 trace_irdma_reject(cm_node, 0, NULL); in irdma_reject()
3803 cm_node->cm_core->stats_rejects++; in irdma_reject()
3808 return irdma_cm_reject(cm_node, pdata, pdata_len); in irdma_reject()
3821 struct irdma_cm_node *cm_node; in irdma_connect() local
3901 &cm_node); in irdma_connect()
3904 ret = cm_node->cm_core->cm_create_ah(cm_node, true); in irdma_connect()
3913 cm_node->qhash_set = true; in irdma_connect()
3915 cm_node->apbvt_entry = irdma_add_apbvt(iwdev, cm_info.loc_port); in irdma_connect()
3916 if (!cm_node->apbvt_entry) { in irdma_connect()
3921 cm_node->apbvt_set = true; in irdma_connect()
3922 iwqp->cm_node = cm_node; in irdma_connect()
3923 cm_node->iwqp = iwqp; in irdma_connect()
3928 if (cm_node->state != IRDMA_CM_STATE_OFFLOADED) { in irdma_connect()
3929 cm_node->state = IRDMA_CM_STATE_SYN_SENT; in irdma_connect()
3930 ret = irdma_send_syn(cm_node, 0); in irdma_connect()
3937 cm_node->rem_port, cm_node->loc_port, cm_node->rem_addr, in irdma_connect()
3938 cm_node->loc_addr, cm_node, cm_id, ibqp->qp_num); in irdma_connect()
3940 trace_irdma_connect(cm_node, 0, NULL); in irdma_connect()
3953 irdma_rem_ref_cm_node(cm_node); in irdma_connect()
4116 struct irdma_cm_node *cm_node; in irdma_teardown_list_prep() local
4119 hash_for_each_rcu(cm_core->cm_hash_tbl, bkt, cm_node, list) { in irdma_teardown_list_prep()
4121 (nfo->vlan_id == cm_node->vlan_id && in irdma_teardown_list_prep()
4122 !memcmp(cm_node->loc_addr, ipaddr, nfo->ipv4 ? 4 : 16))) && in irdma_teardown_list_prep()
4123 refcount_inc_not_zero(&cm_node->refcnt)) in irdma_teardown_list_prep()
4124 list_add(&cm_node->teardown_entry, teardown_list); in irdma_teardown_list_prep()
4136 struct irdma_cm_node *cm_node; in irdma_cm_event_connected() local
4144 cm_node = event->cm_node; in irdma_cm_event_connected()
4145 cm_id = cm_node->cm_id; in irdma_cm_event_connected()
4154 irdma_cm_init_tsa_conn(iwqp, cm_node); in irdma_cm_event_connected()
4155 read0 = (cm_node->send_rdma0_op == SEND_RDMA_READ_ZERO); in irdma_cm_event_connected()
4163 cm_node->qhash_set = false; in irdma_cm_event_connected()
4172 cm_node, cm_node->loc_port, in irdma_cm_event_connected()
4173 cm_node->rem_port, cm_node->cm_id); in irdma_cm_event_connected()
4176 irdma_send_cm_event(cm_node, cm_id, IW_CM_EVENT_CONNECT_REPLY, 0); in irdma_cm_event_connected()
4177 cm_node->accelerated = true; in irdma_cm_event_connected()
4178 complete(&cm_node->establish_comp); in irdma_cm_event_connected()
4179 cm_node->cm_core->cm_free_ah(cm_node); in irdma_cm_event_connected()
4185 irdma_send_cm_event(event->cm_node, cm_id, IW_CM_EVENT_CONNECT_REPLY, in irdma_cm_event_connected()
4187 irdma_rem_ref_cm_node(event->cm_node); in irdma_cm_event_connected()
4196 struct irdma_cm_node *cm_node = event->cm_node; in irdma_cm_event_reset() local
4197 struct iw_cm_id *cm_id = cm_node->cm_id; in irdma_cm_event_reset()
4207 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_cm_event_reset()
4208 "CM: reset event %p - cm_id = %p\n", event->cm_node, cm_id); in irdma_cm_event_reset()
4211 irdma_send_cm_event(cm_node, cm_node->cm_id, IW_CM_EVENT_DISCONNECT, in irdma_cm_event_reset()
4213 irdma_send_cm_event(cm_node, cm_node->cm_id, IW_CM_EVENT_CLOSE, 0); in irdma_cm_event_reset()
4223 struct irdma_cm_node *cm_node; in irdma_cm_event_handler() local
4225 if (!event || !event->cm_node || !event->cm_node->cm_core) in irdma_cm_event_handler()
4228 cm_node = event->cm_node; in irdma_cm_event_handler()
4229 trace_irdma_cm_event_handler(cm_node, event->type, NULL); in irdma_cm_event_handler()
4233 irdma_send_cm_event(cm_node, cm_node->cm_id, in irdma_cm_event_handler()
4240 if (!event->cm_node->cm_id || in irdma_cm_event_handler()
4241 event->cm_node->state != IRDMA_CM_STATE_OFFLOADED) in irdma_cm_event_handler()
4246 if (!event->cm_node->cm_id || in irdma_cm_event_handler()
4247 cm_node->state == IRDMA_CM_STATE_OFFLOADED) in irdma_cm_event_handler()
4249 irdma_send_cm_event(cm_node, cm_node->cm_id, in irdma_cm_event_handler()
4253 if (!event->cm_node->cm_id || in irdma_cm_event_handler()
4254 event->cm_node->state == IRDMA_CM_STATE_OFFLOADED) in irdma_cm_event_handler()
4259 ibdev_dbg(&cm_node->iwdev->ibdev, in irdma_cm_event_handler()
4264 irdma_rem_ref_cm_node(event->cm_node); in irdma_cm_event_handler()
4274 refcount_inc(&event->cm_node->refcnt); in irdma_cm_post_event()
4276 queue_work(event->cm_node->cm_core->event_wq, &event->event_work); in irdma_cm_post_event()
4295 struct irdma_cm_node *cm_node; in irdma_cm_teardown_connections() local
4306 cm_node = container_of(list_node, struct irdma_cm_node, in irdma_cm_teardown_connections()
4309 irdma_modify_qp(&cm_node->iwqp->ibqp, &attr, IB_QP_STATE, NULL); in irdma_cm_teardown_connections()
4311 irdma_cm_disconn(cm_node->iwqp); in irdma_cm_teardown_connections()
4312 irdma_rem_ref_cm_node(cm_node); in irdma_cm_teardown_connections()