summaryrefslogtreecommitdiffstats
path: root/net/tipc/name_table.h
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2014-12-02 08:00:24 +0100
committerDavid S. Miller <davem@davemloft.net>2014-12-09 02:39:56 +0100
commit993bfe5daf34c645a51348facdc7c28c55f488fe (patch)
tree004748177d0ee50bfad2e6b12f3364f7e047adf9 /net/tipc/name_table.h
parenttipc: remove size variable from publ_list struct (diff)
downloadlinux-993bfe5daf34c645a51348facdc7c28c55f488fe.tar.xz
linux-993bfe5daf34c645a51348facdc7c28c55f488fe.zip
tipc: make name table allocated dynamically
Name table locking policy is going to be adjusted from read-write lock protection to RCU lock protection in the future commits. But its essential precondition is to convert the allocation way of name table from static to dynamic mode. Signed-off-by: Ying Xue <ying.xue@windriver.com> Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Tested-by: Erik Hugne <erik.hugne@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/name_table.h')
-rw-r--r--net/tipc/name_table.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h
index c62877826655..c1fd734eb0d5 100644
--- a/net/tipc/name_table.h
+++ b/net/tipc/name_table.h
@@ -43,7 +43,9 @@ struct tipc_port_list;
/*
* TIPC name types reserved for internal TIPC use (both current and planned)
*/
-#define TIPC_ZM_SRV 3 /* zone master service name type */
+#define TIPC_ZM_SRV 3 /* zone master service name type */
+#define TIPC_PUBL_SCOPE_NUM (TIPC_NODE_SCOPE + 1)
+#define TIPC_NAMETBL_SIZE 1024 /* must be a power of 2 */
/**
* struct publication - info about a published (name or) name sequence
@@ -79,8 +81,20 @@ struct publication {
struct list_head zone_list;
};
+/**
+ * struct name_table - table containing all existing port name publications
+ * @seq_hlist: name sequence hash lists
+ * @publ_list: pulication lists
+ * @local_publ_count: number of publications issued by this node
+ */
+struct name_table {
+ struct hlist_head seq_hlist[TIPC_NAMETBL_SIZE];
+ struct list_head publ_list[TIPC_PUBL_SCOPE_NUM];
+ u32 local_publ_count;
+};
extern rwlock_t tipc_nametbl_lock;
+extern struct name_table *tipc_nametbl;
int tipc_nl_name_table_dump(struct sk_buff *skb, struct netlink_callback *cb);