diff options
author | 2019-09-18 23:52:32 +0000 | |
---|---|---|
committer | 2019-09-18 23:52:32 +0000 | |
commit | bd3bb04caf4d0f71fc37ba9a218f541c111932dd (patch) | |
tree | fec91f1b637950fced8bc890589ad91e0e88b665 /sys/dev/pci/if_ipw.c | |
parent | remove old log options 'log update/all' that were replaced with 'log (diff) | |
download | wireguard-openbsd-bd3bb04caf4d0f71fc37ba9a218f541c111932dd.tar.xz wireguard-openbsd-bd3bb04caf4d0f71fc37ba9a218f541c111932dd.zip |
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_ipw.c')
-rw-r--r-- | sys/dev/pci/if_ipw.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/sys/dev/pci/if_ipw.c b/sys/dev/pci/if_ipw.c index 579db1f9780..b0e8a3e778e 100644 --- a/sys/dev/pci/if_ipw.c +++ b/sys/dev/pci/if_ipw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ipw.c,v 1.124 2019/09/12 12:55:07 stsp Exp $ */ +/* $OpenBSD: if_ipw.c,v 1.125 2019/09/18 23:52:32 dlg Exp $ */ /*- * Copyright (c) 2004-2008 @@ -879,7 +879,6 @@ ipw_data_intr(struct ipw_softc *sc, struct ipw_status *status, #if NBPFILTER > 0 if (sc->sc_drvbpf != NULL) { - struct mbuf mb; struct ipw_rx_radiotap_header *tap = &sc->sc_rxtap; tap->wr_flags = 0; @@ -887,13 +886,8 @@ ipw_data_intr(struct ipw_softc *sc, struct ipw_status *status, tap->wr_chan_freq = htole16(ic->ic_ibss_chan->ic_freq); tap->wr_chan_flags = htole16(ic->ic_ibss_chan->ic_flags); - 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 @@ -1156,20 +1150,14 @@ ipw_tx_start(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni) #if NBPFILTER > 0 if (sc->sc_drvbpf != NULL) { - struct mbuf mb; struct ipw_tx_radiotap_header *tap = &sc->sc_txtap; tap->wt_flags = 0; tap->wt_chan_freq = htole16(ic->ic_ibss_chan->ic_freq); tap->wt_chan_flags = htole16(ic->ic_ibss_chan->ic_flags); - mb.m_data = (caddr_t)tap; - mb.m_len = sc->sc_txtap_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_OUT); + bpf_mtap_hdr(sc->sc_drvbpf, tap, sc->sc_txtap_len, + m, BPF_DIRECTION_OUT, NULL); } #endif |