From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cFopF7cs; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id B2AA35A004E for ; Fri, 09 Jan 2026 17:54:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1767977683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=N2y2YJGAKitqP3igAYharOblqFvOa1ACcb7mEX82DWY=; b=cFopF7csLiMYvUFcDhzr2u7HnT5MictjvVTx5cK5x/ZmrNuQ1qlk0XQtwJgUJpFMYGXTMU dmovuj2ZyXWIasYjFcNdMqxz2gfEewoFUXEajZJPZAcfamt04XRHFUhffdmTr4sLQ59kb/ J7YUKsMmrzG6MO3Q2W6pBTIIjjDLhOM= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-384-3z9CSK0gO3i2PupfL9_gQA-1; Fri, 09 Jan 2026 11:54:42 -0500 X-MC-Unique: 3z9CSK0gO3i2PupfL9_gQA-1 X-Mimecast-MFC-AGG-ID: 3z9CSK0gO3i2PupfL9_gQA_1767977681 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5E610180034F for ; Fri, 9 Jan 2026 16:54:41 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.44.32.149]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 65D0D19560BA; Fri, 9 Jan 2026 16:54:40 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v3 0/6] flow: Introduce flow_epoll_set() to centralize epoll operations Date: Fri, 9 Jan 2026 17:54:32 +0100 Message-ID: <20260109165438.2492285-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: NNBdCUL_70Z8dJ66dc7nUjH9B1X4hYyD1Iyx2Qx0KQY_1767977681 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: GKO32KORXLJBZLVJMS4EMYH3KP3JY5TK X-Message-ID-Hash: GKO32KORXLJBZLVJMS4EMYH3KP3JY5TK X-MailFrom: lvivier@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Laurent Vivier X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Currently, each protocol handler (TCP, TCP splice, ICMP/ping, UDP) has its= =0D own code to add or modify file descriptors in epoll. This leads to=0D duplicated boilerplate across icmp.c, tcp.c, tcp_splice.c, and udp_flow.c,= =0D with each setting up epoll_ref unions and calling epoll_ctl() with=0D flow-type-specific details.=0D =0D This series introduces flow_epoll_set() in flow.c to handle epoll=0D operations for all flow types in a unified way. The function derives=0D the epoll type from the flow type via a mapping array, providing a=0D simpler interface where the caller only needs to pass the flow, command,=0D events, file descriptor, and side index.=0D =0D The API is:=0D =0D int flow_epoll_set(const struct flow_common *f, int command,=0D uint32_t events, int fd, unsigned int sidei);=0D =0D This centralized approach will be essential for queue pair migration in=0D the upcoming multithreading work, where flows need to be moved between=0D different epoll instances owned by different threads.=0D =0D Preparatory patches:=0D - Patch 1 removes dead timer update code in tcp_epoll_ctl()=0D - Patch 2 refactors TCP timer creation to use epoll_add() helper=0D - Patch 3 removes unneeded epoll_ref indirection in udp_flow=0D - Patch 4 refactors udp_flow_sock() to assign the socket internally=0D - Patch 5 refactors tcp_splice_conn_epoll_events() to per-side computation= =0D =0D Core patch:=0D - Patch 6 introduces flow_epoll_set() used by all protocol handlers=0D =0D Changes in v3:=0D - Added patch 2: "tcp: cleanup timer creation" refactoring tcp_timer_ctl()= =0D to use epoll_add() helper with improved error handling=0D - Removed epoll type parameter from flow_epoll_set(): the type is now=0D derived from the flow type via a new flow_epoll[] mapping array=0D - Simplified function signature to flow_epoll_set(f, command, events, fd, s= idei)=0D - TCP timer no longer uses flow_epoll_set(), uses epoll_add() directly=0D - Added Reviewed-by from David Gibson to patches 1 and 3=0D - Series now 6 patches (was 5)=0D =0D Changes in v2:=0D - Added patch 1: Remove dead timer update in tcp_epoll_ctl() since flow=0D table compaction was eliminated=0D - Added patch 2: Remove unnecessary epoll_ref indirection in udp_flow.c=0D - Dropped v1 patch 6 (compute events inside flow_epoll_set())=0D - Dropped v1 patch 7 (retrieve fd from flow structure)=0D - Added epoll_ctl() command parameter (EPOLL_CTL_ADD/EPOLL_CTL_MOD)=0D - Callers must set epollfd via flow_epollid_set() before calling=0D flow_epoll_set()=0D - Removed FLOW_EPOLL_TIMER_ADD/FLOW_EPOLL_TIMER_MOD constants=0D - Reduced series from 7 to 5 patches=0D =0D Laurent Vivier (6):=0D tcp: remove timer update in tcp_epoll_ctl()=0D tcp: cleanup timer creation=0D udp_flow: remove unneeded epoll_ref indirection=0D udp_flow: Assign socket to flow inside udp_flow_sock()=0D tcp_splice: Refactor tcp_splice_conn_epoll_events() to per-side=0D computation=0D flow: Introduce flow_epoll_set() to centralize epoll operations=0D =0D flow.c | 37 +++++++++++++++++=0D flow.h | 2 +=0D icmp.c | 10 ++---=0D tcp.c | 88 ++++++++++++++++++++--------------------=0D tcp_splice.c | 111 +++++++++++++++++++++++----------------------------=0D udp_flow.c | 18 +++------=0D 6 files changed, 140 insertions(+), 126 deletions(-)=0D =0D --=20=0D 2.52.0=0D =0D