]> 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, 29 Jan 2024 05:08:55 +0000 (22:08 -0700)
commit3be59adbb5a2ae7600d46432d3bc82286e507e95
treeca4a1025973a6b0c91fd61ff29ff397caeb764d2
parent2b92b754f18ce86e11e56f91c73aae8d89be80cc
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
sys/dev/virtio/network/if_vtnet.c