Commit a909804f authored by Allan Stephens's avatar Allan Stephens Committed by Paul Gortmaker

tipc: Separate cluster-scope and zone-scope names into distinct lists

Utilizes distinct lists to track zone-scope and cluster-scope names
published by a node. For now, TIPC continues to process the entries
in both lists in the same way; however, an upcoming patch will utilize
the existence of the lists to prevent the sending of cluster-scope names
to nodes that are not part of the local cluster.

To achieve this, an array of publication lists is introduced, so
that they can be iterated over and accessed via publ->scope as
an index where convenient.
Signed-off-by: default avatarAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
parent e11aa059
...@@ -77,11 +77,29 @@ struct publ_list { ...@@ -77,11 +77,29 @@ struct publ_list {
u32 size; u32 size;
}; };
static struct publ_list publ_zone = {
.list = LIST_HEAD_INIT(publ_zone.list),
.size = 0,
};
static struct publ_list publ_cluster = { static struct publ_list publ_cluster = {
.list = LIST_HEAD_INIT(publ_cluster.list), .list = LIST_HEAD_INIT(publ_cluster.list),
.size = 0, .size = 0,
}; };
static struct publ_list publ_node = {
.list = LIST_HEAD_INIT(publ_node.list),
.size = 0,
};
static struct publ_list *publ_lists[] = {
NULL,
&publ_zone, /* publ_lists[TIPC_ZONE_SCOPE] */
&publ_cluster, /* publ_lists[TIPC_CLUSTER_SCOPE] */
&publ_node /* publ_lists[TIPC_NODE_SCOPE] */
};
/** /**
* publ_to_item - add publication info to a publication message * publ_to_item - add publication info to a publication message
*/ */
...@@ -139,8 +157,8 @@ void tipc_named_publish(struct publication *publ) ...@@ -139,8 +157,8 @@ void tipc_named_publish(struct publication *publ)
struct sk_buff *buf; struct sk_buff *buf;
struct distr_item *item; struct distr_item *item;
list_add_tail(&publ->local_list, &publ_cluster.list); list_add_tail(&publ->local_list, &publ_lists[publ->scope]->list);
publ_cluster.size++; publ_lists[publ->scope]->size++;
buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0); buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0);
if (!buf) { if (!buf) {
...@@ -163,7 +181,7 @@ void tipc_named_withdraw(struct publication *publ) ...@@ -163,7 +181,7 @@ void tipc_named_withdraw(struct publication *publ)
struct distr_item *item; struct distr_item *item;
list_del(&publ->local_list); list_del(&publ->local_list);
publ_cluster.size--; publ_lists[publ->scope]->size--;
buf = named_prepare_buf(WITHDRAWAL, ITEM_SIZE, 0); buf = named_prepare_buf(WITHDRAWAL, ITEM_SIZE, 0);
if (!buf) { if (!buf) {
...@@ -243,6 +261,7 @@ void tipc_named_node_up(unsigned long nodearg) ...@@ -243,6 +261,7 @@ void tipc_named_node_up(unsigned long nodearg)
read_lock_bh(&tipc_nametbl_lock); read_lock_bh(&tipc_nametbl_lock);
named_distribute(&message_list, node, &publ_cluster, max_item_buf); named_distribute(&message_list, node, &publ_cluster, max_item_buf);
named_distribute(&message_list, node, &publ_zone, max_item_buf);
read_unlock_bh(&tipc_nametbl_lock); read_unlock_bh(&tipc_nametbl_lock);
tipc_link_send_names(&message_list, (u32)node); tipc_link_send_names(&message_list, (u32)node);
...@@ -340,11 +359,13 @@ void tipc_named_recv(struct sk_buff *buf) ...@@ -340,11 +359,13 @@ void tipc_named_recv(struct sk_buff *buf)
void tipc_named_reinit(void) void tipc_named_reinit(void)
{ {
struct publication *publ; struct publication *publ;
int scope;
write_lock_bh(&tipc_nametbl_lock); write_lock_bh(&tipc_nametbl_lock);
list_for_each_entry(publ, &publ_cluster.list, local_list) for (scope = TIPC_ZONE_SCOPE; scope <= TIPC_CLUSTER_SCOPE; scope++)
publ->node = tipc_own_addr; list_for_each_entry(publ, &publ_lists[scope]->list, local_list)
publ->node = tipc_own_addr;
write_unlock_bh(&tipc_nametbl_lock); write_unlock_bh(&tipc_nametbl_lock);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment