PERFORCE change 113375 for review

Sam Leffler sam at FreeBSD.org
Mon Jan 22 19:07:49 UTC 2007


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

Change 113375 by sam at sam_ebb on 2007/01/22 19:07:03

	o remove hack channel mapping for psb; we don't need it
	  now that we can uniquely identify a channel
	o key psb mapping on frequency; may need to also use the
	  regdomain/sku but I think this is good for now
	o add channel width to ieee80211_announce_channels

Affected files ...

.. //depot/projects/wifi/sys/net80211/ieee80211.c#39 edit

Differences ...

==== //depot/projects/wifi/sys/net80211/ieee80211.c#39 (text+ko) ====

@@ -303,7 +303,7 @@
 static __inline int
 mappsb(u_int freq, u_int flags)
 {
-	return 37 + ((freq * 10) + ((freq % 5) == 2 ? 5 : 0) - 49400) / 5;
+	return ((freq * 10) + (((freq % 5) == 2) ? 5 : 0) - 49400) / 5;
 }
 
 /*
@@ -312,6 +312,7 @@
 int
 ieee80211_mhz2ieee(u_int freq, u_int flags)
 {
+#define	IS_FREQ_IN_PSB(_freq) ((_freq) > 4940 && (_freq) < 4990)
 	if (flags & IEEE80211_CHAN_GSM)
 		return mapgsm(freq, flags);
 	if (flags & IEEE80211_CHAN_2GHZ) {	/* 2GHz band */
@@ -323,7 +324,8 @@
 			return 15 + ((freq - 2512) / 20);
 	} else if (flags & IEEE80211_CHAN_5GHZ) {	/* 5Ghz band */
 		if (freq <= 5000) {
-			if (flags &(IEEE80211_CHAN_HALF|IEEE80211_CHAN_QUARTER))
+			/* XXX check regdomain? */
+			if (IS_FREQ_IN_PSB(freq))
 				return mappsb(freq, flags);
 			return (freq - 4000) / 5;
 		} else
@@ -337,7 +339,7 @@
 			return ((int) freq - 2407) / 5;
 		}
 		if (freq < 5000) {
-			if (flags &(IEEE80211_CHAN_HALF|IEEE80211_CHAN_QUARTER))
+			if (IS_FREQ_IN_PSB(freq))
 				return mappsb(freq, flags);
 			else if (freq > 4900)
 				return (freq - 4000) / 5;
@@ -346,6 +348,7 @@
 		}
 		return (freq - 5000) / 5;
 	}
+#undef IS_FREQ_IN_PSB
 }
 
 /*
@@ -584,9 +587,9 @@
 {
 	const struct ieee80211_channel *c;
 	char type;
-	int i;
+	int i, cw;
 
-	printf("Chan  Freq  RegPwr  MinPwr  MaxPwr\n");
+	printf("Chan  Freq  CW  RegPwr  MinPwr  MaxPwr\n");
 	for (i = 0; i < ic->ic_nchans; i++) {
 		c = &ic->ic_channels[i];
 		if (IEEE80211_IS_CHAN_ST(c))
@@ -603,8 +606,15 @@
 			type = 'b';
 		else
 			type = 'f';
-		printf("%4d  %4d%c %6d  %6d  %6d\n"
+		if (IEEE80211_IS_CHAN_HALF(c))
+			cw = 10;
+		else if (IEEE80211_IS_CHAN_QUARTER(c))
+			cw = 5;
+		else
+			cw = 20;
+		printf("%4d  %4d%c %2d  %6d  %6d  %6d\n"
 			, c->ic_ieee, c->ic_freq, type
+			, cw
 			, c->ic_maxregpower
 			, c->ic_minpower, c->ic_maxpower
 		);


More information about the p4-projects mailing list