-/* $OpenBSD: bwfm.c,v 1.39 2018/02/08 05:00:38 patrick Exp $ */
+/* $OpenBSD: bwfm.c,v 1.40 2018/02/11 05:13:07 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
* Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se>
void
bwfm_proto_bcdc_rx(struct bwfm_softc *sc, struct mbuf *m)
{
+#ifdef __STRICT_ALIGNMENT
+ struct ieee80211com *ic = &sc->sc_ic;
+ struct ifnet *ifp = &ic->ic_if;
+#endif
struct bwfm_proto_bcdc_hdr *hdr;
hdr = mtod(m, struct bwfm_proto_bcdc_hdr *);
return;
}
m_adj(m, sizeof(*hdr) + (hdr->data_offset << 2));
+
+#ifdef __STRICT_ALIGNMENT
+ /* Remaining data is an ethernet packet, so align. */
+ if ((mtod(m, paddr_t) & 0x3) != ETHER_ALIGN) {
+ struct mbuf *m0;
+ m0 = m_devget(mtod(m, caddr_t), m->m_len, ETHER_ALIGN);
+ m_freem(m);
+ if (m0 == NULL) {
+ ifp->if_ierrors++;
+ return;
+ }
+ m = m0;
+ }
+#endif
+
bwfm_rx(sc, m);
}
-/* $OpenBSD: if_bwfm_sdio.c,v 1.5 2018/02/11 05:07:36 patrick Exp $ */
+/* $OpenBSD: if_bwfm_sdio.c,v 1.6 2018/02/11 05:13:07 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
* Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se>
m = bwfm_sdio_newbuf();
if (m == NULL)
break;
- m_adj(m, ETHER_ALIGN);
if (flen - off > m->m_len) {
printf("%s: frame bigger than anticipated\n",
DEVNAME(sc));
-/* $OpenBSD: if_bwfm_usb.c,v 1.10 2018/02/08 05:00:38 patrick Exp $ */
+/* $OpenBSD: if_bwfm_usb.c,v 1.11 2018/02/11 05:13:07 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
* Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se>
}
m->m_len = m->m_pkthdr.len = MCLBYTES;
- m_adj(m, ETHER_ALIGN);
return (m);
}