summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2018-07-06 12:30:37 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2018-07-06 12:30:37 +0000
commit86da52e00e81e99701b9b8a0a15ea9d660d8f110 (patch)
treef518db23a114e4499f9800cebf4f3dec3996831f /sys/dev/ic
parent9185485aa2418852a0923a06956c955154d9d662 (diff)
Move mbuf alignment for strict aligned architectures from the BCDC
specific receive path into the generic receive path, since PCIe supplied packets can be misaligned as well.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/bwfm.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c
index a59a0f5756d..b7a5f98041a 100644
--- a/sys/dev/ic/bwfm.c
+++ b/sys/dev/ic/bwfm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bwfm.c,v 1.49 2018/07/04 12:57:18 patrick Exp $ */
+/* $OpenBSD: bwfm.c,v 1.50 2018/07/06 12:30:36 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
* Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se>
@@ -1426,10 +1426,6 @@ bwfm_proto_bcdc_rxctl(struct bwfm_softc *sc, char *buf, size_t len)
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 *);
@@ -1443,20 +1439,6 @@ bwfm_proto_bcdc_rx(struct bwfm_softc *sc, struct mbuf *m)
}
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_dup_pkt(m, ETHER_ALIGN, M_WAITOK);
- m_freem(m);
- if (m0 == NULL) {
- ifp->if_ierrors++;
- return;
- }
- m = m0;
- }
-#endif
-
bwfm_rx(sc, m);
}
@@ -1881,6 +1863,20 @@ bwfm_rx(struct bwfm_softc *sc, struct mbuf *m)
struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct ieee80211_node *ni;
+#ifdef __STRICT_ALIGNMENT
+ /* Remaining data is an ethernet packet, so align. */
+ if ((mtod(m, paddr_t) & 0x3) != ETHER_ALIGN) {
+ struct mbuf *m0;
+ m0 = m_dup_pkt(m, ETHER_ALIGN, M_WAITOK);
+ m_freem(m);
+ if (m0 == NULL) {
+ ifp->if_ierrors++;
+ return;
+ }
+ m = m0;
+ }
+#endif
+
if (m->m_len >= sizeof(e->ehdr) &&
ntohs(e->ehdr.ether_type) == BWFM_ETHERTYPE_LINK_CTL &&
memcmp(BWFM_BRCM_OUI, e->hdr.oui, sizeof(e->hdr.oui)) == 0 &&