Lines Matching +full:1 +full:l
11 * 1. Redistributions of source code must retain the above copyright
230 #define TIPC_UC_RETR_TIME (jiffies + msecs_to_jiffies(1))
244 static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,
246 static void tipc_link_build_proto_msg(struct tipc_link *l, int mtyp, bool probe,
250 static void link_print(struct tipc_link *l, const char *str);
251 static int tipc_link_build_nack_msg(struct tipc_link *l,
253 static void tipc_link_build_bc_init_msg(struct tipc_link *l,
256 struct tipc_link *l, u8 start_index);
257 static u16 tipc_build_gap_ack_blks(struct tipc_link *l, struct tipc_msg *hdr);
258 static int tipc_link_advance_transmq(struct tipc_link *l, struct tipc_link *r,
263 static void tipc_link_update_cwin(struct tipc_link *l, int released,
268 bool tipc_link_is_up(struct tipc_link *l) in tipc_link_is_up() argument
270 return l->state & (LINK_ESTABLISHED | LINK_SYNCHING); in tipc_link_is_up()
273 bool tipc_link_peer_is_down(struct tipc_link *l) in tipc_link_peer_is_down() argument
275 return l->state == LINK_PEER_RESET; in tipc_link_peer_is_down()
278 bool tipc_link_is_reset(struct tipc_link *l) in tipc_link_is_reset() argument
280 return l->state & (LINK_RESET | LINK_FAILINGOVER | LINK_ESTABLISHING); in tipc_link_is_reset()
283 bool tipc_link_is_establishing(struct tipc_link *l) in tipc_link_is_establishing() argument
285 return l->state == LINK_ESTABLISHING; in tipc_link_is_establishing()
288 bool tipc_link_is_synching(struct tipc_link *l) in tipc_link_is_synching() argument
290 return l->state == LINK_SYNCHING; in tipc_link_is_synching()
293 bool tipc_link_is_failingover(struct tipc_link *l) in tipc_link_is_failingover() argument
295 return l->state == LINK_FAILINGOVER; in tipc_link_is_failingover()
298 bool tipc_link_is_blocked(struct tipc_link *l) in tipc_link_is_blocked() argument
300 return l->state & (LINK_RESETTING | LINK_PEER_RESET | LINK_FAILINGOVER); in tipc_link_is_blocked()
303 static bool link_is_bc_sndlink(struct tipc_link *l) in link_is_bc_sndlink() argument
305 return !l->bc_sndlink; in link_is_bc_sndlink()
308 static bool link_is_bc_rcvlink(struct tipc_link *l) in link_is_bc_rcvlink() argument
310 return ((l->bc_rcvlink == l) && !link_is_bc_sndlink(l)); in link_is_bc_rcvlink()
313 void tipc_link_set_active(struct tipc_link *l, bool active) in tipc_link_set_active() argument
315 l->active = active; in tipc_link_set_active()
318 u32 tipc_link_id(struct tipc_link *l) in tipc_link_id() argument
320 return l->peer_bearer_id << 16 | l->bearer_id; in tipc_link_id()
323 int tipc_link_min_win(struct tipc_link *l) in tipc_link_min_win() argument
325 return l->min_win; in tipc_link_min_win()
328 int tipc_link_max_win(struct tipc_link *l) in tipc_link_max_win() argument
330 return l->max_win; in tipc_link_max_win()
333 int tipc_link_prio(struct tipc_link *l) in tipc_link_prio() argument
335 return l->priority; in tipc_link_prio()
338 unsigned long tipc_link_tolerance(struct tipc_link *l) in tipc_link_tolerance() argument
340 return l->tolerance; in tipc_link_tolerance()
343 struct sk_buff_head *tipc_link_inputq(struct tipc_link *l) in tipc_link_inputq() argument
345 return l->inputq; in tipc_link_inputq()
348 char tipc_link_plane(struct tipc_link *l) in tipc_link_plane() argument
350 return l->net_plane; in tipc_link_plane()
353 struct net *tipc_link_net(struct tipc_link *l) in tipc_link_net() argument
355 return l->net; in tipc_link_net()
358 void tipc_link_update_caps(struct tipc_link *l, u16 capabilities) in tipc_link_update_caps() argument
360 l->peer_caps = capabilities; in tipc_link_update_caps()
370 rcv_l->acked = snd_l->snd_nxt - 1; in tipc_link_add_bc_peer()
379 u16 ack = snd_l->snd_nxt - 1; in tipc_link_remove_bc_peer()
396 int tipc_link_bc_peers(struct tipc_link *l) in tipc_link_bc_peers() argument
398 return l->ackers; in tipc_link_bc_peers()
401 static u16 link_bc_rcv_gap(struct tipc_link *l) in link_bc_rcv_gap() argument
403 struct sk_buff *skb = skb_peek(&l->deferdq); in link_bc_rcv_gap()
406 if (more(l->snd_nxt, l->rcv_nxt)) in link_bc_rcv_gap()
407 gap = l->snd_nxt - l->rcv_nxt; in link_bc_rcv_gap()
409 gap = buf_seqno(skb) - l->rcv_nxt; in link_bc_rcv_gap()
413 void tipc_link_set_mtu(struct tipc_link *l, int mtu) in tipc_link_set_mtu() argument
415 l->mtu = mtu; in tipc_link_set_mtu()
418 int tipc_link_mtu(struct tipc_link *l) in tipc_link_mtu() argument
420 return l->mtu; in tipc_link_mtu()
423 int tipc_link_mss(struct tipc_link *l) in tipc_link_mss() argument
426 return l->mtu - INT_H_SIZE - EMSG_OVERHEAD; in tipc_link_mss()
428 return l->mtu - INT_H_SIZE; in tipc_link_mss()
432 u16 tipc_link_rcv_nxt(struct tipc_link *l) in tipc_link_rcv_nxt() argument
434 return l->rcv_nxt; in tipc_link_rcv_nxt()
437 u16 tipc_link_acked(struct tipc_link *l) in tipc_link_acked() argument
439 return l->acked; in tipc_link_acked()
442 char *tipc_link_name(struct tipc_link *l) in tipc_link_name() argument
444 return l->name; in tipc_link_name()
447 u32 tipc_link_state(struct tipc_link *l) in tipc_link_state() argument
449 return l->state; in tipc_link_state()
488 struct tipc_link *l; in tipc_link_create() local
490 l = kzalloc(sizeof(*l), GFP_ATOMIC); in tipc_link_create()
491 if (!l) in tipc_link_create()
493 *link = l; in tipc_link_create()
494 l->session = session; in tipc_link_create()
506 snprintf(l->name, sizeof(l->name), "%s:%s-%s:unknown", in tipc_link_create()
509 strcpy(l->if_name, if_name); in tipc_link_create()
510 l->addr = peer; in tipc_link_create()
511 l->peer_caps = peer_caps; in tipc_link_create()
512 l->net = net; in tipc_link_create()
513 l->in_session = false; in tipc_link_create()
514 l->bearer_id = bearer_id; in tipc_link_create()
515 l->tolerance = tolerance; in tipc_link_create()
518 l->net_plane = net_plane; in tipc_link_create()
519 l->advertised_mtu = mtu; in tipc_link_create()
520 l->mtu = mtu; in tipc_link_create()
521 l->priority = priority; in tipc_link_create()
522 tipc_link_set_queue_limits(l, min_win, max_win); in tipc_link_create()
523 l->ackers = 1; in tipc_link_create()
524 l->bc_sndlink = bc_sndlink; in tipc_link_create()
525 l->bc_rcvlink = bc_rcvlink; in tipc_link_create()
526 l->inputq = inputq; in tipc_link_create()
527 l->namedq = namedq; in tipc_link_create()
528 l->state = LINK_RESETTING; in tipc_link_create()
529 __skb_queue_head_init(&l->transmq); in tipc_link_create()
530 __skb_queue_head_init(&l->backlogq); in tipc_link_create()
531 __skb_queue_head_init(&l->deferdq); in tipc_link_create()
532 __skb_queue_head_init(&l->failover_deferdq); in tipc_link_create()
533 skb_queue_head_init(&l->wakeupq); in tipc_link_create()
534 skb_queue_head_init(l->inputq); in tipc_link_create()
562 struct tipc_link *l; in tipc_link_bc_create() local
569 l = *link; in tipc_link_bc_create()
577 snprintf(l->name, sizeof(l->name), "%s:%s", tipc_bclink_name, in tipc_link_bc_create()
580 strcpy(l->name, tipc_bclink_name); in tipc_link_bc_create()
582 trace_tipc_link_reset(l, TIPC_DUMP_ALL, "bclink created!"); in tipc_link_bc_create()
583 tipc_link_reset(l); in tipc_link_bc_create()
584 l->state = LINK_RESET; in tipc_link_bc_create()
585 l->ackers = 0; in tipc_link_bc_create()
586 l->bc_rcvlink = l; in tipc_link_bc_create()
589 if (link_is_bc_sndlink(l)) in tipc_link_bc_create()
590 l->state = LINK_ESTABLISHED; in tipc_link_bc_create()
593 if (link_is_bc_rcvlink(l) && !(peer_caps & TIPC_BCAST_RCAST)) in tipc_link_bc_create()
601 * @l: pointer to link
604 int tipc_link_fsm_evt(struct tipc_link *l, int evt) in tipc_link_fsm_evt() argument
607 int old_state = l->state; in tipc_link_fsm_evt()
609 switch (l->state) { in tipc_link_fsm_evt()
613 l->state = LINK_PEER_RESET; in tipc_link_fsm_evt()
616 l->state = LINK_RESET; in tipc_link_fsm_evt()
631 l->state = LINK_ESTABLISHING; in tipc_link_fsm_evt()
634 l->state = LINK_FAILINGOVER; in tipc_link_fsm_evt()
650 l->state = LINK_ESTABLISHING; in tipc_link_fsm_evt()
667 l->state = LINK_RESET; in tipc_link_fsm_evt()
684 l->state = LINK_ESTABLISHED; in tipc_link_fsm_evt()
687 l->state = LINK_FAILINGOVER; in tipc_link_fsm_evt()
690 l->state = LINK_RESET; in tipc_link_fsm_evt()
705 l->state = LINK_PEER_RESET; in tipc_link_fsm_evt()
709 l->state = LINK_RESETTING; in tipc_link_fsm_evt()
713 l->state = LINK_RESET; in tipc_link_fsm_evt()
719 l->state = LINK_SYNCHING; in tipc_link_fsm_evt()
730 l->state = LINK_PEER_RESET; in tipc_link_fsm_evt()
734 l->state = LINK_RESETTING; in tipc_link_fsm_evt()
738 l->state = LINK_RESET; in tipc_link_fsm_evt()
744 l->state = LINK_ESTABLISHED; in tipc_link_fsm_evt()
753 pr_err("Unknown FSM state %x in %s\n", l->state, l->name); in tipc_link_fsm_evt()
755 trace_tipc_link_fsm(l->name, old_state, l->state, evt); in tipc_link_fsm_evt()
759 evt, l->state, l->name); in tipc_link_fsm_evt()
760 trace_tipc_link_fsm(l->name, old_state, l->state, evt); in tipc_link_fsm_evt()
766 static void link_profile_stats(struct tipc_link *l) in link_profile_stats() argument
773 l->stats.accu_queue_sz += skb_queue_len(&l->transmq); in link_profile_stats()
774 l->stats.queue_sz_counts++; in link_profile_stats()
776 skb = skb_peek(&l->transmq); in link_profile_stats()
787 l->stats.msg_lengths_total += length; in link_profile_stats()
788 l->stats.msg_length_counts++; in link_profile_stats()
790 l->stats.msg_length_profile[0]++; in link_profile_stats()
792 l->stats.msg_length_profile[1]++; in link_profile_stats()
794 l->stats.msg_length_profile[2]++; in link_profile_stats()
796 l->stats.msg_length_profile[3]++; in link_profile_stats()
798 l->stats.msg_length_profile[4]++; in link_profile_stats()
800 l->stats.msg_length_profile[5]++; in link_profile_stats()
802 l->stats.msg_length_profile[6]++; in link_profile_stats()
807 * @l: tipc link to be checked
812 bool tipc_link_too_silent(struct tipc_link *l) in tipc_link_too_silent() argument
814 return (l->silent_intv_cnt + 2 > l->abort_limit); in tipc_link_too_silent()
819 int tipc_link_timeout(struct tipc_link *l, struct sk_buff_head *xmitq) in tipc_link_timeout() argument
826 u16 bc_snt = l->bc_sndlink->snd_nxt - 1; in tipc_link_timeout()
827 u16 bc_acked = l->bc_rcvlink->acked; in tipc_link_timeout()
828 struct tipc_mon_state *mstate = &l->mon_state; in tipc_link_timeout()
830 trace_tipc_link_timeout(l, TIPC_DUMP_NONE, " "); in tipc_link_timeout()
831 trace_tipc_link_too_silent(l, TIPC_DUMP_ALL, " "); in tipc_link_timeout()
832 switch (l->state) { in tipc_link_timeout()
836 link_profile_stats(l); in tipc_link_timeout()
837 tipc_mon_get_state(l->net, l->addr, mstate, l->bearer_id); in tipc_link_timeout()
838 if (mstate->reset || (l->silent_intv_cnt > l->abort_limit)) in tipc_link_timeout()
839 return tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in tipc_link_timeout()
841 state |= l->bc_rcvlink->rcv_unacked; in tipc_link_timeout()
842 state |= l->rcv_unacked; in tipc_link_timeout()
843 state |= !skb_queue_empty(&l->transmq); in tipc_link_timeout()
845 probe |= l->silent_intv_cnt; in tipc_link_timeout()
847 l->silent_intv_cnt++; in tipc_link_timeout()
848 probe |= !skb_queue_empty(&l->deferdq); in tipc_link_timeout()
849 if (l->snd_nxt == l->checkpoint) { in tipc_link_timeout()
850 tipc_link_update_cwin(l, 0, 0); in tipc_link_timeout()
853 l->checkpoint = l->snd_nxt; in tipc_link_timeout()
856 setup = l->rst_cnt++ <= 4; in tipc_link_timeout()
857 setup |= !(l->rst_cnt % 16); in tipc_link_timeout()
873 tipc_link_build_proto_msg(l, mtyp, probe, 0, 0, 0, 0, xmitq); in tipc_link_timeout()
880 * @l: congested link
884 static int link_schedule_user(struct tipc_link *l, struct tipc_msg *hdr) in link_schedule_user() argument
886 u32 dnode = tipc_own_addr(l->net); in link_schedule_user()
892 dnode, l->addr, dport, 0, 0); in link_schedule_user()
897 skb_queue_tail(&l->wakeupq, skb); in link_schedule_user()
898 l->stats.link_congs++; in link_schedule_user()
899 trace_tipc_link_conges(l, TIPC_DUMP_ALL, "wakeup scheduled!"); in link_schedule_user()
905 * @l: congested link
909 static void link_prepare_wakeup(struct tipc_link *l) in link_prepare_wakeup() argument
911 struct sk_buff_head *wakeupq = &l->wakeupq; in link_prepare_wakeup()
912 struct sk_buff_head *inputq = l->inputq; in link_prepare_wakeup()
921 avail[imp] = l->backlog[imp].limit - l->backlog[imp].len; in link_prepare_wakeup()
942 * @l: link the skb will be transmitted on
945 struct tipc_link *l) in tipc_link_set_skb_retransmit_time() argument
947 if (link_is_bc_sndlink(l)) in tipc_link_set_skb_retransmit_time()
953 void tipc_link_reset(struct tipc_link *l) in tipc_link_reset() argument
960 l->in_session = false; in tipc_link_reset()
962 l->peer_session--; in tipc_link_reset()
963 l->session++; in tipc_link_reset()
964 l->mtu = l->advertised_mtu; in tipc_link_reset()
966 spin_lock_bh(&l->wakeupq.lock); in tipc_link_reset()
967 skb_queue_splice_init(&l->wakeupq, &list); in tipc_link_reset()
968 spin_unlock_bh(&l->wakeupq.lock); in tipc_link_reset()
970 spin_lock_bh(&l->inputq->lock); in tipc_link_reset()
971 skb_queue_splice_init(&list, l->inputq); in tipc_link_reset()
972 spin_unlock_bh(&l->inputq->lock); in tipc_link_reset()
974 __skb_queue_purge(&l->transmq); in tipc_link_reset()
975 __skb_queue_purge(&l->deferdq); in tipc_link_reset()
976 __skb_queue_purge(&l->backlogq); in tipc_link_reset()
977 __skb_queue_purge(&l->failover_deferdq); in tipc_link_reset()
979 l->backlog[imp].len = 0; in tipc_link_reset()
980 l->backlog[imp].target_bskb = NULL; in tipc_link_reset()
982 kfree_skb(l->reasm_buf); in tipc_link_reset()
983 kfree_skb(l->reasm_tnlmsg); in tipc_link_reset()
984 kfree_skb(l->failover_reasm_skb); in tipc_link_reset()
985 l->reasm_buf = NULL; in tipc_link_reset()
986 l->reasm_tnlmsg = NULL; in tipc_link_reset()
987 l->failover_reasm_skb = NULL; in tipc_link_reset()
988 l->rcv_unacked = 0; in tipc_link_reset()
989 l->snd_nxt = 1; in tipc_link_reset()
990 l->rcv_nxt = 1; in tipc_link_reset()
991 l->snd_nxt_state = 1; in tipc_link_reset()
992 l->rcv_nxt_state = 1; in tipc_link_reset()
993 l->acked = 0; in tipc_link_reset()
994 l->last_gap = 0; in tipc_link_reset()
995 kfree(l->last_ga); in tipc_link_reset()
996 l->last_ga = NULL; in tipc_link_reset()
997 l->silent_intv_cnt = 0; in tipc_link_reset()
998 l->rst_cnt = 0; in tipc_link_reset()
999 l->bc_peer_is_up = false; in tipc_link_reset()
1000 memset(&l->mon_state, 0, sizeof(l->mon_state)); in tipc_link_reset()
1001 tipc_link_reset_stats(l); in tipc_link_reset()
1006 * @l: link to use
1014 int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list, in tipc_link_xmit() argument
1017 struct sk_buff_head *backlogq = &l->backlogq; in tipc_link_xmit()
1018 struct sk_buff_head *transmq = &l->transmq; in tipc_link_xmit()
1020 u16 bc_ack = l->bc_rcvlink->rcv_nxt - 1; in tipc_link_xmit()
1021 u16 ack = l->rcv_nxt - 1; in tipc_link_xmit()
1022 u16 seqno = l->snd_nxt; in tipc_link_xmit()
1024 unsigned int mss = tipc_link_mss(l); in tipc_link_xmit()
1025 unsigned int cwin = l->window; in tipc_link_xmit()
1026 unsigned int mtu = l->mtu; in tipc_link_xmit()
1046 if (unlikely(l->backlog[imp].len >= l->backlog[imp].limit)) { in tipc_link_xmit()
1048 pr_warn("%s<%s>, link overflow", link_rst_msg, l->name); in tipc_link_xmit()
1051 rc = link_schedule_user(l, hdr); in tipc_link_xmit()
1054 if (pkt_cnt > 1) { in tipc_link_xmit()
1055 l->stats.sent_fragmented++; in tipc_link_xmit()
1056 l->stats.sent_fragments += pkt_cnt; in tipc_link_xmit()
1073 tipc_link_set_skb_retransmit_time(skb, l); in tipc_link_xmit()
1075 TIPC_SKB_CB(skb)->ackers = l->ackers; in tipc_link_xmit()
1076 l->rcv_unacked = 0; in tipc_link_xmit()
1077 l->stats.sent_pkts++; in tipc_link_xmit()
1081 if (tipc_msg_try_bundle(l->backlog[imp].target_bskb, &skb, in tipc_link_xmit()
1082 mss, l->addr, &new_bundle)) { in tipc_link_xmit()
1085 l->backlog[imp].target_bskb = skb; in tipc_link_xmit()
1086 l->backlog[imp].len++; in tipc_link_xmit()
1090 l->stats.sent_bundles++; in tipc_link_xmit()
1091 l->stats.sent_bundled++; in tipc_link_xmit()
1093 l->stats.sent_bundled++; in tipc_link_xmit()
1097 l->backlog[imp].target_bskb = NULL; in tipc_link_xmit()
1098 l->backlog[imp].len += (1 + skb_queue_len(list)); in tipc_link_xmit()
1102 l->snd_nxt = seqno; in tipc_link_xmit()
1106 static void tipc_link_update_cwin(struct tipc_link *l, int released, in tipc_link_update_cwin() argument
1109 int bklog_len = skb_queue_len(&l->backlogq); in tipc_link_update_cwin()
1110 struct sk_buff_head *txq = &l->transmq; in tipc_link_update_cwin()
1112 u16 cwin = l->window; in tipc_link_update_cwin()
1116 l->ssthresh = max_t(u16, l->window / 2, 300); in tipc_link_update_cwin()
1117 l->window = min_t(u16, l->ssthresh, l->window); in tipc_link_update_cwin()
1122 l->ssthresh = max_t(u16, l->window / 2, 300); in tipc_link_update_cwin()
1123 l->window = l->min_win; in tipc_link_update_cwin()
1131 if (txq_len && l->snd_nxt - buf_seqno(skb_peek(txq)) != txq_len) in tipc_link_update_cwin()
1134 l->cong_acks += released; in tipc_link_update_cwin()
1137 if (cwin <= l->ssthresh) { in tipc_link_update_cwin()
1138 l->window = min_t(u16, cwin + released, l->max_win); in tipc_link_update_cwin()
1142 if (l->cong_acks < cwin) in tipc_link_update_cwin()
1144 l->window = min_t(u16, ++cwin, l->max_win); in tipc_link_update_cwin()
1145 l->cong_acks = 0; in tipc_link_update_cwin()
1148 static void tipc_link_advance_backlog(struct tipc_link *l, in tipc_link_advance_backlog() argument
1151 u16 bc_ack = l->bc_rcvlink->rcv_nxt - 1; in tipc_link_advance_backlog()
1152 struct sk_buff_head *txq = &l->transmq; in tipc_link_advance_backlog()
1154 u16 ack = l->rcv_nxt - 1; in tipc_link_advance_backlog()
1155 u16 seqno = l->snd_nxt; in tipc_link_advance_backlog()
1157 u16 cwin = l->window; in tipc_link_advance_backlog()
1161 skb = skb_peek(&l->backlogq); in tipc_link_advance_backlog()
1167 __skb_dequeue(&l->backlogq); in tipc_link_advance_backlog()
1170 l->backlog[imp].len--; in tipc_link_advance_backlog()
1171 if (unlikely(skb == l->backlog[imp].target_bskb)) in tipc_link_advance_backlog()
1172 l->backlog[imp].target_bskb = NULL; in tipc_link_advance_backlog()
1173 __skb_queue_tail(&l->transmq, skb); in tipc_link_advance_backlog()
1174 tipc_link_set_skb_retransmit_time(skb, l); in tipc_link_advance_backlog()
1177 TIPC_SKB_CB(skb)->ackers = l->ackers; in tipc_link_advance_backlog()
1181 l->rcv_unacked = 0; in tipc_link_advance_backlog()
1182 l->stats.sent_pkts++; in tipc_link_advance_backlog()
1185 l->snd_nxt = seqno; in tipc_link_advance_backlog()
1190 * @l: tipc link sender
1191 * @r: tipc link receiver (= l in case of unicast)
1197 static bool link_retransmit_failure(struct tipc_link *l, struct tipc_link *r, in link_retransmit_failure() argument
1200 struct sk_buff *skb = skb_peek(&l->transmq); in link_retransmit_failure()
1214 if (link_is_bc_sndlink(l) && !less(r->acked, msg_seqno(hdr))) in link_retransmit_failure()
1217 pr_warn("Retransmission failure on link <%s>\n", l->name); in link_retransmit_failure()
1218 link_print(l, "State of link "); in link_retransmit_failure()
1227 trace_tipc_list_dump(&l->transmq, true, "retrans failure!"); in link_retransmit_failure()
1228 trace_tipc_link_dump(l, TIPC_DUMP_NONE, "retrans failure!"); in link_retransmit_failure()
1231 if (link_is_bc_sndlink(l)) { in link_retransmit_failure()
1235 *rc |= tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in link_retransmit_failure()
1246 static bool tipc_data_input(struct tipc_link *l, struct sk_buff *skb, in tipc_data_input() argument
1249 struct sk_buff_head *mc_inputq = l->bc_rcvlink->inputq; in tipc_data_input()
1269 l->bc_rcvlink->state = LINK_ESTABLISHED; in tipc_data_input()
1270 skb_queue_tail(l->namedq, skb); in tipc_data_input()
1281 tipc_crypto_msg_rcv(l->net, skb); in tipc_data_input()
1297 static int tipc_link_input(struct tipc_link *l, struct sk_buff *skb, in tipc_link_input() argument
1309 l->stats.recv_bundles++; in tipc_link_input()
1310 l->stats.recv_bundled += msg_msgcnt(hdr); in tipc_link_input()
1312 tipc_data_input(l, iskb, &tmpq); in tipc_link_input()
1316 l->stats.recv_fragments++; in tipc_link_input()
1318 l->stats.recv_fragmented++; in tipc_link_input()
1319 tipc_data_input(l, skb, inputq); in tipc_link_input()
1320 } else if (!*reasm_skb && !link_is_bc_rcvlink(l)) { in tipc_link_input()
1322 return tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in tipc_link_input()
1326 tipc_bcast_lock(l->net); in tipc_link_input()
1327 tipc_link_bc_init_rcv(l->bc_rcvlink, hdr); in tipc_link_input()
1328 tipc_bcast_unlock(l->net); in tipc_link_input()
1338 * @l: tunnel link
1342 static int tipc_link_tnl_rcv(struct tipc_link *l, struct sk_buff *skb, in tipc_link_tnl_rcv() argument
1345 struct sk_buff **reasm_skb = &l->failover_reasm_skb; in tipc_link_tnl_rcv()
1346 struct sk_buff **reasm_tnlmsg = &l->reasm_tnlmsg; in tipc_link_tnl_rcv()
1347 struct sk_buff_head *fdefq = &l->failover_deferdq; in tipc_link_tnl_rcv()
1369 if (msg_fragm_no(hdr) == 1) in tipc_link_tnl_rcv()
1378 if (*reasm_tnlmsg || link_is_bc_rcvlink(l)) in tipc_link_tnl_rcv()
1381 return tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in tipc_link_tnl_rcv()
1388 if (unlikely(less(seqno, l->drop_point))) { in tipc_link_tnl_rcv()
1392 if (unlikely(seqno != l->drop_point)) { in tipc_link_tnl_rcv()
1397 l->drop_point++; in tipc_link_tnl_rcv()
1398 if (!tipc_data_input(l, iskb, inputq)) in tipc_link_tnl_rcv()
1399 rc |= tipc_link_input(l, iskb, inputq, reasm_skb); in tipc_link_tnl_rcv()
1402 } while ((iskb = __tipc_skb_dequeue(fdefq, l->drop_point))); in tipc_link_tnl_rcv()
1410 * @l: the tipc link
1412 * @uc: desired Gap ACK blocks type, i.e. unicast (= 1) or broadcast (= 0)
1416 u16 tipc_get_gap_ack_blks(struct tipc_gap_ack_blks **ga, struct tipc_link *l, in tipc_get_gap_ack_blks() argument
1423 if (l->peer_caps & TIPC_GAP_ACK_BLOCK) { in tipc_get_gap_ack_blks()
1448 struct tipc_link *l, u8 start_index) in __tipc_build_gap_ack_blks() argument
1451 struct sk_buff *skb = skb_peek(&l->deferdq); in __tipc_build_gap_ack_blks()
1459 skb_queue_walk(&l->deferdq, skb) { in __tipc_build_gap_ack_blks()
1462 gacks[n].ack = htons(expect - 1); in __tipc_build_gap_ack_blks()
1466 l->name, n, in __tipc_build_gap_ack_blks()
1467 skb_queue_len(&l->deferdq)); in __tipc_build_gap_ack_blks()
1474 expect = seqno + 1; in __tipc_build_gap_ack_blks()
1485 * @l: tipc unicast link
1494 static u16 tipc_build_gap_ack_blks(struct tipc_link *l, struct tipc_msg *hdr) in tipc_build_gap_ack_blks() argument
1496 struct tipc_link *bcl = l->bc_rcvlink; in tipc_build_gap_ack_blks()
1504 msg_set_bcast_ack(hdr, bcl->rcv_nxt - 1); in tipc_build_gap_ack_blks()
1511 __tipc_build_gap_ack_blks(ga, l, ga->bgack_cnt) : 0; in tipc_build_gap_ack_blks()
1522 * @l: tipc link with transmq queue to be advanced
1523 * @r: tipc link "receiver" i.e. in case of broadcast (= "l" if unicast)
1534 static int tipc_link_advance_transmq(struct tipc_link *l, struct tipc_link *r, in tipc_link_advance_transmq() argument
1544 u32 qlen = skb_queue_len(&l->transmq); in tipc_link_advance_transmq()
1546 u16 bc_ack = l->bc_rcvlink->rcv_nxt - 1; in tipc_link_advance_transmq()
1547 u16 ack = l->rcv_nxt - 1; in tipc_link_advance_transmq()
1551 bool is_uc = !link_is_bc_sndlink(l); in tipc_link_advance_transmq()
1554 trace_tipc_link_retrans(r, acked + 1, acked + gap, &l->transmq); in tipc_link_advance_transmq()
1577 skb_queue_walk_safe(&l->transmq, skb, tmp) { in tipc_link_advance_transmq()
1591 start = end + offset + 1; in tipc_link_advance_transmq()
1612 __skb_unlink(skb, &l->transmq); in tipc_link_advance_transmq()
1616 if (unlikely(seqno == acked + 1 && in tipc_link_advance_transmq()
1617 link_retransmit_failure(l, r, rc))) { in tipc_link_advance_transmq()
1626 tipc_link_set_skb_retransmit_time(skb, l); in tipc_link_advance_transmq()
1635 l->stats.retransmitted++; in tipc_link_advance_transmq()
1662 offset = start - acked - 1; in tipc_link_advance_transmq()
1682 return qlen - skb_queue_len(&l->transmq); in tipc_link_advance_transmq()
1690 int tipc_link_build_state_msg(struct tipc_link *l, struct sk_buff_head *xmitq) in tipc_link_build_state_msg() argument
1692 if (!l) in tipc_link_build_state_msg()
1696 if (link_is_bc_rcvlink(l)) { in tipc_link_build_state_msg()
1697 if (((l->rcv_nxt ^ tipc_own_addr(l->net)) & 0xf) != 0xf) in tipc_link_build_state_msg()
1699 l->rcv_unacked = 0; in tipc_link_build_state_msg()
1702 l->snd_nxt = l->rcv_nxt; in tipc_link_build_state_msg()
1706 l->rcv_unacked = 0; in tipc_link_build_state_msg()
1707 l->stats.sent_acks++; in tipc_link_build_state_msg()
1708 tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, 0, 0, 0, xmitq); in tipc_link_build_state_msg()
1714 void tipc_link_build_reset_msg(struct tipc_link *l, struct sk_buff_head *xmitq) in tipc_link_build_reset_msg() argument
1719 if (l->state == LINK_ESTABLISHING) in tipc_link_build_reset_msg()
1722 tipc_link_build_proto_msg(l, mtyp, 0, 0, 0, 0, 0, xmitq); in tipc_link_build_reset_msg()
1726 if (skb && (l->state == LINK_RESET)) in tipc_link_build_reset_msg()
1727 msg_set_peer_stopping(buf_msg(skb), 1); in tipc_link_build_reset_msg()
1734 static int tipc_link_build_nack_msg(struct tipc_link *l, in tipc_link_build_nack_msg() argument
1737 u32 def_cnt = ++l->stats.deferred_recv; in tipc_link_build_nack_msg()
1738 struct sk_buff_head *dfq = &l->deferdq; in tipc_link_build_nack_msg()
1742 if (link_is_bc_rcvlink(l)) { in tipc_link_build_nack_msg()
1744 match2 = tipc_own_addr(l->net) & 0xf; in tipc_link_build_nack_msg()
1751 u16 rcvgap = buf_seqno(skb_peek(dfq)) - l->rcv_nxt; in tipc_link_build_nack_msg()
1753 tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, in tipc_link_build_nack_msg()
1760 * @l: the link that should handle the message
1764 int tipc_link_rcv(struct tipc_link *l, struct sk_buff *skb, in tipc_link_rcv() argument
1767 struct sk_buff_head *defq = &l->deferdq; in tipc_link_rcv()
1775 return tipc_link_proto_rcv(l, skb, xmitq); in tipc_link_rcv()
1778 l->silent_intv_cnt = 0; in tipc_link_rcv()
1783 rcv_nxt = l->rcv_nxt; in tipc_link_rcv()
1786 if (unlikely(!tipc_link_is_up(l))) { in tipc_link_rcv()
1787 if (l->state == LINK_ESTABLISHING) in tipc_link_rcv()
1795 l->stats.duplicates++; in tipc_link_rcv()
1799 released += tipc_link_advance_transmq(l, l, msg_ack(hdr), 0, in tipc_link_rcv()
1805 l->stats.duplicates++; in tipc_link_rcv()
1806 rc |= tipc_link_build_nack_msg(l, xmitq); in tipc_link_rcv()
1811 l->rcv_nxt++; in tipc_link_rcv()
1812 l->stats.recv_pkts++; in tipc_link_rcv()
1815 rc |= tipc_link_tnl_rcv(l, skb, l->inputq); in tipc_link_rcv()
1816 else if (!tipc_data_input(l, skb, l->inputq)) in tipc_link_rcv()
1817 rc |= tipc_link_input(l, skb, l->inputq, &l->reasm_buf); in tipc_link_rcv()
1818 if (unlikely(++l->rcv_unacked >= TIPC_MIN_LINK_WIN)) in tipc_link_rcv()
1819 rc |= tipc_link_build_state_msg(l, xmitq); in tipc_link_rcv()
1822 } while ((skb = __tipc_skb_dequeue(defq, l->rcv_nxt))); in tipc_link_rcv()
1826 tipc_link_update_cwin(l, released, 0); in tipc_link_rcv()
1827 tipc_link_advance_backlog(l, xmitq); in tipc_link_rcv()
1828 if (unlikely(!skb_queue_empty(&l->wakeupq))) in tipc_link_rcv()
1829 link_prepare_wakeup(l); in tipc_link_rcv()
1834 static void tipc_link_build_proto_msg(struct tipc_link *l, int mtyp, bool probe, in tipc_link_build_proto_msg() argument
1839 struct tipc_mon_state *mstate = &l->mon_state; in tipc_link_build_proto_msg()
1840 struct sk_buff_head *dfq = &l->deferdq; in tipc_link_build_proto_msg()
1841 struct tipc_link *bcl = l->bc_rcvlink; in tipc_link_build_proto_msg()
1850 if (tipc_link_is_blocked(l)) in tipc_link_build_proto_msg()
1853 if (!tipc_link_is_up(l) && (mtyp == STATE_MSG)) in tipc_link_build_proto_msg()
1857 rcvgap = buf_seqno(skb_peek(dfq)) - l->rcv_nxt; in tipc_link_build_proto_msg()
1861 l->addr, tipc_own_addr(l->net), 0, 0, 0); in tipc_link_build_proto_msg()
1867 msg_set_session(hdr, l->session); in tipc_link_build_proto_msg()
1868 msg_set_bearer_id(hdr, l->bearer_id); in tipc_link_build_proto_msg()
1869 msg_set_net_plane(hdr, l->net_plane); in tipc_link_build_proto_msg()
1870 msg_set_next_sent(hdr, l->snd_nxt); in tipc_link_build_proto_msg()
1871 msg_set_ack(hdr, l->rcv_nxt - 1); in tipc_link_build_proto_msg()
1872 msg_set_bcast_ack(hdr, bcl->rcv_nxt - 1); in tipc_link_build_proto_msg()
1874 msg_set_last_bcast(hdr, l->bc_sndlink->snd_nxt - 1); in tipc_link_build_proto_msg()
1879 msg_set_seqno(hdr, l->snd_nxt + U16_MAX / 2); in tipc_link_build_proto_msg()
1882 if (l->peer_caps & TIPC_LINK_PROTO_SEQNO) in tipc_link_build_proto_msg()
1883 msg_set_seqno(hdr, l->snd_nxt_state++); in tipc_link_build_proto_msg()
1889 if (l->peer_caps & TIPC_GAP_ACK_BLOCK) in tipc_link_build_proto_msg()
1890 glen = tipc_build_gap_ack_blks(l, hdr); in tipc_link_build_proto_msg()
1891 tipc_mon_prep(l->net, data + glen, &dlen, mstate, l->bearer_id); in tipc_link_build_proto_msg()
1894 l->stats.sent_states++; in tipc_link_build_proto_msg()
1895 l->rcv_unacked = 0; in tipc_link_build_proto_msg()
1899 msg_set_dest_session_valid(hdr, 1); in tipc_link_build_proto_msg()
1900 msg_set_dest_session(hdr, l->peer_session); in tipc_link_build_proto_msg()
1902 msg_set_max_pkt(hdr, l->advertised_mtu); in tipc_link_build_proto_msg()
1903 strcpy(data, l->if_name); in tipc_link_build_proto_msg()
1908 l->stats.sent_probes++; in tipc_link_build_proto_msg()
1910 l->stats.sent_nacks++; in tipc_link_build_proto_msg()
1915 trace_tipc_proto_build(skb, false, l->name); in tipc_link_build_proto_msg()
1918 void tipc_link_create_dummy_tnl_msg(struct tipc_link *l, in tipc_link_create_dummy_tnl_msg() argument
1921 u32 onode = tipc_own_addr(l->net); in tipc_link_create_dummy_tnl_msg()
1925 u32 dnode = l->addr; in tipc_link_create_dummy_tnl_msg()
1937 msg_set_msgcnt(hdr, 1); in tipc_link_create_dummy_tnl_msg()
1938 msg_set_bearer_id(hdr, l->peer_bearer_id); in tipc_link_create_dummy_tnl_msg()
1945 tipc_link_xmit(l, &tnlq, xmitq); in tipc_link_create_dummy_tnl_msg()
1951 void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl, in tipc_link_tnl_prepare() argument
1957 struct sk_buff_head *queue = &l->transmq; in tipc_link_tnl_prepare()
1959 u16 pktlen, pktcnt, seqno = l->snd_nxt; in tipc_link_tnl_prepare()
1975 INT_H_SIZE, 0, l->addr, in tipc_link_tnl_prepare()
1976 tipc_own_addr(l->net), in tipc_link_tnl_prepare()
1985 syncpt = l->snd_nxt + skb_queue_len(&l->backlogq) - 1; in tipc_link_tnl_prepare()
1987 msg_set_bearer_id(hdr, l->peer_bearer_id); in tipc_link_tnl_prepare()
1997 BASIC_H_SIZE, 0, l->addr, tipc_own_addr(l->net), in tipc_link_tnl_prepare()
2004 tipc_link_xmit(l, &tnlq, &tmpxq); in tipc_link_tnl_prepare()
2008 tipc_msg_init(tipc_own_addr(l->net), &tnlhdr, TUNNEL_PROTOCOL, in tipc_link_tnl_prepare()
2009 mtyp, INT_H_SIZE, l->addr); in tipc_link_tnl_prepare()
2011 pktcnt = l->snd_nxt - buf_seqno(skb_peek(&l->transmq)); in tipc_link_tnl_prepare()
2013 pktcnt = skb_queue_len(&l->transmq); in tipc_link_tnl_prepare()
2014 pktcnt += skb_queue_len(&l->backlogq); in tipc_link_tnl_prepare()
2016 msg_set_bearer_id(&tnlhdr, l->peer_bearer_id); in tipc_link_tnl_prepare()
2021 if (queue == &l->backlogq) in tipc_link_tnl_prepare()
2027 * 1) Link MTU has just changed or set differently; in tipc_link_tnl_prepare()
2043 pktcnt += skb_queue_len(&frags) - 1; in tipc_link_tnl_prepare()
2067 if (queue != &l->backlogq) { in tipc_link_tnl_prepare()
2068 queue = &l->backlogq; in tipc_link_tnl_prepare()
2081 tnl->drop_point = l->rcv_nxt; in tipc_link_tnl_prepare()
2082 tnl->failover_reasm_skb = l->reasm_buf; in tipc_link_tnl_prepare()
2083 l->reasm_buf = NULL; in tipc_link_tnl_prepare()
2091 skb_queue_splice_init(&l->deferdq, fdefq); in tipc_link_tnl_prepare()
2101 * @l: failover link
2105 void tipc_link_failover_prepare(struct tipc_link *l, struct tipc_link *tnl, in tipc_link_failover_prepare() argument
2118 tnl->drop_point = 1; in tipc_link_failover_prepare()
2132 bool tipc_link_validate_msg(struct tipc_link *l, struct tipc_msg *hdr) in tipc_link_validate_msg() argument
2134 u16 curr_session = l->peer_session; in tipc_link_validate_msg()
2143 if (!l->in_session) in tipc_link_validate_msg()
2148 if (!l->in_session) in tipc_link_validate_msg()
2154 if (!l->in_session) in tipc_link_validate_msg()
2159 if (!tipc_link_is_up(l) && msg_ack(hdr)) in tipc_link_validate_msg()
2161 if (!(l->peer_caps & TIPC_LINK_PROTO_SEQNO)) in tipc_link_validate_msg()
2164 return !less(msg_seqno(hdr), l->rcv_nxt_state); in tipc_link_validate_msg()
2175 static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb, in tipc_link_proto_rcv() argument
2187 u16 rcv_nxt = l->rcv_nxt; in tipc_link_proto_rcv()
2194 trace_tipc_proto_rcv(skb, false, l->name); in tipc_link_proto_rcv()
2199 if (tipc_link_is_blocked(l) || !xmitq) in tipc_link_proto_rcv()
2202 if (tipc_own_addr(l->net) > msg_prevnode(hdr)) in tipc_link_proto_rcv()
2203 l->net_plane = msg_net_plane(hdr); in tipc_link_proto_rcv()
2211 if (!tipc_link_validate_msg(l, hdr)) { in tipc_link_proto_rcv()
2212 trace_tipc_skb_dump(skb, false, "PROTO invalid (1)!"); in tipc_link_proto_rcv()
2213 trace_tipc_link_dump(l, TIPC_DUMP_NONE, "PROTO invalid (1)!"); in tipc_link_proto_rcv()
2221 if (msg_max < tipc_bearer_min_mtu(l->net, l->bearer_id)) in tipc_link_proto_rcv()
2224 if_name = strrchr(l->name, ':') + 1; in tipc_link_proto_rcv()
2225 if (sizeof(l->name) - (if_name - l->name) <= TIPC_MAX_IF_NAME) in tipc_link_proto_rcv()
2233 l->tolerance = peers_tol; in tipc_link_proto_rcv()
2234 l->bc_rcvlink->tolerance = peers_tol; in tipc_link_proto_rcv()
2237 if (tipc_in_range(peers_prio, l->priority + 1, TIPC_MAX_LINK_PRI)) in tipc_link_proto_rcv()
2238 l->priority = peers_prio; in tipc_link_proto_rcv()
2242 rc = tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in tipc_link_proto_rcv()
2250 l->session != msg_dest_session(hdr)) { in tipc_link_proto_rcv()
2251 if (less(l->session, msg_dest_session(hdr))) in tipc_link_proto_rcv()
2252 l->session = msg_dest_session(hdr) + 1; in tipc_link_proto_rcv()
2257 if (mtyp == RESET_MSG || !tipc_link_is_up(l)) in tipc_link_proto_rcv()
2258 rc = tipc_link_fsm_evt(l, LINK_PEER_RESET_EVT); in tipc_link_proto_rcv()
2261 if (mtyp == ACTIVATE_MSG && l->state == LINK_ESTABLISHING) in tipc_link_proto_rcv()
2264 l->peer_session = msg_session(hdr); in tipc_link_proto_rcv()
2265 l->in_session = true; in tipc_link_proto_rcv()
2266 l->peer_bearer_id = msg_bearer_id(hdr); in tipc_link_proto_rcv()
2267 if (l->mtu > msg_max) in tipc_link_proto_rcv()
2268 l->mtu = msg_max; in tipc_link_proto_rcv()
2273 glen = tipc_get_gap_ack_blks(&ga, l, hdr, true); in tipc_link_proto_rcv()
2277 l->rcv_nxt_state = msg_seqno(hdr) + 1; in tipc_link_proto_rcv()
2281 l->tolerance = peers_tol; in tipc_link_proto_rcv()
2282 l->bc_rcvlink->tolerance = peers_tol; in tipc_link_proto_rcv()
2285 if ((peers_prio != l->priority) && in tipc_link_proto_rcv()
2286 tipc_in_range(peers_prio, 1, TIPC_MAX_LINK_PRI)) { in tipc_link_proto_rcv()
2287 l->priority = peers_prio; in tipc_link_proto_rcv()
2288 rc = tipc_link_fsm_evt(l, LINK_FAILURE_EVT); in tipc_link_proto_rcv()
2291 l->silent_intv_cnt = 0; in tipc_link_proto_rcv()
2292 l->stats.recv_states++; in tipc_link_proto_rcv()
2294 l->stats.recv_probes++; in tipc_link_proto_rcv()
2296 if (!tipc_link_is_up(l)) { in tipc_link_proto_rcv()
2297 if (l->state == LINK_ESTABLISHING) in tipc_link_proto_rcv()
2302 tipc_mon_rcv(l->net, data + glen, dlen - glen, l->addr, in tipc_link_proto_rcv()
2303 &l->mon_state, l->bearer_id); in tipc_link_proto_rcv()
2308 !tipc_link_is_synching(l) && in tipc_link_proto_rcv()
2309 skb_queue_empty(&l->deferdq)) in tipc_link_proto_rcv()
2310 rcvgap = peers_snd_nxt - l->rcv_nxt; in tipc_link_proto_rcv()
2312 tipc_link_build_proto_msg(l, STATE_MSG, 0, reply, in tipc_link_proto_rcv()
2315 released = tipc_link_advance_transmq(l, l, ack, gap, ga, xmitq, in tipc_link_proto_rcv()
2318 l->stats.recv_nacks++; in tipc_link_proto_rcv()
2320 tipc_link_update_cwin(l, released, retransmitted); in tipc_link_proto_rcv()
2322 tipc_link_advance_backlog(l, xmitq); in tipc_link_proto_rcv()
2323 if (unlikely(!skb_queue_empty(&l->wakeupq))) in tipc_link_proto_rcv()
2324 link_prepare_wakeup(l); in tipc_link_proto_rcv()
2333 static bool tipc_link_build_bc_proto_msg(struct tipc_link *l, bool bcast, in tipc_link_build_bc_proto_msg() argument
2339 struct sk_buff *dfrd_skb = skb_peek(&l->deferdq); in tipc_link_build_bc_proto_msg()
2340 u16 ack = l->rcv_nxt - 1; in tipc_link_build_bc_proto_msg()
2341 u16 gap_to = peers_snd_nxt - 1; in tipc_link_build_bc_proto_msg()
2344 0, l->addr, tipc_own_addr(l->net), 0, 0, 0); in tipc_link_build_bc_proto_msg()
2348 msg_set_last_bcast(hdr, l->bc_sndlink->snd_nxt - 1); in tipc_link_build_bc_proto_msg()
2352 gap_to = buf_seqno(dfrd_skb) - 1; in tipc_link_build_bc_proto_msg()
2364 static void tipc_link_build_bc_init_msg(struct tipc_link *l, in tipc_link_build_bc_init_msg() argument
2370 if (!tipc_link_build_bc_proto_msg(l->bc_rcvlink, false, 0, &list)) in tipc_link_build_bc_init_msg()
2373 tipc_link_xmit(l, &list, xmitq); in tipc_link_build_bc_init_msg()
2378 void tipc_link_bc_init_rcv(struct tipc_link *l, struct tipc_msg *hdr) in tipc_link_bc_init_rcv() argument
2383 if (tipc_link_is_up(l)) in tipc_link_bc_init_rcv()
2387 l->rcv_nxt = peers_snd_nxt; in tipc_link_bc_init_rcv()
2388 l->state = LINK_ESTABLISHED; in tipc_link_bc_init_rcv()
2392 if (l->peer_caps & TIPC_BCAST_SYNCH) in tipc_link_bc_init_rcv()
2400 l->rcv_nxt = peers_snd_nxt; in tipc_link_bc_init_rcv()
2405 int tipc_link_bc_sync_rcv(struct tipc_link *l, struct tipc_msg *hdr, in tipc_link_bc_sync_rcv() argument
2411 if (!tipc_link_is_up(l)) in tipc_link_bc_sync_rcv()
2417 /* Open when peer acknowledges our bcast init msg (pkt #1) */ in tipc_link_bc_sync_rcv()
2419 l->bc_peer_is_up = true; in tipc_link_bc_sync_rcv()
2421 if (!l->bc_peer_is_up) in tipc_link_bc_sync_rcv()
2425 if (more(peers_snd_nxt, l->rcv_nxt + l->window)) in tipc_link_bc_sync_rcv()
2428 l->snd_nxt = peers_snd_nxt; in tipc_link_bc_sync_rcv()
2429 if (link_bc_rcv_gap(l)) in tipc_link_bc_sync_rcv()
2433 if (l->peer_caps & TIPC_BCAST_STATE_NACK) in tipc_link_bc_sync_rcv()
2438 if (!more(peers_snd_nxt, l->rcv_nxt)) { in tipc_link_bc_sync_rcv()
2439 l->nack_state = BC_NACK_SND_CONDITIONAL; in tipc_link_bc_sync_rcv()
2444 if (l->nack_state == BC_NACK_SND_SUPPRESS) { in tipc_link_bc_sync_rcv()
2445 l->nack_state = BC_NACK_SND_UNCONDITIONAL; in tipc_link_bc_sync_rcv()
2450 if (l->nack_state == BC_NACK_SND_CONDITIONAL) { in tipc_link_bc_sync_rcv()
2451 l->nack_state = BC_NACK_SND_UNCONDITIONAL; in tipc_link_bc_sync_rcv()
2452 if ((peers_snd_nxt - l->rcv_nxt) < TIPC_MIN_LINK_WIN) in tipc_link_bc_sync_rcv()
2457 tipc_link_build_bc_proto_msg(l, true, peers_snd_nxt, xmitq); in tipc_link_bc_sync_rcv()
2458 l->nack_state = BC_NACK_SND_SUPPRESS; in tipc_link_bc_sync_rcv()
2467 struct tipc_link *l = r->bc_sndlink; in tipc_link_bc_ack_rcv() local
2475 l->stats.recv_nacks++; in tipc_link_bc_ack_rcv()
2482 trace_tipc_link_bc_ack(r, acked, gap, &l->transmq); in tipc_link_bc_ack_rcv()
2483 tipc_link_advance_transmq(l, r, acked, gap, ga, retrq, &unused, &rc); in tipc_link_bc_ack_rcv()
2485 tipc_link_advance_backlog(l, xmitq); in tipc_link_bc_ack_rcv()
2486 if (unlikely(!skb_queue_empty(&l->wakeupq))) in tipc_link_bc_ack_rcv()
2487 link_prepare_wakeup(l); in tipc_link_bc_ack_rcv()
2496 int tipc_link_bc_nack_rcv(struct tipc_link *l, struct sk_buff *skb, in tipc_link_bc_nack_rcv() argument
2503 u16 from = acked + 1; in tipc_link_bc_nack_rcv()
2505 u16 peers_snd_nxt = to + 1; in tipc_link_bc_nack_rcv()
2510 if (!tipc_link_is_up(l) || !l->bc_peer_is_up) in tipc_link_bc_nack_rcv()
2516 if (dnode == tipc_own_addr(l->net)) { in tipc_link_bc_nack_rcv()
2517 rc = tipc_link_bc_ack_rcv(l, acked, to - acked, NULL, xmitq, in tipc_link_bc_nack_rcv()
2519 l->stats.recv_nacks++; in tipc_link_bc_nack_rcv()
2524 if (more(peers_snd_nxt, l->rcv_nxt) && !less(l->rcv_nxt, from)) in tipc_link_bc_nack_rcv()
2525 l->nack_state = BC_NACK_SND_SUPPRESS; in tipc_link_bc_nack_rcv()
2530 void tipc_link_set_queue_limits(struct tipc_link *l, u32 min_win, u32 max_win) in tipc_link_set_queue_limits() argument
2532 int max_bulk = TIPC_MAX_PUBL / (l->mtu / ITEM_SIZE); in tipc_link_set_queue_limits()
2534 l->min_win = min_win; in tipc_link_set_queue_limits()
2535 l->ssthresh = max_win; in tipc_link_set_queue_limits()
2536 l->max_win = max_win; in tipc_link_set_queue_limits()
2537 l->window = min_win; in tipc_link_set_queue_limits()
2538 l->backlog[TIPC_LOW_IMPORTANCE].limit = min_win * 2; in tipc_link_set_queue_limits()
2539 l->backlog[TIPC_MEDIUM_IMPORTANCE].limit = min_win * 4; in tipc_link_set_queue_limits()
2540 l->backlog[TIPC_HIGH_IMPORTANCE].limit = min_win * 6; in tipc_link_set_queue_limits()
2541 l->backlog[TIPC_CRITICAL_IMPORTANCE].limit = min_win * 8; in tipc_link_set_queue_limits()
2542 l->backlog[TIPC_SYSTEM_IMPORTANCE].limit = max_bulk; in tipc_link_set_queue_limits()
2547 * @l: pointer to link
2549 void tipc_link_reset_stats(struct tipc_link *l) in tipc_link_reset_stats() argument
2551 memset(&l->stats, 0, sizeof(l->stats)); in tipc_link_reset_stats()
2554 static void link_print(struct tipc_link *l, const char *str) in link_print() argument
2556 struct sk_buff *hskb = skb_peek(&l->transmq); in link_print()
2557 u16 head = hskb ? msg_seqno(buf_msg(hskb)) : l->snd_nxt - 1; in link_print()
2558 u16 tail = l->snd_nxt - 1; in link_print()
2560 pr_info("%s Link <%s> state %x\n", str, l->name, l->state); in link_print()
2562 skb_queue_len(&l->transmq), head, tail, in link_print()
2563 skb_queue_len(&l->backlogq), l->snd_nxt, l->rcv_nxt); in link_print()
2626 s->msg_length_counts : 1}, in __tipc_nl_add_stats()
2630 {TIPC_NLA_STATS_MSG_LEN_P1, s->msg_length_profile[1]}, in __tipc_nl_add_stats()
2863 void tipc_link_set_tolerance(struct tipc_link *l, u32 tol, in tipc_link_set_tolerance() argument
2866 l->tolerance = tol; in tipc_link_set_tolerance()
2867 if (l->bc_rcvlink) in tipc_link_set_tolerance()
2868 l->bc_rcvlink->tolerance = tol; in tipc_link_set_tolerance()
2869 if (tipc_link_is_up(l)) in tipc_link_set_tolerance()
2870 tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, 0, tol, 0, xmitq); in tipc_link_set_tolerance()
2873 void tipc_link_set_prio(struct tipc_link *l, u32 prio, in tipc_link_set_prio() argument
2876 l->priority = prio; in tipc_link_set_prio()
2877 tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, 0, 0, prio, xmitq); in tipc_link_set_prio()
2880 void tipc_link_set_abort_limit(struct tipc_link *l, u32 limit) in tipc_link_set_abort_limit() argument
2882 l->abort_limit = limit; in tipc_link_set_abort_limit()
2887 * @l: tipc link to be dumped
2898 int tipc_link_dump(struct tipc_link *l, u16 dqueues, char *buf) in tipc_link_dump() argument
2906 if (!l) { in tipc_link_dump()
2911 i += scnprintf(buf, sz, "link data: %x", l->addr); in tipc_link_dump()
2912 i += scnprintf(buf + i, sz - i, " %x", l->state); in tipc_link_dump()
2913 i += scnprintf(buf + i, sz - i, " %u", l->in_session); in tipc_link_dump()
2914 i += scnprintf(buf + i, sz - i, " %u", l->session); in tipc_link_dump()
2915 i += scnprintf(buf + i, sz - i, " %u", l->peer_session); in tipc_link_dump()
2916 i += scnprintf(buf + i, sz - i, " %u", l->snd_nxt); in tipc_link_dump()
2917 i += scnprintf(buf + i, sz - i, " %u", l->rcv_nxt); in tipc_link_dump()
2918 i += scnprintf(buf + i, sz - i, " %u", l->snd_nxt_state); in tipc_link_dump()
2919 i += scnprintf(buf + i, sz - i, " %u", l->rcv_nxt_state); in tipc_link_dump()
2920 i += scnprintf(buf + i, sz - i, " %x", l->peer_caps); in tipc_link_dump()
2921 i += scnprintf(buf + i, sz - i, " %u", l->silent_intv_cnt); in tipc_link_dump()
2922 i += scnprintf(buf + i, sz - i, " %u", l->rst_cnt); in tipc_link_dump()
2925 i += scnprintf(buf + i, sz - i, " %u", l->acked); in tipc_link_dump()
2927 list = &l->transmq; in tipc_link_dump()
2935 list = &l->deferdq; in tipc_link_dump()
2943 list = &l->backlogq; in tipc_link_dump()
2951 list = l->inputq; in tipc_link_dump()
2961 i += tipc_list_dump(&l->transmq, false, buf + i); in tipc_link_dump()
2966 l->backlog[TIPC_LOW_IMPORTANCE].len, in tipc_link_dump()
2967 l->backlog[TIPC_MEDIUM_IMPORTANCE].len, in tipc_link_dump()
2968 l->backlog[TIPC_HIGH_IMPORTANCE].len, in tipc_link_dump()
2969 l->backlog[TIPC_CRITICAL_IMPORTANCE].len, in tipc_link_dump()
2970 l->backlog[TIPC_SYSTEM_IMPORTANCE].len); in tipc_link_dump()
2971 i += tipc_list_dump(&l->backlogq, false, buf + i); in tipc_link_dump()
2975 i += tipc_list_dump(&l->deferdq, false, buf + i); in tipc_link_dump()
2979 i += tipc_list_dump(l->inputq, false, buf + i); in tipc_link_dump()
2983 i += tipc_list_dump(&l->wakeupq, false, buf + i); in tipc_link_dump()