public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH v5 4/7] tcp, flow: Replace per-connection in_epoll flag with an epollid in flow_common
Date: Thu, 23 Oct 2025 12:39:21 +1100	[thread overview]
Message-ID: <aPmHSWuWXvQOIsP-@zatzit> (raw)
In-Reply-To: <20251021210116.314674-5-lvivier@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2178 bytes --]

On Tue, Oct 21, 2025 at 11:01:13PM +0200, Laurent Vivier wrote:
> The in_epoll boolean flag in tcp_tap_conn and tcp_splice_conn only tracked
> whether a connection was registered with epoll, not which epoll instance.
> This limited flexibility for future multi-epoll support.
> 
> Replace the boolean with an epollid field in flow_common that identifies
> which epoll instance the flow is registered with.
> Use FLOW_EPOLLID_INVALID to indicate when a flow is not registered with
> any epoll instance. An epoll_id_to_fd[] mapping table translates
> epoll ids to their corresponding epoll file descriptors.
> 
> Add helper functions:
> - flow_in_epoll() to check if a flow is registered with epoll
> - flow_epollfd() to retrieve the epoll fd for a flow's thread
> - flow_epollid_register() to register an epoll fd with an epollid
> - flow_epollid_set() to set the epollid of a flow
> - flow_epollid_clear() to reset the epoll id of a flow
> 
> This change also simplifies tcp_timer_ctl() and conn_flag_do() by removing
> the need to pass the context 'c', since the epoll fd is now directly
> accessible from the flow structure via flow_epollfd().
> 
> Add a defensive check at the beginning of tcp_flow_repair_queue() to
> avoid a false positive with "make clang-tidy":
>   error: The 1st argument to 'send' is < 0 but should be >= 0
>    3230 |                 ssize_t rc = send(conn->sock, p, MIN(len, chunk), 0);
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

[snip]
> @@ -570,7 +573,7 @@ static void tcp_timer_ctl(const struct ctx *c, struct tcp_tap_conn *conn)
>  		}
>  		conn->timer = fd;
>  
> -		if (epoll_ctl(c->epollfd, EPOLL_CTL_ADD, conn->timer, &ev)) {
> +		if (epoll_ctl(epollfd, EPOLL_CTL_ADD, conn->timer, &ev)) {

I still think it's a bug that the timer's ref.fd field isn't the timer
fd, but I recognize that fixing that is not in scope for this series.

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2025-10-23  1:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-21 21:01 [PATCH v5 0/7] Refactor epoll handling in preparation for multithreading Laurent Vivier
2025-10-21 21:01 ` [PATCH v5 1/7] util: Simplify epoll_del() interface to take epollfd directly Laurent Vivier
2025-10-21 21:01 ` [PATCH v5 2/7] epoll_ctl: Extract epoll operations Laurent Vivier
2025-10-23  1:29   ` David Gibson
2025-10-21 21:01 ` [PATCH v5 3/7] util: Move epoll registration out of sock_l4_sa() Laurent Vivier
2025-10-21 21:01 ` [PATCH v5 4/7] tcp, flow: Replace per-connection in_epoll flag with an epollid in flow_common Laurent Vivier
2025-10-23  1:39   ` David Gibson [this message]
2025-10-30 17:00   ` Stefano Brivio
2025-10-21 21:01 ` [PATCH v5 5/7] icmp: Use epoll instance management for ICMP flows Laurent Vivier
2025-10-21 21:01 ` [PATCH v5 6/7] udp: Use epoll instance management for UDP flows Laurent Vivier
2025-10-23  1:40   ` David Gibson
2025-10-21 21:01 ` [PATCH v5 7/7] passt: Move main event loop processing into passt_worker() Laurent Vivier
2025-10-23  1:42   ` David Gibson
2025-10-30 17:00 ` [PATCH v5 0/7] Refactor epoll handling in preparation for multithreading Stefano Brivio

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=aPmHSWuWXvQOIsP-@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).