summaryrefslogtreecommitdiff
path: root/sys/dev/isa/if_ed.c
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-09-26 21:07:19 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-09-26 21:07:19 +0000
commitb0fd7a95a95d0cd1f294136ab14f392af167bd7c (patch)
treebb7f3ce122c1f8d0c93fbeabb6a0887011993e3a /sys/dev/isa/if_ed.c
parentdd2c5fcd0f95a68c0e3a20238e4298e9a4434ec0 (diff)
Fix alignment for mips & other strict architectures, mostly used lance stuff.
Diffstat (limited to 'sys/dev/isa/if_ed.c')
-rw-r--r--sys/dev/isa/if_ed.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/sys/dev/isa/if_ed.c b/sys/dev/isa/if_ed.c
index 356bf0fd01b..20e53840f00 100644
--- a/sys/dev/isa/if_ed.c
+++ b/sys/dev/isa/if_ed.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ed.c,v 1.18 1996/08/02 11:15:52 niklas Exp $ */
+/* $OpenBSD: if_ed.c,v 1.19 1996/09/26 21:07:16 niklas Exp $ */
/* $NetBSD: if_ed.c,v 1.100 1996/05/12 23:52:19 mycroft Exp $ */
/*
@@ -2634,29 +2634,31 @@ ed_ring_copy(sc, src, dst, amount)
* as needed. Return pointer to last mbuf in chain.
* sc = ed info (softc)
* src = pointer in ed ring buffer
- * dst = pointer to last mbuf in mbuf chain to copy to
- * amount = amount of data to copy
+ * totlen = maximum packet size
*/
struct mbuf *
-edget(sc, src, total_len)
+edget(sc, src, totlen)
struct ed_softc *sc;
int src;
- u_short total_len;
+ int totlen;
{
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct mbuf *top, **mp, *m;
- int len;
+ int len, pad;
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == 0)
return 0;
+
m->m_pkthdr.rcvif = ifp;
- m->m_pkthdr.len = total_len;
- len = MHLEN;
+ m->m_pkthdr.len = totlen;
+ pad = ALIGN(sizeof(struct ether_header)) - sizeof(struct ether_header);
+ m->m_data += pad;
+ len = MHLEN - pad;
top = 0;
mp = &top;
- while (total_len > 0) {
+ while (totlen > 0) {
if (top) {
MGET(m, M_DONTWAIT, MT_DATA);
if (m == 0) {
@@ -2665,14 +2667,14 @@ edget(sc, src, total_len)
}
len = MLEN;
}
- if (total_len >= MINCLSIZE) {
+ if (top && totlen >= MINCLSIZE) {
MCLGET(m, M_DONTWAIT);
if (m->m_flags & M_EXT)
len = MCLBYTES;
}
- m->m_len = len = min(total_len, len);
+ m->m_len = len = min(totlen, len);
src = ed_ring_copy(sc, src, mtod(m, caddr_t), len);
- total_len -= len;
+ totlen -= len;
*mp = m;
mp = &m->m_next;
}