aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/cluster.c
diff options
context:
space:
mode:
authorAllan Stephens <Allan.Stephens@windriver.com>2010-12-31 13:59:19 -0500
committerDavid S. Miller <davem@davemloft.net>2011-01-01 16:57:49 -0500
commit8f92df6ad49da958d97e171762d0a97a3dc738f1 (patch)
treead848109f978d225b42ea219d7f45f10aa008a2c /net/tipc/cluster.c
parent51a8e4dee7653698ba4c6e7de71053665f075273 (diff)
tipc: Remove prototype code for supporting multiple clusters
Eliminates routines, data structures, and files that were intended to allow TIPC to support a network containing multiple clusters. 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>
Diffstat (limited to 'net/tipc/cluster.c')
-rw-r--r--net/tipc/cluster.c135
1 files changed, 0 insertions, 135 deletions
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
41struct tipc_node **tipc_local_nodes = NULL;
42struct tipc_node_map tipc_cltr_bcast_nodes = {0,{0,}};
43
44struct 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
72void 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
86void 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
103void 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 }
127exit:
128 buf_discard(buf);
129}
130
131int tipc_cltr_init(void)
132{
133 return tipc_cltr_create(tipc_own_addr) ? 0 : -ENOMEM;
134}
135