Article View: linux.kernel.netdev
Article #25396[PATCH net-next v3 08/13] nexthop: factor out nh_has_f6i()
From: David Ahern
Date: Tue, 01 Dec 2026 17:40
Date: Tue, 01 Dec 2026 17:40
57 lines
9113 bytes
9113 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:
<20261201174021.7211-9-dsahern@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375260-linux-kernel-netdev=dewy.ruReferences:
<20261201174021.7211-1-dsahern@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375260-linux-kernel-netdev=dewy.ru From: dsahern@kernel.org (David Ahern) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v3 08/13] nexthop: factor out nh_has_f6i() Date: Tue, 1 Dec 2026 10:40:09 -0700 Organization: Usenet Network Message-ID: <20261201174021.7211-9-dsahern@kernel.org> References: <20261201174021.7211-1-dsahern@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1780217"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:9hGnFC0Q/QNQWliOG/nMFkJXmto= sha256:Oz8GrIpwHRoAizu30Ws/obbtYpBCODs+hZqTn4s7wLU= sha1:yPNKVrnrqpH8tC9bNAmRbGdPTSw= sha256:k2cmQpNGn+C6IrwFv0v0VJSPPDTDyNZx8ZVNuHDtd+o= 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 A403811743F; Tue, 1 Dec 2026 20:41:31 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[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 HxV_OyruXzaL; Tue, 1 Dec 2026 20:41:29 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-375260-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 757A0117440; Tue, 1 Dec 2026 20:41:19 +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 15E442810F; Tue, 1 Dec 2026 17:41:15 +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=1796146864; b=fC6Q+byuQGGrYtS25wD/arRPPua+VfkyAdOee5EMH9JYfaTYTJw7ShZOFBPQIgzp9Q5G kom+o1ihFIvGHk6tJg9jXip/KdXhh6KhwArMWrq+/PSZW1L11q3PXLqRUugM01nV6Zha2 E+2OPB8Seeeu6LkO3mYSMPYDDK+GsfI31Se/8LC5bheigFVMpCseTinKXOVg9ecJN//+E YsX7dudxrgC2iypoZotwHxD7u24yKeg018s7NtEwXzxOLrT/rI6sm+d3uXMQ2SWTvB+Ih AIp3Kjo0LK74DFqQU/4PhmcTO6+3cjse8pX/Dnt0QomP/Dy062E1zbj/gbHcM+BPi4g== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796146864; 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=xv1Ph2Tw1zPmMzCo96+IlQ04/mOiONoY8LjbEVCc9CXMJG2PiNOcawg8mAYGxLsFl1S1 thSY6qq2G8WcJfnTt89gPobR6iSYxtFgYHnI+OOxKXNk/ibK6R4Zg9j9QvmrGULGVmF7S R+an3+WyN90Qx8qh84dGmCIULCXTeGncdV03hNkgf9tfzLoPoGyHsUG0m0CoTcTEUBxEu zAL87LPcOqatcyzgbNsLFoJ00WLFg73jSYCwvXteGa4YCOD+z02Tp5rS/ILsAeXgPtvgj 9GzCovwQdT5oGNkmMI8Keaj1uyds9DjpV0EV3606JRNbH248jzff6R5NYuacJLSbwoA== 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=dI9bX85S; 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 B878C606A6AD; Tue, 1 Dec 2026 17:41:04 +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=dI9bX85S 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=1796146863; b=Q9jqWQ6MUtloxqXY8aESzhL9HVzH2e9bVh50yNYus7ByJ7afNPIF3vhyjN8eBVlpT38y R5w0mqCMhzGWEluRKcDZIO31KSb85M8v6N88hSQT5vu9KCxm/MJ1BPRSrZ0nEyayxrTol mlx2gY00c0vVp+CoisnOlOuJ09H0aNYVH9IxyF/+7e+OknZ5O7qAdc9w3qECFmthDXO9d 5SO0YU0bqKJItkbEM45HgtfSOobWKkGmUwzKq90AAglJ3DzbRuDTvhNRfuaDqsKnQ917B bNXhl33uBoqLdhO2Npu/3YwRO3aSFrAOh+eXAtlKZDzH4x+c6KDXX1dupjGh1YABmwA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796146863; 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=uXUAu0JgZyYMBO3Jfx8ZVN2Yv3l8oNUpm1YGGfOwLa8fMjaRff0p/Cit75upCpZyCA0i IsMCV+q+cai0YnxWjkWkIxLpgmnM6B9Vgqi1h0O9ogc3lcR0HF+e6YzqMMgUGjuCCXtVj 46D4+RwjBiyxZObNDxwPl4dgRGp97zkQRXXf3xvzH60h1SbvvJtQxxV692+QcBGB5uqbQ hP97xRKxEigGiTKpz4VVp/cDIWmTF5Dw3cDoLCosnehjcs9XfKsh/WJxRyNkuxXmRWGp5 22INvq0we3qaR4WH+KIvFdHN/8eT86sE2evqy4shjzF0tx1YRFiKHBVpIbqvYWMKMqA== 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=dI9bX85S; 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 DBCEA606A6A8 for <netdev@vger.kernel.org>; Tue, 1 Dec 2026 17:41:03 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id F274F1F0089C; Tue, 1 Dec 2026 17:41:02 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796146863; bh=zAN2qqoJtcSelGCw27D53NDlA0Ce0ZwWItYo5sp3gMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dI9bX85SV4/j5D2mRiWVnMmTyZnH6E771A44ML9rwmvrYXvH8NJo9Fja9MC5DrApd FNkfX+vHJpn02/lApvF3vAoGN3U0rld2vgo+hl7Ax3WUmue0qCuhwlOOxkLycBW7oF MyxFBE32q/2h2NJk2JELJ1NaIV3bkGmgwVedeyatPQce4FZdWYdY73Ji/sTx6gV58r F6xxHexnXJwb7+6inzxDJj3CutTe7qtHp4+hfD0tnF1dxc4hlONfd5ArzwCkIv6OwC kdRGFWQo4t5rXvPxwBXy9/aMkspxI5dKUNG2rcRmszAEpCvzJwyd6Dr3n1PaooAiOI 1gFaXD2Hd+tyA== 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: <20261201174021.7211-1-dsahern@kernel.org> 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