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=WP4psCCb; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id C42425A0271 for ; Tue, 20 Jan 2026 01:09:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202512; t=1768867773; bh=QlvbJe84VHNOHHSVZxLXWwLcoT1wjtf2ePQkvEgWUSk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WP4psCCbnIFuh14hcdiQpB1hQvaHn0hUU5IvCc62fPyIsEHto0pBQzmUR027qeCYn 7lf3BWcB73Cyc4IgGqrOOq1Vhcc+FosaKuCI25MhPK9/241+BHsKBM6OrxqoMqDNCR cWgvDR3xJn9rhUH1OmC0oeLzR9gKshv2Ea90v2EVl6M6eFwZ/MzO5cxqPP9XqSliHf kym3YnLfmvh/nnHybrUEArSVOjDrXtRh5lEYndDQpT8EXsJDlvzvfWSwM0qzfps6Lv jTPT49eKI3GcUVbulvQmMS6iriAT+rBkyqDEL7brOjcNTtzrPmO+lqPWCRb0cH76BN +2f6Z8Acp3P9w== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4dw73x4MSVz4wCG; Tue, 20 Jan 2026 11:09:33 +1100 (AEDT) Date: Tue, 20 Jan 2026 11:09:28 +1100 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH v2 3/3] flow: Remove EPOLLFD_ID_INVALID Message-ID: References: <20260119161915.4014677-1-lvivier@redhat.com> <20260119161915.4014677-4-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pGG1p5kiIdHznV2S" Content-Disposition: inline In-Reply-To: <20260119161915.4014677-4-lvivier@redhat.com> Message-ID-Hash: FJ6FNLQ6LKO5UEZENKYZGMTDSVVR7FKG X-Message-ID-Hash: FJ6FNLQ6LKO5UEZENKYZGMTDSVVR7FKG 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: --pGG1p5kiIdHznV2S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 19, 2026 at 05:19:15PM +0100, Laurent Vivier wrote: > As all flows are now registered with an epollid at creation, we no > longer need to test if a flow is in epoll. Remove all related code > including flow_in_epoll() and flow_epollid_clear(). >=20 > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- > flow.c | 35 +++-------------------------------- > flow.h | 6 +----- > icmp.c | 1 - > tcp.c | 1 - > udp_flow.c | 1 - > 5 files changed, 4 insertions(+), 40 deletions(-) >=20 > diff --git a/flow.c b/flow.c > index 532339ce7fe1..1b8643358575 100644 > --- a/flow.c > +++ b/flow.c > @@ -127,7 +127,7 @@ static_assert(ARRAY_SIZE(flow_epoll) =3D=3D FLOW_NUM_= TYPES, > unsigned flow_first_free; > union flow flowtab[FLOW_MAX]; > static const union flow *flow_new_entry; /* =3D NULL */ > -static int epoll_id_to_fd[EPOLLFD_ID_MAX]; > +static int epoll_id_to_fd[EPOLLFD_ID_SIZE]; > =20 > /* Hash table to index it */ > #define FLOW_HASH_LOAD 70 /* % */ > @@ -351,18 +351,6 @@ static void flow_set_state(struct flow_common *f, en= um flow_state state) > flow_log_details_(f, LOG_DEBUG, MAX(state, oldstate)); > } > =20 > -/** > - * flow_in_epoll() - Check if flow is registered with an epoll instance > - * @f: Flow to check > - * > - * Return: true if flow is registered with epoll, false otherwise > - */ > -/* cppcheck-suppress unusedFunction */ > -bool flow_in_epoll(const struct flow_common *f) > -{ > - return f->epollid !=3D EPOLLFD_ID_INVALID; > -} > - > /** > * flow_epollfd() - Get the epoll file descriptor for a flow > * @f: Flow to query > @@ -371,13 +359,6 @@ bool flow_in_epoll(const struct flow_common *f) > */ > int flow_epollfd(const struct flow_common *f) > { > - if (f->epollid >=3D EPOLLFD_ID_MAX) { > - flow_log_(f, true, LOG_WARNING, > - "Invalid epollid %i for flow, assuming default", > - f->epollid); > - return epoll_id_to_fd[EPOLLFD_ID_DEFAULT]; > - } > - > return epoll_id_to_fd[f->epollid]; > } > =20 > @@ -388,20 +369,11 @@ int flow_epollfd(const struct flow_common *f) > */ > void flow_epollid_set(struct flow_common *f, int epollid) > { > - ASSERT(epollid < EPOLLFD_ID_MAX); > + ASSERT(epollid < EPOLLFD_ID_SIZE); > =20 > f->epollid =3D epollid; > } > =20 > -/** > - * flow_epollid_clear() - Clear the flow epoll id > - * @f: Flow to update > - */ > -void flow_epollid_clear(struct flow_common *f) > -{ > - f->epollid =3D EPOLLFD_ID_INVALID; > -} > - > /** > * flow_epoll_set() - Add or modify epoll registration for a flow socket > * @f: Flow to register socket for > @@ -435,7 +407,7 @@ int flow_epoll_set(const struct flow_common *f, int c= ommand, uint32_t events, > */ > void flow_epollid_register(int epollid, int epollfd) > { > - ASSERT(epollid < EPOLLFD_ID_MAX); > + ASSERT(epollid < EPOLLFD_ID_SIZE); > =20 > epoll_id_to_fd[epollid] =3D epollfd; > } > @@ -643,7 +615,6 @@ union flow *flow_alloc(void) > =20 > flow_new_entry =3D flow; > memset(flow, 0, sizeof(*flow)); > - flow_epollid_clear(&flow->f); > flow_set_state(&flow->f, FLOW_STATE_NEW); > =20 > return flow; > diff --git a/flow.h b/flow.h > index a74e13507957..d636358df422 100644 > --- a/flow.h > +++ b/flow.h > @@ -178,7 +178,7 @@ int flowside_connect(const struct ctx *c, int s, > * @pif[]: Interface for each side of the flow > * @side[]: Information for each side of the flow > * @tap_omac: MAC address of remote endpoint as seen from the guest > - * @epollid: epollfd identifier, or EPOLLFD_ID_INVALID > + * @epollid: epollfd identifier > */ > struct flow_common { > #ifdef __GNUC__ > @@ -203,8 +203,6 @@ struct flow_common { > =20 > #define EPOLLFD_ID_DEFAULT 0 > #define EPOLLFD_ID_SIZE (1 << EPOLLFD_ID_BITS) > -#define EPOLLFD_ID_MAX (EPOLLFD_ID_SIZE - 1) > -#define EPOLLFD_ID_INVALID EPOLLFD_ID_MAX > =20 > #define FLOW_INDEX_BITS 17 /* 128k - 1 */ > #define FLOW_MAX MAX_FROM_BITS(FLOW_INDEX_BITS) > @@ -261,10 +259,8 @@ flow_sidx_t flow_lookup_sa(const struct ctx *c, uint= 8_t proto, uint8_t pif, > union flow; > =20 > void flow_init(void); > -bool flow_in_epoll(const struct flow_common *f); > int flow_epollfd(const struct flow_common *f); > void flow_epollid_set(struct flow_common *f, int epollid); > -void flow_epollid_clear(struct flow_common *f); > int flow_epoll_set(const struct flow_common *f, int command, uint32_t ev= ents, > int fd, unsigned int sidei); > void flow_epollid_register(int epollid, int epollfd); > diff --git a/icmp.c b/icmp.c > index eb7f11be5dad..9da5a787d181 100644 > --- a/icmp.c > +++ b/icmp.c > @@ -213,7 +213,6 @@ static struct icmp_ping_flow *icmp_ping_new(const str= uct ctx *c, > if (flow_epoll_set(&pingf->f, EPOLL_CTL_ADD, EPOLLIN, pingf->sock, > TGTSIDE) < 0) { > close(pingf->sock); > - flow_epollid_clear(&pingf->f); > goto cancel; > } > =20 > diff --git a/tcp.c b/tcp.c > index 29d69354bd94..31d4e41ecb1a 100644 > --- a/tcp.c > +++ b/tcp.c > @@ -3759,7 +3759,6 @@ static int tcp_flow_repair_connect(const struct ctx= *c, > return rc; > } > =20 > - flow_epollid_clear(&conn->f); > conn->timer =3D -1; > conn->listening_sock =3D -1; > =20 > diff --git a/udp_flow.c b/udp_flow.c > index 80b15433f0ac..d824e2c55b2c 100644 > --- a/udp_flow.c > +++ b/udp_flow.c > @@ -86,7 +86,6 @@ static int udp_flow_sock(const struct ctx *c, > flow_epollid_set(&uflow->f, EPOLLFD_ID_DEFAULT); > if (flow_epoll_set(&uflow->f, EPOLL_CTL_ADD, EPOLLIN, s, sidei) < 0) { > rc =3D -errno; > - flow_epollid_clear(&uflow->f); > close(s); > return rc; > } > --=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 --pGG1p5kiIdHznV2S Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmlux7cACgkQzQJF27ox 2GdOKA//TfC3tWlvDpw5JrUl1EO2SnKpy5lgq3RyC7qbYdYJ2EOVHVABwTo7VSUT 4b0AWkStSmSTywlVmO9PfiBsJ5+EY0YL8jojYpMCmP46f2gX/EoniPbKca3///r3 qaTMKMpvY4ZfALZ3u719+wzixiD5ThG539p3zgfObOKMlBRsMNmCIOUgvobS91xa nPcGhvJT16oCE1NNc7EzkrfQBhDhNBLmf6lrSIdQ2P67GdQaKLFa6CiB3x/60d7+ SV6QbYGcgjSgUfafXM+xEGGGhhQuEpRfO4bBFnOwRfUWGQShar/afJ+42mGBJA5e iMPu9qtcXUAIn6sGdLGedM3eSn5kfOvwWF+FcreGpMaOVuWhHYQPxdy9cx0BbJiq BdJQSLTP/K7gim2d4DTh8/TCBvP9D/LdAwXJFAj3fw/KBNVx5a1Iv+/X+DYeIn/f 1Fd0jbs2WpV9HOuPGlWaQZYhprlF2MusQH6Ofk0T2jTpI0QAYqswPZKXY3jixlV9 0aaBq+V/P7MrhzbXLAPpB8iUNQCjspJnPBlrS5gC5EPkH+Cco6/yp81q41TBgVSb ZEqfZWr5m24S3qdFXftTjIrsn0KPedyBFvTM+e3JJv/t5junlAS5NXRxVuVzRbUO owciCYbfkWRETazd8j6kKRHPTAzXL3q0gKi0nkn9GMAUsxUm7b0= =ROBR -----END PGP SIGNATURE----- --pGG1p5kiIdHznV2S--