Article View: linux.kernel.netdev
Article #22835[PATCH net-next v2 08/13] nexthop: factor out nh_has_f6i()
From: David Ahern
Date: Thu, 26 Nov 2026 01:33
Date: Thu, 26 Nov 2026 01:33
57 lines
9088 bytes
9088 bytes
From: David Ahern <dahern@nvidia.com>
nh_rt_cache_flush() open codes a locked check of whether any IPv6
routes use a nexthop. Move it into a helper, placed ahead of
remove_nexthop_from_groups(), so the next patch can use it there as
well.
No functional change.
Signed-off-by: David Ahern <dahern@nvidia.com>
---
net/ipv4/nexthop.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
index 42e55b5a755e..53431fe7d328 100644
--- a/net/ipv4/nexthop.c
+++ b/net/ipv4/nexthop.c
@@ -2109,6 +2109,17 @@ remove_nh_grp_entry(struct net *net, struct nh_grp_entry *nhge,
return false;
}
+static bool nh_has_f6i(struct nexthop *nh)
+{
+ bool have_f6i;
+
+ spin_lock_bh(&nh->lock);
+ have_f6i = !list_empty(&nh->f6i_list);
+ spin_unlock_bh(&nh->lock);
+
+ return have_f6i;
+}
+
static bool __must_check
remove_nexthop_from_groups(struct net *net, struct nexthop *nh,
struct nl_info *nlinfo)
@@ -2248,16 +2259,12 @@ static void nh_rt_cache_flush(struct net *net, struct nexthop *nh,
struct nexthop *replaced_nh)
{
struct nh_group *nhg;
- bool have_f6i;
int i;
if (!list_empty(&nh->fi_list))
rt_cache_flush(net);
- spin_lock_bh(&nh->lock);
- have_f6i = !list_empty(&nh->f6i_list);
- spin_unlock_bh(&nh->lock);
- if (have_f6i)
+ if (nh_has_f6i(nh))
rt_genid_bump_ipv6(net);
/* if an IPv6 group was replaced, we have to release all old
--
2.54.0 (Apple Git-157)
Technical Details
Message-ID:
<445f336e64d9d09682c9c9d5cd01d2e6ac290004.1795642432.git.dahern@nvidia.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371791-linux-kernel-netdev=dewy.ruReferences:
<cover.1795642432.git.dahern@nvidia.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371791-linux-kernel-netdev=dewy.ru From: dsahern@kernel.org (David Ahern) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v2 08/13] nexthop: factor out nh_has_f6i() Date: Wed, 25 Nov 2026 18:33:34 -0700 Organization: Usenet Network Message-ID: <445f336e64d9d09682c9c9d5cd01d2e6ac290004.1795642432.git.dahern@nvidia.com> References: <cover.1795642432.git.dahern@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="353037"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:lZFZlumFQvvK850xWmkQGblmGr0= sha256:nMv8GZsccaRxkC2DIsioZ+6bO5aomwbYfoF6WF0c7Uc= sha1:jhay4zobF34uayxgl2LDoVUAxZU= sha256:dHmJcyjm1eBgBVMrSJ67RbDfZ+BSXRiVST+/kP/WsFo= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id A7559125EAB; Thu, 26 Nov 2026 04:34:15 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fr-VqgHE8e6Q; Thu, 26 Nov 2026 04:34:13 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-371791-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 0A8CE125EB4; Thu, 26 Nov 2026 04:34:00 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id BC2CC3178E; Thu, 26 Nov 2026 01:33:55 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795656835; b=aBM1NuvegxNdk8fYa2fLr1W0WWEf2c2ToY2T/uMobU07OcYPosccAiie0/yEcXRTEI9U F4IlJcd+n/w2xVboLFy9Et3lWdZVqH2LL+G0W4GGrCcAVsPxo11YQ8y6wf26TehtS2ZVL 3B7g7jBTLXUGj3fUvVj+ZQ03k6Ty19FAR+Q9TSCOSngDcHpjZ8Grtqon9/n/QD7FC2hbV WOYJzCDIiseLGBJdG8810S2aSGxuzarwNRBi/sbdCRhc2T5dW0k/DgoYODjKO0YUQ52uU dQJmbvE5OvjDTCpOBOjIUb8nkqCwe5evZcRpIFgAbdJvmujvEAxL7UqDxwhG/BeoXpA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795656835; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:X-Mailing-List: List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe: List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding; bh=zAN2qqoJtcSelGCw27D53NDlA0Ce0ZwWItYo5sp3gMI=; b=T3EqhEhv7gO/IqHPegXqdkO1fUgV56/BRxwi+V9HgT+vY+UQAkRB+XKkllZ5RKt1TWCJ jqP0ND+K4NJupnxz3c11ELx8sayoXYXtrYSkZNlRNkmAwv7CjACCbZP4eCDxFLog0u6TJ QFGLOMKXXFIOXHfdjLTRqdSYBbURGgl2FchmPQ0fEmSJMJ7ChAEeUZCh+idN4mC/eGE08 Qdt1Pc5a9ta4FA2DMzARZpLs4Lqg2ntw+126MKsR47btGC8N9vapz9qjApsxYoHZnS7QE YNPeBao1n1CctTT09U5gK8XFtOfdrCd19ktaMQTsVRkqokAAZ4Ra2kWfjyfERtMIGdA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XujfWdDN; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 806F0606A31E; Thu, 26 Nov 2026 01:33:55 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XujfWdDN X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795656834; b=XXi3aIliOw1G+Qo70cMjuQLePYCcCoKu/37ZET36U4T9dcvipWGsl2+/ShrPHusZY+5m vttI+mSuAGDsi/Qbxdae+hIQCyenWgD1uD2ux2kn9lExR9eaEZJ4xHzbf4dPasHxagiQi WGfRuj3DjJf5oxYN5M5S1+NGOG5L/qNC+AGLlP4w9fAweT+kkVS9sUfm+zZMXZET8kD7r 2tgYh1nOdXM4yWKA1o6IMe1eeyDxlY6PA959sPa4Pz5BzbjszN5aOnEkdwgXk4ReIeuYZ Fsc+ReLy/2TmDN8DFRvVT5Je8npDlv8EOxRKuebegtkRAyTiUF/PKrRBGljOvPpOuaA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795656834; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=zAN2qqoJtcSelGCw27D53NDlA0Ce0ZwWItYo5sp3gMI=; b=XeafsH0NaRT05gbqIYY/Tuc4HWpJipcHfywoy6U6gl5lGX0aN4E3NtSY9dGaa0580fe8 /cjErbOCmxOqSx0MtQAx2dsZ/TlR8P6haAt3MmCGuNjN/qcBma4poAsy9wfllWB6Ylznr AFMPfOkiV9x67XvjWqbZr+Ls5cxAR5AfZqCj6cfx/jDrcvVxDeedWBlpbKG0GzWp7nEtq kmPHvLAaGJFseQ0gPHNSe9j7TF5dgWiRJqDrd5pSUWr2zbShQX8RV+wSWCt9RSZqtm2hs WAUEChXAHrrE4IkOdAmuwiaF/gh9azmfxKeJhFzpzn5hODIQDWbi2j/RguTFal3XSOg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XujfWdDN; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0C50606A326 for <netdev@vger.kernel.org>; Thu, 26 Nov 2026 01:33:54 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D955B1F000E6; Thu, 26 Nov 2026 01:33:53 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795656834; bh=zAN2qqoJtcSelGCw27D53NDlA0Ce0ZwWItYo5sp3gMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=XujfWdDNT2FoDstQbqnGsKs1IKO7P6l2uFvWhERObmhTemAfm6Nsu2ceQh6gH5Lie hwPgJQ5ljDxWDQEnt0UUxLKJEsLjhv6yDrtR21b2netMaWfJRsgY8jIjkfHzVweH+G c/YpYzviOdRKqkOWBdU6p5N6kYnh3nzsWt8RS4ZKlEghRSD0lHyWwvcLGLVRqmcS2D kL+d9+/ougLtxB540vZe7Y23TuMHJQCV2LaHVL1OzdbFwKfkByb2Z4Bl1cBCT79V7w B21JGKMoRbBweaz7I1fdoW1xO5oAMz1wBR20MRRvpNgM8pPvfWT1dLmP+eF8/cL2E5 icAH/aPRfYtDw== X-Cc: dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, ralf@mandelbit.com, ja@ssi.bg, David Ahern <dahern@nvidia.com> X-Mailer: git-send-email 2.54.0 X-In-Reply-To: <cover.1795642432.git.dahern@nvidia.com> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list