summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>1998-01-27 23:26:21 +0000
committerthorpej <thorpej@NetBSD.org>1998-01-27 23:26:21 +0000
commitcdec42b6a0e04b6be112c285d204a9df900869cb (patch)
tree573a8c9b44f7c3242afb35baa625f54004259b1f /sys/dev
parent0c86a9c11eedfc9ece6fa76cea8bba5a8703e90c (diff)
Fudge the start of the data pointer of the first mbuf in the chain when
reading a packet, ensuring that the data after the Ethernet header will be aligned. Part of PR #4595, from Andreas Johansson <ajo@wopr.campus.luth.se>
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/dp8390.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/dev/ic/dp8390.c b/sys/dev/ic/dp8390.c
index 8b0e0daefee..fbc6998944d 100644
--- a/sys/dev/ic/dp8390.c
+++ b/sys/dev/ic/dp8390.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dp8390.c,v 1.10 1997/11/03 00:19:41 thorpej Exp $ */
+/* $NetBSD: dp8390.c,v 1.11 1998/01/27 23:26:21 thorpej Exp $ */
/*
* Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@@ -1076,6 +1076,18 @@ dp8390_get(sc, src, total_len)
}
len = MCLBYTES;
}
+
+ /*
+ * Make sure the data after the Ethernet header is aligned.
+ */
+ if (top == NULL) {
+ caddr_t newdata = (caddr_t)
+ ALIGN(m->m_data + sizeof(struct ether_header)) -
+ sizeof(struct ether_header);
+ len -= newdata - m->m_data;
+ m->m_data = newdata;
+ }
+
m->m_len = len = min(total_len, len);
if (sc->ring_copy)
src = (*sc->ring_copy)(sc, src, mtod(m, caddr_t), len);