Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115509556
D43656.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D43656.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D43656: vtnet: Account for the padding when selecting allocation size
Attached
Detach File
Event Timeline
Log In to Comment