diff options
Diffstat (limited to 'net/tipc/node.c')
-rw-r--r-- | net/tipc/node.c | 13 |
1 files changed, 13 insertions, 0 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 | |||
42 | static void node_lost_contact(struct tipc_node *n_ptr); | 44 | static void node_lost_contact(struct tipc_node *n_ptr); |
43 | static void node_established_contact(struct tipc_node *n_ptr); | 45 | static void node_established_contact(struct tipc_node *n_ptr); |
44 | 46 | ||
@@ -51,6 +53,17 @@ static u32 tipc_num_nodes; | |||
51 | static atomic_t tipc_num_links = ATOMIC_INIT(0); | 53 | static 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 | */ | ||
61 | static 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 | ||