From: Nikolay Aleksandrov <razor@blackwall.org>
To: Paolo Abeni <pabeni@redhat.com>,
Hangbin Liu <liuhangbin@gmail.com>,
netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Shuah Khan <shuah@kernel.org>,
Johannes Nixdorf <jnixdorf-oss@avm.de>,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net] selftests: forwarding: skip if kernel not support setting bridge fdb learning limit
Date: Tue, 23 Jul 2024 12:43:58 +0300 [thread overview]
Message-ID: <eb8196bb-5ff4-4c98-8b62-c2cf35f3135e@blackwall.org> (raw)
In-Reply-To: <416ebc12-50a1-48e5-a17f-8999f3b460cd@redhat.com>
On 23/07/2024 12:24, Paolo Abeni wrote:
>
>
> On 7/23/24 10:30, Nikolay Aleksandrov wrote:
>> On 23/07/2024 11:22, Hangbin Liu wrote:
>>> If the testing kernel doesn't support setting fdb_max_learned or show
>>> fdb_n_learned, just skip it. Or we will get errors like
>>>
>>> ./bridge_fdb_learning_limit.sh: line 218: [: null: integer expression expected
>>> ./bridge_fdb_learning_limit.sh: line 225: [: null: integer expression expected
>>>
>>> Fixes: 6f84090333bb ("selftests: forwarding: bridge_fdb_learning_limit: Add a new selftest")
>>> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
>>> ---
>>> .../forwarding/bridge_fdb_learning_limit.sh | 18 ++++++++++++++++++
>>> 1 file changed, 18 insertions(+)
>>>
>>> diff --git a/tools/testing/selftests/net/forwarding/bridge_fdb_learning_limit.sh b/tools/testing/selftests/net/forwarding/bridge_fdb_learning_limit.sh
>>> index 0760a34b7114..a21b7085da2e 100755
>>> --- a/tools/testing/selftests/net/forwarding/bridge_fdb_learning_limit.sh
>>> +++ b/tools/testing/selftests/net/forwarding/bridge_fdb_learning_limit.sh
>>> @@ -178,6 +178,22 @@ fdb_del()
>>> check_err $? "Failed to remove a FDB entry of type ${type}"
>>> }
>>> +check_fdb_n_learned_support()
>>> +{
>>> + if ! ip link help bridge 2>&1 | grep -q "fdb_max_learned"; then
>>> + echo "SKIP: iproute2 too old, missing bridge max learned support"
>>> + exit $ksft_skip
>>> + fi
>>> +
>>> + ip link add dev br0 type bridge
>>> + local learned=$(fdb_get_n_learned)
>>> + ip link del dev br0
>>> + if [ "$learned" == "null" ]; then
>>> + echo "SKIP: kernel too old; bridge fdb_n_learned feature not supported."
>>> + exit $ksft_skip
>>> + fi
>>> +}
>>> +
>>> check_accounting_one_type()
>>> {
>>> local type=$1 is_counted=$2 overrides_learned=$3
>>> @@ -274,6 +290,8 @@ check_limit()
>>> done
>>> }
>>> +check_fdb_n_learned_support
>>> +
>>> trap cleanup EXIT
>>> setup_prepare
>>
>> Isn't the selftest supposed to be added after the feature was included?
>>
>> I don't understand why this one is special, we should have the same
>> issue with all new features.
>
> I must admit I was surprised when I learned the fact, but the stable team routinely runs up2date upstream self-tests on top of stable/older kernels:
>
> https://lore.kernel.org/mptcp/ZAHLYvOPEYghRcJ1@kroah.com/
>
> The expected self-test design is to probe the tested feature and skip if not available in the running kernel. The self-test should not break when run on an older kernel not offering such feature.
>
> I understand some (most?) of the self-tests do not cope with the above perfectly, but we can improve ;).
>
> Thanks,
>
> Paolo
>
>
Interesting, and unexpected at least for me. :) But okay, I'll keep it in mind
when sending/reviewing patches.
Thanks!
For the patch:
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
next prev parent reply other threads:[~2024-07-23 9:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-23 8:22 [PATCH net] selftests: forwarding: skip if kernel not support setting bridge fdb learning limit Hangbin Liu
2024-07-23 8:30 ` Nikolay Aleksandrov
2024-07-23 9:24 ` Paolo Abeni
2024-07-23 9:43 ` Nikolay Aleksandrov [this message]
2024-07-23 11:13 ` Johannes Nixdorf
2024-07-24 12:00 ` 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=eb8196bb-5ff4-4c98-8b62-c2cf35f3135e@blackwall.org \
--to=razor@blackwall.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jnixdorf-oss@avm.de \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).