PERFORCE change 136138 for review

Sam Leffler sam at FreeBSD.org
Mon Feb 25 02:54:58 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=136138

Change 136138 by sam at sam_ebb on 2008/02/25 02:54:10

	o require drivers to allocate the ifnet w/ IFT_IEEE80211
	  instead of blindly clobbering if_type in ieee80211_ifattach;
	  this is effectively a noop but codifies the fact drivers
	  are 802.11-specific
	o fix various radiotap bogosity in drivers; in particular
	  we no longer need to use bpfattach2 or maintain a private
	  sc_drvbpf as if_bpf isn't used by way of attaching as an
	  802.11 device (and not calling ether_ifattach)

Affected files ...

.. //depot/projects/vap/sys/dev/ath/if_ath.c#36 edit
.. //depot/projects/vap/sys/dev/ath/if_athvar.h#17 edit
.. //depot/projects/vap/sys/dev/ipw/if_ipw.c#8 edit
.. //depot/projects/vap/sys/dev/ipw/if_ipwvar.h#6 edit
.. //depot/projects/vap/sys/dev/iwi/if_iwi.c#13 edit
.. //depot/projects/vap/sys/dev/iwi/if_iwivar.h#8 edit
.. //depot/projects/vap/sys/dev/ral/rt2560.c#15 edit
.. //depot/projects/vap/sys/dev/ral/rt2560var.h#10 edit
.. //depot/projects/vap/sys/dev/ral/rt2661.c#12 edit
.. //depot/projects/vap/sys/dev/ral/rt2661var.h#7 edit
.. //depot/projects/vap/sys/dev/usb/if_rum.c#7 edit
.. //depot/projects/vap/sys/dev/usb/if_rumvar.h#5 edit
.. //depot/projects/vap/sys/dev/usb/if_ural.c#9 edit
.. //depot/projects/vap/sys/dev/usb/if_uralvar.h#7 edit
.. //depot/projects/vap/sys/dev/usb/if_zyd.c#8 edit
.. //depot/projects/vap/sys/dev/usb/if_zydreg.h#5 edit
.. //depot/projects/vap/sys/dev/wi/if_wi.c#11 edit
.. //depot/projects/vap/sys/dev/wi/if_wivar.h#8 edit
.. //depot/projects/vap/sys/dev/wpi/if_wpi.c#7 edit
.. //depot/projects/vap/sys/net80211/ieee80211.c#26 edit

Differences ...

==== //depot/projects/vap/sys/dev/ath/if_ath.c#36 (text+ko) ====

@@ -293,7 +293,7 @@
 
 	DPRINTF(sc, ATH_DEBUG_ANY, "%s: devid 0x%x\n", __func__, devid);
 
-	ifp = sc->sc_ifp = if_alloc(IFT_ETHER);
+	ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
 	if (ifp == NULL) {
 		device_printf(sc->sc_dev, "can not if_alloc()\n");
 		error = ENOSPC;
@@ -3754,14 +3754,13 @@
 }
 
 static int
-ath_rx_tap(struct ath_softc *sc, struct mbuf *m,
+ath_rx_tap(struct ifnet *ifp, struct mbuf *m,
 	const struct ath_rx_status *rs, u_int64_t tsf, int16_t nf)
 {
 #define	CHANNEL_HT	(CHANNEL_HT20|CHANNEL_HT40PLUS|CHANNEL_HT40MINUS)
+	struct ath_softc *sc = ifp->if_softc;
 	u_int8_t rix;
 
-	KASSERT(sc->sc_drvbpf != NULL, ("no tap"));
-
 	/*
 	 * Discard anything shorter than an ack or cts.
 	 */
@@ -3802,7 +3801,7 @@
 	sc->sc_rx_th.wr_antnoise = nf;
 	sc->sc_rx_th.wr_antenna = rs->rs_antenna;
 
-	bpf_mtap2(sc->sc_drvbpf, &sc->sc_rx_th, sc->sc_rx_th_len, m);
+	bpf_mtap2(ifp->if_bpf, &sc->sc_rx_th, sc->sc_rx_th_len, m);
 
 	return 1;
 #undef CHANNEL_HT
@@ -3951,14 +3950,14 @@
 			 * pass decrypt+mic errors but others may be
 			 * interesting (e.g. crc).
 			 */
-			if (bpf_peers_present(sc->sc_drvbpf) &&
+			if (bpf_peers_present(ifp->if_bpf) &&
 			    (rs->rs_status & sc->sc_monpass)) {
 				bus_dmamap_sync(sc->sc_dmat, bf->bf_dmamap,
 				    BUS_DMASYNC_POSTREAD);
 				/* NB: bpf needs the mbuf length setup */
 				len = rs->rs_datalen;
 				m->m_pkthdr.len = m->m_len = len;
-				(void) ath_rx_tap(sc, m, rs, tsf, nf);
+				(void) ath_rx_tap(ifp, m, rs, tsf, nf);
 			}
 			/* XXX pass MIC errors up for s/w reclaculation */
 			goto rx_next;
@@ -4015,8 +4014,8 @@
 
 		sc->sc_stats.ast_ant_rx[rs->rs_antenna]++;
 
-		if (bpf_peers_present(sc->sc_drvbpf) &&
-		    !ath_rx_tap(sc, m, rs, tsf, nf)) {
+		if (bpf_peers_present(ifp->if_bpf) &&
+		    !ath_rx_tap(ifp, m, rs, tsf, nf)) {
 			m_freem(m);		/* XXX reclaim */
 			goto rx_next;
 		}
@@ -4758,7 +4757,7 @@
 		ieee80211_dump_pkt(ic, mtod(m0, caddr_t), m0->m_len,
 			sc->sc_hwmap[txrate].ieeerate, -1);
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		u_int64_t tsf = ath_hal_gettsf64(ah);
 
 		sc->sc_tx_th.wt_tsf = htole64(tsf);
@@ -4771,8 +4770,7 @@
 		sc->sc_tx_th.wt_txpower = ni->ni_txpower;
 		sc->sc_tx_th.wt_antenna = sc->sc_txantenna;
 
-		bpf_mtap2(sc->sc_drvbpf,
-			&sc->sc_tx_th, sc->sc_tx_th_len, m0);
+		bpf_mtap2(ifp->if_bpf, &sc->sc_tx_th, sc->sc_tx_th_len, m0);
 	}
 
 	/*
@@ -6591,9 +6589,8 @@
 {
 	struct ifnet *ifp = sc->sc_ifp;
 
-	bpfattach2(ifp, DLT_IEEE802_11_RADIO,
-		sizeof(struct ieee80211_frame) + sizeof(sc->sc_tx_th),
-		&sc->sc_drvbpf);
+	bpfattach(ifp, DLT_IEEE802_11_RADIO,
+		sizeof(struct ieee80211_frame) + sizeof(sc->sc_tx_th));
 	/*
 	 * Initialize constant fields.
 	 * XXX make header lengths a multiple of 32-bits so subsequent
@@ -6618,6 +6615,7 @@
 	const struct ieee80211_bpf_params *params)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
 	struct ath_hal *ah = sc->sc_ah;
 	int error, ismcast, ismrr;
 	int hdrlen, pktlen, try0, txantenna;
@@ -6702,7 +6700,7 @@
 		ieee80211_dump_pkt(ic, mtod(m0, caddr_t), m0->m_len,
 			sc->sc_hwmap[txrate].ieeerate, -1);
 	
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		u_int64_t tsf = ath_hal_gettsf64(ah);
 
 		sc->sc_tx_th.wt_tsf = htole64(tsf);
@@ -6713,8 +6711,7 @@
 		sc->sc_tx_th.wt_txpower = ni->ni_txpower;
 		sc->sc_tx_th.wt_antenna = sc->sc_txantenna;
 
-		bpf_mtap2(sc->sc_drvbpf,
-			&sc->sc_tx_th, sc->sc_tx_th_len, m0);
+		bpf_mtap2(ifp->if_bpf, &sc->sc_tx_th, sc->sc_tx_th_len, m0);
 	}
 
 	/*

==== //depot/projects/vap/sys/dev/ath/if_athvar.h#17 (text+ko) ====

@@ -283,7 +283,6 @@
 	u_int			sc_rfsilentpin;	/* GPIO pin for rfkill int */
 	u_int			sc_rfsilentpol;	/* pin setting for rfkill on */
 
-	struct bpf_if		*sc_drvbpf;
 	struct ath_tx_radiotap_header sc_tx_th;
 	int			sc_tx_th_len;
 	struct ath_rx_radiotap_header sc_rx_th;

==== //depot/projects/vap/sys/dev/ipw/if_ipw.c#8 (text+ko) ====

@@ -280,7 +280,7 @@
 		goto fail;
 	}
 
-	ifp = sc->sc_ifp = if_alloc(IFT_ETHER);
+	ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
 	if (ifp == NULL) {
 		device_printf(dev, "can not if_alloc()\n");
 		goto fail;
@@ -345,9 +345,8 @@
 	ic->ic_vap_create = ipw_vap_create;
 	ic->ic_vap_delete = ipw_vap_delete;
 
-	bpfattach2(ifp, DLT_IEEE802_11_RADIO,
-	    sizeof (struct ieee80211_frame) + sizeof (sc->sc_txtap),
-	    &sc->sc_drvbpf);
+	bpfattach(ifp, DLT_IEEE802_11_RADIO,
+	    sizeof (struct ieee80211_frame) + sizeof (sc->sc_txtap));
 
 	sc->sc_rxtap_len = sizeof sc->sc_rxtap;
 	sc->sc_rxtap.wr_ihdr.it_len = htole16(sc->sc_rxtap_len);
@@ -1167,7 +1166,7 @@
 	m->m_pkthdr.rcvif = ifp;
 	m->m_pkthdr.len = m->m_len = le32toh(status->len);
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct ipw_rx_radiotap_header *tap = &sc->sc_rxtap;
 
 		tap->wr_flags = 0;
@@ -1175,7 +1174,7 @@
 		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_mtap2(ifp->if_bpf, tap, sc->sc_rxtap_len, m);
 	}
 
 	if (sc->flags & IPW_FLAG_SCANNING)
@@ -1526,14 +1525,14 @@
 		wh = mtod(m0, struct ieee80211_frame *);
 	}
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct ipw_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);
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_txtap_len, m0);
 	}
 
 	shdr = SLIST_FIRST(&sc->free_shdr);

==== //depot/projects/vap/sys/dev/ipw/if_ipwvar.h#6 (text+ko) ====

@@ -158,8 +158,6 @@
 	uint32_t			rxcur;
 	int				txfree;
 
-	struct bpf_if			*sc_drvbpf;
-
 	struct ipw_rx_radiotap_header	sc_rxtap;
 	int				sc_rxtap_len;
 

==== //depot/projects/vap/sys/dev/iwi/if_iwi.c#13 (text+ko) ====

@@ -350,7 +350,7 @@
 
 	iwi_wme_init(sc);
 
-	ifp = sc->sc_ifp = if_alloc(IFT_ETHER);
+	ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
 	if (ifp == NULL) {
 		device_printf(dev, "can not if_alloc()\n");
 		goto fail;
@@ -412,9 +412,8 @@
 	ic->ic_vap_create = iwi_vap_create;
 	ic->ic_vap_delete = iwi_vap_delete;
 
-	bpfattach2(ifp, DLT_IEEE802_11_RADIO,
-	    sizeof (struct ieee80211_frame) + sizeof (sc->sc_txtap),
-	    &sc->sc_drvbpf);
+	bpfattach(ifp, DLT_IEEE802_11_RADIO,
+	    sizeof (struct ieee80211_frame) + sizeof (sc->sc_txtap));
 
 	sc->sc_rxtap_len = sizeof sc->sc_rxtap;
 	sc->sc_rxtap.wr_ihdr.it_len = htole16(sc->sc_rxtap_len);
@@ -1263,7 +1262,7 @@
 
 	m_adj(m, sizeof (struct iwi_hdr) + sizeof (struct iwi_frame));
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct iwi_rx_radiotap_header *tap = &sc->sc_rxtap;
 
 		tap->wr_flags = 0;
@@ -1271,7 +1270,7 @@
 		tap->wr_antsignal = frame->signal;
 		tap->wr_antenna = frame->antenna;
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_rxtap_len, m);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_rxtap_len, m);
 	}
 	IWI_UNLOCK(sc);
 
@@ -1793,12 +1792,12 @@
 		wh = mtod(m0, struct ieee80211_frame *);
 	}
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct iwi_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_txtap_len, m0);
 	}
 
 	data = &txq->data[txq->cur];

==== //depot/projects/vap/sys/dev/iwi/if_iwivar.h#8 (text+ko) ====

@@ -230,20 +230,11 @@
 	int                     sc_cmd_cur;    /* current queued scan task */
 	int                     sc_cmd_next;   /* last queued scan task */
 	unsigned long		sc_maxdwell;	/* max dwell time for curchan */
-	struct bpf_if		*sc_drvbpf;
 
-	union {
-		struct iwi_rx_radiotap_header th;
-		uint8_t	pad[64];
-	}			sc_rxtapu;
-#define sc_rxtap	sc_rxtapu.th
+	struct iwi_rx_radiotap_header sc_rxtap;
 	int			sc_rxtap_len;
 
-	union {
-		struct iwi_tx_radiotap_header th;
-		uint8_t	pad[64];
-	}			sc_txtapu;
-#define sc_txtap	sc_txtapu.th
+	struct iwi_tx_radiotap_header sc_txtap;
 	int			sc_txtap_len;
 };
 

==== //depot/projects/vap/sys/dev/ral/rt2560.c#15 (text) ====

@@ -258,7 +258,7 @@
 		goto fail5;
 	}
 
-	ifp = sc->sc_ifp = if_alloc(IFT_ETHER);
+	ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
 	if (ifp == NULL) {
 		device_printf(sc->sc_dev, "can not if_alloc()\n");
 		goto fail6;
@@ -307,9 +307,8 @@
 	ic->ic_vap_create = rt2560_vap_create;
 	ic->ic_vap_delete = rt2560_vap_delete;
 
-	bpfattach2(ifp, DLT_IEEE802_11_RADIO,
-	    sizeof (struct ieee80211_frame) + sizeof (sc->sc_txtap), 
-	    &sc->sc_drvbpf);
+	bpfattach(ifp, DLT_IEEE802_11_RADIO,
+	    sizeof (struct ieee80211_frame) + sizeof (sc->sc_txtap));
 
 	sc->sc_rxtap_len = sizeof sc->sc_rxtap;
 	sc->sc_rxtap.wr_ihdr.it_len = htole16(sc->sc_rxtap_len);
@@ -1239,7 +1238,7 @@
 		m->m_pkthdr.len = m->m_len =
 		    (le32toh(desc->flags) >> 16) & 0xfff;
 
-		if (bpf_peers_present(sc->sc_drvbpf)) {
+		if (bpf_peers_present(ifp->if_bpf)) {
 			struct rt2560_rx_radiotap_header *tap = &sc->sc_rxtap;
 			uint32_t tsf_lo, tsf_hi;
 
@@ -1254,7 +1253,7 @@
 			tap->wr_antenna = sc->rx_ant;
 			tap->wr_antsignal = RT2560_RSSI(sc, desc->rssi);
 
-			bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_rxtap_len, m);
+			bpf_mtap2(ifp->if_bpf, tap, sc->sc_rxtap_len, m);
 		}
 
 		sc->sc_flags |= RT2560_F_INPUT_RUNNING;
@@ -1554,6 +1553,7 @@
 {
 	struct ieee80211vap *vap = ni->ni_vap;
 	struct ieee80211com *ic = ni->ni_ic;
+	struct ifnet *ifp = sc->sc_ifp;
 	struct rt2560_tx_desc *desc;
 	struct rt2560_tx_data *data;
 	bus_dma_segment_t segs[RT2560_MAX_SCATTER];
@@ -1574,7 +1574,7 @@
 		return error;
 	}
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct rt2560_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
@@ -1583,7 +1583,7 @@
 		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 		tap->wt_antenna = sc->tx_ant;
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_txtap_len, m0);
 	}
 
 	data->m = m0;
@@ -1610,6 +1610,7 @@
 {
 	struct ieee80211vap *vap = ni->ni_vap;
 	struct ieee80211com *ic = ni->ni_ic;
+	struct ifnet *ifp = sc->sc_ifp;
 	struct rt2560_tx_desc *desc;
 	struct rt2560_tx_data *data;
 	struct ieee80211_frame *wh;
@@ -1643,7 +1644,7 @@
 		return error;
 	}
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct rt2560_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
@@ -1652,7 +1653,7 @@
 		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 		tap->wt_antenna = sc->tx_ant;
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_txtap_len, m0);
 	}
 
 	data->m = m0;
@@ -1700,6 +1701,7 @@
     struct ieee80211_node *ni, const struct ieee80211_bpf_params *params)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
 	struct rt2560_tx_desc *desc;
 	struct rt2560_tx_data *data;
 	bus_dma_segment_t segs[RT2560_MAX_SCATTER];
@@ -1726,7 +1728,7 @@
 		return error;
 	}
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct rt2560_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
@@ -1735,7 +1737,7 @@
 		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 		tap->wt_antenna = sc->tx_ant;
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_txtap_len, m0);
 	}
 
 	data->m = m0;
@@ -1802,6 +1804,7 @@
 {
 	struct ieee80211vap *vap = ni->ni_vap;
 	struct ieee80211com *ic = ni->ni_ic;
+	struct ifnet *ifp = sc->sc_ifp;
 	struct rt2560_tx_desc *desc;
 	struct rt2560_tx_data *data;
 	struct rt2560_node *rn;
@@ -1943,14 +1946,14 @@
 		wh = mtod(m0, struct ieee80211_frame *);
 	}
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct rt2560_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
 		tap->wt_rate = rate;
 		tap->wt_antenna = sc->tx_ant;
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_txtap_len, m0);
 	}
 
 	data->m = m0;

==== //depot/projects/vap/sys/dev/ral/rt2560var.h#10 (text) ====

@@ -155,8 +155,6 @@
 	int			tx_ant;
 	int			nb_ant;
 
-	struct bpf_if		*sc_drvbpf;
-
 	struct rt2560_rx_radiotap_header sc_rxtap;
 	int			sc_rxtap_len;
 

==== //depot/projects/vap/sys/dev/ral/rt2661.c#12 (text) ====

@@ -284,7 +284,7 @@
 		goto fail3;
 	}
 
-	ifp = sc->sc_ifp = if_alloc(IFT_ETHER);
+	ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
 	if (ifp == NULL) {
 		device_printf(sc->sc_dev, "can not if_alloc()\n");
 		error = ENOMEM;
@@ -338,9 +338,8 @@
 	ic->ic_vap_create = rt2661_vap_create;
 	ic->ic_vap_delete = rt2661_vap_delete;
 
-	bpfattach2(ifp, DLT_IEEE802_11_RADIO,
-	    sizeof (struct ieee80211_frame) + sizeof (sc->sc_txtap), 
-	    &sc->sc_drvbpf);
+	bpfattach(ifp, DLT_IEEE802_11_RADIO,
+	    sizeof (struct ieee80211_frame) + sizeof (sc->sc_txtap));
 
 	sc->sc_rxtap_len = sizeof sc->sc_rxtap;
 	sc->sc_rxtap.wr_ihdr.it_len = htole16(sc->sc_rxtap_len);
@@ -1146,7 +1145,7 @@
 
 		rssi = rt2661_get_rssi(sc, desc->rssi);
 
-		if (bpf_peers_present(sc->sc_drvbpf)) {
+		if (bpf_peers_present(ifp->if_bpf)) {
 			struct rt2661_rx_radiotap_header *tap = &sc->sc_rxtap;
 			uint32_t tsf_lo, tsf_hi;
 
@@ -1160,7 +1159,7 @@
 			tap->wr_rate = rt2661_rxrate(desc);
 			tap->wr_antsignal = rssi < 0 ? 0 : rssi;
 
-			bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_rxtap_len, m);
+			bpf_mtap2(ifp->if_bpf, tap, sc->sc_rxtap_len, m);
 		}
 		sc->sc_flags |= RAL_INPUT_RUNNING;
 		RAL_UNLOCK(sc);
@@ -1476,6 +1475,7 @@
 {
 	struct ieee80211vap *vap = ni->ni_vap;
 	struct ieee80211com *ic = ni->ni_ic;
+	struct ifnet *ifp = sc->sc_ifp;
 	struct rt2661_tx_desc *desc;
 	struct rt2661_tx_data *data;
 	struct ieee80211_frame *wh;
@@ -1509,13 +1509,13 @@
 		return error;
 	}
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct rt2661_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
 		tap->wt_rate = rate;
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_txtap_len, m0);
 	}
 
 	data->m = m0;
@@ -1595,6 +1595,7 @@
 	struct ieee80211vap *vap = ni->ni_vap;
 	struct ieee80211com *ic = &sc->sc_ic;
 	struct rt2661_tx_ring *txq = &sc->txq[ac];
+	struct ifnet *ifp = sc->sc_ifp;
 	struct rt2661_tx_desc *desc;
 	struct rt2661_tx_data *data;
 	struct rt2661_node *rn;
@@ -1740,7 +1741,7 @@
 		wh = mtod(m0, struct ieee80211_frame *);
 	}
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct rt2661_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
@@ -1748,7 +1749,7 @@
 		tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq);
 		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_txtap_len, m0);
 	}
 
 	data->m = m0;

==== //depot/projects/vap/sys/dev/ral/rt2661var.h#7 (text) ====

@@ -158,8 +158,6 @@
 
 	int				dwelltime;
 
-	struct bpf_if			*sc_drvbpf;
-
 	struct rt2661_rx_radiotap_header sc_rxtap;
 	int				sc_rxtap_len;
 

==== //depot/projects/vap/sys/dev/usb/if_rum.c#7 (text+ko) ====

@@ -470,7 +470,7 @@
 		return ENXIO;
 	}
 
-	ifp = sc->sc_ifp = if_alloc(IFT_ETHER);
+	ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
 	if (ifp == NULL) {
 		printf("%s: can not if_alloc()\n", 
 		    device_get_nameunit(sc->sc_dev));
@@ -520,9 +520,8 @@
 	ic->ic_vap_create = rum_vap_create;
 	ic->ic_vap_delete = rum_vap_delete;
 
-	bpfattach2(ifp, DLT_IEEE802_11_RADIO,
-	    sizeof (struct ieee80211_frame) + IEEE80211_RADIOTAP_HDRLEN, 
-	    &sc->sc_drvbpf);
+	bpfattach(ifp, DLT_IEEE802_11_RADIO,
+	    sizeof (struct ieee80211_frame) + sizeof(sc->sc_txtap));
 
 	sc->sc_rxtap_len = sizeof sc->sc_rxtap;
 	sc->sc_rxtap.wr_ihdr.it_len = htole16(sc->sc_rxtap_len);
@@ -925,7 +924,7 @@
 
 	rssi = rum_get_rssi(sc, desc->rssi);
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct rum_rx_radiotap_header *tap = &sc->sc_rxtap;
 
 		tap->wr_flags = IEEE80211_RADIOTAP_F_FCS;
@@ -935,7 +934,7 @@
 		tap->wr_antenna = sc->rx_ant;
 		tap->wr_antsignal = rssi;
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_rxtap_len, m);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_rxtap_len, m);
 	}
 
 	ni = ieee80211_find_rxnode(ic, mtod(m, struct ieee80211_frame_min *));
@@ -1120,6 +1119,7 @@
 {
 	struct ieee80211vap *vap = ni->ni_vap;
 	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
 	struct rum_tx_desc *desc;
 	struct rum_tx_data *data;
 	struct ieee80211_frame *wh;
@@ -1161,7 +1161,7 @@
 			flags |= RT2573_TX_TIMESTAMP;
 	}
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct rum_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
@@ -1170,7 +1170,7 @@
 		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 		tap->wt_antenna = sc->tx_ant;
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_txtap_len, m0);
 	}
 
 	m_copydata(m0, 0, m0->m_pkthdr.len, data->buf + RT2573_TX_DESC_SIZE);
@@ -1210,6 +1210,7 @@
     const struct ieee80211_bpf_params *params)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
 	struct rum_tx_desc *desc;
 	struct rum_tx_data *data;
 	uint32_t flags;
@@ -1231,7 +1232,7 @@
 	if ((params->ibp_flags & IEEE80211_BPF_NOACK) == 0)
 		flags |= RT2573_TX_NEED_ACK;
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct rum_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
@@ -1240,7 +1241,7 @@
 		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 		tap->wt_antenna = sc->tx_ant;
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_txtap_len, m0);
 	}
 
 	data->m = m0;
@@ -1281,6 +1282,7 @@
 {
 	struct ieee80211vap *vap = ni->ni_vap;
 	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
 	struct rum_tx_desc *desc;
 	struct rum_tx_data *data;
 	struct ieee80211_frame *wh;
@@ -1329,7 +1331,7 @@
 		*(uint16_t *)wh->i_dur = htole16(dur);
 	}
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct rum_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
@@ -1338,7 +1340,7 @@
 		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 		tap->wt_antenna = sc->tx_ant;
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_txtap_len, m0);
 	}
 
 	m_copydata(m0, 0, m0->m_pkthdr.len, data->buf + RT2573_TX_DESC_SIZE);

==== //depot/projects/vap/sys/dev/usb/if_rumvar.h#5 (text+ko) ====

@@ -140,8 +140,6 @@
 	int				sifs;
 	uint8_t				bbp17;
 
-	struct bpf_if			*sc_drvbpf;
-
 	struct rum_rx_radiotap_header	sc_rxtap;
 	int				sc_rxtap_len;
 

==== //depot/projects/vap/sys/dev/usb/if_ural.c#9 (text+ko) ====

@@ -460,7 +460,7 @@
 	    device_get_nameunit(sc->sc_dev), sc->asic_rev,
 	    ural_get_rf(sc->rf_rev));
 
-	ifp = sc->sc_ifp = if_alloc(IFT_ETHER);
+	ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
 	if (ifp == NULL) {
 		printf("%s: can not if_alloc()\n",
 		    device_get_nameunit(sc->sc_dev));
@@ -509,8 +509,8 @@
 	ic->ic_vap_create = ural_vap_create;
 	ic->ic_vap_delete = ural_vap_delete;
 
-	bpfattach2(ifp, DLT_IEEE802_11_RADIO,
-	    sizeof (struct ieee80211_frame) + 64, &sc->sc_drvbpf);
+	bpfattach(ifp, DLT_IEEE802_11_RADIO,
+	    sizeof (struct ieee80211_frame) + sizeof(sc->sc_txtap));
 
 	sc->sc_rxtap_len = sizeof sc->sc_rxtap;
 	sc->sc_rxtap.wr_ihdr.it_len = htole16(sc->sc_rxtap_len);
@@ -993,7 +993,7 @@
 	m->m_pkthdr.rcvif = ifp;
 	m->m_pkthdr.len = m->m_len = (le32toh(desc->flags) >> 16) & 0xfff;
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct ural_rx_radiotap_header *tap = &sc->sc_rxtap;
 
 		tap->wr_flags = IEEE80211_RADIOTAP_F_FCS;   
@@ -1003,7 +1003,7 @@
 		tap->wr_antenna = sc->rx_ant;
 		tap->wr_antsignal = URAL_RSSI(desc->rssi);
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_rxtap_len, m);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_rxtap_len, m);
 	}
 
 	/* Strip trailing 802.11 MAC FCS. */
@@ -1216,6 +1216,7 @@
 {
 	struct ieee80211vap *vap = ni->ni_vap;
 	struct ieee80211com *ic = ni->ni_ic;
+	struct ifnet *ifp = sc->sc_ifp;
 	const struct ieee80211_txparam *tp;
 	struct ural_tx_desc *desc;
 	struct ural_tx_data *data;
@@ -1259,7 +1260,7 @@
 			flags |= RAL_TX_TIMESTAMP;
 	}
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct ural_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
@@ -1268,7 +1269,7 @@
 		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 		tap->wt_antenna = sc->tx_ant;
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_txtap_len, m0);
 	}
 
 	m_copydata(m0, 0, m0->m_pkthdr.len, data->buf + RAL_TX_DESC_SIZE);
@@ -1309,6 +1310,7 @@
     const struct ieee80211_bpf_params *params)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
 	struct ural_tx_desc *desc;
 	struct ural_tx_data *data;
 	uint32_t flags;
@@ -1327,7 +1329,7 @@
 		return EINVAL;
 	}
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct ural_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
@@ -1336,7 +1338,7 @@
 		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 		tap->wt_antenna = sc->tx_ant;
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_txtap_len, m0);
 	}
 
 	data->m = m0;
@@ -1385,6 +1387,7 @@
 {
 	struct ieee80211vap *vap = ni->ni_vap;
 	struct ieee80211com *ic = ni->ni_ic;
+	struct ifnet *ifp = sc->sc_ifp;
 	struct ural_tx_desc *desc;
 	struct ural_tx_data *data;
 	struct ieee80211_frame *wh;
@@ -1431,7 +1434,7 @@
 		*(uint16_t *)wh->i_dur = htole16(dur);
 	}
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct ural_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
@@ -1440,7 +1443,7 @@
 		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 		tap->wt_antenna = sc->tx_ant;
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_txtap_len, m0);
 	}
 
 	m_copydata(m0, 0, m0->m_pkthdr.len, data->buf + RAL_TX_DESC_SIZE);

==== //depot/projects/vap/sys/dev/usb/if_uralvar.h#7 (text+ko) ====

@@ -134,8 +134,6 @@
 	int				tx_ant;
 	int				nb_ant;
 
-	struct bpf_if			*sc_drvbpf;
-
 	struct ural_rx_radiotap_header	sc_rxtap;
 	int				sc_rxtap_len;
 

==== //depot/projects/vap/sys/dev/usb/if_zyd.c#8 (text+ko) ====

@@ -286,7 +286,7 @@
 
 	sc->sc_dev = dev;
 
-	ifp = sc->sc_ifp = if_alloc(IFT_ETHER);
+	ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
 	if (ifp == NULL) {
 		device_printf(dev, "can not if_alloc()\n");
 		return ENXIO;
@@ -413,9 +413,8 @@
 	ic->ic_vap_create = zyd_vap_create;
 	ic->ic_vap_delete = zyd_vap_delete;
 
-	bpfattach2(ifp, DLT_IEEE802_11_RADIO,
-	    sizeof(struct ieee80211_frame) + sizeof(sc->sc_txtap),
-	    &sc->sc_drvbpf);
+	bpfattach(ifp, DLT_IEEE802_11_RADIO,
+	    sizeof(struct ieee80211_frame) + sizeof(sc->sc_txtap));
 
 	sc->sc_rxtap_len = sizeof(sc->sc_rxtap);
 	sc->sc_rxtap.wr_ihdr.it_len = htole16(sc->sc_rxtap_len);
@@ -2007,7 +2006,7 @@
 	m->m_pkthdr.len = m->m_len = rlen;
 	bcopy((const uint8_t *)(plcp + 1), mtod(m, uint8_t *), rlen);
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct zyd_rx_radiotap_header *tap = &sc->sc_rxtap;
 
 		tap->wr_flags = 0;
@@ -2021,7 +2020,7 @@
 		tap->wr_antsignal = stat->rssi + -95;
 		tap->wr_antnoise = -95;		/* XXX */
 		
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_rxtap_len, m);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_rxtap_len, m);
 	}
 
 	rssi = stat->rssi > 63 ? 127 : 2 * stat->rssi;
@@ -2176,13 +2175,13 @@
 			desc->plcp_service |= ZYD_PLCP_LENGEXT;
 	}
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct zyd_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
 		tap->wt_rate = rate;
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_txtap_len, m0);
 	}
 
 	m_copydata(m0, 0, m0->m_pkthdr.len,
@@ -2345,7 +2344,7 @@
 			desc->plcp_service |= ZYD_PLCP_LENGEXT;
 	}
 
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		struct zyd_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
@@ -2353,7 +2352,7 @@
 		tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq);
 		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 
-		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
+		bpf_mtap2(ifp->if_bpf, tap, sc->sc_txtap_len, m0);
 	}
 
 	m_copydata(m0, 0, m0->m_pkthdr.len,

==== //depot/projects/vap/sys/dev/usb/if_zydreg.h#5 (text+ko) ====

@@ -1238,8 +1238,6 @@
 
 	int				tx_timer;
 
-	struct bpf_if			*sc_drvbpf;
-
 	struct zyd_rx_radiotap_header	sc_rxtap;
 	int				sc_rxtap_len;
 

==== //depot/projects/vap/sys/dev/wi/if_wi.c#11 (text+ko) ====

@@ -266,7 +266,7 @@
 	};
 	int error;
 
-	ifp = sc->sc_ifp = if_alloc(IFT_ETHER);
+	ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
 	if (ifp == NULL) {
 		device_printf(dev, "can not if_alloc\n");
 		wi_free(dev);
@@ -519,9 +519,8 @@
 	ieee80211_media_init(ic, wi_media_change, wi_media_status);
 
 #if NBPFILTER > 0
-	bpfattach2(ifp, DLT_IEEE802_11_RADIO,
-		sizeof(struct ieee80211_frame) + sizeof(sc->sc_tx_th),
-		&sc->sc_drvbpf);
+	bpfattach(ifp, DLT_IEEE802_11_RADIO,
+		sizeof(struct ieee80211_frame) + sizeof(sc->sc_tx_th));
 	/*
 	 * Initialize constant fields.
 	 * XXX make header lengths a multiple of 32-bits so subsequent
@@ -958,11 +957,11 @@
 			frmhdr.wi_tx_ctl |= htole16(WI_TXCNTL_NOCRYPT);
 		}
 #if NBPFILTER > 0
-		if (bpf_peers_present(sc->sc_drvbpf)) {
+		if (bpf_peers_present(ifp->if_bpf)) {
 			sc->sc_tx_th.wt_rate =
 				ni->ni_rates.rs_rates[ni->ni_txrate];
-			bpf_mtap2(sc->sc_drvbpf,
-				&sc->sc_tx_th, sc->sc_tx_th_len, m0);
+			bpf_mtap2(ifp->if_bpf,
+			    &sc->sc_tx_th, sc->sc_tx_th_len, m0);
 		}
 #endif
 		m_copydata(m0, 0, sizeof(struct ieee80211_frame),
@@ -1076,11 +1075,10 @@
 		}
 	}
 #if NBPFILTER > 0
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		sc->sc_tx_th.wt_rate =
 			ni->ni_rates.rs_rates[ni->ni_txrate];
-		bpf_mtap2(sc->sc_drvbpf,
-			&sc->sc_tx_th, sc->sc_tx_th_len, m0);
+		bpf_mtap2(ifp->if_bpf, &sc->sc_tx_th, sc->sc_tx_th_len, m0);
 	}
 #endif
 	m_copydata(m0, 0, sizeof(struct ieee80211_frame),
@@ -1676,7 +1674,7 @@
 	CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_RX);
 
 #if NBPFILTER > 0
-	if (bpf_peers_present(sc->sc_drvbpf)) {
+	if (bpf_peers_present(ifp->if_bpf)) {
 		/* XXX replace divide by table */
 		sc->sc_rx_th.wr_rate = frmhdr.wi_rx_rate / 5;
 		sc->sc_rx_th.wr_antsignal = frmhdr.wi_rx_signal;
@@ -1685,8 +1683,7 @@
 		if (frmhdr.wi_status & WI_STAT_PCF)

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list