Smaller, cleaner code for aligning struct ip on receipt.

This commit is contained in:
cjs 1997-04-23 08:15:03 +00:00
parent 8b76947495
commit 9be8b65e23
1 changed files with 7 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: elink3.c,v 1.24 1997/04/22 21:19:11 cjs Exp $ */
/* $NetBSD: elink3.c,v 1.25 1997/04/23 08:15:03 cjs Exp $ */
/*
* Copyright (c) 1996, 1997 Jonathan Stone <jonathan@NetBSD.org>
@ -1262,7 +1262,6 @@ epget(sc, totlen)
bus_space_handle_t ioh = sc->sc_ioh;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
struct mbuf *top, **mp, *m;
u_long pad;
int len, remaining;
int sh;
@ -1316,15 +1315,13 @@ epget(sc, totlen)
len = MCLBYTES;
}
if (top == 0) {
/* align the struct ip header */
pad = ALIGN(sizeof(struct ether_header))
- sizeof(struct ether_header);
} else {
/* XXX do we really need this? */
pad = ALIGN(m->m_data) - (u_long) m->m_data;
/* align the struct ip header */
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_data += pad;
len -= pad;
remaining = len = min(totlen, len);
if (EP_IS_BUS_32(sc->bustype)) {
u_long offset = mtod(m, u_long);