aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorJon Maloy <jon.maloy@ericsson.com>2018-03-15 11:48:52 -0400
committerDavid S. Miller <davem@davemloft.net>2018-03-17 17:11:46 -0400
commit64a52b26d5633d6efc35cdf1e0c627cc4189e55a (patch)
treee5d40c7be6e87953313e10ea698db475b6071725 /net/tipc
parent928df1880e24bcd47d6359ff86df24db3dfba3c3 (diff)
tipc: remove zone publication list in name table
As a consequence of the previous commit we nan now eliminate zone scope related lists in the name table. We start with name_table::publ_list[3], which can now be replaced with two lists, one for node scope publications and one for cluster scope publications. Acked-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/core.h5
-rw-r--r--net/tipc/name_distr.c39
-rw-r--r--net/tipc/name_table.c5
-rw-r--r--net/tipc/name_table.h6
4 files changed, 29 insertions, 26 deletions
diff --git a/net/tipc/core.h b/net/tipc/core.h
index ff8b071654f5..347f850dc872 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -131,6 +131,11 @@ static inline struct list_head *tipc_nodes(struct net *net)
131 return &tipc_net(net)->node_list; 131 return &tipc_net(net)->node_list;
132} 132}
133 133
134static inline struct name_table *tipc_name_table(struct net *net)
135{
136 return tipc_net(net)->nametbl;
137}
138
134static inline struct tipc_topsrv *tipc_topsrv(struct net *net) 139static inline struct tipc_topsrv *tipc_topsrv(struct net *net)
135{ 140{
136 return tipc_net(net)->topsrv; 141 return tipc_net(net)->topsrv;
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 23f8899e0f8c..11ce20505550 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -86,25 +86,25 @@ static struct sk_buff *named_prepare_buf(struct net *net, u32 type, u32 size,
86 */ 86 */
87struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ) 87struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ)
88{ 88{
89 struct tipc_net *tn = net_generic(net, tipc_net_id); 89 struct name_table *nt = tipc_name_table(net);
90 struct sk_buff *buf;
91 struct distr_item *item; 90 struct distr_item *item;
91 struct sk_buff *skb;
92 92
93 list_add_tail_rcu(&publ->local_list, 93 if (publ->scope == TIPC_NODE_SCOPE) {
94 &tn->nametbl->publ_list[publ->scope]); 94 list_add_tail_rcu(&publ->local_list, &nt->node_scope);
95
96 if (publ->scope == TIPC_NODE_SCOPE)
97 return NULL; 95 return NULL;
96 }
97 list_add_tail_rcu(&publ->local_list, &nt->cluster_scope);
98 98
99 buf = named_prepare_buf(net, PUBLICATION, ITEM_SIZE, 0); 99 skb = named_prepare_buf(net, PUBLICATION, ITEM_SIZE, 0);
100 if (!buf) { 100 if (!skb) {
101 pr_warn("Publication distribution failure\n"); 101 pr_warn("Publication distribution failure\n");
102 return NULL; 102 return NULL;
103 } 103 }
104 104
105 item = (struct distr_item *)msg_data(buf_msg(buf)); 105 item = (struct distr_item *)msg_data(buf_msg(skb));
106 publ_to_item(item, publ); 106 publ_to_item(item, publ);
107 return buf; 107 return skb;
108} 108}
109 109
110/** 110/**
@@ -184,16 +184,13 @@ static void named_distribute(struct net *net, struct sk_buff_head *list,
184 */ 184 */
185void tipc_named_node_up(struct net *net, u32 dnode) 185void tipc_named_node_up(struct net *net, u32 dnode)
186{ 186{
187 struct tipc_net *tn = net_generic(net, tipc_net_id); 187 struct name_table *nt = tipc_name_table(net);
188 struct sk_buff_head head; 188 struct sk_buff_head head;
189 189
190 __skb_queue_head_init(&head); 190 __skb_queue_head_init(&head);
191 191
192 rcu_read_lock(); 192 rcu_read_lock();
193 named_distribute(net, &head, dnode, 193 named_distribute(net, &head, dnode, &nt->cluster_scope);
194 &tn->nametbl->publ_list[TIPC_CLUSTER_SCOPE]);
195 named_distribute(net, &head, dnode,
196 &tn->nametbl->publ_list[TIPC_ZONE_SCOPE]);
197 rcu_read_unlock(); 194 rcu_read_unlock();
198 195
199 tipc_node_xmit(net, &head, dnode, 0); 196 tipc_node_xmit(net, &head, dnode, 0);
@@ -382,16 +379,16 @@ void tipc_named_rcv(struct net *net, struct sk_buff_head *inputq)
382 */ 379 */
383void tipc_named_reinit(struct net *net) 380void tipc_named_reinit(struct net *net)
384{ 381{
385 struct tipc_net *tn = net_generic(net, tipc_net_id); 382 struct name_table *nt = tipc_name_table(net);
383 struct tipc_net *tn = tipc_net(net);
386 struct publication *publ; 384 struct publication *publ;
387 int scope;
388 385
389 spin_lock_bh(&tn->nametbl_lock); 386 spin_lock_bh(&tn->nametbl_lock);
390 387
391 for (scope = TIPC_ZONE_SCOPE; scope <= TIPC_NODE_SCOPE; scope++) 388 list_for_each_entry_rcu(publ, &nt->node_scope, local_list)
392 list_for_each_entry_rcu(publ, &tn->nametbl->publ_list[scope], 389 publ->node = tn->own_addr;
393 local_list) 390 list_for_each_entry_rcu(publ, &nt->cluster_scope, local_list)
394 publ->node = tn->own_addr; 391 publ->node = tn->own_addr;
395 392
396 spin_unlock_bh(&tn->nametbl_lock); 393 spin_unlock_bh(&tn->nametbl_lock);
397} 394}
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 6772390fcb00..1a3a327018c5 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -878,9 +878,8 @@ int tipc_nametbl_init(struct net *net)
878 for (i = 0; i < TIPC_NAMETBL_SIZE; i++) 878 for (i = 0; i < TIPC_NAMETBL_SIZE; i++)
879 INIT_HLIST_HEAD(&tipc_nametbl->seq_hlist[i]); 879 INIT_HLIST_HEAD(&tipc_nametbl->seq_hlist[i]);
880 880
881 INIT_LIST_HEAD(&tipc_nametbl->publ_list[TIPC_ZONE_SCOPE]); 881 INIT_LIST_HEAD(&tipc_nametbl->node_scope);
882 INIT_LIST_HEAD(&tipc_nametbl->publ_list[TIPC_CLUSTER_SCOPE]); 882 INIT_LIST_HEAD(&tipc_nametbl->cluster_scope);
883 INIT_LIST_HEAD(&tipc_nametbl->publ_list[TIPC_NODE_SCOPE]);
884 tn->nametbl = tipc_nametbl; 883 tn->nametbl = tipc_nametbl;
885 spin_lock_init(&tn->nametbl_lock); 884 spin_lock_init(&tn->nametbl_lock);
886 return 0; 885 return 0;
diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h
index 17652602d5e2..47f72cddfb39 100644
--- a/net/tipc/name_table.h
+++ b/net/tipc/name_table.h
@@ -88,12 +88,14 @@ struct publication {
88/** 88/**
89 * struct name_table - table containing all existing port name publications 89 * struct name_table - table containing all existing port name publications
90 * @seq_hlist: name sequence hash lists 90 * @seq_hlist: name sequence hash lists
91 * @publ_list: pulication lists 91 * @node_scope: all local publications with node scope
92 * @cluster_scope: all local publications with cluster scope
92 * @local_publ_count: number of publications issued by this node 93 * @local_publ_count: number of publications issued by this node
93 */ 94 */
94struct name_table { 95struct name_table {
95 struct hlist_head seq_hlist[TIPC_NAMETBL_SIZE]; 96 struct hlist_head seq_hlist[TIPC_NAMETBL_SIZE];
96 struct list_head publ_list[TIPC_PUBL_SCOPE_NUM]; 97 struct list_head node_scope;
98 struct list_head cluster_scope;
97 u32 local_publ_count; 99 u32 local_publ_count;
98}; 100};
99 101