* [PATCH trivial] tcp_vu, udp_vu: Fix comment headers for header length functions
@ 2026-02-24 12:22 Laurent Vivier
2026-02-24 15:24 ` Stefano Brivio
0 siblings, 1 reply; 4+ messages in thread
From: Laurent Vivier @ 2026-02-24 12:22 UTC (permalink / raw)
To: passt-dev; +Cc: Laurent Vivier
The comment headers for tcp_vu_hdrlen() and udp_vu_hdrlen() described
the return value as "the size of the header in level 2 frame", but
these functions also include the virtio net header, which is not part
of the L2 frame.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
tcp_vu.c | 4 ++--
udp_vu.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tcp_vu.c b/tcp_vu.c
index 94169c21f700..8908d376a7dd 100644
--- a/tcp_vu.c
+++ b/tcp_vu.c
@@ -40,10 +40,10 @@ static struct vu_virtq_element elem[VIRTQUEUE_MAX_SIZE];
static int head[VIRTQUEUE_MAX_SIZE + 1];
/**
- * tcp_vu_hdrlen() - return the size of the header in level 2 frame (TCP)
+ * tcp_vu_hdrlen() - Return the size of virtio net and L2 headers (TCP)
* @v6: Set for IPv6 packet
*
- * Return: return the size of the header
+ * Return: total size of virtio net header, Ethernet, IP and TCP headers
*/
static size_t tcp_vu_hdrlen(bool v6)
{
diff --git a/udp_vu.c b/udp_vu.c
index d190fef82d49..dd3f8e9272ff 100644
--- a/udp_vu.c
+++ b/udp_vu.c
@@ -37,10 +37,10 @@ static struct iovec iov_vu [VIRTQUEUE_MAX_SIZE];
static struct vu_virtq_element elem [VIRTQUEUE_MAX_SIZE];
/**
- * udp_vu_hdrlen() - return the size of the header in level 2 frame (UDP)
+ * udp_vu_hdrlen() - Return the size of virtio net and L2 headers (UDP)
* @v6: Set for IPv6 packet
*
- * Return: return the size of the header
+ * Return: total size of virtio net header, Ethernet, IP and UDP headers
*/
static size_t udp_vu_hdrlen(bool v6)
{
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH trivial] tcp_vu, udp_vu: Fix comment headers for header length functions
2026-02-24 12:22 [PATCH trivial] tcp_vu, udp_vu: Fix comment headers for header length functions Laurent Vivier
@ 2026-02-24 15:24 ` Stefano Brivio
2026-02-24 15:26 ` Laurent Vivier
0 siblings, 1 reply; 4+ messages in thread
From: Stefano Brivio @ 2026-02-24 15:24 UTC (permalink / raw)
To: Laurent Vivier; +Cc: passt-dev
On Tue, 24 Feb 2026 13:22:27 +0100
Laurent Vivier <lvivier@redhat.com> wrote:
> The comment headers for tcp_vu_hdrlen() and udp_vu_hdrlen() described
> the return value as "the size of the header in level 2 frame", but
> these functions also include the virtio net header, which is not part
> of the L2 frame.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> tcp_vu.c | 4 ++--
> udp_vu.c | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tcp_vu.c b/tcp_vu.c
> index 94169c21f700..8908d376a7dd 100644
> --- a/tcp_vu.c
> +++ b/tcp_vu.c
> @@ -40,10 +40,10 @@ static struct vu_virtq_element elem[VIRTQUEUE_MAX_SIZE];
> static int head[VIRTQUEUE_MAX_SIZE + 1];
>
> /**
> - * tcp_vu_hdrlen() - return the size of the header in level 2 frame (TCP)
> + * tcp_vu_hdrlen() - Return the size of virtio net and L2 headers (TCP)
Thanks, I think that this, plus the line changed below, makes it clear.
What I still find confusing is: "L2 headers (TCP)". If I see this
together with udp_vu_hdrlen() I understand what you mean, but
otherwise I'd ask myself what TCP has to do with Layer-2...
I tried rephrasing it a bit, what do you think about:
* tcp_vu_hdrlen() - Sum size of all headers, from TCP to virtio-net
> * @v6: Set for IPv6 packet
> *
> - * Return: return the size of the header
> + * Return: total size of virtio net header, Ethernet, IP and TCP headers
...and changing this to "virtio-net" (not a very official name but it
seems to be widely used, more than "virtio net"...)?
If you're fine with it (same for UDP) I would change it and apply. I'm
not exactly proud of this either, so if you or somebody else has better
ideas...
> */
> static size_t tcp_vu_hdrlen(bool v6)
> {
> diff --git a/udp_vu.c b/udp_vu.c
> index d190fef82d49..dd3f8e9272ff 100644
> --- a/udp_vu.c
> +++ b/udp_vu.c
> @@ -37,10 +37,10 @@ static struct iovec iov_vu [VIRTQUEUE_MAX_SIZE];
> static struct vu_virtq_element elem [VIRTQUEUE_MAX_SIZE];
>
> /**
> - * udp_vu_hdrlen() - return the size of the header in level 2 frame (UDP)
> + * udp_vu_hdrlen() - Return the size of virtio net and L2 headers (UDP)
> * @v6: Set for IPv6 packet
> *
> - * Return: return the size of the header
> + * Return: total size of virtio net header, Ethernet, IP and UDP headers
> */
> static size_t udp_vu_hdrlen(bool v6)
> {
--
Stefano
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH trivial] tcp_vu, udp_vu: Fix comment headers for header length functions
2026-02-24 15:24 ` Stefano Brivio
@ 2026-02-24 15:26 ` Laurent Vivier
2026-02-24 17:57 ` Stefano Brivio
0 siblings, 1 reply; 4+ messages in thread
From: Laurent Vivier @ 2026-02-24 15:26 UTC (permalink / raw)
To: Stefano Brivio, Laurent Vivier; +Cc: passt-dev
On 2/24/26 16:24, Stefano Brivio wrote:
> On Tue, 24 Feb 2026 13:22:27 +0100
> Laurent Vivier <lvivier@redhat.com> wrote:
>
>> The comment headers for tcp_vu_hdrlen() and udp_vu_hdrlen() described
>> the return value as "the size of the header in level 2 frame", but
>> these functions also include the virtio net header, which is not part
>> of the L2 frame.
>>
>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>> ---
>> tcp_vu.c | 4 ++--
>> udp_vu.c | 4 ++--
>> 2 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/tcp_vu.c b/tcp_vu.c
>> index 94169c21f700..8908d376a7dd 100644
>> --- a/tcp_vu.c
>> +++ b/tcp_vu.c
>> @@ -40,10 +40,10 @@ static struct vu_virtq_element elem[VIRTQUEUE_MAX_SIZE];
>> static int head[VIRTQUEUE_MAX_SIZE + 1];
>>
>> /**
>> - * tcp_vu_hdrlen() - return the size of the header in level 2 frame (TCP)
>> + * tcp_vu_hdrlen() - Return the size of virtio net and L2 headers (TCP)
>
> Thanks, I think that this, plus the line changed below, makes it clear.
>
> What I still find confusing is: "L2 headers (TCP)". If I see this
> together with udp_vu_hdrlen() I understand what you mean, but
> otherwise I'd ask myself what TCP has to do with Layer-2...
>
> I tried rephrasing it a bit, what do you think about:
>
> * tcp_vu_hdrlen() - Sum size of all headers, from TCP to virtio-net
>
>> * @v6: Set for IPv6 packet
>> *
>> - * Return: return the size of the header
>> + * Return: total size of virtio net header, Ethernet, IP and TCP headers
>
> ...and changing this to "virtio-net" (not a very official name but it
> seems to be widely used, more than "virtio net"...)?
>
> If you're fine with it (same for UDP) I would change it and apply. I'm
> not exactly proud of this either, so if you or somebody else has better
> ideas...
I'm fine with it, go ahead...
Thanks,
Laurent
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH trivial] tcp_vu, udp_vu: Fix comment headers for header length functions
2026-02-24 15:26 ` Laurent Vivier
@ 2026-02-24 17:57 ` Stefano Brivio
0 siblings, 0 replies; 4+ messages in thread
From: Stefano Brivio @ 2026-02-24 17:57 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Laurent Vivier, passt-dev
On Tue, 24 Feb 2026 16:26:59 +0100
Laurent Vivier <laurent@vivier.eu> wrote:
> On 2/24/26 16:24, Stefano Brivio wrote:
> > On Tue, 24 Feb 2026 13:22:27 +0100
> > Laurent Vivier <lvivier@redhat.com> wrote:
> >
> >> The comment headers for tcp_vu_hdrlen() and udp_vu_hdrlen() described
> >> the return value as "the size of the header in level 2 frame", but
> >> these functions also include the virtio net header, which is not part
> >> of the L2 frame.
> >>
> >> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> >> ---
> >> tcp_vu.c | 4 ++--
> >> udp_vu.c | 4 ++--
> >> 2 files changed, 4 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/tcp_vu.c b/tcp_vu.c
> >> index 94169c21f700..8908d376a7dd 100644
> >> --- a/tcp_vu.c
> >> +++ b/tcp_vu.c
> >> @@ -40,10 +40,10 @@ static struct vu_virtq_element elem[VIRTQUEUE_MAX_SIZE];
> >> static int head[VIRTQUEUE_MAX_SIZE + 1];
> >>
> >> /**
> >> - * tcp_vu_hdrlen() - return the size of the header in level 2 frame (TCP)
> >> + * tcp_vu_hdrlen() - Return the size of virtio net and L2 headers (TCP)
> >
> > Thanks, I think that this, plus the line changed below, makes it clear.
> >
> > What I still find confusing is: "L2 headers (TCP)". If I see this
> > together with udp_vu_hdrlen() I understand what you mean, but
> > otherwise I'd ask myself what TCP has to do with Layer-2...
> >
> > I tried rephrasing it a bit, what do you think about:
> >
> > * tcp_vu_hdrlen() - Sum size of all headers, from TCP to virtio-net
> >
> >> * @v6: Set for IPv6 packet
> >> *
> >> - * Return: return the size of the header
> >> + * Return: total size of virtio net header, Ethernet, IP and TCP headers
> >
> > ...and changing this to "virtio-net" (not a very official name but it
> > seems to be widely used, more than "virtio net"...)?
> >
> > If you're fine with it (same for UDP) I would change it and apply. I'm
> > not exactly proud of this either, so if you or somebody else has better
> > ideas...
>
> I'm fine with it, go ahead...
Applied with changes as discussed.
--
Stefano
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-24 17:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-24 12:22 [PATCH trivial] tcp_vu, udp_vu: Fix comment headers for header length functions Laurent Vivier
2026-02-24 15:24 ` Stefano Brivio
2026-02-24 15:26 ` Laurent Vivier
2026-02-24 17:57 ` Stefano Brivio
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).