@@ -193,60 +193,30 @@ int tipc_link_is_active(struct tipc_link *l)
193
193
194
194
/**
195
195
* link_timeout - handle expiration of link timer
196
- * @l_ptr: pointer to link
197
196
*/
198
197
static void link_timeout (unsigned long data )
199
198
{
200
- struct tipc_link * l_ptr = (struct tipc_link * )data ;
199
+ struct tipc_link * l = (struct tipc_link * )data ;
200
+ struct sk_buff_head xmitq ;
201
201
struct sk_buff * skb ;
202
+ int rc ;
202
203
203
- tipc_node_lock ( l_ptr -> owner );
204
+ __skb_queue_head_init ( & xmitq );
204
205
205
- /* update counters used in statistical profiling of send traffic */
206
- l_ptr -> stats .accu_queue_sz += skb_queue_len (& l_ptr -> transmq );
207
- l_ptr -> stats .queue_sz_counts ++ ;
206
+ tipc_node_lock (l -> owner );
208
207
209
- skb = skb_peek (& l_ptr -> transmq );
210
- if (skb ) {
211
- struct tipc_msg * msg = buf_msg (skb );
212
- u32 length = msg_size (msg );
213
-
214
- if ((msg_user (msg ) == MSG_FRAGMENTER ) &&
215
- (msg_type (msg ) == FIRST_FRAGMENT )) {
216
- length = msg_size (msg_get_wrapped (msg ));
217
- }
218
- if (length ) {
219
- l_ptr -> stats .msg_lengths_total += length ;
220
- l_ptr -> stats .msg_length_counts ++ ;
221
- if (length <= 64 )
222
- l_ptr -> stats .msg_length_profile [0 ]++ ;
223
- else if (length <= 256 )
224
- l_ptr -> stats .msg_length_profile [1 ]++ ;
225
- else if (length <= 1024 )
226
- l_ptr -> stats .msg_length_profile [2 ]++ ;
227
- else if (length <= 4096 )
228
- l_ptr -> stats .msg_length_profile [3 ]++ ;
229
- else if (length <= 16384 )
230
- l_ptr -> stats .msg_length_profile [4 ]++ ;
231
- else if (length <= 32768 )
232
- l_ptr -> stats .msg_length_profile [5 ]++ ;
233
- else
234
- l_ptr -> stats .msg_length_profile [6 ]++ ;
235
- }
236
- }
208
+ rc = tipc_link_timeout (l , & xmitq );
237
209
238
- /* do all other link processing performed on a periodic basis */
239
- if (l_ptr -> silent_intv_cnt )
240
- link_state_event (l_ptr , SILENCE_EVT );
241
- else if (link_working (l_ptr ) && tipc_bclink_acks_missing (l_ptr -> owner ))
242
- tipc_link_proto_xmit (l_ptr , STATE_MSG , 0 , 0 , 0 , 0 );
210
+ if (rc & TIPC_LINK_DOWN_EVT )
211
+ tipc_link_reset (l );
243
212
244
- l_ptr -> silent_intv_cnt ++ ;
245
- if (skb_queue_len (& l_ptr -> backlogq ))
246
- tipc_link_push_packets (l_ptr );
247
- link_set_timer (l_ptr , l_ptr -> keepalive_intv );
248
- tipc_node_unlock (l_ptr -> owner );
249
- tipc_link_put (l_ptr );
213
+ skb = __skb_dequeue (& xmitq );
214
+ if (skb )
215
+ tipc_bearer_send (l -> owner -> net , l -> bearer_id ,
216
+ skb , & l -> media_addr );
217
+ link_set_timer (l , l -> keepalive_intv );
218
+ tipc_node_unlock (l -> owner );
219
+ tipc_link_put (l );
250
220
}
251
221
252
222
static void link_set_timer (struct tipc_link * link , unsigned long time )
@@ -499,6 +469,62 @@ static int tipc_link_fsm_evt(struct tipc_link *l, int evt,
499
469
return rc ;
500
470
}
501
471
472
+ /* link_profile_stats - update statistical profiling of traffic
473
+ */
474
+ static void link_profile_stats (struct tipc_link * l )
475
+ {
476
+ struct sk_buff * skb ;
477
+ struct tipc_msg * msg ;
478
+ int length ;
479
+
480
+ /* Update counters used in statistical profiling of send traffic */
481
+ l -> stats .accu_queue_sz += skb_queue_len (& l -> transmq );
482
+ l -> stats .queue_sz_counts ++ ;
483
+
484
+ skb = skb_peek (& l -> transmq );
485
+ if (!skb )
486
+ return ;
487
+ msg = buf_msg (skb );
488
+ length = msg_size (msg );
489
+
490
+ if (msg_user (msg ) == MSG_FRAGMENTER ) {
491
+ if (msg_type (msg ) != FIRST_FRAGMENT )
492
+ return ;
493
+ length = msg_size (msg_get_wrapped (msg ));
494
+ }
495
+ l -> stats .msg_lengths_total += length ;
496
+ l -> stats .msg_length_counts ++ ;
497
+ if (length <= 64 )
498
+ l -> stats .msg_length_profile [0 ]++ ;
499
+ else if (length <= 256 )
500
+ l -> stats .msg_length_profile [1 ]++ ;
501
+ else if (length <= 1024 )
502
+ l -> stats .msg_length_profile [2 ]++ ;
503
+ else if (length <= 4096 )
504
+ l -> stats .msg_length_profile [3 ]++ ;
505
+ else if (length <= 16384 )
506
+ l -> stats .msg_length_profile [4 ]++ ;
507
+ else if (length <= 32768 )
508
+ l -> stats .msg_length_profile [5 ]++ ;
509
+ else
510
+ l -> stats .msg_length_profile [6 ]++ ;
511
+ }
512
+
513
+ /* tipc_link_timeout - perform periodic task as instructed from node timeout
514
+ */
515
+ int tipc_link_timeout (struct tipc_link * l , struct sk_buff_head * xmitq )
516
+ {
517
+ int rc = 0 ;
518
+
519
+ link_profile_stats (l );
520
+ if (l -> silent_intv_cnt )
521
+ rc = tipc_link_fsm_evt (l , SILENCE_EVT , xmitq );
522
+ else if (link_working (l ) && tipc_bclink_acks_missing (l -> owner ))
523
+ tipc_link_build_proto_msg (l , STATE_MSG , 0 , 0 , 0 , 0 , xmitq );
524
+ l -> silent_intv_cnt ++ ;
525
+ return rc ;
526
+ }
527
+
502
528
/**
503
529
* link_schedule_user - schedule a message sender for wakeup after congestion
504
530
* @link: congested link
0 commit comments