Acked-by: Jon Maloy <jon.ma...@ericsson.com>

> -----Original Message-----
> From: Hoang Le <hoang.h...@dektech.com.au>
> Sent: 20-Nov-19 03:39
> To: Jon Maloy <jon.ma...@ericsson.com>; ma...@donjonn.com; 
> tipc-discussion@lists.sourceforge.net;
> ying....@windriver.com
> Subject: [net-next] tipc: update replicast capability for broadcast send link
> 
> When setting up a cluster with non-replicast/replicast capability
> supported. This capability will be disabled for broadcast send link
> in order to be backwards compatible.
> 
> However, when these non-support nodes left and be removed out the cluster.
> We don't update this capability on broadcast send link. Then, some of
> features that based on this capability will also disabling as unexpected.
> 
> In this commit, we make sure the broadcast send link capabilities will
> be re-calculated as soon as a node removed/rejoined a cluster.
> 
> Signed-off-by: Hoang Le <hoang.h...@dektech.com.au>
> ---
>  net/tipc/bcast.c | 4 ++--
>  net/tipc/bcast.h | 2 +-
>  net/tipc/link.c  | 2 +-
>  net/tipc/node.c  | 8 +++++++-
>  4 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
> index 44ed481fec47..3d14e60ef642 100644
> --- a/net/tipc/bcast.c
> +++ b/net/tipc/bcast.c
> @@ -87,9 +87,9 @@ int tipc_bcast_get_mtu(struct net *net)
>       return tipc_link_mss(tipc_bc_sndlink(net));
>  }
> 
> -void tipc_bcast_disable_rcast(struct net *net)
> +void tipc_bcast_toggle_rcast(struct net *net, bool supp)
>  {
> -     tipc_bc_base(net)->rcast_support = false;
> +     tipc_bc_base(net)->rcast_support = supp;
>  }
> 
>  static void tipc_bcbase_calc_bc_threshold(struct net *net)
> diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h
> index dadad953e2be..9e847d9617d3 100644
> --- a/net/tipc/bcast.h
> +++ b/net/tipc/bcast.h
> @@ -85,7 +85,7 @@ void tipc_bcast_remove_peer(struct net *net, struct 
> tipc_link *rcv_bcl);
>  void tipc_bcast_inc_bearer_dst_cnt(struct net *net, int bearer_id);
>  void tipc_bcast_dec_bearer_dst_cnt(struct net *net, int bearer_id);
>  int  tipc_bcast_get_mtu(struct net *net);
> -void tipc_bcast_disable_rcast(struct net *net);
> +void tipc_bcast_toggle_rcast(struct net *net, bool supp);
>  int tipc_mcast_xmit(struct net *net, struct sk_buff_head *pkts,
>                   struct tipc_mc_method *method, struct tipc_nlist *dests,
>                   u16 *cong_link_cnt);
> diff --git a/net/tipc/link.c b/net/tipc/link.c
> index a2e9a64d5a0f..5153b9bb7b3f 100644
> --- a/net/tipc/link.c
> +++ b/net/tipc/link.c
> @@ -550,7 +550,7 @@ bool tipc_link_bc_create(struct net *net, u32 ownnode, 
> u32 peer,
> 
>       /* Disable replicast if even a single peer doesn't support it */
>       if (link_is_bc_rcvlink(l) && !(peer_caps & TIPC_BCAST_RCAST))
> -             tipc_bcast_disable_rcast(net);
> +             tipc_bcast_toggle_rcast(net, false);
> 
>       return true;
>  }
> diff --git a/net/tipc/node.c b/net/tipc/node.c
> index b058647fa78b..b9f6b5dfdb5b 100644
> --- a/net/tipc/node.c
> +++ b/net/tipc/node.c
> @@ -496,6 +496,9 @@ struct tipc_node *tipc_node_create(struct net *net, u32 
> addr, u8 *peer_id,
>                       tn->capabilities &= temp_node->capabilities;
>               }
> 
> +             tipc_bcast_toggle_rcast(net,
> +                                     (tn->capabilities & TIPC_BCAST_RCAST));
> +
>               goto exit;
>       }
>       n = kzalloc(sizeof(*n), GFP_ATOMIC);
> @@ -557,6 +560,7 @@ struct tipc_node *tipc_node_create(struct net *net, u32 
> addr, u8 *peer_id,
>       list_for_each_entry_rcu(temp_node, &tn->node_list, list) {
>               tn->capabilities &= temp_node->capabilities;
>       }
> +     tipc_bcast_toggle_rcast(net, (tn->capabilities & TIPC_BCAST_RCAST));
>       trace_tipc_node_create(n, true, " ");
>  exit:
>       spin_unlock_bh(&tn->node_list_lock);
> @@ -740,7 +744,8 @@ static bool tipc_node_cleanup(struct tipc_node *peer)
>       list_for_each_entry_rcu(temp_node, &tn->node_list, list) {
>               tn->capabilities &= temp_node->capabilities;
>       }
> -
> +     tipc_bcast_toggle_rcast(peer->net,
> +                             (tn->capabilities & TIPC_BCAST_RCAST));
>       spin_unlock_bh(&tn->node_list_lock);
>       return deleted;
>  }
> @@ -2198,6 +2203,7 @@ int tipc_nl_peer_rm(struct sk_buff *skb, struct 
> genl_info *info)
>       list_for_each_entry_rcu(temp_node, &tn->node_list, list) {
>               tn->capabilities &= temp_node->capabilities;
>       }
> +     tipc_bcast_toggle_rcast(net, (tn->capabilities & TIPC_BCAST_RCAST));
>       err = 0;
>  err_out:
>       tipc_node_put(peer);
> --
> 2.20.1


_______________________________________________
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

Reply via email to