Page MenuHomeFreeBSD

D43656.diff
No OneTemporary

D43656.diff

diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c
--- a/sys/dev/virtio/network/if_vtnet.c
+++ b/sys/dev/virtio/network/if_vtnet.c
@@ -1223,6 +1223,15 @@
} else
framesz = sizeof(struct vtnet_rx_header);
framesz += sizeof(struct ether_vlan_header) + mtu;
+#ifndef __NO_STRICT_ALIGNMENT
+ /*
+ * Account for the offsetting we'll do elsewhere so we allocate the
+ * right size for the mtu.
+ */
+ if (sc->vtnet_hdr_size % 4 == 0) {
+ framesz += ETHER_ALIGN;
+ }
+#endif
if (framesz <= MCLBYTES)
return (MCLBYTES);
diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h
--- a/sys/dev/virtio/network/if_vtnetvar.h
+++ b/sys/dev/virtio/network/if_vtnetvar.h
@@ -232,7 +232,13 @@
*/
#define VTNET_VLAN_FILTER_NWORDS (4096 / 32)
-/* We depend on these being the same size (and same layout). */
+/*
+ * We depend on all of the hdr structures being even, and matching the standard
+ * length. As well, we depend on two being identally sized (with the same
+ * layout).
+ */
+CTASSERT(sizeof(struct virtio_net_hdr_v1) == 12);
+CTASSERT(sizeof(struct virtio_net_hdr) == 10);
CTASSERT(sizeof(struct virtio_net_hdr_mrg_rxbuf) ==
sizeof(struct virtio_net_hdr_v1));

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 25, 3:40 PM (17 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17788014
Default Alt Text
D43656.diff (1 KB)

Event Timeline