PERFORCE change 123080 for review

Andrew Thompson thompsa at FreeBSD.org
Sun Jul 8 02:23:40 UTC 2007


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

Change 123080 by thompsa at thompsa_heff on 2007/07/08 02:22:52

	Change ipw_setcurchan() to take a channel pointer.

Affected files ...

.. //depot/projects/wifi/sys/dev/ipw/if_ipw.c#20 edit

Differences ...

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

@@ -989,18 +989,11 @@
  * Set driver state for current channel.
  */
 static void
-ipw_setcurchan(struct ipw_softc *sc, int chan)
+ipw_setcurchan(struct ipw_softc *sc, struct ieee80211_channel *chan)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
 
-	if (chan == sc->curchan)
-		return;
-
-	ic->ic_curchan = ieee80211_find_channel(ic,
-				ieee80211_ieee2mhz(chan, 0),
-				IEEE80211_CHAN_B);
-	sc->curchan = chan;
-
+	ic->ic_curchan = chan;
 	sc->sc_rxtap.wr_chan_freq = sc->sc_txtap.wt_chan_freq =
 		htole16(ic->ic_curchan->ic_freq);
 	sc->sc_rxtap.wr_chan_flags = sc->sc_txtap.wt_chan_flags =
@@ -1015,6 +1008,8 @@
 static void
 ipw_fix_channel(struct ipw_softc *sc, struct mbuf *m)
 {
+	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211_channel *c;
 	struct ieee80211_frame *wh;
 	uint8_t subtype;
 	uint8_t *frm, *efrm;
@@ -1035,11 +1030,18 @@
 
 	frm += 12;	/* skip tstamp, bintval and capinfo fields */
 	while (frm < efrm) {
-		if (*frm == IEEE80211_ELEMID_DSPARMS)
+		if (*frm == IEEE80211_ELEMID_DSPARMS
 #if IEEE80211_CHAN_MAX < 255
-		if (frm[2] <= IEEE80211_CHAN_MAX)
+		    && frm[2] <= IEEE80211_CHAN_MAX
 #endif
-			ipw_setcurchan(sc, frm[2]);
+		    ) {
+			c = ieee80211_find_channel(ic,
+				ieee80211_ieee2mhz(frm[2], 0),
+				IEEE80211_CHAN_B);
+			if (c == NULL)
+				c = &ic->ic_channels[0];
+			ipw_setcurchan(sc, c);
+		}
 
 		frm += frm[1] + 2;
 	}
@@ -1947,7 +1949,7 @@
 static int
 ipw_setssid(struct ipw_softc *sc, void *ssid, size_t ssidlen)
 {
-	if (ssid == NULL) {
+	if (ssidlen == 0) {
 		/*
 		 * A bug in the firmware breaks the ``don't associate''
 		 * bit in the scan options command.  To compensate for
@@ -1983,7 +1985,7 @@
 	DPRINTF(("Setting channel to %u\n", le32toh(data)));
 	error = ipw_cmd(sc, IPW_CMD_SET_CHANNEL, &data, sizeof data);
 	if (error == 0)
-		ipw_setcurchan(sc, le32toh(data));
+		ipw_setcurchan(sc, chan);
 	return error;
 }
 


More information about the p4-projects mailing list