Netdev List
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: aroulin@nvidia.com
Cc: 'Simon Horman' <horms@kernel.org>,
	netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	edumazet@google.com, pabeni@redhat.com, andrew+netdev@lunn.ch,
	roopa@nvidia.com, petrm@nvidia.com, idosch@nvidia.com,
	chirag@nvidia.com, shuah@kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2 3/3] selftests: net: add vxlan vnifilter notification test
Date: Thu,  4 Jun 2026 14:19:25 +0100	[thread overview]
Message-ID: <20260604131922.3928241-4-horms@kernel.org> (raw)
In-Reply-To: <20260602185138.253265-4-aroulin@nvidia.com>

From: 'Simon Horman' <horms@kernel.org>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://netdev-ai.bots.linux.dev/sashiko/

Simon says:

There is also an AI-generated review of this patch on sashiko.dev.
And AI-generated reviews of other patches of this series.
But I believe what is forwarded here covers what should
be considered in the context of this patch-set.

---
selftests: net: add vxlan vnifilter notification test

This patch adds a selftest that exercises VXLAN vnifilter netlink
notifications by running bridge monitor vni in the background while
adding, updating, deleting and re-adding VNIs, then counting the
matching lines in the captured output.

> diff --git a/tools/testing/selftests/net/test_vxlan_vnifilter_notify.sh b/tools/testing/selftests/net/test_vxlan_vnifilter_notify.sh
> new file mode 100755
> index 000000000000..9d51a9e02ae0
> --- /dev/null
> +++ b/tools/testing/selftests/net/test_vxlan_vnifilter_notify.sh
> @@ -0,0 +1,184 @@

[ ... ]

> +# Run bridge monitor in the background, execute a command, then count
> +# the notification lines.
> +# Usage: vni_notify_check <command> [args...]
> +# Sets: NOTIFY_COUNT with the number of notifications observed.
> +vni_notify_check()
> +{
> +	local tmpf cmd_ret monitor_pid
> +
> +	tmpf=$(mktemp)
> +	defer rm "$tmpf"
> +
> +	defer_scope_push
> +		ip netns exec "$NS1" bridge monitor vni > "$tmpf" 2>/dev/null &
> +		monitor_pid=$!
> +		defer kill_process "$monitor_pid"
> +
> +		sleep 0.5
> +		if [ ! -e "/proc/$monitor_pid" ]; then
> +			RET=$ksft_skip
> +			log_test "iproute2 'bridge monitor vni' not supported"
> +			return "$RET"
> +		fi

[Medium]
Could the skip path here turn a legitimate skip into a failure?

When bridge monitor vni is not supported, the helper sets RET=$ksft_skip,
calls log_test from inside the helper, and then returns ksft_skip (4).
Every caller follows the helper with:

    vni_notify_check \
        bridge -n "$NS1" vni add vni 1000 dev "$VXLAN_DEV"
    check_err $? "Failed to add VNI"

Since ksft_skip is non-zero, check_err treats the return as a failure
and calls ret_set_ksft_status with ksft_fail. Per the merge weights in
ksft_status_merge (pass < xfail < skip < fail), that demotes RET from
skip to fail.

NOTIFY_COUNT is also never assigned because the function returned
before the grep, so the next:

    [ "$NOTIFY_COUNT" -eq 1 ]
    check_err $? "Expected 1 notification for VNI add, got $NOTIFY_COUNT"

also records a failure, and the caller's log_test then prints FAIL for
the real test name in addition to the SKIP printed by the helper. The
script ends up reporting both a SKIP and a FAIL line for the same case
and exits with a failure status.

Two related observations on this same path:

The bare return is issued between defer_scope_push and defer_scope_pop,
so defer_scope_pop is skipped on the skip path. Does that leave
__DEFER__SCOPE_ID off by one and the registered defer kill_process
"$monitor_pid" only unwound through the EXIT trap rather than the
normal scope unwind?

Would it be cleaner to signal skip back to the caller without going
through check_err (for example, set RET plus a flag and have the caller
short-circuit), and either move log_test to the caller or restructure
the skip path so it does not straddle defer_scope_push/defer_scope_pop?
fdb_notify.sh uses a similar pattern without mixing log_test and an
early return inside the scope.

> +
> +		"$@"
> +		cmd_ret=$?
> +		sleep 0.2
> +	defer_scope_pop
> +
> +	NOTIFY_COUNT=$(grep -c "$VXLAN_DEV" "$tmpf")
> +	NOTIFY_COUNT=${NOTIFY_COUNT:-0}
> +	return "$cmd_ret"
> +}

[Low]
Does this counting strategy actually distinguish RTM_NEWTUNNEL from
RTM_DELTUNNEL?

The commit message states:

    verifies that RTM_NEWTUNNEL and RTM_DELTUNNEL are sent correctly
    when VNIs are added, deleted, or updated

but NOTIFY_COUNT comes from:

    NOTIFY_COUNT=$(grep -c "$VXLAN_DEV" "$tmpf")

which matches both add and delete events emitted by bridge monitor vni.
A regression that emitted RTM_NEWTUNNEL on delete (or vice versa) would
still produce NOTIFY_COUNT=1 and pass every positive test. Would
differentiating the two (for instance, by separately counting lines
that begin with "Deleted " versus those that do not) make the test
match what the commit message describes?

  reply	other threads:[~2026-06-04 13:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02 18:51 [PATCH net v2 0/3] vxlan: vnifilter: fix VNI add/update notifications Andy Roulin
2026-06-02 18:51 ` [PATCH net v2 1/3] vxlan: vnifilter: send notification on VNI add Andy Roulin
2026-06-02 18:51 ` [PATCH net v2 2/3] vxlan: vnifilter: fix spurious notification on VNI update Andy Roulin
2026-06-02 18:51 ` [PATCH net v2 3/3] selftests: net: add vxlan vnifilter notification test Andy Roulin
2026-06-04 13:19   ` Simon Horman [this message]
2026-06-04 15:49     ` Jakub Kicinski
2026-06-04 16:00 ` [PATCH net v2 0/3] vxlan: vnifilter: fix VNI add/update notifications patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260604131922.3928241-4-horms@kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=aroulin@nvidia.com \
    --cc=chirag@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=roopa@nvidia.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox