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=1796146868; b=E+jsYwZIdtHubmphU3M+Bmheo50Dx0sPD+z7SFzA8SPE0VlWbjDn0YB6ZR3lg3En6SK2 6YVq2mK+weOIEIm0iRl3gDtD6i2nhK+HGbRZYX538JdxsgH8ntmGhVnatQSzu7r6x/Yvr Ctc+VEfMYZk8VPGaJ0kIN5ju/i0d39s3ntDvH8p0E2tXUw1An6/bX82+B6mFrZrItFMwi KUZHPt5/MGJID7aLyYXvHOnqAwzaYZeNfG6NcCMxWzbyHd5h0q2JPozGHNACWf7Tio8lI Pa1MOBGYJPjJJuR3ZXLsdBYZcpVrkTP3+Dm3jsVVverLXWGpXhqOv1hyqhnnFARQEgA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796146868; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=Ggltb7RoF9HsjuZzJaLHwGvo3eh4NABtovn8kGjeIQ8=; b=IBMYyDIy+7y7BUnp6WF2O8ywCt2PxnxwhsixrciOwW83Q+oBEoXCsnW+MJoEUf/KcM3K o5RhCWGEbgnJ2m6bYLSJPcJYg+anUwGRPNZZuvSsWKAtNJ6e6cqQOnXy9bjBl39PCOt5o zIAZPf+ea5JbvecjbCPK8KUxSXdMf8wcgZp0uWuGoDsnSkglS/yhgM149YzV1GCDK0fsU 24Qn7jzMc+JoNQlXB5r41BqzykqMwmH3QZ/SkD5nhnSILdmIrSGwe2VALy5WLcJfT28Lx laFolU66qjpl2GTOpjq4doj/+dP9qLekoO8V5jEs/07iipcOn2VhUqOljAIyrur2JKQ== 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=UmdGLM0k; 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 B15C9606A322 for ; Tue, 1 Dec 2026 17:41:08 +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=UmdGLM0k Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9D8D1F00939; Tue, 1 Dec 2026 17:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796146868; bh=Ggltb7RoF9HsjuZzJaLHwGvo3eh4NABtovn8kGjeIQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UmdGLM0kOz5v2r+EXE4ndJEZBfQa0Lpwh7XRhTrdAaNMWkSWProoxSDXJHf3mdYv1 dXyLfGiY/VuFtK666/CMenz9VKWkjn/k/4zE8oQ3z1d1pGd04Q4RJcZr00i6WTkdOE 5Sehvm/b9soZzLdBrjQOLf1vTZwgPzfCy5uvo9ZGwqudZOJYIZikBdwmG9m7WTdFpC pgEWuOQ1SYx2M4Rg0pOOpodf5GqiDXPY1Xxj8OE4GJWhRnbtWjylE15lP5t6tFujaC Efxw4m2ZOCTDqhPTLcrpYKCHjdYtLkdoYMR7M3bSWHgI9iM7yfMkrSbBE/75Zu4sbk anFas1Bnho2Sw== 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 12/13] selftests: net: fib_tests: Add stale pcpu test Date: Tue, 1 Dec 2026 10:40:13 -0700 Message-ID: <20261201174021.7211-13-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 Avoid regression with stale pcpu route entries and add a selftest that covers the regression fixed by 8f34e53b60b3 ("ipv6: Use global sernum for dst validation with nexthop objects") Signed-off-by: David Ahern --- tools/testing/selftests/net/fib_tests.sh | 53 +++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh index d7ac3c727f70..dc2ac5d7f29b 100755 --- a/tools/testing/selftests/net/fib_tests.sh +++ b/tools/testing/selftests/net/fib_tests.sh @@ -14,7 +14,7 @@ TESTS="unregister down carrier nexthop suppress ipv6_notify ipv4_notify \ ipv4_mpath_list ipv6_mpath_list ipv4_mpath_balance ipv6_mpath_balance \ ipv4_mpath_balance_preferred ipv4_mpath_oif ipv4_mpath_oif_nh \ ipv4_mpath_oif_vrf ipv6_mpath_oif ipv6_mpath_oif_nh ipv6_mpath_oif_vrf \ - fib6_ra_to_static fib6_temp_addr_renewal" + fib6_ra_to_static fib6_temp_addr_renewal ipv6_nh_pcpu_stale" VERBOSE=0 PAUSE_ON_FAIL=no @@ -3228,6 +3228,56 @@ ipv6_mpath_oif_vrf_test() cleanup } +ipv6_nh_pcpu_stale_test() +{ + local cpu + + echo + echo "IPv6 nexthop object stale pcpu dst test" + + if [ ! -x "$(command -v taskset)" ]; then + echo "SKIP: taskset not installed" + return $ksft_skip + fi + + if [ $(nproc) -lt 2 ]; then + echo "SKIP: pcpu test requires multiple cpus" + return $ksft_skip + fi + + setup + + set -e + setup_ns ns2 + $IP link add veth1 type veth peer name veth2 netns $ns2 + $IP link set veth1 up + $IP -6 address add 2001:db8:10::1/64 dev veth1 nodad + ip -netns $ns2 link set lo up + ip -netns $ns2 address add 2001:db8:11::1/128 dev lo + ip netns exec $ns2 sysctl -qw net.ipv6.conf.all.forwarding=1 + ip -netns $ns2 link set veth2 up + ip -netns $ns2 -6 address add 2001:db8:10::2/64 dev veth2 nodad + + $IP -6 nexthop add id 100 via 2001:db8:10::2 dev veth1 + $IP -6 route add 2001:db8:11::1/128 nhid 100 + set +e + + # create a pcpu dst entry on cpu 0 + taskset -a -c 0 $IP -6 route get 2001:db8:11::1 &> /dev/null + + # re-add the route entry + $IP -6 route del 2001:db8:11::1 + $IP -6 route add 2001:db8:11::1/128 nhid 100 + + # cached dst on cpu 0 must have been invalidated + for cpu in 0 1; do + taskset -a -c $cpu $IP -6 route get 2001:db8:11::1 &> /dev/null + log_test $? 0 "Route get on cpu $cpu after route re-add" + done + + cleanup +} + ################################################################################ # usage @@ -3322,6 +3372,7 @@ do ipv6_mpath_oif_vrf) ipv6_mpath_oif_vrf_test;; fib6_ra_to_static) fib6_ra_to_static;; fib6_temp_addr_renewal) fib6_temp_addr_renewal;; + ipv6_nh_pcpu_stale) ipv6_nh_pcpu_stale_test;; help) echo "Test names: $TESTS"; exit 0;; esac -- 2.54.0 (Apple Git-157)