All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Jordan Rife <jordan@jrife.io>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
	Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Kuniyuki Iwashima <kuniyu@google.com>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Stanislav Fomichev <stfomichev@gmail.com>,
	netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH v6 bpf-next 10/12] selftests/bpf: Create established sockets in socket iterator tests
Date: Mon, 14 Jul 2025 15:29:08 -0700	[thread overview]
Message-ID: <d109f0de-c857-46f6-9560-a7bd93b59bef@linux.dev> (raw)
In-Reply-To: <20250714180919.127192-11-jordan@jrife.io>

On 7/14/25 11:09 AM, Jordan Rife wrote:
> +static int *connect_to_server(int family, int sock_type, const char *addr,
> +			      __u16 port, int nr_connects, int *server_fds,
> +			      int server_fds_len)
> +{
> +	struct pollfd *server_poll_fds = NULL;
> +	struct network_helper_opts opts = {

A nit. I removed "opts" and just passed NULL to connect_to_addr_str.

I also carried Stan's ack from v4. Applied. Thanks.

> +		.timeout_ms = 0,
> +	};
> +	int *established_socks = NULL;
> +	int i;
> +
> +	server_poll_fds = calloc(server_fds_len, sizeof(*server_poll_fds));
> +	if (!ASSERT_OK_PTR(server_poll_fds, "server_poll_fds"))
> +		return NULL;
> +
> +	for (i = 0; i < server_fds_len; i++) {
> +		server_poll_fds[i].fd = server_fds[i];
> +		server_poll_fds[i].events = POLLIN;
> +	}
> +
> +	i = 0;
> +
> +	established_socks = malloc(sizeof(*established_socks) * nr_connects*2);
> +	if (!ASSERT_OK_PTR(established_socks, "established_socks"))
> +		goto error;
> +
> +	while (nr_connects--) {
> +		established_socks[i] = connect_to_addr_str(family, sock_type,
> +							   addr, port, &opts);
> +		if (!ASSERT_OK_FD(established_socks[i], "connect_to_addr_str"))
> +			goto error;
> +		i++;
> +		established_socks[i] = accept_from_one(server_poll_fds,
> +						       server_fds_len);
> +		if (!ASSERT_OK_FD(established_socks[i], "accept_from_one"))
> +			goto error;
> +		i++;
> +	}
> +
> +	free(server_poll_fds);
> +	return established_socks;
> +error:
> +	free_fds(established_socks, i);
> +	free(server_poll_fds);
> +	return NULL;
> +}


  reply	other threads:[~2025-07-14 22:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-14 18:09 [PATCH v6 bpf-next 00/12] bpf: tcp: Exactly-once socket iteration Jordan Rife
2025-07-14 18:09 ` [PATCH v6 bpf-next 01/12] bpf: tcp: Make mem flags configurable through bpf_iter_tcp_realloc_batch Jordan Rife
2025-07-14 18:09 ` [PATCH v6 bpf-next 02/12] bpf: tcp: Make sure iter->batch always contains a full bucket snapshot Jordan Rife
2025-07-14 18:09 ` [PATCH v6 bpf-next 03/12] bpf: tcp: Get rid of st_bucket_done Jordan Rife
2025-07-14 18:09 ` [PATCH v6 bpf-next 04/12] bpf: tcp: Use bpf_tcp_iter_batch_item for bpf_tcp_iter_state batch items Jordan Rife
2025-07-14 18:09 ` [PATCH v6 bpf-next 05/12] bpf: tcp: Avoid socket skips and repeats during iteration Jordan Rife
2025-07-14 18:09 ` [PATCH v6 bpf-next 06/12] selftests/bpf: Add tests for bucket resume logic in listening sockets Jordan Rife
2025-07-14 18:09 ` [PATCH v6 bpf-next 07/12] selftests/bpf: Allow for iteration over multiple ports Jordan Rife
2025-07-14 18:09 ` [PATCH v6 bpf-next 08/12] selftests/bpf: Allow for iteration over multiple states Jordan Rife
2025-07-14 18:09 ` [PATCH v6 bpf-next 09/12] selftests/bpf: Make ehash buckets configurable in socket iterator tests Jordan Rife
2025-07-14 18:09 ` [PATCH v6 bpf-next 10/12] selftests/bpf: Create established sockets " Jordan Rife
2025-07-14 22:29   ` Martin KaFai Lau [this message]
2025-07-14 18:09 ` [PATCH v6 bpf-next 11/12] selftests/bpf: Create iter_tcp_destroy test program Jordan Rife
2025-07-14 18:09 ` [PATCH v6 bpf-next 12/12] selftests/bpf: Add tests for bucket resume logic in established sockets Jordan Rife
2025-07-14 22:30 ` [PATCH v6 bpf-next 00/12] bpf: tcp: Exactly-once socket iteration 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=d109f0de-c857-46f6-9560-a7bd93b59bef@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jordan@jrife.io \
    --cc=kuniyu@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=stfomichev@gmail.com \
    --cc=willemdebruijn.kernel@gmail.com \
    /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.