From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next 3/4] selftests: mptcp: enable io thread mode
Date: Thu, 1 Aug 2024 12:05:00 +0200 [thread overview]
Message-ID: <ebbfef1f-e21c-4fbf-b7e8-ff30f62e45c3@kernel.org> (raw)
In-Reply-To: <fde5c2d7de9816aab48637225fc2c9a9df94bd20.1722502941.git.tanggeliang@kylinos.cn>
Hi Geliang,
On 01/08/2024 11:21, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> 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().
Please add the reason why this is needed.
Also, it is not clear that this will cause the same app to send and
receives data. Is it really required to reproduce the bug? Can we not do
the usual client-server thing? e.g.
./mptcp_connect.sh -m thread
Or at least an explicit option.
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
> .../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) {
(detail: can it not go to the previous line?)
> + peerfd = accept(listensock, NULL, NULL);
> + while (peerfd == -1) {
> + if (errno == EINTR)
> + continue;
Mmh, do you not need to call 'accept()' again?
> + 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);
> }
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2024-08-01 10:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-01 9:21 [PATCH mptcp-next 0/4] add io thread mode tests Geliang Tang
2024-08-01 9:21 ` [PATCH mptcp-next 1/4] selftests: mptcp: add cfg_timeo for mptcp_connect Geliang Tang
2024-08-01 10:03 ` Matthieu Baerts
2024-08-01 9:21 ` [PATCH mptcp-next 2/4] selftests: mptcp: add io thread mode " Geliang Tang
2024-08-01 10:04 ` Matthieu Baerts
2024-08-01 9:21 ` [PATCH mptcp-next 3/4] selftests: mptcp: enable io thread mode Geliang Tang
2024-08-01 10:05 ` Matthieu Baerts [this message]
2024-08-01 9:21 ` [PATCH mptcp-next 4/4] selftests: mptcp: join: add io thread tests Geliang Tang
2024-08-01 10:05 ` Matthieu Baerts
2024-08-01 10:03 ` [PATCH mptcp-next 0/4] add io thread mode tests Matthieu Baerts
2024-08-01 10:24 ` MPTCP CI
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=ebbfef1f-e21c-4fbf-b7e8-ff30f62e45c3@kernel.org \
--to=matttbe@kernel.org \
--cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.