public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: Ammar Yasser <aerosound161@gmail.com>, passt-dev@passt.top
Cc: eperezma@redhat.com
Subject: Re: [PATCH 2/7] conf: Add context fields, epoll types and --vhost-kernel flag to pasta
Date: Mon, 14 Sep 2026 08:56:48 +0200	[thread overview]
Message-ID: <44fddd18-43c3-4836-86cc-c24be2c7169f@redhat.com> (raw)
In-Reply-To: <DLDA91VVAQL4.1IRPFBT6IT9AD@gmail.com>

On 9/12/26 12:57, Ammar Yasser wrote:
> On Wed Sep 9, 2026 at 3:35 PM EEST, Laurent Vivier wrote:
>> On 9/4/26 23:28, aerosouund wrote:
>>> From: Ammar Yasser <aerosound161@gmail.com>
> 
>>> + * The only structural limit the QEMU socket protocol imposes on frames is
>>> + * (2^32-1) bytes, but that would be ludicrously long in practice.  For now,
>>> + * limit it somewhat arbitrarily to 65535 bytes.  FIXME: Work out an appropriate
>>> + * limit with more precision.
>>> + */
>>> +#define L2_MAX_LEN_PASST	USHRT_MAX
>>> +
>>> +/** L2_MAX_LEN_VU - Maximum frame length for vhost-user mode (with L2 header)
>>> + *
>>> + * vhost-user allows multiple buffers per frame, each of which can be quite
>>> + * large, so the inherent frame size limit is rather large.  Much larger than is
>>> + * actually useful for IP.  For now limit arbitrarily to 65535 bytes. FIXME:
>>> + * Work out an appropriate limit with more precision.
>>> + */
>>> +#define L2_MAX_LEN_VU		USHRT_MAX
>>> +
>>> +/* Number of descriptors in each vhost-net virtqueue */
>>> +#define VHOST_NDESCS		128
>>> +
>>> +/* Bytes of pkt_buf backing one from-guest descriptor: a maximum size frame
>>> + * plus the virtio-net header the kernel writes in front of it
>>> + */
>>> +#define VHOST_DESC_BYTES	(L2_MAX_LEN_PASTA +			\
>>> +				 sizeof(struct virtio_net_hdr_mrg_rxbuf))
>>> +
>>> +/* One maximum size frame per vhost-net descriptor */bbb
>>> +#define PKT_BUF_BYTES		(VHOST_NDESCS * VHOST_DESC_BYTES)
>>
>> 128 * (65535 + 12) = 8390016
>>
>> but we have in passt.c
>>
>> madvise(pkt_buf, sizeof(pkt_buf), MADV_HUGEPAGE);
>>
>> originaly we had:
>>
>> 2dbed699e78e ("passt: Align pkt_buf to PAGE_SIZE (start and size), try to fit in huge pages")
>>
>> And your change is reverting the logic of:
>>
>> b6945e055376 ("Simplify sizing of pkt_buf")
>>
> 
> Hmm, i see the reasoning behind why it was this way before now.
> Generally speaking, i think it's pretty unlikely that the there will be
> a time where the packet buffer will be completely full (the kernel
> queued 128 packets and i didn't process any). Only in this case would
> the fact that this buffer is 8MB and doesn't have space for the
> virtio_net_mrg_rxbuf cause problems. So maybe we can just put it back to
> be 8MB. what do you think ?

I think we can keep the original value.

> 
>>
>>> +		ret.iov_len = sizeof(struct virtio_net_hdr_mrg_rxbuf);
>>> +	} else {
>>> +		ret.iov_len = c->mode == MODE_PASST ? sizeof(thdr->vnet_len) : 0;
>>> +	};
>>
>> no need for the semicolon.
>>
>> This change should be in PATCH 1
> 
> This won't work unfortunately. Since this change depends on the fields
> added to the context. the c->vhost.fd field

I was speaking about the sizeof(thdr->vnet_len)

Thanks,
Laurent>>
>>> +
>>> +	return ret;
>>>    }
>>>    
>>>    /**
> 


  reply	other threads:[~2026-09-14  6:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 21:28 [PATCH 0/7] Add vhost-net kernel support " aerosouund
2026-09-04 21:28 ` [PATCH 1/7] tap: Move the tap_hdr file to a separate file aerosouund
2026-09-05  1:52   ` David Gibson
2026-09-09  8:47   ` Laurent Vivier
2026-09-09  9:10     ` David Gibson
2026-09-09  9:42       ` Laurent Vivier
2026-09-04 21:28 ` [PATCH 2/7] conf: Add context fields, epoll types and --vhost-kernel flag to pasta aerosouund
2026-09-09 12:35   ` Laurent Vivier
2026-09-12 10:57     ` Ammar Yasser
2026-09-14  6:56       ` Laurent Vivier [this message]
2026-09-04 21:28 ` [PATCH 3/7] virtio: Add the pasta vhost-net interface and implementation aerosouund
2026-09-09 15:13   ` Laurent Vivier
2026-09-04 21:28 ` [PATCH 4/7] tap: Implement the pasta vhost-net from-guest path aerosouund
2026-09-04 21:28 ` [PATCH 5/7] tap, tcp, udp: Prepare the to-guest path for vhost-net aerosouund
2026-09-04 21:28 ` [PATCH 6/7] tap: Implement the pasta vhost-net to-guest path aerosouund
2026-09-16 14:00   ` Laurent Vivier
2026-09-04 21:28 ` [PATCH 7/7] tap/tcp: Replace tcp_payload_used with a ring buffer style index aerosouund
2026-09-16 14:29   ` Laurent Vivier
2026-09-05 16:25 ` [PATCH 2/7] conf: Add context fields, epoll types and --vhost-kernel flag to pasta aerosouund
2026-09-05 16:25   ` [PATCH 3/7] virtio: Add the pasta vhost-net interface and implementation aerosouund
2026-09-05 16:25   ` [PATCH 4/7] tap: Implement the pasta vhost-net from-guest path aerosouund
2026-09-05 16:25   ` [PATCH 7/7] tap/tcp: Replace tcp_payload_used with a ring buffer style index aerosouund

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=44fddd18-43c3-4836-86cc-c24be2c7169f@redhat.com \
    --to=lvivier@redhat.com \
    --cc=aerosound161@gmail.com \
    --cc=eperezma@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).