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 7997FC43381 for ; Thu, 28 Mar 2019 03:56:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 36550206DF for ; Thu, 28 Mar 2019 03:56:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553745413; bh=h3rIo7k98teflivQSkhQs0dRfFSF1JfEVG44fKTD8/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=iQmibO/+GRltDhdi9IBqrLL/7ZGYVzlOzNELXVj8rIuAxKKEa/qmMpRd4O7G7kyy3 v3F4P6UIWvM3NS9q0Kd18tahGsEImFrikYD3Yh20Y8UivPKAXIqW2VBU09sG5gVbfN I2038N4pJJxYstRWAG683UgKTDsBmYZ5yCWr6aMY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728466AbfC1D4v (ORCPT ); Wed, 27 Mar 2019 23:56:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:38390 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727723AbfC1D4o (ORCPT ); Wed, 27 Mar 2019 23:56:44 -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 EB37D217D9; Thu, 28 Mar 2019 03:56:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553745404; bh=h3rIo7k98teflivQSkhQs0dRfFSF1JfEVG44fKTD8/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aHAJu4OysDGMPzQThtT2R93mwzILZQCimWQURhorKNQaKFliBmR1vk/0kw8jJawwf pmNf7OwCPof4+1IoRAJN0DSZGCpCZkmajqylfHhhVDiiA7ULc0adYhIAGjk4gP5IOz QYus/V+gIN+RqLC9uE6suprixazL+Tsr5rqwZ4MQ= 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 v3 net-next 06/13] ipv6: Create cleanup helper for fib6_nh Date: Wed, 27 Mar 2019 20:53:51 -0700 Message-Id: <20190328035358.4929-7-dsahern@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190328035358.4929-1-dsahern@kernel.org> References: <20190328035358.4929-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 8c5a998b28a1..5f453c79dd00 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -3025,6 +3025,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