PERFORCE change 112431 for review

Sam Leffler sam at FreeBSD.org
Tue Jan 2 10:55:09 PST 2007


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

Change 112431 by sam at sam_ebb on 2007/01/02 18:54:40

	convert 2560 support to use net80211 channel setup code
	and default rate set setup to net80211; the channel stuff
	is just an example and needs mucho work

Affected files ...

.. //depot/projects/wifi/sys/dev/ral/rt2560.c#6 edit

Differences ...

==== //depot/projects/wifi/sys/dev/ral/rt2560.c#6 (text) ====

@@ -53,6 +53,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>
@@ -154,18 +155,6 @@
 static int		rt2560_raw_xmit(struct ieee80211_node *, struct mbuf *,
 				const struct ieee80211_bpf_params *);
 
-/*
- * Supported rates for 802.11a/b/g modes (in 500Kbps unit).
- */
-static const struct ieee80211_rateset rt2560_rateset_11a =
-	{ 8, { 12, 18, 24, 36, 48, 72, 96, 108 } };
-
-static const struct ieee80211_rateset rt2560_rateset_11b =
-	{ 4, { 2, 4, 11, 22 } };
-
-static const struct ieee80211_rateset rt2560_rateset_11g =
-	{ 12, { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 } };
-
 static const struct {
 	uint32_t	reg;
 	uint32_t	val;
@@ -202,7 +191,7 @@
 	struct rt2560_softc *sc = device_get_softc(dev);
 	struct ieee80211com *ic = &sc->sc_ic;
 	struct ifnet *ifp;
-	int error, i, j;
+	int error, bands;
 
 	sc->sc_dev = dev;
 
@@ -288,50 +277,13 @@
 	    IEEE80211_C_SHSLOT |	/* short slot time supported */
 	    IEEE80211_C_WPA;		/* 802.11i */
 
-	/* set supported .11b and .11g channels (1 through 14) */
-	for (j = 0, i = 1; i <= 14; i++) {
-		ic->ic_channels[j].ic_freq =
-		    ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ);
-		ic->ic_channels[j].ic_flags = IEEE80211_CHAN_B;
-		ic->ic_channels[j].ic_ieee = i;
-		j++;
-
-		ic->ic_channels[j].ic_freq =
-		    ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ);
-		ic->ic_channels[j].ic_flags = IEEE80211_CHAN_G;
-		ic->ic_channels[j].ic_ieee = i;
-		j++;
-	}
-
-	if (sc->rf_rev == RT2560_RF_5222) {
-		/* set supported .11a rates */
-		ic->ic_sup_rates[IEEE80211_MODE_11A] = rt2560_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 = 100; i <= 140; 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 <= 161; 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;
-		}
-	}
+	bands = 0;
+	setbit(&bands, IEEE80211_MODE_11B);
+	setbit(&bands, IEEE80211_MODE_11G);
+	if (sc->rf_rev == RT2560_RF_5222)
+		setbit(&bands, IEEE80211_MODE_11A);
+	ieee80211_init_channels(ic, 0, CTRY_DEFAULT, bands, 0, 1);
 
-	/* set supported .11b and .11g rates */
-	ic->ic_sup_rates[IEEE80211_MODE_11B] = rt2560_rateset_11b;
-	ic->ic_sup_rates[IEEE80211_MODE_11G] = rt2560_rateset_11g;
-	ic->ic_nchans = j;
 	ieee80211_ifattach(ic);
 	ic->ic_scan_start = rt2560_scan_start;
 	ic->ic_scan_end = rt2560_scan_end;


More information about the p4-projects mailing list