From: Geliang Tang <geliang@kernel.org>
To: Matthieu Baerts <matttbe@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next v10 12/12] selftests: mptcp: add path_manager sysctl tests
Date: Tue, 11 Mar 2025 14:54:21 +0800 [thread overview]
Message-ID: <29feb9623a11f6030d3d61d03a5d4150eee3cc3f.camel@kernel.org> (raw)
In-Reply-To: <6935189a-0afa-4d55-a210-dc67370c32ea@kernel.org>
Hi Matt,
On Tue, 2025-03-11 at 00:25 +0100, Matthieu Baerts wrote:
> Hi Geliang,
>
> On 06/03/2025 12:01, Geliang Tang wrote:
> > From: Geliang Tang <tanggeliang@kylinos.cn>
> >
> > This patch checks if the newly added net.mptcp.path_manager is
> > mapped
> > successfully from or to the old net.mptcp.pm_type. And add a new
> > helper
> > set_path_manager() to set the newly added net.mptcp.path_manager.
> >
> > Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> >
> > fix
>
> (typo)
>
> >
> > Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> > ---
> > .../selftests/net/mptcp/userspace_pm.sh | 58
> > ++++++++++++++++++-
> > 1 file changed, 55 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh
> > b/tools/testing/selftests/net/mptcp/userspace_pm.sh
> > index 3651f73451cf..35ba4edc0fa2 100755
> > --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh
> > +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh
> > @@ -118,9 +118,61 @@ trap cleanup EXIT
> >
> > # Create and configure network namespaces for testing
>
> I see that you didn't move the "print_title" and "print_test" here. I
> think you should do that to be able to print test_fail properly, no?
>
> > mptcp_lib_ns_init ns1 ns2
> > -for i in "$ns1" "$ns2" ;do
> > - ip netns exec "$i" sysctl -q net.mptcp.pm_type=1
> > -done
> > +
> > +set_path_manager()
> > +{
> > + local ns=$1
> > + local pm=$2
> > +
> > + if ! ip netns exec ${ns} sysctl
> > net.mptcp.available_path_managers |
> > + grep -wq "${pm}"; then
> > + test_fail "path manager ${pm} not found"
> > + return 1
> > + fi
> > + ip netns exec ${ns} sysctl -q
> > net.mptcp.path_manager="${pm}"
> > +}
> > +
>
> Maybe add a comment here to explain what's the goal, e.g.
>
> # check path_manager and pm_type sysctl mapping
>
> > +if [ -f /proc/sys/net/mptcp/path_manager ]; then
> > + ip netns exec "$ns1" sysctl -q net.mptcp.pm_type=0
> > + pm_name="$(ip netns exec "$ns1" sysctl -n
> > net.mptcp.path_manager)"
> > + if [ "${pm_name}" != "kernel" ]; then
> > + test_fail "unexpected pm_name: ${pm_name}"
> > + mptcp_lib_result_print_all_tap
> > + exit ${KSFT_FAIL}
> > + fi
> I don't think this step should be moved below, because here we don't
> change values: pm_type=0 is the default value.
>
> > + ip netns exec "$ns1" sysctl -q net.mptcp.pm_type=1
> > + pm_name="$(ip netns exec "$ns1" sysctl -n
> > net.mptcp.path_manager)"
> > + if [ "${pm_name}" != "userspace" ]; then
> > + test_fail "unexpected pm_name: ${pm_name}"
> > + mptcp_lib_result_print_all_tap
> > + exit ${KSFT_FAIL}
> > + fi
>
> I don't think you need this step if you keep the for-loop out of the
> 'else', like before, see below. It implicitly check that setting
> pm_type
> to 1 also changes "path_manager", otherwise the rest of the tests
> will fail.
>
> > +
> > + set_path_manager "$ns1" "kernel"
> > + pm_type="$(ip netns exec "$ns1" sysctl -n
> > net.mptcp.pm_type)"
> > + if [ "${pm_type}" != "0" ]; then
> > + test_fail "unexpected pm_type: ${pm_type}"
> > + mptcp_lib_result_print_all_tap
> > + exit ${KSFT_FAIL}
> > + fi
> > +
> > + set_path_manager "$ns1" "userspace"
> > + pm_type="$(ip netns exec "$ns1" sysctl -n
> > net.mptcp.pm_type)"
> > + if [ "${pm_type}" != "1" ]; then
> > + test_fail "unexpected pm_type: ${pm_type}"
> > + mptcp_lib_result_print_all_tap
> > + exit ${KSFT_FAIL}
> > + fi
> > +
> > + set_path_manager "$ns2" "userspace"
> > + print_test "check path_manager and pm_type sysctl mapping"
> > + test_pass
> > +else
> > + for i in "$ns1" "$ns2"; do
> > + ip netns exec "$i" sysctl -q net.mptcp.pm_type=1
> > + done
> > +fi
>
> I do think there is no need to do repeating tests here, Just having
> these 3 steps are enough to cover all cases directly and indirectly,
> easier to maintain without the repeat, and only focus on the mapping
> aspect, not on the final values we set (so keeping the 'pm_type=1' at
> the end for all kernel versions is easier).
>
> In other words:
>
> print_title "Init"
> print_test "Created network namespaces ns1, ns2"
> mptcp_lib_ns_init ns1 ns2
test_pass should be followed this print_test to print a [OK].
So this may be better:
print_title "Init"
mptcp_lib_ns_init ns1 ns2
if []; then
test_fail "..."
fi
print_test "Created network namespaces ns1, ns2"
test_pass
So in v11, I just moved 'print_title "Init"' forward but kept
"print_test" and "test_pass" unchanged.
Thanks,
-Geliang
>
> # check path_manager and pm_type sysctl mapping
> if [ -f /proc/sys/net/mptcp/path_manager ]; then
> ip netns exec "$ns1" sysctl -q net.mptcp.path_manager=userspace
> pm_type="$(ip netns exec "$ns1" sysctl -n net.mptcp.pm_type)"
> if [ "${pm_type}" != "1" ]; then
> test_fail "unexpected pm_type: ${pm_type}"
> mptcp_lib_result_print_all_tap
> exit ${KSFT_FAIL}
> fi
>
> ip netns exec "$ns1" sysctl -q net.mptcp.pm_type=0
> pm="$(ip netns exec "$ns1" sysctl -n net.mptcp.path_manager)"
> if [ "${pm}" != "kernel" ]; then
> test_fail "unexpected path-manager: ${pm}"
> mptcp_lib_result_print_all_tap
> exit ${KSFT_FAIL}
> fi
> fi
>
> for i in "$ns1" "$ns2"; do
> ip netns exec "$i" sysctl -q net.mptcp.pm_type=1
> done
>
> (...)
>
> Small and enough, no?
>
> (If you want, you can also add an extra test setting "path_manager"
> to
> "error", and checking that "pm_type" is unchanged, e.g. place this in
> the middle of the two.)
>
> ip netns exec "$ns1" sysctl -q net.mptcp.path_manager=error
> 2>/dev/null
> pm_type="$(ip netns exec "$ns1" sysctl -n net.mptcp.pm_type)"
> if [ "${pm_type}" != "1" ]; then
> test_fail "unexpected pm_type after error: ${pm_type}"
> mptcp_lib_result_print_all_tap
> exit ${KSFT_FAIL}
> fi
>
> And no need to have the same tests on ns2. Easier to keep the for-
> loop
> setting pm_type=1 like before.
>
> Cheers,
> Matt
next prev parent reply other threads:[~2025-03-11 6:54 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-06 11:01 [PATCH mptcp-next v10 00/12] BPF path manager, part 5 Geliang Tang
2025-03-06 11:01 ` [PATCH mptcp-next v10 01/12] mptcp: pm: define struct mptcp_pm_ops Geliang Tang
2025-03-06 11:01 ` [PATCH mptcp-next v10 02/12] mptcp: pm: register in-kernel and userspace PM Geliang Tang
2025-03-06 11:01 ` [PATCH mptcp-next v10 03/12] mptcp: sysctl: set path manager by name Geliang Tang
2025-03-06 11:01 ` [PATCH mptcp-next v10 04/12] mptcp: add struct_group in mptcp_pm_data Geliang Tang
2025-03-10 23:17 ` Matthieu Baerts
2025-03-11 4:24 ` Geliang Tang
2025-03-11 8:53 ` Matthieu Baerts
2025-03-06 11:01 ` [PATCH mptcp-next v10 05/12] mptcp: pm: init and release mptcp_pm_ops Geliang Tang
2025-03-10 23:18 ` Matthieu Baerts
2025-03-06 11:01 ` [PATCH mptcp-next v10 06/12] mptcp: pm: add get_local_id() interface Geliang Tang
2025-03-06 11:01 ` [PATCH mptcp-next v10 07/12] mptcp: pm: add get_priority() interface Geliang Tang
2025-03-06 11:01 ` [PATCH mptcp-next v10 08/12] mptcp: pm: validate mandatory ops Geliang Tang
2025-03-10 23:18 ` Matthieu Baerts
2025-03-06 11:01 ` [PATCH mptcp-next v10 09/12] mptcp: sysctl: map path_manager to pm_type Geliang Tang
2025-03-10 23:19 ` Matthieu Baerts
2025-03-11 4:29 ` Geliang Tang
2025-03-06 11:01 ` [PATCH mptcp-next v10 10/12] mptcp: sysctl: map pm_type to path_manager Geliang Tang
2025-03-10 23:19 ` Matthieu Baerts
2025-03-06 11:01 ` [PATCH mptcp-next v10 11/12] mptcp: sysctl: add available_path_managers Geliang Tang
2025-03-06 11:01 ` [PATCH mptcp-next v10 12/12] selftests: mptcp: add path_manager sysctl tests Geliang Tang
2025-03-10 23:25 ` Matthieu Baerts
2025-03-11 6:54 ` Geliang Tang [this message]
2025-03-06 12:05 ` BPF path manager, part 5 MPTCP CI
2025-03-10 23:16 ` [PATCH mptcp-next v10 00/12] " Matthieu Baerts
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=29feb9623a11f6030d3d61d03a5d4150eee3cc3f.camel@kernel.org \
--to=geliang@kernel.org \
--cc=matttbe@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=tanggeliang@kylinos.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.