public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: passt-dev@passt.top
Subject: Re: [PATCH v14 7/9] vhost-user: add vhost-user
Date: Thu, 28 Nov 2024 13:57:34 +0100	[thread overview]
Message-ID: <1d7670f9-ae9f-46e2-864d-d36fe3947709@redhat.com> (raw)
In-Reply-To: <Z0VboMFWVRxH72kC@zatzit>

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...

Thanks,
Laurent


  reply	other threads:[~2024-11-28 12:57 UTC|newest]

Thread overview: 26+ 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 [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=1d7670f9-ae9f-46e2-864d-d36fe3947709@redhat.com \
    --to=lvivier@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --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).