From: Geliang Tang <geliang@kernel.org>
To: mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: [PATCH mptcp-next v2 15/15] Squash to "selftests/bpf: Add bpf scheduler test" 2
Date: Fri, 29 Mar 2024 12:56:11 +0800 [thread overview]
Message-ID: <444a1f6d61fc86bde74fe93cf3f19605994b4632.1711688054.git.tanggeliang@kylinos.cn> (raw)
In-Reply-To: <cover.1711688054.git.tanggeliang@kylinos.cn>
From: Geliang Tang <tanggeliang@kylinos.cn>
send_data isn't invoked anywhere, can be dropped now.
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
.../testing/selftests/bpf/prog_tests/mptcp.c | 83 +------------------
1 file changed, 1 insertion(+), 82 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index 6b77fb51c4f5..34fe79f34eb9 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -299,87 +299,6 @@ static void run_mptcpify(int cgroup_fd, struct mptcpify *skel)
MPTCP_BASE_TEST(mptcpify);
-static const unsigned int total_bytes = 10 * 1024 * 1024;
-static int stop, duration;
-
-static void *server(void *arg)
-{
- int lfd = (int)(long)arg, err = 0, fd;
- ssize_t nr_sent = 0, bytes = 0;
- char batch[1500];
-
- fd = accept(lfd, NULL, NULL);
- while (fd == -1) {
- if (errno == EINTR)
- continue;
- err = -errno;
- goto done;
- }
-
- if (settimeo(fd, 0)) {
- err = -errno;
- goto done;
- }
-
- while (bytes < total_bytes && !READ_ONCE(stop)) {
- nr_sent = send(fd, &batch,
- MIN(total_bytes - bytes, sizeof(batch)), 0);
- if (nr_sent == -1 && (errno == EINTR || errno == EAGAIN))
- continue;
- if (nr_sent == -1) {
- err = -errno;
- break;
- }
- bytes += nr_sent;
- }
-
- CHECK(bytes != total_bytes, "send", "%zd != %u nr_sent:%zd errno:%d\n",
- bytes, total_bytes, nr_sent, errno);
-
-done:
- if (fd >= 0)
- close(fd);
- if (err) {
- WRITE_ONCE(stop, 1);
- return ERR_PTR(err);
- }
- return NULL;
-}
-
-static void send_data(int lfd, int fd, char *msg)
-{
- ssize_t nr_recv = 0, bytes = 0;
- pthread_t srv_thread;
- void *thread_ret;
- char batch[1500];
- int err;
-
- WRITE_ONCE(stop, 0);
-
- err = pthread_create(&srv_thread, NULL, server, (void *)(long)lfd);
- if (CHECK(err != 0, "pthread_create", "err:%d errno:%d\n", err, errno))
- return;
-
- /* recv total_bytes */
- while (bytes < total_bytes && !READ_ONCE(stop)) {
- nr_recv = recv(fd, &batch,
- MIN(total_bytes - bytes, sizeof(batch)), 0);
- if (nr_recv == -1 && (errno == EINTR || errno == EAGAIN))
- continue;
- if (nr_recv == -1)
- break;
- bytes += nr_recv;
- }
-
- CHECK(bytes != total_bytes, "recv", "%zd != %u nr_recv:%zd errno:%d\n",
- bytes, total_bytes, nr_recv, errno);
-
- WRITE_ONCE(stop, 1);
- pthread_join(srv_thread, &thread_ret);
- CHECK(IS_ERR(thread_ret), "pthread_join", "thread_ret:%ld",
- PTR_ERR(thread_ret));
-}
-
#define ADDR_1 "10.0.1.1"
#define ADDR_2 "10.0.1.2"
#define PORT_1 10001
@@ -433,7 +352,7 @@ static void send_data_and_verify(char *msg, int addr1, int addr2)
if (clock_gettime(CLOCK_MONOTONIC, &start) < 0)
return;
- send_data(server_fd, client_fd, msg);
+ send_recv_data(server_fd, client_fd);
if (clock_gettime(CLOCK_MONOTONIC, &end) < 0)
return;
--
2.40.1
prev parent reply other threads:[~2024-03-29 4:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-29 4:55 [PATCH mptcp-next v2 00/15] refactor mptcp bpf tests Geliang Tang
2024-03-29 4:55 ` [PATCH mptcp-next v2 01/15] Squash to "selftests/bpf: Add bpf scheduler test" - fix Geliang Tang
2024-03-29 4:55 ` [PATCH mptcp-next v2 02/15] selftests/bpf: Handle EAGAIN in bpf_tcp_ca Geliang Tang
2024-03-29 4:55 ` [PATCH mptcp-next v2 03/15] selftests/bpf: Export send_single_byte helper Geliang Tang
2024-03-29 4:56 ` [PATCH mptcp-next v2 04/15] selftests/bpf: Export send_recv_data helper Geliang Tang
2024-03-29 4:56 ` [PATCH mptcp-next v2 05/15] selftests/bpf: Refactor mptcp_sock test Geliang Tang
2024-03-29 4:56 ` [PATCH mptcp-next v2 06/15] selftests/bpf: Refactor mptcpify test Geliang Tang
2024-03-29 4:56 ` [PATCH mptcp-next v2 07/15] selftests/bpf: Add MPTCP_BASE_TEST macro Geliang Tang
2024-03-29 4:56 ` [PATCH mptcp-next v2 08/15] selftests/bpf: Add RUN_MPTCP_TEST macro Geliang Tang
2024-03-29 4:56 ` [PATCH mptcp-next v2 09/15] Squash to "selftests/bpf: Add bpf scheduler test" Geliang Tang
2024-03-29 4:56 ` [PATCH mptcp-next v2 10/15] Squash to "selftests/bpf: Add bpf_first test" Geliang Tang
2024-03-29 4:56 ` [PATCH mptcp-next v2 11/15] Squash to "selftests/bpf: Add bpf_bkup test" Geliang Tang
2024-03-29 4:56 ` [PATCH mptcp-next v2 12/15] Squash to "selftests/bpf: Add bpf_rr test" Geliang Tang
2024-03-29 4:56 ` [PATCH mptcp-next v2 13/15] Squash to "selftests/bpf: Add bpf_red test" Geliang Tang
2024-03-29 4:56 ` [PATCH mptcp-next v2 14/15] Squash to "selftests/bpf: Add bpf_burst test" Geliang Tang
2024-03-29 4:56 ` Geliang Tang [this message]
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=444a1f6d61fc86bde74fe93cf3f19605994b4632.1711688054.git.tanggeliang@kylinos.cn \
--to=geliang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).