11/*
22 * net/tipc/bcast.c: TIPC broadcast code
3- *
3+ *
44 * Copyright (c) 2004-2006, Ericsson AB
55 * Copyright (c) 2004, Intel Corporation.
66 * Copyright (c) 2005, Wind River Systems
5959 * Loss rate for incoming broadcast frames; used to test retransmission code.
6060 * Set to N to cause every N'th frame to be discarded; 0 => don't discard any.
6161 */
62-
62+
6363#define TIPC_BCAST_LOSS_RATE 0
6464
6565/**
6666 * struct bcbearer_pair - a pair of bearers used by broadcast link
6767 * @primary: pointer to primary bearer
6868 * @secondary: pointer to secondary bearer
69- *
70- * Bearers must have same priority and same set of reachable destinations
69+ *
70+ * Bearers must have same priority and same set of reachable destinations
7171 * to be paired.
7272 */
7373
@@ -84,7 +84,7 @@ struct bcbearer_pair {
8484 * @bpairs_temp: temporary array of bearer pairs used by tipc_bcbearer_sort()
8585 * @remains: temporary node map used by tipc_bcbearer_send()
8686 * @remains_new: temporary node map used tipc_bcbearer_send()
87- *
87+ *
8888 * Note: The fields labelled "temporary" are incorporated into the bearer
8989 * to avoid consuming potentially limited stack space through the use of
9090 * large local variables within multicast routines. Concurrent access is
@@ -104,7 +104,7 @@ struct bcbearer {
104104 * struct bclink - link used for broadcast messages
105105 * @link: (non-standard) broadcast link structure
106106 * @node: (non-standard) node structure representing b'cast link's peer node
107- *
107+ *
108108 * Handles sequence numbering, fragmentation, bundling, etc.
109109 */
110110
@@ -125,7 +125,7 @@ char tipc_bclink_name[] = "multicast-link";
125125static u32 buf_seqno (struct sk_buff * buf )
126126{
127127 return msg_seqno (buf_msg (buf ));
128- }
128+ }
129129
130130static u32 bcbuf_acks (struct sk_buff * buf )
131131{
@@ -143,9 +143,9 @@ static void bcbuf_decr_acks(struct sk_buff *buf)
143143}
144144
145145
146- /**
146+ /**
147147 * bclink_set_gap - set gap according to contents of current deferred pkt queue
148- *
148+ *
149149 * Called with 'node' locked, bc_lock unlocked
150150 */
151151
@@ -159,14 +159,14 @@ static void bclink_set_gap(struct node *n_ptr)
159159 n_ptr -> bclink .gap_to = mod (buf_seqno (buf ) - 1 );
160160}
161161
162- /**
162+ /**
163163 * bclink_ack_allowed - test if ACK or NACK message can be sent at this moment
164- *
164+ *
165165 * This mechanism endeavours to prevent all nodes in network from trying
166166 * to ACK or NACK at the same time.
167- *
167+ *
168168 * Note: TIPC uses a different trigger to distribute ACKs than it does to
169- * distribute NACKs, but tries to use the same spacing (divide by 16).
169+ * distribute NACKs, but tries to use the same spacing (divide by 16).
170170 */
171171
172172static int bclink_ack_allowed (u32 n )
@@ -175,11 +175,11 @@ static int bclink_ack_allowed(u32 n)
175175}
176176
177177
178- /**
178+ /**
179179 * bclink_retransmit_pkt - retransmit broadcast packets
180180 * @after: sequence number of last packet to *not* retransmit
181181 * @to: sequence number of last packet to retransmit
182- *
182+ *
183183 * Called with bc_lock locked
184184 */
185185
@@ -189,16 +189,16 @@ static void bclink_retransmit_pkt(u32 after, u32 to)
189189
190190 buf = bcl -> first_out ;
191191 while (buf && less_eq (buf_seqno (buf ), after )) {
192- buf = buf -> next ;
192+ buf = buf -> next ;
193193 }
194194 tipc_link_retransmit (bcl , buf , mod (to - after ));
195195}
196196
197- /**
197+ /**
198198 * tipc_bclink_acknowledge - handle acknowledgement of broadcast packets
199199 * @n_ptr: node that sent acknowledgement info
200200 * @acked: broadcast sequence # that has been acknowledged
201- *
201+ *
202202 * Node is locked, bc_lock unlocked.
203203 */
204204
@@ -244,9 +244,9 @@ void tipc_bclink_acknowledge(struct node *n_ptr, u32 acked)
244244 spin_unlock_bh (& bc_lock );
245245}
246246
247- /**
247+ /**
248248 * bclink_send_ack - unicast an ACK msg
249- *
249+ *
250250 * tipc_net_lock and node lock set
251251 */
252252
@@ -258,9 +258,9 @@ static void bclink_send_ack(struct node *n_ptr)
258258 tipc_link_send_proto_msg (l_ptr , STATE_MSG , 0 , 0 , 0 , 0 , 0 );
259259}
260260
261- /**
261+ /**
262262 * bclink_send_nack- broadcast a NACK msg
263- *
263+ *
264264 * tipc_net_lock and node lock set
265265 */
266266
@@ -278,7 +278,7 @@ static void bclink_send_nack(struct node *n_ptr)
278278 msg_init (msg , BCAST_PROTOCOL , STATE_MSG ,
279279 TIPC_OK , INT_H_SIZE , n_ptr -> addr );
280280 msg_set_mc_netid (msg , tipc_net_id );
281- msg_set_bcast_ack (msg , mod (n_ptr -> bclink .last_in ));
281+ msg_set_bcast_ack (msg , mod (n_ptr -> bclink .last_in ));
282282 msg_set_bcgap_after (msg , n_ptr -> bclink .gap_after );
283283 msg_set_bcgap_to (msg , n_ptr -> bclink .gap_to );
284284 msg_set_bcast_tag (msg , tipc_own_tag );
@@ -292,17 +292,17 @@ static void bclink_send_nack(struct node *n_ptr)
292292 bcl -> stats .bearer_congs ++ ;
293293 }
294294
295- /*
295+ /*
296296 * Ensure we doesn't send another NACK msg to the node
297297 * until 16 more deferred messages arrive from it
298298 * (i.e. helps prevent all nodes from NACK'ing at same time)
299299 */
300-
300+
301301 n_ptr -> bclink .nack_sync = tipc_own_tag ;
302302 }
303303}
304304
305- /**
305+ /**
306306 * tipc_bclink_check_gap - send a NACK if a sequence gap exists
307307 *
308308 * tipc_net_lock and node lock set
@@ -320,9 +320,9 @@ void tipc_bclink_check_gap(struct node *n_ptr, u32 last_sent)
320320 bclink_send_nack (n_ptr );
321321}
322322
323- /**
323+ /**
324324 * tipc_bclink_peek_nack - process a NACK msg meant for another node
325- *
325+ *
326326 * Only tipc_net_lock set.
327327 */
328328
@@ -349,7 +349,7 @@ static void tipc_bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 g
349349 if (less_eq (my_to , gap_to ))
350350 n_ptr -> bclink .gap_to = gap_after ;
351351 } else {
352- /*
352+ /*
353353 * Expand gap if missing bufs not in deferred queue:
354354 */
355355 struct sk_buff * buf = n_ptr -> bclink .deferred_head ;
@@ -371,7 +371,7 @@ static void tipc_bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 g
371371 }
372372 /*
373373 * Some nodes may send a complementary NACK now:
374- */
374+ */
375375 if (bclink_ack_allowed (sender_tag + 1 )) {
376376 if (n_ptr -> bclink .gap_to != n_ptr -> bclink .gap_after ) {
377377 bclink_send_nack (n_ptr );
@@ -408,7 +408,7 @@ int tipc_bclink_send_msg(struct sk_buff *buf)
408408
409409/**
410410 * tipc_bclink_recv_pkt - receive a broadcast packet, and deliver upwards
411- *
411+ *
412412 * tipc_net_lock is read_locked, no other locks set
413413 */
414414
@@ -425,7 +425,7 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf)
425425
426426 msg_dbg (msg , "<BC<<<" );
427427
428- if (unlikely (!node || !tipc_node_is_up (node ) || !node -> bclink .supported ||
428+ if (unlikely (!node || !tipc_node_is_up (node ) || !node -> bclink .supported ||
429429 (msg_mc_netid (msg ) != tipc_net_id ))) {
430430 buf_discard (buf );
431431 return ;
@@ -443,7 +443,7 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf)
443443 bclink_retransmit_pkt (msg_bcgap_after (msg ),
444444 msg_bcgap_to (msg ));
445445 bcl -> owner -> next = NULL ;
446- spin_unlock_bh (& bc_lock );
446+ spin_unlock_bh (& bc_lock );
447447 } else {
448448 tipc_bclink_peek_nack (msg_destnode (msg ),
449449 msg_bcast_tag (msg ),
@@ -547,10 +547,10 @@ u32 tipc_bclink_acks_missing(struct node *n_ptr)
547547
548548/**
549549 * tipc_bcbearer_send - send a packet through the broadcast pseudo-bearer
550- *
550+ *
551551 * Send through as many bearers as necessary to reach all nodes
552552 * that support TIPC multicasting.
553- *
553+ *
554554 * Returns 0 if packet sent successfully, non-zero if not
555555 */
556556
@@ -581,7 +581,7 @@ static int tipc_bcbearer_send(struct sk_buff *buf,
581581 send_count = 0 ;
582582
583583 /* Send buffer over bearers until all targets reached */
584-
584+
585585 bcbearer -> remains = tipc_cltr_bcast_nodes ;
586586
587587 for (bp_index = 0 ; bp_index < MAX_BEARERS ; bp_index ++ ) {
@@ -615,7 +615,7 @@ static int tipc_bcbearer_send(struct sk_buff *buf,
615615
616616 bcbearer -> remains = bcbearer -> remains_new ;
617617 }
618-
618+
619619 /* Unable to reach all targets */
620620
621621 bcbearer -> bearer .publ .blocked = 1 ;
@@ -682,7 +682,7 @@ void tipc_bcbearer_sort(void)
682682
683683/**
684684 * tipc_bcbearer_push - resolve bearer congestion
685- *
685+ *
686686 * Forces bclink to push out any unsent packets, until all packets are gone
687687 * or congestion reoccurs.
688688 * No locks set when function called
@@ -714,27 +714,27 @@ int tipc_bclink_stats(char *buf, const u32 buf_size)
714714 spin_lock_bh (& bc_lock );
715715
716716 tipc_printf (& pb , "Link <%s>\n"
717- " Window:%u packets\n" ,
717+ " Window:%u packets\n" ,
718718 bcl -> name , bcl -> queue_limit [0 ]);
719- tipc_printf (& pb , " RX packets:%u fragments:%u/%u bundles:%u/%u\n" ,
719+ tipc_printf (& pb , " RX packets:%u fragments:%u/%u bundles:%u/%u\n" ,
720720 bcl -> stats .recv_info ,
721721 bcl -> stats .recv_fragments ,
722722 bcl -> stats .recv_fragmented ,
723723 bcl -> stats .recv_bundles ,
724724 bcl -> stats .recv_bundled );
725- tipc_printf (& pb , " TX packets:%u fragments:%u/%u bundles:%u/%u\n" ,
725+ tipc_printf (& pb , " TX packets:%u fragments:%u/%u bundles:%u/%u\n" ,
726726 bcl -> stats .sent_info ,
727727 bcl -> stats .sent_fragments ,
728- bcl -> stats .sent_fragmented ,
728+ bcl -> stats .sent_fragmented ,
729729 bcl -> stats .sent_bundles ,
730730 bcl -> stats .sent_bundled );
731- tipc_printf (& pb , " RX naks:%u defs:%u dups:%u\n" ,
731+ tipc_printf (& pb , " RX naks:%u defs:%u dups:%u\n" ,
732732 bcl -> stats .recv_nacks ,
733- bcl -> stats .deferred_recv ,
733+ bcl -> stats .deferred_recv ,
734734 bcl -> stats .duplicates );
735- tipc_printf (& pb , " TX naks:%u acks:%u dups:%u\n" ,
736- bcl -> stats .sent_nacks ,
737- bcl -> stats .sent_acks ,
735+ tipc_printf (& pb , " TX naks:%u acks:%u dups:%u\n" ,
736+ bcl -> stats .sent_nacks ,
737+ bcl -> stats .sent_acks ,
738738 bcl -> stats .retransmitted );
739739 tipc_printf (& pb , " Congestion bearer:%u link:%u Send queue max:%u avg:%u\n" ,
740740 bcl -> stats .bearer_congs ,
@@ -778,7 +778,7 @@ int tipc_bclink_init(void)
778778 bclink = kzalloc (sizeof (* bclink ), GFP_ATOMIC );
779779 if (!bcbearer || !bclink ) {
780780 nomem :
781- warn ("Multicast link creation failed, no memory\n" );
781+ warn ("Multicast link creation failed, no memory\n" );
782782 kfree (bcbearer );
783783 bcbearer = NULL ;
784784 kfree (bclink );
@@ -796,7 +796,7 @@ int tipc_bclink_init(void)
796796 bcl -> next_out_no = 1 ;
797797 spin_lock_init (& bclink -> node .lock );
798798 bcl -> owner = & bclink -> node ;
799- bcl -> max_pkt = MAX_PKT_DEFAULT_MCAST ;
799+ bcl -> max_pkt = MAX_PKT_DEFAULT_MCAST ;
800800 tipc_link_set_queue_limits (bcl , BCLINK_WIN_DEFAULT );
801801 bcl -> b_ptr = & bcbearer -> bearer ;
802802 bcl -> state = WORKING_WORKING ;
0 commit comments