public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] udp_vu: update segment size
@ 2024-12-04 15:33 Laurent Vivier
  2024-12-04 16:58 ` Stefano Brivio
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Vivier @ 2024-12-04 15:33 UTC (permalink / raw)
  To: passt-dev; +Cc: Laurent Vivier

In udp_vu_sock_recv(), collect a segment with a size defined to
IP_MAX_MTU + ETH_HLEN + sizeof(struct virtio_net_hdr_mrg_rxbuf)

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 udp_vu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/udp_vu.c b/udp_vu.c
index 9c697f3be247..41235101b69e 100644
--- a/udp_vu.c
+++ b/udp_vu.c
@@ -104,7 +104,8 @@ static int udp_vu_sock_recv(const struct ctx *c, int s, uint32_t events,
 	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,
+			     IP_MAX_MTU + ETH_HLEN +
+			     sizeof(struct virtio_net_hdr_mrg_rxbuf),
 			     NULL);
 	if (iov_cnt == 0)
 		return 0;
-- 
@@ -104,7 +104,8 @@ static int udp_vu_sock_recv(const struct ctx *c, int s, uint32_t events,
 	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,
+			     IP_MAX_MTU + ETH_HLEN +
+			     sizeof(struct virtio_net_hdr_mrg_rxbuf),
 			     NULL);
 	if (iov_cnt == 0)
 		return 0;
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] udp_vu: update segment size
  2024-12-04 15:33 [PATCH] udp_vu: update segment size Laurent Vivier
@ 2024-12-04 16:58 ` Stefano Brivio
  2024-12-05  1:36   ` David Gibson
  0 siblings, 1 reply; 3+ messages in thread
From: Stefano Brivio @ 2024-12-04 16:58 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: passt-dev

On Wed,  4 Dec 2024 16:33:21 +0100
Laurent Vivier <lvivier@redhat.com> wrote:

> In udp_vu_sock_recv(), collect a segment with a size defined to
> IP_MAX_MTU + ETH_HLEN + sizeof(struct virtio_net_hdr_mrg_rxbuf)

Can you briefly explain why, and what's the problem otherwise?

-- 
Stefano


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] udp_vu: update segment size
  2024-12-04 16:58 ` Stefano Brivio
@ 2024-12-05  1:36   ` David Gibson
  0 siblings, 0 replies; 3+ messages in thread
From: David Gibson @ 2024-12-05  1:36 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: Laurent Vivier, passt-dev

[-- Attachment #1: Type: text/plain, Size: 670 bytes --]

On Wed, Dec 04, 2024 at 05:58:06PM +0100, Stefano Brivio wrote:
> On Wed,  4 Dec 2024 16:33:21 +0100
> Laurent Vivier <lvivier@redhat.com> wrote:
> 
> > In udp_vu_sock_recv(), collect a segment with a size defined to
> > IP_MAX_MTU + ETH_HLEN + sizeof(struct virtio_net_hdr_mrg_rxbuf)
> 
> Can you briefly explain why, and what's the problem otherwise?

The original version double counted the IP header: IP_MAX_MTU includes
the IP header, and so did hdrlen.


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-05  2:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-04 15:33 [PATCH] udp_vu: update segment size Laurent Vivier
2024-12-04 16:58 ` Stefano Brivio
2024-12-05  1:36   ` David Gibson

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