From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 457295A004F for ; Sat, 03 Aug 2024 09:51:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1722671508; bh=zKQWS8qmSpSBMst1cerb0Dj34ntfYbHXydZL+dmWna8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H1rHP1TTRdJZ3thXkODk5dMgge2sW39lHaa0g2mEL/DYlbDiQW7BYOhQniPYRoKKt IeN49gaF4ln4nd/hHO6yeIgiWH7dO+cJpDC+uDm5kVvl4SLvD7IfdVq01fnk8DEsTu 9IEEdAapD3EGC9tPoPuQ3K9H7p//9jGwZab/xHbtBd99hqmSwTTsKY0Sd6PVI5u3+T YdCbl+MNPVvZGT/DEmHwuDg6r/bIFH1GpQSWIMP6l8asdRK3ZXJIxMHpPQA7cn5WPJ 35H6o1+z694RhSHJHhZpOpnh8Bpryrmo4/ZbZ2FeXIXHaheCkUplxAcQgifs1UaCCN zmjTAMxrwXSZg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4WbZfD1LQlz4wx5; Sat, 3 Aug 2024 17:51:48 +1000 (AEST) Date: Sat, 3 Aug 2024 17:47:40 +1000 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH 1/2] udp_flow: Remove udp_meta_t from the parameters of udp_flow_from_sock() Message-ID: References: <20240802161036.1404559-1-lvivier@redhat.com> <20240802161036.1404559-2-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="/ZUkKt5sLZV69Vg4" Content-Disposition: inline In-Reply-To: <20240802161036.1404559-2-lvivier@redhat.com> Message-ID-Hash: XZIA67V5EJ3UL4A4QZS66IDFC2ETA3SC X-Message-ID-Hash: XZIA67V5EJ3UL4A4QZS66IDFC2ETA3SC 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: --/ZUkKt5sLZV69Vg4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 02, 2024 at 06:10:35PM +0200, Laurent Vivier wrote: > To be used with the vhost-user version of udp.c, we need to export the > udp_flow functions. To avoid to export udp_meta_t too that is specific > to the socket version of udp.c, don't pass udp_meta_t to it, > but the only needed field, s_in. >=20 > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- > udp.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) >=20 > diff --git a/udp.c b/udp.c > index a92014806a73..f27a00bf5610 100644 > --- a/udp.c > +++ b/udp.c > @@ -432,7 +432,7 @@ cancel: > * udp_flow_from_sock() - Find or create UDP flow for "listening" socket > * @c: Execution context > * @ref: epoll reference of the receiving socket > - * @meta: Metadata buffer for the datagram > + * @s_in: Source socket address, filled in by recvmmsg() > * @now: Timestamp > * > * #syscalls fcntl > @@ -441,7 +441,7 @@ cancel: > * FLOW_SIDX_NONE if we couldn't find or create a flow. > */ > static flow_sidx_t udp_flow_from_sock(const struct ctx *c, union epoll_r= ef ref, > - struct udp_meta_t *meta, > + const union sockaddr_inany *s_in, > const struct timespec *now) > { > struct udp_flow *uflow; > @@ -450,7 +450,7 @@ static flow_sidx_t udp_flow_from_sock(const struct ct= x *c, union epoll_ref ref, > =20 > ASSERT(ref.type =3D=3D EPOLL_TYPE_UDP_LISTEN); > =20 > - sidx =3D flow_lookup_sa(c, IPPROTO_UDP, ref.udp.pif, &meta->s_in, ref.u= dp.port); > + sidx =3D flow_lookup_sa(c, IPPROTO_UDP, ref.udp.pif, s_in, ref.udp.port= ); > if ((uflow =3D udp_at_sidx(sidx))) { > uflow->ts =3D now->tv_sec; > return flow_sidx_opposite(sidx); > @@ -461,11 +461,11 @@ static flow_sidx_t udp_flow_from_sock(const struct = ctx *c, union epoll_ref ref, > =20 > debug("Couldn't allocate flow for UDP datagram from %s %s", > pif_name(ref.udp.pif), > - sockaddr_ntop(&meta->s_in, sastr, sizeof(sastr))); > + sockaddr_ntop(s_in, sastr, sizeof(sastr))); > return FLOW_SIDX_NONE; > } > =20 > - flow_initiate_sa(flow, ref.udp.pif, &meta->s_in, ref.udp.port); > + flow_initiate_sa(flow, ref.udp.pif, s_in, ref.udp.port); > return udp_flow_new(c, flow, ref.fd, now); > } > =20 > @@ -712,7 +712,7 @@ void udp_listen_sock_handler(const struct ctx *c, uni= on epoll_ref ref, > * the array, or recalculating tosidx for a single entry, we have to > * populate it one entry *ahead* of the loop counter. > */ > - udp_meta[0].tosidx =3D udp_flow_from_sock(c, ref, &udp_meta[0], now); > + udp_meta[0].tosidx =3D udp_flow_from_sock(c, ref, &udp_meta[0].s_in, no= w); > for (i =3D 0; i < n; ) { > flow_sidx_t batchsidx =3D udp_meta[i].tosidx; > uint8_t batchpif =3D pif_at_sidx(batchsidx); > @@ -730,7 +730,7 @@ void udp_listen_sock_handler(const struct ctx *c, uni= on epoll_ref ref, > break; > =20 > udp_meta[i].tosidx =3D udp_flow_from_sock(c, ref, > - &udp_meta[i], > + &udp_meta[i].s_in, > now); > } while (flow_sidx_eq(udp_meta[i].tosidx, batchsidx)); > =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 --/ZUkKt5sLZV69Vg4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmat4I4ACgkQzQJF27ox 2GeAsRAAlZ/uRoPzbq+b/jIvjvj7foQZW4j9DmiCUerKFJqMraomukCWsJbl4N5/ ygWfV0Fxj4AZh8QP2xRtfEfCXVcaG83pZTAwYMh6muTROPKMVolIltZAv/0G4lTd D2/DF0jQHV6R52r1bGFAu6G5WnWp8RuelDQtMAWATg85o4qPgVipU8YFipMli0Ak gB573sNdFPtkNUKOAoSzUgSUmnbmHqlnPk5DK1HfYq2CMfCFxZaM6UBD5D5QGliC Y6hHmZ3Estq+y/S3URxu76Yqpvot04Zy5cl+r1DNs2Q2109PAoLREXVkxzWf7bab bzw/rTbkQlnX5rkgpEg/DSfqzLl3XTMni7Vg4//6HNatg4RQy3/zRSycnjjmUVJc iIqUP0gnAX5bH56YpKaOC/xk+ygF0pTLcok/b1CTF9bhEqJghHEYH7QXwZMb5f5p eG28RjcB3bs/xQndGWOOsEYEdGH1O3StNHOcfoUWa/0E4wB9CwjvH4/Zsk7Bv5Nr D5RfoZYCG9CN0kqimFTcEOe3uPngp5vkXyrqTAol8TCaB2HZjqQ8KQ/DZruLLXWi i2T7Pu/ZIisd6jqTt7wf7z1GFsF8xaHZ3HEwEP4XdBBDgn5scGnGxD6o1xW/e4uO 3C0LswnYs/DMBCLhxdVGpfIRlBKn7gu6pkUOGHFPJtIJ4mEgDsg= =IxvJ -----END PGP SIGNATURE----- --/ZUkKt5sLZV69Vg4--