All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juanlu Herrero <juanlu@fastmail.com>
To: David Wei <dw@davidwei.uk>
Cc: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
	 Pavel Begunkov <asml.silence@gmail.com>
Subject: Re: [PATCH net-next v4 4/6] selftests: net: add multithread client support to iou-zcrx
Date: Tue, 4 Aug 2026 11:28:58 -0500	[thread overview]
Message-ID: <anITF0eIGOVCgc-a@jlhe0197-mac> (raw)
In-Reply-To: <beb62270-ddb2-40d1-b03d-fd612073c4e7@davidwei.uk>

On Tue, Aug 04, 2026 at 08:47:33AM -0600, David Wei wrote:
> On 2026-07-29 15:18, Juanlu Herrero wrote:
> > Add pthreads to the iou-zcrx client so that multiple connections can be
> > established simultaneously. Each client thread connects to the server
> > and sends its payload independently.
> > 
> > Introduce the -t option to control the number of threads (default 1),
> > preserving backwards compatibility with existing tests.
> > 
> > Assisted-by: Claude:claude-opus-4-8
> > Signed-off-by: Juanlu Herrero <juanlu@fastmail.com>
> > ---
> >   .../testing/selftests/drivers/net/hw/Makefile |  2 +-
> >   .../selftests/drivers/net/hw/iou-zcrx.c       | 38 +++++++++++++++++--
> >   2 files changed, 36 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/drivers/net/hw/Makefile b/tools/testing/selftests/drivers/net/hw/Makefile
> > index 234db5c2c90cc..3cab3b4adbb2e 100644
> > --- a/tools/testing/selftests/drivers/net/hw/Makefile
> > +++ b/tools/testing/selftests/drivers/net/hw/Makefile
> > @@ -88,5 +88,5 @@ include ../../../net/ynl.mk
> >   include ../../../net/bpf.mk
> >   ifeq ($(HAS_IOURING_ZCRX),y)
> > -$(OUTPUT)/iou-zcrx: LDLIBS += -luring
> > +$(OUTPUT)/iou-zcrx: LDLIBS += -luring -lpthread
> >   endif
> > diff --git a/tools/testing/selftests/drivers/net/hw/iou-zcrx.c b/tools/testing/selftests/drivers/net/hw/iou-zcrx.c
> > index 9b62fd0703e61..7bc61f3b70ca6 100644
> > --- a/tools/testing/selftests/drivers/net/hw/iou-zcrx.c
> > +++ b/tools/testing/selftests/drivers/net/hw/iou-zcrx.c
> > @@ -4,6 +4,7 @@
> >   #include <error.h>
> >   #include <fcntl.h>
> >   #include <limits.h>
> > +#include <pthread.h>
> >   #include <stdbool.h>
> >   #include <stdint.h>
> >   #include <stdio.h>
> > @@ -85,9 +86,12 @@ static int cfg_send_size = SEND_SIZE;
> >   static struct sockaddr_in6 cfg_addr;
> >   static unsigned int cfg_rx_buf_len;
> >   static bool cfg_dry_run;
> > +static int cfg_num_threads = 1;
> >   static char *payload;
> > +#define CONNS_PER_THREAD	4
> > +
> >   struct thread_ctx {
> >   	struct io_uring		ring;
> >   	void			*area_ptr;
> > @@ -379,7 +383,7 @@ static void run_server(void)
> >   		error(1, 0, "test failed\n");
> >   }
> > -static void run_client(void)
> > +static void *client_worker(void *arg)
> >   {
> >   	ssize_t to_send = cfg_send_size;
> >   	ssize_t sent = 0;
> > @@ -405,12 +409,37 @@ static void run_client(void)
> >   	}
> >   	close(fd);
> > +	return NULL;
> > +}
> > +
> > +static void run_client(void)
> > +{
> > +	int conns_per_thread = cfg_num_threads > 1 ? CONNS_PER_THREAD : 1;
> 
> Make cfg_num_threads the default value you want, then you can remove
> CONNS_PER_THREAD and this ternary.

seems cleaner, I will fix that in v5 and thanks for the review.

Best,
Juanlu

  reply	other threads:[~2026-08-04 16:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 22:18 [PATCH net-next v4 0/6] selftests: net: multithreaded multiqueue iou-zcrx Juanlu Herrero
2026-07-29 22:18 ` [PATCH net-next v4 1/6] selftests: net: fix get_refill_ring_size() to use its local variable Juanlu Herrero
2026-07-29 22:18 ` [PATCH net-next v4 2/6] selftests: net: remove unused variable in process_recvzc() Juanlu Herrero
2026-07-29 22:18 ` [PATCH net-next v4 3/6] selftests: net: refactor server state into struct thread_ctx Juanlu Herrero
2026-07-29 22:18 ` [PATCH net-next v4 4/6] selftests: net: add multithread client support to iou-zcrx Juanlu Herrero
2026-08-04 15:47   ` David Wei
2026-08-04 16:28     ` Juanlu Herrero [this message]
2026-07-29 22:18 ` [PATCH net-next v4 5/6] selftests: net: add multithread server " Juanlu Herrero
2026-08-04 10:42   ` Paolo Abeni
2026-08-04 16:27     ` Juanlu Herrero
2026-08-04 16:45   ` David Wei
2026-08-04 19:54     ` Juanlu Herrero
2026-07-29 22:18 ` [PATCH net-next v4 6/6] selftests: net: add rss_multiqueue test variant " Juanlu Herrero

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=anITF0eIGOVCgc-a@jlhe0197-mac \
    --to=juanlu@fastmail.com \
    --cc=asml.silence@gmail.com \
    --cc=dw@davidwei.uk \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.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 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.