diff options
author | Patrick McHardy <kaber@trash.net> | 2011-01-14 08:12:37 -0500 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2011-01-14 08:12:37 -0500 |
commit | 0134e89c7bcc9fde1da962c82a120691e185619f (patch) | |
tree | 3e03335cf001019a2687d161e956de4f73379984 /net/tipc/bcast.c | |
parent | c7066f70d9610df0b9406cc635fc09e86136e714 (diff) | |
parent | 6faee60a4e82075853a437831768cc9e2e563e4e (diff) |
Merge branch 'master' of git://1984.lsi.us.es/net-next-2.6
Conflicts:
net/ipv4/route.c
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/tipc/bcast.c')
-rw-r--r-- | net/tipc/bcast.c | 50 |
1 files changed, 13 insertions, 37 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 22a60fc98392..70ab5ef48766 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c | |||
@@ -36,25 +36,14 @@ | |||
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include "core.h" | 38 | #include "core.h" |
39 | #include "msg.h" | ||
40 | #include "dbg.h" | ||
41 | #include "link.h" | 39 | #include "link.h" |
42 | #include "net.h" | ||
43 | #include "node.h" | ||
44 | #include "port.h" | 40 | #include "port.h" |
45 | #include "addr.h" | ||
46 | #include "node_subscr.h" | ||
47 | #include "name_distr.h" | ||
48 | #include "bearer.h" | ||
49 | #include "name_table.h" | ||
50 | #include "bcast.h" | 41 | #include "bcast.h" |
51 | 42 | ||
52 | #define MAX_PKT_DEFAULT_MCAST 1500 /* bcast link max packet size (fixed) */ | 43 | #define MAX_PKT_DEFAULT_MCAST 1500 /* bcast link max packet size (fixed) */ |
53 | 44 | ||
54 | #define BCLINK_WIN_DEFAULT 20 /* bcast link window size (default) */ | 45 | #define BCLINK_WIN_DEFAULT 20 /* bcast link window size (default) */ |
55 | 46 | ||
56 | #define BCLINK_LOG_BUF_SIZE 0 | ||
57 | |||
58 | /* | 47 | /* |
59 | * Loss rate for incoming broadcast frames; used to test retransmission code. | 48 | * Loss rate for incoming broadcast frames; used to test retransmission code. |
60 | * Set to N to cause every N'th frame to be discarded; 0 => don't discard any. | 49 | * Set to N to cause every N'th frame to be discarded; 0 => don't discard any. |
@@ -114,11 +103,14 @@ struct bclink { | |||
114 | }; | 103 | }; |
115 | 104 | ||
116 | 105 | ||
117 | static struct bcbearer *bcbearer = NULL; | 106 | static struct bcbearer *bcbearer; |
118 | static struct bclink *bclink = NULL; | 107 | static struct bclink *bclink; |
119 | static struct link *bcl = NULL; | 108 | static struct link *bcl; |
120 | static DEFINE_SPINLOCK(bc_lock); | 109 | static DEFINE_SPINLOCK(bc_lock); |
121 | 110 | ||
111 | /* broadcast-capable node map */ | ||
112 | struct tipc_node_map tipc_bcast_nmap; | ||
113 | |||
122 | const char tipc_bclink_name[] = "broadcast-link"; | 114 | const char tipc_bclink_name[] = "broadcast-link"; |
123 | 115 | ||
124 | static void tipc_nmap_diff(struct tipc_node_map *nm_a, | 116 | static void tipc_nmap_diff(struct tipc_node_map *nm_a, |
@@ -204,9 +196,8 @@ static void bclink_retransmit_pkt(u32 after, u32 to) | |||
204 | struct sk_buff *buf; | 196 | struct sk_buff *buf; |
205 | 197 | ||
206 | buf = bcl->first_out; | 198 | buf = bcl->first_out; |
207 | while (buf && less_eq(buf_seqno(buf), after)) { | 199 | while (buf && less_eq(buf_seqno(buf), after)) |
208 | buf = buf->next; | 200 | buf = buf->next; |
209 | } | ||
210 | tipc_link_retransmit(bcl, buf, mod(to - after)); | 201 | tipc_link_retransmit(bcl, buf, mod(to - after)); |
211 | } | 202 | } |
212 | 203 | ||
@@ -232,9 +223,8 @@ void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked) | |||
232 | /* Skip over packets that node has previously acknowledged */ | 223 | /* Skip over packets that node has previously acknowledged */ |
233 | 224 | ||
234 | crs = bcl->first_out; | 225 | crs = bcl->first_out; |
235 | while (crs && less_eq(buf_seqno(crs), n_ptr->bclink.acked)) { | 226 | while (crs && less_eq(buf_seqno(crs), n_ptr->bclink.acked)) |
236 | crs = crs->next; | 227 | crs = crs->next; |
237 | } | ||
238 | 228 | ||
239 | /* Update packets that node is now acknowledging */ | 229 | /* Update packets that node is now acknowledging */ |
240 | 230 | ||
@@ -433,16 +423,14 @@ int tipc_bclink_send_msg(struct sk_buff *buf) | |||
433 | void tipc_bclink_recv_pkt(struct sk_buff *buf) | 423 | void tipc_bclink_recv_pkt(struct sk_buff *buf) |
434 | { | 424 | { |
435 | #if (TIPC_BCAST_LOSS_RATE) | 425 | #if (TIPC_BCAST_LOSS_RATE) |
436 | static int rx_count = 0; | 426 | static int rx_count; |
437 | #endif | 427 | #endif |
438 | struct tipc_msg *msg = buf_msg(buf); | 428 | struct tipc_msg *msg = buf_msg(buf); |
439 | struct tipc_node* node = tipc_node_find(msg_prevnode(msg)); | 429 | struct tipc_node *node = tipc_node_find(msg_prevnode(msg)); |
440 | u32 next_in; | 430 | u32 next_in; |
441 | u32 seqno; | 431 | u32 seqno; |
442 | struct sk_buff *deferred; | 432 | struct sk_buff *deferred; |
443 | 433 | ||
444 | msg_dbg(msg, "<BC<<<"); | ||
445 | |||
446 | if (unlikely(!node || !tipc_node_is_up(node) || !node->bclink.supported || | 434 | if (unlikely(!node || !tipc_node_is_up(node) || !node->bclink.supported || |
447 | (msg_mc_netid(msg) != tipc_net_id))) { | 435 | (msg_mc_netid(msg) != tipc_net_id))) { |
448 | buf_discard(buf); | 436 | buf_discard(buf); |
@@ -450,7 +438,6 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf) | |||
450 | } | 438 | } |
451 | 439 | ||
452 | if (unlikely(msg_user(msg) == BCAST_PROTOCOL)) { | 440 | if (unlikely(msg_user(msg) == BCAST_PROTOCOL)) { |
453 | msg_dbg(msg, "<BCNACK<<<"); | ||
454 | if (msg_destnode(msg) == tipc_own_addr) { | 441 | if (msg_destnode(msg) == tipc_own_addr) { |
455 | tipc_node_lock(node); | 442 | tipc_node_lock(node); |
456 | tipc_bclink_acknowledge(node, msg_bcast_ack(msg)); | 443 | tipc_bclink_acknowledge(node, msg_bcast_ack(msg)); |
@@ -574,8 +561,8 @@ static int tipc_bcbearer_send(struct sk_buff *buf, | |||
574 | if (likely(!msg_non_seq(buf_msg(buf)))) { | 561 | if (likely(!msg_non_seq(buf_msg(buf)))) { |
575 | struct tipc_msg *msg; | 562 | struct tipc_msg *msg; |
576 | 563 | ||
577 | assert(tipc_cltr_bcast_nodes.count != 0); | 564 | assert(tipc_bcast_nmap.count != 0); |
578 | bcbuf_set_acks(buf, tipc_cltr_bcast_nodes.count); | 565 | bcbuf_set_acks(buf, tipc_bcast_nmap.count); |
579 | msg = buf_msg(buf); | 566 | msg = buf_msg(buf); |
580 | msg_set_non_seq(msg, 1); | 567 | msg_set_non_seq(msg, 1); |
581 | msg_set_mc_netid(msg, tipc_net_id); | 568 | msg_set_mc_netid(msg, tipc_net_id); |
@@ -584,7 +571,7 @@ static int tipc_bcbearer_send(struct sk_buff *buf, | |||
584 | 571 | ||
585 | /* Send buffer over bearers until all targets reached */ | 572 | /* Send buffer over bearers until all targets reached */ |
586 | 573 | ||
587 | bcbearer->remains = tipc_cltr_bcast_nodes; | 574 | bcbearer->remains = tipc_bcast_nmap; |
588 | 575 | ||
589 | for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { | 576 | for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { |
590 | struct bearer *p = bcbearer->bpairs[bp_index].primary; | 577 | struct bearer *p = bcbearer->bpairs[bp_index].primary; |
@@ -782,7 +769,6 @@ int tipc_bclink_init(void) | |||
782 | bcbearer = kzalloc(sizeof(*bcbearer), GFP_ATOMIC); | 769 | bcbearer = kzalloc(sizeof(*bcbearer), GFP_ATOMIC); |
783 | bclink = kzalloc(sizeof(*bclink), GFP_ATOMIC); | 770 | bclink = kzalloc(sizeof(*bclink), GFP_ATOMIC); |
784 | if (!bcbearer || !bclink) { | 771 | if (!bcbearer || !bclink) { |
785 | nomem: | ||
786 | warn("Multicast link creation failed, no memory\n"); | 772 | warn("Multicast link creation failed, no memory\n"); |
787 | kfree(bcbearer); | 773 | kfree(bcbearer); |
788 | bcbearer = NULL; | 774 | bcbearer = NULL; |
@@ -807,14 +793,6 @@ int tipc_bclink_init(void) | |||
807 | bcl->state = WORKING_WORKING; | 793 | bcl->state = WORKING_WORKING; |
808 | strlcpy(bcl->name, tipc_bclink_name, TIPC_MAX_LINK_NAME); | 794 | strlcpy(bcl->name, tipc_bclink_name, TIPC_MAX_LINK_NAME); |
809 | 795 | ||
810 | if (BCLINK_LOG_BUF_SIZE) { | ||
811 | char *pb = kmalloc(BCLINK_LOG_BUF_SIZE, GFP_ATOMIC); | ||
812 | |||
813 | if (!pb) | ||
814 | goto nomem; | ||
815 | tipc_printbuf_init(&bcl->print_buf, pb, BCLINK_LOG_BUF_SIZE); | ||
816 | } | ||
817 | |||
818 | return 0; | 796 | return 0; |
819 | } | 797 | } |
820 | 798 | ||
@@ -823,8 +801,6 @@ void tipc_bclink_stop(void) | |||
823 | spin_lock_bh(&bc_lock); | 801 | spin_lock_bh(&bc_lock); |
824 | if (bcbearer) { | 802 | if (bcbearer) { |
825 | tipc_link_stop(bcl); | 803 | tipc_link_stop(bcl); |
826 | if (BCLINK_LOG_BUF_SIZE) | ||
827 | kfree(bcl->print_buf.buf); | ||
828 | bcl = NULL; | 804 | bcl = NULL; |
829 | kfree(bclink); | 805 | kfree(bclink); |
830 | bclink = NULL; | 806 | bclink = NULL; |