Message ID | b0ae79b3c2e446dd0f5ac09470db661d51575227.1714654747.git.tanggeliang@kylinos.cn (mailing list archive) |
---|---|
State | Accepted, archived |
Commit | f6121dceb9dfe466f425d98cd8540c6ab5b632a4 |
Delegated to: | Matthieu Baerts |
Headers | show |
Series | [mptcp-next] Squash to "selftests/bpf: Add bpf scheduler test" - drop send_data | expand |
Context | Check | Description |
---|---|---|
matttbe/build | success | Build and static analysis OK |
matttbe/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 103 lines checked |
matttbe/shellcheck | success | MPTCP selftests files have not been modified |
matttbe/KVM_Validation__normal | success | Success! ✅ |
matttbe/KVM_Validation__debug | success | Success! ✅ |
matttbe/KVM_Validation__btf__only_bpftest_all_ | success | Success! ✅ |
Hi Geliang, Thank you for your modifications, that's great! Our CI did some validations and here is its report: - KVM Validation: normal: Success! ✅ - KVM Validation: debug: Success! ✅ - KVM Validation: btf (only bpftest_all): Success! ✅ - Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/8924472364 Initiator: Patchew Applier Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/9c0791ebf569 Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=849888 If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.: $ cd [kernel source code] $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \ --pull always mptcp/mptcp-upstream-virtme-docker:latest \ auto-normal For more details: https://github.com/multipath-tcp/mptcp-upstream-virtme-docker Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-) Cheers, MPTCP GH Action bot Bot operated by Matthieu Baerts (NGI0 Core)
Hi Geliang, On 02/05/2024 14:59, Geliang Tang wrote: > From: Geliang Tang <tanggeliang@kylinos.cn> > > Drop send_data, using send_recv_data instead. Thank you for the follow-up patch! It looks good to me: New patches for t/upstream: - f6121dceb9df: "squashed" (with conflicts) in "selftests/bpf: Add bpf scheduler test" - Results: aec5976283ec..553805a44319 (export) Tests are now in progress: - export: https://github.com/multipath-tcp/mptcp_net-next/commit/2eb644226c7bbf2ff4525c16c9d636e386c50c57/checks Cheers, Matt
diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c index 88bc96bfd594..6a07160b5ac9 100644 --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c @@ -46,7 +46,7 @@ #define MPTCP_SCHED_NAME_MAX 16 static const unsigned int total_bytes = 10 * 1024 * 1024; -static int stop, duration; +static int duration; struct __mptcp_info { __u8 mptcpi_subflows; @@ -465,85 +465,6 @@ static void test_subflow(void) close(cgroup_fd); } -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) - 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) - 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)); -} - static struct nstoken *sched_init(char *flags, char *sched) { struct nstoken *nstoken; @@ -585,7 +506,9 @@ static void send_data_and_verify(char *sched, bool addr1, bool addr2) if (clock_gettime(CLOCK_MONOTONIC, &start) < 0) goto fail; - send_data(server_fd, client_fd, sched); + if (!ASSERT_OK(send_recv_data(server_fd, client_fd, total_bytes), + "send_recv_data")) + goto fail; if (clock_gettime(CLOCK_MONOTONIC, &end) < 0) goto fail;