Lines Matching +full:1 +full:l
11 * 1. Redistributions of source code must retain the above copyright
245 #define TIPC_UC_RETR_TIME (jiffies + msecs_to_jiffies(1))
261 static int link_is_up(struct tipc_link *l) in link_is_up() argument
263 return l->state & (LINK_ESTABLISHED | LINK_SYNCHING); in link_is_up()
266 static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,
268 static void tipc_link_build_proto_msg(struct tipc_link *l, int mtyp, bool probe,
272 static void link_print(struct tipc_link *l, const char *str);
273 static int tipc_link_build_nack_msg(struct tipc_link *l,
275 static void tipc_link_build_bc_init_msg(struct tipc_link *l,
278 struct tipc_link *l, u8 start_index);
279 static u16 tipc_build_gap_ack_blks(struct tipc_link *l, struct tipc_msg *hdr);
280 static int tipc_link_advance_transmq(struct tipc_link *l, struct tipc_link *r,
285 static void tipc_link_update_cwin(struct tipc_link *l, int released,
290 bool tipc_link_is_up(struct tipc_link *l) in tipc_link_is_up() argument
292 return link_is_up(l); in tipc_link_is_up()
295 bool tipc_link_peer_is_down(struct tipc_link *l) in tipc_link_peer_is_down() argument
297 return l->state == LINK_PEER_RESET; in tipc_link_peer_is_down()
300 bool tipc_link_is_reset(struct tipc_link *l) in tipc_link_is_reset() argument
302 return l->state & (LINK_RESET | LINK_FAILINGOVER | LINK_ESTABLISHING); in tipc_link_is_reset()
305 bool tipc_link_is_establishing(struct tipc_link *l) in tipc_link_is_establishing() argument
307 return l->state == LINK_ESTABLISHING; in tipc_link_is_establishing()
310 bool tipc_link_is_synching(struct tipc_link *l) in tipc_link_is_synching() argument
312 return l->state == LINK_SYNCHING; in tipc_link_is_synching()
315 bool tipc_link_is_failingover(struct tipc_link *l) in tipc_link_is_failingover() argument
317 return l->state == LINK_FAILINGOVER; in tipc_link_is_failingover()
320 bool tipc_link_is_blocked(struct tipc_link *l) in tipc_link_is_blocked() argument
322 return l->state & (LINK_RESETTING | LINK_PEER_RESET | LINK_FAILINGOVER); in tipc_link_is_blocked()
325 static bool link_is_bc_sndlink(struct tipc_link *l) in link_is_bc_sndlink() argument
327 return !l->bc_sndlink; in link_is_bc_sndlink()
330 static bool link_is_bc_rcvlink(struct tipc_link *l) in link_is_bc_rcvlink() argument
332 return ((l->bc_rcvlink == l) && !link_is_bc_sndlink(l)); in link_is_bc_rcvlink()
335 void tipc_link_set_active(struct tipc_link *l, bool active) in tipc_link_set_active() argument
337 l->active = active; in tipc_link_set_active()
340 u32 tipc_link_id(struct tipc_link *l) in tipc_link_id() argument
342 return l->peer_bearer_id << 16 | l->bearer_id; in tipc_link_id()
345 int tipc_link_min_win(struct tipc_link *l) in tipc_link_min_win() argument
347 return l->min_win; in tipc_link_min_win()
350 int tipc_link_max_win(struct tipc_link *l) in tipc_link_max_win() argument
352 return l->max_win; in tipc_link_max_win()
355 int tipc_link_prio(struct tipc_link *l) in tipc_link_prio() argument
357 return l->priority; in tipc_link_prio()
360 unsigned long tipc_link_tolerance(struct tipc_link *l) in tipc_link_tolerance() argument
362 return l->tolerance; in tipc_link_tolerance()
365 struct sk_buff_head *tipc_link_inputq(struct tipc_link *l) in tipc_link_inputq() argument
367 return l->inputq; in tipc_link_inputq()
370 char tipc_link_plane(struct tipc_link *l) in tipc_link_plane() argument
372 return l->net_plane; in tipc_link_plane()
375 struct net *tipc_link_net(struct tipc_link *l) in tipc_link_net() argument
377 return l->net; in tipc_link_net()
380 void tipc_link_update_caps(struct tipc_link *l, u16 capabilities) in tipc_link_update_caps() argument
382 l->peer_caps = capabilities; in tipc_link_update_caps()
392 rcv_l->acked = snd_l->snd_nxt - 1; in tipc_link_add_bc_peer()
401 u16 ack = snd_l->snd_nxt - 1; in tipc_link_remove_bc_peer()
418 int tipc_link_bc_peers(struct tipc_link *l) in tipc_link_bc_peers() argument
420 return l->ackers; in tipc_link_bc_peers()
423 static u16 link_bc_rcv_gap(struct tipc_link *l) in link_bc_rcv_gap() argument
425 struct sk_buff *skb = skb_peek(&l->deferdq); in link_bc_rcv_gap()
428 if (more(l->snd_nxt, l->rcv_nxt)) in link_bc_rcv_gap()
429 gap = l->snd_nxt - l->rcv_nxt; in link_bc_rcv_gap()
431 gap = buf_seqno(skb) - l->rcv_nxt; in link_bc_rcv_gap()
435 void tipc_link_set_mtu(struct tipc_link *l, int mtu) in tipc_link_set_mtu() argument
437 l->mtu = mtu; in tipc_link_set_mtu()
440 int tipc_link_mtu(struct tipc_link *l) in tipc_link_mtu() argument
442 return l->mtu; in tipc_link_mtu()
445 int tipc_link_mss(struct tipc_link *l) in tipc_link_mss() argument
448 return l->mtu - INT_H_SIZE - EMSG_OVERHEAD; in tipc_link_mss()
450 return l->mtu - INT_H_SIZE; in tipc_link_mss()
454 u16 tipc_link_rcv_nxt(struct tipc_link *l) in tipc_link_rcv_nxt() argument
456 return l->rcv_nxt; in tipc_link_rcv_nxt()
459 u16 tipc_link_acked(struct tipc_link *l) in tipc_link_acked() argument
461 return l->acked; in tipc_link_acked()
464 char *tipc_link_name(struct tipc_link *l) in tipc_link_name() argument
466 return l->name; in tipc_link_name()
469 u32 tipc_link_state(struct tipc_link *l) in tipc_link_state() argument
471 return l->state; in tipc_link_state()
510 struct tipc_link *l; in tipc_link_create() local
512 l = kzalloc(sizeof(*l), GFP_ATOMIC); in tipc_link_create()
513 if (!l) in tipc_link_create()
515 *link = l; in tipc_link_create()
516 l->session = session; in tipc_link_create()
528 snprintf(l->name, sizeof(l->name), "%s:%s-%s:unknown", in tipc_link_create()
531 strcpy(l->if_name, if_name); in tipc_link_create()
532 l->addr = peer; in tipc_link_create()
533 l->peer_caps = peer_caps; in tipc_link_create()
534 l->net = net; in tipc_link_create()
535 l->in_session = false; in tipc_link_create()
536 l->bearer_id = bearer_id; in tipc_link_create()
537 l->tolerance = tolerance; in tipc_link_create()
540 l->net_plane = net_plane; in tipc_link_create()
541 l->advertised_mtu = mtu; in tipc_link_create()
542 l->mtu = mtu; in tipc_link_create()
543 l->priority = priority; in tipc_link_create()
544 tipc_link_set_queue_limits(l, min_win, max_win); in tipc_link_create()
545 l->ackers = 1; in tipc_link_create()
546 l->bc_sndlink = bc_sndlink; in tipc_link_create()
547 l->bc_rcvlink = bc_rcvlink; in tipc_link_create()
548 l->inputq = inputq; in tipc_link_create()
549 l->namedq = namedq; in tipc_link_create()
550 l->state = LINK_RESETTING; in tipc_link_create()
551 __skb_queue_head_init(&l->transmq); in tipc_link_create()
552 __skb_queue_head_init(&l->backlogq); in tipc_link_create()
553 __skb_queue_head_init(&l->deferdq); in tipc_link_create()
554 __skb_queue_head_init(&l->failover_deferdq); in tipc_link_create()
555 skb_queue_head_init(&l->wakeupq); in tipc_link_create()
556 skb_queue_head_init(l->inputq); in tipc_link_create()
584 struct tipc_link *l; in tipc_link_bc_create() local
591 l = *link; in tipc_link_bc_create()
599 snprintf(l->name, sizeof(l->name), "%s:%s", tipc_bclink_name, in tipc_link_bc_create()
602 strcpy(l->name, tipc_bclink_name); in tipc_link_bc_create()
604 trace_tipc_link_reset(l, TIPC_DUMP_ALL, "bclink created!"); in tipc_link_bc_create()
605 tipc_link_reset(l); in tipc_link_bc_create()
606 l->state = LINK_RESET; in tipc_link_bc_create()
607 l->ackers = 0; in tipc_link_bc_create()
608 l->bc_rcvlink = l; in tipc_link_bc_create()
611 if (link_is_bc_sndlink(l)) in tipc_link_bc_create()
612 l->state = LINK_ESTABLISHED; in tipc_link_bc_create()
615 if (link_is_bc_rcvlink(l) && !(peer_caps & TIPC_BCAST_RCAST)) in tipc_link_bc_create()
623 * @l: pointer to link
626 int tipc_link_fsm_evt(struct tipc_link *l, int evt) in tipc_link_fsm_evt() argument
629 int old_state = l->state; in tipc_link_fsm_evt()
631 switch (l->state) { in tipc_link_fsm_evt()
635 l->state = LINK_PEER_RESET; in tipc_link_fsm_evt()
638 l->state = LINK_RESET; in tipc_link_fsm_evt()
653 l->state = LINK_ESTABLISHING; in tipc_link_fsm_evt()
656 l->state = LINK_FAILINGOVER; in tipc_link_fsm_evt()
672 l->state = LINK_ESTABLISHING; in tipc_link_fsm_evt()
689 l->state = LINK_RESET; in tipc_link_fsm_evt()
706 l->state = LINK_ESTABLISHED; in tipc_link_fsm_evt()
709 l->state = LINK_FAILINGOVER; in tipc_link_fsm_evt()
712 l->state = LINK_RESET; in tipc_link_fsm_evt()
727 l->state = LINK_PEER_RESET; in tipc_link_fsm_evt()
731 l->state = LINK_RESETTING; in tipc_link_fsm_evt()
735 l->state = LINK_RESET; in tipc_link_fsm_evt()
741 l->state = LINK_SYNCHING; in tipc_link_fsm_evt()
752 l->state = LINK_PEER_RESET; in tipc_link_fsm_evt()
756 l->state = LINK_RESETTING; in tipc_link_fsm_evt()
760 l->state = LINK_RESET; in tipc_link_fsm_evt()
766 l->state = LINK_ESTABLISHED; in tipc_link_fsm_evt()
775 pr_err("Unknown FSM state %x in %s\n", l->state, l->name); in tipc_link_fsm_evt()
777 trace_tipc_link_fsm(l->name, old_state, l->state, evt); in tipc_link_fsm_evt()
781 evt, l->state, l->name); in tipc_link_fsm_evt()
782 trace_tipc_link_fsm(l->name, old_state, l->state, evt); in tipc_link_fsm_evt()
788 static void link_profile_stats(struct tipc_link *l) in link_profile_stats() argument
795 l->stats.accu_queue_sz += skb_queue_len(&l->transmq); in link_profile_stats()
796 l->stats.queue_sz_counts++; in link_profile_stats()
798 skb = skb_peek(&l->transmq); in link_profile_stats()
809 l->stats.msg_lengths_total += length; in link_profile_stats()
810 l->stats.msg_length_counts++; in link_profile_stats()
812 l->stats.msg_length_profile[0]++; in link_profile_stats()
814 l->stats.msg_length_profile[1]++; in link_profile_stats()
816 l->stats.msg_length_profile[2]++; in link_profile_stats()
818 l->stats.msg_length_profile[3]++; in link_profile_stats()
820 l->stats.msg_length_profile[4]++; in link_profile_stats()
822 l->stats.msg_length_profile[5]++; in link_profile_stats()
824 l->stats.msg_length_profile[6]++; in link_profile_stats()
829 * @l: tipc link to be checked
834 bool tipc_link_too_silent(struct tipc_link *l) in tipc_link_too_silent() argument
836 return (l->silent_intv_cnt + 2 > l->abort_limit); in tipc_link_too_silent()
841 int tipc_link_timeout(struct tipc_link *l, struct sk_buff_head *xmitq) in tipc_link_timeout() argument
848 u16 bc_snt = l->bc_sndlink->snd_nxt - 1; in tipc_link_timeout()
849 u16 bc_acked = l->bc_rcvlink->acked; in tipc_link_timeout()
850 struct tipc_mon_state *mstate = &l->mon_state; in tipc_link_timeout()
852 trace_tipc_link_timeout(l, TIPC_DUMP_NONE, " "); in tipc_link_timeout()
853 trace_tipc_link_too_silent(l, TIPC_DUMP_ALL, " "); in tipc_link_timeout()
854 switch (l->state) { in tipc_link_timeout()
858 link_profile_stats(l); in tipc_link_timeout()
859 tipc_mon_get_state(l->net, l->addr, mstate, l->bearer_id); in tipc_link_timeout()
860 if (mstate->reset || (l->silent_intv_cnt > l->abort_limit)) in tipc_link_timeout()
861 return tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in tipc_link_timeout()
863 state |= l->bc_rcvlink->rcv_unacked; in tipc_link_timeout()
864 state |= l->rcv_unacked; in tipc_link_timeout()
865 state |= !skb_queue_empty(&l->transmq); in tipc_link_timeout()
867 probe |= l->silent_intv_cnt; in tipc_link_timeout()
869 l->silent_intv_cnt++; in tipc_link_timeout()
870 probe |= !skb_queue_empty(&l->deferdq); in tipc_link_timeout()
871 if (l->snd_nxt == l->checkpoint) { in tipc_link_timeout()
872 tipc_link_update_cwin(l, 0, 0); in tipc_link_timeout()
875 l->checkpoint = l->snd_nxt; in tipc_link_timeout()
878 setup = l->rst_cnt++ <= 4; in tipc_link_timeout()
879 setup |= !(l->rst_cnt % 16); in tipc_link_timeout()
895 tipc_link_build_proto_msg(l, mtyp, probe, 0, 0, 0, 0, xmitq); in tipc_link_timeout()
902 * @l: congested link
906 static int link_schedule_user(struct tipc_link *l, struct tipc_msg *hdr) in link_schedule_user() argument
908 u32 dnode = tipc_own_addr(l->net); in link_schedule_user()
914 dnode, l->addr, dport, 0, 0); in link_schedule_user()
919 skb_queue_tail(&l->wakeupq, skb); in link_schedule_user()
920 l->stats.link_congs++; in link_schedule_user()
921 trace_tipc_link_conges(l, TIPC_DUMP_ALL, "wakeup scheduled!"); in link_schedule_user()
927 * @l: congested link
931 static void link_prepare_wakeup(struct tipc_link *l) in link_prepare_wakeup() argument
933 struct sk_buff_head *wakeupq = &l->wakeupq; in link_prepare_wakeup()
934 struct sk_buff_head *inputq = l->inputq; in link_prepare_wakeup()
943 avail[imp] = l->backlog[imp].limit - l->backlog[imp].len; in link_prepare_wakeup()
964 * @l: link the skb will be transmitted on
967 struct tipc_link *l) in tipc_link_set_skb_retransmit_time() argument
969 if (link_is_bc_sndlink(l)) in tipc_link_set_skb_retransmit_time()
975 void tipc_link_reset(struct tipc_link *l) in tipc_link_reset() argument
982 l->in_session = false; in tipc_link_reset()
984 l->peer_session--; in tipc_link_reset()
985 l->session++; in tipc_link_reset()
986 l->mtu = l->advertised_mtu; in tipc_link_reset()
988 spin_lock_bh(&l->wakeupq.lock); in tipc_link_reset()
989 skb_queue_splice_init(&l->wakeupq, &list); in tipc_link_reset()
990 spin_unlock_bh(&l->wakeupq.lock); in tipc_link_reset()
992 spin_lock_bh(&l->inputq->lock); in tipc_link_reset()
993 skb_queue_splice_init(&list, l->inputq); in tipc_link_reset()
994 spin_unlock_bh(&l->inputq->lock); in tipc_link_reset()
996 __skb_queue_purge(&l->transmq); in tipc_link_reset()
997 __skb_queue_purge(&l->deferdq); in tipc_link_reset()
998 __skb_queue_purge(&l->backlogq); in tipc_link_reset()
999 __skb_queue_purge(&l->failover_deferdq); in tipc_link_reset()
1001 l->backlog[imp].len = 0; in tipc_link_reset()
1002 l->backlog[imp].target_bskb = NULL; in tipc_link_reset()
1004 kfree_skb(l->reasm_buf); in tipc_link_reset()
1005 kfree_skb(l->reasm_tnlmsg); in tipc_link_reset()
1006 kfree_skb(l->failover_reasm_skb); in tipc_link_reset()
1007 l->reasm_buf = NULL; in tipc_link_reset()
1008 l->reasm_tnlmsg = NULL; in tipc_link_reset()
1009 l->failover_reasm_skb = NULL; in tipc_link_reset()
1010 l->rcv_unacked = 0; in tipc_link_reset()
1011 l->snd_nxt = 1; in tipc_link_reset()
1012 l->rcv_nxt = 1; in tipc_link_reset()
1013 l->snd_nxt_state = 1; in tipc_link_reset()
1014 l->rcv_nxt_state = 1; in tipc_link_reset()
1015 l->acked = 0; in tipc_link_reset()
1016 l->last_gap = 0; in tipc_link_reset()
1017 kfree(l->last_ga); in tipc_link_reset()
1018 l->last_ga = NULL; in tipc_link_reset()
1019 l->silent_intv_cnt = 0; in tipc_link_reset()
1020 l->rst_cnt = 0; in tipc_link_reset()
1021 l->bc_peer_is_up = false; in tipc_link_reset()
1022 memset(&l->mon_state, 0, sizeof(l->mon_state)); in tipc_link_reset()
1023 tipc_link_reset_stats(l); in tipc_link_reset()
1028 * @l: link to use
1036 int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list, in tipc_link_xmit() argument
1039 struct sk_buff_head *backlogq = &l->backlogq; in tipc_link_xmit()
1040 struct sk_buff_head *transmq = &l->transmq; in tipc_link_xmit()
1042 u16 bc_ack = l->bc_rcvlink->rcv_nxt - 1; in tipc_link_xmit()
1043 u16 ack = l->rcv_nxt - 1; in tipc_link_xmit()
1044 u16 seqno = l->snd_nxt; in tipc_link_xmit()
1046 unsigned int mss = tipc_link_mss(l); in tipc_link_xmit()
1047 unsigned int cwin = l->window; in tipc_link_xmit()
1048 unsigned int mtu = l->mtu; in tipc_link_xmit()
1068 if (unlikely(l->backlog[imp].len >= l->backlog[imp].limit)) { in tipc_link_xmit()
1070 pr_warn("%s<%s>, link overflow", link_rst_msg, l->name); in tipc_link_xmit()
1073 rc = link_schedule_user(l, hdr); in tipc_link_xmit()
1076 if (pkt_cnt > 1) { in tipc_link_xmit()
1077 l->stats.sent_fragmented++; in tipc_link_xmit()
1078 l->stats.sent_fragments += pkt_cnt; in tipc_link_xmit()
1095 tipc_link_set_skb_retransmit_time(skb, l); in tipc_link_xmit()
1097 TIPC_SKB_CB(skb)->ackers = l->ackers; in tipc_link_xmit()
1098 l->rcv_unacked = 0; in tipc_link_xmit()
1099 l->stats.sent_pkts++; in tipc_link_xmit()
1103 if (tipc_msg_try_bundle(l->backlog[imp].target_bskb, &skb, in tipc_link_xmit()
1104 mss, l->addr, &new_bundle)) { in tipc_link_xmit()
1107 l->backlog[imp].target_bskb = skb; in tipc_link_xmit()
1108 l->backlog[imp].len++; in tipc_link_xmit()
1112 l->stats.sent_bundles++; in tipc_link_xmit()
1113 l->stats.sent_bundled++; in tipc_link_xmit()
1115 l->stats.sent_bundled++; in tipc_link_xmit()
1119 l->backlog[imp].target_bskb = NULL; in tipc_link_xmit()
1120 l->backlog[imp].len += (1 + skb_queue_len(list)); in tipc_link_xmit()
1124 l->snd_nxt = seqno; in tipc_link_xmit()
1128 static void tipc_link_update_cwin(struct tipc_link *l, int released, in tipc_link_update_cwin() argument
1131 int bklog_len = skb_queue_len(&l->backlogq); in tipc_link_update_cwin()
1132 struct sk_buff_head *txq = &l->transmq; in tipc_link_update_cwin()
1134 u16 cwin = l->window; in tipc_link_update_cwin()
1138 l->ssthresh = max_t(u16, l->window / 2, 300); in tipc_link_update_cwin()
1139 l->window = min_t(u16, l->ssthresh, l->window); in tipc_link_update_cwin()
1144 l->ssthresh = max_t(u16, l->window / 2, 300); in tipc_link_update_cwin()
1145 l->window = l->min_win; in tipc_link_update_cwin()
1153 if (txq_len && l->snd_nxt - buf_seqno(skb_peek(txq)) != txq_len) in tipc_link_update_cwin()
1156 l->cong_acks += released; in tipc_link_update_cwin()
1159 if (cwin <= l->ssthresh) { in tipc_link_update_cwin()
1160 l->window = min_t(u16, cwin + released, l->max_win); in tipc_link_update_cwin()
1164 if (l->cong_acks < cwin) in tipc_link_update_cwin()
1166 l->window = min_t(u16, ++cwin, l->max_win); in tipc_link_update_cwin()
1167 l->cong_acks = 0; in tipc_link_update_cwin()
1170 static void tipc_link_advance_backlog(struct tipc_link *l, in tipc_link_advance_backlog() argument
1173 u16 bc_ack = l->bc_rcvlink->rcv_nxt - 1; in tipc_link_advance_backlog()
1174 struct sk_buff_head *txq = &l->transmq; in tipc_link_advance_backlog()
1176 u16 ack = l->rcv_nxt - 1; in tipc_link_advance_backlog()
1177 u16 seqno = l->snd_nxt; in tipc_link_advance_backlog()
1179 u16 cwin = l->window; in tipc_link_advance_backlog()
1183 skb = skb_peek(&l->backlogq); in tipc_link_advance_backlog()
1189 __skb_dequeue(&l->backlogq); in tipc_link_advance_backlog()
1192 l->backlog[imp].len--; in tipc_link_advance_backlog()
1193 if (unlikely(skb == l->backlog[imp].target_bskb)) in tipc_link_advance_backlog()
1194 l->backlog[imp].target_bskb = NULL; in tipc_link_advance_backlog()
1195 __skb_queue_tail(&l->transmq, skb); in tipc_link_advance_backlog()
1196 tipc_link_set_skb_retransmit_time(skb, l); in tipc_link_advance_backlog()
1199 TIPC_SKB_CB(skb)->ackers = l->ackers; in tipc_link_advance_backlog()
1203 l->rcv_unacked = 0; in tipc_link_advance_backlog()
1204 l->stats.sent_pkts++; in tipc_link_advance_backlog()
1207 l->snd_nxt = seqno; in tipc_link_advance_backlog()
1212 * @l: tipc link sender
1213 * @r: tipc link receiver (= l in case of unicast)
1219 static bool link_retransmit_failure(struct tipc_link *l, struct tipc_link *r, in link_retransmit_failure() argument
1222 struct sk_buff *skb = skb_peek(&l->transmq); in link_retransmit_failure()
1236 if (link_is_bc_sndlink(l) && !less(r->acked, msg_seqno(hdr))) in link_retransmit_failure()
1239 pr_warn("Retransmission failure on link <%s>\n", l->name); in link_retransmit_failure()
1240 link_print(l, "State of link "); in link_retransmit_failure()
1249 trace_tipc_list_dump(&l->transmq, true, "retrans failure!"); in link_retransmit_failure()
1250 trace_tipc_link_dump(l, TIPC_DUMP_NONE, "retrans failure!"); in link_retransmit_failure()
1253 if (link_is_bc_sndlink(l)) { in link_retransmit_failure()
1257 *rc |= tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in link_retransmit_failure()
1268 static bool tipc_data_input(struct tipc_link *l, struct sk_buff *skb, in tipc_data_input() argument
1271 struct sk_buff_head *mc_inputq = l->bc_rcvlink->inputq; in tipc_data_input()
1291 l->bc_rcvlink->state = LINK_ESTABLISHED; in tipc_data_input()
1292 skb_queue_tail(l->namedq, skb); in tipc_data_input()
1303 tipc_crypto_msg_rcv(l->net, skb); in tipc_data_input()
1319 static int tipc_link_input(struct tipc_link *l, struct sk_buff *skb, in tipc_link_input() argument
1331 l->stats.recv_bundles++; in tipc_link_input()
1332 l->stats.recv_bundled += msg_msgcnt(hdr); in tipc_link_input()
1334 tipc_data_input(l, iskb, &tmpq); in tipc_link_input()
1338 l->stats.recv_fragments++; in tipc_link_input()
1340 l->stats.recv_fragmented++; in tipc_link_input()
1341 tipc_data_input(l, skb, inputq); in tipc_link_input()
1342 } else if (!*reasm_skb && !link_is_bc_rcvlink(l)) { in tipc_link_input()
1344 return tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in tipc_link_input()
1348 tipc_bcast_lock(l->net); in tipc_link_input()
1349 tipc_link_bc_init_rcv(l->bc_rcvlink, hdr); in tipc_link_input()
1350 tipc_bcast_unlock(l->net); in tipc_link_input()
1360 * @l: tunnel link
1364 static int tipc_link_tnl_rcv(struct tipc_link *l, struct sk_buff *skb, in tipc_link_tnl_rcv() argument
1367 struct sk_buff **reasm_skb = &l->failover_reasm_skb; in tipc_link_tnl_rcv()
1368 struct sk_buff **reasm_tnlmsg = &l->reasm_tnlmsg; in tipc_link_tnl_rcv()
1369 struct sk_buff_head *fdefq = &l->failover_deferdq; in tipc_link_tnl_rcv()
1391 if (msg_fragm_no(hdr) == 1) in tipc_link_tnl_rcv()
1400 if (*reasm_tnlmsg || link_is_bc_rcvlink(l)) in tipc_link_tnl_rcv()
1403 return tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in tipc_link_tnl_rcv()
1410 if (unlikely(less(seqno, l->drop_point))) { in tipc_link_tnl_rcv()
1414 if (unlikely(seqno != l->drop_point)) { in tipc_link_tnl_rcv()
1419 l->drop_point++; in tipc_link_tnl_rcv()
1420 if (!tipc_data_input(l, iskb, inputq)) in tipc_link_tnl_rcv()
1421 rc |= tipc_link_input(l, iskb, inputq, reasm_skb); in tipc_link_tnl_rcv()
1424 } while ((iskb = __tipc_skb_dequeue(fdefq, l->drop_point))); in tipc_link_tnl_rcv()
1432 * @l: the tipc link
1434 * @uc: desired Gap ACK blocks type, i.e. unicast (= 1) or broadcast (= 0)
1438 u16 tipc_get_gap_ack_blks(struct tipc_gap_ack_blks **ga, struct tipc_link *l, in tipc_get_gap_ack_blks() argument
1445 if (l->peer_caps & TIPC_GAP_ACK_BLOCK) { in tipc_get_gap_ack_blks()
1470 struct tipc_link *l, u8 start_index) in __tipc_build_gap_ack_blks() argument
1473 struct sk_buff *skb = skb_peek(&l->deferdq); in __tipc_build_gap_ack_blks()
1481 skb_queue_walk(&l->deferdq, skb) { in __tipc_build_gap_ack_blks()
1484 gacks[n].ack = htons(expect - 1); in __tipc_build_gap_ack_blks()
1488 l->name, n, in __tipc_build_gap_ack_blks()
1489 skb_queue_len(&l->deferdq)); in __tipc_build_gap_ack_blks()
1496 expect = seqno + 1; in __tipc_build_gap_ack_blks()
1507 * @l: tipc unicast link
1516 static u16 tipc_build_gap_ack_blks(struct tipc_link *l, struct tipc_msg *hdr) in tipc_build_gap_ack_blks() argument
1518 struct tipc_link *bcl = l->bc_rcvlink; in tipc_build_gap_ack_blks()
1526 msg_set_bcast_ack(hdr, bcl->rcv_nxt - 1); in tipc_build_gap_ack_blks()
1533 __tipc_build_gap_ack_blks(ga, l, ga->bgack_cnt) : 0; in tipc_build_gap_ack_blks()
1544 * @l: tipc link with transmq queue to be advanced
1545 * @r: tipc link "receiver" i.e. in case of broadcast (= "l" if unicast)
1556 static int tipc_link_advance_transmq(struct tipc_link *l, struct tipc_link *r, in tipc_link_advance_transmq() argument
1566 u32 qlen = skb_queue_len(&l->transmq); in tipc_link_advance_transmq()
1568 u16 bc_ack = l->bc_rcvlink->rcv_nxt - 1; in tipc_link_advance_transmq()
1569 u16 ack = l->rcv_nxt - 1; in tipc_link_advance_transmq()
1573 bool is_uc = !link_is_bc_sndlink(l); in tipc_link_advance_transmq()
1576 trace_tipc_link_retrans(r, acked + 1, acked + gap, &l->transmq); in tipc_link_advance_transmq()
1599 skb_queue_walk_safe(&l->transmq, skb, tmp) { in tipc_link_advance_transmq()
1613 start = end + offset + 1; in tipc_link_advance_transmq()
1634 __skb_unlink(skb, &l->transmq); in tipc_link_advance_transmq()
1638 if (unlikely(seqno == acked + 1 && in tipc_link_advance_transmq()
1639 link_retransmit_failure(l, r, rc))) { in tipc_link_advance_transmq()
1648 tipc_link_set_skb_retransmit_time(skb, l); in tipc_link_advance_transmq()
1657 l->stats.retransmitted++; in tipc_link_advance_transmq()
1684 offset = start - acked - 1; in tipc_link_advance_transmq()
1704 return qlen - skb_queue_len(&l->transmq); in tipc_link_advance_transmq()
1712 int tipc_link_build_state_msg(struct tipc_link *l, struct sk_buff_head *xmitq) in tipc_link_build_state_msg() argument
1714 if (!l) in tipc_link_build_state_msg()
1718 if (link_is_bc_rcvlink(l)) { in tipc_link_build_state_msg()
1719 if (((l->rcv_nxt ^ tipc_own_addr(l->net)) & 0xf) != 0xf) in tipc_link_build_state_msg()
1721 l->rcv_unacked = 0; in tipc_link_build_state_msg()
1724 l->snd_nxt = l->rcv_nxt; in tipc_link_build_state_msg()
1728 l->rcv_unacked = 0; in tipc_link_build_state_msg()
1729 l->stats.sent_acks++; in tipc_link_build_state_msg()
1730 tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, 0, 0, 0, xmitq); in tipc_link_build_state_msg()
1736 void tipc_link_build_reset_msg(struct tipc_link *l, struct sk_buff_head *xmitq) in tipc_link_build_reset_msg() argument
1741 if (l->state == LINK_ESTABLISHING) in tipc_link_build_reset_msg()
1744 tipc_link_build_proto_msg(l, mtyp, 0, 0, 0, 0, 0, xmitq); in tipc_link_build_reset_msg()
1748 if (skb && (l->state == LINK_RESET)) in tipc_link_build_reset_msg()
1749 msg_set_peer_stopping(buf_msg(skb), 1); in tipc_link_build_reset_msg()
1756 static int tipc_link_build_nack_msg(struct tipc_link *l, in tipc_link_build_nack_msg() argument
1759 u32 def_cnt = ++l->stats.deferred_recv; in tipc_link_build_nack_msg()
1760 struct sk_buff_head *dfq = &l->deferdq; in tipc_link_build_nack_msg()
1764 if (link_is_bc_rcvlink(l)) { in tipc_link_build_nack_msg()
1766 match2 = tipc_own_addr(l->net) & 0xf; in tipc_link_build_nack_msg()
1773 u16 rcvgap = buf_seqno(skb_peek(dfq)) - l->rcv_nxt; in tipc_link_build_nack_msg()
1775 tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, in tipc_link_build_nack_msg()
1782 * @l: the link that should handle the message
1786 int tipc_link_rcv(struct tipc_link *l, struct sk_buff *skb, in tipc_link_rcv() argument
1789 struct sk_buff_head *defq = &l->deferdq; in tipc_link_rcv()
1797 return tipc_link_proto_rcv(l, skb, xmitq); in tipc_link_rcv()
1800 l->silent_intv_cnt = 0; in tipc_link_rcv()
1805 rcv_nxt = l->rcv_nxt; in tipc_link_rcv()
1808 if (unlikely(!link_is_up(l))) { in tipc_link_rcv()
1809 if (l->state == LINK_ESTABLISHING) in tipc_link_rcv()
1817 l->stats.duplicates++; in tipc_link_rcv()
1821 released += tipc_link_advance_transmq(l, l, msg_ack(hdr), 0, in tipc_link_rcv()
1827 l->stats.duplicates++; in tipc_link_rcv()
1828 rc |= tipc_link_build_nack_msg(l, xmitq); in tipc_link_rcv()
1833 l->rcv_nxt++; in tipc_link_rcv()
1834 l->stats.recv_pkts++; in tipc_link_rcv()
1837 rc |= tipc_link_tnl_rcv(l, skb, l->inputq); in tipc_link_rcv()
1838 else if (!tipc_data_input(l, skb, l->inputq)) in tipc_link_rcv()
1839 rc |= tipc_link_input(l, skb, l->inputq, &l->reasm_buf); in tipc_link_rcv()
1840 if (unlikely(++l->rcv_unacked >= TIPC_MIN_LINK_WIN)) in tipc_link_rcv()
1841 rc |= tipc_link_build_state_msg(l, xmitq); in tipc_link_rcv()
1844 } while ((skb = __tipc_skb_dequeue(defq, l->rcv_nxt))); in tipc_link_rcv()
1848 tipc_link_update_cwin(l, released, 0); in tipc_link_rcv()
1849 tipc_link_advance_backlog(l, xmitq); in tipc_link_rcv()
1850 if (unlikely(!skb_queue_empty(&l->wakeupq))) in tipc_link_rcv()
1851 link_prepare_wakeup(l); in tipc_link_rcv()
1856 static void tipc_link_build_proto_msg(struct tipc_link *l, int mtyp, bool probe, in tipc_link_build_proto_msg() argument
1861 struct tipc_mon_state *mstate = &l->mon_state; in tipc_link_build_proto_msg()
1862 struct sk_buff_head *dfq = &l->deferdq; in tipc_link_build_proto_msg()
1863 struct tipc_link *bcl = l->bc_rcvlink; in tipc_link_build_proto_msg()
1872 if (tipc_link_is_blocked(l)) in tipc_link_build_proto_msg()
1875 if (!tipc_link_is_up(l) && (mtyp == STATE_MSG)) in tipc_link_build_proto_msg()
1879 rcvgap = buf_seqno(skb_peek(dfq)) - l->rcv_nxt; in tipc_link_build_proto_msg()
1883 l->addr, tipc_own_addr(l->net), 0, 0, 0); in tipc_link_build_proto_msg()
1889 msg_set_session(hdr, l->session); in tipc_link_build_proto_msg()
1890 msg_set_bearer_id(hdr, l->bearer_id); in tipc_link_build_proto_msg()
1891 msg_set_net_plane(hdr, l->net_plane); in tipc_link_build_proto_msg()
1892 msg_set_next_sent(hdr, l->snd_nxt); in tipc_link_build_proto_msg()
1893 msg_set_ack(hdr, l->rcv_nxt - 1); in tipc_link_build_proto_msg()
1894 msg_set_bcast_ack(hdr, bcl->rcv_nxt - 1); in tipc_link_build_proto_msg()
1896 msg_set_last_bcast(hdr, l->bc_sndlink->snd_nxt - 1); in tipc_link_build_proto_msg()
1901 msg_set_seqno(hdr, l->snd_nxt + U16_MAX / 2); in tipc_link_build_proto_msg()
1904 if (l->peer_caps & TIPC_LINK_PROTO_SEQNO) in tipc_link_build_proto_msg()
1905 msg_set_seqno(hdr, l->snd_nxt_state++); in tipc_link_build_proto_msg()
1911 if (l->peer_caps & TIPC_GAP_ACK_BLOCK) in tipc_link_build_proto_msg()
1912 glen = tipc_build_gap_ack_blks(l, hdr); in tipc_link_build_proto_msg()
1913 tipc_mon_prep(l->net, data + glen, &dlen, mstate, l->bearer_id); in tipc_link_build_proto_msg()
1916 l->stats.sent_states++; in tipc_link_build_proto_msg()
1917 l->rcv_unacked = 0; in tipc_link_build_proto_msg()
1921 msg_set_dest_session_valid(hdr, 1); in tipc_link_build_proto_msg()
1922 msg_set_dest_session(hdr, l->peer_session); in tipc_link_build_proto_msg()
1924 msg_set_max_pkt(hdr, l->advertised_mtu); in tipc_link_build_proto_msg()
1925 strcpy(data, l->if_name); in tipc_link_build_proto_msg()
1930 l->stats.sent_probes++; in tipc_link_build_proto_msg()
1932 l->stats.sent_nacks++; in tipc_link_build_proto_msg()
1937 trace_tipc_proto_build(skb, false, l->name); in tipc_link_build_proto_msg()
1940 void tipc_link_create_dummy_tnl_msg(struct tipc_link *l, in tipc_link_create_dummy_tnl_msg() argument
1943 u32 onode = tipc_own_addr(l->net); in tipc_link_create_dummy_tnl_msg()
1947 u32 dnode = l->addr; in tipc_link_create_dummy_tnl_msg()
1959 msg_set_msgcnt(hdr, 1); in tipc_link_create_dummy_tnl_msg()
1960 msg_set_bearer_id(hdr, l->peer_bearer_id); in tipc_link_create_dummy_tnl_msg()
1967 tipc_link_xmit(l, &tnlq, xmitq); in tipc_link_create_dummy_tnl_msg()
1973 void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl, in tipc_link_tnl_prepare() argument
1979 struct sk_buff_head *queue = &l->transmq; in tipc_link_tnl_prepare()
1981 u16 pktlen, pktcnt, seqno = l->snd_nxt; in tipc_link_tnl_prepare()
1997 INT_H_SIZE, 0, l->addr, in tipc_link_tnl_prepare()
1998 tipc_own_addr(l->net), in tipc_link_tnl_prepare()
2007 syncpt = l->snd_nxt + skb_queue_len(&l->backlogq) - 1; in tipc_link_tnl_prepare()
2009 msg_set_bearer_id(hdr, l->peer_bearer_id); in tipc_link_tnl_prepare()
2019 BASIC_H_SIZE, 0, l->addr, tipc_own_addr(l->net), in tipc_link_tnl_prepare()
2026 tipc_link_xmit(l, &tnlq, &tmpxq); in tipc_link_tnl_prepare()
2030 tipc_msg_init(tipc_own_addr(l->net), &tnlhdr, TUNNEL_PROTOCOL, in tipc_link_tnl_prepare()
2031 mtyp, INT_H_SIZE, l->addr); in tipc_link_tnl_prepare()
2033 pktcnt = l->snd_nxt - buf_seqno(skb_peek(&l->transmq)); in tipc_link_tnl_prepare()
2035 pktcnt = skb_queue_len(&l->transmq); in tipc_link_tnl_prepare()
2036 pktcnt += skb_queue_len(&l->backlogq); in tipc_link_tnl_prepare()
2038 msg_set_bearer_id(&tnlhdr, l->peer_bearer_id); in tipc_link_tnl_prepare()
2043 if (queue == &l->backlogq) in tipc_link_tnl_prepare()
2049 * 1) Link MTU has just changed or set differently; in tipc_link_tnl_prepare()
2065 pktcnt += skb_queue_len(&frags) - 1; in tipc_link_tnl_prepare()
2089 if (queue != &l->backlogq) { in tipc_link_tnl_prepare()
2090 queue = &l->backlogq; in tipc_link_tnl_prepare()
2103 tnl->drop_point = l->rcv_nxt; in tipc_link_tnl_prepare()
2104 tnl->failover_reasm_skb = l->reasm_buf; in tipc_link_tnl_prepare()
2105 l->reasm_buf = NULL; in tipc_link_tnl_prepare()
2113 skb_queue_splice_init(&l->deferdq, fdefq); in tipc_link_tnl_prepare()
2123 * @l: failover link
2127 void tipc_link_failover_prepare(struct tipc_link *l, struct tipc_link *tnl, in tipc_link_failover_prepare() argument
2140 tnl->drop_point = 1; in tipc_link_failover_prepare()
2154 bool tipc_link_validate_msg(struct tipc_link *l, struct tipc_msg *hdr) in tipc_link_validate_msg() argument
2156 u16 curr_session = l->peer_session; in tipc_link_validate_msg()
2165 if (!l->in_session) in tipc_link_validate_msg()
2170 if (!l->in_session) in tipc_link_validate_msg()
2176 if (!l->in_session) in tipc_link_validate_msg()
2181 if (!link_is_up(l) && msg_ack(hdr)) in tipc_link_validate_msg()
2183 if (!(l->peer_caps & TIPC_LINK_PROTO_SEQNO)) in tipc_link_validate_msg()
2186 return !less(msg_seqno(hdr), l->rcv_nxt_state); in tipc_link_validate_msg()
2197 static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb, in tipc_link_proto_rcv() argument
2209 u16 rcv_nxt = l->rcv_nxt; in tipc_link_proto_rcv()
2216 trace_tipc_proto_rcv(skb, false, l->name); in tipc_link_proto_rcv()
2221 if (tipc_link_is_blocked(l) || !xmitq) in tipc_link_proto_rcv()
2224 if (tipc_own_addr(l->net) > msg_prevnode(hdr)) in tipc_link_proto_rcv()
2225 l->net_plane = msg_net_plane(hdr); in tipc_link_proto_rcv()
2233 if (!tipc_link_validate_msg(l, hdr)) { in tipc_link_proto_rcv()
2234 trace_tipc_skb_dump(skb, false, "PROTO invalid (1)!"); in tipc_link_proto_rcv()
2235 trace_tipc_link_dump(l, TIPC_DUMP_NONE, "PROTO invalid (1)!"); in tipc_link_proto_rcv()
2243 if_name = strrchr(l->name, ':') + 1; in tipc_link_proto_rcv()
2244 if (sizeof(l->name) - (if_name - l->name) <= TIPC_MAX_IF_NAME) in tipc_link_proto_rcv()
2252 l->tolerance = peers_tol; in tipc_link_proto_rcv()
2253 l->bc_rcvlink->tolerance = peers_tol; in tipc_link_proto_rcv()
2256 if (in_range(peers_prio, l->priority + 1, TIPC_MAX_LINK_PRI)) in tipc_link_proto_rcv()
2257 l->priority = peers_prio; in tipc_link_proto_rcv()
2261 rc = tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in tipc_link_proto_rcv()
2269 l->session != msg_dest_session(hdr)) { in tipc_link_proto_rcv()
2270 if (less(l->session, msg_dest_session(hdr))) in tipc_link_proto_rcv()
2271 l->session = msg_dest_session(hdr) + 1; in tipc_link_proto_rcv()
2276 if (mtyp == RESET_MSG || !link_is_up(l)) in tipc_link_proto_rcv()
2277 rc = tipc_link_fsm_evt(l, LINK_PEER_RESET_EVT); in tipc_link_proto_rcv()
2280 if (mtyp == ACTIVATE_MSG && l->state == LINK_ESTABLISHING) in tipc_link_proto_rcv()
2283 l->peer_session = msg_session(hdr); in tipc_link_proto_rcv()
2284 l->in_session = true; in tipc_link_proto_rcv()
2285 l->peer_bearer_id = msg_bearer_id(hdr); in tipc_link_proto_rcv()
2286 if (l->mtu > msg_max_pkt(hdr)) in tipc_link_proto_rcv()
2287 l->mtu = msg_max_pkt(hdr); in tipc_link_proto_rcv()
2292 glen = tipc_get_gap_ack_blks(&ga, l, hdr, true); in tipc_link_proto_rcv()
2296 l->rcv_nxt_state = msg_seqno(hdr) + 1; in tipc_link_proto_rcv()
2300 l->tolerance = peers_tol; in tipc_link_proto_rcv()
2301 l->bc_rcvlink->tolerance = peers_tol; in tipc_link_proto_rcv()
2304 if ((peers_prio != l->priority) && in tipc_link_proto_rcv()
2305 in_range(peers_prio, 1, TIPC_MAX_LINK_PRI)) { in tipc_link_proto_rcv()
2306 l->priority = peers_prio; in tipc_link_proto_rcv()
2307 rc = tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in tipc_link_proto_rcv()
2310 l->silent_intv_cnt = 0; in tipc_link_proto_rcv()
2311 l->stats.recv_states++; in tipc_link_proto_rcv()
2313 l->stats.recv_probes++; in tipc_link_proto_rcv()
2315 if (!link_is_up(l)) { in tipc_link_proto_rcv()
2316 if (l->state == LINK_ESTABLISHING) in tipc_link_proto_rcv()
2321 tipc_mon_rcv(l->net, data + glen, dlen - glen, l->addr, in tipc_link_proto_rcv()
2322 &l->mon_state, l->bearer_id); in tipc_link_proto_rcv()
2327 !tipc_link_is_synching(l) && in tipc_link_proto_rcv()
2328 skb_queue_empty(&l->deferdq)) in tipc_link_proto_rcv()
2329 rcvgap = peers_snd_nxt - l->rcv_nxt; in tipc_link_proto_rcv()
2331 tipc_link_build_proto_msg(l, STATE_MSG, 0, reply, in tipc_link_proto_rcv()
2334 released = tipc_link_advance_transmq(l, l, ack, gap, ga, xmitq, in tipc_link_proto_rcv()
2337 l->stats.recv_nacks++; in tipc_link_proto_rcv()
2339 tipc_link_update_cwin(l, released, retransmitted); in tipc_link_proto_rcv()
2341 tipc_link_advance_backlog(l, xmitq); in tipc_link_proto_rcv()
2342 if (unlikely(!skb_queue_empty(&l->wakeupq))) in tipc_link_proto_rcv()
2343 link_prepare_wakeup(l); in tipc_link_proto_rcv()
2352 static bool tipc_link_build_bc_proto_msg(struct tipc_link *l, bool bcast, in tipc_link_build_bc_proto_msg() argument
2358 struct sk_buff *dfrd_skb = skb_peek(&l->deferdq); in tipc_link_build_bc_proto_msg()
2359 u16 ack = l->rcv_nxt - 1; in tipc_link_build_bc_proto_msg()
2360 u16 gap_to = peers_snd_nxt - 1; in tipc_link_build_bc_proto_msg()
2363 0, l->addr, tipc_own_addr(l->net), 0, 0, 0); in tipc_link_build_bc_proto_msg()
2367 msg_set_last_bcast(hdr, l->bc_sndlink->snd_nxt - 1); in tipc_link_build_bc_proto_msg()
2371 gap_to = buf_seqno(dfrd_skb) - 1; in tipc_link_build_bc_proto_msg()
2383 static void tipc_link_build_bc_init_msg(struct tipc_link *l, in tipc_link_build_bc_init_msg() argument
2389 if (!tipc_link_build_bc_proto_msg(l->bc_rcvlink, false, 0, &list)) in tipc_link_build_bc_init_msg()
2392 tipc_link_xmit(l, &list, xmitq); in tipc_link_build_bc_init_msg()
2397 void tipc_link_bc_init_rcv(struct tipc_link *l, struct tipc_msg *hdr) in tipc_link_bc_init_rcv() argument
2402 if (link_is_up(l)) in tipc_link_bc_init_rcv()
2406 l->rcv_nxt = peers_snd_nxt; in tipc_link_bc_init_rcv()
2407 l->state = LINK_ESTABLISHED; in tipc_link_bc_init_rcv()
2411 if (l->peer_caps & TIPC_BCAST_SYNCH) in tipc_link_bc_init_rcv()
2419 l->rcv_nxt = peers_snd_nxt; in tipc_link_bc_init_rcv()
2424 int tipc_link_bc_sync_rcv(struct tipc_link *l, struct tipc_msg *hdr, in tipc_link_bc_sync_rcv() argument
2430 if (!link_is_up(l)) in tipc_link_bc_sync_rcv()
2436 /* Open when peer acknowledges our bcast init msg (pkt #1) */ in tipc_link_bc_sync_rcv()
2438 l->bc_peer_is_up = true; in tipc_link_bc_sync_rcv()
2440 if (!l->bc_peer_is_up) in tipc_link_bc_sync_rcv()
2444 if (more(peers_snd_nxt, l->rcv_nxt + l->window)) in tipc_link_bc_sync_rcv()
2447 l->snd_nxt = peers_snd_nxt; in tipc_link_bc_sync_rcv()
2448 if (link_bc_rcv_gap(l)) in tipc_link_bc_sync_rcv()
2452 if (l->peer_caps & TIPC_BCAST_STATE_NACK) in tipc_link_bc_sync_rcv()
2457 if (!more(peers_snd_nxt, l->rcv_nxt)) { in tipc_link_bc_sync_rcv()
2458 l->nack_state = BC_NACK_SND_CONDITIONAL; in tipc_link_bc_sync_rcv()
2463 if (l->nack_state == BC_NACK_SND_SUPPRESS) { in tipc_link_bc_sync_rcv()
2464 l->nack_state = BC_NACK_SND_UNCONDITIONAL; in tipc_link_bc_sync_rcv()
2469 if (l->nack_state == BC_NACK_SND_CONDITIONAL) { in tipc_link_bc_sync_rcv()
2470 l->nack_state = BC_NACK_SND_UNCONDITIONAL; in tipc_link_bc_sync_rcv()
2471 if ((peers_snd_nxt - l->rcv_nxt) < TIPC_MIN_LINK_WIN) in tipc_link_bc_sync_rcv()
2476 tipc_link_build_bc_proto_msg(l, true, peers_snd_nxt, xmitq); in tipc_link_bc_sync_rcv()
2477 l->nack_state = BC_NACK_SND_SUPPRESS; in tipc_link_bc_sync_rcv()
2486 struct tipc_link *l = r->bc_sndlink; in tipc_link_bc_ack_rcv() local
2494 l->stats.recv_nacks++; in tipc_link_bc_ack_rcv()
2501 trace_tipc_link_bc_ack(r, acked, gap, &l->transmq); in tipc_link_bc_ack_rcv()
2502 tipc_link_advance_transmq(l, r, acked, gap, ga, retrq, &unused, &rc); in tipc_link_bc_ack_rcv()
2504 tipc_link_advance_backlog(l, xmitq); in tipc_link_bc_ack_rcv()
2505 if (unlikely(!skb_queue_empty(&l->wakeupq))) in tipc_link_bc_ack_rcv()
2506 link_prepare_wakeup(l); in tipc_link_bc_ack_rcv()
2515 int tipc_link_bc_nack_rcv(struct tipc_link *l, struct sk_buff *skb, in tipc_link_bc_nack_rcv() argument
2522 u16 from = acked + 1; in tipc_link_bc_nack_rcv()
2524 u16 peers_snd_nxt = to + 1; in tipc_link_bc_nack_rcv()
2529 if (!tipc_link_is_up(l) || !l->bc_peer_is_up) in tipc_link_bc_nack_rcv()
2535 if (dnode == tipc_own_addr(l->net)) { in tipc_link_bc_nack_rcv()
2536 rc = tipc_link_bc_ack_rcv(l, acked, to - acked, NULL, xmitq, in tipc_link_bc_nack_rcv()
2538 l->stats.recv_nacks++; in tipc_link_bc_nack_rcv()
2543 if (more(peers_snd_nxt, l->rcv_nxt) && !less(l->rcv_nxt, from)) in tipc_link_bc_nack_rcv()
2544 l->nack_state = BC_NACK_SND_SUPPRESS; in tipc_link_bc_nack_rcv()
2549 void tipc_link_set_queue_limits(struct tipc_link *l, u32 min_win, u32 max_win) in tipc_link_set_queue_limits() argument
2551 int max_bulk = TIPC_MAX_PUBL / (l->mtu / ITEM_SIZE); in tipc_link_set_queue_limits()
2553 l->min_win = min_win; in tipc_link_set_queue_limits()
2554 l->ssthresh = max_win; in tipc_link_set_queue_limits()
2555 l->max_win = max_win; in tipc_link_set_queue_limits()
2556 l->window = min_win; in tipc_link_set_queue_limits()
2557 l->backlog[TIPC_LOW_IMPORTANCE].limit = min_win * 2; in tipc_link_set_queue_limits()
2558 l->backlog[TIPC_MEDIUM_IMPORTANCE].limit = min_win * 4; in tipc_link_set_queue_limits()
2559 l->backlog[TIPC_HIGH_IMPORTANCE].limit = min_win * 6; in tipc_link_set_queue_limits()
2560 l->backlog[TIPC_CRITICAL_IMPORTANCE].limit = min_win * 8; in tipc_link_set_queue_limits()
2561 l->backlog[TIPC_SYSTEM_IMPORTANCE].limit = max_bulk; in tipc_link_set_queue_limits()
2566 * @l: pointer to link
2568 void tipc_link_reset_stats(struct tipc_link *l) in tipc_link_reset_stats() argument
2570 memset(&l->stats, 0, sizeof(l->stats)); in tipc_link_reset_stats()
2573 static void link_print(struct tipc_link *l, const char *str) in link_print() argument
2575 struct sk_buff *hskb = skb_peek(&l->transmq); in link_print()
2576 u16 head = hskb ? msg_seqno(buf_msg(hskb)) : l->snd_nxt - 1; in link_print()
2577 u16 tail = l->snd_nxt - 1; in link_print()
2579 pr_info("%s Link <%s> state %x\n", str, l->name, l->state); in link_print()
2581 skb_queue_len(&l->transmq), head, tail, in link_print()
2582 skb_queue_len(&l->backlogq), l->snd_nxt, l->rcv_nxt); in link_print()
2645 s->msg_length_counts : 1}, in __tipc_nl_add_stats()
2649 {TIPC_NLA_STATS_MSG_LEN_P1, s->msg_length_profile[1]}, in __tipc_nl_add_stats()
2882 void tipc_link_set_tolerance(struct tipc_link *l, u32 tol, in tipc_link_set_tolerance() argument
2885 l->tolerance = tol; in tipc_link_set_tolerance()
2886 if (l->bc_rcvlink) in tipc_link_set_tolerance()
2887 l->bc_rcvlink->tolerance = tol; in tipc_link_set_tolerance()
2888 if (link_is_up(l)) in tipc_link_set_tolerance()
2889 tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, 0, tol, 0, xmitq); in tipc_link_set_tolerance()
2892 void tipc_link_set_prio(struct tipc_link *l, u32 prio, in tipc_link_set_prio() argument
2895 l->priority = prio; in tipc_link_set_prio()
2896 tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, 0, 0, prio, xmitq); in tipc_link_set_prio()
2899 void tipc_link_set_abort_limit(struct tipc_link *l, u32 limit) in tipc_link_set_abort_limit() argument
2901 l->abort_limit = limit; in tipc_link_set_abort_limit()
2906 * @l: tipc link to be dumped
2917 int tipc_link_dump(struct tipc_link *l, u16 dqueues, char *buf) in tipc_link_dump() argument
2925 if (!l) { in tipc_link_dump()
2930 i += scnprintf(buf, sz, "link data: %x", l->addr); in tipc_link_dump()
2931 i += scnprintf(buf + i, sz - i, " %x", l->state); in tipc_link_dump()
2932 i += scnprintf(buf + i, sz - i, " %u", l->in_session); in tipc_link_dump()
2933 i += scnprintf(buf + i, sz - i, " %u", l->session); in tipc_link_dump()
2934 i += scnprintf(buf + i, sz - i, " %u", l->peer_session); in tipc_link_dump()
2935 i += scnprintf(buf + i, sz - i, " %u", l->snd_nxt); in tipc_link_dump()
2936 i += scnprintf(buf + i, sz - i, " %u", l->rcv_nxt); in tipc_link_dump()
2937 i += scnprintf(buf + i, sz - i, " %u", l->snd_nxt_state); in tipc_link_dump()
2938 i += scnprintf(buf + i, sz - i, " %u", l->rcv_nxt_state); in tipc_link_dump()
2939 i += scnprintf(buf + i, sz - i, " %x", l->peer_caps); in tipc_link_dump()
2940 i += scnprintf(buf + i, sz - i, " %u", l->silent_intv_cnt); in tipc_link_dump()
2941 i += scnprintf(buf + i, sz - i, " %u", l->rst_cnt); in tipc_link_dump()
2944 i += scnprintf(buf + i, sz - i, " %u", l->acked); in tipc_link_dump()
2946 list = &l->transmq; in tipc_link_dump()
2954 list = &l->deferdq; in tipc_link_dump()
2962 list = &l->backlogq; in tipc_link_dump()
2970 list = l->inputq; in tipc_link_dump()
2980 i += tipc_list_dump(&l->transmq, false, buf + i); in tipc_link_dump()
2985 l->backlog[TIPC_LOW_IMPORTANCE].len, in tipc_link_dump()
2986 l->backlog[TIPC_MEDIUM_IMPORTANCE].len, in tipc_link_dump()
2987 l->backlog[TIPC_HIGH_IMPORTANCE].len, in tipc_link_dump()
2988 l->backlog[TIPC_CRITICAL_IMPORTANCE].len, in tipc_link_dump()
2989 l->backlog[TIPC_SYSTEM_IMPORTANCE].len); in tipc_link_dump()
2990 i += tipc_list_dump(&l->backlogq, false, buf + i); in tipc_link_dump()
2994 i += tipc_list_dump(&l->deferdq, false, buf + i); in tipc_link_dump()
2998 i += tipc_list_dump(l->inputq, false, buf + i); in tipc_link_dump()
3002 i += tipc_list_dump(&l->wakeupq, false, buf + i); in tipc_link_dump()