提交 ff2ebbfb 编写于 作者: H Hoang Le 提交者: David S. Miller

tipc: introduce new capability flag for cluster

As a preparation for introducing a smooth switching between replicast
and broadcast method for multicast message, We have to introduce a new
capability flag TIPC_MCAST_RBCTL to handle this new feature.

During a cluster upgrade a node can come back with this new capabilities
which also must be reflected in the cluster capabilities field.
The new feature is only applicable if all node in the cluster supports
this new capability.
Acked-by: NJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: NHoang Le <hoang.h.le@dektech.com.au>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 02ec6caf
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "net.h" #include "net.h"
#include "socket.h" #include "socket.h"
#include "bcast.h" #include "bcast.h"
#include "node.h"
#include <linux/module.h> #include <linux/module.h>
...@@ -59,6 +60,7 @@ static int __net_init tipc_init_net(struct net *net) ...@@ -59,6 +60,7 @@ static int __net_init tipc_init_net(struct net *net)
tn->node_addr = 0; tn->node_addr = 0;
tn->trial_addr = 0; tn->trial_addr = 0;
tn->addr_trial_end = 0; tn->addr_trial_end = 0;
tn->capabilities = TIPC_NODE_CAPABILITIES;
memset(tn->node_id, 0, sizeof(tn->node_id)); memset(tn->node_id, 0, sizeof(tn->node_id));
memset(tn->node_id_string, 0, sizeof(tn->node_id_string)); memset(tn->node_id_string, 0, sizeof(tn->node_id_string));
tn->mon_threshold = TIPC_DEF_MON_THRESHOLD; tn->mon_threshold = TIPC_DEF_MON_THRESHOLD;
......
...@@ -122,6 +122,9 @@ struct tipc_net { ...@@ -122,6 +122,9 @@ struct tipc_net {
/* Topology subscription server */ /* Topology subscription server */
struct tipc_topsrv *topsrv; struct tipc_topsrv *topsrv;
atomic_t subscription_count; atomic_t subscription_count;
/* Cluster capabilities */
u16 capabilities;
}; };
static inline struct tipc_net *tipc_net(struct net *net) static inline struct tipc_net *tipc_net(struct net *net)
......
...@@ -383,6 +383,11 @@ static struct tipc_node *tipc_node_create(struct net *net, u32 addr, ...@@ -383,6 +383,11 @@ static struct tipc_node *tipc_node_create(struct net *net, u32 addr,
tipc_link_update_caps(l, capabilities); tipc_link_update_caps(l, capabilities);
} }
write_unlock_bh(&n->lock); write_unlock_bh(&n->lock);
/* Calculate cluster capabilities */
tn->capabilities = TIPC_NODE_CAPABILITIES;
list_for_each_entry_rcu(temp_node, &tn->node_list, list) {
tn->capabilities &= temp_node->capabilities;
}
goto exit; goto exit;
} }
n = kzalloc(sizeof(*n), GFP_ATOMIC); n = kzalloc(sizeof(*n), GFP_ATOMIC);
...@@ -433,6 +438,11 @@ static struct tipc_node *tipc_node_create(struct net *net, u32 addr, ...@@ -433,6 +438,11 @@ static struct tipc_node *tipc_node_create(struct net *net, u32 addr,
break; break;
} }
list_add_tail_rcu(&n->list, &temp_node->list); list_add_tail_rcu(&n->list, &temp_node->list);
/* Calculate cluster capabilities */
tn->capabilities = TIPC_NODE_CAPABILITIES;
list_for_each_entry_rcu(temp_node, &tn->node_list, list) {
tn->capabilities &= temp_node->capabilities;
}
trace_tipc_node_create(n, true, " "); trace_tipc_node_create(n, true, " ");
exit: exit:
spin_unlock_bh(&tn->node_list_lock); spin_unlock_bh(&tn->node_list_lock);
...@@ -589,6 +599,7 @@ static void tipc_node_clear_links(struct tipc_node *node) ...@@ -589,6 +599,7 @@ static void tipc_node_clear_links(struct tipc_node *node)
*/ */
static bool tipc_node_cleanup(struct tipc_node *peer) static bool tipc_node_cleanup(struct tipc_node *peer)
{ {
struct tipc_node *temp_node;
struct tipc_net *tn = tipc_net(peer->net); struct tipc_net *tn = tipc_net(peer->net);
bool deleted = false; bool deleted = false;
...@@ -604,6 +615,13 @@ static bool tipc_node_cleanup(struct tipc_node *peer) ...@@ -604,6 +615,13 @@ static bool tipc_node_cleanup(struct tipc_node *peer)
deleted = true; deleted = true;
} }
tipc_node_write_unlock(peer); tipc_node_write_unlock(peer);
/* Calculate cluster capabilities */
tn->capabilities = TIPC_NODE_CAPABILITIES;
list_for_each_entry_rcu(temp_node, &tn->node_list, list) {
tn->capabilities &= temp_node->capabilities;
}
spin_unlock_bh(&tn->node_list_lock); spin_unlock_bh(&tn->node_list_lock);
return deleted; return deleted;
} }
......
...@@ -51,7 +51,8 @@ enum { ...@@ -51,7 +51,8 @@ enum {
TIPC_BLOCK_FLOWCTL = (1 << 3), TIPC_BLOCK_FLOWCTL = (1 << 3),
TIPC_BCAST_RCAST = (1 << 4), TIPC_BCAST_RCAST = (1 << 4),
TIPC_NODE_ID128 = (1 << 5), TIPC_NODE_ID128 = (1 << 5),
TIPC_LINK_PROTO_SEQNO = (1 << 6) TIPC_LINK_PROTO_SEQNO = (1 << 6),
TIPC_MCAST_RBCTL = (1 << 7)
}; };
#define TIPC_NODE_CAPABILITIES (TIPC_SYN_BIT | \ #define TIPC_NODE_CAPABILITIES (TIPC_SYN_BIT | \
...@@ -60,7 +61,8 @@ enum { ...@@ -60,7 +61,8 @@ enum {
TIPC_BCAST_RCAST | \ TIPC_BCAST_RCAST | \
TIPC_BLOCK_FLOWCTL | \ TIPC_BLOCK_FLOWCTL | \
TIPC_NODE_ID128 | \ TIPC_NODE_ID128 | \
TIPC_LINK_PROTO_SEQNO) TIPC_LINK_PROTO_SEQNO | \
TIPC_MCAST_RBCTL)
#define INVALID_BEARER_ID -1 #define INVALID_BEARER_ID -1
void tipc_node_stop(struct net *net); void tipc_node_stop(struct net *net);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册