aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/node.c
diff options
context:
space:
mode:
authorHoang Le <hoang.h.le@dektech.com.au>2019-03-19 07:49:49 -0400
committerDavid S. Miller <davem@davemloft.net>2019-03-19 16:56:17 -0400
commitff2ebbfba6186adf3964eb816f8f255c6e664dc4 (patch)
tree12310faa497e8e64adf2b9628e24011159820531 /net/tipc/node.c
parent02ec6cafd78c2052283516afc74c309745d20271 (diff)
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: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/node.c')
-rw-r--r--net/tipc/node.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 2dc4919ab23c..2717893e9dbe 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -383,6 +383,11 @@ static struct tipc_node *tipc_node_create(struct net *net, u32 addr,
383 tipc_link_update_caps(l, capabilities); 383 tipc_link_update_caps(l, capabilities);
384 } 384 }
385 write_unlock_bh(&n->lock); 385 write_unlock_bh(&n->lock);
386 /* Calculate cluster capabilities */
387 tn->capabilities = TIPC_NODE_CAPABILITIES;
388 list_for_each_entry_rcu(temp_node, &tn->node_list, list) {
389 tn->capabilities &= temp_node->capabilities;
390 }
386 goto exit; 391 goto exit;
387 } 392 }
388 n = kzalloc(sizeof(*n), GFP_ATOMIC); 393 n = kzalloc(sizeof(*n), GFP_ATOMIC);
@@ -433,6 +438,11 @@ static struct tipc_node *tipc_node_create(struct net *net, u32 addr,
433 break; 438 break;
434 } 439 }
435 list_add_tail_rcu(&n->list, &temp_node->list); 440 list_add_tail_rcu(&n->list, &temp_node->list);
441 /* Calculate cluster capabilities */
442 tn->capabilities = TIPC_NODE_CAPABILITIES;
443 list_for_each_entry_rcu(temp_node, &tn->node_list, list) {
444 tn->capabilities &= temp_node->capabilities;
445 }
436 trace_tipc_node_create(n, true, " "); 446 trace_tipc_node_create(n, true, " ");
437exit: 447exit:
438 spin_unlock_bh(&tn->node_list_lock); 448 spin_unlock_bh(&tn->node_list_lock);
@@ -589,6 +599,7 @@ static void tipc_node_clear_links(struct tipc_node *node)
589 */ 599 */
590static bool tipc_node_cleanup(struct tipc_node *peer) 600static bool tipc_node_cleanup(struct tipc_node *peer)
591{ 601{
602 struct tipc_node *temp_node;
592 struct tipc_net *tn = tipc_net(peer->net); 603 struct tipc_net *tn = tipc_net(peer->net);
593 bool deleted = false; 604 bool deleted = false;
594 605
@@ -604,6 +615,13 @@ static bool tipc_node_cleanup(struct tipc_node *peer)
604 deleted = true; 615 deleted = true;
605 } 616 }
606 tipc_node_write_unlock(peer); 617 tipc_node_write_unlock(peer);
618
619 /* Calculate cluster capabilities */
620 tn->capabilities = TIPC_NODE_CAPABILITIES;
621 list_for_each_entry_rcu(temp_node, &tn->node_list, list) {
622 tn->capabilities &= temp_node->capabilities;
623 }
624
607 spin_unlock_bh(&tn->node_list_lock); 625 spin_unlock_bh(&tn->node_list_lock);
608 return deleted; 626 return deleted;
609} 627}