Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149263479
D43224.1789784922.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D43224.1789784922.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_ALIGN
+ /*
+ * Need to offset the mbuf if the header we're going to add
+ * will misalign.
+ */
+ if (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 (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 {
@@ -1907,8 +1928,8 @@
int error __diagused;
/*
- * Requeue the discarded mbuf. This should always be successful
- * since it was just dequeued.
+ * Requeue the discarded mbuf. This should always be successful since it
+ * was just dequeued.
*/
error = vtnet_rxq_enqueue_buf(rxq, m);
KASSERT(error == 0,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Sep 19, 2:28 AM (22 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29768793
Default Alt Text
D43224.1789784922.diff (1 KB)
Attached To
Mode
D43224: vtnet: Adjust for ethernet alignment.
Attached
Detach File
Event Timeline
Log In to Comment