@@ -539,7 +539,7 @@ bool tipc_link_create(struct net *net, char *if_name, int bearer_id,
539539 *
540540 * Returns true if link was created, otherwise false
541541 */
542- bool tipc_link_bc_create (struct net * net , u32 ownnode , u32 peer ,
542+ bool tipc_link_bc_create (struct net * net , u32 ownnode , u32 peer , u8 * peer_id ,
543543 int mtu , u32 min_win , u32 max_win , u16 peer_caps ,
544544 struct sk_buff_head * inputq ,
545545 struct sk_buff_head * namedq ,
@@ -554,7 +554,18 @@ bool tipc_link_bc_create(struct net *net, u32 ownnode, u32 peer,
554554 return false;
555555
556556 l = * link ;
557- strcpy (l -> name , tipc_bclink_name );
557+ if (peer_id ) {
558+ char peer_str [NODE_ID_STR_LEN ] = {0 ,};
559+
560+ tipc_nodeid2string (peer_str , peer_id );
561+ if (strlen (peer_str ) > 16 )
562+ sprintf (peer_str , "%x" , peer );
563+ /* Broadcast receiver link name: "broadcast-link:<peer>" */
564+ snprintf (l -> name , sizeof (l -> name ), "%s:%s" , tipc_bclink_name ,
565+ peer_str );
566+ } else {
567+ strcpy (l -> name , tipc_bclink_name );
568+ }
558569 trace_tipc_link_reset (l , TIPC_DUMP_ALL , "bclink created!" );
559570 tipc_link_reset (l );
560571 l -> state = LINK_RESET ;
@@ -1412,11 +1423,8 @@ static u8 __tipc_build_gap_ack_blks(struct tipc_gap_ack_blks *ga,
14121423 gacks [n ].ack = htons (expect - 1 );
14131424 gacks [n ].gap = htons (seqno - expect );
14141425 if (++ n >= MAX_GAP_ACK_BLKS / 2 ) {
1415- char buf [TIPC_MAX_LINK_NAME ];
1416-
14171426 pr_info_ratelimited ("Gacks on %s: %d, ql: %d!\n" ,
1418- tipc_link_name_ext (l , buf ),
1419- n ,
1427+ l -> name , n ,
14201428 skb_queue_len (& l -> deferdq ));
14211429 return n ;
14221430 }
@@ -1587,6 +1595,8 @@ static int tipc_link_advance_transmq(struct tipc_link *l, struct tipc_link *r,
15871595 _skb -> priority = TC_PRIO_CONTROL ;
15881596 __skb_queue_tail (xmitq , _skb );
15891597 l -> stats .retransmitted ++ ;
1598+ if (!is_uc )
1599+ r -> stats .retransmitted ++ ;
15901600 * retransmitted = true;
15911601 /* Increase actual retrans counter & mark first time */
15921602 if (!TIPC_SKB_CB (skb )-> retr_cnt ++ )
@@ -1753,7 +1763,8 @@ int tipc_link_rcv(struct tipc_link *l, struct sk_buff *skb,
17531763
17541764 /* Defer delivery if sequence gap */
17551765 if (unlikely (seqno != rcv_nxt )) {
1756- __tipc_skb_queue_sorted (defq , seqno , skb );
1766+ if (!__tipc_skb_queue_sorted (defq , seqno , skb ))
1767+ l -> stats .duplicates ++ ;
17571768 rc |= tipc_link_build_nack_msg (l , xmitq );
17581769 break ;
17591770 }
@@ -1787,15 +1798,15 @@ static void tipc_link_build_proto_msg(struct tipc_link *l, int mtyp, bool probe,
17871798 int tolerance , int priority ,
17881799 struct sk_buff_head * xmitq )
17891800{
1801+ struct tipc_mon_state * mstate = & l -> mon_state ;
1802+ struct sk_buff_head * dfq = & l -> deferdq ;
17901803 struct tipc_link * bcl = l -> bc_rcvlink ;
1791- struct sk_buff * skb ;
17921804 struct tipc_msg * hdr ;
1793- struct sk_buff_head * dfq = & l -> deferdq ;
1805+ struct sk_buff * skb ;
17941806 bool node_up = link_is_up (bcl );
1795- struct tipc_mon_state * mstate = & l -> mon_state ;
1807+ u16 glen = 0 , bc_rcvgap = 0 ;
17961808 int dlen = 0 ;
17971809 void * data ;
1798- u16 glen = 0 ;
17991810
18001811 /* Don't send protocol message during reset or link failover */
18011812 if (tipc_link_is_blocked (l ))
@@ -1833,7 +1844,8 @@ static void tipc_link_build_proto_msg(struct tipc_link *l, int mtyp, bool probe,
18331844 if (l -> peer_caps & TIPC_LINK_PROTO_SEQNO )
18341845 msg_set_seqno (hdr , l -> snd_nxt_state ++ );
18351846 msg_set_seq_gap (hdr , rcvgap );
1836- msg_set_bc_gap (hdr , link_bc_rcv_gap (bcl ));
1847+ bc_rcvgap = link_bc_rcv_gap (bcl );
1848+ msg_set_bc_gap (hdr , bc_rcvgap );
18371849 msg_set_probe (hdr , probe );
18381850 msg_set_is_keepalive (hdr , probe || probe_reply );
18391851 if (l -> peer_caps & TIPC_GAP_ACK_BLOCK )
@@ -1858,6 +1870,8 @@ static void tipc_link_build_proto_msg(struct tipc_link *l, int mtyp, bool probe,
18581870 l -> stats .sent_probes ++ ;
18591871 if (rcvgap )
18601872 l -> stats .sent_nacks ++ ;
1873+ if (bc_rcvgap )
1874+ bcl -> stats .sent_nacks ++ ;
18611875 skb -> priority = TC_PRIO_CONTROL ;
18621876 __skb_queue_tail (xmitq , skb );
18631877 trace_tipc_proto_build (skb , false, l -> name );
@@ -2358,8 +2372,6 @@ int tipc_link_bc_sync_rcv(struct tipc_link *l, struct tipc_msg *hdr,
23582372 if (!l -> bc_peer_is_up )
23592373 return rc ;
23602374
2361- l -> stats .recv_nacks ++ ;
2362-
23632375 /* Ignore if peers_snd_nxt goes beyond receive window */
23642376 if (more (peers_snd_nxt , l -> rcv_nxt + l -> window ))
23652377 return rc ;
@@ -2410,6 +2422,11 @@ int tipc_link_bc_ack_rcv(struct tipc_link *r, u16 acked, u16 gap,
24102422 if (!link_is_up (r ) || !r -> bc_peer_is_up )
24112423 return 0 ;
24122424
2425+ if (gap ) {
2426+ l -> stats .recv_nacks ++ ;
2427+ r -> stats .recv_nacks ++ ;
2428+ }
2429+
24132430 if (less (acked , r -> acked ) || (acked == r -> acked && !gap && !ga ))
24142431 return 0 ;
24152432
@@ -2721,16 +2738,15 @@ static int __tipc_nl_add_bc_link_stat(struct sk_buff *skb,
27212738 return - EMSGSIZE ;
27222739}
27232740
2724- int tipc_nl_add_bc_link (struct net * net , struct tipc_nl_msg * msg )
2741+ int tipc_nl_add_bc_link (struct net * net , struct tipc_nl_msg * msg ,
2742+ struct tipc_link * bcl )
27252743{
27262744 int err ;
27272745 void * hdr ;
27282746 struct nlattr * attrs ;
27292747 struct nlattr * prop ;
2730- struct tipc_net * tn = net_generic (net , tipc_net_id );
27312748 u32 bc_mode = tipc_bcast_get_broadcast_mode (net );
27322749 u32 bc_ratio = tipc_bcast_get_broadcast_ratio (net );
2733- struct tipc_link * bcl = tn -> bcl ;
27342750
27352751 if (!bcl )
27362752 return 0 ;
@@ -2817,21 +2833,6 @@ void tipc_link_set_abort_limit(struct tipc_link *l, u32 limit)
28172833 l -> abort_limit = limit ;
28182834}
28192835
2820- char * tipc_link_name_ext (struct tipc_link * l , char * buf )
2821- {
2822- if (!l )
2823- scnprintf (buf , TIPC_MAX_LINK_NAME , "null" );
2824- else if (link_is_bc_sndlink (l ))
2825- scnprintf (buf , TIPC_MAX_LINK_NAME , "broadcast-sender" );
2826- else if (link_is_bc_rcvlink (l ))
2827- scnprintf (buf , TIPC_MAX_LINK_NAME ,
2828- "broadcast-receiver, peer %x" , l -> addr );
2829- else
2830- memcpy (buf , l -> name , TIPC_MAX_LINK_NAME );
2831-
2832- return buf ;
2833- }
2834-
28352836/**
28362837 * tipc_link_dump - dump TIPC link data
28372838 * @l: tipc link to be dumped
0 commit comments