From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 626FF1DE2C9 for ; Fri, 14 Nov 2025 01:36:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763084210; cv=none; b=UNQvR1UM2dQaMn1eCInG5u/bsg1/lmIEuY1G+huaDvh8bzfM0MrG1x2+Dx/20J3kBOC08b7cmsfjE3Dhgzb1/uXFhYoxHbFe/KASRj9ZJVDaZyO9rsQIOCToq3BdJFzGNsYXbvitUEZdfSOcgn1sQLjo4SIvk+cMoEjq2v2f9g4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763084210; c=relaxed/simple; bh=184T6RWPKkrI9yGxqY80YK5leWWcLPxzmE9thnr28BY=; h=MIME-Version:Date:Content-Type:From:Message-ID:Subject:To:Cc: In-Reply-To:References; b=mZUMtsNlgPzQ4IrQHNYTLULqgs+bklQZ27SkwWR/kSulkxHslNhmCrrd2BaHvFprc44Nfng+IvQ1uoDMeLlKGbCaWjK/jVdJFtDTMt5W/EtANTJ+p/F6oTRpLoY5+Ftbqpd7hcq36KZOw0p9SFDjRkcMkupDcRHn/OFOvE8oezk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=t/xuhW6c; arc=none smtp.client-ip=91.218.175.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="t/xuhW6c" Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1763084195; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rhAvhoW0qGIKNwEfFjd214od0HqLgMRWs7YHTP4WZaA=; b=t/xuhW6cYzNRhoXeqwXsrq+DVpCFpEEZ10t9Hro34mdAneBTjRM8fcvOodXL4GzWCL08QT w5yBZIDqjrzULT/Bml/Q14gUs+7099w1Lo6UWJV/hf+EAI+ry5Q8OoKTumBnDTAaCcoI57 h0iRQ7TrtIz0Fbe6Uq3NbwiDiI7zRGo= Date: Fri, 14 Nov 2025 01:36:32 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Jiayuan Chen" Message-ID: TLS-Required: No Subject: Re: [PATCH net v5 3/3] selftests/bpf: Add mptcp test with sockmap To: "Martin KaFai Lau" , "Matthieu Baerts" Cc: mptcp@lists.linux.dev, "Mat Martineau" , "Geliang Tang" , "David S. Miller" , "Eric Dumazet" , "Jakub Kicinski" , "Paolo Abeni" , "Simon Horman" , "Alexei Starovoitov" , "Daniel Borkmann" , "Andrii Nakryiko" , "Eduard Zingerman" , "Song Liu" , "Yonghong Song" , "John Fastabend" , "KP Singh" , "Stanislav Fomichev" , "Hao Luo" , "Jiri Olsa" , "Shuah Khan" , "Florian Westphal" , "Christoph Paasch" , "Peter Krystad" , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org In-Reply-To: References: <20251111060307.194196-1-jiayuan.chen@linux.dev> <20251111060307.194196-4-jiayuan.chen@linux.dev> X-Migadu-Flow: FLOW_OUT 2025/11/14 05:48, "Martin KaFai Lau" =E5=86=99=E5=88=B0: >=20 >=20>=20 >=20> diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools= /testing/selftests/bpf/prog_tests/mptcp.c > > index f8eb7f9d4fd2..b976fe626343 100644 > > --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c > > +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c > > @@ -6,11 +6,14 @@ > > #include > > #include > > #include > > +#include > >=20 >=20I changed to errno.h to be specific. I think you only need the values= of an errno here. >=20 >=20>=20 >=20> #include "cgroup_helpers.h" > > #include "network_helpers.h" > > +#include "socket_helpers.h" > > #include "mptcp_sock.skel.h" > > #include "mptcpify.skel.h" > > #include "mptcp_subflow.skel.h" > > +#include "mptcp_sockmap.skel.h" > > > #define NS_TEST "mptcp_ns" > > #define ADDR_1 "10.0.1.1" > > @@ -436,6 +439,142 @@ static void test_subflow(void) > > close(cgroup_fd); > > } > > > +/* Test sockmap on MPTCP server handling non-mp-capable clients. = */ > > +static void test_sockmap_with_mptcp_fallback(struct mptcp_sockmap *= skel) > > +{ > > + int listen_fd =3D -1, client_fd1 =3D -1, client_fd2 =3D -1; > > + int server_fd1 =3D -1, server_fd2 =3D -1, sent, recvd; > > + char snd[9] =3D "123456789"; > > + char rcv[10]; > > + > > + /* start server with MPTCP enabled */ > > + listen_fd =3D start_mptcp_server(AF_INET, NULL, 0, 0); > > + if (!ASSERT_OK_FD(listen_fd, "sockmap-fb:start_mptcp_server")) > > + return; > > + > > + skel->bss->trace_port =3D ntohs(get_socket_local_port(listen_fd)); > > + skel->bss->sk_index =3D 0; > > + /* create client without MPTCP enabled */ > > + client_fd1 =3D connect_to_fd_opts(listen_fd, NULL); > > + if (!ASSERT_OK_FD(client_fd1, "sockmap-fb:connect_to_fd")) > > + goto end; > > + > > + server_fd1 =3D xaccept_nonblock(listen_fd, NULL, NULL); > > + skel->bss->sk_index =3D 1; > > + client_fd2 =3D connect_to_fd_opts(listen_fd, NULL); > > + if (!ASSERT_OK_FD(client_fd2, "sockmap-fb:connect_to_fd")) > > + goto end; > > + > > + server_fd2 =3D xaccept_nonblock(listen_fd, NULL, NULL); > > + /* test normal redirect behavior: data sent by client_fd1 can be > > + * received by client_fd2 > > + */ > > + skel->bss->redirect_idx =3D 1; > > + sent =3D xsend(client_fd1, snd, sizeof(snd), 0); > > + if (!ASSERT_EQ(sent, sizeof(snd), "sockmap-fb:xsend(client_fd1)")) > > + goto end; > > + > > + /* try to recv more bytes to avoid truncation check */ > > + recvd =3D recv_timeout(client_fd2, rcv, sizeof(rcv), MSG_DONTWAIT,= 2); > >=20 >=20I removed the socket_helpers.h usage. The _nonblock, _timeout, and > MSG_DONTWAIT are unnecessary. I replaced them with the regular accept, > send, and recv. All fds from network_helpers.c have a default 3s > timeout instead of 30s in xaccept_nonblock. This matches how most of > the selftests/bpf are doing it as well. >=20 >=20I also touched up the commit message in patch 2 based on Matt's comme= nt. >=20 >=20Applied. Thanks. >=20 Thanks=20for the cleanup and applying!