Lines Matching refs:cm_node

112 static int send_ack(struct nes_cm_node *cm_node, struct sk_buff *skb);
113 static int send_fin(struct nes_cm_node *cm_node, struct sk_buff *skb);
121 static void free_retrans_entry(struct nes_cm_node *cm_node);
122 static int handle_tcp_options(struct nes_cm_node *cm_node, struct tcphdr *tcph,
131 static void handle_recv_entry(struct nes_cm_node *cm_node, u32 rem_node);
166 static struct nes_cm_event *create_event(struct nes_cm_node *cm_node, in create_event() argument
171 if (!cm_node->cm_id) in create_event()
181 event->cm_node = cm_node; in create_event()
182 event->cm_info.rem_addr = cm_node->rem_addr; in create_event()
183 event->cm_info.loc_addr = cm_node->loc_addr; in create_event()
184 event->cm_info.rem_port = cm_node->rem_port; in create_event()
185 event->cm_info.loc_port = cm_node->loc_port; in create_event()
186 event->cm_info.cm_id = cm_node->cm_id; in create_event()
190 cm_node, event, type, event->cm_info.loc_addr, in create_event()
202 static int send_mpa_request(struct nes_cm_node *cm_node, struct sk_buff *skb) in send_mpa_request() argument
210 form_cm_frame(skb, cm_node, NULL, 0, &cm_node->mpa_frame, in send_mpa_request()
211 cm_node->mpa_frame_size, SET_ACK); in send_mpa_request()
213 return schedule_nes_timer(cm_node, skb, NES_TIMER_TYPE_SEND, 1, 0); in send_mpa_request()
218 static int send_mpa_reject(struct nes_cm_node *cm_node) in send_mpa_reject() argument
229 form_cm_frame(skb, cm_node, NULL, 0, &cm_node->mpa_frame, in send_mpa_reject()
230 cm_node->mpa_frame_size, SET_ACK | SET_FIN); in send_mpa_reject()
232 cm_node->state = NES_CM_STATE_FIN_WAIT1; in send_mpa_reject()
233 return schedule_nes_timer(cm_node, skb, NES_TIMER_TYPE_SEND, 1, 0); in send_mpa_reject()
241 static int parse_mpa(struct nes_cm_node *cm_node, u8 *buffer, u32 *type, in parse_mpa() argument
255 cm_node->mpa_frame_size = ntohs(mpa_frame->priv_data_len); in parse_mpa()
257 if (cm_node->mpa_frame_size > IETF_MAX_PRIV_DATA_LEN) { in parse_mpa()
272 if (cm_node->state != NES_CM_STATE_MPAREQ_SENT) { in parse_mpa()
284 if (cm_node->mpa_frame_size + sizeof(struct ietf_mpa_frame) != len) { in parse_mpa()
287 cm_node->mpa_frame_size, in parse_mpa()
295 cm_node->mpa_frame_size, in parse_mpa()
301 memcpy(cm_node->mpa_frame_buf, buffer + sizeof(struct ietf_mpa_frame), in parse_mpa()
302 cm_node->mpa_frame_size); in parse_mpa()
315 struct nes_cm_node *cm_node, void *options, u32 optionsize, in form_cm_frame() argument
348 memcpy(ethh->h_dest, cm_node->rem_mac, ETH_ALEN); in form_cm_frame()
349 memcpy(ethh->h_source, cm_node->loc_mac, ETH_ALEN); in form_cm_frame()
356 iph->id = htons(++cm_node->tcp_cntxt.loc_id); in form_cm_frame()
362 iph->saddr = htonl(cm_node->loc_addr); in form_cm_frame()
363 iph->daddr = htonl(cm_node->rem_addr); in form_cm_frame()
365 tcph->source = htons(cm_node->loc_port); in form_cm_frame()
366 tcph->dest = htons(cm_node->rem_port); in form_cm_frame()
367 tcph->seq = htonl(cm_node->tcp_cntxt.loc_seq_num); in form_cm_frame()
370 cm_node->tcp_cntxt.loc_ack_num = cm_node->tcp_cntxt.rcv_nxt; in form_cm_frame()
371 tcph->ack_seq = htonl(cm_node->tcp_cntxt.loc_ack_num); in form_cm_frame()
377 cm_node->tcp_cntxt.loc_seq_num++; in form_cm_frame()
380 cm_node->tcp_cntxt.loc_seq_num += datasize; in form_cm_frame()
383 cm_node->tcp_cntxt.loc_seq_num++; in form_cm_frame()
391 tcph->window = htons(cm_node->tcp_cntxt.rcv_wnd); in form_cm_frame()
432 int schedule_nes_timer(struct nes_cm_node *cm_node, struct sk_buff *skb, in schedule_nes_timer() argument
437 struct nes_cm_core *cm_core = cm_node->cm_core; in schedule_nes_timer()
452 new_send->netdev = cm_node->netdev; in schedule_nes_timer()
458 if (cm_node->recv_entry) { in schedule_nes_timer()
463 cm_node->recv_entry = new_send; in schedule_nes_timer()
469 spin_lock_irqsave(&cm_node->retrans_list_lock, flags); in schedule_nes_timer()
470 cm_node->send_entry = new_send; in schedule_nes_timer()
471 add_ref_cm_node(cm_node); in schedule_nes_timer()
472 spin_unlock_irqrestore(&cm_node->retrans_list_lock, flags); in schedule_nes_timer()
475 ret = nes_nic_cm_xmit(new_send->skb, cm_node->netdev); in schedule_nes_timer()
484 cleanup_retrans_entry(cm_node); in schedule_nes_timer()
486 rem_ref_cm_node(cm_core, cm_node); in schedule_nes_timer()
502 static void nes_retrans_expired(struct nes_cm_node *cm_node) in nes_retrans_expired() argument
504 struct iw_cm_id *cm_id = cm_node->cm_id; in nes_retrans_expired()
505 enum nes_cm_node_state state = cm_node->state; in nes_retrans_expired()
506 cm_node->state = NES_CM_STATE_CLOSED; in nes_retrans_expired()
510 rem_ref_cm_node(cm_node->cm_core, cm_node); in nes_retrans_expired()
514 if (cm_node->cm_id) in nes_retrans_expired()
516 send_reset(cm_node, NULL); in nes_retrans_expired()
519 add_ref_cm_node(cm_node); in nes_retrans_expired()
520 send_reset(cm_node, NULL); in nes_retrans_expired()
521 create_event(cm_node, NES_CM_EVENT_ABORTED); in nes_retrans_expired()
525 static void handle_recv_entry(struct nes_cm_node *cm_node, u32 rem_node) in handle_recv_entry() argument
527 struct nes_timer_entry *recv_entry = cm_node->recv_entry; in handle_recv_entry()
528 struct iw_cm_id *cm_id = cm_node->cm_id; in handle_recv_entry()
558 rem_ref_cm_node(cm_node->cm_core, cm_node); in handle_recv_entry()
560 if (cm_node->cm_id) in handle_recv_entry()
563 cm_node->recv_entry = NULL; in handle_recv_entry()
573 struct nes_cm_node *cm_node; in nes_cm_timer_tick() local
588 cm_node = container_of(list_node, struct nes_cm_node, list); in nes_cm_timer_tick()
589 if ((cm_node->recv_entry) || (cm_node->send_entry)) { in nes_cm_timer_tick()
590 add_ref_cm_node(cm_node); in nes_cm_timer_tick()
591 list_add(&cm_node->timer_entry, &timer_list); in nes_cm_timer_tick()
597 cm_node = container_of(list_node, struct nes_cm_node, in nes_cm_timer_tick()
599 recv_entry = cm_node->recv_entry; in nes_cm_timer_tick()
609 handle_recv_entry(cm_node, 1); in nes_cm_timer_tick()
612 spin_lock_irqsave(&cm_node->retrans_list_lock, flags); in nes_cm_timer_tick()
614 send_entry = cm_node->send_entry; in nes_cm_timer_tick()
618 if (cm_node->state != NES_CM_STATE_TSA) { in nes_cm_timer_tick()
627 free_retrans_entry(cm_node); in nes_cm_timer_tick()
632 if ((cm_node->state == NES_CM_STATE_TSA) || in nes_cm_timer_tick()
633 (cm_node->state == NES_CM_STATE_CLOSED)) { in nes_cm_timer_tick()
634 free_retrans_entry(cm_node); in nes_cm_timer_tick()
641 free_retrans_entry(cm_node); in nes_cm_timer_tick()
644 &cm_node->retrans_list_lock, flags); in nes_cm_timer_tick()
645 nes_retrans_expired(cm_node); in nes_cm_timer_tick()
646 cm_node->state = NES_CM_STATE_CLOSED; in nes_cm_timer_tick()
647 spin_lock_irqsave(&cm_node->retrans_list_lock, in nes_cm_timer_tick()
657 "0x%08X\n", send_entry, cm_node, jiffies, in nes_cm_timer_tick()
661 cm_node->tcp_cntxt.rem_ack_num); in nes_cm_timer_tick()
663 spin_unlock_irqrestore(&cm_node->retrans_list_lock, in nes_cm_timer_tick()
665 ret = nes_nic_cm_xmit(send_entry->skb, cm_node->netdev); in nes_cm_timer_tick()
666 spin_lock_irqsave(&cm_node->retrans_list_lock, flags); in nes_cm_timer_tick()
669 "node=%p\n", cm_node); in nes_cm_timer_tick()
699 cm_node, cm_node->state); in nes_cm_timer_tick()
700 free_retrans_entry(cm_node); in nes_cm_timer_tick()
702 rem_ref_cm_node(cm_node->cm_core, in nes_cm_timer_tick()
703 cm_node); in nes_cm_timer_tick()
707 spin_unlock_irqrestore(&cm_node->retrans_list_lock, flags); in nes_cm_timer_tick()
708 rem_ref_cm_node(cm_node->cm_core, cm_node); in nes_cm_timer_tick()
723 static int send_syn(struct nes_cm_node *cm_node, u32 sendack, in send_syn() argument
736 if (!cm_node) in send_syn()
742 options->as_mss.mss = htons(cm_node->tcp_cntxt.mss); in send_syn()
748 options->as_windowscale.shiftcount = cm_node->tcp_cntxt.rcv_wscale; in send_syn()
779 form_cm_frame(skb, cm_node, optionsbuffer, optionssize, NULL, 0, flags); in send_syn()
780 ret = schedule_nes_timer(cm_node, skb, NES_TIMER_TYPE_SEND, 1, 0); in send_syn()
789 static int send_reset(struct nes_cm_node *cm_node, struct sk_buff *skb) in send_reset() argument
801 form_cm_frame(skb, cm_node, NULL, 0, NULL, 0, flags); in send_reset()
802 ret = schedule_nes_timer(cm_node, skb, NES_TIMER_TYPE_SEND, 0, 1); in send_reset()
811 static int send_ack(struct nes_cm_node *cm_node, struct sk_buff *skb) in send_ack() argument
823 form_cm_frame(skb, cm_node, NULL, 0, NULL, 0, SET_ACK); in send_ack()
824 ret = schedule_nes_timer(cm_node, skb, NES_TIMER_TYPE_SEND, 0, 0); in send_ack()
833 static int send_fin(struct nes_cm_node *cm_node, struct sk_buff *skb) in send_fin() argument
846 form_cm_frame(skb, cm_node, NULL, 0, NULL, 0, SET_ACK | SET_FIN); in send_fin()
847 ret = schedule_nes_timer(cm_node, skb, NES_TIMER_TYPE_SEND, 1, 0); in send_fin()
861 struct nes_cm_node *cm_node; in find_node() local
868 list_for_each_entry(cm_node, hte, list) { in find_node()
871 cm_node->loc_addr, cm_node->loc_port, in find_node()
873 cm_node->rem_addr, cm_node->rem_port, in find_node()
875 if ((cm_node->loc_addr == loc_addr) && (cm_node->loc_port == loc_port) && in find_node()
876 (cm_node->rem_addr == rem_addr) && (cm_node->rem_port == rem_port)) { in find_node()
877 add_ref_cm_node(cm_node); in find_node()
879 return cm_node; in find_node()
921 static int add_hte_node(struct nes_cm_core *cm_core, struct nes_cm_node *cm_node) in add_hte_node() argument
926 if (!cm_node || !cm_core) in add_hte_node()
930 cm_node); in add_hte_node()
936 list_add_tail(&cm_node->list, hte); in add_hte_node()
956 struct nes_cm_node *cm_node = NULL; in mini_cm_dec_refcnt_listen() local
968 cm_node = container_of(list_pos, struct nes_cm_node, in mini_cm_dec_refcnt_listen()
970 if ((cm_node->listener == listener) && in mini_cm_dec_refcnt_listen()
971 (!cm_node->accelerated)) { in mini_cm_dec_refcnt_listen()
972 add_ref_cm_node(cm_node); in mini_cm_dec_refcnt_listen()
973 list_add(&cm_node->reset_entry, &reset_list); in mini_cm_dec_refcnt_listen()
980 cm_node = container_of(list_pos, struct nes_cm_node, in mini_cm_dec_refcnt_listen()
983 struct nes_cm_node *loopback = cm_node->loopbackpartner; in mini_cm_dec_refcnt_listen()
985 if (NES_CM_STATE_FIN_WAIT1 <= cm_node->state) { in mini_cm_dec_refcnt_listen()
986 rem_ref_cm_node(cm_node->cm_core, cm_node); in mini_cm_dec_refcnt_listen()
989 cleanup_retrans_entry(cm_node); in mini_cm_dec_refcnt_listen()
990 err = send_reset(cm_node, NULL); in mini_cm_dec_refcnt_listen()
992 cm_node->state = in mini_cm_dec_refcnt_listen()
996 old_state = cm_node->state; in mini_cm_dec_refcnt_listen()
997 cm_node->state = NES_CM_STATE_LISTENER_DESTROYED; in mini_cm_dec_refcnt_listen()
1000 cm_node->cm_core, in mini_cm_dec_refcnt_listen()
1001 cm_node); in mini_cm_dec_refcnt_listen()
1006 event.cm_node = loopback; in mini_cm_dec_refcnt_listen()
1019 cm_node->state = NES_CM_STATE_LISTENER_DESTROYED; in mini_cm_dec_refcnt_listen()
1021 rem_ref_cm_node(cm_node->cm_core, in mini_cm_dec_refcnt_listen()
1022 cm_node); in mini_cm_dec_refcnt_listen()
1079 struct nes_cm_node *cm_node) in mini_cm_accelerated() argument
1082 cm_node->accelerated = 1; in mini_cm_accelerated()
1084 if (cm_node->accept_pend) { in mini_cm_accelerated()
1085 BUG_ON(!cm_node->listener); in mini_cm_accelerated()
1086 atomic_dec(&cm_node->listener->pend_accepts_cnt); in mini_cm_accelerated()
1087 cm_node->accept_pend = 0; in mini_cm_accelerated()
1088 BUG_ON(atomic_read(&cm_node->listener->pend_accepts_cnt) < 0); in mini_cm_accelerated()
1167 struct nes_cm_node *cm_node; in make_cm_node() local
1175 cm_node = kzalloc(sizeof(*cm_node), GFP_ATOMIC); in make_cm_node()
1176 if (!cm_node) in make_cm_node()
1180 cm_node->loc_addr = cm_info->loc_addr; in make_cm_node()
1181 cm_node->rem_addr = cm_info->rem_addr; in make_cm_node()
1182 cm_node->loc_port = cm_info->loc_port; in make_cm_node()
1183 cm_node->rem_port = cm_info->rem_port; in make_cm_node()
1184 cm_node->send_write0 = send_first; in make_cm_node()
1186 &cm_node->loc_addr, cm_node->loc_port, in make_cm_node()
1187 &cm_node->rem_addr, cm_node->rem_port); in make_cm_node()
1188 cm_node->listener = listener; in make_cm_node()
1189 cm_node->netdev = nesvnic->netdev; in make_cm_node()
1190 cm_node->cm_id = cm_info->cm_id; in make_cm_node()
1191 memcpy(cm_node->loc_mac, nesvnic->netdev->dev_addr, ETH_ALEN); in make_cm_node()
1193 nes_debug(NES_DBG_CM, "listener=%p, cm_id=%p\n", cm_node->listener, in make_cm_node()
1194 cm_node->cm_id); in make_cm_node()
1196 spin_lock_init(&cm_node->retrans_list_lock); in make_cm_node()
1198 cm_node->loopbackpartner = NULL; in make_cm_node()
1199 atomic_set(&cm_node->ref_count, 1); in make_cm_node()
1201 cm_node->cm_core = cm_core; in make_cm_node()
1202 cm_node->tcp_cntxt.loc_id = NES_CM_DEF_LOCAL_ID; in make_cm_node()
1203 cm_node->tcp_cntxt.rcv_wscale = NES_CM_DEFAULT_RCV_WND_SCALE; in make_cm_node()
1204 cm_node->tcp_cntxt.rcv_wnd = NES_CM_DEFAULT_RCV_WND_SCALED >> in make_cm_node()
1207 cm_node->tcp_cntxt.loc_seq_num = htonl(ts.tv_nsec); in make_cm_node()
1208 cm_node->tcp_cntxt.mss = nesvnic->max_frame_size - sizeof(struct iphdr) - in make_cm_node()
1210 cm_node->tcp_cntxt.rcv_nxt = 0; in make_cm_node()
1213 cm_node->conn_type = cm_info->conn_type; in make_cm_node()
1214 cm_node->apbvt_set = 0; in make_cm_node()
1215 cm_node->accept_pend = 0; in make_cm_node()
1217 cm_node->nesvnic = nesvnic; in make_cm_node()
1222 cm_node->loopbackpartner = NULL; in make_cm_node()
1225 if (ipv4_is_loopback(htonl(cm_node->rem_addr))) in make_cm_node()
1228 oldarpindex = nes_arp_table(nesdev, cm_node->rem_addr, NULL, NES_ARP_RESOLVE); in make_cm_node()
1233 kfree(cm_node); in make_cm_node()
1238 memcpy(cm_node->rem_mac, nesadapter->arp_table[arpindex].mac_addr, ETH_ALEN); in make_cm_node()
1240 cm_node->rem_mac); in make_cm_node()
1242 add_hte_node(cm_core, cm_node); in make_cm_node()
1245 return cm_node; in make_cm_node()
1252 static int add_ref_cm_node(struct nes_cm_node *cm_node) in add_ref_cm_node() argument
1254 atomic_inc(&cm_node->ref_count); in add_ref_cm_node()
1263 struct nes_cm_node *cm_node) in rem_ref_cm_node() argument
1268 if (!cm_node) in rem_ref_cm_node()
1271 spin_lock_irqsave(&cm_node->cm_core->ht_lock, flags); in rem_ref_cm_node()
1272 if (atomic_dec_return(&cm_node->ref_count)) { in rem_ref_cm_node()
1273 spin_unlock_irqrestore(&cm_node->cm_core->ht_lock, flags); in rem_ref_cm_node()
1276 list_del(&cm_node->list); in rem_ref_cm_node()
1278 spin_unlock_irqrestore(&cm_node->cm_core->ht_lock, flags); in rem_ref_cm_node()
1281 if (!cm_node->accelerated && cm_node->accept_pend) { in rem_ref_cm_node()
1282 BUG_ON(!cm_node->listener); in rem_ref_cm_node()
1283 atomic_dec(&cm_node->listener->pend_accepts_cnt); in rem_ref_cm_node()
1284 BUG_ON(atomic_read(&cm_node->listener->pend_accepts_cnt) < 0); in rem_ref_cm_node()
1286 WARN_ON(cm_node->send_entry); in rem_ref_cm_node()
1287 if (cm_node->recv_entry) in rem_ref_cm_node()
1288 handle_recv_entry(cm_node, 0); in rem_ref_cm_node()
1289 if (cm_node->listener) { in rem_ref_cm_node()
1290 mini_cm_dec_refcnt_listen(cm_core, cm_node->listener, 0); in rem_ref_cm_node()
1292 if (cm_node->apbvt_set && cm_node->nesvnic) { in rem_ref_cm_node()
1293 nes_manage_apbvt(cm_node->nesvnic, cm_node->loc_port, in rem_ref_cm_node()
1295 cm_node->nesvnic->nesdev->pcidev->devfn), in rem_ref_cm_node()
1302 nesqp = cm_node->nesqp; in rem_ref_cm_node()
1304 nesqp->cm_node = NULL; in rem_ref_cm_node()
1306 cm_node->nesqp = NULL; in rem_ref_cm_node()
1309 kfree(cm_node); in rem_ref_cm_node()
1316 static int process_options(struct nes_cm_node *cm_node, u8 *optionsloc, in process_options() argument
1343 cm_node->tcp_cntxt.mss) in process_options()
1344 cm_node->tcp_cntxt.mss = tmp; in process_options()
1348 cm_node->tcp_cntxt.snd_wscale = in process_options()
1352 cm_node->send_write0 = 1; in process_options()
1362 cm_node->tcp_cntxt.mss = NES_CM_DEFAULT_MSS; in process_options()
1372 static void handle_fin_pkt(struct nes_cm_node *cm_node) in handle_fin_pkt() argument
1375 "refcnt=%d\n", cm_node, cm_node->state, in handle_fin_pkt()
1376 atomic_read(&cm_node->ref_count)); in handle_fin_pkt()
1377 switch (cm_node->state) { in handle_fin_pkt()
1382 cm_node->tcp_cntxt.rcv_nxt++; in handle_fin_pkt()
1383 cleanup_retrans_entry(cm_node); in handle_fin_pkt()
1384 cm_node->state = NES_CM_STATE_LAST_ACK; in handle_fin_pkt()
1385 send_fin(cm_node, NULL); in handle_fin_pkt()
1388 create_event(cm_node, NES_CM_EVENT_ABORTED); in handle_fin_pkt()
1389 cm_node->tcp_cntxt.rcv_nxt++; in handle_fin_pkt()
1390 cleanup_retrans_entry(cm_node); in handle_fin_pkt()
1391 cm_node->state = NES_CM_STATE_CLOSED; in handle_fin_pkt()
1392 add_ref_cm_node(cm_node); in handle_fin_pkt()
1393 send_reset(cm_node, NULL); in handle_fin_pkt()
1396 cm_node->tcp_cntxt.rcv_nxt++; in handle_fin_pkt()
1397 cleanup_retrans_entry(cm_node); in handle_fin_pkt()
1398 cm_node->state = NES_CM_STATE_CLOSING; in handle_fin_pkt()
1399 send_ack(cm_node, NULL); in handle_fin_pkt()
1405 cm_node->tcp_cntxt.rcv_nxt++; in handle_fin_pkt()
1406 cleanup_retrans_entry(cm_node); in handle_fin_pkt()
1407 cm_node->state = NES_CM_STATE_TIME_WAIT; in handle_fin_pkt()
1408 send_ack(cm_node, NULL); in handle_fin_pkt()
1409 schedule_nes_timer(cm_node, NULL, NES_TIMER_TYPE_CLOSE, 1, 0); in handle_fin_pkt()
1412 cm_node->tcp_cntxt.rcv_nxt++; in handle_fin_pkt()
1413 cleanup_retrans_entry(cm_node); in handle_fin_pkt()
1414 cm_node->state = NES_CM_STATE_CLOSED; in handle_fin_pkt()
1415 rem_ref_cm_node(cm_node->cm_core, cm_node); in handle_fin_pkt()
1420 cm_node, cm_node->state); in handle_fin_pkt()
1426 static void handle_rst_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, in handle_rst_pkt() argument
1433 " refcnt=%d\n", cm_node, cm_node->state, in handle_rst_pkt()
1434 atomic_read(&cm_node->ref_count)); in handle_rst_pkt()
1435 cleanup_retrans_entry(cm_node); in handle_rst_pkt()
1436 switch (cm_node->state) { in handle_rst_pkt()
1440 "listener=%p state=%d\n", __func__, __LINE__, cm_node, in handle_rst_pkt()
1441 cm_node->listener, cm_node->state); in handle_rst_pkt()
1442 active_open_err(cm_node, skb, reset); in handle_rst_pkt()
1445 atomic_inc(&cm_node->passive_state); in handle_rst_pkt()
1452 passive_open_err(cm_node, skb, reset); in handle_rst_pkt()
1455 active_open_err(cm_node, skb, reset); in handle_rst_pkt()
1463 cm_node->cm_id->rem_ref(cm_node->cm_id); in handle_rst_pkt()
1465 cm_node->state = NES_CM_STATE_CLOSED; in handle_rst_pkt()
1466 rem_ref_cm_node(cm_node->cm_core, cm_node); in handle_rst_pkt()
1476 static void handle_rcv_mpa(struct nes_cm_node *cm_node, struct sk_buff *skb) in handle_rcv_mpa() argument
1485 ret = parse_mpa(cm_node, dataloc, &res_type, datasize); in handle_rcv_mpa()
1488 if (cm_node->state == NES_CM_STATE_MPAREQ_SENT) { in handle_rcv_mpa()
1491 __LINE__, cm_node, cm_node->listener, in handle_rcv_mpa()
1492 cm_node->state); in handle_rcv_mpa()
1493 active_open_err(cm_node, skb, 1); in handle_rcv_mpa()
1495 passive_open_err(cm_node, skb, 1); in handle_rcv_mpa()
1500 switch (cm_node->state) { in handle_rcv_mpa()
1508 cm_node->state = NES_CM_STATE_MPAREQ_RCVD; in handle_rcv_mpa()
1510 atomic_set(&cm_node->passive_state, in handle_rcv_mpa()
1514 cleanup_retrans_entry(cm_node); in handle_rcv_mpa()
1517 cm_node->state = NES_CM_STATE_MPAREJ_RCVD; in handle_rcv_mpa()
1520 cm_node->state = NES_CM_STATE_TSA; in handle_rcv_mpa()
1529 create_event(cm_node, type); in handle_rcv_mpa()
1532 static void indicate_pkt_err(struct nes_cm_node *cm_node, struct sk_buff *skb) in indicate_pkt_err() argument
1534 switch (cm_node->state) { in indicate_pkt_err()
1538 "listener=%p state=%d\n", __func__, __LINE__, cm_node, in indicate_pkt_err()
1539 cm_node->listener, cm_node->state); in indicate_pkt_err()
1540 active_open_err(cm_node, skb, 1); in indicate_pkt_err()
1544 passive_open_err(cm_node, skb, 1); in indicate_pkt_err()
1552 static int check_syn(struct nes_cm_node *cm_node, struct tcphdr *tcph, in check_syn() argument
1557 err = ((ntohl(tcph->ack_seq) == cm_node->tcp_cntxt.loc_seq_num))? 0 : 1; in check_syn()
1559 active_open_err(cm_node, skb, 1); in check_syn()
1564 static int check_seq(struct nes_cm_node *cm_node, struct tcphdr *tcph, in check_seq() argument
1570 u32 loc_seq_num = cm_node->tcp_cntxt.loc_seq_num; in check_seq()
1571 u32 rcv_nxt = cm_node->tcp_cntxt.rcv_nxt; in check_seq()
1575 rcv_wnd = cm_node->tcp_cntxt.rcv_wnd; in check_seq()
1582 "listener=%p state=%d\n", __func__, __LINE__, cm_node, in check_seq()
1583 cm_node->listener, cm_node->state); in check_seq()
1584 indicate_pkt_err(cm_node, skb); in check_seq()
1586 "rcv_nxt=0x%08X rcv_wnd=0x%x\n", cm_node, seq, rcv_nxt, in check_seq()
1598 static void handle_syn_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, in handle_syn_pkt() argument
1609 switch (cm_node->state) { in handle_syn_pkt()
1613 active_open_err(cm_node, skb, 1); in handle_syn_pkt()
1617 if (atomic_read(&cm_node->listener->pend_accepts_cnt) > in handle_syn_pkt()
1618 cm_node->listener->backlog) { in handle_syn_pkt()
1622 passive_open_err(cm_node, skb, 0); in handle_syn_pkt()
1625 ret = handle_tcp_options(cm_node, tcph, skb, optionsize, in handle_syn_pkt()
1628 passive_open_err(cm_node, skb, 0); in handle_syn_pkt()
1632 cm_node->tcp_cntxt.rcv_nxt = inc_sequence + 1; in handle_syn_pkt()
1633 BUG_ON(cm_node->send_entry); in handle_syn_pkt()
1634 cm_node->accept_pend = 1; in handle_syn_pkt()
1635 atomic_inc(&cm_node->listener->pend_accepts_cnt); in handle_syn_pkt()
1637 cm_node->state = NES_CM_STATE_SYN_RCVD; in handle_syn_pkt()
1638 send_syn(cm_node, 1, skb); in handle_syn_pkt()
1641 cleanup_retrans_entry(cm_node); in handle_syn_pkt()
1642 add_ref_cm_node(cm_node); in handle_syn_pkt()
1643 send_reset(cm_node, skb); in handle_syn_pkt()
1659 static void handle_synack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, in handle_synack_pkt() argument
1670 switch (cm_node->state) { in handle_synack_pkt()
1672 cleanup_retrans_entry(cm_node); in handle_synack_pkt()
1674 if (check_syn(cm_node, tcph, skb)) in handle_synack_pkt()
1676 cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq); in handle_synack_pkt()
1678 ret = handle_tcp_options(cm_node, tcph, skb, optionsize, 0); in handle_synack_pkt()
1681 cm_node); in handle_synack_pkt()
1684 cleanup_retrans_entry(cm_node); in handle_synack_pkt()
1685 cm_node->tcp_cntxt.rcv_nxt = inc_sequence + 1; in handle_synack_pkt()
1686 send_mpa_request(cm_node, skb); in handle_synack_pkt()
1687 cm_node->state = NES_CM_STATE_MPAREQ_SENT; in handle_synack_pkt()
1691 passive_open_err(cm_node, skb, 1); in handle_synack_pkt()
1694 cm_node->tcp_cntxt.loc_seq_num = ntohl(tcph->ack_seq); in handle_synack_pkt()
1695 cleanup_retrans_entry(cm_node); in handle_synack_pkt()
1696 cm_node->state = NES_CM_STATE_CLOSED; in handle_synack_pkt()
1697 send_reset(cm_node, skb); in handle_synack_pkt()
1700 cm_node->tcp_cntxt.loc_seq_num = ntohl(tcph->ack_seq); in handle_synack_pkt()
1701 cleanup_retrans_entry(cm_node); in handle_synack_pkt()
1702 add_ref_cm_node(cm_node); in handle_synack_pkt()
1703 send_reset(cm_node, skb); in handle_synack_pkt()
1719 static int handle_ack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb, in handle_ack_pkt() argument
1728 if (check_seq(cm_node, tcph, skb)) in handle_ack_pkt()
1734 switch (cm_node->state) { in handle_ack_pkt()
1737 cleanup_retrans_entry(cm_node); in handle_ack_pkt()
1738 ret = handle_tcp_options(cm_node, tcph, skb, optionsize, 1); in handle_ack_pkt()
1741 cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq); in handle_ack_pkt()
1742 cm_node->state = NES_CM_STATE_ESTABLISHED; in handle_ack_pkt()
1744 cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize; in handle_ack_pkt()
1745 handle_rcv_mpa(cm_node, skb); in handle_ack_pkt()
1751 cleanup_retrans_entry(cm_node); in handle_ack_pkt()
1753 cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize; in handle_ack_pkt()
1754 handle_rcv_mpa(cm_node, skb); in handle_ack_pkt()
1759 cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq); in handle_ack_pkt()
1761 cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize; in handle_ack_pkt()
1762 handle_rcv_mpa(cm_node, skb); in handle_ack_pkt()
1767 cleanup_retrans_entry(cm_node); in handle_ack_pkt()
1768 cm_node->state = NES_CM_STATE_CLOSED; in handle_ack_pkt()
1769 send_reset(cm_node, skb); in handle_ack_pkt()
1772 cleanup_retrans_entry(cm_node); in handle_ack_pkt()
1773 add_ref_cm_node(cm_node); in handle_ack_pkt()
1774 send_reset(cm_node, skb); in handle_ack_pkt()
1778 cleanup_retrans_entry(cm_node); in handle_ack_pkt()
1779 cm_node->state = NES_CM_STATE_CLOSED; in handle_ack_pkt()
1780 cm_node->cm_id->rem_ref(cm_node->cm_id); in handle_ack_pkt()
1781 rem_ref_cm_node(cm_node->cm_core, cm_node); in handle_ack_pkt()
1785 cleanup_retrans_entry(cm_node); in handle_ack_pkt()
1787 cm_node->state = NES_CM_STATE_FIN_WAIT2; in handle_ack_pkt()
1795 cleanup_retrans_entry(cm_node); in handle_ack_pkt()
1804 static int handle_tcp_options(struct nes_cm_node *cm_node, struct tcphdr *tcph, in handle_tcp_options() argument
1809 if (process_options(cm_node, optionsloc, optionsize, in handle_tcp_options()
1812 __func__, cm_node); in handle_tcp_options()
1814 passive_open_err(cm_node, skb, 1); in handle_tcp_options()
1816 active_open_err(cm_node, skb, 1); in handle_tcp_options()
1821 cm_node->tcp_cntxt.snd_wnd = ntohs(tcph->window) << in handle_tcp_options()
1822 cm_node->tcp_cntxt.snd_wscale; in handle_tcp_options()
1824 if (cm_node->tcp_cntxt.snd_wnd > cm_node->tcp_cntxt.max_snd_wnd) in handle_tcp_options()
1825 cm_node->tcp_cntxt.max_snd_wnd = cm_node->tcp_cntxt.snd_wnd; in handle_tcp_options()
1834 static void active_open_err(struct nes_cm_node *cm_node, struct sk_buff *skb, in active_open_err() argument
1837 cleanup_retrans_entry(cm_node); in active_open_err()
1840 "state=%d\n", cm_node, cm_node->state); in active_open_err()
1841 add_ref_cm_node(cm_node); in active_open_err()
1842 send_reset(cm_node, skb); in active_open_err()
1846 cm_node->state = NES_CM_STATE_CLOSED; in active_open_err()
1847 create_event(cm_node, NES_CM_EVENT_ABORTED); in active_open_err()
1855 static void passive_open_err(struct nes_cm_node *cm_node, struct sk_buff *skb, in passive_open_err() argument
1858 cleanup_retrans_entry(cm_node); in passive_open_err()
1859 cm_node->state = NES_CM_STATE_CLOSED; in passive_open_err()
1862 "cm_node=%p state =%d\n", cm_node, cm_node->state); in passive_open_err()
1863 send_reset(cm_node, skb); in passive_open_err()
1866 rem_ref_cm_node(cm_node->cm_core, cm_node); in passive_open_err()
1874 static void free_retrans_entry(struct nes_cm_node *cm_node) in free_retrans_entry() argument
1877 send_entry = cm_node->send_entry; in free_retrans_entry()
1879 cm_node->send_entry = NULL; in free_retrans_entry()
1882 rem_ref_cm_node(cm_node->cm_core, cm_node); in free_retrans_entry()
1886 static void cleanup_retrans_entry(struct nes_cm_node *cm_node) in cleanup_retrans_entry() argument
1890 spin_lock_irqsave(&cm_node->retrans_list_lock, flags); in cleanup_retrans_entry()
1891 free_retrans_entry(cm_node); in cleanup_retrans_entry()
1892 spin_unlock_irqrestore(&cm_node->retrans_list_lock, flags); in cleanup_retrans_entry()
1899 static void process_packet(struct nes_cm_node *cm_node, struct sk_buff *skb, in process_packet() argument
1909 "ack=%d rst=%d fin=%d\n", cm_node, cm_node->state, tcph->syn, in process_packet()
1925 handle_syn_pkt(cm_node, skb, tcph); in process_packet()
1928 handle_synack_pkt(cm_node, skb, tcph); in process_packet()
1931 ret = handle_ack_pkt(cm_node, skb, tcph); in process_packet()
1933 handle_fin_pkt(cm_node); in process_packet()
1936 handle_rst_pkt(cm_node, skb, tcph); in process_packet()
1939 if ((fin_set) && (!check_seq(cm_node, tcph, skb))) in process_packet()
1940 handle_fin_pkt(cm_node); in process_packet()
2022 struct nes_cm_node *cm_node; in mini_cm_connect() local
2030 cm_node = make_cm_node(cm_core, nesvnic, cm_info, NULL); in mini_cm_connect()
2031 if (!cm_node) in mini_cm_connect()
2033 mpa_frame = &cm_node->mpa_frame; in mini_cm_connect()
2040 cm_node->tcp_cntxt.client = 1; in mini_cm_connect()
2041 cm_node->tcp_cntxt.rcv_wscale = NES_CM_DEFAULT_RCV_WND_SCALE; in mini_cm_connect()
2045 ntohl(nesvnic->local_ipaddr), cm_node->rem_port, in mini_cm_connect()
2048 create_event(cm_node, NES_CM_EVENT_ABORTED); in mini_cm_connect()
2057 rem_ref_cm_node(cm_node->cm_core, cm_node); in mini_cm_connect()
2061 loopbackremotenode->loopbackpartner = cm_node; in mini_cm_connect()
2064 cm_node->loopbackpartner = loopbackremotenode; in mini_cm_connect()
2071 cm_node->state = NES_CM_STATE_TSA; in mini_cm_connect()
2072 cm_node->tcp_cntxt.rcv_nxt = in mini_cm_connect()
2075 cm_node->tcp_cntxt.loc_seq_num; in mini_cm_connect()
2076 cm_node->tcp_cntxt.max_snd_wnd = in mini_cm_connect()
2079 cm_node->tcp_cntxt.rcv_wnd; in mini_cm_connect()
2080 cm_node->tcp_cntxt.snd_wnd = in mini_cm_connect()
2083 cm_node->tcp_cntxt.rcv_wnd; in mini_cm_connect()
2084 cm_node->tcp_cntxt.snd_wscale = in mini_cm_connect()
2087 cm_node->tcp_cntxt.rcv_wscale; in mini_cm_connect()
2091 return cm_node; in mini_cm_connect()
2095 cm_node->tcp_cntxt.client = 1; in mini_cm_connect()
2099 cm_node->mpa_frame_size = mpa_frame_size; in mini_cm_connect()
2102 cm_node->state = NES_CM_STATE_SYN_SENT; in mini_cm_connect()
2103 ret = send_syn(cm_node, 0, NULL); in mini_cm_connect()
2109 cm_node->rem_addr, cm_node->rem_port, cm_node, in mini_cm_connect()
2110 cm_node->cm_id); in mini_cm_connect()
2111 rem_ref_cm_node(cm_node->cm_core, cm_node); in mini_cm_connect()
2112 cm_node = NULL; in mini_cm_connect()
2115 if (cm_node) in mini_cm_connect()
2118 cm_node->rem_addr, cm_node->rem_port, cm_node, in mini_cm_connect()
2119 cm_node->cm_id); in mini_cm_connect()
2121 return cm_node; in mini_cm_connect()
2130 struct ietf_mpa_frame *mpa_frame, struct nes_cm_node *cm_node) in mini_cm_accept() argument
2140 struct ietf_mpa_frame *mpa_frame, struct nes_cm_node *cm_node) in mini_cm_reject() argument
2146 struct iw_cm_id *cm_id = cm_node->cm_id; in mini_cm_reject()
2147 struct nes_cm_node *loopback = cm_node->loopbackpartner; in mini_cm_reject()
2150 __func__, cm_node, cm_node->tcp_cntxt.client, cm_node->state); in mini_cm_reject()
2152 if (cm_node->tcp_cntxt.client) in mini_cm_reject()
2154 cleanup_retrans_entry(cm_node); in mini_cm_reject()
2157 passive_state = atomic_add_return(1, &cm_node->passive_state); in mini_cm_reject()
2159 cm_node->state = NES_CM_STATE_CLOSED; in mini_cm_reject()
2160 rem_ref_cm_node(cm_core, cm_node); in mini_cm_reject()
2162 if (cm_node->state == NES_CM_STATE_LISTENER_DESTROYED) { in mini_cm_reject()
2163 rem_ref_cm_node(cm_core, cm_node); in mini_cm_reject()
2165 ret = send_mpa_reject(cm_node); in mini_cm_reject()
2167 cm_node->state = NES_CM_STATE_CLOSED; in mini_cm_reject()
2168 err = send_reset(cm_node, NULL); in mini_cm_reject()
2176 cm_node->cm_id = NULL; in mini_cm_reject()
2177 if (cm_node->state == NES_CM_STATE_LISTENER_DESTROYED) { in mini_cm_reject()
2178 rem_ref_cm_node(cm_core, cm_node); in mini_cm_reject()
2181 event.cm_node = loopback; in mini_cm_reject()
2188 rem_ref_cm_node(cm_core, cm_node); in mini_cm_reject()
2204 static int mini_cm_close(struct nes_cm_core *cm_core, struct nes_cm_node *cm_node) in mini_cm_close() argument
2208 if (!cm_core || !cm_node) in mini_cm_close()
2211 switch (cm_node->state) { in mini_cm_close()
2219 cleanup_retrans_entry(cm_node); in mini_cm_close()
2220 send_reset(cm_node, NULL); in mini_cm_close()
2223 cm_node->state = NES_CM_STATE_LAST_ACK; in mini_cm_close()
2224 send_fin(cm_node, NULL); in mini_cm_close()
2234 cleanup_retrans_entry(cm_node); in mini_cm_close()
2235 send_reset(cm_node, NULL); in mini_cm_close()
2242 ret = rem_ref_cm_node(cm_core, cm_node); in mini_cm_close()
2245 if (cm_node->send_entry) in mini_cm_close()
2247 "send_entry=%p\n", cm_node->send_entry); in mini_cm_close()
2248 ret = rem_ref_cm_node(cm_core, cm_node); in mini_cm_close()
2262 struct nes_cm_node *cm_node = NULL; in mini_cm_recv_pkt() local
2291 cm_node = find_node(cm_core, in mini_cm_recv_pkt()
2295 if (!cm_node) { in mini_cm_recv_pkt()
2314 cm_node = make_cm_node(cm_core, nesvnic, &nfo, in mini_cm_recv_pkt()
2316 if (!cm_node) { in mini_cm_recv_pkt()
2325 cm_node->state = NES_CM_STATE_LISTENING; in mini_cm_recv_pkt()
2328 rem_ref_cm_node(cm_core, cm_node); in mini_cm_recv_pkt()
2332 add_ref_cm_node(cm_node); in mini_cm_recv_pkt()
2333 } else if (cm_node->state == NES_CM_STATE_TSA) { in mini_cm_recv_pkt()
2334 rem_ref_cm_node(cm_core, cm_node); in mini_cm_recv_pkt()
2342 process_packet(cm_node, skb, cm_core); in mini_cm_recv_pkt()
2343 rem_ref_cm_node(cm_core, cm_node); in mini_cm_recv_pkt()
2453 static int nes_cm_init_tsa_conn(struct nes_qp *nesqp, struct nes_cm_node *cm_node) in nes_cm_init_tsa_conn() argument
2464 if (cm_node->tcp_cntxt.snd_wscale || cm_node->tcp_cntxt.rcv_wscale) in nes_cm_init_tsa_conn()
2469 nesqp->nesqp_context->mss |= cpu_to_le32(((u32)cm_node->tcp_cntxt.mss) << 16); in nes_cm_init_tsa_conn()
2475 (cm_node->tcp_cntxt.snd_wscale << NES_QPCONTEXT_PDWSCALE_SND_WSCALE_SHIFT) & in nes_cm_init_tsa_conn()
2479 (cm_node->tcp_cntxt.rcv_wscale << NES_QPCONTEXT_PDWSCALE_RCV_WSCALE_SHIFT) & in nes_cm_init_tsa_conn()
2485 nesqp->nesqp_context->snd_nxt = cpu_to_le32(cm_node->tcp_cntxt.loc_seq_num); in nes_cm_init_tsa_conn()
2486 nesqp->nesqp_context->snd_wnd = cpu_to_le32(cm_node->tcp_cntxt.snd_wnd); in nes_cm_init_tsa_conn()
2487 nesqp->nesqp_context->rcv_nxt = cpu_to_le32(cm_node->tcp_cntxt.rcv_nxt); in nes_cm_init_tsa_conn()
2488 nesqp->nesqp_context->rcv_wnd = cpu_to_le32(cm_node->tcp_cntxt.rcv_wnd << in nes_cm_init_tsa_conn()
2489 cm_node->tcp_cntxt.rcv_wscale); in nes_cm_init_tsa_conn()
2490 nesqp->nesqp_context->snd_max = cpu_to_le32(cm_node->tcp_cntxt.loc_seq_num); in nes_cm_init_tsa_conn()
2491 nesqp->nesqp_context->snd_una = cpu_to_le32(cm_node->tcp_cntxt.loc_seq_num); in nes_cm_init_tsa_conn()
2495 nesqp->nesqp_context->cwnd = cpu_to_le32(2*cm_node->tcp_cntxt.mss); in nes_cm_init_tsa_conn()
2496 nesqp->nesqp_context->snd_wl1 = cpu_to_le32(cm_node->tcp_cntxt.rcv_nxt); in nes_cm_init_tsa_conn()
2497 nesqp->nesqp_context->snd_wl2 = cpu_to_le32(cm_node->tcp_cntxt.loc_seq_num); in nes_cm_init_tsa_conn()
2498 nesqp->nesqp_context->max_snd_wnd = cpu_to_le32(cm_node->tcp_cntxt.max_snd_wnd); in nes_cm_init_tsa_conn()
2504 cm_node->tcp_cntxt.mss, le32_to_cpu(nesqp->nesqp_context->pd_index_wscale), in nes_cm_init_tsa_conn()
2512 cm_node->state = NES_CM_STATE_TSA; in nes_cm_init_tsa_conn()
2725 if (nesqp->cm_node) { in nes_disconnect()
2728 g_cm_core->api->close(g_cm_core, nesqp->cm_node); in nes_disconnect()
2745 struct nes_cm_node *cm_node; in nes_accept() local
2770 cm_node = (struct nes_cm_node *)cm_id->provider_data; in nes_accept()
2772 "%s\n", cm_node, nesvnic, nesvnic->netdev, in nes_accept()
2775 if (NES_CM_STATE_LISTENER_DESTROYED == cm_node->state) { in nes_accept()
2776 if (cm_node->loopbackpartner) in nes_accept()
2777 rem_ref_cm_node(cm_node->cm_core, cm_node->loopbackpartner); in nes_accept()
2778 rem_ref_cm_node(cm_node->cm_core, cm_node); in nes_accept()
2782 passive_state = atomic_add_return(1, &cm_node->passive_state); in nes_accept()
2784 rem_ref_cm_node(cm_node->cm_core, cm_node); in nes_accept()
2789 nesqp->cm_node = (void *)cm_node; in nes_accept()
2790 cm_node->nesqp = nesqp; in nes_accept()
2793 nesqp->hwqp.qp_id, cm_node, jiffies, cm_node->listener); in nes_accept()
2842 cm_node); in nes_accept()
2887 cm_node->cm_id = cm_id; in nes_accept()
2893 if (cm_node->state == NES_CM_STATE_TSA) in nes_accept()
2895 cm_node); in nes_accept()
2897 nes_cm_init_tsa_conn(nesqp, cm_node); in nes_accept()
2949 cm_node->cm_core->api->accelerated(cm_node->cm_core, cm_node); in nes_accept()
2978 if (cm_node->loopbackpartner) { in nes_accept()
2979 cm_node->loopbackpartner->mpa_frame_size = in nes_accept()
2982 memcpy(cm_node->loopbackpartner->mpa_frame_buf, in nes_accept()
2984 create_event(cm_node->loopbackpartner, NES_CM_EVENT_CONNECTED); in nes_accept()
2999 struct nes_cm_node *cm_node; in nes_reject() local
3005 cm_node = (struct nes_cm_node *) cm_id->provider_data; in nes_reject()
3006 loopback = cm_node->loopbackpartner; in nes_reject()
3007 cm_core = cm_node->cm_core; in nes_reject()
3008 cm_node->cm_id = cm_id; in nes_reject()
3009 cm_node->mpa_frame_size = sizeof(struct ietf_mpa_frame) + pdata_len; in nes_reject()
3011 if (cm_node->mpa_frame_size > MAX_CM_BUFFER) in nes_reject()
3014 memcpy(&cm_node->mpa_frame.key[0], IEFT_MPA_KEY_REP, IETF_MPA_KEY_SIZE); in nes_reject()
3021 memcpy(&cm_node->mpa_frame.priv_data, pdata, pdata_len); in nes_reject()
3022 cm_node->mpa_frame.priv_data_len = cpu_to_be16(pdata_len); in nes_reject()
3025 cm_node->mpa_frame.rev = mpa_version; in nes_reject()
3026 cm_node->mpa_frame.flags = IETF_MPA_FLAGS_CRC | IETF_MPA_FLAGS_REJECT; in nes_reject()
3028 return cm_core->api->reject(cm_core, &cm_node->mpa_frame, cm_node); in nes_reject()
3042 struct nes_cm_node *cm_node; in nes_connect() local
3102 cm_node = g_cm_core->api->connect(g_cm_core, nesvnic, in nes_connect()
3105 if (!cm_node) { in nes_connect()
3115 cm_node->apbvt_set = apbvt_set; in nes_connect()
3116 nesqp->cm_node = cm_node; in nes_connect()
3117 cm_node->nesqp = nesqp; in nes_connect()
3130 struct nes_cm_listener *cm_node; in nes_create_listen() local
3156 cm_node = g_cm_core->api->listen(g_cm_core, nesvnic, &cm_info); in nes_create_listen()
3157 if (!cm_node) { in nes_create_listen()
3163 cm_id->provider_data = cm_node; in nes_create_listen()
3165 if (!cm_node->reused_node) { in nes_create_listen()
3173 g_cm_core->api->stop_listener(g_cm_core, (void *)cm_node); in nes_create_listen()
3180 cm_id->provider_data = (void *)cm_node; in nes_create_listen()
3259 struct nes_cm_node *cm_node; in cm_event_connected() local
3270 cm_node = event->cm_node; in cm_event_connected()
3271 cm_id = cm_node->cm_id; in cm_event_connected()
3272 nes_debug(NES_DBG_CM, "cm_event_connected - %p - cm_id = %p\n", cm_node, cm_id); in cm_event_connected()
3290 nes_cm_init_tsa_conn(nesqp, cm_node); in cm_event_connected()
3322 if (cm_node->send_write0) { in cm_event_connected()
3374 nesqp->ietf_frame = &cm_node->mpa_frame; in cm_event_connected()
3375 nesqp->private_data_len = (u8) cm_node->mpa_frame_size; in cm_event_connected()
3376 cm_node->cm_core->api->accelerated(cm_node->cm_core, cm_node); in cm_event_connected()
3386 cm_event.private_data = (void *)event->cm_node->mpa_frame_buf; in cm_event_connected()
3387 cm_event.private_data_len = (u8) event->cm_node->mpa_frame_size; in cm_event_connected()
3417 if (!event->cm_node) in cm_event_connect_error()
3420 cm_id = event->cm_node->cm_id; in cm_event_connect_error()
3425 nes_debug(NES_DBG_CM, "cm_node=%p, cm_id=%p\n", event->cm_node, cm_id); in cm_event_connect_error()
3455 rem_ref_cm_node(event->cm_node->cm_core, event->cm_node); in cm_event_connect_error()
3471 if (!event->cm_node) in cm_event_reset()
3474 if (!event->cm_node->cm_id) in cm_event_reset()
3477 cm_id = event->cm_node->cm_id; in cm_event_reset()
3479 nes_debug(NES_DBG_CM, "%p - cm_id = %p\n", event->cm_node, cm_id); in cm_event_reset()
3504 nes_debug(NES_DBG_CM, "NODE %p Generating CLOSE\n", event->cm_node); in cm_event_reset()
3525 struct nes_cm_node *cm_node; in cm_event_mpa_req() local
3527 cm_node = event->cm_node; in cm_event_mpa_req()
3528 if (!cm_node) in cm_event_mpa_req()
3530 cm_id = cm_node->cm_id; in cm_event_mpa_req()
3534 cm_node, cm_id, jiffies); in cm_event_mpa_req()
3538 cm_event.provider_data = (void *)cm_node; in cm_event_mpa_req()
3547 cm_event.private_data = cm_node->mpa_frame_buf; in cm_event_mpa_req()
3548 cm_event.private_data_len = (u8) cm_node->mpa_frame_size; in cm_event_mpa_req()
3562 struct nes_cm_node *cm_node; in cm_event_mpa_reject() local
3565 cm_node = event->cm_node; in cm_event_mpa_reject()
3566 if (!cm_node) in cm_event_mpa_reject()
3568 cm_id = cm_node->cm_id; in cm_event_mpa_reject()
3572 cm_node, cm_id, jiffies); in cm_event_mpa_reject()
3586 cm_event.private_data = cm_node->mpa_frame_buf; in cm_event_mpa_reject()
3587 cm_event.private_data_len = (u8) cm_node->mpa_frame_size; in cm_event_mpa_reject()
3611 atomic_inc(&event->cm_node->cm_core->events_posted); in nes_cm_post_event()
3612 add_ref_cm_node(event->cm_node); in nes_cm_post_event()
3616 event->cm_node, event); in nes_cm_post_event()
3618 queue_work(event->cm_node->cm_core->event_wq, &event->event_work); in nes_cm_post_event()
3636 if ((!event) || (!event->cm_node) || (!event->cm_node->cm_core)) in nes_cm_event_handler()
3639 cm_core = event->cm_node->cm_core; in nes_cm_event_handler()
3647 event->cm_node); in nes_cm_event_handler()
3651 event->cm_node); in nes_cm_event_handler()
3655 if ((!event->cm_node->cm_id) || in nes_cm_event_handler()
3656 (event->cm_node->state != NES_CM_STATE_TSA)) in nes_cm_event_handler()
3662 if ((!event->cm_node->cm_id) || in nes_cm_event_handler()
3663 (event->cm_node->state == NES_CM_STATE_TSA)) in nes_cm_event_handler()
3670 if ((!event->cm_node->cm_id) || in nes_cm_event_handler()
3671 (event->cm_node->state == NES_CM_STATE_TSA)) in nes_cm_event_handler()
3686 rem_ref_cm_node(cm_core, event->cm_node); in nes_cm_event_handler()