From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <allan.stephens@windriver.com>,
<ying.xue@windriver.com>
Subject: [PATCH net-next 03/16] tipc: Separate cluster-scope and zone-scope names into distinct lists
Date: Fri, 20 Apr 2012 17:05:11 -0400 [thread overview]
Message-ID: <1334955924-907-4-git-send-email-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <1334955924-907-1-git-send-email-paul.gortmaker@windriver.com>
From: Allan Stephens <allan.stephens@windriver.com>
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: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/name_distr.c | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 3be0eb9..8751ea5 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -77,11 +77,29 @@ struct publ_list {
u32 size;
};
+static struct publ_list publ_zone = {
+ .list = LIST_HEAD_INIT(publ_zone.list),
+ .size = 0,
+};
+
static struct publ_list publ_cluster = {
.list = LIST_HEAD_INIT(publ_cluster.list),
.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
*/
@@ -139,8 +157,8 @@ void tipc_named_publish(struct publication *publ)
struct sk_buff *buf;
struct distr_item *item;
- list_add_tail(&publ->local_list, &publ_cluster.list);
- publ_cluster.size++;
+ list_add_tail(&publ->local_list, &publ_lists[publ->scope]->list);
+ publ_lists[publ->scope]->size++;
buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0);
if (!buf) {
@@ -163,7 +181,7 @@ void tipc_named_withdraw(struct publication *publ)
struct distr_item *item;
list_del(&publ->local_list);
- publ_cluster.size--;
+ publ_lists[publ->scope]->size--;
buf = named_prepare_buf(WITHDRAWAL, ITEM_SIZE, 0);
if (!buf) {
@@ -243,6 +261,7 @@ void tipc_named_node_up(unsigned long nodearg)
read_lock_bh(&tipc_nametbl_lock);
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);
tipc_link_send_names(&message_list, (u32)node);
@@ -340,11 +359,13 @@ void tipc_named_recv(struct sk_buff *buf)
void tipc_named_reinit(void)
{
struct publication *publ;
+ int scope;
write_lock_bh(&tipc_nametbl_lock);
- list_for_each_entry(publ, &publ_cluster.list, local_list)
- publ->node = tipc_own_addr;
+ for (scope = TIPC_ZONE_SCOPE; scope <= TIPC_CLUSTER_SCOPE; scope++)
+ list_for_each_entry(publ, &publ_lists[scope]->list, local_list)
+ publ->node = tipc_own_addr;
write_unlock_bh(&tipc_nametbl_lock);
}
--
1.7.9.3
next prev parent reply other threads:[~2012-04-20 21:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-20 21:05 [PATCH net-next 00/16] tipc: publication lists and zero node handling Paul Gortmaker
2012-04-20 21:05 ` [PATCH net-next 01/16] tipc: introduce publication lists struct Paul Gortmaker
2012-04-20 21:05 ` [PATCH net-next 02/16] tipc: Factor out name publication code to a separate function Paul Gortmaker
2012-04-20 21:05 ` Paul Gortmaker [this message]
2012-04-20 21:05 ` [PATCH net-next 04/16] tipc: Update node-scope publications when network address is assigned Paul Gortmaker
2012-04-20 21:05 ` [PATCH net-next 05/16] tipc: Don't record failed publication attempt as a success Paul Gortmaker
2012-04-20 21:05 ` [PATCH net-next 06/16] tipc: Add routines for safe checking of node's network address Paul Gortmaker
2012-04-20 21:05 ` [PATCH net-next 07/16] tipc: Ensure network address change doesn't impact name table updates Paul Gortmaker
2012-04-20 21:05 ` [PATCH net-next 08/16] tipc: Optimize re-initialization of port message header templates Paul Gortmaker
2012-04-20 21:05 ` [PATCH net-next 09/16] tipc: Ensure network address change doesn't impact new port Paul Gortmaker
2012-04-20 21:05 ` [PATCH net-next 10/16] tipc: delete duplicate peerport/peernode helper functions Paul Gortmaker
2012-04-20 21:05 ` [PATCH net-next 11/16] tipc: Ensure network address change doesn't impact local connections Paul Gortmaker
2012-04-20 21:05 ` [PATCH net-next 12/16] tipc: take lock while updating node network address Paul Gortmaker
2012-04-20 21:05 ` [PATCH net-next 13/16] tipc: properly handle off-node send requests with invalid addr Paul Gortmaker
2012-04-20 21:05 ` [PATCH net-next 14/16] tipc: handle <0.0.0> as an alias for this node on outgoing msgs Paul Gortmaker
2012-04-20 21:05 ` [PATCH net-next 15/16] tipc: Ensure network address change doesn't impact rejected message Paul Gortmaker
2012-04-20 21:05 ` [PATCH net-next 16/16] tipc: Ensure network address change doesn't impact configuration service Paul Gortmaker
2012-04-21 0:45 ` [PATCH net-next 00/16] tipc: publication lists and zero node handling David Miller
2012-04-23 14:49 ` [PATCH net-next] tipc: remove inline instances from C source files Paul Gortmaker
2012-04-24 4:41 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1334955924-907-4-git-send-email-paul.gortmaker@windriver.com \
--to=paul.gortmaker@windriver.com \
--cc=allan.stephens@windriver.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=ying.xue@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).