summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2005-01-27 21:49:54 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2005-01-27 21:49:54 +0000
commit5f0f04c48090e99bc33e4f9cb4831048348b7c68 (patch)
treead130f4e06ffe817a374988f9e5510b293e60a91 /sys
parent408476badc11d3e80fd0f3c575d00aa650bfdc61 (diff)
align the buffer when it is allocated, rather than realign the data in it
after we recieve it. the crc is little endian, so always transmit it in that byteorder. this lets me talk to a zaurus with a sparc64. ok drahn@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/if_cdce.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c
index 8e4eaf745d9..e6a24ba819f 100644
--- a/sys/dev/usb/if_cdce.c
+++ b/sys/dev/usb/if_cdce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cdce.c,v 1.7 2005/01/23 03:32:35 drahn Exp $ */
+/* $OpenBSD: if_cdce.c,v 1.8 2005/01/27 21:49:53 dlg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com>
@@ -544,6 +544,8 @@ cdce_newbuf(struct cdce_softc *sc, struct cdce_chain *c, struct mbuf *m)
m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
m_new->m_data = m_new->m_ext.ext_buf;
}
+
+ m_adj(m_new, ETHER_ALIGN);
c->cdce_mbuf = m_new;
return (0);
}
@@ -645,12 +647,6 @@ cdce_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
ifp->if_ipackets++;
-#ifdef __STRICT_ALIGNMENT
- bcopy(m->m_data, m->m_data + ETHER_ALIGN,
- total_len);
- m->m_data += ETHER_ALIGN;
-#endif
-
m->m_pkthdr.len = m->m_len = total_len;
m->m_pkthdr.rcvif = ifp;
@@ -828,5 +824,5 @@ cdce_crc32(const void *buf, size_t size)
while (size--)
crc = cdce_crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
- return (crc ^ ~0U);
+ return (htole32(crc) ^ ~0U);
}