From: David Gibson <david@gibson.dropbear.id.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH v14 7/9] vhost-user: add vhost-user
Date: Tue, 3 Dec 2024 14:51:30 +1100 [thread overview]
Message-ID: <Z06AQpmwfsrnIlh1@zatzit> (raw)
In-Reply-To: <1d7670f9-ae9f-46e2-864d-d36fe3947709@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1966 bytes --]
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 events,
> > > + bool v6, ssize_t *dlen)
> > > +{
> > > + struct vu_dev *vdev = c->vdev;
> > > + struct vu_virtq *vq = &vdev->vq[VHOST_USER_RX_QUEUE];
> > > + int iov_cnt, idx, iov_used;
> > > + struct msghdr msg = { 0 };
> > > + size_t off, hdrlen;
> > > +
> > > + ASSERT(!c->no_udp);
> > > +
> > > + if (!(events & EPOLLIN))
> > > + return 0;
> > > +
> > > + /* compute L2 header length */
> > > + hdrlen = udp_vu_hdrlen(v6);
> > > +
> > > + vu_init_elem(elem, iov_vu, VIRTQUEUE_MAX_SIZE);
> > > +
> > > + iov_cnt = 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.
>
> 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_MTU
> 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)
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-12-03 3:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-22 16:43 [PATCH v14 0/9] Add vhost-user support to passt. (part 3) Laurent Vivier
2024-11-22 16:43 ` [PATCH v14 1/9] packet: replace struct desc by struct iovec Laurent Vivier
2024-11-22 16:43 ` [PATCH v14 2/9] vhost-user: introduce virtio API Laurent Vivier
2024-11-22 16:43 ` [PATCH v14 3/9] vhost-user: introduce vhost-user API Laurent Vivier
2024-11-22 16:43 ` [PATCH v14 4/9] udp: Prepare udp.c to be shared with vhost-user Laurent Vivier
2024-11-22 16:43 ` [PATCH v14 5/9] tcp: Export headers functions Laurent Vivier
2024-11-22 16:43 ` [PATCH v14 6/9] passt: rename tap_sock_init() to tap_backend_init() Laurent Vivier
2024-11-22 16:43 ` [PATCH v14 7/9] vhost-user: add vhost-user Laurent Vivier
2024-11-26 5:14 ` Stefano Brivio
2024-11-26 13:53 ` Stefano Brivio
2024-11-26 14:11 ` Laurent Vivier
2024-11-26 15:20 ` Stefano Brivio
2024-11-26 15:41 ` Laurent Vivier
2024-11-26 5:24 ` David Gibson
2024-11-28 12:57 ` Laurent Vivier
2024-12-03 3:51 ` David Gibson [this message]
2024-11-27 4:47 ` Stefano Brivio
2024-11-27 9:09 ` Laurent Vivier
2024-11-27 9:45 ` Stefano Brivio
2024-11-27 9:48 ` Laurent Vivier
2024-11-27 10:03 ` Stefano Brivio
2024-11-27 10:11 ` Laurent Vivier
2024-11-27 10:14 ` Stefano Brivio
2024-11-22 16:43 ` [PATCH v14 8/9] test: Add tests for passt in vhost-user mode Laurent Vivier
2024-11-22 16:43 ` [PATCH v14 9/9] tcp: Move tcp_l2_buf_fill_headers() to tcp_buf.c Laurent Vivier
2024-11-27 16:21 ` [PATCH v14 0/9] Add vhost-user support to passt. (part 3) Stefano Brivio
2024-11-27 16:40 ` Laurent Vivier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z06AQpmwfsrnIlh1@zatzit \
--to=david@gibson.dropbear.id.au \
--cc=lvivier@redhat.com \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).