Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src-draft/trunk]: src/sys/dev/pci Adjust to common bpf/radiotap handling in ...



details:   https://anonhg.NetBSD.org/src-all/rev/a2a800c9d195
branches:  trunk
changeset: 369291:a2a800c9d195
user:      Martin Husemann <martin%NetBSD.org@localhost>
date:      Sun Jun 06 14:27:00 2021 +0200

description:
Adjust to common bpf/radiotap handling in the new ieee80211 stack

diffstat:

 sys/dev/pci/if_rtwn.c    |  26 ++++++--------------------
 sys/dev/pci/if_rtwnreg.h |   1 -
 2 files changed, 6 insertions(+), 21 deletions(-)

diffs (88 lines):

diff -r 299e3be33198 -r a2a800c9d195 sys/dev/pci/if_rtwn.c
--- a/sys/dev/pci/if_rtwn.c     Sun Jun 06 13:17:19 2021 +0200
+++ b/sys/dev/pci/if_rtwn.c     Sun Jun 06 14:27:00 2021 +0200
@@ -396,6 +396,10 @@
        sc->sc_txtap.wt_ihdr.it_len = htole16(sc->sc_txtap_len);
        sc->sc_txtap.wt_ihdr.it_present = htole32(RTWN_TX_RADIOTAP_PRESENT);
 
+       /* let the stack know we support radiotap */
+       ic->ic_rh = &sc->sc_rxtapu.th.wr_ihdr;
+       ic->ic_th = &sc->sc_txtapu.th.wt_ihdr;
+
        SET(sc->sc_flags, RTWN_FLAG_ATTACHED);
        ieee80211_announce(ic);
 
@@ -1730,7 +1734,7 @@
        struct mbuf *m, *m1;
        uint8_t rate;
        int8_t rssi = 0;
-       int infosz, pktlen, shift, totlen, error, s;
+       int infosz, pktlen, shift, totlen, error;
 
        DPRINTFN(4, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
 
@@ -1834,9 +1838,7 @@
                m_adj(m, shift);
        wh = mtod(m, struct ieee80211_frame *);
 
-       s = splnet();
-
-       if (__predict_false(sc->sc_drvbpf != NULL)) {
+       if (__predict_false(ic->ic_flags_ext & IEEE80211_FEXT_BPF)) {
                struct rtwn_rx_radiotap_header *tap = &sc->sc_rxtap;
 
                tap->wr_flags = 0;
@@ -1866,15 +1868,12 @@
                tap->wr_dbm_antsignal = rssi;
                tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq);
                tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags);
-
-               bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_rxtap_len, m, BPF_D_IN);
        }
 
        ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh);
        if (ni != NULL) {
                if (ni->ni_vap == NULL) {
                        ieee80211_free_node(ni);
-                       splx(s);
                        return;
                }
 
@@ -1888,7 +1887,6 @@
                /* Managment frame */
                (void) ieee80211_input_all(ic, m, rssi, 0);
        }
-       splx(s);
 }
 
 static int
@@ -2078,18 +2076,6 @@
        data->m = m;
        data->ni = ni;
 
-       if (__predict_false(sc->sc_drvbpf != NULL)) {
-               struct rtwn_tx_radiotap_header *tap = &sc->sc_txtap;
-
-               tap->wt_flags = 0;
-               tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq);
-               tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
-               if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED)
-                       tap->wt_flags |= IEEE80211_RADIOTAP_F_WEP;
-
-               bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m, BPF_D_OUT);
-       }
-
        tx_ring->cur = (tx_ring->cur + 1) % RTWN_TX_LIST_COUNT;
        tx_ring->queued++;
 
diff -r 299e3be33198 -r a2a800c9d195 sys/dev/pci/if_rtwnreg.h
--- a/sys/dev/pci/if_rtwnreg.h  Sun Jun 06 13:17:19 2021 +0200
+++ b/sys/dev/pci/if_rtwnreg.h  Sun Jun 06 14:27:00 2021 +0200
@@ -196,7 +196,6 @@
        struct r92c_rom                 rom;
 
        uint32_t                        rf_chnlbw[R92C_MAX_CHAINS];
-       struct bpf_if                   *sc_drvbpf;
 
        union {
                struct rtwn_rx_radiotap_header th;



Home | Main Index | Thread Index | Old Index