diff options
Diffstat (limited to 'net/tipc/bcast.c')
-rw-r--r-- | net/tipc/bcast.c | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 70ab5ef48766..7dc1dc7151ea 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (c) 2004-2006, Ericsson AB | 4 | * Copyright (c) 2004-2006, Ericsson AB |
5 | * Copyright (c) 2004, Intel Corporation. | 5 | * Copyright (c) 2004, Intel Corporation. |
6 | * Copyright (c) 2005, Wind River Systems | 6 | * Copyright (c) 2005, 2010-2011, Wind River Systems |
7 | * All rights reserved. | 7 | * All rights reserved. |
8 | * | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without |
@@ -61,8 +61,8 @@ | |||
61 | */ | 61 | */ |
62 | 62 | ||
63 | struct bcbearer_pair { | 63 | struct bcbearer_pair { |
64 | struct bearer *primary; | 64 | struct tipc_bearer *primary; |
65 | struct bearer *secondary; | 65 | struct tipc_bearer *secondary; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | /** | 68 | /** |
@@ -81,7 +81,7 @@ struct bcbearer_pair { | |||
81 | */ | 81 | */ |
82 | 82 | ||
83 | struct bcbearer { | 83 | struct bcbearer { |
84 | struct bearer bearer; | 84 | struct tipc_bearer bearer; |
85 | struct media media; | 85 | struct media media; |
86 | struct bcbearer_pair bpairs[MAX_BEARERS]; | 86 | struct bcbearer_pair bpairs[MAX_BEARERS]; |
87 | struct bcbearer_pair bpairs_temp[TIPC_MAX_LINK_PRI + 1]; | 87 | struct bcbearer_pair bpairs_temp[TIPC_MAX_LINK_PRI + 1]; |
@@ -93,6 +93,7 @@ struct bcbearer { | |||
93 | * struct bclink - link used for broadcast messages | 93 | * struct bclink - link used for broadcast messages |
94 | * @link: (non-standard) broadcast link structure | 94 | * @link: (non-standard) broadcast link structure |
95 | * @node: (non-standard) node structure representing b'cast link's peer node | 95 | * @node: (non-standard) node structure representing b'cast link's peer node |
96 | * @retransmit_to: node that most recently requested a retransmit | ||
96 | * | 97 | * |
97 | * Handles sequence numbering, fragmentation, bundling, etc. | 98 | * Handles sequence numbering, fragmentation, bundling, etc. |
98 | */ | 99 | */ |
@@ -100,6 +101,7 @@ struct bcbearer { | |||
100 | struct bclink { | 101 | struct bclink { |
101 | struct link link; | 102 | struct link link; |
102 | struct tipc_node node; | 103 | struct tipc_node node; |
104 | struct tipc_node *retransmit_to; | ||
103 | }; | 105 | }; |
104 | 106 | ||
105 | 107 | ||
@@ -184,6 +186,17 @@ static int bclink_ack_allowed(u32 n) | |||
184 | 186 | ||
185 | 187 | ||
186 | /** | 188 | /** |
189 | * tipc_bclink_retransmit_to - get most recent node to request retransmission | ||
190 | * | ||
191 | * Called with bc_lock locked | ||
192 | */ | ||
193 | |||
194 | struct tipc_node *tipc_bclink_retransmit_to(void) | ||
195 | { | ||
196 | return bclink->retransmit_to; | ||
197 | } | ||
198 | |||
199 | /** | ||
187 | * bclink_retransmit_pkt - retransmit broadcast packets | 200 | * bclink_retransmit_pkt - retransmit broadcast packets |
188 | * @after: sequence number of last packet to *not* retransmit | 201 | * @after: sequence number of last packet to *not* retransmit |
189 | * @to: sequence number of last packet to retransmit | 202 | * @to: sequence number of last packet to retransmit |
@@ -285,6 +298,7 @@ static void bclink_send_nack(struct tipc_node *n_ptr) | |||
285 | msg = buf_msg(buf); | 298 | msg = buf_msg(buf); |
286 | tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG, | 299 | tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG, |
287 | INT_H_SIZE, n_ptr->addr); | 300 | INT_H_SIZE, n_ptr->addr); |
301 | msg_set_non_seq(msg, 1); | ||
288 | msg_set_mc_netid(msg, tipc_net_id); | 302 | msg_set_mc_netid(msg, tipc_net_id); |
289 | msg_set_bcast_ack(msg, mod(n_ptr->bclink.last_in)); | 303 | msg_set_bcast_ack(msg, mod(n_ptr->bclink.last_in)); |
290 | msg_set_bcgap_after(msg, n_ptr->bclink.gap_after); | 304 | msg_set_bcgap_after(msg, n_ptr->bclink.gap_after); |
@@ -405,8 +419,6 @@ int tipc_bclink_send_msg(struct sk_buff *buf) | |||
405 | else | 419 | else |
406 | bclink_set_last_sent(); | 420 | bclink_set_last_sent(); |
407 | 421 | ||
408 | if (bcl->out_queue_size > bcl->stats.max_queue_sz) | ||
409 | bcl->stats.max_queue_sz = bcl->out_queue_size; | ||
410 | bcl->stats.queue_sz_counts++; | 422 | bcl->stats.queue_sz_counts++; |
411 | bcl->stats.accu_queue_sz += bcl->out_queue_size; | 423 | bcl->stats.accu_queue_sz += bcl->out_queue_size; |
412 | 424 | ||
@@ -444,10 +456,9 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf) | |||
444 | tipc_node_unlock(node); | 456 | tipc_node_unlock(node); |
445 | spin_lock_bh(&bc_lock); | 457 | spin_lock_bh(&bc_lock); |
446 | bcl->stats.recv_nacks++; | 458 | bcl->stats.recv_nacks++; |
447 | bcl->owner->next = node; /* remember requestor */ | 459 | bclink->retransmit_to = node; |
448 | bclink_retransmit_pkt(msg_bcgap_after(msg), | 460 | bclink_retransmit_pkt(msg_bcgap_after(msg), |
449 | msg_bcgap_to(msg)); | 461 | msg_bcgap_to(msg)); |
450 | bcl->owner->next = NULL; | ||
451 | spin_unlock_bh(&bc_lock); | 462 | spin_unlock_bh(&bc_lock); |
452 | } else { | 463 | } else { |
453 | tipc_bclink_peek_nack(msg_destnode(msg), | 464 | tipc_bclink_peek_nack(msg_destnode(msg), |
@@ -574,8 +585,8 @@ static int tipc_bcbearer_send(struct sk_buff *buf, | |||
574 | bcbearer->remains = tipc_bcast_nmap; | 585 | bcbearer->remains = tipc_bcast_nmap; |
575 | 586 | ||
576 | for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { | 587 | for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { |
577 | struct bearer *p = bcbearer->bpairs[bp_index].primary; | 588 | struct tipc_bearer *p = bcbearer->bpairs[bp_index].primary; |
578 | struct bearer *s = bcbearer->bpairs[bp_index].secondary; | 589 | struct tipc_bearer *s = bcbearer->bpairs[bp_index].secondary; |
579 | 590 | ||
580 | if (!p) | 591 | if (!p) |
581 | break; /* no more bearers to try */ | 592 | break; /* no more bearers to try */ |
@@ -584,11 +595,11 @@ static int tipc_bcbearer_send(struct sk_buff *buf, | |||
584 | if (bcbearer->remains_new.count == bcbearer->remains.count) | 595 | if (bcbearer->remains_new.count == bcbearer->remains.count) |
585 | continue; /* bearer pair doesn't add anything */ | 596 | continue; /* bearer pair doesn't add anything */ |
586 | 597 | ||
587 | if (p->publ.blocked || | 598 | if (p->blocked || |
588 | p->media->send_msg(buf, &p->publ, &p->media->bcast_addr)) { | 599 | p->media->send_msg(buf, p, &p->media->bcast_addr)) { |
589 | /* unable to send on primary bearer */ | 600 | /* unable to send on primary bearer */ |
590 | if (!s || s->publ.blocked || | 601 | if (!s || s->blocked || |
591 | s->media->send_msg(buf, &s->publ, | 602 | s->media->send_msg(buf, s, |
592 | &s->media->bcast_addr)) { | 603 | &s->media->bcast_addr)) { |
593 | /* unable to send on either bearer */ | 604 | /* unable to send on either bearer */ |
594 | continue; | 605 | continue; |
@@ -633,7 +644,7 @@ void tipc_bcbearer_sort(void) | |||
633 | memset(bp_temp, 0, sizeof(bcbearer->bpairs_temp)); | 644 | memset(bp_temp, 0, sizeof(bcbearer->bpairs_temp)); |
634 | 645 | ||
635 | for (b_index = 0; b_index < MAX_BEARERS; b_index++) { | 646 | for (b_index = 0; b_index < MAX_BEARERS; b_index++) { |
636 | struct bearer *b = &tipc_bearers[b_index]; | 647 | struct tipc_bearer *b = &tipc_bearers[b_index]; |
637 | 648 | ||
638 | if (!b->active || !b->nodes.count) | 649 | if (!b->active || !b->nodes.count) |
639 | continue; | 650 | continue; |
@@ -682,12 +693,12 @@ void tipc_bcbearer_sort(void) | |||
682 | 693 | ||
683 | void tipc_bcbearer_push(void) | 694 | void tipc_bcbearer_push(void) |
684 | { | 695 | { |
685 | struct bearer *b_ptr; | 696 | struct tipc_bearer *b_ptr; |
686 | 697 | ||
687 | spin_lock_bh(&bc_lock); | 698 | spin_lock_bh(&bc_lock); |
688 | b_ptr = &bcbearer->bearer; | 699 | b_ptr = &bcbearer->bearer; |
689 | if (b_ptr->publ.blocked) { | 700 | if (b_ptr->blocked) { |
690 | b_ptr->publ.blocked = 0; | 701 | b_ptr->blocked = 0; |
691 | tipc_bearer_lock_push(b_ptr); | 702 | tipc_bearer_lock_push(b_ptr); |
692 | } | 703 | } |
693 | spin_unlock_bh(&bc_lock); | 704 | spin_unlock_bh(&bc_lock); |