Skip to contentSkip to conversation

selftests: mptcp: sockopt: check app_limited

PATCH [email protected] 1 participant 1 message Oct 31 Networking MPTCP

lore
Share & tools
lore

[email protected]

author AI review
#0 lore raw

Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] In connect_one_server() (tools/testing/selftests/net/mptcp/mptcp_sockopt.c:639-641), the new…

--

selftests: mptcp: sockopt: check app_limited

This adds an assertion to connect_one_server() in mptcp_sockopt.c. After a small data exchange, it checks that tcpi_delivery_rate_app_limited is still 1. The aim is to catch regressions in the subflow app-limited accounting added by the preceding mptcp_rate_check_app_limited() change.

tools/testing/selftests/net/mptcp/mptcp_sockopt.c static void connect_one_server(int fd, int pipefd) · line 641

Quoted 12 lines
tools/testing/selftests/net/mptcp/mptcp_sockopt.c +4 -0
index b8158a1198eba..f7a45b93cbe06 100644
@@ -635,6 +635,11 @@ static void connect_one_server(int fd, int pipefd)
 	do_getsockopts(&s, fd, total, total);
 
 	assert(s.mptcpi_rcv_delta == (uint64_t)total);
+
+	/* app-limited accounting requires a recent kernel */
+	if (expect_all_features())
+		assert(s.tcp_info.tcpi_delivery_rate_app_limited == 1);

[Severity: Low]
This isn't a bug, but a question about coverage. With this gate, the new check only runs when SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES=1 is set:

static bool expect_all_features(void)

{
	char *env = getenv("SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES");

	return env && strcmp(env, "1") == 0;
}

So a plain "make run_tests" or a default kselftest run never checks the subflow app-limited accounting. The comment says "requires a recent kernel", but the code only reads the environment variable. It does not probe the kernel.

This looks deliberate and follows existing MPTCP selftest practice. pm_netlink.sh gates checks that only hold on newer kernels the same way:

if mptcp_lib_expect_all_features; then

	check "get_limits" "$(format_limits 0 2)" "defaults limits"

fi

mptcp_lib.sh also says the variable is set when validating against the latest kernel. As far as I can tell there is no runtime probe that could replace it. tcpi_delivery_rate_app_limited was in struct tcp_info long before MPTCP_TCPINFO existed, so the size of the tcp_info the kernel fills says nothing about whether mptcp_rate_check_app_limited() is present.

Would it help to make the comment say the check is only enabled when SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES is set, so it is clear that default runs skip it?

Quoted 3 lines
tools/testing/selftests/net/mptcp/mptcp_sockopt.c +1 -0
+
 	close(fd);
 }
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1793324316.git.tanggeliang%40kylinos.cn