From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202512 header.b=K54BZIrz; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id BA20F5A0624 for ; Mon, 19 Jan 2026 05:51:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202512; t=1768798267; bh=MtrVpP9g6svrbt1aQo1dM/j+zM1RwBBNnCfikYpv9/s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=K54BZIrzKTFvGY80rzcsBPsoHVEbYHRu1NuJEqyVv8bdenhCH5lQazKbsumZwUXJ4 p7a5kcyKZv9KnGXHjHKjR1UejEiF8tB+IJ9Ha3Rt5jflDJ8W19B2wrIKHn3JIa8PpJ Z8fQP/Knyoy1j9VmWoURMV3PFCyZnVHoMm6WXxr5Jd2UKTAfEDGDVYhQXtI48Cun0c Xp7A7pwUDJe3NLAn0mZl0mM0IJEhiyJXWlVrObGtfXC4+vL/emxryY7EMtBzvgBtoS B7PkzOsAgZ1ea12HC6+trADVpi6EGKJ8gifwsVuM2nXpDTd4Qezgzht4vS2yZYC9Ta 41dZ5bc7BjzbA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4dvdMH0jhXz4wCp; Mon, 19 Jan 2026 15:51:07 +1100 (AEDT) Date: Mon, 19 Jan 2026 15:45:32 +1100 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH 1/3] tcp_splice: Register fds with epoll at flow creation Message-ID: References: <20260116155223.2717168-1-lvivier@redhat.com> <20260116155223.2717168-2-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="zAYJ8bE625ssAIvn" Content-Disposition: inline In-Reply-To: <20260116155223.2717168-2-lvivier@redhat.com> Message-ID-Hash: UV4IT6RB26E4ZZCLA4IOKSUYA4GSAYWT X-Message-ID-Hash: UV4IT6RB26E4ZZCLA4IOKSUYA4GSAYWT X-MailFrom: dgibson@gandalf.ozlabs.org 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: passt-dev@passt.top 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: --zAYJ8bE625ssAIvn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 16, 2026 at 04:52:21PM +0100, Laurent Vivier wrote: > Register both splice connection sockets with epoll using empty events > (events=3D0) in tcp_splice_connect(), before initiating the connection. >=20 > This allows tcp_splice_epoll_ctl() to always use EPOLL_CTL_MOD, removing > the need to check whether fds are already registered. As a result, the > conditional ADD/MOD logic is no longer needed, simplifying the function. >=20 > Signed-off-by: Laurent Vivier Nice! One query below. > --- > tcp_splice.c | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) >=20 > diff --git a/tcp_splice.c b/tcp_splice.c > index a7c04ca8652a..cb81e012ee4b 100644 > --- a/tcp_splice.c > +++ b/tcp_splice.c > @@ -142,20 +142,12 @@ static uint32_t tcp_splice_conn_epoll_events(uint16= _t events, unsigned sidei) > static int tcp_splice_epoll_ctl(struct tcp_splice_conn *conn) > { > uint32_t events[2]; > - int m; > - > - if (flow_in_epoll(&conn->f)) { > - m =3D EPOLL_CTL_MOD; > - } else { > - flow_epollid_set(&conn->f, EPOLLFD_ID_DEFAULT); > - m =3D EPOLL_CTL_ADD; > - } > =20 > events[0] =3D tcp_splice_conn_epoll_events(conn->events, 0); > events[1] =3D tcp_splice_conn_epoll_events(conn->events, 1); > =20 > - if (flow_epoll_set(&conn->f, m, events[0], conn->s[0], 0) || > - flow_epoll_set(&conn->f, m, events[1], conn->s[1], 1)) { > + if (flow_epoll_set(&conn->f, EPOLL_CTL_MOD, events[0], conn->s[0], 0) || > + flow_epoll_set(&conn->f, EPOLL_CTL_MOD, events[1], conn->s[1], 1)) { > int ret =3D -errno; > flow_perror(conn, "ERROR on epoll_ctl()"); > return ret; > @@ -368,6 +360,14 @@ static int tcp_splice_connect(const struct ctx *c, s= truct tcp_splice_conn *conn) > =20 > pif_sockaddr(c, &sa, tgtpif, &tgt->eaddr, tgt->eport); > =20 > + flow_epollid_set(&conn->f, EPOLLFD_ID_DEFAULT); > + if (flow_epoll_set(&conn->f, EPOLL_CTL_ADD, 0, conn->s[0], 0) || > + flow_epoll_set(&conn->f, EPOLL_CTL_ADD, 0, conn->s[1], 1)) { > + int ret =3D -errno; > + flow_perror(conn, "Cannot register to epollfd"); > + return ret; Do we need to worry about rollback here, if the first one succeeds, but the second one fails? > + } > + > conn_event(conn, SPLICE_CONNECT); > =20 > if (connect(conn->s[1], &sa.sa, socklen_inany(&sa))) { > --=20 > 2.52.0 >=20 --=20 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 --zAYJ8bE625ssAIvn Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmlttusACgkQzQJF27ox 2Gdt+RAAktpw5/lnMQU1yPKRZSthjnlHX29sW+mCurQ308haKvX/rK2sK26p9MLj q5jXVcNXz12zOSlfFB/6vJ3I9YBr4A8iuWfNHuxt8qQLo+L0OpWUJxCnUbVWHywM 7ZvH3dPyOi4KcFsDhaHAdSTvZ51Pj8jXzrnIPFuNBImkEQdZYjrDyINITZ1F4Zfu YvLeM1O+zE3EqS++Ju0V/zp2gddc9cOUEKK3EqvejPmYSYNgKuBBHRehYM4mT8Pu l8pc3z5aRH3IQt58t//IqkIydbB5l5uNAUcfvHZBdvZOOwtjlqZfas3Ha7LQ3Y8U EJy4K8okAU+aJ7YeLBM6kVsUa+pjI+KuXIQNhGtcfRqXDRIt1Ht76ePrn7jmT+16 5FiF/jCvZNpAPy9e078i1Ry43ENrFM1IgrSj/+yugMk2bBT8mVY4J2F0S4+uwv/Z 6B1YNSn74eubYVV+AsEUvStxvRcjeqJA8/1mAI8ejDBYnLI9jj/ReSGdYNVYoBK6 hSUcFpdabsglOSFjlzOCPo0MqZW21VBC22GnlAsbeL2SX7NHgrC+bhYJdEeetv57 8JpmPh+eWD7E+9Z1TSPx6E8hqaRbV0JN5t3YIMW/u6btMABjvexAsHjr4U2+NqiM kdMbcocejE4bfXS486G3SBxxa4CkHorDC7hsrACYLy+DDtm+Jro= =pmSB -----END PGP SIGNATURE----- --zAYJ8bE625ssAIvn--