From patchwork Wed Feb 14 12:34:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Maloy X-Patchwork-Id: 873337 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="bz4jJ0YB"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zhJky4JfLz9t1t for ; Wed, 14 Feb 2018 23:34:50 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967647AbeBNMer (ORCPT ); Wed, 14 Feb 2018 07:34:47 -0500 Received: from sesbmg22.ericsson.net ([193.180.251.48]:59522 "EHLO sesbmg22.ericsson.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967541AbeBNMeq (ORCPT ); Wed, 14 Feb 2018 07:34:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1518611684; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=JlHaLCmtaPfU6GxYwp6WZSp5ByYdpRPCiwvY6Yk+8YA=; b=bz4jJ0YBksVqw6k9u+p59sEdJBjdZB1XbUnTbQcL5D2GaOF4M122fbT1yXkho1xG nITThKsiKy1O3kWKpthaDJghHihaJ+A/9h1E9QMYw+xyLBk/M3/jaBpxuDm9t8m2 ca/UXUeI8Dd0WsNhYle/WuwpnKyjVvDHgNh5oaxEhoI=; X-AuditID: c1b4fb30-799639c000004778-8d-5a842ce40dcc Received: from ESESSHC011.ericsson.se (Unknown_Domain [153.88.183.51]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id 7B.E8.18296.4EC248A5; Wed, 14 Feb 2018 13:34:44 +0100 (CET) Received: from tipsy.lab.linux.ericsson.se (10.35.28.120) by ESESSHC011.ericsson.se (153.88.183.51) with Microsoft SMTP Server (TLS) id 14.3.352.0; Wed, 14 Feb 2018 13:34:43 +0100 From: Jon Maloy To: , CC: , , , , , , Subject: [net-next 1/1] tipc: apply bearer link tolerance on running links Date: Wed, 14 Feb 2018 13:34:39 +0100 Message-ID: <1518611679-4660-1-git-send-email-jon.maloy@ericsson.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 X-Originating-IP: [10.35.28.120] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGLMWRmVeSWpSXmKPExsUyM2K7se4TnZYog3+zDSxuNPQwW8w538Ji 8fbVLHaLYwvELLacz7K40n6W3eLx9evMDuweW1beZPJ4d4XNY/eCz0wenzfJeazfspUpgDWK yyYlNSezLLVI3y6BK2PZ1X1sBdPkKlp+dzM2ML6T6GLk5JAQMJE41d3I2sXIxSEkcJhR4u6T KVDOdkaJ51vOsYFUsQloSLyc1sEIYosIGEu8WtnJBFLELPCJUaJl5TOwImEBb4nph/4yg9gs AqoSXXc/s4PYvAKuEpt2TGaGWCcncf74T2aIuKDEyZlPWEBsZgEJiYMvXoDFhQSUJeZ+mMYE Ua8g8W1mN9MERr5ZSFpmIWlZwMi0ilG0OLU4KTfdyEgvtSgzubg4P08vL7VkEyMwNA9u+W2w g/Hlc8dDjAIcjEo8vCLSLVFCrIllxZW5hxglOJiVRHiNzzdHCfGmJFZWpRblxxeV5qQWH2KU 5mBREuc96ckbJSSQnliSmp2aWpBaBJNl4uCUamCU49LoU7kYZXuLQc+6Tt5HO6vGbrvDda1f 1ttXpdwyvaN1RGBCW/bOzY0BnKkR71bEnD6byOhZtWOq/99cV4vwZY5Kwiu4QlIqLvsxPL19 8MmiGYc4OTb9cjA+cbxU9e+Vn0mrhQSDbn7aIzE/ykrpQzKX07lGt49t0pbm3115TFboef6M /6zEUpyRaKjFXFScCAAUBPeBSQIAAA== Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Currently, the default link tolerance set in struct tipc_bearer only has effect on links going up after that moment. I.e., a user has to reset all the node's links across that bearer to have the new value applied. This is too limiting and disturbing on a running cluster to be useful. We now change this so that also already existing links are updated dynamically, without any need for a reset, when the bearer value is changed. We leverage the already existing per-link functionality for this to achieve the wanted effect. Acked-by: Ying Xue Signed-off-by: Jon Maloy --- net/tipc/bearer.c | 8 +++++--- net/tipc/link.c | 3 ++- net/tipc/node.c | 24 ++++++++++++++++++++++++ net/tipc/node.h | 1 + 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index c800147..83d284f 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c @@ -946,11 +946,11 @@ int tipc_nl_bearer_add(struct sk_buff *skb, struct genl_info *info) int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info) { - int err; - char *name; struct tipc_bearer *b; struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1]; struct net *net = sock_net(skb->sk); + char *name; + int err; if (!info->attrs[TIPC_NLA_BEARER]) return -EINVAL; @@ -982,8 +982,10 @@ int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info) return err; } - if (props[TIPC_NLA_PROP_TOL]) + if (props[TIPC_NLA_PROP_TOL]) { b->tolerance = nla_get_u32(props[TIPC_NLA_PROP_TOL]); + tipc_node_apply_tolerance(net, b); + } if (props[TIPC_NLA_PROP_PRIO]) b->priority = nla_get_u32(props[TIPC_NLA_PROP_PRIO]); if (props[TIPC_NLA_PROP_WIN]) diff --git a/net/tipc/link.c b/net/tipc/link.c index 2d6b2ae..3c23046 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -2126,7 +2126,8 @@ void tipc_link_set_tolerance(struct tipc_link *l, u32 tol, struct sk_buff_head *xmitq) { l->tolerance = tol; - tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, 0, tol, 0, xmitq); + if (link_is_up(l)) + tipc_link_build_proto_msg(l, STATE_MSG, 0, 0, 0, tol, 0, xmitq); } void tipc_link_set_prio(struct tipc_link *l, u32 prio, diff --git a/net/tipc/node.c b/net/tipc/node.c index 9036d87..389193d 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -1618,6 +1618,30 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b) kfree_skb(skb); } +void tipc_node_apply_tolerance(struct net *net, struct tipc_bearer *b) +{ + struct tipc_net *tn = tipc_net(net); + int bearer_id = b->identity; + struct sk_buff_head xmitq; + struct tipc_link_entry *e; + struct tipc_node *n; + + __skb_queue_head_init(&xmitq); + + rcu_read_lock(); + + list_for_each_entry_rcu(n, &tn->node_list, list) { + tipc_node_write_lock(n); + e = &n->links[bearer_id]; + if (e->link) + tipc_link_set_tolerance(e->link, b->tolerance, &xmitq); + tipc_node_write_unlock(n); + tipc_bearer_xmit(net, bearer_id, &xmitq, &e->maddr); + } + + rcu_read_unlock(); +} + int tipc_nl_peer_rm(struct sk_buff *skb, struct genl_info *info) { struct net *net = sock_net(skb->sk); diff --git a/net/tipc/node.h b/net/tipc/node.h index acd58d2..4ce5e3a 100644 --- a/net/tipc/node.h +++ b/net/tipc/node.h @@ -65,6 +65,7 @@ void tipc_node_check_dest(struct net *net, u32 onode, struct tipc_media_addr *maddr, bool *respond, bool *dupl_addr); void tipc_node_delete_links(struct net *net, int bearer_id); +void tipc_node_apply_tolerance(struct net *net, struct tipc_bearer *b); int tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 node, char *linkname, size_t len); int tipc_node_xmit(struct net *net, struct sk_buff_head *list, u32 dnode,