aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Stephens <Allan.Stephens@windriver.com>2010-12-31 13:59:16 -0500
committerDavid S. Miller <davem@davemloft.net>2011-01-01 16:57:47 -0500
commit51f98a8d70583b18cb08b19353aeed5efb0244af (patch)
tree96253d3cb394202b442e65f4d169bbf49b94c327
parentaa6027cacdd912ce884953714fcc7392b6155bc6 (diff)
tipc: Remove prototype code for supporting multiple zones
Eliminates routines, data structures, and files that were intended to allows TIPC to support a network containing multiple zones. Currently, TIPC supports only networks consisting of a single cluster within a single zone, so this code is unnecessary. Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/tipc_config.h4
-rw-r--r--net/tipc/Kconfig12
-rw-r--r--net/tipc/Makefile2
-rw-r--r--net/tipc/addr.c4
-rw-r--r--net/tipc/cluster.c14
-rw-r--r--net/tipc/cluster.h12
-rw-r--r--net/tipc/config.c30
-rw-r--r--net/tipc/core.c6
-rw-r--r--net/tipc/core.h1
-rw-r--r--net/tipc/net.c41
-rw-r--r--net/tipc/net.h8
-rw-r--r--net/tipc/node.c7
-rw-r--r--net/tipc/node.h1
-rw-r--r--net/tipc/zone.c159
-rw-r--r--net/tipc/zone.h70
15 files changed, 46 insertions, 325 deletions
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index 9cde86c3241..fa3aeaafeab 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -94,7 +94,7 @@
94#define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */ 94#define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */
95#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* tx none, rx unsigned */ 95#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* tx none, rx unsigned */
96#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */ 96#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */
97#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* tx none, rx unsigned */ 97#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */
98#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* tx none, rx unsigned */ 98#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* tx none, rx unsigned */
99#define TIPC_CMD_GET_MAX_NODES 0x4009 /* tx none, rx unsigned */ 99#define TIPC_CMD_GET_MAX_NODES 0x4009 /* tx none, rx unsigned */
100#define TIPC_CMD_GET_MAX_SLAVES 0x400A /* tx none, rx unsigned */ 100#define TIPC_CMD_GET_MAX_SLAVES 0x400A /* tx none, rx unsigned */
@@ -130,7 +130,7 @@
130#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */ 130#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */
131#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */ 131#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */
132#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */ 132#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */
133#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* tx unsigned, rx none */ 133#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */
134#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* tx unsigned, rx none */ 134#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* tx unsigned, rx none */
135#define TIPC_CMD_SET_MAX_NODES 0x8009 /* tx unsigned, rx none */ 135#define TIPC_CMD_SET_MAX_NODES 0x8009 /* tx unsigned, rx none */
136#define TIPC_CMD_SET_MAX_SLAVES 0x800A /* tx unsigned, rx none */ 136#define TIPC_CMD_SET_MAX_SLAVES 0x800A /* tx unsigned, rx none */
diff --git a/net/tipc/Kconfig b/net/tipc/Kconfig
index b74f78d0c03..06d32908fcf 100644
--- a/net/tipc/Kconfig
+++ b/net/tipc/Kconfig
@@ -29,18 +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
32config TIPC_ZONES
33 int "Maximum number of zones in a network"
34 depends on TIPC_ADVANCED
35 range 1 255
36 default "3"
37 help
38 Specifies how many zones can be supported in a TIPC network.
39 Can range from 1 to 255 zones; default is 3.
40
41 Setting this to a smaller value saves some memory;
42 setting it to a higher value allows for more zones.
43
44config TIPC_CLUSTERS 32config TIPC_CLUSTERS
45 int "Maximum number of clusters in a zone" 33 int "Maximum number of clusters in a zone"
46 depends on TIPC_ADVANCED 34 depends on TIPC_ADVANCED
diff --git a/net/tipc/Makefile b/net/tipc/Makefile
index dceb7027946..3d936f0560c 100644
--- a/net/tipc/Makefile
+++ b/net/tipc/Makefile
@@ -8,6 +8,6 @@ tipc-y += addr.o bcast.o bearer.o config.o cluster.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 \
11 socket.o user_reg.o zone.o dbg.o eth_media.o 11 socket.o user_reg.o dbg.o eth_media.o
12 12
13# End of file 13# End of file
diff --git a/net/tipc/addr.c b/net/tipc/addr.c
index 886715a7525..3d0f97da5b5 100644
--- a/net/tipc/addr.c
+++ b/net/tipc/addr.c
@@ -35,8 +35,6 @@
35 */ 35 */
36 36
37#include "core.h" 37#include "core.h"
38#include "addr.h"
39#include "zone.h"
40#include "cluster.h" 38#include "cluster.h"
41 39
42/** 40/**
@@ -61,8 +59,6 @@ int tipc_addr_domain_valid(u32 addr)
61 return 0; 59 return 0;
62 if (c > tipc_max_clusters) 60 if (c > tipc_max_clusters)
63 return 0; 61 return 0;
64 if (z > tipc_max_zones)
65 return 0;
66 62
67 if (n && (!z || !c)) 63 if (n && (!z || !c))
68 return 0; 64 return 0;
diff --git a/net/tipc/cluster.c b/net/tipc/cluster.c
index 405be87157b..996b2b67687 100644
--- a/net/tipc/cluster.c
+++ b/net/tipc/cluster.c
@@ -47,7 +47,6 @@ u32 tipc_highest_allowed_slave = 0;
47 47
48struct cluster *tipc_cltr_create(u32 addr) 48struct cluster *tipc_cltr_create(u32 addr)
49{ 49{
50 struct _zone *z_ptr;
51 struct cluster *c_ptr; 50 struct cluster *c_ptr;
52 int max_nodes; 51 int max_nodes;
53 52
@@ -75,18 +74,7 @@ struct cluster *tipc_cltr_create(u32 addr)
75 c_ptr->highest_slave = LOWEST_SLAVE - 1; 74 c_ptr->highest_slave = LOWEST_SLAVE - 1;
76 c_ptr->highest_node = 0; 75 c_ptr->highest_node = 0;
77 76
78 z_ptr = tipc_zone_find(tipc_zone(addr)); 77 tipc_net.clusters[1] = c_ptr;
79 if (!z_ptr) {
80 z_ptr = tipc_zone_create(addr);
81 }
82 if (!z_ptr) {
83 kfree(c_ptr->nodes);
84 kfree(c_ptr);
85 return NULL;
86 }
87
88 tipc_zone_attach_cluster(z_ptr, c_ptr);
89 c_ptr->owner = z_ptr;
90 return c_ptr; 78 return c_ptr;
91} 79}
92 80
diff --git a/net/tipc/cluster.h b/net/tipc/cluster.h
index 32636d98c9c..21493f7beb9 100644
--- a/net/tipc/cluster.h
+++ b/net/tipc/cluster.h
@@ -38,14 +38,13 @@
38#define _TIPC_CLUSTER_H 38#define _TIPC_CLUSTER_H
39 39
40#include "addr.h" 40#include "addr.h"
41#include "zone.h" 41#include "net.h"
42 42
43#define LOWEST_SLAVE 2048u 43#define LOWEST_SLAVE 2048u
44 44
45/** 45/**
46 * struct cluster - TIPC cluster structure 46 * struct cluster - TIPC cluster structure
47 * @addr: network address of cluster 47 * @addr: network address of cluster
48 * @owner: pointer to zone that cluster belongs to
49 * @nodes: array of pointers to all nodes within cluster 48 * @nodes: array of pointers to all nodes within cluster
50 * @highest_node: id of highest numbered node within cluster 49 * @highest_node: id of highest numbered node within cluster
51 * @highest_slave: (used for secondary node support) 50 * @highest_slave: (used for secondary node support)
@@ -53,7 +52,6 @@
53 52
54struct cluster { 53struct cluster {
55 u32 addr; 54 u32 addr;
56 struct _zone *owner;
57 struct tipc_node **nodes; 55 struct tipc_node **nodes;
58 u32 highest_node; 56 u32 highest_node;
59 u32 highest_slave; 57 u32 highest_slave;
@@ -82,11 +80,9 @@ void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi)
82 80
83static inline struct cluster *tipc_cltr_find(u32 addr) 81static inline struct cluster *tipc_cltr_find(u32 addr)
84{ 82{
85 struct _zone *z_ptr = tipc_zone_find(addr); 83 if (!in_own_cluster(addr))
86 84 return NULL;
87 if (z_ptr) 85 return tipc_net.clusters[1];
88 return z_ptr->clusters[1];
89 return NULL;
90} 86}
91 87
92#endif 88#endif
diff --git a/net/tipc/config.c b/net/tipc/config.c
index bdde39f0436..8de97ddb042 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -269,25 +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
272static struct sk_buff *cfg_set_max_zones(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 == tipc_max_zones)
280 return tipc_cfg_reply_none();
281 if (value != delimit(value, 1, 255))
282 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
283 " (max zones must be 1-255)");
284 if (tipc_mode == TIPC_NET_MODE)
285 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
286 " (cannot change max zones once TIPC has joined a network)");
287 tipc_max_zones = value;
288 return tipc_cfg_reply_none();
289}
290
291static struct sk_buff *cfg_set_max_clusters(void) 272static struct sk_buff *cfg_set_max_clusters(void)
292{ 273{
293 u32 value; 274 u32 value;
@@ -452,9 +433,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
452 case TIPC_CMD_SET_MAX_SUBSCR: 433 case TIPC_CMD_SET_MAX_SUBSCR:
453 rep_tlv_buf = cfg_set_max_subscriptions(); 434 rep_tlv_buf = cfg_set_max_subscriptions();
454 break; 435 break;
455 case TIPC_CMD_SET_MAX_ZONES:
456 rep_tlv_buf = cfg_set_max_zones();
457 break;
458 case TIPC_CMD_SET_MAX_CLUSTERS: 436 case TIPC_CMD_SET_MAX_CLUSTERS:
459 rep_tlv_buf = cfg_set_max_clusters(); 437 rep_tlv_buf = cfg_set_max_clusters();
460 break; 438 break;
@@ -479,9 +457,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
479 case TIPC_CMD_GET_MAX_SUBSCR: 457 case TIPC_CMD_GET_MAX_SUBSCR:
480 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_subscriptions); 458 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_subscriptions);
481 break; 459 break;
482 case TIPC_CMD_GET_MAX_ZONES:
483 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_zones);
484 break;
485 case TIPC_CMD_GET_MAX_CLUSTERS: 460 case TIPC_CMD_GET_MAX_CLUSTERS:
486 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_clusters); 461 rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_clusters);
487 break; 462 break;
@@ -498,6 +473,11 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
498 rep_tlv_buf = 473 rep_tlv_buf =
499 tipc_cfg_reply_error_string(TIPC_CFG_NOT_NET_ADMIN); 474 tipc_cfg_reply_error_string(TIPC_CFG_NOT_NET_ADMIN);
500 break; 475 break;
476 case TIPC_CMD_SET_MAX_ZONES:
477 case TIPC_CMD_GET_MAX_ZONES:
478 rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
479 " (obsolete command)");
480 break;
501 default: 481 default:
502 rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 482 rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
503 " (unknown command)"); 483 " (unknown command)");
diff --git a/net/tipc/core.c b/net/tipc/core.c
index f5d62c174de..13946331bd4 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_ZONES
52#define CONFIG_TIPC_ZONES 3
53#endif
54
55#ifndef CONFIG_TIPC_CLUSTERS 51#ifndef CONFIG_TIPC_CLUSTERS
56#define CONFIG_TIPC_CLUSTERS 1 52#define CONFIG_TIPC_CLUSTERS 1
57#endif 53#endif
@@ -84,7 +80,6 @@ const char tipc_alphabet[] =
84/* configurable TIPC parameters */ 80/* configurable TIPC parameters */
85 81
86u32 tipc_own_addr; 82u32 tipc_own_addr;
87int tipc_max_zones;
88int tipc_max_clusters; 83int tipc_max_clusters;
89int tipc_max_nodes; 84int tipc_max_nodes;
90int tipc_max_slaves; 85int tipc_max_slaves;
@@ -209,7 +204,6 @@ static int __init tipc_init(void)
209 tipc_max_publications = 10000; 204 tipc_max_publications = 10000;
210 tipc_max_subscriptions = 2000; 205 tipc_max_subscriptions = 2000;
211 tipc_max_ports = CONFIG_TIPC_PORTS; 206 tipc_max_ports = CONFIG_TIPC_PORTS;
212 tipc_max_zones = CONFIG_TIPC_ZONES;
213 tipc_max_clusters = CONFIG_TIPC_CLUSTERS; 207 tipc_max_clusters = CONFIG_TIPC_CLUSTERS;
214 tipc_max_nodes = CONFIG_TIPC_NODES; 208 tipc_max_nodes = CONFIG_TIPC_NODES;
215 tipc_max_slaves = CONFIG_TIPC_SLAVE_NODES; 209 tipc_max_slaves = CONFIG_TIPC_SLAVE_NODES;
diff --git a/net/tipc/core.h b/net/tipc/core.h
index ca7e171c104..9403a226a57 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
186extern u32 tipc_own_addr; 186extern u32 tipc_own_addr;
187extern int tipc_max_zones;
188extern int tipc_max_clusters; 187extern int tipc_max_clusters;
189extern int tipc_max_nodes; 188extern int tipc_max_nodes;
190extern int tipc_max_slaves; 189extern int tipc_max_slaves;
diff --git a/net/tipc/net.c b/net/tipc/net.c
index c2b4b86c2e6..a25f8bb1e1d 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -36,7 +36,6 @@
36 36
37#include "core.h" 37#include "core.h"
38#include "net.h" 38#include "net.h"
39#include "zone.h"
40#include "name_table.h" 39#include "name_table.h"
41#include "name_distr.h" 40#include "name_distr.h"
42#include "subscr.h" 41#include "subscr.h"
@@ -111,46 +110,56 @@
111*/ 110*/
112 111
113DEFINE_RWLOCK(tipc_net_lock); 112DEFINE_RWLOCK(tipc_net_lock);
114static struct _zone *tipc_zones[256] = { NULL, }; 113struct network tipc_net;
115struct network tipc_net = { tipc_zones };
116 114
117struct tipc_node *tipc_net_select_remote_node(u32 addr, u32 ref) 115struct tipc_node *tipc_net_select_remote_node(u32 addr, u32 ref)
118{ 116{
119 return tipc_zone_select_remote_node(tipc_net.zones[tipc_zone(addr)], addr, ref); 117 struct cluster *c_ptr;
118
119 c_ptr = tipc_net.clusters[1];
120 if (!c_ptr)
121 return NULL;
122 return tipc_cltr_select_node(c_ptr, ref);
120} 123}
121 124
122u32 tipc_net_select_router(u32 addr, u32 ref) 125u32 tipc_net_select_router(u32 addr, u32 ref)
123{ 126{
124 return tipc_zone_select_router(tipc_net.zones[tipc_zone(addr)], addr, ref); 127 struct cluster *c_ptr;
128
129 c_ptr = tipc_net.clusters[1];
130 if (!c_ptr)
131 return 0;
132 return tipc_cltr_select_router(c_ptr, ref);
125} 133}
126 134
127void tipc_net_remove_as_router(u32 router) 135void tipc_net_remove_as_router(u32 router)
128{ 136{
129 u32 z_num; 137 u32 c_num;
130 138
131 for (z_num = 1; z_num <= tipc_max_zones; z_num++) { 139 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
132 if (!tipc_net.zones[z_num]) 140 if (!tipc_net.clusters[c_num])
133 continue; 141 continue;
134 tipc_zone_remove_as_router(tipc_net.zones[z_num], router); 142 tipc_cltr_remove_as_router(tipc_net.clusters[c_num], router);
135 } 143 }
136} 144}
137 145
138void tipc_net_send_external_routes(u32 dest) 146void tipc_net_send_external_routes(u32 dest)
139{ 147{
140 u32 z_num; 148 u32 c_num;
141 149
142 for (z_num = 1; z_num <= tipc_max_zones; z_num++) { 150 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
143 if (tipc_net.zones[z_num]) 151 if (tipc_net.clusters[c_num])
144 tipc_zone_send_external_routes(tipc_net.zones[z_num], dest); 152 tipc_cltr_send_ext_routes(tipc_net.clusters[c_num],
153 dest);
145 } 154 }
146} 155}
147 156
148static void net_stop(void) 157static void net_stop(void)
149{ 158{
150 u32 z_num; 159 u32 c_num;
151 160
152 for (z_num = 1; z_num <= tipc_max_zones; z_num++) 161 for (c_num = 1; c_num <= tipc_max_clusters; c_num++)
153 tipc_zone_delete(tipc_net.zones[z_num]); 162 tipc_cltr_delete(tipc_net.clusters[c_num]);
154} 163}
155 164
156static void net_route_named_msg(struct sk_buff *buf) 165static void net_route_named_msg(struct sk_buff *buf)
diff --git a/net/tipc/net.h b/net/tipc/net.h
index de2b9ad8f64..786c9400747 100644
--- a/net/tipc/net.h
+++ b/net/tipc/net.h
@@ -37,15 +37,17 @@
37#ifndef _TIPC_NET_H 37#ifndef _TIPC_NET_H
38#define _TIPC_NET_H 38#define _TIPC_NET_H
39 39
40struct _zone; 40struct cluster;
41 41
42/** 42/**
43 * struct network - TIPC network structure 43 * struct network - TIPC network structure
44 * @zones: array of pointers to all zones within network 44 * @clusters: array of pointers to all clusters within zone
45 * @links: number of (unicast) links to cluster
45 */ 46 */
46 47
47struct network { 48struct network {
48 struct _zone **zones; 49 struct cluster *clusters[2]; /* currently limited to just 1 cluster */
50 u32 links;
49}; 51};
50 52
51 53
diff --git a/net/tipc/node.c b/net/tipc/node.c
index df71dfc3a9a..c20bd851a44 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -257,7 +257,7 @@ struct tipc_node *tipc_node_attach_link(struct link *l_ptr)
257 257
258 if (!n_ptr->links[bearer_id]) { 258 if (!n_ptr->links[bearer_id]) {
259 n_ptr->links[bearer_id] = l_ptr; 259 n_ptr->links[bearer_id] = l_ptr;
260 tipc_net.zones[tipc_zone(l_ptr->addr)]->links++; 260 tipc_net.links++;
261 n_ptr->link_cnt++; 261 n_ptr->link_cnt++;
262 return n_ptr; 262 return n_ptr;
263 } 263 }
@@ -271,7 +271,7 @@ struct tipc_node *tipc_node_attach_link(struct link *l_ptr)
271void tipc_node_detach_link(struct tipc_node *n_ptr, struct link *l_ptr) 271void tipc_node_detach_link(struct tipc_node *n_ptr, struct link *l_ptr)
272{ 272{
273 n_ptr->links[l_ptr->b_ptr->identity] = NULL; 273 n_ptr->links[l_ptr->b_ptr->identity] = NULL;
274 tipc_net.zones[tipc_zone(l_ptr->addr)]->links--; 274 tipc_net.links--;
275 n_ptr->link_cnt--; 275 n_ptr->link_cnt--;
276} 276}
277 277
@@ -656,8 +656,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
656 656
657 /* Get space for all unicast links + multicast link */ 657 /* Get space for all unicast links + multicast link */
658 658
659 payload_size = TLV_SPACE(sizeof(link_info)) * 659 payload_size = TLV_SPACE(sizeof(link_info)) * (tipc_net.links + 1);
660 (tipc_net.zones[tipc_zone(tipc_own_addr)]->links + 1);
661 if (payload_size > 32768u) { 660 if (payload_size > 32768u) {
662 read_unlock_bh(&tipc_net_lock); 661 read_unlock_bh(&tipc_net_lock);
663 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 662 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
diff --git a/net/tipc/node.h b/net/tipc/node.h
index fff331b2d26..7bfaf5e8c20 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -38,7 +38,6 @@
38#define _TIPC_NODE_H 38#define _TIPC_NODE_H
39 39
40#include "node_subscr.h" 40#include "node_subscr.h"
41#include "addr.h"
42#include "cluster.h" 41#include "cluster.h"
43#include "bearer.h" 42#include "bearer.h"
44 43
diff --git a/net/tipc/zone.c b/net/tipc/zone.c
deleted file mode 100644
index 1b61ca8c48e..00000000000
--- a/net/tipc/zone.c
+++ /dev/null
@@ -1,159 +0,0 @@
1/*
2 * net/tipc/zone.c: TIPC zone 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 "zone.h"
39#include "cluster.h"
40#include "node.h"
41
42struct _zone *tipc_zone_create(u32 addr)
43{
44 struct _zone *z_ptr;
45 u32 z_num;
46
47 if (!tipc_addr_domain_valid(addr)) {
48 err("Zone creation failed, invalid domain 0x%x\n", addr);
49 return NULL;
50 }
51
52 z_ptr = kzalloc(sizeof(*z_ptr), GFP_ATOMIC);
53 if (!z_ptr) {
54 warn("Zone creation failed, insufficient memory\n");
55 return NULL;
56 }
57
58 z_num = tipc_zone(addr);
59 z_ptr->addr = tipc_addr(z_num, 0, 0);
60 tipc_net.zones[z_num] = z_ptr;
61 return z_ptr;
62}
63
64void tipc_zone_delete(struct _zone *z_ptr)
65{
66 u32 c_num;
67
68 if (!z_ptr)
69 return;
70 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
71 tipc_cltr_delete(z_ptr->clusters[c_num]);
72 }
73 kfree(z_ptr);
74}
75
76void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr)
77{
78 u32 c_num = tipc_cluster(c_ptr->addr);
79
80 assert(c_ptr->addr);
81 assert(c_num <= tipc_max_clusters);
82 assert(z_ptr->clusters[c_num] == NULL);
83 z_ptr->clusters[c_num] = c_ptr;
84}
85
86void tipc_zone_remove_as_router(struct _zone *z_ptr, u32 router)
87{
88 u32 c_num;
89
90 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
91 if (z_ptr->clusters[c_num]) {
92 tipc_cltr_remove_as_router(z_ptr->clusters[c_num],
93 router);
94 }
95 }
96}
97
98void tipc_zone_send_external_routes(struct _zone *z_ptr, u32 dest)
99{
100 u32 c_num;
101
102 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
103 if (z_ptr->clusters[c_num]) {
104 if (in_own_cluster(z_ptr->addr))
105 continue;
106 tipc_cltr_send_ext_routes(z_ptr->clusters[c_num], dest);
107 }
108 }
109}
110
111struct tipc_node *tipc_zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref)
112{
113 struct cluster *c_ptr;
114 struct tipc_node *n_ptr;
115 u32 c_num;
116
117 if (!z_ptr)
118 return NULL;
119 c_ptr = z_ptr->clusters[tipc_cluster(addr)];
120 if (!c_ptr)
121 return NULL;
122 n_ptr = tipc_cltr_select_node(c_ptr, ref);
123 if (n_ptr)
124 return n_ptr;
125
126 /* Links to any other clusters within this zone ? */
127 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
128 c_ptr = z_ptr->clusters[c_num];
129 if (!c_ptr)
130 return NULL;
131 n_ptr = tipc_cltr_select_node(c_ptr, ref);
132 if (n_ptr)
133 return n_ptr;
134 }
135 return NULL;
136}
137
138u32 tipc_zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref)
139{
140 struct cluster *c_ptr;
141 u32 c_num;
142 u32 router;
143
144 if (!z_ptr)
145 return 0;
146 c_ptr = z_ptr->clusters[tipc_cluster(addr)];
147 router = c_ptr ? tipc_cltr_select_router(c_ptr, ref) : 0;
148 if (router)
149 return router;
150
151 /* Links to any other clusters within the zone? */
152 for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
153 c_ptr = z_ptr->clusters[c_num];
154 router = c_ptr ? tipc_cltr_select_router(c_ptr, ref) : 0;
155 if (router)
156 return router;
157 }
158 return 0;
159}
diff --git a/net/tipc/zone.h b/net/tipc/zone.h
deleted file mode 100644
index bd1c20ce9d0..00000000000
--- a/net/tipc/zone.h
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * net/tipc/zone.h: Include file for TIPC zone management routines
3 *
4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005-2006, 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_ZONE_H
38#define _TIPC_ZONE_H
39
40#include "node_subscr.h"
41#include "net.h"
42
43
44/**
45 * struct _zone - TIPC zone structure
46 * @addr: network address of zone
47 * @clusters: array of pointers to all clusters within zone
48 * @links: number of (unicast) links to zone
49 */
50
51struct _zone {
52 u32 addr;
53 struct cluster *clusters[2]; /* currently limited to just 1 cluster */
54 u32 links;
55};
56
57struct tipc_node *tipc_zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref);
58u32 tipc_zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref);
59void tipc_zone_remove_as_router(struct _zone *z_ptr, u32 router);
60void tipc_zone_send_external_routes(struct _zone *z_ptr, u32 dest);
61struct _zone *tipc_zone_create(u32 addr);
62void tipc_zone_delete(struct _zone *z_ptr);
63void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr);
64
65static inline struct _zone *tipc_zone_find(u32 addr)
66{
67 return tipc_net.zones[tipc_zone(addr)];
68}
69
70#endif