HomeFreeBSD

vtnet: Adjust for ethernet alignment.

Description

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.

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

(cherry picked from commit 3be59adbb5a2ae7600d46432d3bc82286e507e95)
(cherry picked from commit 778eb6e1f6668864a6eddd2f6f9bcc2aa26344f3)

Approved-by: re (cperciva)

Details

Provenance
impAuthored on Jan 29 2024, 5:08 AM
Reviewer
bryanv
Differential Revision
D43224: vtnet: Adjust for ethernet alignment.
Parents
rGda2e35b0ec99: smartpqi: Drop spinlock before freeing memory
Branches
Unknown
Tags
Unknown