From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 966BBC43381 for ; Wed, 27 Mar 2019 18:37:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5EF2F20651 for ; Wed, 27 Mar 2019 18:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553711873; bh=E+pw9GKTrap829Xx9KVzH7pLt162QBrWJbxxSpfT0ag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VjLksmtQBY7f843EhVg9CQozIRqM/S+7Sauc93/p9w3yKjLLKR4RJxeMx8NZb0qFl K5FGNtaBYa1A0QsLLigrvjS6GNg6qoLy3QNdRQNDwLMh/1jHp91l3y9MU99RYgsIzv QUK1iHudKaHiC9E9ufVLSAAUxhSAGB4FIfVjyFpE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391515AbfC0SXe (ORCPT ); Wed, 27 Mar 2019 14:23:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:42104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390873AbfC0SXa (ORCPT ); Wed, 27 Mar 2019 14:23:30 -0400 Received: from kenny.it.cumulusnetworks.com. (fw.cumulusnetworks.com [216.129.126.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8246E2184E; Wed, 27 Mar 2019 18:23:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553711009; bh=E+pw9GKTrap829Xx9KVzH7pLt162QBrWJbxxSpfT0ag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Znp+QKn9zQjz5F7F0hIFTHNXIG+2HKcRgnq9WnuSgPLW2+MB5sHmGrep7udrbydxN 9LUYJ6XQ4mihgRRi8cVcGXgk69jEtB+EVXaE3LzhpRU/weFgmfvw4lGy9KwavWp+SI 1eFRvntkl2wBFUNPpk0vly7BpGe8FT8MDy2Z69rg= From: David Ahern To: davem@davemloft.net, netdev@vger.kernel.org Cc: idosch@mellanox.com, jiri@mellanox.com, saeedm@mellanox.com, David Ahern Subject: [PATCH v2 net-next 06/13] ipv6: Create cleanup helper for fib6_nh Date: Wed, 27 Mar 2019 11:23:22 -0700 Message-Id: <20190327182329.18149-7-dsahern@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190327182329.18149-1-dsahern@kernel.org> References: <20190327182329.18149-1-dsahern@kernel.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: David Ahern Move the fib6_nh cleanup code to a new helper, fib6_nh_release. Signed-off-by: David Ahern --- include/net/ip6_fib.h | 1 + net/ipv6/ip6_fib.c | 5 +---- net/ipv6/route.c | 8 ++++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index ce1f81345c8e..2d2a468b3d6d 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -447,6 +447,7 @@ static inline struct net_device *fib6_info_nh_dev(const struct fib6_info *f6i) int fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh, struct fib6_config *cfg, gfp_t gfp_flags, struct netlink_ext_ack *extack); +void fib6_nh_release(struct fib6_nh *fib6_nh); static inline struct lwtunnel_state *fib6_info_nh_lwt(const struct fib6_info *f6i) diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 6613d8dbb0e5..db886085369b 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -199,10 +199,7 @@ void fib6_info_destroy_rcu(struct rcu_head *head) free_percpu(f6i->rt6i_pcpu); } - lwtstate_put(f6i->fib6_nh.nh_lwtstate); - - if (f6i->fib6_nh.nh_dev) - dev_put(f6i->fib6_nh.nh_dev); + fib6_nh_release(&f6i->fib6_nh); ip_fib_metrics_put(f6i->fib6_metrics); diff --git a/net/ipv6/route.c b/net/ipv6/route.c index e577d2d51b5f..bd910a266aa7 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -3016,6 +3016,14 @@ int fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh, return err; } +void fib6_nh_release(struct fib6_nh *fib6_nh) +{ + lwtstate_put(fib6_nh->nh_lwtstate); + + if (fib6_nh->nh_dev) + dev_put(fib6_nh->nh_dev); +} + static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg, gfp_t gfp_flags, struct netlink_ext_ack *extack) -- 2.11.0