From patchwork Thu Aug 1 09:21:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13750069 X-Patchwork-Delegate: matthieu.baerts@tessares.net Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4CAFC18B482 for ; Thu, 1 Aug 2024 09:21:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722504110; cv=none; b=tjI9LODwbupLk19ZnvPiBfkS13igZb/DppA6yQ3eJ2gYkpReiES03ArJ3ui8ZfqTRpck1sXmE+rWah3NpjpbastaKbNPatjh7Rik8QABR83OQDv3GkL0K7Yp/xFn/Xgin2P3gLNg0Se0uCat3PB0mKNBuWUnJ6kmFUvAM2wVZXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722504110; c=relaxed/simple; bh=W2TuQyeWiVAbc37Da1tLEgsaRxSP3hpjznqE6RQRQIU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z5CaRXC5Gyk8wbNEN5VaAu0/Agp1UlRYy/DDOaFG6Fs5SKYaNrQJ4KiDGl7Fe3GnPae1xtv/DHBEziBQuzsKggRE01a8TTzqtcrkVlgwQ0GUUJbhmJlVhp3MgXzsHexieK4cYjf+y8tLMgVnnB7j7x0LKhme0VPan8WrO03hnxw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=T88/cl+a; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="T88/cl+a" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECB4FC32786; Thu, 1 Aug 2024 09:21:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722504109; bh=W2TuQyeWiVAbc37Da1tLEgsaRxSP3hpjznqE6RQRQIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T88/cl+ayDzv65IXaxkGzYFJeoLjnWfVEmB676hi3sPz8TfssvRb1FM4tgaoUqbt0 8oGZvZYWiqrj7bMi5E40NVlvm2Mw4f4QdAl7k+B6+Gh+UY02WaNGmJyTevuRRkeqkS Aw57jgUNC345opSTbprlVkEhuSEtSb/IlnoGq48OGRa+oiuqujMSkoOze4h4gQsd1/ 7qCoL3LLYmMTuUF9vlmkLWMp6iz0wr3LQG7wtIlPIdwOLk1LuMKaJkBxyDqwhtexJb NfchIF6KoL1Srbfm/fs5vYgwnTmQhOgnyQk44AcS8heryM/f1s2L3uEfevatQd9pas zR0qVwKfkBRyg== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 1/4] selftests: mptcp: add cfg_timeo for mptcp_connect Date: Thu, 1 Aug 2024 17:21:39 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang This patch adds a new helper settimeo(), which comes from BPF selftests network_helpers.c, into MPTCP selftests tool mptcp_connect, to set SO_RCVTIMEO and SO_SNDTIMEO options of the given socket. Add a new mptcp_connect option "-O" to pass a timeout value and a new cfg cfg_timeo to store this value. Invoke this new helper in sock_connect_mptcp() when cfg_timeo is set. Signed-off-by: Geliang Tang --- .../selftests/net/mptcp/mptcp_connect.c | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c index 4209b9569039..ce261a4bb324 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c @@ -75,6 +75,7 @@ static char *cfg_input; static int cfg_repeat = 1; static int cfg_truncate; static int cfg_rcv_trunc; +static int cfg_timeo; struct cfg_cmsg_types { unsigned int cmsg_enabled:1; @@ -249,6 +250,30 @@ static void set_mptfo(int fd, int pf) perror("TCP_FASTOPEN"); } +static int settimeo(int fd, int timeout_ms) +{ + struct timeval timeout = { .tv_sec = 3 }; + + if (timeout_ms > 0) { + timeout.tv_sec = timeout_ms / 1000; + timeout.tv_usec = (timeout_ms % 1000) * 1000; + } + + if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, + sizeof(timeout))) { + perror("set SO_RCVTIMEO"); + return -1; + } + + if (setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &timeout, + sizeof(timeout))) { + perror("set SO_SNDTIMEO"); + return -1; + } + + return 0; +} + static int do_ulp_so(int sock, const char *name) { return setsockopt(sock, IPPROTO_TCP, TCP_ULP, name, strlen(name)); @@ -376,6 +401,9 @@ static int sock_connect_mptcp(const char * const remoteaddr, if (cfg_mark) set_mark(sock, cfg_mark); + if (cfg_timeo) + settimeo(sock, cfg_timeo); + if (cfg_sockopt_types.mptfo) { if (!winfo->total_len) winfo->total_len = winfo->len = read(infd, winfo->buf, @@ -1384,7 +1412,7 @@ static void parse_opts(int argc, char **argv) { int c; - while ((c = getopt(argc, argv, "6c:f:hi:I:jlm:M:o:p:P:r:R:s:S:t:T:w:")) != -1) { + while ((c = getopt(argc, argv, "6c:f:hi:I:jlm:M:o:p:P:r:R:s:S:t:T:w:O:")) != -1) { switch (c) { case 'f': cfg_truncate = atoi(optarg); @@ -1462,6 +1490,9 @@ static void parse_opts(int argc, char **argv) case 'o': parse_setsock_options(optarg); break; + case 'O': + cfg_timeo = strtol(optarg, NULL, 0); + break; } } From patchwork Thu Aug 1 09:21:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13750070 X-Patchwork-Delegate: matthieu.baerts@tessares.net Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DF8F218B482 for ; Thu, 1 Aug 2024 09:21:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722504112; cv=none; b=tiVeFxlkP/JrXs8kdwLK07by7hHlZpg7JnRDAnn4T2x/dDrYXBPzJWE7iGnawWslKxiyWAjbSLJqpFDpBIoT3tsAI4FbtoCbpuVBViD4ih8iNFlLi/1V9w4dElmDeZkUSD2vmIk/oCAmlCEEq0vTy4CTJqxIfwOLo4JGYYWV8zg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722504112; c=relaxed/simple; bh=j5KRxO4c9ioLsw+4TbFylU3IXiH9SkqnRK9GiS5QbAU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u+02BkAUOYCKz3ALWk7pco+g5/g7Fz3JuGEsRzHZayGdtiP/uiIPsJhnIuSHvRXiUWrL/ss0pGxSpv2zFuxAHjWxlcR/leLYgGEU0A0n9r+rBwGgnYr0cWTTd8doPFkD9/zSX4Hntcu5jQtvA6ayRwfJKnezrwvfzdPdIvxqSOY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aFYGnR6S; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aFYGnR6S" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C140C4AF0A; Thu, 1 Aug 2024 09:21:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722504111; bh=j5KRxO4c9ioLsw+4TbFylU3IXiH9SkqnRK9GiS5QbAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aFYGnR6SrIA6H2R8oHMdzGGlw9WSsakEKbSVf89K94Z1vueapa6a9L+oLlpuOXd63 1gWQ4KXs/uBK80F1GGUx4SXgvrIHe0IeHQwXZKfG204B3VEwI+zuVYW377KlgGwkOZ 3epPV/qZz0DVtUei/JgswSRq4qMbDBm57DOE7MrdJAkiEjB5BhDhDuJK4rINKqYlXk IB3Jo9We/wQodqFEPdkpRW57pqPAKt28vS7kWiwdHH9qAV4bSPtbhRp94BfXWFcb7N qdqRNDY5ZhfVCLNHq6YkRSlqKzZnRWIjX3gpobeb/agtmvoP1zj4t8RdWyKj31IMnc NgQY5R7weIpYA== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 2/4] selftests: mptcp: add io thread mode for mptcp_connect Date: Thu, 1 Aug 2024 17:21:40 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang This patch adds a new io mode "thread" for mptcp_connect, it creates a new thread to send data meanwhile receiving data in main thread. copyfd_io_thread() comes from BPF selftests network_helpers.c. Signed-off-by: Geliang Tang --- .../selftests/net/mptcp/mptcp_connect.c | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c index ce261a4bb324..477969ba9653 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -24,6 +25,7 @@ #include #include #include +#include #include #include @@ -49,6 +51,7 @@ enum cfg_mode { CFG_MODE_POLL, CFG_MODE_MMAP, CFG_MODE_SENDFILE, + CFG_MODE_THREAD, }; enum cfg_peek { @@ -105,6 +108,8 @@ static struct tcp_inq_state tcp_inq; static struct cfg_cmsg_types cfg_cmsg_types; static struct cfg_sockopt_types cfg_sockopt_types; +static unsigned int io_thread_total_bytes = 10 * 1024 * 1024; + static void die_usage(void) { fprintf(stderr, "Usage: mptcp_connect [-6] [-c cmsg] [-f offset] [-i file] [-I num] [-j] [-l] " @@ -139,6 +144,11 @@ static void die_usage(void) exit(1); } +static void *ERR_PTR(long error) +{ + return (void *)error; +} + static void xerror(const char *fmt, ...) { va_list ap; @@ -938,6 +948,94 @@ static int copyfd_io_sendfile(int infd, int peerfd, int outfd, return err; } +struct io_thread_arg { + int fd; + uint32_t bytes; + int stop; +}; + +static void *send_thread(void *arg) +{ + struct io_thread_arg *a = (struct io_thread_arg *)arg; + ssize_t nr_sent = 0, bytes = 0; + int err = 0, fd = a->fd; + char batch[1500]; + + while (bytes < a->bytes && !a->stop) { + nr_sent = send(fd, &batch, + MIN(a->bytes - bytes, sizeof(batch)), 0); + if (nr_sent == -1 && errno == EINTR) + continue; + if (nr_sent == -1) { + err = -errno; + break; + } + bytes += nr_sent; + } + + if (bytes != a->bytes) { + printf("send %zd expected %u\n", bytes, a->bytes); + if (!err) + err = bytes > a->bytes ? -E2BIG : -EINTR; + } + + if (err) { + a->stop = 1; + return ERR_PTR(err); + } + return NULL; +} + +static int copyfd_io_thread(int peerfd, int fd, uint32_t total_bytes) +{ + ssize_t nr_recv = 0, bytes = 0; + struct io_thread_arg arg = { + .fd = fd, + .bytes = total_bytes, + .stop = 0, + }; + pthread_t thread; + void *thread_ret; + char batch[1500]; + int err; + + err = pthread_create(&thread, NULL, send_thread, (void *)&arg); + if (err) { + printf("Failed to pthread_create\n"); + goto done; + } + + /* recv total_bytes */ + while (bytes < total_bytes && !arg.stop) { + nr_recv = recv(peerfd, &batch, + MIN(total_bytes - bytes, sizeof(batch)), 0); + if (nr_recv == -1 && errno == EINTR) + continue; + if (nr_recv == -1) { + err = -errno; + break; + } + bytes += nr_recv; + } + + if (bytes != total_bytes) { + printf("recv %zd expected %u\n", bytes, total_bytes); + if (!err) + err = bytes > total_bytes ? -E2BIG : -EINTR; + } + + arg.stop = 1; + pthread_join(thread, &thread_ret); + if (thread_ret) { + printf("Failed in thread_ret %ld\n", (long)thread_ret); + err = err ? : (long)thread_ret; + } + +done: + close(peerfd); + return err; +} + static int copyfd_io(int infd, int peerfd, int outfd, bool close_peerfd, struct wstate *winfo) { bool in_closed_after_out = false; @@ -970,6 +1068,11 @@ static int copyfd_io(int infd, int peerfd, int outfd, bool close_peerfd, struct &in_closed_after_out, winfo); break; + case CFG_MODE_THREAD: + ret = copyfd_io_thread(peerfd, outfd, + io_thread_total_bytes); + break; + default: fprintf(stderr, "Invalid mode %d\n", cfg_mode); @@ -1352,6 +1455,8 @@ int parse_mode(const char *mode) return CFG_MODE_MMAP; if (!strcasecmp(mode, "sendfile")) return CFG_MODE_SENDFILE; + if (!strcasecmp(mode, "thread")) + return CFG_MODE_THREAD; fprintf(stderr, "Unknown test mode: %s\n", mode); fprintf(stderr, "Supported modes are:\n"); From patchwork Thu Aug 1 09:21:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13750071 X-Patchwork-Delegate: matthieu.baerts@tessares.net Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 AEC0618B489 for ; Thu, 1 Aug 2024 09:21:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722504113; cv=none; b=BeTzVsIKvdkNjyuIu80934cpGb2Fwvk+0Iwb3/GoRPke8/iDwOa2MdpudH9gc7FVStVg7u46o5eFhl58MiRW4v/hYJWDSzWnPMTae+mVETlfCgyjEm8xiddSjtQEpVc/BUD15Mh9tJzSmXJeuUKeMfEsmGfW5ujygdgUqd/1ISo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722504113; c=relaxed/simple; bh=P219Myx4oW/sivfPkepM8i1gWrkjmQvByhQh8DuwL0A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YaWKyj2SHQztgHiIin/KvklHntt/+CjKUoBq1ZYgtVPUVniqzC3S2ehHqelF4ud3nuVjY4iQHKP7mdc6+opnM8qDvaqavlyXAcD+irNNsaIWb3rj9n1hGLT4GGWRajSTGPmlgojvuKGceh0Ok//j8eIiBGp2bVsKUkQb653pCK0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BdU1wLxi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BdU1wLxi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0399CC32786; Thu, 1 Aug 2024 09:21:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722504113; bh=P219Myx4oW/sivfPkepM8i1gWrkjmQvByhQh8DuwL0A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BdU1wLxinS4Y0Ph5IvvPGIp59q90frrnmaFMyAisSrmAGU64YdfnkYBDlaSL3HTgJ neplxcjNp+U2IrsbXTKyKlOn6ipqhBVc5pmP4kgw8RhbZ2Pw5wEeE7VsoCMh4G5bV/ 7Z1VokoQ0ncJxX2eg1VQQyDkD8r6UWJSaF5FE+23nLpcS2v4/hOZTEl38aG6JVOzPc lsghxzkIQV9YClKuE3+avylMXT4OwaNuSmoJJraoGEfwql3/5tGdLo4X8FBr4A7ruz FTGAJMkwYrRn2m3SdsGR16qlTQc9jeyjSLkm8CXq9iy7ApPDJFYmTOnFkw5oV1G3mo j0FAYnBmw8zFQ== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 3/4] selftests: mptcp: enable io thread mode Date: Thu, 1 Aug 2024 17:21:41 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang This patch adds a new parameter "listensock" for the client main_loop() to support io thread mode tests. In it, invoke accept() to get the peer socket and pass it to copyfd_io(), then to copyfd_io_thread(). Signed-off-by: Geliang Tang --- .../selftests/net/mptcp/mptcp_connect.c | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c index 477969ba9653..bd61cf203501 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c @@ -1372,9 +1372,9 @@ void xdisconnect(int fd, int addrlen) xerror("can't disconnect: %d", errno); } -int main_loop(void) +int main_loop(int listensock) { - int fd = 0, ret, fd_in = 0; + int fd = 0, ret, fd_in = 0, peerfd = 1; struct addrinfo *peer; struct wstate winfo; @@ -1389,6 +1389,19 @@ int main_loop(void) if (fd < 0) return 2; + if (cfg_mode == CFG_MODE_THREAD && + listensock >= 0) { + peerfd = accept(listensock, NULL, NULL); + while (peerfd == -1) { + if (errno == EINTR) + continue; + return -errno; + } + + if (cfg_timeo) + settimeo(peerfd, cfg_timeo); + } + again: check_getpeername_connect(fd); @@ -1407,7 +1420,7 @@ int main_loop(void) xerror("can't open %s:%d", cfg_input, errno); } - ret = copyfd_io(fd_in, fd, 1, 0, &winfo); + ret = copyfd_io(fd_in, fd, peerfd, 0, &winfo); if (ret) return ret; @@ -1430,6 +1443,8 @@ int main_loop(void) close(fd); } + if (listensock >= 0) + close(listensock); return 0; } @@ -1630,9 +1645,11 @@ int main(int argc, char *argv[]) set_mark(fd, cfg_mark); if (cfg_cmsg_types.cmsg_enabled) apply_cmsg_types(fd, &cfg_cmsg_types); + if (cfg_mode == CFG_MODE_THREAD) + return main_loop(fd); return main_loop_s(fd); } - return main_loop(); + return main_loop(-1); } From patchwork Thu Aug 1 09:21:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13750072 X-Patchwork-Delegate: matthieu.baerts@tessares.net Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CF35D18B482 for ; Thu, 1 Aug 2024 09:21:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722504115; cv=none; b=PGgrJ99e+bdxam905oSfYyQQuUdteyvX4xmtKU2pCUXye9VO1IC6xQiMHvN5r7DhO2Eo2Fygw4seA5k98rOnE3fKt8xSnYrnqPRXDDwi5iVZxh9EIxdDnC52AxUVBxS1iSKrmBG/Fy1NYmAjH08Eb5Px9CyW4CyZbxP/+evP2N0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722504115; c=relaxed/simple; bh=OOVR7U8Kupf1czJSoIYGIhCynIGRjvm1gIqEQ0iKxMY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uQAyV7Ra9GgEmpatIl0XjWI5+XwW7lfBwMA+AZ+DRdcmtE3s0urgfybXjMmVohXy45YCFctzDhfvD9JudG15bsTZ22pH1mym9l/dUtq/NfvjrNtRyolbL0O7pblvDbJmT4Lqx5AoNys86PaI2oxye+BeW8l9ajb/wp80SXStBp8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gvpDSbAg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gvpDSbAg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC368C4AF09; Thu, 1 Aug 2024 09:21:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722504115; bh=OOVR7U8Kupf1czJSoIYGIhCynIGRjvm1gIqEQ0iKxMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gvpDSbAgnSYlfDdI2NtlJS6B1PE5VBsULaJO1DBx4VbW0PG01tfemyl/8s3pjEGqM JwN2ATFs/YAOHDrXnP2UUbQGYx6QQL3V5DSCbkeK2MyMwaA9u3/BPexWh8FYRxySJK ziFEfkdLyxOOqIWFcRDf+uI+ROib2ZEj8mi577CUYuCpz31NwYS1YblDIvLx1Majot 7JHIlGKPd470dPv0wldXpYxx5RP+lrhms5TJieO0BAJCFdEOwViD5qYoiRUirAhko5 CmSiaatJ8ISc/a333IM/RV55czpRnqIDHCmYTFVL/BQb0XrNjM63hjs3IyusWq89dZ 2lDJvI0zNjoZw== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next 4/4] selftests: mptcp: join: add io thread tests Date: Thu, 1 Aug 2024 17:21:42 +0800 Message-ID: <30fbc6cffaf0617640cd1dbb0afd8b056dcab684.1722502941.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang This io thread mode is used in BPF selftests bpf_tcp_ca and MPTCP, and it is not very stable for MPTCP sched tests. This patch adds them into mptcp_join tests (-T) to make sure this scene is also covered. These tests only run in ns1 for 100 times. The failed output looks like: 001 io thread tests recv 2884500 expected 10485760 send 8005500 expected 10485760 Failed in thread_ret -11 Test no. 12 failed. syn [FAIL] got 12 JOIN[s] syn expected 100 synack [ OK ] ack [FAIL] got 12 JOIN[s] ack expected 100 Signed-off-by: Geliang Tang --- .../testing/selftests/net/mptcp/mptcp_join.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 01c1e0871aca..ecba07aac776 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3663,6 +3663,24 @@ endpoint_tests() fi } +io_thread_tests() +{ + if reset "io thread tests"; then + local nr=0 max=100 + mptcp_lib_pm_nl_set_limits $ns1 8 8 + mptcp_lib_pm_nl_add_endpoint $ns1 10.0.2.1 flags subflow + while [ $nr -lt $max ]; do + nr=$((nr + 1)) + ip netns exec $ns1 ./mptcp_connect -l 10.0.1.1 -m "thread" -O 3000 + if [ $? -ne 0 ]; then + echo "Test no. $nr failed." + break; + fi + done + chk_join_nr $max 0 $max + fi +} + # [$1: error message] usage() { @@ -3711,6 +3729,7 @@ all_tests_sorted=( F@fail_tests u@userspace_tests I@endpoint_tests + T@io_thread_tests ) all_tests_args=""