Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jan 2024 15:26:31 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
To:        Warner Losh <imp@FreeBSD.org>
Cc:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,  dev-commits-src-main@FreeBSD.org
Subject:   Re: git: 3be59adbb5a2 - main - vtnet: Adjust for ethernet  alignment.
Message-ID:  <n4s5849r-4q46-3628-qq82-p50q3698172n@yvfgf.mnoonqbm.arg>
In-Reply-To: <202401290514.40T5Eb1i061789@gitrepo.freebsd.org>
References:  <202401290514.40T5Eb1i061789@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 29 Jan 2024, Warner Losh wrote:

> The branch main has been updated by imp:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=3be59adbb5a2ae7600d46432d3bc82286e507e95
>
> commit 3be59adbb5a2ae7600d46432d3bc82286e507e95
> Author:     Warner Losh <imp@FreeBSD.org>
> AuthorDate: 2024-01-29 05:08:55 +0000
> Commit:     Warner Losh <imp@FreeBSD.org>
> CommitDate: 2024-01-29 05:08:55 +0000
>
>    vtnet: Adjust for ethernet alignment.
>
>    If the header that we add to the packet's size is 0 % 4 and we're
>    strictly aligning, then we need to adjust where we store the header so
>    the packet that follows will have it's struct ip header properly
>    aligned.  We do this on allocation (and when we check the length of the
>    mbufs in the lro_nomrg case). We can't just adjust the clustersz in the
>    softc, because it's also used to allocate the mbufs and it needs to be
>    the proper size for that. Since we otherwise use the size of the mbuf
>    (or sometimes the smaller size of the received packet) to compute how
>    much we can buffer, this ensures no overflows. The 2 byte adjustment
>    also does not affect how many packets we can receive in the lro_nomrg
>    case.


Doesn't this still include at least these two un-asserted/un-documented asumptions:

(a) mbuf space is large enough to hold 2 extra bytes?  Is this always
     the case?

(b) the struct sizes assigned to vtnet_hdr_size are not odd numbers of
     bytes?  Could add comments or CTASSERTs?


>    PR:                     271288
>    Sponsored by:           Netflix
>    Reviewed by:            bryanv
>    Differential Revision:  https://reviews.freebsd.org/D43224

-- 
Bjoern A. Zeeb                                                     r15:7



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?n4s5849r-4q46-3628-qq82-p50q3698172n>