From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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 ; Tue, 1 Dec 2026 17:41:03 +0000 (UTC) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F274F1F0089C; Tue, 1 Dec 2026 17:41:02 +0000 (UTC) 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== From: David Ahern To: netdev@vger.kernel.org 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 Subject: [PATCH net-next v3 08/13] nexthop: factor out nh_has_f6i() Date: Tue, 1 Dec 2026 10:40:09 -0700 Message-ID: <20261201174021.7211-9-dsahern@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261201174021.7211-1-dsahern@kernel.org> References: <20261201174021.7211-1-dsahern@kernel.org> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: David Ahern 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 --- 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)