]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
vtnet: Avoid ifdefs based on __NO_STRICT_ALIGNMENT
authorWarner Losh <imp@FreeBSD.org>
Mon, 5 Feb 2024 05:43:49 +0000 (22:43 -0700)
committerWarner Losh <imp@FreeBSD.org>
Mon, 19 Feb 2024 06:59:51 +0000 (23:59 -0700)
commit7c51748a443fb1259f68ac2df134b294441b2add
tree261b2aa5df5c8688dd1efa44063ebf82626b6753
parent67aff34d9ad00761b2e2b1197c4bc1e856bb6959
vtnet: Avoid ifdefs based on __NO_STRICT_ALIGNMENT

Some platforms require an adjustment of the ethernet hearders. Rather
than make this be on __NO_STRICT_ALIGNMENT being defined, define
VTNET_ETHER_ALIGN to be either 0 or ETHER_ALIGN (aka 2). Add a test to
the if statements to only do them when != 0. This eliminates the #ifdef
sprinkled in the code, still communicates the intent and gives the same
compiled results.

Sponsored by: Netflix
Reviewed by: bz, bryanv
Differential Revision: https://reviews.freebsd.org/D43654

(cherry picked from commit 0ea4b4084845bfeedc8c692e4d34252023b78cb3)
(cherry picked from commit 9ae56ea964c89284a998a501e6cf1b57d000d968)

Approved-by: re (cperciva)
sys/dev/virtio/network/if_vtnet.c