HomeFreeBSD

vtnet: Account for the padding when selecting allocation size

Description

vtnet: Account for the padding when selecting allocation size

While we account for the padding in the length of the mbuf we use, we do
not account for it when we 'guess' the size of the mbuf to allocate
based in the MTU of the device. This leads to a situation where we might
fail if the mtu is close to a bucket size (say 2018) such that the added
padding would push us over the edge for a full-sized packet. mtu of 2018
is super rare (2016 and 2020 would both work), but fix it none-the-less.
It's a shame we can't just set VTNET_RX_HEADER_PAD to 2 in this case. The 4
seems hard-coded somewhere I've not found documented (I think it's in the
protocol given the comments about VIRTIO_F_ANY_LAYOUT).

Sponsored by: Netflix
Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D43656

(cherry picked from commit d9e0e42627613b56abf0f8fa1ad601e5690d775c)
(cherry picked from commit 1dc264a126b13e0e20b13bbcd69451c5d4b63f7c)

Approved-by: re (cperciva)

Details

Provenance
impAuthored on Feb 5 2024, 5:43 AM
Reviewer
bz
Differential Revision
D43656: vtnet: Account for the padding when selecting allocation size
Parents
rGfbbfcab6b850: vtnet: Adjust for ethernet alignment.
Branches
Unknown
Tags
Unknown