Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Jan 2007 08:06:09 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 112446 for review
Message-ID:  <200701030806.l03869D4097899@repoman.freebsd.org>

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

Change 112446 by kmacy@kmacy_serendipity:sam_wifi on 2007/01/03 08:05:15

	use net80211 layer support for channel initialization

Affected files ...

.. //depot/projects/wifi/sys/dev/iwi/if_iwi.c#18 edit

Differences ...

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

@@ -72,6 +72,7 @@
 
 #include <net80211/ieee80211_var.h>
 #include <net80211/ieee80211_radiotap.h>
+#include <net80211/ieee80211_regdomain.h>
 
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
@@ -257,9 +258,8 @@
 	struct iwi_softc *sc = device_get_softc(dev);
 	struct ifnet *ifp;
 	struct ieee80211com *ic = &sc->sc_ic;
-	struct ieee80211_channel *c;
 	uint16_t val;
-	int error, i, j;
+	int error, bands;
 
 	sc->sc_dev = dev;
 
@@ -409,41 +409,12 @@
 	ic->ic_myaddr[4] = val & 0xff;
 	ic->ic_myaddr[5] = val >> 8;
 	
-	/* set supported .11b and .11g channels (1 through 14) */
-	for (j = 0, i = 1; i <= 14; i++) {
-		c = &ic->ic_channels[j++];
-		c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ);
-		c->ic_flags = IEEE80211_CHAN_B;
-		c->ic_ieee = i;
-		c = &ic->ic_channels[j++];
-		c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ);
-		c->ic_flags = IEEE80211_CHAN_G;
-		c->ic_ieee = i;
-
-	}
-	if (pci_get_device(dev) >= 0x4223) {
-		/* set supported .11a rates (2915ABG only) */
-		ic->ic_sup_rates[IEEE80211_MODE_11A] = iwi_rateset_11a;
-
-		/* set supported .11a channels */
-		for (i = 36; i <= 64; i += 4, j++) {
-			ic->ic_channels[j].ic_freq =
-			    ieee80211_ieee2mhz(i, IEEE80211_CHAN_5GHZ);
-			ic->ic_channels[j].ic_flags = IEEE80211_CHAN_A;
-			ic->ic_channels[j].ic_ieee = i;
-		}
-		for (i = 149; i <= 165; i += 4, j++) {
-			ic->ic_channels[j].ic_freq =
-			    ieee80211_ieee2mhz(i, IEEE80211_CHAN_5GHZ);
-			ic->ic_channels[j].ic_flags = IEEE80211_CHAN_A;
-			ic->ic_channels[j].ic_ieee = i;
-		}
-	}
-
-	/* set supported .11b and .11g rates */
-	ic->ic_sup_rates[IEEE80211_MODE_11B] = iwi_rateset_11b;
-	ic->ic_sup_rates[IEEE80211_MODE_11G] = iwi_rateset_11g;
-	ic->ic_nchans = j;
+	bands = 0;
+	setbit(&bands, IEEE80211_MODE_11B);
+	setbit(&bands, IEEE80211_MODE_11G);
+	if (pci_get_device(dev) >= 0x4223) 
+		setbit(&bands, IEEE80211_MODE_11A);
+	ieee80211_init_channels(ic, 0, CTRY_DEFAULT, bands, 0, 1);
 
 	ieee80211_ifattach(ic);
 	ic->ic_bmissthreshold = 10;		/* override default */



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