aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2011-11-04 11:54:43 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-02-24 17:05:15 -0500
commita635b46bd884efc1fc98819cb5a200da255d575c (patch)
tree11474076133688401f58c8c0801b2c49776aa441 /net/tipc
parent9efde4a0bd2f21dec0c7b40da2bf2c3e189e98e2 (diff)
tipc: Hide internal details of node table implementation
Relocates information about the size of TIPC's node table index and its associated hash function, since only node subsystem routines need to have access to this information. Note that these changes are essentially cosmetic in nature, and have no impact on the actual operation of TIPC. Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/node.c13
-rw-r--r--net/tipc/node.h12
2 files changed, 13 insertions, 12 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 153425997cce..1790f503f57b 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -39,6 +39,8 @@
39#include "node.h" 39#include "node.h"
40#include "name_distr.h" 40#include "name_distr.h"
41 41
42#define NODE_HTABLE_SIZE 512
43
42static void node_lost_contact(struct tipc_node *n_ptr); 44static void node_lost_contact(struct tipc_node *n_ptr);
43static void node_established_contact(struct tipc_node *n_ptr); 45static void node_established_contact(struct tipc_node *n_ptr);
44 46
@@ -51,6 +53,17 @@ static u32 tipc_num_nodes;
51static atomic_t tipc_num_links = ATOMIC_INIT(0); 53static atomic_t tipc_num_links = ATOMIC_INIT(0);
52 54
53/* 55/*
56 * A trivial power-of-two bitmask technique is used for speed, since this
57 * operation is done for every incoming TIPC packet. The number of hash table
58 * entries has been chosen so that no hash chain exceeds 8 nodes and will
59 * usually be much smaller (typically only a single node).
60 */
61static inline unsigned int tipc_hashfn(u32 addr)
62{
63 return addr & (NODE_HTABLE_SIZE - 1);
64}
65
66/*
54 * tipc_node_find - locate specified node object, if it exists 67 * tipc_node_find - locate specified node object, if it exists
55 */ 68 */
56 69
diff --git a/net/tipc/node.h b/net/tipc/node.h
index 7bf526af1dfb..72561c971d67 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -107,20 +107,8 @@ struct tipc_node {
107 } bclink; 107 } bclink;
108}; 108};
109 109
110#define NODE_HTABLE_SIZE 512
111extern struct list_head tipc_node_list; 110extern struct list_head tipc_node_list;
112 111
113/*
114 * A trivial power-of-two bitmask technique is used for speed, since this
115 * operation is done for every incoming TIPC packet. The number of hash table
116 * entries has been chosen so that no hash chain exceeds 8 nodes and will
117 * usually be much smaller (typically only a single node).
118 */
119static inline unsigned int tipc_hashfn(u32 addr)
120{
121 return addr & (NODE_HTABLE_SIZE - 1);
122}
123
124struct tipc_node *tipc_node_find(u32 addr); 112struct tipc_node *tipc_node_find(u32 addr);
125struct tipc_node *tipc_node_create(u32 addr); 113struct tipc_node *tipc_node_create(u32 addr);
126void tipc_node_delete(struct tipc_node *n_ptr); 114void tipc_node_delete(struct tipc_node *n_ptr);