aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/bcast.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-23 14:47:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-23 14:47:02 -0400
commit5f05647dd81c11a6a165ccc8f0c1370b16f3bcb0 (patch)
tree7851ef1c93aa1aba7ef327ca4b75fd35e6d10f29 /net/tipc/bcast.c
parent02f36038c568111ad4fc433f6fa760ff5e38fab4 (diff)
parentec37a48d1d16c30b655ac5280209edf52a6775d4 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1699 commits) bnx2/bnx2x: Unsupported Ethtool operations should return -EINVAL. vlan: Calling vlan_hwaccel_do_receive() is always valid. tproxy: use the interface primary IP address as a default value for --on-ip tproxy: added IPv6 support to the socket match cxgb3: function namespace cleanup tproxy: added IPv6 support to the TPROXY target tproxy: added IPv6 socket lookup function to nf_tproxy_core be2net: Changes to use only priority codes allowed by f/w tproxy: allow non-local binds of IPv6 sockets if IP_TRANSPARENT is enabled tproxy: added tproxy sockopt interface in the IPV6 layer tproxy: added udp6_lib_lookup function tproxy: added const specifiers to udp lookup functions tproxy: split off ipv6 defragmentation to a separate module l2tp: small cleanup nf_nat: restrict ICMP translation for embedded header can: mcp251x: fix generation of error frames can: mcp251x: fix endless loop in interrupt handler if CANINTF_MERRF is set can-raw: add msg_flags to distinguish local traffic 9p: client code cleanup rds: make local functions/variables static ... Fix up conflicts in net/core/dev.c, drivers/net/pcmcia/smc91c92_cs.c and drivers/net/wireless/ath/ath9k/debug.c as per David
Diffstat (limited to 'net/tipc/bcast.c')
-rw-r--r--net/tipc/bcast.c51
1 files changed, 32 insertions, 19 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index a008c6689305..22a60fc98392 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -121,6 +121,9 @@ static DEFINE_SPINLOCK(bc_lock);
121 121
122const char tipc_bclink_name[] = "broadcast-link"; 122const char tipc_bclink_name[] = "broadcast-link";
123 123
124static void tipc_nmap_diff(struct tipc_node_map *nm_a,
125 struct tipc_node_map *nm_b,
126 struct tipc_node_map *nm_diff);
124 127
125static u32 buf_seqno(struct sk_buff *buf) 128static u32 buf_seqno(struct sk_buff *buf)
126{ 129{
@@ -143,6 +146,19 @@ static void bcbuf_decr_acks(struct sk_buff *buf)
143} 146}
144 147
145 148
149static void bclink_set_last_sent(void)
150{
151 if (bcl->next_out)
152 bcl->fsm_msg_cnt = mod(buf_seqno(bcl->next_out) - 1);
153 else
154 bcl->fsm_msg_cnt = mod(bcl->next_out_no - 1);
155}
156
157u32 tipc_bclink_get_last_sent(void)
158{
159 return bcl->fsm_msg_cnt;
160}
161
146/** 162/**
147 * bclink_set_gap - set gap according to contents of current deferred pkt queue 163 * bclink_set_gap - set gap according to contents of current deferred pkt queue
148 * 164 *
@@ -171,7 +187,7 @@ static void bclink_set_gap(struct tipc_node *n_ptr)
171 187
172static int bclink_ack_allowed(u32 n) 188static int bclink_ack_allowed(u32 n)
173{ 189{
174 return((n % TIPC_MIN_LINK_WIN) == tipc_own_tag); 190 return (n % TIPC_MIN_LINK_WIN) == tipc_own_tag;
175} 191}
176 192
177 193
@@ -237,8 +253,10 @@ void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked)
237 253
238 /* Try resolving broadcast link congestion, if necessary */ 254 /* Try resolving broadcast link congestion, if necessary */
239 255
240 if (unlikely(bcl->next_out)) 256 if (unlikely(bcl->next_out)) {
241 tipc_link_push_queue(bcl); 257 tipc_link_push_queue(bcl);
258 bclink_set_last_sent();
259 }
242 if (unlikely(released && !list_empty(&bcl->waiting_ports))) 260 if (unlikely(released && !list_empty(&bcl->waiting_ports)))
243 tipc_link_wakeup_ports(bcl, 0); 261 tipc_link_wakeup_ports(bcl, 0);
244 spin_unlock_bh(&bc_lock); 262 spin_unlock_bh(&bc_lock);
@@ -272,7 +290,7 @@ static void bclink_send_nack(struct tipc_node *n_ptr)
272 if (!less(n_ptr->bclink.gap_after, n_ptr->bclink.gap_to)) 290 if (!less(n_ptr->bclink.gap_after, n_ptr->bclink.gap_to))
273 return; 291 return;
274 292
275 buf = buf_acquire(INT_H_SIZE); 293 buf = tipc_buf_acquire(INT_H_SIZE);
276 if (buf) { 294 if (buf) {
277 msg = buf_msg(buf); 295 msg = buf_msg(buf);
278 tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG, 296 tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG,
@@ -395,7 +413,7 @@ int tipc_bclink_send_msg(struct sk_buff *buf)
395 if (unlikely(res == -ELINKCONG)) 413 if (unlikely(res == -ELINKCONG))
396 buf_discard(buf); 414 buf_discard(buf);
397 else 415 else
398 bcl->stats.sent_info++; 416 bclink_set_last_sent();
399 417
400 if (bcl->out_queue_size > bcl->stats.max_queue_sz) 418 if (bcl->out_queue_size > bcl->stats.max_queue_sz)
401 bcl->stats.max_queue_sz = bcl->out_queue_size; 419 bcl->stats.max_queue_sz = bcl->out_queue_size;
@@ -529,15 +547,6 @@ receive:
529 tipc_node_unlock(node); 547 tipc_node_unlock(node);
530} 548}
531 549
532u32 tipc_bclink_get_last_sent(void)
533{
534 u32 last_sent = mod(bcl->next_out_no - 1);
535
536 if (bcl->next_out)
537 last_sent = mod(buf_seqno(bcl->next_out) - 1);
538 return last_sent;
539}
540
541u32 tipc_bclink_acks_missing(struct tipc_node *n_ptr) 550u32 tipc_bclink_acks_missing(struct tipc_node *n_ptr)
542{ 551{
543 return (n_ptr->bclink.supported && 552 return (n_ptr->bclink.supported &&
@@ -570,6 +579,7 @@ static int tipc_bcbearer_send(struct sk_buff *buf,
570 msg = buf_msg(buf); 579 msg = buf_msg(buf);
571 msg_set_non_seq(msg, 1); 580 msg_set_non_seq(msg, 1);
572 msg_set_mc_netid(msg, tipc_net_id); 581 msg_set_mc_netid(msg, tipc_net_id);
582 bcl->stats.sent_info++;
573 } 583 }
574 584
575 /* Send buffer over bearers until all targets reached */ 585 /* Send buffer over bearers until all targets reached */
@@ -609,11 +619,13 @@ static int tipc_bcbearer_send(struct sk_buff *buf,
609 bcbearer->remains = bcbearer->remains_new; 619 bcbearer->remains = bcbearer->remains_new;
610 } 620 }
611 621
612 /* Unable to reach all targets */ 622 /*
623 * Unable to reach all targets (indicate success, since currently
624 * there isn't code in place to properly block & unblock the
625 * pseudo-bearer used by the broadcast link)
626 */
613 627
614 bcbearer->bearer.publ.blocked = 1; 628 return TIPC_OK;
615 bcl->stats.bearer_congs++;
616 return 1;
617} 629}
618 630
619/** 631/**
@@ -862,8 +874,9 @@ void tipc_nmap_remove(struct tipc_node_map *nm_ptr, u32 node)
862 * @nm_diff: output node map A-B (i.e. nodes of A that are not in B) 874 * @nm_diff: output node map A-B (i.e. nodes of A that are not in B)
863 */ 875 */
864 876
865void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b, 877static void tipc_nmap_diff(struct tipc_node_map *nm_a,
866 struct tipc_node_map *nm_diff) 878 struct tipc_node_map *nm_b,
879 struct tipc_node_map *nm_diff)
867{ 880{
868 int stop = ARRAY_SIZE(nm_a->map); 881 int stop = ARRAY_SIZE(nm_a->map);
869 int w; 882 int w;