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=XQAY/8YZ; 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 ADC335A0625 for ; Fri, 19 Dec 2025 17:45:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766162723; 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=pz2UzJpelIxf1KbSbhM4ReBg8cWYAZ/qCwVbdpF7pCw=; b=XQAY/8YZmcP9TC0o6UTroVqnyOcrduXyEgrvTZQCWSKLKIu/w0mng2SpuXW5g4ZpGXUOhD bvtDP6bp2QahtK2AjIWPUjhxxqAIj7LsD7dtO4z9uGG5pJ3DUhRYx/Z4ig4TrXUVmEHdmz C+YGo4/PG6+z0a3VxChHbkVEsHXpvFw= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-136-EAUyUBVWNjipyxObZqWVCg-1; Fri, 19 Dec 2025 11:45:22 -0500 X-MC-Unique: EAUyUBVWNjipyxObZqWVCg-1 X-Mimecast-MFC-AGG-ID: EAUyUBVWNjipyxObZqWVCg_1766162721 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 30312195605B for ; Fri, 19 Dec 2025 16:45:21 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.44.32.145]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 377C1180049F; Fri, 19 Dec 2025 16:45:19 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH 0/7] flow: Introduce flow_epoll_set() to centralize epoll operations Date: Fri, 19 Dec 2025 17:45:11 +0100 Message-ID: <20251219164518.930012-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 3o0jio9Y3a7uq1mrc3o0wjSAPgYDBIGcZOizW2m9F0E_1766162721 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: GRSUNZHTGD6W2FP542D2DFLOWPWLX6FQ X-Message-ID-Hash: GRSUNZHTGD6W2FP542D2DFLOWPWLX6FQ 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 evolves=0D across the series, progressively absorbing more responsibilities:=0D =0D 1. Initial version takes explicit fd, events, and ctx parameters=0D =0D 2. Events computation is moved inside the function by relocating=0D tcp_conn_epoll_events() and tcp_splice_conn_epoll_events() into flow.c= =0D =0D 3. The ctx parameter is removed by using epoll_id_to_fd[EPOLLFD_ID_DEFAULT]= =0D directly for new flows=0D =0D 4. The fd parameter is removed by having the function extract the file=0D descriptor from the flow structure based on the epoll type=0D =0D The final API is simply:=0D =0D int flow_epoll_set(enum epoll_type type, const struct flow_common *f,= =0D 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 fixes EPOLL_TYPE_TCP_TIMER to use the actual timer fd=0D - Patch 2 refactors udp_flow_sock() to assign the socket internally=0D - Patch 3 refactors tcp_splice_conn_epoll_events() to per-side computation= =0D =0D Core series:=0D - Patch 4 introduces the initial flow_epoll_set() function=0D - Patch 5 removes the ctx parameter=0D - Patch 6 moves event computation inside flow_epoll_set()=0D - Patch 7 removes the fd parameter, completing the refactoring=0D =0D Laurent Vivier (7):=0D tcp: Update EPOLL_TYPE_TCP_TIMER fd=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 flow: Use epoll_id_to_fd[EPOLLFD_ID_DEFAULT] in flow_epollid_set()=0D flow: Compute epoll events inside flow_epoll_set()=0D flow: Have flow_epoll_set() retrieve file descriptor from flow=0D structure=0D =0D flow.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++=0D flow.h | 4 ++=0D icmp.c | 8 +--=0D tcp.c | 68 +++-------------------=0D tcp_splice.c | 77 +++++--------------------=0D udp_flow.c | 17 ++----=0D 6 files changed, 190 insertions(+), 142 deletions(-)=0D =0D --=20=0D 2.51.1=0D =0D