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=202410 header.b=iKdO2PRG; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 5E4445A061C for ; Tue, 03 Dec 2024 04:51:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202410; t=1733197896; bh=SNJdag41Y8mVCizgLPOOe6Afdi3XhyL1Wp2/p5vRaYY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iKdO2PRGjeWX9qRvezp+jgNDcTCmARIiYR2B+nyG+OfIF24txo6ZuxrznxgOhazJ/ XCSYKsWgoA19JWxEJv5HoAWZg/rN7vz6ljNeDgd8lXV9WNGs/rX5gtiEKiKk9lBQoF xetPnhydL1LEE+fxRvzMSvXNKz4/oIxLBmg0h6r84R6FaIN6vV8Ix9X4KcqLLSkyof N1570cJxWJdR/4H+OHKFPgyN4F1jLfJRjeNd71WR5+O4vGyqT6MFCfBnejXQ2J/1Gr 5jVyvb2EjzxW2qYA0pYJfizuwAm07Kbpr/fOdI5u9CnmcTTBX7OU2lkfWV6YlrLV7g Nwv6N4g+u/jYw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Y2RXm0HjMz4wj2; Tue, 3 Dec 2024 14:51:36 +1100 (AEDT) Date: Tue, 3 Dec 2024 14:51:30 +1100 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH v14 7/9] vhost-user: add vhost-user Message-ID: References: <20241122164337.3377854-1-lvivier@redhat.com> <20241122164337.3377854-8-lvivier@redhat.com> <1d7670f9-ae9f-46e2-864d-d36fe3947709@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GW6s+MlDr6WFLQEo" Content-Disposition: inline In-Reply-To: <1d7670f9-ae9f-46e2-864d-d36fe3947709@redhat.com> Message-ID-Hash: ANGI3S35GIOEFR73GSRP57HSHDYKGWB5 X-Message-ID-Hash: ANGI3S35GIOEFR73GSRP57HSHDYKGWB5 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: --GW6s+MlDr6WFLQEo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 28, 2024 at 01:57:34PM +0100, Laurent Vivier wrote: > On 26/11/2024 06:24, David Gibson wrote: > > > static int udp_vu_sock_recv(const struct ctx *c, int s, uint32_t even= ts, > > > + bool v6, ssize_t *dlen) > > > +{ > > > + struct vu_dev *vdev =3D c->vdev; > > > + struct vu_virtq *vq =3D &vdev->vq[VHOST_USER_RX_QUEUE]; > > > + int iov_cnt, idx, iov_used; > > > + struct msghdr msg =3D { 0 }; > > > + size_t off, hdrlen; > > > + > > > + ASSERT(!c->no_udp); > > > + > > > + if (!(events & EPOLLIN)) > > > + return 0; > > > + > > > + /* compute L2 header length */ > > > + hdrlen =3D udp_vu_hdrlen(v6); > > > + > > > + vu_init_elem(elem, iov_vu, VIRTQUEUE_MAX_SIZE); > > > + > > > + iov_cnt =3D vu_collect(vdev, vq, elem, VIRTQUEUE_MAX_SIZE, > > > + IP_MAX_MTU - sizeof(struct udphdr) + hdrlen, > > I don't think this calculation is quite right, though it's probably > > safe. At least for IPv4, IP_MAX_MTU includes the IP header itself, > > but then you count that again in hdrlen. >=20 > I think it would be semantically more correct to use "ETH_MAX_MTU + > sizeof(struct virtio_net_hdr_mrg_rxbuf)", but as ETH_MAX_MTU and IP_MAX_M= TU > are both defined to USHRT_MAX I'm not sure how to compute the segment > size... Huh, right. I guess that means you can't quite put a maximum size IP frame on ethernet, because you'll run out of Ethernet MTU before you run out of IP MTU. I think we should work based on the IP limits, not the L2 limit: our operation means we're inherently connected to IP. *Currently* we always use Ethernet headers as well, but that could reasonably change ("tun" mode support, or other possible L2s). So, that would give us: IP_MAX_MTU + ETH_HLEN + sizeof(virtio_net_hdr_mrg_rxbuf) --=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 --GW6s+MlDr6WFLQEo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmdOgDUACgkQzQJF27ox 2Gc9oA//blnzdg8QBweACmOiD0DopW4gJdBWTneFySjMt3LgoGKU+mM/jpVn85Bz +ZyL4HKoG87m7eeClkiwpqbxSF2wr9ldtqU49RxOxzh5s/LB3S7BK1JaqbgV4HKB rR+017X8lvQ1/bKjXfUdh4wLwM8JdzGwXV93a5IUkLKnZAL8v3TvFYv82Se7SZuf +UTz4CdomsVrxvzxXb+cazik/BZDekHiY67CgqeL04ONG+aEtCBXzfy0yfb3JIS4 s1gR+ytE+kMqmHoDNpcKu6GRwptR5FlNV1aPM8aeY5cm2VRDfDkE7b5QVT9RIorW H+U5PrhX1k7r92GmeSBIIApCMvxjXmvnRskRKZ1Poqad6NUzHCSz4PKJBv/ZXd+e C+PyaADYpn831YBFq4IM3K2vZh2/svnZLhPpYfVFp83N98vOnQGub1bo4NmZbn/8 UDkvPbyd/hG94Q0tYxwvcVzWK84VGhvR5Ia3JpyWl0C3CUXh9o3xZ3BF0fi1pAac DInHWP2SO2jnVdt/fN2PCxy5rj76H+6Y9JnGv9YL5uumwZebnQ3dNeLQGXel+ojg p+y2DglFffKkiKO6tTrWL1tnAgM9LwVGP7hC2OyYixUJv6hVKESbRTypB7os+bDi +N/UHCnnE2eCapRXuF5R99Qv/8R2ybG3ldngeYBlWijsmQznsx8= =ghAG -----END PGP SIGNATURE----- --GW6s+MlDr6WFLQEo--