diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/tipc/Kconfig | 10 | ||||
-rw-r--r-- | net/tipc/Makefile | 2 | ||||
-rw-r--r-- | net/tipc/addr.c | 5 | ||||
-rw-r--r-- | net/tipc/bcast.c | 9 | ||||
-rw-r--r-- | net/tipc/bcast.h | 1 | ||||
-rw-r--r-- | net/tipc/cluster.c | 135 | ||||
-rw-r--r-- | net/tipc/cluster.h | 73 | ||||
-rw-r--r-- | net/tipc/config.c | 21 | ||||
-rw-r--r-- | net/tipc/core.c | 6 | ||||
-rw-r--r-- | net/tipc/core.h | 1 | ||||
-rw-r--r-- | net/tipc/name_distr.c | 28 | ||||
-rw-r--r-- | net/tipc/net.c | 25 | ||||
-rw-r--r-- | net/tipc/net.h | 8 | ||||
-rw-r--r-- | net/tipc/node.c | 37 | ||||
-rw-r--r-- | net/tipc/node.h | 7 |
15 files changed, 81 insertions, 287 deletions
diff --git a/net/tipc/Kconfig b/net/tipc/Kconfig index 06d32908fcfb..c02d3e9c156d 100644 --- a/net/tipc/Kconfig +++ b/net/tipc/Kconfig | |||
@@ -29,16 +29,6 @@ config TIPC_ADVANCED | |||
29 | Saying Y here will open some advanced configuration for TIPC. | 29 | Saying Y here will open some advanced configuration for TIPC. |
30 | Most users do not need to bother; if unsure, just say N. | 30 | Most users do not need to bother; if unsure, just say N. |
31 | 31 | ||
32 | config TIPC_CLUSTERS | ||
33 | int "Maximum number of clusters in a zone" | ||
34 | depends on TIPC_ADVANCED | ||
35 | range 1 1 | ||
36 | default "1" | ||
37 | help | ||
38 | Specifies how many clusters can be supported in a TIPC zone. | ||
39 | |||
40 | *** Currently TIPC only supports a single cluster per zone. *** | ||
41 | |||
42 | config TIPC_NODES | 32 | config TIPC_NODES |
43 | int "Maximum number of nodes in a cluster" | 33 | int "Maximum number of nodes in a cluster" |
44 | depends on TIPC_ADVANCED | 34 | depends on TIPC_ADVANCED |
diff --git a/net/tipc/Makefile b/net/tipc/Makefile index 3d936f0560c7..849d819bfc74 100644 --- a/net/tipc/Makefile +++ b/net/tipc/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | obj-$(CONFIG_TIPC) := tipc.o | 5 | obj-$(CONFIG_TIPC) := tipc.o |
6 | 6 | ||
7 | tipc-y += addr.o bcast.o bearer.o config.o cluster.o \ | 7 | tipc-y += addr.o bcast.o bearer.o config.o \ |
8 | core.o handler.o link.o discover.o msg.o \ | 8 | core.o handler.o link.o discover.o msg.o \ |
9 | name_distr.o subscr.o name_table.o net.o \ | 9 | name_distr.o subscr.o name_table.o net.o \ |
10 | netlink.o node.o node_subscr.o port.o ref.o \ | 10 | netlink.o node.o node_subscr.o port.o ref.o \ |
diff --git a/net/tipc/addr.c b/net/tipc/addr.c index 8823e03e52e0..483868a75b88 100644 --- a/net/tipc/addr.c +++ b/net/tipc/addr.c | |||
@@ -35,7 +35,8 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "core.h" | 37 | #include "core.h" |
38 | #include "cluster.h" | 38 | #include "node.h" |
39 | #include "addr.h" | ||
39 | 40 | ||
40 | /** | 41 | /** |
41 | * tipc_addr_domain_valid - validates a network domain address | 42 | * tipc_addr_domain_valid - validates a network domain address |
@@ -55,8 +56,6 @@ int tipc_addr_domain_valid(u32 addr) | |||
55 | 56 | ||
56 | if (n > max_nodes) | 57 | if (n > max_nodes) |
57 | return 0; | 58 | return 0; |
58 | if (c > tipc_max_clusters) | ||
59 | return 0; | ||
60 | 59 | ||
61 | if (n && (!z || !c)) | 60 | if (n && (!z || !c)) |
62 | return 0; | 61 | return 0; |
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 6d828d9eda42..110829eab96a 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c | |||
@@ -111,6 +111,9 @@ static struct bclink *bclink = NULL; | |||
111 | static struct link *bcl = NULL; | 111 | static struct link *bcl = NULL; |
112 | static DEFINE_SPINLOCK(bc_lock); | 112 | static DEFINE_SPINLOCK(bc_lock); |
113 | 113 | ||
114 | /* broadcast-capable node map */ | ||
115 | struct tipc_node_map tipc_bcast_nmap; | ||
116 | |||
114 | const char tipc_bclink_name[] = "broadcast-link"; | 117 | const char tipc_bclink_name[] = "broadcast-link"; |
115 | 118 | ||
116 | static void tipc_nmap_diff(struct tipc_node_map *nm_a, | 119 | static void tipc_nmap_diff(struct tipc_node_map *nm_a, |
@@ -566,8 +569,8 @@ static int tipc_bcbearer_send(struct sk_buff *buf, | |||
566 | if (likely(!msg_non_seq(buf_msg(buf)))) { | 569 | if (likely(!msg_non_seq(buf_msg(buf)))) { |
567 | struct tipc_msg *msg; | 570 | struct tipc_msg *msg; |
568 | 571 | ||
569 | assert(tipc_cltr_bcast_nodes.count != 0); | 572 | assert(tipc_bcast_nmap.count != 0); |
570 | bcbuf_set_acks(buf, tipc_cltr_bcast_nodes.count); | 573 | bcbuf_set_acks(buf, tipc_bcast_nmap.count); |
571 | msg = buf_msg(buf); | 574 | msg = buf_msg(buf); |
572 | msg_set_non_seq(msg, 1); | 575 | msg_set_non_seq(msg, 1); |
573 | msg_set_mc_netid(msg, tipc_net_id); | 576 | msg_set_mc_netid(msg, tipc_net_id); |
@@ -576,7 +579,7 @@ static int tipc_bcbearer_send(struct sk_buff *buf, | |||
576 | 579 | ||
577 | /* Send buffer over bearers until all targets reached */ | 580 | /* Send buffer over bearers until all targets reached */ |
578 | 581 | ||
579 | bcbearer->remains = tipc_cltr_bcast_nodes; | 582 | bcbearer->remains = tipc_bcast_nmap; |
580 | 583 | ||
581 | for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { | 584 | for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { |
582 | struct bearer *p = bcbearer->bpairs[bp_index].primary; | 585 | struct bearer *p = bcbearer->bpairs[bp_index].primary; |
diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h index 011c03f0a4ab..51f8c5326ce6 100644 --- a/net/tipc/bcast.h +++ b/net/tipc/bcast.h | |||
@@ -51,6 +51,7 @@ struct tipc_node_map { | |||
51 | u32 map[MAX_NODES / WSIZE]; | 51 | u32 map[MAX_NODES / WSIZE]; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | extern struct tipc_node_map tipc_bcast_nmap; | ||
54 | 55 | ||
55 | #define PLSIZE 32 | 56 | #define PLSIZE 32 |
56 | 57 | ||
diff --git a/net/tipc/cluster.c b/net/tipc/cluster.c deleted file mode 100644 index ba6f5bfa0cdb..000000000000 --- a/net/tipc/cluster.c +++ /dev/null | |||
@@ -1,135 +0,0 @@ | |||
1 | /* | ||
2 | * net/tipc/cluster.c: TIPC cluster management routines | ||
3 | * | ||
4 | * Copyright (c) 2000-2006, Ericsson AB | ||
5 | * Copyright (c) 2005, Wind River Systems | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions are met: | ||
10 | * | ||
11 | * 1. Redistributions of source code must retain the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer. | ||
13 | * 2. Redistributions in binary form must reproduce the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer in the | ||
15 | * documentation and/or other materials provided with the distribution. | ||
16 | * 3. Neither the names of the copyright holders nor the names of its | ||
17 | * contributors may be used to endorse or promote products derived from | ||
18 | * this software without specific prior written permission. | ||
19 | * | ||
20 | * Alternatively, this software may be distributed under the terms of the | ||
21 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
22 | * Software Foundation. | ||
23 | * | ||
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
34 | * POSSIBILITY OF SUCH DAMAGE. | ||
35 | */ | ||
36 | |||
37 | #include "core.h" | ||
38 | #include "cluster.h" | ||
39 | #include "link.h" | ||
40 | |||
41 | struct tipc_node **tipc_local_nodes = NULL; | ||
42 | struct tipc_node_map tipc_cltr_bcast_nodes = {0,{0,}}; | ||
43 | |||
44 | struct cluster *tipc_cltr_create(u32 addr) | ||
45 | { | ||
46 | struct cluster *c_ptr; | ||
47 | int max_nodes; | ||
48 | |||
49 | c_ptr = kzalloc(sizeof(*c_ptr), GFP_ATOMIC); | ||
50 | if (c_ptr == NULL) { | ||
51 | warn("Cluster creation failure, no memory\n"); | ||
52 | return NULL; | ||
53 | } | ||
54 | |||
55 | c_ptr->addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); | ||
56 | max_nodes = tipc_max_nodes + 1; | ||
57 | |||
58 | c_ptr->nodes = kcalloc(max_nodes + 1, sizeof(void*), GFP_ATOMIC); | ||
59 | if (c_ptr->nodes == NULL) { | ||
60 | warn("Cluster creation failure, no memory for node area\n"); | ||
61 | kfree(c_ptr); | ||
62 | return NULL; | ||
63 | } | ||
64 | |||
65 | tipc_local_nodes = c_ptr->nodes; | ||
66 | c_ptr->highest_node = 0; | ||
67 | |||
68 | tipc_net.clusters[1] = c_ptr; | ||
69 | return c_ptr; | ||
70 | } | ||
71 | |||
72 | void tipc_cltr_delete(struct cluster *c_ptr) | ||
73 | { | ||
74 | u32 n_num; | ||
75 | |||
76 | if (!c_ptr) | ||
77 | return; | ||
78 | for (n_num = 1; n_num <= c_ptr->highest_node; n_num++) { | ||
79 | tipc_node_delete(c_ptr->nodes[n_num]); | ||
80 | } | ||
81 | kfree(c_ptr->nodes); | ||
82 | kfree(c_ptr); | ||
83 | } | ||
84 | |||
85 | |||
86 | void tipc_cltr_attach_node(struct cluster *c_ptr, struct tipc_node *n_ptr) | ||
87 | { | ||
88 | u32 n_num = tipc_node(n_ptr->addr); | ||
89 | u32 max_n_num = tipc_max_nodes; | ||
90 | |||
91 | assert(n_num > 0); | ||
92 | assert(n_num <= max_n_num); | ||
93 | assert(c_ptr->nodes[n_num] == NULL); | ||
94 | c_ptr->nodes[n_num] = n_ptr; | ||
95 | if (n_num > c_ptr->highest_node) | ||
96 | c_ptr->highest_node = n_num; | ||
97 | } | ||
98 | |||
99 | /** | ||
100 | * tipc_cltr_broadcast - broadcast message to all nodes within cluster | ||
101 | */ | ||
102 | |||
103 | void tipc_cltr_broadcast(struct sk_buff *buf) | ||
104 | { | ||
105 | struct sk_buff *buf_copy; | ||
106 | struct cluster *c_ptr; | ||
107 | struct tipc_node *n_ptr; | ||
108 | u32 n_num; | ||
109 | |||
110 | if (tipc_mode == TIPC_NET_MODE) { | ||
111 | c_ptr = tipc_cltr_find(tipc_own_addr); | ||
112 | |||
113 | /* Send to nodes */ | ||
114 | for (n_num = 1; n_num <= c_ptr->highest_node; n_num++) { | ||
115 | n_ptr = c_ptr->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 == NULL) | ||
119 | goto exit; | ||
120 | msg_set_destnode(buf_msg(buf_copy), | ||
121 | n_ptr->addr); | ||
122 | tipc_link_send(buf_copy, n_ptr->addr, | ||
123 | n_ptr->addr); | ||
124 | } | ||
125 | } | ||
126 | } | ||
127 | exit: | ||
128 | buf_discard(buf); | ||
129 | } | ||
130 | |||
131 | int tipc_cltr_init(void) | ||
132 | { | ||
133 | return tipc_cltr_create(tipc_own_addr) ? 0 : -ENOMEM; | ||
134 | } | ||
135 | |||
diff --git a/net/tipc/cluster.h b/net/tipc/cluster.h deleted file mode 100644 index e4b6e4e27371..000000000000 --- a/net/tipc/cluster.h +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | /* | ||
2 | * net/tipc/cluster.h: Include file for TIPC cluster management routines | ||
3 | * | ||
4 | * Copyright (c) 2000-2006, Ericsson AB | ||
5 | * Copyright (c) 2005, Wind River Systems | ||
6 | * All rights reserved. | ||
7 | * | ||
8 | * Redistribution and use in source and binary forms, with or without | ||
9 | * modification, are permitted provided that the following conditions are met: | ||
10 | * | ||
11 | * 1. Redistributions of source code must retain the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer. | ||
13 | * 2. Redistributions in binary form must reproduce the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer in the | ||
15 | * documentation and/or other materials provided with the distribution. | ||
16 | * 3. Neither the names of the copyright holders nor the names of its | ||
17 | * contributors may be used to endorse or promote products derived from | ||
18 | * this software without specific prior written permission. | ||
19 | * | ||
20 | * Alternatively, this software may be distributed under the terms of the | ||
21 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
22 | * Software Foundation. | ||
23 | * | ||
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
34 | * POSSIBILITY OF SUCH DAMAGE. | ||
35 | */ | ||
36 | |||
37 | #ifndef _TIPC_CLUSTER_H | ||
38 | #define _TIPC_CLUSTER_H | ||
39 | |||
40 | #include "addr.h" | ||
41 | #include "net.h" | ||
42 | |||
43 | /** | ||
44 | * struct cluster - TIPC cluster structure | ||
45 | * @addr: network address of cluster | ||
46 | * @nodes: array of pointers to all nodes within cluster | ||
47 | * @highest_node: id of highest numbered node within cluster | ||
48 | */ | ||
49 | |||
50 | struct cluster { | ||
51 | u32 addr; | ||
52 | struct tipc_node **nodes; | ||
53 | u32 highest_node; | ||
54 | }; | ||
55 | |||
56 | |||
57 | extern struct tipc_node **tipc_local_nodes; | ||
58 | extern struct tipc_node_map tipc_cltr_bcast_nodes; | ||
59 | |||
60 | struct cluster *tipc_cltr_create(u32 addr); | ||
61 | void tipc_cltr_delete(struct cluster *c_ptr); | ||
62 | void tipc_cltr_attach_node(struct cluster *c_ptr, struct tipc_node *n_ptr); | ||
63 | void tipc_cltr_broadcast(struct sk_buff *buf); | ||
64 | int tipc_cltr_init(void); | ||
65 | |||
66 | static inline struct cluster *tipc_cltr_find(u32 addr) | ||
67 | { | ||
68 | if (!in_own_cluster(addr)) | ||
69 | return NULL; | ||
70 | return tipc_net.clusters[1]; | ||
71 | } | ||
72 | |||
73 | #endif | ||
diff --git a/net/tipc/config.c b/net/tipc/config.c index 05dc102300ae..bc512102eebd 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c | |||
@@ -269,19 +269,6 @@ static struct sk_buff *cfg_set_max_ports(void) | |||
269 | return tipc_cfg_reply_none(); | 269 | return tipc_cfg_reply_none(); |
270 | } | 270 | } |
271 | 271 | ||
272 | static struct sk_buff *cfg_set_max_clusters(void) | ||
273 | { | ||
274 | u32 value; | ||
275 | |||
276 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) | ||
277 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | ||
278 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); | ||
279 | if (value != delimit(value, 1, 1)) | ||
280 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | ||
281 | " (max clusters fixed at 1)"); | ||
282 | return tipc_cfg_reply_none(); | ||
283 | } | ||
284 | |||
285 | static struct sk_buff *cfg_set_max_nodes(void) | 272 | static struct sk_buff *cfg_set_max_nodes(void) |
286 | { | 273 | { |
287 | u32 value; | 274 | u32 value; |
@@ -420,9 +407,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area | |||
420 | case TIPC_CMD_SET_MAX_SUBSCR: | 407 | case TIPC_CMD_SET_MAX_SUBSCR: |
421 | rep_tlv_buf = cfg_set_max_subscriptions(); | 408 | rep_tlv_buf = cfg_set_max_subscriptions(); |
422 | break; | 409 | break; |
423 | case TIPC_CMD_SET_MAX_CLUSTERS: | ||
424 | rep_tlv_buf = cfg_set_max_clusters(); | ||
425 | break; | ||
426 | case TIPC_CMD_SET_MAX_NODES: | 410 | case TIPC_CMD_SET_MAX_NODES: |
427 | rep_tlv_buf = cfg_set_max_nodes(); | 411 | rep_tlv_buf = cfg_set_max_nodes(); |
428 | break; | 412 | break; |
@@ -441,9 +425,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area | |||
441 | case TIPC_CMD_GET_MAX_SUBSCR: | 425 | case TIPC_CMD_GET_MAX_SUBSCR: |
442 | rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_subscriptions); | 426 | rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_subscriptions); |
443 | break; | 427 | break; |
444 | case TIPC_CMD_GET_MAX_CLUSTERS: | ||
445 | rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_clusters); | ||
446 | break; | ||
447 | case TIPC_CMD_GET_MAX_NODES: | 428 | case TIPC_CMD_GET_MAX_NODES: |
448 | rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_nodes); | 429 | rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_nodes); |
449 | break; | 430 | break; |
@@ -458,6 +439,8 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area | |||
458 | case TIPC_CMD_GET_MAX_ZONES: | 439 | case TIPC_CMD_GET_MAX_ZONES: |
459 | case TIPC_CMD_SET_MAX_SLAVES: | 440 | case TIPC_CMD_SET_MAX_SLAVES: |
460 | case TIPC_CMD_GET_MAX_SLAVES: | 441 | case TIPC_CMD_GET_MAX_SLAVES: |
442 | case TIPC_CMD_SET_MAX_CLUSTERS: | ||
443 | case TIPC_CMD_GET_MAX_CLUSTERS: | ||
461 | rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED | 444 | rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED |
462 | " (obsolete command)"); | 445 | " (obsolete command)"); |
463 | break; | 446 | break; |
diff --git a/net/tipc/core.c b/net/tipc/core.c index 8b7af893971e..b9a3ef13f7e7 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c | |||
@@ -48,10 +48,6 @@ | |||
48 | #include "config.h" | 48 | #include "config.h" |
49 | 49 | ||
50 | 50 | ||
51 | #ifndef CONFIG_TIPC_CLUSTERS | ||
52 | #define CONFIG_TIPC_CLUSTERS 1 | ||
53 | #endif | ||
54 | |||
55 | #ifndef CONFIG_TIPC_NODES | 51 | #ifndef CONFIG_TIPC_NODES |
56 | #define CONFIG_TIPC_NODES 255 | 52 | #define CONFIG_TIPC_NODES 255 |
57 | #endif | 53 | #endif |
@@ -76,7 +72,6 @@ const char tipc_alphabet[] = | |||
76 | /* configurable TIPC parameters */ | 72 | /* configurable TIPC parameters */ |
77 | 73 | ||
78 | u32 tipc_own_addr; | 74 | u32 tipc_own_addr; |
79 | int tipc_max_clusters; | ||
80 | int tipc_max_nodes; | 75 | int tipc_max_nodes; |
81 | int tipc_max_ports; | 76 | int tipc_max_ports; |
82 | int tipc_max_subscriptions; | 77 | int tipc_max_subscriptions; |
@@ -199,7 +194,6 @@ static int __init tipc_init(void) | |||
199 | tipc_max_publications = 10000; | 194 | tipc_max_publications = 10000; |
200 | tipc_max_subscriptions = 2000; | 195 | tipc_max_subscriptions = 2000; |
201 | tipc_max_ports = CONFIG_TIPC_PORTS; | 196 | tipc_max_ports = CONFIG_TIPC_PORTS; |
202 | tipc_max_clusters = CONFIG_TIPC_CLUSTERS; | ||
203 | tipc_max_nodes = CONFIG_TIPC_NODES; | 197 | tipc_max_nodes = CONFIG_TIPC_NODES; |
204 | tipc_net_id = 4711; | 198 | tipc_net_id = 4711; |
205 | 199 | ||
diff --git a/net/tipc/core.h b/net/tipc/core.h index 8313a1689565..c44f955bd54a 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h | |||
@@ -184,7 +184,6 @@ void tipc_dump_dbg(struct print_buf *, const char *fmt, ...); | |||
184 | */ | 184 | */ |
185 | 185 | ||
186 | extern u32 tipc_own_addr; | 186 | extern u32 tipc_own_addr; |
187 | extern int tipc_max_clusters; | ||
188 | extern int tipc_max_nodes; | 187 | extern int tipc_max_nodes; |
189 | extern int tipc_max_ports; | 188 | extern int tipc_max_ports; |
190 | extern int tipc_max_subscriptions; | 189 | extern int tipc_max_subscriptions; |
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index 10ff48be3c01..c4583fe888d8 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c | |||
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "core.h" | 37 | #include "core.h" |
38 | #include "cluster.h" | 38 | #include "addr.h" |
39 | #include "link.h" | 39 | #include "link.h" |
40 | #include "name_distr.h" | 40 | #include "name_distr.h" |
41 | 41 | ||
@@ -107,6 +107,26 @@ static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest) | |||
107 | return buf; | 107 | return buf; |
108 | } | 108 | } |
109 | 109 | ||
110 | static void named_cluster_distribute(struct sk_buff *buf) | ||
111 | { | ||
112 | struct sk_buff *buf_copy; | ||
113 | struct tipc_node *n_ptr; | ||
114 | u32 n_num; | ||
115 | |||
116 | for (n_num = 1; n_num <= tipc_net.highest_node; n_num++) { | ||
117 | n_ptr = tipc_net.nodes[n_num]; | ||
118 | if (n_ptr && tipc_node_has_active_links(n_ptr)) { | ||
119 | buf_copy = skb_copy(buf, GFP_ATOMIC); | ||
120 | if (!buf_copy) | ||
121 | break; | ||
122 | msg_set_destnode(buf_msg(buf_copy), n_ptr->addr); | ||
123 | tipc_link_send(buf_copy, n_ptr->addr, n_ptr->addr); | ||
124 | } | ||
125 | } | ||
126 | |||
127 | buf_discard(buf); | ||
128 | } | ||
129 | |||
110 | /** | 130 | /** |
111 | * tipc_named_publish - tell other nodes about a new publication by this node | 131 | * tipc_named_publish - tell other nodes about a new publication by this node |
112 | */ | 132 | */ |
@@ -127,8 +147,8 @@ void tipc_named_publish(struct publication *publ) | |||
127 | 147 | ||
128 | item = (struct distr_item *)msg_data(buf_msg(buf)); | 148 | item = (struct distr_item *)msg_data(buf_msg(buf)); |
129 | publ_to_item(item, publ); | 149 | publ_to_item(item, publ); |
130 | dbg("tipc_named_withdraw: broadcasting publish msg\n"); | 150 | dbg("tipc_named_publish: broadcasting publish msg\n"); |
131 | tipc_cltr_broadcast(buf); | 151 | named_cluster_distribute(buf); |
132 | } | 152 | } |
133 | 153 | ||
134 | /** | 154 | /** |
@@ -152,7 +172,7 @@ void tipc_named_withdraw(struct publication *publ) | |||
152 | item = (struct distr_item *)msg_data(buf_msg(buf)); | 172 | item = (struct distr_item *)msg_data(buf_msg(buf)); |
153 | publ_to_item(item, publ); | 173 | publ_to_item(item, publ); |
154 | dbg("tipc_named_withdraw: broadcasting withdraw msg\n"); | 174 | dbg("tipc_named_withdraw: broadcasting withdraw msg\n"); |
155 | tipc_cltr_broadcast(buf); | 175 | named_cluster_distribute(buf); |
156 | } | 176 | } |
157 | 177 | ||
158 | /** | 178 | /** |
diff --git a/net/tipc/net.c b/net/tipc/net.c index 3967f1f6d97f..3baf55ee0985 100644 --- a/net/tipc/net.c +++ b/net/tipc/net.c | |||
@@ -112,12 +112,23 @@ | |||
112 | DEFINE_RWLOCK(tipc_net_lock); | 112 | DEFINE_RWLOCK(tipc_net_lock); |
113 | struct network tipc_net; | 113 | struct network tipc_net; |
114 | 114 | ||
115 | static int net_start(void) | ||
116 | { | ||
117 | tipc_net.nodes = kcalloc(tipc_max_nodes + 1, | ||
118 | sizeof(*tipc_net.nodes), GFP_ATOMIC); | ||
119 | tipc_net.highest_node = 0; | ||
120 | |||
121 | return tipc_net.nodes ? 0 : -ENOMEM; | ||
122 | } | ||
123 | |||
115 | static void net_stop(void) | 124 | static void net_stop(void) |
116 | { | 125 | { |
117 | u32 c_num; | 126 | u32 n_num; |
118 | 127 | ||
119 | for (c_num = 1; c_num <= tipc_max_clusters; c_num++) | 128 | for (n_num = 1; n_num <= tipc_net.highest_node; n_num++) |
120 | tipc_cltr_delete(tipc_net.clusters[c_num]); | 129 | tipc_node_delete(tipc_net.nodes[n_num]); |
130 | kfree(tipc_net.nodes); | ||
131 | tipc_net.nodes = NULL; | ||
121 | } | 132 | } |
122 | 133 | ||
123 | static void net_route_named_msg(struct sk_buff *buf) | 134 | static void net_route_named_msg(struct sk_buff *buf) |
@@ -218,10 +229,12 @@ int tipc_net_start(u32 addr) | |||
218 | tipc_named_reinit(); | 229 | tipc_named_reinit(); |
219 | tipc_port_reinit(); | 230 | tipc_port_reinit(); |
220 | 231 | ||
221 | if ((res = tipc_cltr_init()) || | 232 | res = net_start(); |
222 | (res = tipc_bclink_init())) { | 233 | if (res) |
234 | return res; | ||
235 | res = tipc_bclink_init(); | ||
236 | if (res) | ||
223 | return res; | 237 | return res; |
224 | } | ||
225 | 238 | ||
226 | tipc_k_signal((Handler)tipc_subscr_start, 0); | 239 | tipc_k_signal((Handler)tipc_subscr_start, 0); |
227 | tipc_k_signal((Handler)tipc_cfg_init, 0); | 240 | tipc_k_signal((Handler)tipc_cfg_init, 0); |
diff --git a/net/tipc/net.h b/net/tipc/net.h index 6e402d9b33e0..4ae59ad04893 100644 --- a/net/tipc/net.h +++ b/net/tipc/net.h | |||
@@ -37,16 +37,18 @@ | |||
37 | #ifndef _TIPC_NET_H | 37 | #ifndef _TIPC_NET_H |
38 | #define _TIPC_NET_H | 38 | #define _TIPC_NET_H |
39 | 39 | ||
40 | struct cluster; | 40 | struct tipc_node; |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * struct network - TIPC network structure | 43 | * struct network - TIPC network structure |
44 | * @clusters: array of pointers to all clusters within zone | 44 | * @nodes: array of pointers to all nodes within cluster |
45 | * @highest_node: id of highest numbered node within cluster | ||
45 | * @links: number of (unicast) links to cluster | 46 | * @links: number of (unicast) links to cluster |
46 | */ | 47 | */ |
47 | 48 | ||
48 | struct network { | 49 | struct network { |
49 | struct cluster *clusters[2]; /* currently limited to just 1 cluster */ | 50 | struct tipc_node **nodes; |
51 | u32 highest_node; | ||
50 | u32 links; | 52 | u32 links; |
51 | }; | 53 | }; |
52 | 54 | ||
diff --git a/net/tipc/node.c b/net/tipc/node.c index c47cc69eb575..58e189bf5c96 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -62,9 +62,9 @@ u32 tipc_own_tag = 0; | |||
62 | 62 | ||
63 | struct tipc_node *tipc_node_create(u32 addr) | 63 | struct tipc_node *tipc_node_create(u32 addr) |
64 | { | 64 | { |
65 | struct cluster *c_ptr; | ||
66 | struct tipc_node *n_ptr; | 65 | struct tipc_node *n_ptr; |
67 | struct tipc_node **curr_node; | 66 | struct tipc_node **curr_node; |
67 | u32 n_num; | ||
68 | 68 | ||
69 | spin_lock_bh(&node_create_lock); | 69 | spin_lock_bh(&node_create_lock); |
70 | 70 | ||
@@ -84,21 +84,14 @@ struct tipc_node *tipc_node_create(u32 addr) | |||
84 | return NULL; | 84 | return NULL; |
85 | } | 85 | } |
86 | 86 | ||
87 | c_ptr = tipc_cltr_find(addr); | ||
88 | if (!c_ptr) { | ||
89 | c_ptr = tipc_cltr_create(addr); | ||
90 | } | ||
91 | if (!c_ptr) { | ||
92 | spin_unlock_bh(&node_create_lock); | ||
93 | kfree(n_ptr); | ||
94 | return NULL; | ||
95 | } | ||
96 | |||
97 | n_ptr->addr = addr; | 87 | n_ptr->addr = addr; |
98 | spin_lock_init(&n_ptr->lock); | 88 | spin_lock_init(&n_ptr->lock); |
99 | INIT_LIST_HEAD(&n_ptr->nsub); | 89 | INIT_LIST_HEAD(&n_ptr->nsub); |
100 | n_ptr->owner = c_ptr; | 90 | |
101 | tipc_cltr_attach_node(c_ptr, n_ptr); | 91 | n_num = tipc_node(addr); |
92 | tipc_net.nodes[n_num] = n_ptr; | ||
93 | if (n_num > tipc_net.highest_node) | ||
94 | tipc_net.highest_node = n_num; | ||
102 | 95 | ||
103 | /* Insert node into ordered list */ | 96 | /* Insert node into ordered list */ |
104 | for (curr_node = &tipc_nodes; *curr_node; | 97 | for (curr_node = &tipc_nodes; *curr_node; |
@@ -115,11 +108,19 @@ struct tipc_node *tipc_node_create(u32 addr) | |||
115 | 108 | ||
116 | void tipc_node_delete(struct tipc_node *n_ptr) | 109 | void tipc_node_delete(struct tipc_node *n_ptr) |
117 | { | 110 | { |
111 | u32 n_num; | ||
112 | |||
118 | if (!n_ptr) | 113 | if (!n_ptr) |
119 | return; | 114 | return; |
120 | 115 | ||
121 | dbg("node %x deleted\n", n_ptr->addr); | 116 | dbg("node %x deleted\n", n_ptr->addr); |
117 | n_num = tipc_node(n_ptr->addr); | ||
118 | tipc_net.nodes[n_num] = NULL; | ||
122 | kfree(n_ptr); | 119 | kfree(n_ptr); |
120 | |||
121 | while (!tipc_net.nodes[tipc_net.highest_node]) | ||
122 | if (--tipc_net.highest_node == 0) | ||
123 | break; | ||
123 | } | 124 | } |
124 | 125 | ||
125 | 126 | ||
@@ -324,7 +325,7 @@ static void node_established_contact(struct tipc_node *n_ptr) | |||
324 | n_ptr->bclink.acked = tipc_bclink_get_last_sent(); | 325 | n_ptr->bclink.acked = tipc_bclink_get_last_sent(); |
325 | 326 | ||
326 | if (n_ptr->bclink.supported) { | 327 | if (n_ptr->bclink.supported) { |
327 | tipc_nmap_add(&tipc_cltr_bcast_nodes, n_ptr->addr); | 328 | tipc_nmap_add(&tipc_bcast_nmap, n_ptr->addr); |
328 | if (n_ptr->addr < tipc_own_addr) | 329 | if (n_ptr->addr < tipc_own_addr) |
329 | tipc_own_tag++; | 330 | tipc_own_tag++; |
330 | } | 331 | } |
@@ -361,13 +362,11 @@ static void node_lost_contact(struct tipc_node *n_ptr) | |||
361 | buf_discard(n_ptr->bclink.defragm); | 362 | buf_discard(n_ptr->bclink.defragm); |
362 | n_ptr->bclink.defragm = NULL; | 363 | n_ptr->bclink.defragm = NULL; |
363 | } | 364 | } |
364 | if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) { | ||
365 | tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000)); | ||
366 | } | ||
367 | 365 | ||
368 | /* Update routing tables */ | ||
369 | if (n_ptr->bclink.supported) { | 366 | if (n_ptr->bclink.supported) { |
370 | tipc_nmap_remove(&tipc_cltr_bcast_nodes, n_ptr->addr); | 367 | tipc_bclink_acknowledge(n_ptr, |
368 | mod(n_ptr->bclink.acked + 10000)); | ||
369 | tipc_nmap_remove(&tipc_bcast_nmap, n_ptr->addr); | ||
371 | if (n_ptr->addr < tipc_own_addr) | 370 | if (n_ptr->addr < tipc_own_addr) |
372 | tipc_own_tag--; | 371 | tipc_own_tag--; |
373 | } | 372 | } |
diff --git a/net/tipc/node.h b/net/tipc/node.h index 3abaaa24c77d..206a8efa410e 100644 --- a/net/tipc/node.h +++ b/net/tipc/node.h | |||
@@ -38,14 +38,14 @@ | |||
38 | #define _TIPC_NODE_H | 38 | #define _TIPC_NODE_H |
39 | 39 | ||
40 | #include "node_subscr.h" | 40 | #include "node_subscr.h" |
41 | #include "cluster.h" | 41 | #include "addr.h" |
42 | #include "net.h" | ||
42 | #include "bearer.h" | 43 | #include "bearer.h" |
43 | 44 | ||
44 | /** | 45 | /** |
45 | * struct tipc_node - TIPC node structure | 46 | * struct tipc_node - TIPC node structure |
46 | * @addr: network address of node | 47 | * @addr: network address of node |
47 | * @lock: spinlock governing access to structure | 48 | * @lock: spinlock governing access to structure |
48 | * @owner: pointer to cluster that node belongs to | ||
49 | * @next: pointer to next node in sorted list of cluster's nodes | 49 | * @next: pointer to next node in sorted list of cluster's nodes |
50 | * @nsub: list of "node down" subscriptions monitoring node | 50 | * @nsub: list of "node down" subscriptions monitoring node |
51 | * @active_links: pointers to active links to node | 51 | * @active_links: pointers to active links to node |
@@ -69,7 +69,6 @@ | |||
69 | struct tipc_node { | 69 | struct tipc_node { |
70 | u32 addr; | 70 | u32 addr; |
71 | spinlock_t lock; | 71 | spinlock_t lock; |
72 | struct cluster *owner; | ||
73 | struct tipc_node *next; | 72 | struct tipc_node *next; |
74 | struct list_head nsub; | 73 | struct list_head nsub; |
75 | struct link *active_links[2]; | 74 | struct link *active_links[2]; |
@@ -108,7 +107,7 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) | |||
108 | static inline struct tipc_node *tipc_node_find(u32 addr) | 107 | static inline struct tipc_node *tipc_node_find(u32 addr) |
109 | { | 108 | { |
110 | if (likely(in_own_cluster(addr))) | 109 | if (likely(in_own_cluster(addr))) |
111 | return tipc_local_nodes[tipc_node(addr)]; | 110 | return tipc_net.nodes[tipc_node(addr)]; |
112 | return NULL; | 111 | return NULL; |
113 | } | 112 | } |
114 | 113 | ||