Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Nov 2005 00:56:07 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 87233 for review
Message-ID:  <200511260056.jAQ0u7Yb015420@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=87233

Change 87233 by sam@sam_ebb on 2005/11/26 00:55:12

	fixups for new scanning stuff and channel reorg; doesn't
	work because of Giant needs

Affected files ...

.. //depot/projects/wifi/sys/dev/usb/if_ural.c#8 edit

Differences ...

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

@@ -142,13 +142,16 @@
 Static void		ural_bbp_write(struct ural_softc *, uint8_t, uint8_t);
 Static uint8_t		ural_bbp_read(struct ural_softc *, uint8_t);
 Static void		ural_rf_write(struct ural_softc *, uint8_t, uint32_t);
+static void		ural_scan_start(struct ieee80211com *);
+static void		ural_scan_end(struct ieee80211com *);
+static void		ural_set_channel(struct ieee80211com *);
 Static void		ural_set_chan(struct ural_softc *,
 			    struct ieee80211_channel *);
 #if 0
 Static void		ural_disable_rf_tune(struct ural_softc *);
 #endif
 Static void		ural_enable_tsf_sync(struct ural_softc *);
-Static void		ural_set_bssid(struct ural_softc *, uint8_t *);
+Static void		ural_set_bssid(struct ural_softc *, const uint8_t *);
 Static void		ural_set_macaddr(struct ural_softc *, uint8_t *);
 Static void		ural_update_promisc(struct ural_softc *);
 Static const char	*ural_get_rf(int);
@@ -488,16 +491,20 @@
 	/* set supported .11b and .11g channels (1 through 14) */
 	for (i = 1; i <= 14; i++) {
 		c = &ic->ic_channels[ic->ic_nchans++];
-		c->ic_freq =
-		    ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ);
-		c->ic_flags =
-		    IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM |
-		    IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ;
+		c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ);
+		c->ic_flags = IEEE80211_CHAN_B;
+		c->ic_ieee = i;
+		c = &ic->ic_channels[ic->ic_nchans++];
+		c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ);
+		c->ic_flags = IEEE80211_CHAN_G;
 		c->ic_ieee = i;
 	}
 
 	ieee80211_ifattach(ic);
 	ic->ic_reset = ural_reset;
+	ic->ic_scan_start = ural_scan_start;
+	ic->ic_scan_end = ural_scan_end;
+	ic->ic_set_channel = ural_set_channel;
 
 	/* override state transition machine */
 	sc->sc_newstate = ic->ic_newstate;
@@ -787,6 +794,9 @@
 	struct ural_softc *sc = data->sc;
 	struct ifnet *ifp = sc->sc_ic.ic_ifp;
 
+	if (data->m->m_flags & M_TXCB)
+		ieee80211_process_callback(data->ni, data->m,
+			status == USBD_NORMAL_COMPLETION ? 0 : ETIMEDOUT);
 	if (status != USBD_NORMAL_COMPLETION) {
 		if (status == USBD_NOT_STARTED || status == USBD_CANCELLED)
 			return;
@@ -798,6 +808,7 @@
 			usbd_clear_endpoint_stall(sc->sc_rx_pipeh);
 
 		ifp->if_oerrors++;
+		/* XXX mbuf leak? */
 		return;
 	}
 
@@ -1557,6 +1568,39 @@
 }
 
 Static void
+ural_scan_start(struct ieee80211com *ic)
+{
+	struct ifnet *ifp = ic->ic_ifp;
+	struct ural_softc *sc = ifp->if_softc;
+
+	/* abort TSF synchronization */
+	ural_write(sc, RAL_TXRX_CSR19, 0);
+	ural_set_bssid(sc, ifp->if_broadcastaddr);
+}
+
+Static void
+ural_scan_end(struct ieee80211com *ic)
+{
+	struct ifnet *ifp = ic->ic_ifp;
+	struct ural_softc *sc = ifp->if_softc;
+
+	ural_enable_tsf_sync(sc);
+	/* XXX keep local copy */
+	ural_set_bssid(sc, ic->ic_bss->ni_bssid);
+}
+
+Static void
+ural_set_channel(struct ieee80211com *ic)
+{
+	struct ifnet *ifp = ic->ic_ifp;
+	struct ural_softc *sc = ifp->if_softc;
+
+	mtx_lock(&Giant);
+	ural_set_chan(sc, ic->ic_curchan);
+	mtx_unlock(&Giant);
+}
+
+Static void
 ural_set_chan(struct ural_softc *sc, struct ieee80211_channel *c)
 {
 #define N(a)	(sizeof (a) / sizeof ((a)[0]))
@@ -1641,7 +1685,7 @@
 	}
 
 	if (ic->ic_opmode != IEEE80211_M_MONITOR &&
-	    ic->ic_state != IEEE80211_S_SCAN) {
+	    (ic->ic_flags & IEEE80211_F_SCAN) == 0) {
 		/* set Japan filter bit for channel 14 */
 		tmp = ural_bbp_read(sc, 70);
 
@@ -1723,7 +1767,7 @@
 }
 
 Static void
-ural_set_bssid(struct ural_softc *sc, uint8_t *bssid)
+ural_set_bssid(struct ural_softc *sc, const uint8_t *bssid)
 {
 	uint16_t tmp;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200511260056.jAQ0u7Yb015420>