Skip to content

Commit

Permalink
tipc: Remove prototype code for supporting multiple zones
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Allan Stephens authored and David S. Miller committed Jan 1, 2011
1 parent aa6027c commit 51f98a8
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 325 deletions.
4 changes: 2 additions & 2 deletions include/linux/tipc_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
#define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */
#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* tx none, rx unsigned */
#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */
#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* tx none, rx unsigned */
#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */
#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* tx none, rx unsigned */
#define TIPC_CMD_GET_MAX_NODES 0x4009 /* tx none, rx unsigned */
#define TIPC_CMD_GET_MAX_SLAVES 0x400A /* tx none, rx unsigned */
Expand Down Expand Up @@ -130,7 +130,7 @@
#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */
#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */
#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */
#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* tx unsigned, rx none */
#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */
#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* tx unsigned, rx none */
#define TIPC_CMD_SET_MAX_NODES 0x8009 /* tx unsigned, rx none */
#define TIPC_CMD_SET_MAX_SLAVES 0x800A /* tx unsigned, rx none */
Expand Down
12 changes: 0 additions & 12 deletions net/tipc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,6 @@ config TIPC_ADVANCED
Saying Y here will open some advanced configuration for TIPC.
Most users do not need to bother; if unsure, just say N.

config TIPC_ZONES
int "Maximum number of zones in a network"
depends on TIPC_ADVANCED
range 1 255
default "3"
help
Specifies how many zones can be supported in a TIPC network.
Can range from 1 to 255 zones; default is 3.

Setting this to a smaller value saves some memory;
setting it to a higher value allows for more zones.

config TIPC_CLUSTERS
int "Maximum number of clusters in a zone"
depends on TIPC_ADVANCED
Expand Down
2 changes: 1 addition & 1 deletion net/tipc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ tipc-y += addr.o bcast.o bearer.o config.o cluster.o \
core.o handler.o link.o discover.o msg.o \
name_distr.o subscr.o name_table.o net.o \
netlink.o node.o node_subscr.o port.o ref.o \
socket.o user_reg.o zone.o dbg.o eth_media.o
socket.o user_reg.o dbg.o eth_media.o

# End of file
4 changes: 0 additions & 4 deletions net/tipc/addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
*/

#include "core.h"
#include "addr.h"
#include "zone.h"
#include "cluster.h"

/**
Expand All @@ -61,8 +59,6 @@ int tipc_addr_domain_valid(u32 addr)
return 0;
if (c > tipc_max_clusters)
return 0;
if (z > tipc_max_zones)
return 0;

if (n && (!z || !c))
return 0;
Expand Down
14 changes: 1 addition & 13 deletions net/tipc/cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ u32 tipc_highest_allowed_slave = 0;

struct cluster *tipc_cltr_create(u32 addr)
{
struct _zone *z_ptr;
struct cluster *c_ptr;
int max_nodes;

Expand Down Expand Up @@ -75,18 +74,7 @@ struct cluster *tipc_cltr_create(u32 addr)
c_ptr->highest_slave = LOWEST_SLAVE - 1;
c_ptr->highest_node = 0;

z_ptr = tipc_zone_find(tipc_zone(addr));
if (!z_ptr) {
z_ptr = tipc_zone_create(addr);
}
if (!z_ptr) {
kfree(c_ptr->nodes);
kfree(c_ptr);
return NULL;
}

tipc_zone_attach_cluster(z_ptr, c_ptr);
c_ptr->owner = z_ptr;
tipc_net.clusters[1] = c_ptr;
return c_ptr;
}

Expand Down
12 changes: 4 additions & 8 deletions net/tipc/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,20 @@
#define _TIPC_CLUSTER_H

#include "addr.h"
#include "zone.h"
#include "net.h"

#define LOWEST_SLAVE 2048u

/**
* struct cluster - TIPC cluster structure
* @addr: network address of cluster
* @owner: pointer to zone that cluster belongs to
* @nodes: array of pointers to all nodes within cluster
* @highest_node: id of highest numbered node within cluster
* @highest_slave: (used for secondary node support)
*/

struct cluster {
u32 addr;
struct _zone *owner;
struct tipc_node **nodes;
u32 highest_node;
u32 highest_slave;
Expand Down Expand Up @@ -82,11 +80,9 @@ void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi)

static inline struct cluster *tipc_cltr_find(u32 addr)
{
struct _zone *z_ptr = tipc_zone_find(addr);

if (z_ptr)
return z_ptr->clusters[1];
return NULL;
if (!in_own_cluster(addr))
return NULL;
return tipc_net.clusters[1];
}

#endif
30 changes: 5 additions & 25 deletions net/tipc/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,25 +269,6 @@ static struct sk_buff *cfg_set_max_ports(void)
return tipc_cfg_reply_none();
}

static struct sk_buff *cfg_set_max_zones(void)
{
u32 value;

if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
if (value == tipc_max_zones)
return tipc_cfg_reply_none();
if (value != delimit(value, 1, 255))
return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (max zones must be 1-255)");
if (tipc_mode == TIPC_NET_MODE)
return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (cannot change max zones once TIPC has joined a network)");
tipc_max_zones = value;
return tipc_cfg_reply_none();
}

static struct sk_buff *cfg_set_max_clusters(void)
{
u32 value;
Expand Down Expand Up @@ -452,9 +433,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
case TIPC_CMD_SET_MAX_SUBSCR:
rep_tlv_buf = cfg_set_max_subscriptions();
break;
case TIPC_CMD_SET_MAX_ZONES:
rep_tlv_buf = cfg_set_max_zones();
break;
case TIPC_CMD_SET_MAX_CLUSTERS:
rep_tlv_buf = cfg_set_max_clusters();
break;
Expand All @@ -479,9 +457,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
case TIPC_CMD_GET_MAX_SUBSCR:
rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_subscriptions);
break;
case TIPC_CMD_GET_MAX_ZONES:
rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_zones);
break;
case TIPC_CMD_GET_MAX_CLUSTERS:
rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_clusters);
break;
Expand All @@ -498,6 +473,11 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
rep_tlv_buf =
tipc_cfg_reply_error_string(TIPC_CFG_NOT_NET_ADMIN);
break;
case TIPC_CMD_SET_MAX_ZONES:
case TIPC_CMD_GET_MAX_ZONES:
rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (obsolete command)");
break;
default:
rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (unknown command)");
Expand Down
6 changes: 0 additions & 6 deletions net/tipc/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@
#include "config.h"


#ifndef CONFIG_TIPC_ZONES
#define CONFIG_TIPC_ZONES 3
#endif

#ifndef CONFIG_TIPC_CLUSTERS
#define CONFIG_TIPC_CLUSTERS 1
#endif
Expand Down Expand Up @@ -84,7 +80,6 @@ const char tipc_alphabet[] =
/* configurable TIPC parameters */

u32 tipc_own_addr;
int tipc_max_zones;
int tipc_max_clusters;
int tipc_max_nodes;
int tipc_max_slaves;
Expand Down Expand Up @@ -209,7 +204,6 @@ static int __init tipc_init(void)
tipc_max_publications = 10000;
tipc_max_subscriptions = 2000;
tipc_max_ports = CONFIG_TIPC_PORTS;
tipc_max_zones = CONFIG_TIPC_ZONES;
tipc_max_clusters = CONFIG_TIPC_CLUSTERS;
tipc_max_nodes = CONFIG_TIPC_NODES;
tipc_max_slaves = CONFIG_TIPC_SLAVE_NODES;
Expand Down
1 change: 0 additions & 1 deletion net/tipc/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ void tipc_dump_dbg(struct print_buf *, const char *fmt, ...);
*/

extern u32 tipc_own_addr;
extern int tipc_max_zones;
extern int tipc_max_clusters;
extern int tipc_max_nodes;
extern int tipc_max_slaves;
Expand Down
41 changes: 25 additions & 16 deletions net/tipc/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

#include "core.h"
#include "net.h"
#include "zone.h"
#include "name_table.h"
#include "name_distr.h"
#include "subscr.h"
Expand Down Expand Up @@ -111,46 +110,56 @@
*/

DEFINE_RWLOCK(tipc_net_lock);
static struct _zone *tipc_zones[256] = { NULL, };
struct network tipc_net = { tipc_zones };
struct network tipc_net;

struct tipc_node *tipc_net_select_remote_node(u32 addr, u32 ref)
{
return tipc_zone_select_remote_node(tipc_net.zones[tipc_zone(addr)], addr, ref);
struct cluster *c_ptr;

c_ptr = tipc_net.clusters[1];
if (!c_ptr)
return NULL;
return tipc_cltr_select_node(c_ptr, ref);
}

u32 tipc_net_select_router(u32 addr, u32 ref)
{
return tipc_zone_select_router(tipc_net.zones[tipc_zone(addr)], addr, ref);
struct cluster *c_ptr;

c_ptr = tipc_net.clusters[1];
if (!c_ptr)
return 0;
return tipc_cltr_select_router(c_ptr, ref);
}

void tipc_net_remove_as_router(u32 router)
{
u32 z_num;
u32 c_num;

for (z_num = 1; z_num <= tipc_max_zones; z_num++) {
if (!tipc_net.zones[z_num])
for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
if (!tipc_net.clusters[c_num])
continue;
tipc_zone_remove_as_router(tipc_net.zones[z_num], router);
tipc_cltr_remove_as_router(tipc_net.clusters[c_num], router);
}
}

void tipc_net_send_external_routes(u32 dest)
{
u32 z_num;
u32 c_num;

for (z_num = 1; z_num <= tipc_max_zones; z_num++) {
if (tipc_net.zones[z_num])
tipc_zone_send_external_routes(tipc_net.zones[z_num], dest);
for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
if (tipc_net.clusters[c_num])
tipc_cltr_send_ext_routes(tipc_net.clusters[c_num],
dest);
}
}

static void net_stop(void)
{
u32 z_num;
u32 c_num;

for (z_num = 1; z_num <= tipc_max_zones; z_num++)
tipc_zone_delete(tipc_net.zones[z_num]);
for (c_num = 1; c_num <= tipc_max_clusters; c_num++)
tipc_cltr_delete(tipc_net.clusters[c_num]);
}

static void net_route_named_msg(struct sk_buff *buf)
Expand Down
8 changes: 5 additions & 3 deletions net/tipc/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@
#ifndef _TIPC_NET_H
#define _TIPC_NET_H

struct _zone;
struct cluster;

/**
* struct network - TIPC network structure
* @zones: array of pointers to all zones within network
* @clusters: array of pointers to all clusters within zone
* @links: number of (unicast) links to cluster
*/

struct network {
struct _zone **zones;
struct cluster *clusters[2]; /* currently limited to just 1 cluster */
u32 links;
};


Expand Down
7 changes: 3 additions & 4 deletions net/tipc/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ struct tipc_node *tipc_node_attach_link(struct link *l_ptr)

if (!n_ptr->links[bearer_id]) {
n_ptr->links[bearer_id] = l_ptr;
tipc_net.zones[tipc_zone(l_ptr->addr)]->links++;
tipc_net.links++;
n_ptr->link_cnt++;
return n_ptr;
}
Expand All @@ -271,7 +271,7 @@ struct tipc_node *tipc_node_attach_link(struct link *l_ptr)
void tipc_node_detach_link(struct tipc_node *n_ptr, struct link *l_ptr)
{
n_ptr->links[l_ptr->b_ptr->identity] = NULL;
tipc_net.zones[tipc_zone(l_ptr->addr)]->links--;
tipc_net.links--;
n_ptr->link_cnt--;
}

Expand Down Expand Up @@ -656,8 +656,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)

/* Get space for all unicast links + multicast link */

payload_size = TLV_SPACE(sizeof(link_info)) *
(tipc_net.zones[tipc_zone(tipc_own_addr)]->links + 1);
payload_size = TLV_SPACE(sizeof(link_info)) * (tipc_net.links + 1);
if (payload_size > 32768u) {
read_unlock_bh(&tipc_net_lock);
return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
Expand Down
1 change: 0 additions & 1 deletion net/tipc/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#define _TIPC_NODE_H

#include "node_subscr.h"
#include "addr.h"
#include "cluster.h"
#include "bearer.h"

Expand Down
Loading

0 comments on commit 51f98a8

Please sign in to comment.