mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arseniy Krasnov <avkrasnov@salutedevices.com>
To: Stefano Garzarella <sgarzare@redhat.com>, <netdev@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
	<virtualization@lists.linux-foundation.org>, <oxffffaa@gmail.com>,
	Bobby Eshleman <bobby.eshleman@bytedance.com>
Subject: Re: [PATCH net-next 5/5] vsock/test: track bytes in MSG_PEEK test for SOCK_SEQPACKET
Date: Fri, 15 Sep 2023 22:29:06 +0300	[thread overview]
Message-ID: <97ea5def-d82f-9f8b-fb45-8b37c3d96cb9@salutedevices.com> (raw)
In-Reply-To: <20230915121452.87192-6-sgarzare@redhat.com>

Small remark on 'Subject' - this is not MSG_PEEK test, it is test for sk_buff merging.

Considering that:

Reviewed-by: Arseniy Krasnov <avkrasnov@salutedevices.com>

Thanks, Arseniy

On 15.09.2023 15:14, Stefano Garzarella wrote:
> The test was a bit complicated to read.
> Added variables to keep track of the bytes read and to be read
> in each step. Also some comments.
> 
> The test is unchanged.
> 
> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
> ---
>  tools/testing/vsock/vsock_test.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/vsock/vsock_test.c b/tools/testing/vsock/vsock_test.c
> index b18acbaf92e2..5743dcae2350 100644
> --- a/tools/testing/vsock/vsock_test.c
> +++ b/tools/testing/vsock/vsock_test.c
> @@ -1002,6 +1002,7 @@ static void test_stream_virtio_skb_merge_client(const struct test_opts *opts)
>  
>  static void test_stream_virtio_skb_merge_server(const struct test_opts *opts)
>  {
> +	size_t read = 0, to_read;
>  	unsigned char buf[64];
>  	int fd;
>  
> @@ -1014,14 +1015,21 @@ static void test_stream_virtio_skb_merge_server(const struct test_opts *opts)
>  	control_expectln("SEND0");
>  
>  	/* Read skbuff partially. */
> -	recv_buf(fd, buf, 2, 0, 2);
> +	to_read = 2;
> +	recv_buf(fd, buf + read, to_read, 0, to_read);
> +	read += to_read;
>  
>  	control_writeln("REPLY0");
>  	control_expectln("SEND1");
>  
> -	recv_buf(fd, buf + 2, 8, 0, 8);
> +	/* Read the rest of both buffers */
> +	to_read = strlen(HELLO_STR WORLD_STR) - read;
> +	recv_buf(fd, buf + read, to_read, 0, to_read);
> +	read += to_read;
>  
> -	recv_buf(fd, buf, sizeof(buf) - 8 - 2, MSG_DONTWAIT, -EAGAIN);
> +	/* No more bytes should be there */
> +	to_read = sizeof(buf) - read;
> +	recv_buf(fd, buf + read, to_read, MSG_DONTWAIT, -EAGAIN);
>  
>  	if (memcmp(buf, HELLO_STR WORLD_STR, strlen(HELLO_STR WORLD_STR))) {
>  		fprintf(stderr, "pattern mismatch\n");

  reply	other threads:[~2023-09-15 19:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 12:14 [PATCH net-next 0/5] vsock/test: add recv_buf()/send_buf() utility functions and some improvements Stefano Garzarella
2023-09-15 12:14 ` [PATCH net-next 1/5] vsock/test: add recv_buf() utility function Stefano Garzarella
2023-09-15 19:23   ` Arseniy Krasnov
2023-09-15 12:14 ` [PATCH net-next 2/5] vsock/test: use recv_buf() in vsock_test.c Stefano Garzarella
2023-09-15 19:24   ` Arseniy Krasnov
2023-09-15 12:14 ` [PATCH net-next 3/5] vsock/test: add send_buf() utility function Stefano Garzarella
2023-09-15 19:25   ` Arseniy Krasnov
2023-09-15 12:14 ` [PATCH net-next 4/5] vsock/test: use send_buf() in vsock_test.c Stefano Garzarella
2023-09-15 19:26   ` Arseniy Krasnov
2023-09-15 12:14 ` [PATCH net-next 5/5] vsock/test: track bytes in MSG_PEEK test for SOCK_SEQPACKET Stefano Garzarella
2023-09-15 19:29   ` Arseniy Krasnov [this message]
2023-09-15 19:30 ` [PATCH net-next 0/5] vsock/test: add recv_buf()/send_buf() utility functions and some improvements Arseniy Krasnov
2023-09-17 16:50 ` patchwork-bot+netdevbpf

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=97ea5def-d82f-9f8b-fb45-8b37c3d96cb9@salutedevices.com \
    --to=avkrasnov@salutedevices.com \
    --cc=bobby.eshleman@bytedance.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oxffffaa@gmail.com \
    --cc=sgarzare@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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

all inboxes | Powered by JetHome®