Lines Matching full:l
233 static int link_is_up(struct tipc_link *l) in link_is_up() argument
235 return l->state & (LINK_ESTABLISHED | LINK_SYNCHING); in link_is_up()
238 static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,
240 static void tipc_link_build_proto_msg(struct tipc_link *l, int mtyp, bool probe,
244 static void link_print(struct tipc_link *l, const char *str);
245 static int tipc_link_build_nack_msg(struct tipc_link *l,
247 static void tipc_link_build_bc_init_msg(struct tipc_link *l,
250 struct tipc_link *l, u8 start_index);
251 static u16 tipc_build_gap_ack_blks(struct tipc_link *l, struct tipc_msg *hdr);
252 static int tipc_link_advance_transmq(struct tipc_link *l, struct tipc_link *r,
257 static void tipc_link_update_cwin(struct tipc_link *l, int released,
262 bool tipc_link_is_up(struct tipc_link *l) in tipc_link_is_up() argument
264 return link_is_up(l); in tipc_link_is_up()
267 bool tipc_link_peer_is_down(struct tipc_link *l) in tipc_link_peer_is_down() argument
269 return l->state == LINK_PEER_RESET; in tipc_link_peer_is_down()
272 bool tipc_link_is_reset(struct tipc_link *l) in tipc_link_is_reset() argument
274 return l->state & (LINK_RESET | LINK_FAILINGOVER | LINK_ESTABLISHING); in tipc_link_is_reset()
277 bool tipc_link_is_establishing(struct tipc_link *l) in tipc_link_is_establishing() argument
279 return l->state == LINK_ESTABLISHING; in tipc_link_is_establishing()
282 bool tipc_link_is_synching(struct tipc_link *l) in tipc_link_is_synching() argument
284 return l->state == LINK_SYNCHING; in tipc_link_is_synching()
287 bool tipc_link_is_failingover(struct tipc_link *l) in tipc_link_is_failingover() argument
289 return l->state == LINK_FAILINGOVER; in tipc_link_is_failingover()
292 bool tipc_link_is_blocked(struct tipc_link *l) in tipc_link_is_blocked() argument
294 return l->state & (LINK_RESETTING | LINK_PEER_RESET | LINK_FAILINGOVER); in tipc_link_is_blocked()
297 static bool link_is_bc_sndlink(struct tipc_link *l) in link_is_bc_sndlink() argument
299 return !l->bc_sndlink; in link_is_bc_sndlink()
302 static bool link_is_bc_rcvlink(struct tipc_link *l) in link_is_bc_rcvlink() argument
304 return ((l->bc_rcvlink == l) && !link_is_bc_sndlink(l)); in link_is_bc_rcvlink()
307 void tipc_link_set_active(struct tipc_link *l, bool active) in tipc_link_set_active() argument
309 l->active = active; in tipc_link_set_active()
312 u32 tipc_link_id(struct tipc_link *l) in tipc_link_id() argument
314 return l->peer_bearer_id << 16 | l->bearer_id; in tipc_link_id()
317 int tipc_link_min_win(struct tipc_link *l) in tipc_link_min_win() argument
319 return l->min_win; in tipc_link_min_win()
322 int tipc_link_max_win(struct tipc_link *l) in tipc_link_max_win() argument
324 return l->max_win; in tipc_link_max_win()
327 int tipc_link_prio(struct tipc_link *l) in tipc_link_prio() argument
329 return l->priority; in tipc_link_prio()
332 unsigned long tipc_link_tolerance(struct tipc_link *l) in tipc_link_tolerance() argument
334 return l->tolerance; in tipc_link_tolerance()
337 struct sk_buff_head *tipc_link_inputq(struct tipc_link *l) in tipc_link_inputq() argument
339 return l->inputq; in tipc_link_inputq()
342 char tipc_link_plane(struct tipc_link *l) in tipc_link_plane() argument
344 return l->net_plane; in tipc_link_plane()
347 void tipc_link_update_caps(struct tipc_link *l, u16 capabilities) in tipc_link_update_caps() argument
349 l->peer_caps = capabilities; in tipc_link_update_caps()
385 int tipc_link_bc_peers(struct tipc_link *l) in tipc_link_bc_peers() argument
387 return l->ackers; in tipc_link_bc_peers()
390 static u16 link_bc_rcv_gap(struct tipc_link *l) in link_bc_rcv_gap() argument
392 struct sk_buff *skb = skb_peek(&l->deferdq); in link_bc_rcv_gap()
395 if (more(l->snd_nxt, l->rcv_nxt)) in link_bc_rcv_gap()
396 gap = l->snd_nxt - l->rcv_nxt; in link_bc_rcv_gap()
398 gap = buf_seqno(skb) - l->rcv_nxt; in link_bc_rcv_gap()
402 void tipc_link_set_mtu(struct tipc_link *l, int mtu) in tipc_link_set_mtu() argument
404 l->mtu = mtu; in tipc_link_set_mtu()
407 int tipc_link_mtu(struct tipc_link *l) in tipc_link_mtu() argument
409 return l->mtu; in tipc_link_mtu()
412 int tipc_link_mss(struct tipc_link *l) in tipc_link_mss() argument
415 return l->mtu - INT_H_SIZE - EMSG_OVERHEAD; in tipc_link_mss()
417 return l->mtu - INT_H_SIZE; in tipc_link_mss()
421 u16 tipc_link_rcv_nxt(struct tipc_link *l) in tipc_link_rcv_nxt() argument
423 return l->rcv_nxt; in tipc_link_rcv_nxt()
426 u16 tipc_link_acked(struct tipc_link *l) in tipc_link_acked() argument
428 return l->acked; in tipc_link_acked()
431 char *tipc_link_name(struct tipc_link *l) in tipc_link_name() argument
433 return l->name; in tipc_link_name()
436 u32 tipc_link_state(struct tipc_link *l) in tipc_link_state() argument
438 return l->state; in tipc_link_state()
476 struct tipc_link *l; in tipc_link_create() local
478 l = kzalloc(sizeof(*l), GFP_ATOMIC); in tipc_link_create()
479 if (!l) in tipc_link_create()
481 *link = l; in tipc_link_create()
482 l->session = session; in tipc_link_create()
494 snprintf(l->name, sizeof(l->name), "%s:%s-%s:unknown", in tipc_link_create()
497 strcpy(l->if_name, if_name); in tipc_link_create()
498 l->addr = peer; in tipc_link_create()
499 l->peer_caps = peer_caps; in tipc_link_create()
500 l->net = net; in tipc_link_create()
501 l->in_session = false; in tipc_link_create()
502 l->bearer_id = bearer_id; in tipc_link_create()
503 l->tolerance = tolerance; in tipc_link_create()
506 l->net_plane = net_plane; in tipc_link_create()
507 l->advertised_mtu = mtu; in tipc_link_create()
508 l->mtu = mtu; in tipc_link_create()
509 l->priority = priority; in tipc_link_create()
510 tipc_link_set_queue_limits(l, min_win, max_win); in tipc_link_create()
511 l->ackers = 1; in tipc_link_create()
512 l->bc_sndlink = bc_sndlink; in tipc_link_create()
513 l->bc_rcvlink = bc_rcvlink; in tipc_link_create()
514 l->inputq = inputq; in tipc_link_create()
515 l->namedq = namedq; in tipc_link_create()
516 l->state = LINK_RESETTING; in tipc_link_create()
517 __skb_queue_head_init(&l->transmq); in tipc_link_create()
518 __skb_queue_head_init(&l->backlogq); in tipc_link_create()
519 __skb_queue_head_init(&l->deferdq); in tipc_link_create()
520 __skb_queue_head_init(&l->failover_deferdq); in tipc_link_create()
521 skb_queue_head_init(&l->wakeupq); in tipc_link_create()
522 skb_queue_head_init(l->inputq); in tipc_link_create()
545 struct tipc_link *l; in tipc_link_bc_create() local
552 l = *link; in tipc_link_bc_create()
560 snprintf(l->name, sizeof(l->name), "%s:%s", tipc_bclink_name, in tipc_link_bc_create()
563 strcpy(l->name, tipc_bclink_name); in tipc_link_bc_create()
565 trace_tipc_link_reset(l, TIPC_DUMP_ALL, "bclink created!"); in tipc_link_bc_create()
566 tipc_link_reset(l); in tipc_link_bc_create()
567 l->state = LINK_RESET; in tipc_link_bc_create()
568 l->ackers = 0; in tipc_link_bc_create()
569 l->bc_rcvlink = l; in tipc_link_bc_create()
572 if (link_is_bc_sndlink(l)) in tipc_link_bc_create()
573 l->state = LINK_ESTABLISHED; in tipc_link_bc_create()
576 if (link_is_bc_rcvlink(l) && !(peer_caps & TIPC_BCAST_RCAST)) in tipc_link_bc_create()
584 * @l: pointer to link
587 int tipc_link_fsm_evt(struct tipc_link *l, int evt) in tipc_link_fsm_evt() argument
590 int old_state = l->state; in tipc_link_fsm_evt()
592 switch (l->state) { in tipc_link_fsm_evt()
596 l->state = LINK_PEER_RESET; in tipc_link_fsm_evt()
599 l->state = LINK_RESET; in tipc_link_fsm_evt()
614 l->state = LINK_ESTABLISHING; in tipc_link_fsm_evt()
617 l->state = LINK_FAILINGOVER; in tipc_link_fsm_evt()
632 l->state = LINK_ESTABLISHING; in tipc_link_fsm_evt()
649 l->state = LINK_RESET; in tipc_link_fsm_evt()
666 l->state = LINK_ESTABLISHED; in tipc_link_fsm_evt()
669 l->state = LINK_FAILINGOVER; in tipc_link_fsm_evt()
672 l->state = LINK_RESET; in tipc_link_fsm_evt()
687 l->state = LINK_PEER_RESET; in tipc_link_fsm_evt()
691 l->state = LINK_RESETTING; in tipc_link_fsm_evt()
695 l->state = LINK_RESET; in tipc_link_fsm_evt()
701 l->state = LINK_SYNCHING; in tipc_link_fsm_evt()
712 l->state = LINK_PEER_RESET; in tipc_link_fsm_evt()
716 l->state = LINK_RESETTING; in tipc_link_fsm_evt()
720 l->state = LINK_RESET; in tipc_link_fsm_evt()
726 l->state = LINK_ESTABLISHED; in tipc_link_fsm_evt()
735 pr_err("Unknown FSM state %x in %s\n", l->state, l->name); in tipc_link_fsm_evt()
737 trace_tipc_link_fsm(l->name, old_state, l->state, evt); in tipc_link_fsm_evt()
741 evt, l->state, l->name); in tipc_link_fsm_evt()
742 trace_tipc_link_fsm(l->name, old_state, l->state, evt); in tipc_link_fsm_evt()
748 static void link_profile_stats(struct tipc_link *l) in link_profile_stats() argument
755 l->stats.accu_queue_sz += skb_queue_len(&l->transmq); in link_profile_stats()
756 l->stats.queue_sz_counts++; in link_profile_stats()
758 skb = skb_peek(&l->transmq); in link_profile_stats()
769 l->stats.msg_lengths_total += length; in link_profile_stats()
770 l->stats.msg_length_counts++; in link_profile_stats()
772 l->stats.msg_length_profile[0]++; in link_profile_stats()
774 l->stats.msg_length_profile[1]++; in link_profile_stats()
776 l->stats.msg_length_profile[2]++; in link_profile_stats()
778 l->stats.msg_length_profile[3]++; in link_profile_stats()
780 l->stats.msg_length_profile[4]++; in link_profile_stats()
782 l->stats.msg_length_profile[5]++; in link_profile_stats()
784 l->stats.msg_length_profile[6]++; in link_profile_stats()
789 * @l: tipc link to be checked
794 bool tipc_link_too_silent(struct tipc_link *l) in tipc_link_too_silent() argument
796 return (l->silent_intv_cnt + 2 > l->abort_limit); in tipc_link_too_silent()
801 int tipc_link_timeout(struct tipc_link *l, struct sk_buff_head *xmitq) in tipc_link_timeout() argument
808 u16 bc_snt = l->bc_sndlink->snd_nxt - 1; in tipc_link_timeout()
809 u16 bc_acked = l->bc_rcvlink->acked; in tipc_link_timeout()
810 struct tipc_mon_state *mstate = &l->mon_state; in tipc_link_timeout()
812 trace_tipc_link_timeout(l, TIPC_DUMP_NONE, " "); in tipc_link_timeout()
813 trace_tipc_link_too_silent(l, TIPC_DUMP_ALL, " "); in tipc_link_timeout()
814 switch (l->state) { in tipc_link_timeout()
818 link_profile_stats(l); in tipc_link_timeout()
819 tipc_mon_get_state(l->net, l->addr, mstate, l->bearer_id); in tipc_link_timeout()
820 if (mstate->reset || (l->silent_intv_cnt > l->abort_limit)) in tipc_link_timeout()
821 return tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in tipc_link_timeout()
823 state |= l->bc_rcvlink->rcv_unacked; in tipc_link_timeout()
824 state |= l->rcv_unacked; in tipc_link_timeout()
825 state |= !skb_queue_empty(&l->transmq); in tipc_link_timeout()
827 probe |= l->silent_intv_cnt; in tipc_link_timeout()
829 l->silent_intv_cnt++; in tipc_link_timeout()
830 probe |= !skb_queue_empty(&l->deferdq); in tipc_link_timeout()
831 if (l->snd_nxt == l->checkpoint) { in tipc_link_timeout()
832 tipc_link_update_cwin(l, 0, 0); in tipc_link_timeout()
835 l->checkpoint = l->snd_nxt; in tipc_link_timeout()
838 setup = l->rst_cnt++ <= 4; in tipc_link_timeout()
839 setup |= !(l->rst_cnt % 16); in tipc_link_timeout()
855 tipc_link_build_proto_msg(l, mtyp, probe, 0, 0, 0, 0, xmitq); in tipc_link_timeout()
862 * @l: congested link
866 static int link_schedule_user(struct tipc_link *l, struct tipc_msg *hdr) in link_schedule_user() argument
868 u32 dnode = tipc_own_addr(l->net); in link_schedule_user()
874 dnode, l->addr, dport, 0, 0); in link_schedule_user()
879 skb_queue_tail(&l->wakeupq, skb); in link_schedule_user()
880 l->stats.link_congs++; in link_schedule_user()
881 trace_tipc_link_conges(l, TIPC_DUMP_ALL, "wakeup scheduled!"); in link_schedule_user()
887 * @l: congested link
891 static void link_prepare_wakeup(struct tipc_link *l) in link_prepare_wakeup() argument
893 struct sk_buff_head *wakeupq = &l->wakeupq; in link_prepare_wakeup()
894 struct sk_buff_head *inputq = l->inputq; in link_prepare_wakeup()
903 avail[imp] = l->backlog[imp].limit - l->backlog[imp].len; in link_prepare_wakeup()
924 * @l: link the skb will be transmitted on
927 struct tipc_link *l) in tipc_link_set_skb_retransmit_time() argument
929 if (link_is_bc_sndlink(l)) in tipc_link_set_skb_retransmit_time()
935 void tipc_link_reset(struct tipc_link *l) in tipc_link_reset() argument
942 l->in_session = false; in tipc_link_reset()
944 l->peer_session--; in tipc_link_reset()
945 l->session++; in tipc_link_reset()
946 l->mtu = l->advertised_mtu; in tipc_link_reset()
948 spin_lock_bh(&l->wakeupq.lock); in tipc_link_reset()
949 skb_queue_splice_init(&l->wakeupq, &list); in tipc_link_reset()
950 spin_unlock_bh(&l->wakeupq.lock); in tipc_link_reset()
952 spin_lock_bh(&l->inputq->lock); in tipc_link_reset()
953 skb_queue_splice_init(&list, l->inputq); in tipc_link_reset()
954 spin_unlock_bh(&l->inputq->lock); in tipc_link_reset()
956 __skb_queue_purge(&l->transmq); in tipc_link_reset()
957 __skb_queue_purge(&l->deferdq); in tipc_link_reset()
958 __skb_queue_purge(&l->backlogq); in tipc_link_reset()
959 __skb_queue_purge(&l->failover_deferdq); in tipc_link_reset()
961 l->backlog[imp].len = 0; in tipc_link_reset()
962 l->backlog[imp].target_bskb = NULL; in tipc_link_reset()
964 kfree_skb(l->reasm_buf); in tipc_link_reset()
965 kfree_skb(l->reasm_tnlmsg); in tipc_link_reset()
966 kfree_skb(l->failover_reasm_skb); in tipc_link_reset()
967 l->reasm_buf = NULL; in tipc_link_reset()
968 l->reasm_tnlmsg = NULL; in tipc_link_reset()
969 l->failover_reasm_skb = NULL; in tipc_link_reset()
970 l->rcv_unacked = 0; in tipc_link_reset()
971 l->snd_nxt = 1; in tipc_link_reset()
972 l->rcv_nxt = 1; in tipc_link_reset()
973 l->snd_nxt_state = 1; in tipc_link_reset()
974 l->rcv_nxt_state = 1; in tipc_link_reset()
975 l->acked = 0; in tipc_link_reset()
976 l->last_gap = 0; in tipc_link_reset()
977 kfree(l->last_ga); in tipc_link_reset()
978 l->last_ga = NULL; in tipc_link_reset()
979 l->silent_intv_cnt = 0; in tipc_link_reset()
980 l->rst_cnt = 0; in tipc_link_reset()
981 l->bc_peer_is_up = false; in tipc_link_reset()
982 memset(&l->mon_state, 0, sizeof(l->mon_state)); in tipc_link_reset()
983 tipc_link_reset_stats(l); in tipc_link_reset()
988 * @l: link to use
996 int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list, in tipc_link_xmit() argument
1000 struct sk_buff_head *backlogq = &l->backlogq; in tipc_link_xmit()
1001 struct sk_buff_head *transmq = &l->transmq; in tipc_link_xmit()
1003 u16 bc_ack = l->bc_rcvlink->rcv_nxt - 1; in tipc_link_xmit()
1004 u16 ack = l->rcv_nxt - 1; in tipc_link_xmit()
1005 u16 seqno = l->snd_nxt; in tipc_link_xmit()
1008 unsigned int mss = tipc_link_mss(l); in tipc_link_xmit()
1009 unsigned int cwin = l->window; in tipc_link_xmit()
1010 unsigned int mtu = l->mtu; in tipc_link_xmit()
1023 if (unlikely(l->backlog[imp].len >= l->backlog[imp].limit)) { in tipc_link_xmit()
1025 pr_warn("%s<%s>, link overflow", link_rst_msg, l->name); in tipc_link_xmit()
1028 rc = link_schedule_user(l, hdr); in tipc_link_xmit()
1032 l->stats.sent_fragmented++; in tipc_link_xmit()
1033 l->stats.sent_fragments += pkt_cnt; in tipc_link_xmit()
1050 tipc_link_set_skb_retransmit_time(skb, l); in tipc_link_xmit()
1052 TIPC_SKB_CB(skb)->ackers = l->ackers; in tipc_link_xmit()
1053 l->rcv_unacked = 0; in tipc_link_xmit()
1054 l->stats.sent_pkts++; in tipc_link_xmit()
1058 if (tipc_msg_try_bundle(l->backlog[imp].target_bskb, &skb, in tipc_link_xmit()
1059 mss, l->addr, &new_bundle)) { in tipc_link_xmit()
1062 l->backlog[imp].target_bskb = skb; in tipc_link_xmit()
1063 l->backlog[imp].len++; in tipc_link_xmit()
1067 l->stats.sent_bundles++; in tipc_link_xmit()
1068 l->stats.sent_bundled++; in tipc_link_xmit()
1070 l->stats.sent_bundled++; in tipc_link_xmit()
1074 l->backlog[imp].target_bskb = NULL; in tipc_link_xmit()
1075 l->backlog[imp].len += (1 + skb_queue_len(list)); in tipc_link_xmit()
1079 l->snd_nxt = seqno; in tipc_link_xmit()
1083 static void tipc_link_update_cwin(struct tipc_link *l, int released, in tipc_link_update_cwin() argument
1086 int bklog_len = skb_queue_len(&l->backlogq); in tipc_link_update_cwin()
1087 struct sk_buff_head *txq = &l->transmq; in tipc_link_update_cwin()
1089 u16 cwin = l->window; in tipc_link_update_cwin()
1093 l->ssthresh = max_t(u16, l->window / 2, 300); in tipc_link_update_cwin()
1094 l->window = min_t(u16, l->ssthresh, l->window); in tipc_link_update_cwin()
1099 l->ssthresh = max_t(u16, l->window / 2, 300); in tipc_link_update_cwin()
1100 l->window = l->min_win; in tipc_link_update_cwin()
1108 if (txq_len && l->snd_nxt - buf_seqno(skb_peek(txq)) != txq_len) in tipc_link_update_cwin()
1111 l->cong_acks += released; in tipc_link_update_cwin()
1114 if (cwin <= l->ssthresh) { in tipc_link_update_cwin()
1115 l->window = min_t(u16, cwin + released, l->max_win); in tipc_link_update_cwin()
1119 if (l->cong_acks < cwin) in tipc_link_update_cwin()
1121 l->window = min_t(u16, ++cwin, l->max_win); in tipc_link_update_cwin()
1122 l->cong_acks = 0; in tipc_link_update_cwin()
1125 static void tipc_link_advance_backlog(struct tipc_link *l, in tipc_link_advance_backlog() argument
1128 u16 bc_ack = l->bc_rcvlink->rcv_nxt - 1; in tipc_link_advance_backlog()
1129 struct sk_buff_head *txq = &l->transmq; in tipc_link_advance_backlog()
1131 u16 ack = l->rcv_nxt - 1; in tipc_link_advance_backlog()
1132 u16 seqno = l->snd_nxt; in tipc_link_advance_backlog()
1134 u16 cwin = l->window; in tipc_link_advance_backlog()
1138 skb = skb_peek(&l->backlogq); in tipc_link_advance_backlog()
1144 __skb_dequeue(&l->backlogq); in tipc_link_advance_backlog()
1147 l->backlog[imp].len--; in tipc_link_advance_backlog()
1148 if (unlikely(skb == l->backlog[imp].target_bskb)) in tipc_link_advance_backlog()
1149 l->backlog[imp].target_bskb = NULL; in tipc_link_advance_backlog()
1150 __skb_queue_tail(&l->transmq, skb); in tipc_link_advance_backlog()
1151 tipc_link_set_skb_retransmit_time(skb, l); in tipc_link_advance_backlog()
1154 TIPC_SKB_CB(skb)->ackers = l->ackers; in tipc_link_advance_backlog()
1158 l->rcv_unacked = 0; in tipc_link_advance_backlog()
1159 l->stats.sent_pkts++; in tipc_link_advance_backlog()
1162 l->snd_nxt = seqno; in tipc_link_advance_backlog()
1167 * @l: tipc link sender
1168 * @r: tipc link receiver (= l in case of unicast)
1174 static bool link_retransmit_failure(struct tipc_link *l, struct tipc_link *r, in link_retransmit_failure() argument
1177 struct sk_buff *skb = skb_peek(&l->transmq); in link_retransmit_failure()
1191 if (link_is_bc_sndlink(l) && !less(r->acked, msg_seqno(hdr))) in link_retransmit_failure()
1194 pr_warn("Retransmission failure on link <%s>\n", l->name); in link_retransmit_failure()
1195 link_print(l, "State of link "); in link_retransmit_failure()
1204 trace_tipc_list_dump(&l->transmq, true, "retrans failure!"); in link_retransmit_failure()
1205 trace_tipc_link_dump(l, TIPC_DUMP_NONE, "retrans failure!"); in link_retransmit_failure()
1208 if (link_is_bc_sndlink(l)) { in link_retransmit_failure()
1212 *rc |= tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in link_retransmit_failure()
1223 static bool tipc_data_input(struct tipc_link *l, struct sk_buff *skb, in tipc_data_input() argument
1226 struct sk_buff_head *mc_inputq = l->bc_rcvlink->inputq; in tipc_data_input()
1246 l->bc_rcvlink->state = LINK_ESTABLISHED; in tipc_data_input()
1247 skb_queue_tail(l->namedq, skb); in tipc_data_input()
1256 tipc_crypto_msg_rcv(l->net, skb); in tipc_data_input()
1270 static int tipc_link_input(struct tipc_link *l, struct sk_buff *skb, in tipc_link_input() argument
1282 l->stats.recv_bundles++; in tipc_link_input()
1283 l->stats.recv_bundled += msg_msgcnt(hdr); in tipc_link_input()
1285 tipc_data_input(l, iskb, &tmpq); in tipc_link_input()
1289 l->stats.recv_fragments++; in tipc_link_input()
1291 l->stats.recv_fragmented++; in tipc_link_input()
1292 tipc_data_input(l, skb, inputq); in tipc_link_input()
1293 } else if (!*reasm_skb && !link_is_bc_rcvlink(l)) { in tipc_link_input()
1295 return tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in tipc_link_input()
1299 tipc_bcast_lock(l->net); in tipc_link_input()
1300 tipc_link_bc_init_rcv(l->bc_rcvlink, hdr); in tipc_link_input()
1301 tipc_bcast_unlock(l->net); in tipc_link_input()
1311 * @l: tunnel link
1315 static int tipc_link_tnl_rcv(struct tipc_link *l, struct sk_buff *skb, in tipc_link_tnl_rcv() argument
1318 struct sk_buff **reasm_skb = &l->failover_reasm_skb; in tipc_link_tnl_rcv()
1319 struct sk_buff **reasm_tnlmsg = &l->reasm_tnlmsg; in tipc_link_tnl_rcv()
1320 struct sk_buff_head *fdefq = &l->failover_deferdq; in tipc_link_tnl_rcv()
1351 if (*reasm_tnlmsg || link_is_bc_rcvlink(l)) in tipc_link_tnl_rcv()
1354 return tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in tipc_link_tnl_rcv()
1361 if (unlikely(less(seqno, l->drop_point))) { in tipc_link_tnl_rcv()
1365 if (unlikely(seqno != l->drop_point)) { in tipc_link_tnl_rcv()
1370 l->drop_point++; in tipc_link_tnl_rcv()
1371 if (!tipc_data_input(l, iskb, inputq)) in tipc_link_tnl_rcv()
1372 rc |= tipc_link_input(l, iskb, inputq, reasm_skb); in tipc_link_tnl_rcv()
1375 } while ((iskb = __tipc_skb_dequeue(fdefq, l->drop_point))); in tipc_link_tnl_rcv()
1383 * @l: the tipc link
1389 u16 tipc_get_gap_ack_blks(struct tipc_gap_ack_blks **ga, struct tipc_link *l, in tipc_get_gap_ack_blks() argument
1396 if (l->peer_caps & TIPC_GAP_ACK_BLOCK) { in tipc_get_gap_ack_blks()
1421 struct tipc_link *l, u8 start_index) in __tipc_build_gap_ack_blks() argument
1424 struct sk_buff *skb = skb_peek(&l->deferdq); in __tipc_build_gap_ack_blks()
1432 skb_queue_walk(&l->deferdq, skb) { in __tipc_build_gap_ack_blks()
1439 l->name, n, in __tipc_build_gap_ack_blks()
1440 skb_queue_len(&l->deferdq)); in __tipc_build_gap_ack_blks()
1458 * @l: tipc unicast link
1467 static u16 tipc_build_gap_ack_blks(struct tipc_link *l, struct tipc_msg *hdr) in tipc_build_gap_ack_blks() argument
1469 struct tipc_link *bcl = l->bc_rcvlink; in tipc_build_gap_ack_blks()
1484 __tipc_build_gap_ack_blks(ga, l, ga->bgack_cnt) : 0; in tipc_build_gap_ack_blks()
1495 * @l: tipc link with transmq queue to be advanced
1496 * @r: tipc link "receiver" i.e. in case of broadcast (= "l" if unicast)
1507 static int tipc_link_advance_transmq(struct tipc_link *l, struct tipc_link *r, in tipc_link_advance_transmq() argument
1517 u32 qlen = skb_queue_len(&l->transmq); in tipc_link_advance_transmq()
1519 u16 bc_ack = l->bc_rcvlink->rcv_nxt - 1; in tipc_link_advance_transmq()
1520 u16 ack = l->rcv_nxt - 1; in tipc_link_advance_transmq()
1524 bool is_uc = !link_is_bc_sndlink(l); in tipc_link_advance_transmq()
1527 trace_tipc_link_retrans(r, acked + 1, acked + gap, &l->transmq); in tipc_link_advance_transmq()
1550 skb_queue_walk_safe(&l->transmq, skb, tmp) { in tipc_link_advance_transmq()
1585 __skb_unlink(skb, &l->transmq); in tipc_link_advance_transmq()
1590 link_retransmit_failure(l, r, rc))) { in tipc_link_advance_transmq()
1599 tipc_link_set_skb_retransmit_time(skb, l); in tipc_link_advance_transmq()
1608 l->stats.retransmitted++; in tipc_link_advance_transmq()
1655 return qlen - skb_queue_len(&l->transmq); in tipc_link_advance_transmq()
1663 int tipc_link_build_state_msg(struct tipc_link *l, struct sk_buff_head *xmitq) in tipc_link_build_state_msg() argument
1665 if (!l) in tipc_link_build_state_msg()
1669 if (link_is_bc_rcvlink(l)) { in tipc_link_build_state_msg()
1670 if (((l->rcv_nxt ^ tipc_own_addr(l->net)) & 0xf) != 0xf) in tipc_link_build_state_msg()
1672 l->rcv_unacked = 0; in tipc_link_build_state_msg()
1675 l->snd_nxt = l->rcv_nxt; in tipc_link_build_state_msg()
1679 l->rcv_unacked = 0; in tipc_link_build_state_msg()
1680 l->stats.sent_acks++; in tipc_link_build_state_msg()
1681 tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, 0, 0, 0, xmitq); in tipc_link_build_state_msg()
1687 void tipc_link_build_reset_msg(struct tipc_link *l, struct sk_buff_head *xmitq) in tipc_link_build_reset_msg() argument
1692 if (l->state == LINK_ESTABLISHING) in tipc_link_build_reset_msg()
1695 tipc_link_build_proto_msg(l, mtyp, 0, 0, 0, 0, 0, xmitq); in tipc_link_build_reset_msg()
1699 if (skb && (l->state == LINK_RESET)) in tipc_link_build_reset_msg()
1707 static int tipc_link_build_nack_msg(struct tipc_link *l, in tipc_link_build_nack_msg() argument
1710 u32 def_cnt = ++l->stats.deferred_recv; in tipc_link_build_nack_msg()
1711 struct sk_buff_head *dfq = &l->deferdq; in tipc_link_build_nack_msg()
1715 if (link_is_bc_rcvlink(l)) { in tipc_link_build_nack_msg()
1717 match2 = tipc_own_addr(l->net) & 0xf; in tipc_link_build_nack_msg()
1724 u16 rcvgap = buf_seqno(skb_peek(dfq)) - l->rcv_nxt; in tipc_link_build_nack_msg()
1726 tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, in tipc_link_build_nack_msg()
1733 * @l: the link that should handle the message
1737 int tipc_link_rcv(struct tipc_link *l, struct sk_buff *skb, in tipc_link_rcv() argument
1740 struct sk_buff_head *defq = &l->deferdq; in tipc_link_rcv()
1748 return tipc_link_proto_rcv(l, skb, xmitq); in tipc_link_rcv()
1751 l->silent_intv_cnt = 0; in tipc_link_rcv()
1756 rcv_nxt = l->rcv_nxt; in tipc_link_rcv()
1759 if (unlikely(!link_is_up(l))) { in tipc_link_rcv()
1760 if (l->state == LINK_ESTABLISHING) in tipc_link_rcv()
1768 l->stats.duplicates++; in tipc_link_rcv()
1772 released += tipc_link_advance_transmq(l, l, msg_ack(hdr), 0, in tipc_link_rcv()
1778 l->stats.duplicates++; in tipc_link_rcv()
1779 rc |= tipc_link_build_nack_msg(l, xmitq); in tipc_link_rcv()
1784 l->rcv_nxt++; in tipc_link_rcv()
1785 l->stats.recv_pkts++; in tipc_link_rcv()
1788 rc |= tipc_link_tnl_rcv(l, skb, l->inputq); in tipc_link_rcv()
1789 else if (!tipc_data_input(l, skb, l->inputq)) in tipc_link_rcv()
1790 rc |= tipc_link_input(l, skb, l->inputq, &l->reasm_buf); in tipc_link_rcv()
1791 if (unlikely(++l->rcv_unacked >= TIPC_MIN_LINK_WIN)) in tipc_link_rcv()
1792 rc |= tipc_link_build_state_msg(l, xmitq); in tipc_link_rcv()
1795 } while ((skb = __tipc_skb_dequeue(defq, l->rcv_nxt))); in tipc_link_rcv()
1799 tipc_link_update_cwin(l, released, 0); in tipc_link_rcv()
1800 tipc_link_advance_backlog(l, xmitq); in tipc_link_rcv()
1801 if (unlikely(!skb_queue_empty(&l->wakeupq))) in tipc_link_rcv()
1802 link_prepare_wakeup(l); in tipc_link_rcv()
1807 static void tipc_link_build_proto_msg(struct tipc_link *l, int mtyp, bool probe, in tipc_link_build_proto_msg() argument
1812 struct tipc_mon_state *mstate = &l->mon_state; in tipc_link_build_proto_msg()
1813 struct sk_buff_head *dfq = &l->deferdq; in tipc_link_build_proto_msg()
1814 struct tipc_link *bcl = l->bc_rcvlink; in tipc_link_build_proto_msg()
1823 if (tipc_link_is_blocked(l)) in tipc_link_build_proto_msg()
1826 if (!tipc_link_is_up(l) && (mtyp == STATE_MSG)) in tipc_link_build_proto_msg()
1830 rcvgap = buf_seqno(skb_peek(dfq)) - l->rcv_nxt; in tipc_link_build_proto_msg()
1834 l->addr, tipc_own_addr(l->net), 0, 0, 0); in tipc_link_build_proto_msg()
1840 msg_set_session(hdr, l->session); in tipc_link_build_proto_msg()
1841 msg_set_bearer_id(hdr, l->bearer_id); in tipc_link_build_proto_msg()
1842 msg_set_net_plane(hdr, l->net_plane); in tipc_link_build_proto_msg()
1843 msg_set_next_sent(hdr, l->snd_nxt); in tipc_link_build_proto_msg()
1844 msg_set_ack(hdr, l->rcv_nxt - 1); in tipc_link_build_proto_msg()
1847 msg_set_last_bcast(hdr, l->bc_sndlink->snd_nxt - 1); in tipc_link_build_proto_msg()
1852 msg_set_seqno(hdr, l->snd_nxt + U16_MAX / 2); in tipc_link_build_proto_msg()
1855 if (l->peer_caps & TIPC_LINK_PROTO_SEQNO) in tipc_link_build_proto_msg()
1856 msg_set_seqno(hdr, l->snd_nxt_state++); in tipc_link_build_proto_msg()
1862 if (l->peer_caps & TIPC_GAP_ACK_BLOCK) in tipc_link_build_proto_msg()
1863 glen = tipc_build_gap_ack_blks(l, hdr); in tipc_link_build_proto_msg()
1864 tipc_mon_prep(l->net, data + glen, &dlen, mstate, l->bearer_id); in tipc_link_build_proto_msg()
1867 l->stats.sent_states++; in tipc_link_build_proto_msg()
1868 l->rcv_unacked = 0; in tipc_link_build_proto_msg()
1873 msg_set_dest_session(hdr, l->peer_session); in tipc_link_build_proto_msg()
1875 msg_set_max_pkt(hdr, l->advertised_mtu); in tipc_link_build_proto_msg()
1876 strcpy(data, l->if_name); in tipc_link_build_proto_msg()
1881 l->stats.sent_probes++; in tipc_link_build_proto_msg()
1883 l->stats.sent_nacks++; in tipc_link_build_proto_msg()
1888 trace_tipc_proto_build(skb, false, l->name); in tipc_link_build_proto_msg()
1891 void tipc_link_create_dummy_tnl_msg(struct tipc_link *l, in tipc_link_create_dummy_tnl_msg() argument
1894 u32 onode = tipc_own_addr(l->net); in tipc_link_create_dummy_tnl_msg()
1898 u32 dnode = l->addr; in tipc_link_create_dummy_tnl_msg()
1911 msg_set_bearer_id(hdr, l->peer_bearer_id); in tipc_link_create_dummy_tnl_msg()
1918 tipc_link_xmit(l, &tnlq, xmitq); in tipc_link_create_dummy_tnl_msg()
1924 void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl, in tipc_link_tnl_prepare() argument
1930 struct sk_buff_head *queue = &l->transmq; in tipc_link_tnl_prepare()
1932 u16 pktlen, pktcnt, seqno = l->snd_nxt; in tipc_link_tnl_prepare()
1948 INT_H_SIZE, 0, l->addr, in tipc_link_tnl_prepare()
1949 tipc_own_addr(l->net), in tipc_link_tnl_prepare()
1958 syncpt = l->snd_nxt + skb_queue_len(&l->backlogq) - 1; in tipc_link_tnl_prepare()
1960 msg_set_bearer_id(hdr, l->peer_bearer_id); in tipc_link_tnl_prepare()
1970 BASIC_H_SIZE, 0, l->addr, tipc_own_addr(l->net), in tipc_link_tnl_prepare()
1977 tipc_link_xmit(l, &tnlq, &tmpxq); in tipc_link_tnl_prepare()
1981 tipc_msg_init(tipc_own_addr(l->net), &tnlhdr, TUNNEL_PROTOCOL, in tipc_link_tnl_prepare()
1982 mtyp, INT_H_SIZE, l->addr); in tipc_link_tnl_prepare()
1984 pktcnt = l->snd_nxt - buf_seqno(skb_peek(&l->transmq)); in tipc_link_tnl_prepare()
1986 pktcnt = skb_queue_len(&l->transmq); in tipc_link_tnl_prepare()
1987 pktcnt += skb_queue_len(&l->backlogq); in tipc_link_tnl_prepare()
1989 msg_set_bearer_id(&tnlhdr, l->peer_bearer_id); in tipc_link_tnl_prepare()
1994 if (queue == &l->backlogq) in tipc_link_tnl_prepare()
2040 if (queue != &l->backlogq) { in tipc_link_tnl_prepare()
2041 queue = &l->backlogq; in tipc_link_tnl_prepare()
2054 tnl->drop_point = l->rcv_nxt; in tipc_link_tnl_prepare()
2055 tnl->failover_reasm_skb = l->reasm_buf; in tipc_link_tnl_prepare()
2056 l->reasm_buf = NULL; in tipc_link_tnl_prepare()
2064 skb_queue_splice_init(&l->deferdq, fdefq); in tipc_link_tnl_prepare()
2074 * @l: failover link
2078 void tipc_link_failover_prepare(struct tipc_link *l, struct tipc_link *tnl, in tipc_link_failover_prepare() argument
2105 bool tipc_link_validate_msg(struct tipc_link *l, struct tipc_msg *hdr) in tipc_link_validate_msg() argument
2107 u16 curr_session = l->peer_session; in tipc_link_validate_msg()
2116 if (!l->in_session) in tipc_link_validate_msg()
2121 if (!l->in_session) in tipc_link_validate_msg()
2127 if (!l->in_session) in tipc_link_validate_msg()
2132 if (!link_is_up(l) && msg_ack(hdr)) in tipc_link_validate_msg()
2134 if (!(l->peer_caps & TIPC_LINK_PROTO_SEQNO)) in tipc_link_validate_msg()
2137 return !less(msg_seqno(hdr), l->rcv_nxt_state); in tipc_link_validate_msg()
2148 static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb, in tipc_link_proto_rcv() argument
2160 u16 rcv_nxt = l->rcv_nxt; in tipc_link_proto_rcv()
2167 trace_tipc_proto_rcv(skb, false, l->name); in tipc_link_proto_rcv()
2168 if (tipc_link_is_blocked(l) || !xmitq) in tipc_link_proto_rcv()
2171 if (tipc_own_addr(l->net) > msg_prevnode(hdr)) in tipc_link_proto_rcv()
2172 l->net_plane = msg_net_plane(hdr); in tipc_link_proto_rcv()
2178 if (!tipc_link_validate_msg(l, hdr)) { in tipc_link_proto_rcv()
2180 trace_tipc_link_dump(l, TIPC_DUMP_NONE, "PROTO invalid (1)!"); in tipc_link_proto_rcv()
2188 if_name = strrchr(l->name, ':') + 1; in tipc_link_proto_rcv()
2189 if (sizeof(l->name) - (if_name - l->name) <= TIPC_MAX_IF_NAME) in tipc_link_proto_rcv()
2197 l->tolerance = peers_tol; in tipc_link_proto_rcv()
2198 l->bc_rcvlink->tolerance = peers_tol; in tipc_link_proto_rcv()
2201 if (in_range(peers_prio, l->priority + 1, TIPC_MAX_LINK_PRI)) in tipc_link_proto_rcv()
2202 l->priority = peers_prio; in tipc_link_proto_rcv()
2206 rc = tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in tipc_link_proto_rcv()
2214 l->session != msg_dest_session(hdr)) { in tipc_link_proto_rcv()
2215 if (less(l->session, msg_dest_session(hdr))) in tipc_link_proto_rcv()
2216 l->session = msg_dest_session(hdr) + 1; in tipc_link_proto_rcv()
2221 if (mtyp == RESET_MSG || !link_is_up(l)) in tipc_link_proto_rcv()
2222 rc = tipc_link_fsm_evt(l, LINK_PEER_RESET_EVT); in tipc_link_proto_rcv()
2225 if (mtyp == ACTIVATE_MSG && l->state == LINK_ESTABLISHING) in tipc_link_proto_rcv()
2228 l->peer_session = msg_session(hdr); in tipc_link_proto_rcv()
2229 l->in_session = true; in tipc_link_proto_rcv()
2230 l->peer_bearer_id = msg_bearer_id(hdr); in tipc_link_proto_rcv()
2231 if (l->mtu > msg_max_pkt(hdr)) in tipc_link_proto_rcv()
2232 l->mtu = msg_max_pkt(hdr); in tipc_link_proto_rcv()
2236 l->rcv_nxt_state = msg_seqno(hdr) + 1; in tipc_link_proto_rcv()
2240 l->tolerance = peers_tol; in tipc_link_proto_rcv()
2241 l->bc_rcvlink->tolerance = peers_tol; in tipc_link_proto_rcv()
2244 if ((peers_prio != l->priority) && in tipc_link_proto_rcv()
2246 l->priority = peers_prio; in tipc_link_proto_rcv()
2247 rc = tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in tipc_link_proto_rcv()
2250 l->silent_intv_cnt = 0; in tipc_link_proto_rcv()
2251 l->stats.recv_states++; in tipc_link_proto_rcv()
2253 l->stats.recv_probes++; in tipc_link_proto_rcv()
2255 if (!link_is_up(l)) { in tipc_link_proto_rcv()
2256 if (l->state == LINK_ESTABLISHING) in tipc_link_proto_rcv()
2262 glen = tipc_get_gap_ack_blks(&ga, l, hdr, true); in tipc_link_proto_rcv()
2264 tipc_mon_rcv(l->net, data + glen, dlen - glen, l->addr, in tipc_link_proto_rcv()
2265 &l->mon_state, l->bearer_id); in tipc_link_proto_rcv()
2270 !tipc_link_is_synching(l) && in tipc_link_proto_rcv()
2271 skb_queue_empty(&l->deferdq)) in tipc_link_proto_rcv()
2272 rcvgap = peers_snd_nxt - l->rcv_nxt; in tipc_link_proto_rcv()
2274 tipc_link_build_proto_msg(l, STATE_MSG, 0, reply, in tipc_link_proto_rcv()
2277 released = tipc_link_advance_transmq(l, l, ack, gap, ga, xmitq, in tipc_link_proto_rcv()
2280 l->stats.recv_nacks++; in tipc_link_proto_rcv()
2282 tipc_link_update_cwin(l, released, retransmitted); in tipc_link_proto_rcv()
2284 tipc_link_advance_backlog(l, xmitq); in tipc_link_proto_rcv()
2285 if (unlikely(!skb_queue_empty(&l->wakeupq))) in tipc_link_proto_rcv()
2286 link_prepare_wakeup(l); in tipc_link_proto_rcv()
2295 static bool tipc_link_build_bc_proto_msg(struct tipc_link *l, bool bcast, in tipc_link_build_bc_proto_msg() argument
2301 struct sk_buff *dfrd_skb = skb_peek(&l->deferdq); in tipc_link_build_bc_proto_msg()
2302 u16 ack = l->rcv_nxt - 1; in tipc_link_build_bc_proto_msg()
2306 0, l->addr, tipc_own_addr(l->net), 0, 0, 0); in tipc_link_build_bc_proto_msg()
2310 msg_set_last_bcast(hdr, l->bc_sndlink->snd_nxt - 1); in tipc_link_build_bc_proto_msg()
2326 static void tipc_link_build_bc_init_msg(struct tipc_link *l, in tipc_link_build_bc_init_msg() argument
2332 if (!tipc_link_build_bc_proto_msg(l->bc_rcvlink, false, 0, &list)) in tipc_link_build_bc_init_msg()
2335 tipc_link_xmit(l, &list, xmitq); in tipc_link_build_bc_init_msg()
2340 void tipc_link_bc_init_rcv(struct tipc_link *l, struct tipc_msg *hdr) in tipc_link_bc_init_rcv() argument
2345 if (link_is_up(l)) in tipc_link_bc_init_rcv()
2349 l->rcv_nxt = peers_snd_nxt; in tipc_link_bc_init_rcv()
2350 l->state = LINK_ESTABLISHED; in tipc_link_bc_init_rcv()
2354 if (l->peer_caps & TIPC_BCAST_SYNCH) in tipc_link_bc_init_rcv()
2362 l->rcv_nxt = peers_snd_nxt; in tipc_link_bc_init_rcv()
2367 int tipc_link_bc_sync_rcv(struct tipc_link *l, struct tipc_msg *hdr, in tipc_link_bc_sync_rcv() argument
2373 if (!link_is_up(l)) in tipc_link_bc_sync_rcv()
2381 l->bc_peer_is_up = true; in tipc_link_bc_sync_rcv()
2383 if (!l->bc_peer_is_up) in tipc_link_bc_sync_rcv()
2387 if (more(peers_snd_nxt, l->rcv_nxt + l->window)) in tipc_link_bc_sync_rcv()
2390 l->snd_nxt = peers_snd_nxt; in tipc_link_bc_sync_rcv()
2391 if (link_bc_rcv_gap(l)) in tipc_link_bc_sync_rcv()
2395 if (l->peer_caps & TIPC_BCAST_STATE_NACK) in tipc_link_bc_sync_rcv()
2400 if (!more(peers_snd_nxt, l->rcv_nxt)) { in tipc_link_bc_sync_rcv()
2401 l->nack_state = BC_NACK_SND_CONDITIONAL; in tipc_link_bc_sync_rcv()
2406 if (l->nack_state == BC_NACK_SND_SUPPRESS) { in tipc_link_bc_sync_rcv()
2407 l->nack_state = BC_NACK_SND_UNCONDITIONAL; in tipc_link_bc_sync_rcv()
2412 if (l->nack_state == BC_NACK_SND_CONDITIONAL) { in tipc_link_bc_sync_rcv()
2413 l->nack_state = BC_NACK_SND_UNCONDITIONAL; in tipc_link_bc_sync_rcv()
2414 if ((peers_snd_nxt - l->rcv_nxt) < TIPC_MIN_LINK_WIN) in tipc_link_bc_sync_rcv()
2419 tipc_link_build_bc_proto_msg(l, true, peers_snd_nxt, xmitq); in tipc_link_bc_sync_rcv()
2420 l->nack_state = BC_NACK_SND_SUPPRESS; in tipc_link_bc_sync_rcv()
2429 struct tipc_link *l = r->bc_sndlink; in tipc_link_bc_ack_rcv() local
2437 l->stats.recv_nacks++; in tipc_link_bc_ack_rcv()
2444 trace_tipc_link_bc_ack(r, acked, gap, &l->transmq); in tipc_link_bc_ack_rcv()
2445 tipc_link_advance_transmq(l, r, acked, gap, ga, retrq, &unused, &rc); in tipc_link_bc_ack_rcv()
2447 tipc_link_advance_backlog(l, xmitq); in tipc_link_bc_ack_rcv()
2448 if (unlikely(!skb_queue_empty(&l->wakeupq))) in tipc_link_bc_ack_rcv()
2449 link_prepare_wakeup(l); in tipc_link_bc_ack_rcv()
2458 int tipc_link_bc_nack_rcv(struct tipc_link *l, struct sk_buff *skb, in tipc_link_bc_nack_rcv() argument
2472 if (!tipc_link_is_up(l) || !l->bc_peer_is_up) in tipc_link_bc_nack_rcv()
2478 if (dnode == tipc_own_addr(l->net)) { in tipc_link_bc_nack_rcv()
2479 rc = tipc_link_bc_ack_rcv(l, acked, to - acked, NULL, xmitq, in tipc_link_bc_nack_rcv()
2481 l->stats.recv_nacks++; in tipc_link_bc_nack_rcv()
2486 if (more(peers_snd_nxt, l->rcv_nxt) && !less(l->rcv_nxt, from)) in tipc_link_bc_nack_rcv()
2487 l->nack_state = BC_NACK_SND_SUPPRESS; in tipc_link_bc_nack_rcv()
2492 void tipc_link_set_queue_limits(struct tipc_link *l, u32 min_win, u32 max_win) in tipc_link_set_queue_limits() argument
2494 int max_bulk = TIPC_MAX_PUBL / (l->mtu / ITEM_SIZE); in tipc_link_set_queue_limits()
2496 l->min_win = min_win; in tipc_link_set_queue_limits()
2497 l->ssthresh = max_win; in tipc_link_set_queue_limits()
2498 l->max_win = max_win; in tipc_link_set_queue_limits()
2499 l->window = min_win; in tipc_link_set_queue_limits()
2500 l->backlog[TIPC_LOW_IMPORTANCE].limit = min_win * 2; in tipc_link_set_queue_limits()
2501 l->backlog[TIPC_MEDIUM_IMPORTANCE].limit = min_win * 4; in tipc_link_set_queue_limits()
2502 l->backlog[TIPC_HIGH_IMPORTANCE].limit = min_win * 6; in tipc_link_set_queue_limits()
2503 l->backlog[TIPC_CRITICAL_IMPORTANCE].limit = min_win * 8; in tipc_link_set_queue_limits()
2504 l->backlog[TIPC_SYSTEM_IMPORTANCE].limit = max_bulk; in tipc_link_set_queue_limits()
2509 * @l: pointer to link
2511 void tipc_link_reset_stats(struct tipc_link *l) in tipc_link_reset_stats() argument
2513 memset(&l->stats, 0, sizeof(l->stats)); in tipc_link_reset_stats()
2516 static void link_print(struct tipc_link *l, const char *str) in link_print() argument
2518 struct sk_buff *hskb = skb_peek(&l->transmq); in link_print()
2519 u16 head = hskb ? msg_seqno(buf_msg(hskb)) : l->snd_nxt - 1; in link_print()
2520 u16 tail = l->snd_nxt - 1; in link_print()
2522 pr_info("%s Link <%s> state %x\n", str, l->name, l->state); in link_print()
2524 skb_queue_len(&l->transmq), head, tail, in link_print()
2525 skb_queue_len(&l->backlogq), l->snd_nxt, l->rcv_nxt); in link_print()
2825 void tipc_link_set_tolerance(struct tipc_link *l, u32 tol, in tipc_link_set_tolerance() argument
2828 l->tolerance = tol; in tipc_link_set_tolerance()
2829 if (l->bc_rcvlink) in tipc_link_set_tolerance()
2830 l->bc_rcvlink->tolerance = tol; in tipc_link_set_tolerance()
2831 if (link_is_up(l)) in tipc_link_set_tolerance()
2832 tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, 0, tol, 0, xmitq); in tipc_link_set_tolerance()
2835 void tipc_link_set_prio(struct tipc_link *l, u32 prio, in tipc_link_set_prio() argument
2838 l->priority = prio; in tipc_link_set_prio()
2839 tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, 0, 0, prio, xmitq); in tipc_link_set_prio()
2842 void tipc_link_set_abort_limit(struct tipc_link *l, u32 limit) in tipc_link_set_abort_limit() argument
2844 l->abort_limit = limit; in tipc_link_set_abort_limit()
2849 * @l: tipc link to be dumped
2860 int tipc_link_dump(struct tipc_link *l, u16 dqueues, char *buf) in tipc_link_dump() argument
2868 if (!l) { in tipc_link_dump()
2873 i += scnprintf(buf, sz, "link data: %x", l->addr); in tipc_link_dump()
2874 i += scnprintf(buf + i, sz - i, " %x", l->state); in tipc_link_dump()
2875 i += scnprintf(buf + i, sz - i, " %u", l->in_session); in tipc_link_dump()
2876 i += scnprintf(buf + i, sz - i, " %u", l->session); in tipc_link_dump()
2877 i += scnprintf(buf + i, sz - i, " %u", l->peer_session); in tipc_link_dump()
2878 i += scnprintf(buf + i, sz - i, " %u", l->snd_nxt); in tipc_link_dump()
2879 i += scnprintf(buf + i, sz - i, " %u", l->rcv_nxt); in tipc_link_dump()
2880 i += scnprintf(buf + i, sz - i, " %u", l->snd_nxt_state); in tipc_link_dump()
2881 i += scnprintf(buf + i, sz - i, " %u", l->rcv_nxt_state); in tipc_link_dump()
2882 i += scnprintf(buf + i, sz - i, " %x", l->peer_caps); in tipc_link_dump()
2883 i += scnprintf(buf + i, sz - i, " %u", l->silent_intv_cnt); in tipc_link_dump()
2884 i += scnprintf(buf + i, sz - i, " %u", l->rst_cnt); in tipc_link_dump()
2887 i += scnprintf(buf + i, sz - i, " %u", l->acked); in tipc_link_dump()
2889 list = &l->transmq; in tipc_link_dump()
2897 list = &l->deferdq; in tipc_link_dump()
2905 list = &l->backlogq; in tipc_link_dump()
2913 list = l->inputq; in tipc_link_dump()
2923 i += tipc_list_dump(&l->transmq, false, buf + i); in tipc_link_dump()
2928 l->backlog[TIPC_LOW_IMPORTANCE].len, in tipc_link_dump()
2929 l->backlog[TIPC_MEDIUM_IMPORTANCE].len, in tipc_link_dump()
2930 l->backlog[TIPC_HIGH_IMPORTANCE].len, in tipc_link_dump()
2931 l->backlog[TIPC_CRITICAL_IMPORTANCE].len, in tipc_link_dump()
2932 l->backlog[TIPC_SYSTEM_IMPORTANCE].len); in tipc_link_dump()
2933 i += tipc_list_dump(&l->backlogq, false, buf + i); in tipc_link_dump()
2937 i += tipc_list_dump(&l->deferdq, false, buf + i); in tipc_link_dump()
2941 i += tipc_list_dump(l->inputq, false, buf + i); in tipc_link_dump()
2945 i += tipc_list_dump(&l->wakeupq, false, buf + i); in tipc_link_dump()