Lines Matching +full:no +full:- +full:ref +full:- +full:high +full:- +full:z
4 * Copyright (c) 1996-2007, 2012-2016, Ericsson AB
5 * Copyright (c) 2004-2007, 2010-2013, Wind River Systems
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
73 u32 max_queue_sz; /* send queue size high water mark */
82 * struct tipc_link - TIPC link data structure
266 * Simple non-static link routines (i.e. referenced outside this file)
270 return l->state & (LINK_ESTABLISHED | LINK_SYNCHING); in tipc_link_is_up()
275 return l->state == LINK_PEER_RESET; in tipc_link_peer_is_down()
280 return l->state & (LINK_RESET | LINK_FAILINGOVER | LINK_ESTABLISHING); in tipc_link_is_reset()
285 return l->state == LINK_ESTABLISHING; in tipc_link_is_establishing()
290 return l->state == LINK_SYNCHING; in tipc_link_is_synching()
295 return l->state == LINK_FAILINGOVER; in tipc_link_is_failingover()
300 return l->state & (LINK_RESETTING | LINK_PEER_RESET | LINK_FAILINGOVER); in tipc_link_is_blocked()
305 return !l->bc_sndlink; in link_is_bc_sndlink()
310 return ((l->bc_rcvlink == l) && !link_is_bc_sndlink(l)); in link_is_bc_rcvlink()
315 l->active = active; in tipc_link_set_active()
320 return l->peer_bearer_id << 16 | l->bearer_id; in tipc_link_id()
325 return l->min_win; in tipc_link_min_win()
330 return l->max_win; in tipc_link_max_win()
335 return l->priority; in tipc_link_prio()
340 return l->tolerance; in tipc_link_tolerance()
345 return l->inputq; in tipc_link_inputq()
350 return l->net_plane; in tipc_link_plane()
355 return l->net; in tipc_link_net()
360 l->peer_caps = capabilities; in tipc_link_update_caps()
367 struct tipc_link *rcv_l = uc_l->bc_rcvlink; in tipc_link_add_bc_peer()
369 snd_l->ackers++; in tipc_link_add_bc_peer()
370 rcv_l->acked = snd_l->snd_nxt - 1; in tipc_link_add_bc_peer()
371 snd_l->state = LINK_ESTABLISHED; in tipc_link_add_bc_peer()
379 u16 ack = snd_l->snd_nxt - 1; in tipc_link_remove_bc_peer()
381 snd_l->ackers--; in tipc_link_remove_bc_peer()
382 rcv_l->bc_peer_is_up = true; in tipc_link_remove_bc_peer()
383 rcv_l->state = LINK_ESTABLISHED; in tipc_link_remove_bc_peer()
387 rcv_l->state = LINK_RESET; in tipc_link_remove_bc_peer()
388 if (!snd_l->ackers) { in tipc_link_remove_bc_peer()
391 snd_l->state = LINK_RESET; in tipc_link_remove_bc_peer()
398 return l->ackers; in tipc_link_bc_peers()
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()
415 l->mtu = mtu; in tipc_link_set_mtu()
420 return l->mtu; in tipc_link_mtu()
426 return l->mtu - INT_H_SIZE - EMSG_OVERHEAD; in tipc_link_mss()
428 return l->mtu - INT_H_SIZE; in tipc_link_mss()
434 return l->rcv_nxt; in tipc_link_rcv_nxt()
439 return l->acked; in tipc_link_acked()
444 return l->name; in tipc_link_name()
449 return l->state; in tipc_link_state()
453 * tipc_link_create - create a new link
472 * @peer_id: 128-bit ID of peer
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()
517 bc_rcvlink->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()
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()
539 * tipc_link_bc_create - create new link to be used for broadcast
541 * @mtu: mtu to be used initially if no peers
549 * @peer_id: 128-bit ID of peer
564 if (!tipc_link_create(net, "", MAX_BEARERS, 0, 'Z', mtu, 0, min_win, in tipc_link_bc_create()
576 /* Broadcast receiver link name: "broadcast-link:<peer>" */ 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()
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()
590 l->state = LINK_ESTABLISHED; in tipc_link_bc_create()
600 * tipc_link_fsm_evt - link finite state machine
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()
764 /* link_profile_stats - update statistical profiling of traffic
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()
806 * tipc_link_too_silent - check if link is "too silent"
814 return (l->silent_intv_cnt + 2 > l->abort_limit); in tipc_link_too_silent()
817 /* tipc_link_timeout - perform periodic task as instructed from node timeout
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()
832 switch (l->state) { 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()
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()
844 probe = mstate->probing; in tipc_link_timeout()
845 probe |= l->silent_intv_cnt; in tipc_link_timeout()
846 if (probe || mstate->monitoring) 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()
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()
879 * link_schedule_user - schedule a message sender for wakeup after congestion
886 u32 dnode = tipc_own_addr(l->net); in link_schedule_user()
892 dnode, l->addr, dport, 0, 0); in link_schedule_user()
894 return -ENOBUFS; in link_schedule_user()
896 TIPC_SKB_CB(skb)->chain_imp = msg_importance(hdr); in link_schedule_user()
897 skb_queue_tail(&l->wakeupq, skb); in link_schedule_user()
898 l->stats.link_congs++; in link_schedule_user()
900 return -ELINKCONG; in link_schedule_user()
904 * link_prepare_wakeup - prepare users for wakeup after congestion
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()
924 imp = TIPC_SKB_CB(skb)->chain_imp; in link_prepare_wakeup()
927 avail[imp]--; in link_prepare_wakeup()
932 spin_lock_bh(&inputq->lock); in link_prepare_wakeup()
934 spin_unlock_bh(&inputq->lock); in link_prepare_wakeup()
939 * tipc_link_set_skb_retransmit_time - set the time at which retransmission of
948 TIPC_SKB_CB(skb)->nxt_retr = TIPC_BC_RETR_LIM; in tipc_link_set_skb_retransmit_time()
950 TIPC_SKB_CB(skb)->nxt_retr = TIPC_UC_RETR_TIME; in tipc_link_set_skb_retransmit_time()
960 l->in_session = false; in tipc_link_reset()
961 /* Force re-synch of peer session number before establishing */ 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()
1012 * Return: 0 if success, or errno: -ELINKCONG, -EMSGSIZE or -ENOBUFS
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()
1025 unsigned int cwin = l->window; in tipc_link_xmit()
1026 unsigned int mtu = l->mtu; in tipc_link_xmit()
1041 return -EMSGSIZE; 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()
1049 return -ENOBUFS; in tipc_link_xmit()
1055 l->stats.sent_fragmented++; in tipc_link_xmit()
1056 l->stats.sent_fragments += pkt_cnt; in tipc_link_xmit()
1070 return -ENOBUFS; 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()
1084 /* Keep a ref. to the skb for next try */ 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()
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()
1126 /* Don't increase window if no pressure on the transmit queue */ 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()
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()
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()
1189 * link_retransmit_failure() - Detect repeated retransmit failures
1200 struct sk_buff *skb = skb_peek(&l->transmq); in link_retransmit_failure()
1206 if (!TIPC_SKB_CB(skb)->retr_cnt) in link_retransmit_failure()
1209 if (!time_after(jiffies, TIPC_SKB_CB(skb)->retr_stamp + in link_retransmit_failure()
1210 msecs_to_jiffies(r->tolerance * 10))) 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()
1224 jiffies_to_msecs(TIPC_SKB_CB(skb)->retr_stamp), in link_retransmit_failure()
1225 TIPC_SKB_CB(skb)->retr_cnt); in link_retransmit_failure()
1227 trace_tipc_list_dump(&l->transmq, true, "retrans failure!"); in link_retransmit_failure()
1232 r->state = LINK_RESET; in link_retransmit_failure()
1241 /* tipc_data_input - deliver data and name distr msgs to upper layer
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()
1280 TIPC_SKB_CB(skb)->decrypted) { in tipc_data_input()
1281 tipc_crypto_msg_rcv(l->net, skb); in tipc_data_input()
1293 /* tipc_link_input - process packet that has passed link protocol check
1309 l->stats.recv_bundles++; in tipc_link_input()
1310 l->stats.recv_bundled += msg_msgcnt(hdr); in tipc_link_input()
1316 l->stats.recv_fragments++; in tipc_link_input()
1318 l->stats.recv_fragmented++; 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()
1335 /* tipc_link_tnl_rcv() - receive TUNNEL_PROTOCOL message, drop or process the
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()
1377 /* Successful but non-complete reassembly? */ 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()
1402 } while ((iskb = __tipc_skb_dequeue(fdefq, l->drop_point))); in tipc_link_tnl_rcv()
1408 * tipc_get_gap_ack_blks - get Gap ACK blocks from PROTOCOL/STATE_MSG
1423 if (l->peer_caps & TIPC_GAP_ACK_BLOCK) { in tipc_get_gap_ack_blks()
1425 sz = ntohs(p->len); in tipc_get_gap_ack_blks()
1427 if (sz == struct_size(p, gacks, size_add(p->ugack_cnt, p->bgack_cnt))) { in tipc_get_gap_ack_blks()
1429 if ((uc && p->ugack_cnt) || (!uc && p->bgack_cnt)) in tipc_get_gap_ack_blks()
1432 } else if (uc && sz == struct_size(p, gacks, p->ugack_cnt)) { in tipc_get_gap_ack_blks()
1433 if (p->ugack_cnt) { in tipc_get_gap_ack_blks()
1434 p->bgack_cnt = 0; in tipc_get_gap_ack_blks()
1450 struct tipc_gap_ack *gacks = &ga->gacks[start_index]; in __tipc_build_gap_ack_blks()
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()
1463 gacks[n].gap = htons(seqno - expect); 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()
1484 /* tipc_build_gap_ack_blks - build Gap ACK blocks
1496 struct tipc_link *bcl = l->bc_rcvlink; in tipc_build_gap_ack_blks()
1503 tipc_bcast_lock(bcl->net); in tipc_build_gap_ack_blks()
1504 msg_set_bcast_ack(hdr, bcl->rcv_nxt - 1); in tipc_build_gap_ack_blks()
1506 ga->bgack_cnt = __tipc_build_gap_ack_blks(ga, bcl, 0); in tipc_build_gap_ack_blks()
1507 tipc_bcast_unlock(bcl->net); in tipc_build_gap_ack_blks()
1510 ga->ugack_cnt = (msg_seq_gap(hdr)) ? in tipc_build_gap_ack_blks()
1511 __tipc_build_gap_ack_blks(ga, l, ga->bgack_cnt) : 0; in tipc_build_gap_ack_blks()
1514 len = struct_size(ga, gacks, size_add(ga->bgack_cnt, ga->ugack_cnt)); in tipc_build_gap_ack_blks()
1515 ga->len = htons(len); in tipc_build_gap_ack_blks()
1519 /* tipc_link_advance_transmq - advance TIPC link transmq queue by releasing
1530 * happens (- unlikely case)
1540 struct tipc_gap_ack_blks *last_ga = r->last_ga, *this_ga = NULL; in tipc_link_advance_transmq()
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()
1549 u16 end = r->acked, start = end, offset = r->last_gap; in tipc_link_advance_transmq()
1550 u16 si = (last_ga) ? last_ga->start_index : 0; in tipc_link_advance_transmq()
1554 trace_tipc_link_retrans(r, acked + 1, acked + gap, &l->transmq); in tipc_link_advance_transmq()
1559 gack_cnt = ga->ugack_cnt; in tipc_link_advance_transmq()
1560 gacks = &ga->gacks[ga->bgack_cnt]; in tipc_link_advance_transmq()
1563 this_ga = kmemdup(ga, struct_size(ga, gacks, ga->bgack_cnt), in tipc_link_advance_transmq()
1566 this_ga->start_index = 0; in tipc_link_advance_transmq()
1568 gack_cnt = this_ga->bgack_cnt; in tipc_link_advance_transmq()
1569 gacks = &this_ga->gacks[0]; in tipc_link_advance_transmq()
1572 pr_warn_ratelimited("Ignoring bc Gap ACKs, no memory\n"); in tipc_link_advance_transmq()
1577 skb_queue_walk_safe(&l->transmq, skb, tmp) { in tipc_link_advance_transmq()
1585 if (!more(seqno, r->acked)) in tipc_link_advance_transmq()
1589 if (!last_ga || si >= last_ga->bgack_cnt) in tipc_link_advance_transmq()
1592 end = ntohs(last_ga->gacks[si].ack); in tipc_link_advance_transmq()
1593 offset = ntohs(last_ga->gacks[si].gap); in tipc_link_advance_transmq()
1597 si < last_ga->bgack_cnt) || in tipc_link_advance_transmq()
1601 last_ga->bgack_cnt); in tipc_link_advance_transmq()
1608 if (--TIPC_SKB_CB(skb)->ackers) in tipc_link_advance_transmq()
1612 __skb_unlink(skb, &l->transmq); in tipc_link_advance_transmq()
1624 if (time_before(jiffies, TIPC_SKB_CB(skb)->nxt_retr)) in tipc_link_advance_transmq()
1633 _skb->priority = TC_PRIO_CONTROL; in tipc_link_advance_transmq()
1635 l->stats.retransmitted++; in tipc_link_advance_transmq()
1637 r->stats.retransmitted++; in tipc_link_advance_transmq()
1640 if (!TIPC_SKB_CB(skb)->retr_cnt++) in tipc_link_advance_transmq()
1641 TIPC_SKB_CB(skb)->retr_stamp = jiffies; in tipc_link_advance_transmq()
1657 r->last_ga = this_ga; in tipc_link_advance_transmq()
1658 r->last_gap = gap; in tipc_link_advance_transmq()
1661 si--; in tipc_link_advance_transmq()
1662 offset = start - acked - 1; in tipc_link_advance_transmq()
1666 if (si < last_ga->bgack_cnt) { in tipc_link_advance_transmq()
1667 last_ga->start_index = si; in tipc_link_advance_transmq()
1668 r->last_gap = offset; in tipc_link_advance_transmq()
1671 r->last_ga = NULL; in tipc_link_advance_transmq()
1672 r->last_gap = 0; in tipc_link_advance_transmq()
1675 r->last_gap = 0; in tipc_link_advance_transmq()
1677 r->acked = acked; in tipc_link_advance_transmq()
1682 return qlen - skb_queue_len(&l->transmq); in tipc_link_advance_transmq()
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()
1719 if (l->state == LINK_ESTABLISHING) in tipc_link_build_reset_msg()
1726 if (skb && (l->state == LINK_RESET)) in tipc_link_build_reset_msg()
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()
1744 match2 = tipc_own_addr(l->net) & 0xf; in tipc_link_build_nack_msg()
1750 if (defq_len >= 3 && !((defq_len - 3) % 16)) { in tipc_link_build_nack_msg()
1751 u16 rcvgap = buf_seqno(skb_peek(dfq)) - l->rcv_nxt; in tipc_link_build_nack_msg()
1759 /* tipc_link_rcv - process TIPC packets/messages arriving from off-node
1767 struct sk_buff_head *defq = &l->deferdq; in tipc_link_rcv()
1778 l->silent_intv_cnt = 0; in tipc_link_rcv()
1783 rcv_nxt = l->rcv_nxt; in tipc_link_rcv()
1787 if (l->state == LINK_ESTABLISHING) in tipc_link_rcv()
1795 l->stats.duplicates++; in tipc_link_rcv()
1805 l->stats.duplicates++; 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()
1822 } while ((skb = __tipc_skb_dequeue(defq, l->rcv_nxt))); in tipc_link_rcv()
1828 if (unlikely(!skb_queue_empty(&l->wakeupq))) in tipc_link_rcv()
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()
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()
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()
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()
1912 bcl->stats.sent_nacks++; in tipc_link_build_proto_msg()
1913 skb->priority = TC_PRIO_CONTROL; in tipc_link_build_proto_msg()
1915 trace_tipc_proto_build(skb, false, l->name); in tipc_link_build_proto_msg()
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()
1938 msg_set_bearer_id(hdr, l->peer_bearer_id); in tipc_link_create_dummy_tnl_msg()
1954 struct sk_buff_head *fdefq = &tnl->failover_deferdq; in tipc_link_tnl_prepare()
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()
1973 if (mtyp == SYNCH_MSG && (tnl->peer_caps & TIPC_TUNNEL_ENHANCED)) { 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()
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()
2033 if (pktlen > tnl->mtu - INT_H_SIZE) { in tipc_link_tnl_prepare()
2035 (tnl->peer_caps & TIPC_TUNNEL_ENHANCED)) { in tipc_link_tnl_prepare()
2036 rc = tipc_msg_fragment(skb, &tnlhdr, tnl->mtu, 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()
2096 * tipc_link_failover_prepare() - prepare tnl for link failover
2098 * This is a special version of the precursor - tipc_link_tnl_prepare(),
2108 struct sk_buff_head *fdefq = &tnl->failover_deferdq; in tipc_link_failover_prepare()
2118 tnl->drop_point = 1; in tipc_link_failover_prepare()
2119 tnl->failover_reasm_skb = NULL; in tipc_link_failover_prepare()
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()
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()
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()
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()
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()
2231 /* Update own tolerance if peer indicates a non-zero value */ 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()
2240 /* If peer is going down we want full re-establish cycle */ in tipc_link_proto_rcv()
2246 /* If this endpoint was re-created while peer was ESTABLISHING in tipc_link_proto_rcv()
2247 * it doesn't know current session number. Force re-synch. 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()
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()
2277 l->rcv_nxt_state = msg_seqno(hdr) + 1; in tipc_link_proto_rcv()
2279 /* Update own tolerance if peer indicates a non-zero value */ 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()
2287 l->priority = peers_prio; 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()
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()
2309 skb_queue_empty(&l->deferdq)) in tipc_link_proto_rcv()
2310 rcvgap = peers_snd_nxt - l->rcv_nxt; in tipc_link_proto_rcv()
2318 l->stats.recv_nacks++; in tipc_link_proto_rcv()
2323 if (unlikely(!skb_queue_empty(&l->wakeupq))) in tipc_link_proto_rcv()
2331 /* tipc_link_build_bc_proto_msg() - create broadcast protocol message
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()
2359 /* tipc_link_build_bc_init_msg() - synchronize broadcast link endpoints.
2370 if (!tipc_link_build_bc_proto_msg(l->bc_rcvlink, false, 0, &list)) in tipc_link_build_bc_init_msg()
2376 /* tipc_link_bc_init_rcv - receive initial broadcast synch data from peer
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()
2403 /* tipc_link_bc_sync_rcv - update rcv link according to peer's send state
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()
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()
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()
2471 if (!tipc_link_is_up(r) || !r->bc_peer_is_up) in tipc_link_bc_ack_rcv()
2475 l->stats.recv_nacks++; in tipc_link_bc_ack_rcv()
2476 r->stats.recv_nacks++; in tipc_link_bc_ack_rcv()
2479 if (less(acked, r->acked) || (acked == r->acked && !gap && !ga)) in tipc_link_bc_ack_rcv()
2482 trace_tipc_link_bc_ack(r, acked, gap, &l->transmq); in tipc_link_bc_ack_rcv()
2486 if (unlikely(!skb_queue_empty(&l->wakeupq))) in tipc_link_bc_ack_rcv()
2494 * no BCAST_PROTOCOL/STATE messages occur from TIPC v2.5.
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()
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()
2546 * tipc_link_reset_stats - reset link statistics
2551 memset(&l->stats, 0, sizeof(l->stats)); in tipc_link_reset_stats()
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()
2561 pr_info("XMTQ: %u [%u-%u], BKLGQ: %u, SNDNX: %u, RCVNX: %u\n", 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()
2582 return -EINVAL; in tipc_nl_parse_link_prop()
2590 return -EINVAL; in tipc_nl_parse_link_prop()
2598 return -EINVAL; in tipc_nl_parse_link_prop()
2616 {TIPC_NLA_STATS_RX_FRAGMENTS, s->recv_fragments}, in __tipc_nl_add_stats()
2617 {TIPC_NLA_STATS_RX_FRAGMENTED, s->recv_fragmented}, in __tipc_nl_add_stats()
2618 {TIPC_NLA_STATS_RX_BUNDLES, s->recv_bundles}, in __tipc_nl_add_stats()
2619 {TIPC_NLA_STATS_RX_BUNDLED, s->recv_bundled}, in __tipc_nl_add_stats()
2621 {TIPC_NLA_STATS_TX_FRAGMENTS, s->sent_fragments}, in __tipc_nl_add_stats()
2622 {TIPC_NLA_STATS_TX_FRAGMENTED, s->sent_fragmented}, in __tipc_nl_add_stats()
2623 {TIPC_NLA_STATS_TX_BUNDLES, s->sent_bundles}, in __tipc_nl_add_stats()
2624 {TIPC_NLA_STATS_TX_BUNDLED, s->sent_bundled}, in __tipc_nl_add_stats()
2625 {TIPC_NLA_STATS_MSG_PROF_TOT, (s->msg_length_counts) ? in __tipc_nl_add_stats()
2626 s->msg_length_counts : 1}, in __tipc_nl_add_stats()
2627 {TIPC_NLA_STATS_MSG_LEN_CNT, s->msg_length_counts}, in __tipc_nl_add_stats()
2628 {TIPC_NLA_STATS_MSG_LEN_TOT, s->msg_lengths_total}, in __tipc_nl_add_stats()
2629 {TIPC_NLA_STATS_MSG_LEN_P0, s->msg_length_profile[0]}, in __tipc_nl_add_stats()
2630 {TIPC_NLA_STATS_MSG_LEN_P1, s->msg_length_profile[1]}, in __tipc_nl_add_stats()
2631 {TIPC_NLA_STATS_MSG_LEN_P2, s->msg_length_profile[2]}, in __tipc_nl_add_stats()
2632 {TIPC_NLA_STATS_MSG_LEN_P3, s->msg_length_profile[3]}, in __tipc_nl_add_stats()
2633 {TIPC_NLA_STATS_MSG_LEN_P4, s->msg_length_profile[4]}, in __tipc_nl_add_stats()
2634 {TIPC_NLA_STATS_MSG_LEN_P5, s->msg_length_profile[5]}, in __tipc_nl_add_stats()
2635 {TIPC_NLA_STATS_MSG_LEN_P6, s->msg_length_profile[6]}, in __tipc_nl_add_stats()
2636 {TIPC_NLA_STATS_RX_STATES, s->recv_states}, in __tipc_nl_add_stats()
2637 {TIPC_NLA_STATS_RX_PROBES, s->recv_probes}, in __tipc_nl_add_stats()
2638 {TIPC_NLA_STATS_RX_NACKS, s->recv_nacks}, in __tipc_nl_add_stats()
2639 {TIPC_NLA_STATS_RX_DEFERRED, s->deferred_recv}, in __tipc_nl_add_stats()
2640 {TIPC_NLA_STATS_TX_STATES, s->sent_states}, in __tipc_nl_add_stats()
2641 {TIPC_NLA_STATS_TX_PROBES, s->sent_probes}, in __tipc_nl_add_stats()
2642 {TIPC_NLA_STATS_TX_NACKS, s->sent_nacks}, in __tipc_nl_add_stats()
2643 {TIPC_NLA_STATS_TX_ACKS, s->sent_acks}, in __tipc_nl_add_stats()
2644 {TIPC_NLA_STATS_RETRANSMITTED, s->retransmitted}, in __tipc_nl_add_stats()
2645 {TIPC_NLA_STATS_DUPLICATES, s->duplicates}, in __tipc_nl_add_stats()
2646 {TIPC_NLA_STATS_LINK_CONGS, s->link_congs}, in __tipc_nl_add_stats()
2647 {TIPC_NLA_STATS_MAX_QUEUE, s->max_queue_sz}, in __tipc_nl_add_stats()
2648 {TIPC_NLA_STATS_AVG_QUEUE, s->queue_sz_counts ? in __tipc_nl_add_stats()
2649 (s->accu_queue_sz / s->queue_sz_counts) : 0} in __tipc_nl_add_stats()
2654 return -EMSGSIZE; in __tipc_nl_add_stats()
2666 return -EMSGSIZE; in __tipc_nl_add_stats()
2679 hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family, in __tipc_nl_add_link()
2682 return -EMSGSIZE; in __tipc_nl_add_link()
2684 attrs = nla_nest_start_noflag(msg->skb, TIPC_NLA_LINK); in __tipc_nl_add_link()
2688 if (nla_put_string(msg->skb, TIPC_NLA_LINK_NAME, link->name)) in __tipc_nl_add_link()
2690 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_DEST, tipc_cluster_mask(self))) in __tipc_nl_add_link()
2692 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_MTU, link->mtu)) in __tipc_nl_add_link()
2694 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_RX, link->stats.recv_pkts)) in __tipc_nl_add_link()
2696 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_TX, link->stats.sent_pkts)) in __tipc_nl_add_link()
2700 if (nla_put_flag(msg->skb, TIPC_NLA_LINK_UP)) in __tipc_nl_add_link()
2702 if (link->active) in __tipc_nl_add_link()
2703 if (nla_put_flag(msg->skb, TIPC_NLA_LINK_ACTIVE)) in __tipc_nl_add_link()
2706 prop = nla_nest_start_noflag(msg->skb, TIPC_NLA_LINK_PROP); in __tipc_nl_add_link()
2709 if (nla_put_u32(msg->skb, TIPC_NLA_PROP_PRIO, link->priority)) in __tipc_nl_add_link()
2711 if (nla_put_u32(msg->skb, TIPC_NLA_PROP_TOL, link->tolerance)) in __tipc_nl_add_link()
2713 if (nla_put_u32(msg->skb, TIPC_NLA_PROP_WIN, in __tipc_nl_add_link()
2714 link->window)) in __tipc_nl_add_link()
2716 if (nla_put_u32(msg->skb, TIPC_NLA_PROP_PRIO, link->priority)) in __tipc_nl_add_link()
2718 nla_nest_end(msg->skb, prop); in __tipc_nl_add_link()
2720 err = __tipc_nl_add_stats(msg->skb, &link->stats); in __tipc_nl_add_link()
2724 nla_nest_end(msg->skb, attrs); in __tipc_nl_add_link()
2725 genlmsg_end(msg->skb, hdr); in __tipc_nl_add_link()
2730 nla_nest_cancel(msg->skb, prop); in __tipc_nl_add_link()
2732 nla_nest_cancel(msg->skb, attrs); in __tipc_nl_add_link()
2734 genlmsg_cancel(msg->skb, hdr); in __tipc_nl_add_link()
2736 return -EMSGSIZE; in __tipc_nl_add_link()
2751 {TIPC_NLA_STATS_RX_INFO, stats->recv_pkts}, in __tipc_nl_add_bc_link_stat()
2752 {TIPC_NLA_STATS_RX_FRAGMENTS, stats->recv_fragments}, in __tipc_nl_add_bc_link_stat()
2753 {TIPC_NLA_STATS_RX_FRAGMENTED, stats->recv_fragmented}, in __tipc_nl_add_bc_link_stat()
2754 {TIPC_NLA_STATS_RX_BUNDLES, stats->recv_bundles}, in __tipc_nl_add_bc_link_stat()
2755 {TIPC_NLA_STATS_RX_BUNDLED, stats->recv_bundled}, in __tipc_nl_add_bc_link_stat()
2756 {TIPC_NLA_STATS_TX_INFO, stats->sent_pkts}, in __tipc_nl_add_bc_link_stat()
2757 {TIPC_NLA_STATS_TX_FRAGMENTS, stats->sent_fragments}, in __tipc_nl_add_bc_link_stat()
2758 {TIPC_NLA_STATS_TX_FRAGMENTED, stats->sent_fragmented}, in __tipc_nl_add_bc_link_stat()
2759 {TIPC_NLA_STATS_TX_BUNDLES, stats->sent_bundles}, in __tipc_nl_add_bc_link_stat()
2760 {TIPC_NLA_STATS_TX_BUNDLED, stats->sent_bundled}, in __tipc_nl_add_bc_link_stat()
2761 {TIPC_NLA_STATS_RX_NACKS, stats->recv_nacks}, in __tipc_nl_add_bc_link_stat()
2762 {TIPC_NLA_STATS_RX_DEFERRED, stats->deferred_recv}, in __tipc_nl_add_bc_link_stat()
2763 {TIPC_NLA_STATS_TX_NACKS, stats->sent_nacks}, in __tipc_nl_add_bc_link_stat()
2764 {TIPC_NLA_STATS_TX_ACKS, stats->sent_acks}, in __tipc_nl_add_bc_link_stat()
2765 {TIPC_NLA_STATS_RETRANSMITTED, stats->retransmitted}, in __tipc_nl_add_bc_link_stat()
2766 {TIPC_NLA_STATS_DUPLICATES, stats->duplicates}, in __tipc_nl_add_bc_link_stat()
2767 {TIPC_NLA_STATS_LINK_CONGS, stats->link_congs}, in __tipc_nl_add_bc_link_stat()
2768 {TIPC_NLA_STATS_MAX_QUEUE, stats->max_queue_sz}, in __tipc_nl_add_bc_link_stat()
2769 {TIPC_NLA_STATS_AVG_QUEUE, stats->queue_sz_counts ? in __tipc_nl_add_bc_link_stat()
2770 (stats->accu_queue_sz / stats->queue_sz_counts) : 0} in __tipc_nl_add_bc_link_stat()
2775 return -EMSGSIZE; in __tipc_nl_add_bc_link_stat()
2787 return -EMSGSIZE; in __tipc_nl_add_bc_link_stat()
2805 hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family, in tipc_nl_add_bc_link()
2809 return -EMSGSIZE; in tipc_nl_add_bc_link()
2812 attrs = nla_nest_start_noflag(msg->skb, TIPC_NLA_LINK); in tipc_nl_add_bc_link()
2817 if (nla_put_flag(msg->skb, TIPC_NLA_LINK_UP)) in tipc_nl_add_bc_link()
2820 if (nla_put_flag(msg->skb, TIPC_NLA_LINK_BROADCAST)) in tipc_nl_add_bc_link()
2822 if (nla_put_string(msg->skb, TIPC_NLA_LINK_NAME, bcl->name)) in tipc_nl_add_bc_link()
2824 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_RX, 0)) in tipc_nl_add_bc_link()
2826 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_TX, 0)) in tipc_nl_add_bc_link()
2829 prop = nla_nest_start_noflag(msg->skb, TIPC_NLA_LINK_PROP); in tipc_nl_add_bc_link()
2832 if (nla_put_u32(msg->skb, TIPC_NLA_PROP_WIN, bcl->max_win)) in tipc_nl_add_bc_link()
2834 if (nla_put_u32(msg->skb, TIPC_NLA_PROP_BROADCAST, bc_mode)) in tipc_nl_add_bc_link()
2837 if (nla_put_u32(msg->skb, TIPC_NLA_PROP_BROADCAST_RATIO, in tipc_nl_add_bc_link()
2840 nla_nest_end(msg->skb, prop); in tipc_nl_add_bc_link()
2842 err = __tipc_nl_add_bc_link_stat(msg->skb, &bcl->stats); in tipc_nl_add_bc_link()
2847 nla_nest_end(msg->skb, attrs); in tipc_nl_add_bc_link()
2848 genlmsg_end(msg->skb, hdr); in tipc_nl_add_bc_link()
2853 nla_nest_cancel(msg->skb, prop); in tipc_nl_add_bc_link()
2855 nla_nest_cancel(msg->skb, attrs); in tipc_nl_add_bc_link()
2858 genlmsg_cancel(msg->skb, hdr); in tipc_nl_add_bc_link()
2860 return -EMSGSIZE; in tipc_nl_add_bc_link()
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()
2876 l->priority = prio; in tipc_link_set_prio()
2882 l->abort_limit = limit; in tipc_link_set_abort_limit()
2886 * tipc_link_dump - dump TIPC link data
2889 * - TIPC_DUMP_NONE: don't dump link queues
2890 * - TIPC_DUMP_TRANSMQ: dump link transmq queue
2891 * - TIPC_DUMP_BACKLOGQ: dump link backlog queue
2892 * - TIPC_DUMP_DEFERDQ: dump link deferd queue
2893 * - TIPC_DUMP_INPUTQ: dump link input queue
2894 * - TIPC_DUMP_WAKEUP: dump link wakeup queue
2895 * - TIPC_DUMP_ALL: dump all the link queues above
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()
2923 i += scnprintf(buf + i, sz - i, " %u", 0); in tipc_link_dump()
2924 i += scnprintf(buf + i, sz - i, " %u", 0); 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()
2931 i += scnprintf(buf + i, sz - i, " | %u %u %u", len, in tipc_link_dump()
2935 list = &l->deferdq; in tipc_link_dump()
2939 i += scnprintf(buf + i, sz - i, " | %u %u %u", len, in tipc_link_dump()
2943 list = &l->backlogq; in tipc_link_dump()
2947 i += scnprintf(buf + i, sz - i, " | %u %u %u", len, in tipc_link_dump()
2951 list = l->inputq; in tipc_link_dump()
2955 i += scnprintf(buf + i, sz - i, " | %u %u %u\n", len, in tipc_link_dump()
2960 i += scnprintf(buf + i, sz - i, "transmq: "); in tipc_link_dump()
2961 i += tipc_list_dump(&l->transmq, false, buf + i); in tipc_link_dump()
2964 i += scnprintf(buf + i, sz - 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()
2974 i += scnprintf(buf + i, sz - i, "deferdq: "); in tipc_link_dump()
2975 i += tipc_list_dump(&l->deferdq, false, buf + i); in tipc_link_dump()
2978 i += scnprintf(buf + i, sz - i, "inputq: "); in tipc_link_dump()
2979 i += tipc_list_dump(l->inputq, false, buf + i); in tipc_link_dump()
2982 i += scnprintf(buf + i, sz - i, "wakeup: "); in tipc_link_dump()
2983 i += tipc_list_dump(&l->wakeupq, false, buf + i); in tipc_link_dump()