Re: git: 3be59adbb5a2 - main - vtnet: Adjust for ethernet alignment.

From: Bjoern A. Zeeb <bzeeb-lists_at_lists.zabbadoz.net>
Date: Mon, 29 Jan 2024 15:26:31 UTC
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