mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-24 15:42:32 +00:00
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>
This commit is contained in:
parent
928df1880e
commit
64a52b26d5
4 changed files with 29 additions and 26 deletions
|
@ -131,6 +131,11 @@ static inline struct list_head *tipc_nodes(struct net *net)
|
||||||
return &tipc_net(net)->node_list;
|
return &tipc_net(net)->node_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline struct name_table *tipc_name_table(struct net *net)
|
||||||
|
{
|
||||||
|
return tipc_net(net)->nametbl;
|
||||||
|
}
|
||||||
|
|
||||||
static inline struct tipc_topsrv *tipc_topsrv(struct net *net)
|
static inline struct tipc_topsrv *tipc_topsrv(struct net *net)
|
||||||
{
|
{
|
||||||
return tipc_net(net)->topsrv;
|
return tipc_net(net)->topsrv;
|
||||||
|
|
|
@ -86,25 +86,25 @@ static struct sk_buff *named_prepare_buf(struct net *net, u32 type, u32 size,
|
||||||
*/
|
*/
|
||||||
struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ)
|
struct sk_buff *tipc_named_publish(struct net *net, struct publication *publ)
|
||||||
{
|
{
|
||||||
struct tipc_net *tn = net_generic(net, tipc_net_id);
|
struct name_table *nt = tipc_name_table(net);
|
||||||
struct sk_buff *buf;
|
|
||||||
struct distr_item *item;
|
struct distr_item *item;
|
||||||
|
struct sk_buff *skb;
|
||||||
|
|
||||||
list_add_tail_rcu(&publ->local_list,
|
if (publ->scope == TIPC_NODE_SCOPE) {
|
||||||
&tn->nametbl->publ_list[publ->scope]);
|
list_add_tail_rcu(&publ->local_list, &nt->node_scope);
|
||||||
|
|
||||||
if (publ->scope == TIPC_NODE_SCOPE)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
list_add_tail_rcu(&publ->local_list, &nt->cluster_scope);
|
||||||
|
|
||||||
buf = named_prepare_buf(net, PUBLICATION, ITEM_SIZE, 0);
|
skb = named_prepare_buf(net, PUBLICATION, ITEM_SIZE, 0);
|
||||||
if (!buf) {
|
if (!skb) {
|
||||||
pr_warn("Publication distribution failure\n");
|
pr_warn("Publication distribution failure\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
item = (struct distr_item *)msg_data(buf_msg(buf));
|
item = (struct distr_item *)msg_data(buf_msg(skb));
|
||||||
publ_to_item(item, publ);
|
publ_to_item(item, publ);
|
||||||
return buf;
|
return skb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -184,16 +184,13 @@ static void named_distribute(struct net *net, struct sk_buff_head *list,
|
||||||
*/
|
*/
|
||||||
void tipc_named_node_up(struct net *net, u32 dnode)
|
void tipc_named_node_up(struct net *net, u32 dnode)
|
||||||
{
|
{
|
||||||
struct tipc_net *tn = net_generic(net, tipc_net_id);
|
struct name_table *nt = tipc_name_table(net);
|
||||||
struct sk_buff_head head;
|
struct sk_buff_head head;
|
||||||
|
|
||||||
__skb_queue_head_init(&head);
|
__skb_queue_head_init(&head);
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
named_distribute(net, &head, dnode,
|
named_distribute(net, &head, dnode, &nt->cluster_scope);
|
||||||
&tn->nametbl->publ_list[TIPC_CLUSTER_SCOPE]);
|
|
||||||
named_distribute(net, &head, dnode,
|
|
||||||
&tn->nametbl->publ_list[TIPC_ZONE_SCOPE]);
|
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
tipc_node_xmit(net, &head, dnode, 0);
|
tipc_node_xmit(net, &head, dnode, 0);
|
||||||
|
@ -382,16 +379,16 @@ void tipc_named_rcv(struct net *net, struct sk_buff_head *inputq)
|
||||||
*/
|
*/
|
||||||
void tipc_named_reinit(struct net *net)
|
void tipc_named_reinit(struct net *net)
|
||||||
{
|
{
|
||||||
struct tipc_net *tn = net_generic(net, tipc_net_id);
|
struct name_table *nt = tipc_name_table(net);
|
||||||
|
struct tipc_net *tn = tipc_net(net);
|
||||||
struct publication *publ;
|
struct publication *publ;
|
||||||
int scope;
|
|
||||||
|
|
||||||
spin_lock_bh(&tn->nametbl_lock);
|
spin_lock_bh(&tn->nametbl_lock);
|
||||||
|
|
||||||
for (scope = TIPC_ZONE_SCOPE; scope <= TIPC_NODE_SCOPE; scope++)
|
list_for_each_entry_rcu(publ, &nt->node_scope, local_list)
|
||||||
list_for_each_entry_rcu(publ, &tn->nametbl->publ_list[scope],
|
publ->node = tn->own_addr;
|
||||||
local_list)
|
list_for_each_entry_rcu(publ, &nt->cluster_scope, local_list)
|
||||||
publ->node = tn->own_addr;
|
publ->node = tn->own_addr;
|
||||||
|
|
||||||
spin_unlock_bh(&tn->nametbl_lock);
|
spin_unlock_bh(&tn->nametbl_lock);
|
||||||
}
|
}
|
||||||
|
|
|
@ -878,9 +878,8 @@ int tipc_nametbl_init(struct net *net)
|
||||||
for (i = 0; i < TIPC_NAMETBL_SIZE; i++)
|
for (i = 0; i < TIPC_NAMETBL_SIZE; i++)
|
||||||
INIT_HLIST_HEAD(&tipc_nametbl->seq_hlist[i]);
|
INIT_HLIST_HEAD(&tipc_nametbl->seq_hlist[i]);
|
||||||
|
|
||||||
INIT_LIST_HEAD(&tipc_nametbl->publ_list[TIPC_ZONE_SCOPE]);
|
INIT_LIST_HEAD(&tipc_nametbl->node_scope);
|
||||||
INIT_LIST_HEAD(&tipc_nametbl->publ_list[TIPC_CLUSTER_SCOPE]);
|
INIT_LIST_HEAD(&tipc_nametbl->cluster_scope);
|
||||||
INIT_LIST_HEAD(&tipc_nametbl->publ_list[TIPC_NODE_SCOPE]);
|
|
||||||
tn->nametbl = tipc_nametbl;
|
tn->nametbl = tipc_nametbl;
|
||||||
spin_lock_init(&tn->nametbl_lock);
|
spin_lock_init(&tn->nametbl_lock);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -88,12 +88,14 @@ struct publication {
|
||||||
/**
|
/**
|
||||||
* struct name_table - table containing all existing port name publications
|
* struct name_table - table containing all existing port name publications
|
||||||
* @seq_hlist: name sequence hash lists
|
* @seq_hlist: name sequence hash lists
|
||||||
* @publ_list: pulication lists
|
* @node_scope: all local publications with node scope
|
||||||
|
* @cluster_scope: all local publications with cluster scope
|
||||||
* @local_publ_count: number of publications issued by this node
|
* @local_publ_count: number of publications issued by this node
|
||||||
*/
|
*/
|
||||||
struct name_table {
|
struct name_table {
|
||||||
struct hlist_head seq_hlist[TIPC_NAMETBL_SIZE];
|
struct hlist_head seq_hlist[TIPC_NAMETBL_SIZE];
|
||||||
struct list_head publ_list[TIPC_PUBL_SCOPE_NUM];
|
struct list_head node_scope;
|
||||||
|
struct list_head cluster_scope;
|
||||||
u32 local_publ_count;
|
u32 local_publ_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue