Page MenuHomeFreeBSD

D43654.1781226083.diff
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

D43654.1781226083.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
@@ -89,6 +89,12 @@
#include <machine/in_cksum.h>
#endif
+#ifdef __NO_STRICT_ALIGNMENT
+#define VTNET_ETHER_ALIGN 0
+#else /* Strict alignment */
+#define VTNET_ETHER_ALIGN 2
+#endif
+
static int vtnet_modevent(module_t, int, void *);
static int vtnet_probe(device_t);
@@ -1223,15 +1229,13 @@
} 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;
+ if (VTNET_ETHER_ALIGN != 0 && sc->vtnet_hdr_size % 4 == 0) {
+ framesz += VTNET_ETHER_ALIGN;
}
-#endif
if (framesz <= MCLBYTES)
return (MCLBYTES);
@@ -1543,15 +1547,13 @@
}
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);
+ if (VTNET_ETHER_ALIGN != 0 && sc->vtnet_hdr_size % 4 == 0) {
+ m_adj(m, VTNET_ETHER_ALIGN);
}
-#endif
if (m_head != NULL) {
m_tail->m_next = m;
m_tail = m;
@@ -1578,14 +1580,12 @@
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
+ if (VTNET_ETHER_ALIGN != 0 && sc->vtnet_hdr_size % 4 == 0)
+ clustersz -= VTNET_ETHER_ALIGN;
m_prev = NULL;
m_tail = NULL;

File Metadata

Mime Type
text/plain
Expires
Fri, Jun 12, 1:01 AM (15 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28878672
Default Alt Text
D43654.1781226083.diff (1 KB)

Event Timeline