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=AN57dObE; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 628135A0625 for ; Fri, 12 Dec 2025 03:32:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202512; t=1765506727; bh=iLgcOJ3vzh3M5RpeOIuAYpKl6Ty9kzK0V+9UZcaUGyA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AN57dObEAl6p0SI4VSNyfEFSUARSPIhr4czLwpjwXDu2uM8dqDXwCz+Y9RJFHJWOu RfReGRkA0uBDr0oDhxcN9oV2ZPCqPinEZTeu/N/83KJ+bYqPePe0X4RKWrR6u2dIrH ETZzh2V5BDNA2gUBDXVzfsisXg3z4KhmJ7VJHmnL/New/tfZ6gGzfozfAYCkWiFBHd DLgeyHGk6fTGdLpI57Xp7CKmODliffTm+3qG8IJBATfTC3yhBcAeEB1Xw0g/s+ZmjD tOqAm+nLLL3DEox2b4tN8Zrs8cOO2f2W+lE9egpbVBgInsr0Yu//8nq2epuROtvAZd 5KhcjLtbXac2A== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4dSD4R6gL9z4wMS; Fri, 12 Dec 2025 13:32:07 +1100 (AEDT) Date: Fri, 12 Dec 2025 13:30:32 +1100 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH] udp: Rename udp_buf_sock_to_tap() and udp_vu_sock_to_tap() Message-ID: References: <20251211141626.301969-1-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="iM2sijtIEF7UeP1M" Content-Disposition: inline In-Reply-To: <20251211141626.301969-1-lvivier@redhat.com> Message-ID-Hash: 5XT7XUTW6QLXUKJHLNZEICLYZTMH64SI X-Message-ID-Hash: 5XT7XUTW6QLXUKJHLNZEICLYZTMH64SI 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: --iM2sijtIEF7UeP1M Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 11, 2025 at 03:16:26PM +0100, Laurent Vivier wrote: > The function udp_vu_sock_to_tap() sends data to the vhost-user interface, > not the tap interface. Rename it to udp_sock_to_vu() to accurately reflect > its destination. >=20 > The function udp_buf_sock_to_tap() includes a "buf_" prefix that is now > redundant. Since the functions can be distinguished by their destination > (to_tap vs. to_vu), drop the prefix and rename it to udp_sock_to_tap(). >=20 > No functional change. >=20 > Signed-off-by: Laurent Vivier Eh, I mean using "tap" to mean the guest side interface, even if it's not based on /dev/net/tap is pretty well established at this point. I do think udp_sock_to_vu() is a better name regardless. I'm a bit less convinced on renaming udp_buf_sock_to_tap(). If we're trying to abandon the "tap means any guest interface" convention, then udp_sock_to_tap() is still inaccurate, since it can also send to a qemu socket. If we're not trying to abandon that convention then it suggests that the function does any forwarding to the guest, not just the non-vu case. > --- > udp.c | 15 +++++++-------- > udp_vu.c | 4 ++-- > udp_vu.h | 2 +- > 3 files changed, 10 insertions(+), 11 deletions(-) >=20 > diff --git a/udp.c b/udp.c > index 08bec50a27af..10704681973b 100644 > --- a/udp.c > +++ b/udp.c > @@ -824,14 +824,14 @@ static void udp_sock_to_sock(const struct ctx *c, i= nt from_s, int n, > } > =20 > /** > - * udp_buf_sock_to_tap() - Forward datagrams from socket to tap > + * udp_sock_to_tap() - Forward datagrams from socket to tap > * @c: Execution context > * @s: Socket to read data from > * @n: Maximum number of datagrams to forward > * @tosidx: Flow & side to forward data from @s to > */ > -static void udp_buf_sock_to_tap(const struct ctx *c, int s, int n, > - flow_sidx_t tosidx) > +static void udp_sock_to_tap(const struct ctx *c, int s, int n, > + flow_sidx_t tosidx) > { > const struct flowside *toside =3D flowside_at_sidx(tosidx); > struct udp_flow *uflow =3D udp_at_sidx(tosidx); > @@ -892,9 +892,9 @@ void udp_sock_fwd(const struct ctx *c, int s, uint8_t= frompif, > udp_sock_to_sock(c, s, 1, tosidx); > } else if (topif =3D=3D PIF_TAP) { > if (c->mode =3D=3D MODE_VU) > - udp_vu_sock_to_tap(c, s, 1, tosidx); > + udp_sock_to_vu(c, s, 1, tosidx); > else > - udp_buf_sock_to_tap(c, s, 1, tosidx); > + udp_sock_to_tap(c, s, 1, tosidx); > } else if (flow_sidx_valid(tosidx)) { > struct udp_flow *uflow =3D udp_at_sidx(tosidx); > =20 > @@ -972,10 +972,9 @@ void udp_sock_handler(const struct ctx *c, union epo= ll_ref ref, > udp_sock_to_sock(c, ref.fd, n, tosidx); > } else if (topif =3D=3D PIF_TAP) { > if (c->mode =3D=3D MODE_VU) { > - udp_vu_sock_to_tap(c, s, UDP_MAX_FRAMES, > - tosidx); > + udp_sock_to_vu(c, s, UDP_MAX_FRAMES, tosidx); > } else { > - udp_buf_sock_to_tap(c, s, n, tosidx); > + udp_sock_to_tap(c, s, n, tosidx); > } > } else { > flow_err(uflow, > diff --git a/udp_vu.c b/udp_vu.c > index c30dcf97698f..f7ed6bc6a67c 100644 > --- a/udp_vu.c > +++ b/udp_vu.c > @@ -197,13 +197,13 @@ static void udp_vu_csum(const struct flowside *tosi= de, int iov_used) > } > =20 > /** > - * udp_vu_sock_to_tap() - Forward datagrams from socket to tap > + * udp_sock_to_vu() - Forward datagrams from socket to vhost-user > * @c: Execution context > * @s: Socket to read data from > * @n: Maximum number of datagrams to forward > * @tosidx: Flow & side to forward data from @s to > */ > -void udp_vu_sock_to_tap(const struct ctx *c, int s, int n, flow_sidx_t t= osidx) > +void udp_sock_to_vu(const struct ctx *c, int s, int n, flow_sidx_t tosid= x) > { > const struct flowside *toside =3D flowside_at_sidx(tosidx); > bool v6 =3D !(inany_v4(&toside->eaddr) && inany_v4(&toside->oaddr)); > diff --git a/udp_vu.h b/udp_vu.h > index 576b0e716f3d..669bde1c10dc 100644 > --- a/udp_vu.h > +++ b/udp_vu.h > @@ -8,6 +8,6 @@ > =20 > void udp_vu_listen_sock_data(const struct ctx *c, union epoll_ref ref, > const struct timespec *now); > -void udp_vu_sock_to_tap(const struct ctx *c, int s, int n, flow_sidx_t t= osidx); > +void udp_sock_to_vu(const struct ctx *c, int s, int n, flow_sidx_t tosid= x); > =20 > #endif /* UDP_VU_H */ > --=20 > 2.51.1 >=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 --iM2sijtIEF7UeP1M Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmk7fjkACgkQzQJF27ox 2GfP6Q/9FC5lt2agDC+dEI/j9xfgvLSyvcsnAv+KPU+gSjSV0QUDgUZpNW0ySMft Zgk/jjJ11hzReb3lSSw0C3dktNv6rPVjjsyp3YTK3C0nY1ishSojIyVsabh/Ok13 SYlw6UkiXhAXh8dpRNfP7RmD/g0KW+ALUc0WnhJ/VdHDoOAJbcD588XYJeIlam0l ATTa2Zq8OXkm/lXZ8g1+E8HsnthtJQaX/Wp+pAn22qDgXuAg2dJxpSfqRHWuiAXq WMFEu7CHXs8uX5EmciBrk4Rv1fZ2XU7dWDMxgnYr2x2HvdDBUrn9PgEl5b46ruiN eCHVGCojpG4kqOIm+z5a0ofJFgCJdkPOROIaRFJ6qL56/Wv18F+rVxrLwUftNBqX F0yogAlFJvXH9fApE3uMrb/boxDHuKU6CO2xES3C59Yecym9IlWaDqrRqbFHqgT4 gk0/L29CH3LPmvF/gN/KOtjJw4/81DD8TSNwp68mXPpnlFDYBDBIJrJmArKeYwXu oO+IOCVw9731V3pk/AkU6sG34rnvUpphn2JgGBd6+D7MxlzmQpGEpBc4yLGAY7fG 1rDn9AAvBUlulc7DUj7mrtMyQ5HreGlD/vfpODByMJeJGLDdqvqneVTyNMFy2nCn RX4DzZvynkn8w8fjBVt+YsOtHwHGwh+eE03h59VDsuIHRF3JjzQ= =ieH+ -----END PGP SIGNATURE----- --iM2sijtIEF7UeP1M--