diff options
Diffstat (limited to 'net/tipc/name_distr.c')
-rw-r--r-- | net/tipc/name_distr.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index 7b907171f879..483c226c9581 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c | |||
@@ -35,10 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "core.h" | 37 | #include "core.h" |
38 | #include "cluster.h" | ||
39 | #include "dbg.h" | ||
40 | #include "link.h" | 38 | #include "link.h" |
41 | #include "msg.h" | ||
42 | #include "name_distr.h" | 39 | #include "name_distr.h" |
43 | 40 | ||
44 | #define ITEM_SIZE sizeof(struct distr_item) | 41 | #define ITEM_SIZE sizeof(struct distr_item) |
@@ -76,7 +73,7 @@ struct distr_item { | |||
76 | */ | 73 | */ |
77 | 74 | ||
78 | static LIST_HEAD(publ_root); | 75 | static LIST_HEAD(publ_root); |
79 | static u32 publ_cnt = 0; | 76 | static u32 publ_cnt; |
80 | 77 | ||
81 | /** | 78 | /** |
82 | * publ_to_item - add publication info to a publication message | 79 | * publ_to_item - add publication info to a publication message |
@@ -89,7 +86,6 @@ static void publ_to_item(struct distr_item *i, struct publication *p) | |||
89 | i->upper = htonl(p->upper); | 86 | i->upper = htonl(p->upper); |
90 | i->ref = htonl(p->ref); | 87 | i->ref = htonl(p->ref); |
91 | i->key = htonl(p->key); | 88 | i->key = htonl(p->key); |
92 | dbg("publ_to_item: %u, %u, %u\n", p->type, p->lower, p->upper); | ||
93 | } | 89 | } |
94 | 90 | ||
95 | /** | 91 | /** |
@@ -109,6 +105,26 @@ static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest) | |||
109 | return buf; | 105 | return buf; |
110 | } | 106 | } |
111 | 107 | ||
108 | static void named_cluster_distribute(struct sk_buff *buf) | ||
109 | { | ||
110 | struct sk_buff *buf_copy; | ||
111 | struct tipc_node *n_ptr; | ||
112 | u32 n_num; | ||
113 | |||
114 | for (n_num = 1; n_num <= tipc_net.highest_node; n_num++) { | ||
115 | n_ptr = tipc_net.nodes[n_num]; | ||
116 | if (n_ptr && tipc_node_has_active_links(n_ptr)) { | ||
117 | buf_copy = skb_copy(buf, GFP_ATOMIC); | ||
118 | if (!buf_copy) | ||
119 | break; | ||
120 | msg_set_destnode(buf_msg(buf_copy), n_ptr->addr); | ||
121 | tipc_link_send(buf_copy, n_ptr->addr, n_ptr->addr); | ||
122 | } | ||
123 | } | ||
124 | |||
125 | buf_discard(buf); | ||
126 | } | ||
127 | |||
112 | /** | 128 | /** |
113 | * tipc_named_publish - tell other nodes about a new publication by this node | 129 | * tipc_named_publish - tell other nodes about a new publication by this node |
114 | */ | 130 | */ |
@@ -129,8 +145,7 @@ void tipc_named_publish(struct publication *publ) | |||
129 | 145 | ||
130 | item = (struct distr_item *)msg_data(buf_msg(buf)); | 146 | item = (struct distr_item *)msg_data(buf_msg(buf)); |
131 | publ_to_item(item, publ); | 147 | publ_to_item(item, publ); |
132 | dbg("tipc_named_withdraw: broadcasting publish msg\n"); | 148 | named_cluster_distribute(buf); |
133 | tipc_cltr_broadcast(buf); | ||
134 | } | 149 | } |
135 | 150 | ||
136 | /** | 151 | /** |
@@ -153,8 +168,7 @@ void tipc_named_withdraw(struct publication *publ) | |||
153 | 168 | ||
154 | item = (struct distr_item *)msg_data(buf_msg(buf)); | 169 | item = (struct distr_item *)msg_data(buf_msg(buf)); |
155 | publ_to_item(item, publ); | 170 | publ_to_item(item, publ); |
156 | dbg("tipc_named_withdraw: broadcasting withdraw msg\n"); | 171 | named_cluster_distribute(buf); |
157 | tipc_cltr_broadcast(buf); | ||
158 | } | 172 | } |
159 | 173 | ||
160 | /** | 174 | /** |
@@ -191,9 +205,6 @@ void tipc_named_node_up(unsigned long node) | |||
191 | left -= ITEM_SIZE; | 205 | left -= ITEM_SIZE; |
192 | if (!left) { | 206 | if (!left) { |
193 | msg_set_link_selector(buf_msg(buf), node); | 207 | msg_set_link_selector(buf_msg(buf), node); |
194 | dbg("tipc_named_node_up: sending publish msg to " | ||
195 | "<%u.%u.%u>\n", tipc_zone(node), | ||
196 | tipc_cluster(node), tipc_node(node)); | ||
197 | tipc_link_send(buf, node, node); | 208 | tipc_link_send(buf, node, node); |
198 | buf = NULL; | 209 | buf = NULL; |
199 | } | 210 | } |
@@ -218,8 +229,6 @@ static void node_is_down(struct publication *publ) | |||
218 | struct publication *p; | 229 | struct publication *p; |
219 | 230 | ||
220 | write_lock_bh(&tipc_nametbl_lock); | 231 | write_lock_bh(&tipc_nametbl_lock); |
221 | dbg("node_is_down: withdrawing %u, %u, %u\n", | ||
222 | publ->type, publ->lower, publ->upper); | ||
223 | publ->key += 1222345; | 232 | publ->key += 1222345; |
224 | p = tipc_nametbl_remove_publ(publ->type, publ->lower, | 233 | p = tipc_nametbl_remove_publ(publ->type, publ->lower, |
225 | publ->node, publ->ref, publ->key); | 234 | publ->node, publ->ref, publ->key); |
@@ -231,9 +240,7 @@ static void node_is_down(struct publication *publ) | |||
231 | publ->type, publ->lower, publ->node, publ->ref, publ->key); | 240 | publ->type, publ->lower, publ->node, publ->ref, publ->key); |
232 | } | 241 | } |
233 | 242 | ||
234 | if (p) { | 243 | kfree(p); |
235 | kfree(p); | ||
236 | } | ||
237 | } | 244 | } |
238 | 245 | ||
239 | /** | 246 | /** |
@@ -250,9 +257,6 @@ void tipc_named_recv(struct sk_buff *buf) | |||
250 | write_lock_bh(&tipc_nametbl_lock); | 257 | write_lock_bh(&tipc_nametbl_lock); |
251 | while (count--) { | 258 | while (count--) { |
252 | if (msg_type(msg) == PUBLICATION) { | 259 | if (msg_type(msg) == PUBLICATION) { |
253 | dbg("tipc_named_recv: got publication for %u, %u, %u\n", | ||
254 | ntohl(item->type), ntohl(item->lower), | ||
255 | ntohl(item->upper)); | ||
256 | publ = tipc_nametbl_insert_publ(ntohl(item->type), | 260 | publ = tipc_nametbl_insert_publ(ntohl(item->type), |
257 | ntohl(item->lower), | 261 | ntohl(item->lower), |
258 | ntohl(item->upper), | 262 | ntohl(item->upper), |
@@ -267,9 +271,6 @@ void tipc_named_recv(struct sk_buff *buf) | |||
267 | (net_ev_handler)node_is_down); | 271 | (net_ev_handler)node_is_down); |
268 | } | 272 | } |
269 | } else if (msg_type(msg) == WITHDRAWAL) { | 273 | } else if (msg_type(msg) == WITHDRAWAL) { |
270 | dbg("tipc_named_recv: got withdrawl for %u, %u, %u\n", | ||
271 | ntohl(item->type), ntohl(item->lower), | ||
272 | ntohl(item->upper)); | ||
273 | publ = tipc_nametbl_remove_publ(ntohl(item->type), | 274 | publ = tipc_nametbl_remove_publ(ntohl(item->type), |
274 | ntohl(item->lower), | 275 | ntohl(item->lower), |
275 | msg_orignode(msg), | 276 | msg_orignode(msg), |