From: Matthieu Baerts <matttbe@kernel.org>
To: Gang Yan <yangang@kylinos.cn>, mptcp@lists.linux.dev
Cc: Geliang Tang <geliang@kernel.org>
Subject: Re: [mptcp-next v2 3/7] selftests: mptcp: refine the 'iovlen' handling logic
Date: Tue, 22 Apr 2025 15:22:55 +0200 [thread overview]
Message-ID: <32bf44a4-baf0-4e43-a9e7-77f3506d509a@kernel.org> (raw)
In-Reply-To: <dee8dc73f766bc52c79d32a2dd22e9bc6ae436f0.1744793332.git.yangang@kylinos.cn>
Hi Gang,
On 16/04/2025 10:59, Gang Yan wrote:
> In the original version, the handling logic for the 'iovlen' appeared
> somewhat redundant. Therefore, 'iovlen++' is used to simpify this
> portion of the code and improve its readaility.
>
> Co-developed-by: Geliang Tang <geliang@kernel.org>
> Signed-off-by: Geliang Tang <geliang@kernel.org>
> Signed-off-by: Gang Yan <yangang@kylinos.cn>
> ---
> tools/testing/selftests/net/mptcp/mptcp_diag.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_diag.c b/tools/testing/selftests/net/mptcp/mptcp_diag.c
> index 8a5b7745c58c..2bf13bce59a5 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_diag.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_diag.c
> @@ -91,10 +91,9 @@ static void send_query(int fd, struct inet_diag_req_v2 *r)
> .iov_base = &req,
> .iov_len = sizeof(req)
> };
I guess you could also declare iovlen to 0, then start the increment above:
iov[iovlen++] = (struct iovec) { (...) };
> - iov[iovlen] = (struct iovec){ &rta_proto, sizeof(rta_proto)};
> - iov[iovlen + 1] = (struct iovec){ &proto, sizeof(proto)};
> + iov[iovlen++] = (struct iovec){ &rta_proto, sizeof(rta_proto)};
> + iov[iovlen++] = (struct iovec){ &proto, sizeof(proto)};
> req.nlh.nlmsg_len += RTA_LENGTH(sizeof(proto));
> - iovlen += 2;
For such very small and not complex change like that, I think there is
no need to create a dedicate patch. This can be squashed in the next
patch with a note like:
While at it, increment iovlen directly when an item is added.
> struct msghdr msg = {
> .msg_name = &nladdr,
> .msg_namelen = sizeof(nladdr),
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2025-04-22 13:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 8:59 [mptcp-next v2 0/7] Add 'dump_subflow' test in selftests Gang Yan
2025-04-16 8:59 ` [mptcp-next v2 1/7] selftests: mptcp: add struct params in mptcp_diag Gang Yan
2025-04-16 8:59 ` [mptcp-next v2 2/7] selftests: mptcp: refactor send_query parameters for code clarity Gang Yan
2025-04-22 13:22 ` Matthieu Baerts
2025-04-16 8:59 ` [mptcp-next v2 3/7] selftests: mptcp: refine the 'iovlen' handling logic Gang Yan
2025-04-22 13:22 ` Matthieu Baerts [this message]
2025-04-16 8:59 ` [mptcp-next v2 4/7] selftests: mptcp: refactor NLMSG handling with 'proto' Gang Yan
2025-04-16 8:59 ` [mptcp-next v2 5/7] selftests: mptcp: add a helper to get subflow_info Gang Yan
2025-04-22 13:23 ` Matthieu Baerts
2025-04-16 8:59 ` [mptcp-next v2 6/7] selftests: mptcp: add a helper to print subflow_info Gang Yan
2025-04-22 13:23 ` Matthieu Baerts
2025-04-16 8:59 ` [mptcp-next v2 7/7] selftests: mptcp: add chk_sublfow in diag.sh Gang Yan
2025-04-22 13:24 ` Matthieu Baerts
2025-04-16 10:20 ` [mptcp-next v2 0/7] Add 'dump_subflow' test in selftests MPTCP CI
2025-04-22 13:22 ` Matthieu Baerts
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=32bf44a4-baf0-4e43-a9e7-77f3506d509a@kernel.org \
--to=matttbe@kernel.org \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=yangang@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.