From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id AD0DC5A0307 for ; Mon, 03 Jun 2024 06:20:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1717388441; bh=lroqJfGvLmGFe06//AfTGnQElBNO39IRWdH8BQd/NBs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mIsmp2LpijfybF+fPdBMsKWUFdIUDXbgqORRjwhL4ZST26slc/pjeezZoxpxXwqSv RWHWZ8SywfiM3JoexRhMmP1QrmB6+/418Io9sSLQUPfcfHjFDrsV+XUXKgwhFiEFPl CsdCt6FVuPqxZTbBZTOAzp99DUOm98r9zRpjfQNFi1sQ74JIoFQHSU9U8owtOeaZsC Xy2Zt5vZw/CIWS3mn5xp8p5O5wycuoCmOiVrO3bve8i+N1CdxsRnesqacYx5eloH8e witcpRmYkQzm+Dxsq5ntnfd+YuKrdi/fhfpuwGdr6Xuq2AHi2EyS9LYLN4cF+Rfjbe pLzFUhPkz50RQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Vt0rn3zPQz4wx6; Mon, 3 Jun 2024 14:20:41 +1000 (AEST) Date: Mon, 3 Jun 2024 14:20:35 +1000 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH v4 10/10] tap: use in->buf_size rather than sizeof(pkt_buf) Message-ID: References: <20240531142344.1420034-1-lvivier@redhat.com> <20240531142344.1420034-11-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WJ1dwwBwMl0mOOBH" Content-Disposition: inline In-Reply-To: <20240531142344.1420034-11-lvivier@redhat.com> Message-ID-Hash: LUUUCVIOZZ5KVSOJ56LGAGKOUUIL44VJ X-Message-ID-Hash: LUUUCVIOZZ5KVSOJ56LGAGKOUUIL44VJ 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: --WJ1dwwBwMl0mOOBH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 31, 2024 at 04:23:44PM +0200, Laurent Vivier wrote: > buf_size is set to sizeof(pkt_buf) by default. And it seems more correct > to provide the actual size of the buffer. >=20 > Later a buf_size of 0 will allow vhost-user mode to detect > guest memory buffers. >=20 > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson Stefano, I think this one would also make sense to apply immediately, independently of the rest of the series. > --- > tap.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) >=20 > diff --git a/tap.c b/tap.c > index c436d2d7b72b..28b515906f3b 100644 > --- a/tap.c > +++ b/tap.c > @@ -602,7 +602,7 @@ resume: > if (!eh) > continue; > if (ntohs(eh->h_proto) =3D=3D ETH_P_ARP) { > - PACKET_POOL_P(pkt, 1, in->buf, sizeof(pkt_buf)); > + PACKET_POOL_P(pkt, 1, in->buf, in->buf_size); > =20 > packet_add(pkt, l2len, (char *)eh); > arp(c, pkt); > @@ -642,7 +642,7 @@ resume: > continue; > =20 > if (iph->protocol =3D=3D IPPROTO_ICMP) { > - PACKET_POOL_P(pkt, 1, in->buf, sizeof(pkt_buf)); > + PACKET_POOL_P(pkt, 1, in->buf, in->buf_size); > =20 > if (c->no_icmp) > continue; > @@ -661,7 +661,7 @@ resume: > continue; > =20 > if (iph->protocol =3D=3D IPPROTO_UDP) { > - PACKET_POOL_P(pkt, 1, in->buf, sizeof(pkt_buf)); > + PACKET_POOL_P(pkt, 1, in->buf, in->buf_size); > =20 > packet_add(pkt, l2len, (char *)eh); > if (dhcp(c, pkt)) > @@ -810,7 +810,7 @@ resume: > } > =20 > if (proto =3D=3D IPPROTO_ICMPV6) { > - PACKET_POOL_P(pkt, 1, in->buf, sizeof(pkt_buf)); > + PACKET_POOL_P(pkt, 1, in->buf, in->buf_size); > =20 > if (c->no_icmp) > continue; > @@ -834,7 +834,7 @@ resume: > uh =3D (struct udphdr *)l4h; > =20 > if (proto =3D=3D IPPROTO_UDP) { > - PACKET_POOL_P(pkt, 1, in->buf, sizeof(pkt_buf)); > + PACKET_POOL_P(pkt, 1, in->buf, in->buf_size); > =20 > packet_add(pkt, l4len, l4h); > =20 --=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 --WJ1dwwBwMl0mOOBH Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmZdRJIACgkQzQJF27ox 2GdRNQ//b3B90RZwbdkHIf75MRaCodKANMpIueYz5JCOSzB+5seyCyTNLwvgOT0f xGZnKiPUXd31b95kBLQA/Vj9vNPqQ/CLlePIFX+Lghe6nuB54PzBfgQnqkLg+l17 QemxQFHQ30KVKSbZX/xY/SGPM6wB9M/BvSsrDyLg6oTD87BiUWOrREfsVE7BG2C6 XAuXu6Lysn8kOrxal4/SwXA83yfJWvRycA3pVXyD4XxIYD7cIFvo+3KSfqRKEd1P Zl0NnRxch9JQs+qREKVTAxkkQ9DvUjGIAieG7diUGTpsUwVAG692AP9dRA+ATXVh ykTQNk0qeKgabiRzK3cdxhNmjDLyI3/WRraGZq6tTz4Kmb1GTMYbH8sd34Kw8BH6 /y+o6kCEqnUysyzqvuvznUX1GiL709UV9SNY0HJlEW82i4rjOZLGpJOMV4/BGZzd 4B6WRzUIFzRpckRB12g+Yh88LcLESBmVUHZFlNSxatMMc2jYsJ9R9h8YV7ADYayf oYv14E/PIMu99rlH7suGfomHbSVwSMOefbDQii/ER+GzO8jPaHrhFWzeQUsNmQ+D dP6LQAXhtB12HW0nbnUSqznPXz9hKbI5XGhE6VVyV+t1NLkqMBdVRKgiUjzuiutd kS6qMVbtCT/H4zMk2e//RI+am6b1jDQUuG62ffnN6Ujyga1PLAk= =EnZP -----END PGP SIGNATURE----- --WJ1dwwBwMl0mOOBH--