Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107106500
D43224.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
D43224.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
@@ -1534,6 +1534,15 @@
}
m->m_len = size;
+#ifndef __NO_STRICT_ALIGNMENT
+ /*
+ * Need to offset the mbuf if the header we're going to add
+ * will misalign.
+ */
+ if (sc->vtnet_hdr_size % 4 == 0) {
+ m_adj(m, ETHER_ALIGN);
+ }
+#endif
if (m_head != NULL) {
m_tail->m_next = m;
m_tail = m;
@@ -1560,6 +1569,14 @@
sc = rxq->vtnrx_sc;
clustersz = sc->vtnet_rx_clustersz;
+#ifndef __NO_STRICT_ALIGNMENT
+ /*
+ * Need to offset the mbuf if the header we're going to add will
+ * misalign, account for that here.
+ */
+ if (sc->vtnet_hdr_size % 4 == 0)
+ clustersz -= ETHER_ALIGN;
+#endif
m_prev = NULL;
m_tail = NULL;
@@ -1683,6 +1700,10 @@
header_inlined = vtnet_modern(sc) ||
(sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) != 0; /* TODO: ANY_LAYOUT */
+ /*
+ * Note: The mbuf has been already adjusted when we allocate it if we
+ * have to do strict alignment.
+ */
if (header_inlined)
error = sglist_append_mbuf(sg, m);
else {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 11, 5:15 AM (18 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15750623
Default Alt Text
D43224.diff (1 KB)
Attached To
Mode
D43224: vtnet: Adjust for ethernet alignment.
Attached
Detach File
Event Timeline
Log In to Comment