public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH 0/7] flow: Introduce flow_epoll_set() to centralize epoll operations
@ 2025-12-19 16:45 Laurent Vivier
  2025-12-19 16:45 ` [PATCH 1/7] tcp: Update EPOLL_TYPE_TCP_TIMER fd Laurent Vivier
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Laurent Vivier @ 2025-12-19 16:45 UTC (permalink / raw)
  To: passt-dev; +Cc: Laurent Vivier

Currently, each protocol handler (TCP, TCP splice, ICMP/ping, UDP) has its
own code to add or modify file descriptors in epoll.  This leads to
duplicated boilerplate across icmp.c, tcp.c, tcp_splice.c, and udp_flow.c,
with each setting up epoll_ref unions and calling epoll_ctl() with
flow-type-specific details.

This series introduces flow_epoll_set() in flow.c to handle epoll
operations for all flow types in a unified way.  The function evolves
across the series, progressively absorbing more responsibilities:

1. Initial version takes explicit fd, events, and ctx parameters

2. Events computation is moved inside the function by relocating
   tcp_conn_epoll_events() and tcp_splice_conn_epoll_events() into flow.c

3. The ctx parameter is removed by using epoll_id_to_fd[EPOLLFD_ID_DEFAULT]
   directly for new flows

4. The fd parameter is removed by having the function extract the file
   descriptor from the flow structure based on the epoll type

The final API is simply:

    int flow_epoll_set(enum epoll_type type, const struct flow_common *f,
                       unsigned int sidei);

This centralized approach will be essential for queue pair migration in
the upcoming multithreading work, where flows need to be moved between
different epoll instances owned by different threads.

Preparatory patches:
- Patch 1 fixes EPOLL_TYPE_TCP_TIMER to use the actual timer fd
- Patch 2 refactors udp_flow_sock() to assign the socket internally
- Patch 3 refactors tcp_splice_conn_epoll_events() to per-side computation

Core series:
- Patch 4 introduces the initial flow_epoll_set() function
- Patch 5 removes the ctx parameter
- Patch 6 moves event computation inside flow_epoll_set()
- Patch 7 removes the fd parameter, completing the refactoring

Laurent Vivier (7):
  tcp: Update EPOLL_TYPE_TCP_TIMER fd
  udp_flow: Assign socket to flow inside udp_flow_sock()
  tcp_splice: Refactor tcp_splice_conn_epoll_events() to per-side
    computation
  flow: Introduce flow_epoll_set() to centralize epoll operations
  flow: Use epoll_id_to_fd[EPOLLFD_ID_DEFAULT] in flow_epollid_set()
  flow: Compute epoll events inside flow_epoll_set()
  flow: Have flow_epoll_set() retrieve file descriptor from flow
    structure

 flow.c       | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++
 flow.h       |   4 ++
 icmp.c       |   8 +--
 tcp.c        |  68 +++-------------------
 tcp_splice.c |  77 +++++--------------------
 udp_flow.c   |  17 ++----
 6 files changed, 190 insertions(+), 142 deletions(-)

-- 
2.51.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-12-19 16:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-19 16:45 [PATCH 0/7] flow: Introduce flow_epoll_set() to centralize epoll operations Laurent Vivier
2025-12-19 16:45 ` [PATCH 1/7] tcp: Update EPOLL_TYPE_TCP_TIMER fd Laurent Vivier
2025-12-19 16:45 ` [PATCH 2/7] udp_flow: Assign socket to flow inside udp_flow_sock() Laurent Vivier
2025-12-19 16:45 ` [PATCH 3/7] tcp_splice: Refactor tcp_splice_conn_epoll_events() to per-side computation Laurent Vivier
2025-12-19 16:45 ` [PATCH 4/7] flow: Introduce flow_epoll_set() to centralize epoll operations Laurent Vivier
2025-12-19 16:45 ` [PATCH 5/7] flow: Use epoll_id_to_fd[EPOLLFD_ID_DEFAULT] in flow_epollid_set() Laurent Vivier
2025-12-19 16:45 ` [PATCH 6/7] flow: Compute epoll events inside flow_epoll_set() Laurent Vivier
2025-12-19 16:45 ` [PATCH 7/7] flow: Have flow_epoll_set() retrieve file descriptor from flow structure Laurent Vivier

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).