]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
vtnet: Adjust for ethernet alignment.
authorWarner Losh <imp@FreeBSD.org>
Mon, 29 Jan 2024 05:08:55 +0000 (22:08 -0700)
committerWarner Losh <imp@FreeBSD.org>
Mon, 19 Feb 2024 06:59:40 +0000 (23:59 -0700)
commitfbbfcab6b850fd0125633cc87575b54f0929c1a8
treeb60f60ef079c629106af436be1e91723e083f569
parentda2e35b0ec99e979963923ed6392b3e883f40eb2
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)
sys/dev/virtio/network/if_vtnet.c