diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2019-09-18 23:52:33 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2019-09-18 23:52:33 +0000 |
commit | 22d164e7696df2961cc7a4096fe32de4bf896f00 (patch) | |
tree | 0449e50d889f9cf9bc858aab5c5e288e23d46e6e /sys/dev/pci/if_iwi.c | |
parent | d73f1b98679b18a9a94da26db01bb9602a548fb8 (diff) |
don't hand roll bpf_mtap_hdr functionality, just use bpf_mtap_hdr.
the radiotap code prepends a big struct to the packets, and wires
them up with the packet by putting an mbuf on the stack and using
that as the head of an mbuf chain. bpf_mtap_hdr does the chain head
thing for us, so shrink this code by calling the bpf function.
there's some other drivers that do this too, so if anyone wants a
free commit they should go looking in the other wireless drivers
and do the same change.
ok claudio@
Diffstat (limited to 'sys/dev/pci/if_iwi.c')
-rw-r--r-- | sys/dev/pci/if_iwi.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c index be8d57baecd..8b5f9119a60 100644 --- a/sys/dev/pci/if_iwi.c +++ b/sys/dev/pci/if_iwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwi.c,v 1.141 2019/09/12 12:55:07 stsp Exp $ */ +/* $OpenBSD: if_iwi.c,v 1.142 2019/09/18 23:52:32 dlg Exp $ */ /*- * Copyright (c) 2004-2008 @@ -923,7 +923,6 @@ iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_data *data, #if NBPFILTER > 0 if (sc->sc_drvbpf != NULL) { - struct mbuf mb; struct iwi_rx_radiotap_header *tap = &sc->sc_rxtap; tap->wr_flags = 0; @@ -937,13 +936,8 @@ iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_data *data, if (frame->antenna & 0x40) tap->wr_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; - mb.m_data = (caddr_t)tap; - mb.m_len = sc->sc_rxtap_len; - mb.m_next = m; - mb.m_nextpkt = NULL; - mb.m_type = 0; - mb.m_flags = 0; - bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_IN); + bpf_mtap_hdr(sc->sc_drvbpf, tap, sc->sc_rxtap_len, + m, BPF_DIRECTION_IN, NULL); } #endif @@ -1267,20 +1261,14 @@ iwi_tx_start(struct ifnet *ifp, struct mbuf *m0, struct ieee80211_node *ni) #if NBPFILTER > 0 if (sc->sc_drvbpf != NULL) { - struct mbuf mb; struct iwi_tx_radiotap_header *tap = &sc->sc_txtap; tap->wt_flags = 0; tap->wt_chan_freq = htole16(ic->ic_bss->ni_chan->ic_freq); tap->wt_chan_flags = htole16(ic->ic_bss->ni_chan->ic_flags); - mb.m_data = (caddr_t)tap; - mb.m_len = sc->sc_txtap_len; - mb.m_next = m0; - mb.m_nextpkt = NULL; - mb.m_type = 0; - mb.m_flags = 0; - bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_OUT); + bpf_mtap_hdr(sc->sc_drvbpf, tap, sc->sc_txtap_len, + m0, BPF_DIRECTION_OUT, NULL); } #endif |