Skip to contentSkip to conversation

selftests: mptcp: sockopt: check app_limited

PATCH [email protected] 1 participant 1 message Oct 30 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] The new check in connect_one_server() (tools/testing/selftests/net/mptcp/mptcp_sockopt.c:640-641) asserts…

--

selftests: mptcp: sockopt: check app_limited

This adds a check to connect_one_server() in the mptcp_sockopt selftest. After a small data exchange, the test now asserts that the client subflow reports tcpi_delivery_rate_app_limited == 1. The check is meant to cover the preceding change to mptcp_rate_check_app_limited().

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]
Does this assertion only cover one direction of the subflow app-limited accounting?

The expected value of 1 is also the initial value set in tcp_init_sock():

net/ipv4/tcp.c:tcp_init_sock() {
    ...
	tp->app_limited = ~0U;
	tp->rate_app_limited = 1;
    ...
}

It only changes in tcp_rate_gen(), and only for a valid sample:

	if (!rs->is_app_limited ||
	    ((u64)rs->delivered * tp->rate_interval_us >=
	     (u64)tp->rate_delivered * rs->interval_us)) {
		tp->rate_delivered = rs->delivered;
		tp->rate_interval_us = rs->interval_us;
		tp->rate_app_limited = rs->is_app_limited;
	}

So a reading of 1 means one of two things: every valid sample was app-limited, or no valid sample was ever recorded.

The test does catch the case it was written for. Without the preceding fix, the handshake ACK clears tp->app_limited. The ACK for the data then gives a valid sample that is not app-limited, and rate_app_limited becomes 0.

However, the test never creates a sender that still has data queued. Suppose a later change always marked subflows app-limited, for example by dropping this bail-out in mptcp_rate_check_app_limited():

	if (msk->write_seq != msk->snd_nxt || mptcp_send_head(sk))
		return;

Would this test still pass in that case? Could a check be added that a subflow reports rate_app_limited == 0 while the MPTCP socket still has data queued?

Some smaller points:

Only the client subflow is checked. process_one_client() also sends the echo through mptcp_sendmsg() on the accepted socket:

	ret2 = write(fd, buf, ret);

Should the server side have a matching check?

The check only runs when SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES=1. Otherwise it is skipped without printing a SKIP message.

do_getsockopt_tcp_info() only waits for tcpi_bytes_sent and tcpi_bytes_received to reach the expected values. It does not check that a delivery rate sample was actually taken.

Given the above, the commit message says:

This guards against regressions in subflow app-limited accounting.

Could this be narrowed to say that the test covers a missing app-limited mark on an idle sender?

Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1793258749.git.tanggeliang%40kylinos.cn