Commit f831c963 authored by Allan Stephens's avatar Allan Stephens Committed by Paul Gortmaker

tipc: Eliminate configuration for maximum number of cluster nodes

Gets rid of the need for users to specify the maximum number of
cluster nodes supported by TIPC. TIPC now automatically provides
support for all 4K nodes allowed by its addressing scheme.

Note: This change sets TIPC's memory usage to the amount used by
a maximum size node table with 4K entries.  An upcoming patch that
converts the node table from a linear array to a hash table will
compact the node table to a more efficient design, but for clarity
it is nice to have all the Kconfig infrastruture go away separately.
Signed-off-by: default avatarAllan Stephens <Allan.Stephens@windriver.com>
Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
parent d1bcb115
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */ #define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */
#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */ #define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */
#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */ #define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */
#define TIPC_CMD_GET_MAX_NODES 0x4009 /* tx none, rx unsigned */ #define TIPC_CMD_GET_MAX_NODES 0x4009 /* obsoleted */
#define TIPC_CMD_GET_MAX_SLAVES 0x400A /* obsoleted */ #define TIPC_CMD_GET_MAX_SLAVES 0x400A /* obsoleted */
#define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */ #define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */ #define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */
#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */ #define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */
#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */ #define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */
#define TIPC_CMD_SET_MAX_NODES 0x8009 /* tx unsigned, rx none */ #define TIPC_CMD_SET_MAX_NODES 0x8009 /* obsoleted */
#define TIPC_CMD_SET_MAX_SLAVES 0x800A /* obsoleted */ #define TIPC_CMD_SET_MAX_SLAVES 0x800A /* obsoleted */
#define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */ #define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */
......
...@@ -29,18 +29,6 @@ config TIPC_ADVANCED ...@@ -29,18 +29,6 @@ config TIPC_ADVANCED
Saying Y here will open some advanced configuration for TIPC. Saying Y here will open some advanced configuration for TIPC.
Most users do not need to bother; if unsure, just say N. Most users do not need to bother; if unsure, just say N.
config TIPC_NODES
int "Maximum number of nodes in a cluster"
depends on TIPC_ADVANCED
range 8 2047
default "255"
help
Specifies how many nodes can be supported in a TIPC cluster.
Can range from 8 to 2047 nodes; default is 255.
Setting this to a smaller value saves some memory;
setting it to higher allows for more nodes.
config TIPC_PORTS config TIPC_PORTS
int "Maximum number of ports in a node" int "Maximum number of ports in a node"
depends on TIPC_ADVANCED depends on TIPC_ADVANCED
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/addr.c: TIPC address utility routines * net/tipc/addr.c: TIPC address utility routines
* *
* Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2000-2006, Ericsson AB
* Copyright (c) 2004-2005, Wind River Systems * Copyright (c) 2004-2005, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
* tipc_addr_domain_valid - validates a network domain address * tipc_addr_domain_valid - validates a network domain address
* *
* Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>, * Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>,
* where Z, C, and N are non-zero and do not exceed the configured limits. * where Z, C, and N are non-zero.
* *
* Returns 1 if domain address is valid, otherwise 0 * Returns 1 if domain address is valid, otherwise 0
*/ */
...@@ -51,10 +51,6 @@ int tipc_addr_domain_valid(u32 addr) ...@@ -51,10 +51,6 @@ int tipc_addr_domain_valid(u32 addr)
u32 n = tipc_node(addr); u32 n = tipc_node(addr);
u32 c = tipc_cluster(addr); u32 c = tipc_cluster(addr);
u32 z = tipc_zone(addr); u32 z = tipc_zone(addr);
u32 max_nodes = tipc_max_nodes;
if (n > max_nodes)
return 0;
if (n && (!z || !c)) if (n && (!z || !c))
return 0; return 0;
...@@ -66,8 +62,7 @@ int tipc_addr_domain_valid(u32 addr) ...@@ -66,8 +62,7 @@ int tipc_addr_domain_valid(u32 addr)
/** /**
* tipc_addr_node_valid - validates a proposed network address for this node * tipc_addr_node_valid - validates a proposed network address for this node
* *
* Accepts <Z.C.N>, where Z, C, and N are non-zero and do not exceed * Accepts <Z.C.N>, where Z, C, and N are non-zero.
* the configured limits.
* *
* Returns 1 if address can be used, otherwise 0 * Returns 1 if address can be used, otherwise 0
*/ */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/config.c: TIPC configuration management code * net/tipc/config.c: TIPC configuration management code
* *
* Copyright (c) 2002-2006, Ericsson AB * Copyright (c) 2002-2006, Ericsson AB
* Copyright (c) 2004-2007, Wind River Systems * Copyright (c) 2004-2007, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -260,25 +260,6 @@ static struct sk_buff *cfg_set_max_ports(void) ...@@ -260,25 +260,6 @@ static struct sk_buff *cfg_set_max_ports(void)
return tipc_cfg_reply_none(); return tipc_cfg_reply_none();
} }
static struct sk_buff *cfg_set_max_nodes(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_nodes)
return tipc_cfg_reply_none();
if (value != delimit(value, 8, 2047))
return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (max nodes must be 8-2047)");
if (tipc_mode == TIPC_NET_MODE)
return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (cannot change max nodes once TIPC has joined a network)");
tipc_max_nodes = value;
return tipc_cfg_reply_none();
}
static struct sk_buff *cfg_set_netid(void) static struct sk_buff *cfg_set_netid(void)
{ {
u32 value; u32 value;
...@@ -397,9 +378,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area ...@@ -397,9 +378,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
case TIPC_CMD_SET_MAX_SUBSCR: case TIPC_CMD_SET_MAX_SUBSCR:
rep_tlv_buf = cfg_set_max_subscriptions(); rep_tlv_buf = cfg_set_max_subscriptions();
break; break;
case TIPC_CMD_SET_MAX_NODES:
rep_tlv_buf = cfg_set_max_nodes();
break;
case TIPC_CMD_SET_NETID: case TIPC_CMD_SET_NETID:
rep_tlv_buf = cfg_set_netid(); rep_tlv_buf = cfg_set_netid();
break; break;
...@@ -415,9 +393,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area ...@@ -415,9 +393,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
case TIPC_CMD_GET_MAX_SUBSCR: case TIPC_CMD_GET_MAX_SUBSCR:
rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_subscriptions); rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_subscriptions);
break; break;
case TIPC_CMD_GET_MAX_NODES:
rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_nodes);
break;
case TIPC_CMD_GET_NETID: case TIPC_CMD_GET_NETID:
rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_net_id); rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_net_id);
break; break;
...@@ -431,6 +406,8 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area ...@@ -431,6 +406,8 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
case TIPC_CMD_GET_MAX_SLAVES: case TIPC_CMD_GET_MAX_SLAVES:
case TIPC_CMD_SET_MAX_CLUSTERS: case TIPC_CMD_SET_MAX_CLUSTERS:
case TIPC_CMD_GET_MAX_CLUSTERS: case TIPC_CMD_GET_MAX_CLUSTERS:
case TIPC_CMD_SET_MAX_NODES:
case TIPC_CMD_GET_MAX_NODES:
rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (obsolete command)"); " (obsolete command)");
break; break;
......
...@@ -41,10 +41,6 @@ ...@@ -41,10 +41,6 @@
#include "config.h" #include "config.h"
#ifndef CONFIG_TIPC_NODES
#define CONFIG_TIPC_NODES 255
#endif
#ifndef CONFIG_TIPC_PORTS #ifndef CONFIG_TIPC_PORTS
#define CONFIG_TIPC_PORTS 8191 #define CONFIG_TIPC_PORTS 8191
#endif #endif
...@@ -64,7 +60,6 @@ const char tipc_alphabet[] = ...@@ -64,7 +60,6 @@ const char tipc_alphabet[] =
/* configurable TIPC parameters */ /* configurable TIPC parameters */
u32 tipc_own_addr; u32 tipc_own_addr;
int tipc_max_nodes;
int tipc_max_ports; int tipc_max_ports;
int tipc_max_subscriptions; int tipc_max_subscriptions;
int tipc_max_publications; int tipc_max_publications;
...@@ -192,7 +187,6 @@ static int __init tipc_init(void) ...@@ -192,7 +187,6 @@ static int __init tipc_init(void)
tipc_max_publications = 10000; tipc_max_publications = 10000;
tipc_max_subscriptions = 2000; tipc_max_subscriptions = 2000;
tipc_max_ports = CONFIG_TIPC_PORTS; tipc_max_ports = CONFIG_TIPC_PORTS;
tipc_max_nodes = CONFIG_TIPC_NODES;
tipc_net_id = 4711; tipc_net_id = 4711;
res = tipc_core_start(); res = tipc_core_start();
......
...@@ -147,7 +147,6 @@ void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *); ...@@ -147,7 +147,6 @@ void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *);
*/ */
extern u32 tipc_own_addr; extern u32 tipc_own_addr;
extern int tipc_max_nodes;
extern int tipc_max_ports; extern int tipc_max_ports;
extern int tipc_max_subscriptions; extern int tipc_max_subscriptions;
extern int tipc_max_publications; extern int tipc_max_publications;
......
...@@ -114,8 +114,7 @@ atomic_t tipc_num_links; ...@@ -114,8 +114,7 @@ atomic_t tipc_num_links;
static int net_start(void) static int net_start(void)
{ {
tipc_nodes = kcalloc(tipc_max_nodes + 1, tipc_nodes = kcalloc(4096, sizeof(*tipc_nodes), GFP_ATOMIC);
sizeof(*tipc_nodes), GFP_ATOMIC);
tipc_highest_node = 0; tipc_highest_node = 0;
atomic_set(&tipc_num_links, 0); atomic_set(&tipc_num_links, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment