From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 79CD75A0274 for ; Thu, 10 Aug 2023 04:33:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1691634801; bh=ZdSEV3xMIKaU5Qgj2eQTsxWXO/Q00YuT8x2qiPCyP/E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T+k1zX+M7U8EIe9hOBdj/S748GDLMfYXERDIglJ89k2Hg+w/j7ucXfx64tH4eF8gq PRtFZYXo9fUSwMx9fhMx+lcyzoXjRLsZd5iQpsBLtNW3EgWgZWcBzPBEURylj4ZeEM IoLuNg53Gd2migSa8NhDUK7I2uLOYeZAPnU/U9d8= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4RLrZT1kVKz4wqX; Thu, 10 Aug 2023 12:33:21 +1000 (AEST) Date: Thu, 10 Aug 2023 10:23:14 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 1/9] epoll: Generalize epoll_ref to cover things other than sockets Message-ID: References: <20230807134631.1400119-1-david@gibson.dropbear.id.au> <20230807134631.1400119-2-david@gibson.dropbear.id.au> <20230809215743.22102e88@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="z4e5MNWiuuxdcTaZ" Content-Disposition: inline In-Reply-To: <20230809215743.22102e88@elisabeth> Message-ID-Hash: 3OKQBVBOWOG5FFG4QBB5ZZ3VFLM3652G X-Message-ID-Hash: 3OKQBVBOWOG5FFG4QBB5ZZ3VFLM3652G 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: --z4e5MNWiuuxdcTaZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 09, 2023 at 09:59:10PM +0200, Stefano Brivio wrote: > On Mon, 7 Aug 2023 23:46:23 +1000 > David Gibson wrote: >=20 > > The epoll_ref type includes fields for the IP protocol of a socket, and= the > > socket fd. However, we already have a few things in the epoll which ar= en't > > protocol sockets, and we may have more in future. Rename these fields = to > > an abstract "fd type" and file descriptor for more generality. > >=20 > > Similarly, rather than using existing IP protocol numbers for the type, > > introduce our own number space. For now these just correspond to the > > supported protocols, but we'll expand on that in future. > >=20 > > Signed-off-by: David Gibson > > --- > > icmp.c | 6 +++--- > > passt.c | 25 ++++++++++++------------- > > passt.h | 40 +++++++++++++++++++++++++++++----------- > > tcp.c | 22 +++++++++++----------- > > tcp_conn.h | 4 ++-- > > tcp_splice.c | 4 ++-- > > udp.c | 14 +++++++------- > > util.c | 27 ++++++++++++++++++++------- > > 8 files changed, 86 insertions(+), 56 deletions(-) > >=20 > > diff --git a/icmp.c b/icmp.c > > index 676fa64..a4b6a47 100644 > > --- a/icmp.c > > +++ b/icmp.c > > @@ -79,7 +79,7 @@ void icmp_sock_handler(const struct ctx *c, union epo= ll_ref ref, > > (void)events; > > (void)now; > > =20 > > - n =3D recvfrom(ref.s, buf, sizeof(buf), 0, (struct sockaddr *)&sr, &s= l); > > + n =3D recvfrom(ref.fd, buf, sizeof(buf), 0, (struct sockaddr *)&sr, &= sl); > > if (n < 0) > > return; > > =20 > > @@ -182,7 +182,7 @@ int icmp_tap_handler(const struct ctx *c, int af, c= onst void *addr, > > bind_if, id, iref.u32); > > if (s < 0) > > goto fail_sock; > > - if (s > SOCKET_MAX) { > > + if (s > FD_REF_MAX) { > > close(s); > > return 1; > > } > > @@ -236,7 +236,7 @@ int icmp_tap_handler(const struct ctx *c, int af, c= onst void *addr, > > bind_if, id, iref.u32); > > if (s < 0) > > goto fail_sock; > > - if (s > SOCKET_MAX) { > > + if (s > FD_REF_MAX) { > > close(s); > > return 1; > > } > > diff --git a/passt.c b/passt.c > > index 9123868..b42f42d 100644 > > --- a/passt.c > > +++ b/passt.c > > @@ -55,12 +55,11 @@ > > =20 > > char pkt_buf[PKT_BUF_BYTES] __attribute__ ((aligned(PAGE_SIZE))); > > =20 > > -char *ip_proto_str[IPPROTO_SCTP + 1] =3D { > > - [IPPROTO_ICMP] =3D "ICMP", > > - [IPPROTO_TCP] =3D "TCP", > > - [IPPROTO_UDP] =3D "UDP", > > - [IPPROTO_ICMPV6] =3D "ICMPV6", > > - [IPPROTO_SCTP] =3D "SCTP", > > +char *epoll_type_str[EPOLL_TYPE_MAX+1] =3D { >=20 > For consistency, given you're respinning anyway: [EPOLL_TYPE_MAX + 1] Done, thanks. --=20 David Gibson | 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 --z4e5MNWiuuxdcTaZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmTULdkACgkQzQJF27ox 2Gc2dw/9HqZr5GI4bJo63WN8SZxtBWguS/7PtssGJYRHmcZaZTN8Cc7fKMTp28kE 12Q0i4dl362oLKTtg6xgUOAxakIZDQgbDT7HxDci6QpRHCZ65K0IcgIHF8wWr+co ADWPWZloqJNZHbrSPZwHM0WWtzKRMeLUtGFqjhzJaGZKoU4MYvGUwGZa2Uk6MN8a 9nBW69kVD5aZ+3d6BcekOFggVyiluerViEjdiNDN0et6PCtLOfNHUw/57eAMU0e2 WlAm+ijNkdbuVgLarIqvNS8mVgzBiF7FkZx/f2PyH5Kk8MQ5LN2HNeVUj2lBdqyD LNHk1XCQGMmmCPT/hgNbBsDI5jtixjUWLzIgcqSVfx8bRJY7dm3VWLuBsVxMP546 0DxnER1TvZmcPWy9vc4NcyUFLs4NIQQn5YRsVA2Yjsb31xgLoTy3f49Vn6jE4g+H tKl5LUoPhi3exqdC2ND6Qbalo0GWqwyNuS3LWz9ro0T/aQHuqarVykzdtsu4HcJn /qsH5aKKECgraLh6KfqwNCIXmoMltLBGL5ZC/i4gtdEO0w7V5NqVhjeRMPzcMaun rs5wZuRoH4hKYGmbNdPNP+p6ZEPAcVblcesqxFAgW+2hAe78/kvy4oMCIwe15ifD HetGq0ngAOJ5VDZQhZpnMCRkANvPvJcbEqmJUD7zi+wsXIgf0fg= =4jWD -----END PGP SIGNATURE----- --z4e5MNWiuuxdcTaZ--