Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Apr 2008 17:52:40 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 140797 for review
Message-ID:  <200804281752.m3SHqeqF046679@repoman.freebsd.org>

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

Change 140797 by sam@sam_ebb on 2008/04/28 17:51:48

	o revise ieee80211_plcp2rate and ieee80211_rate2plcp to take a
	  phy type to potentially disambiguate data (we ignore it for
	  converting rate as the current supported rates are unambiguous);
	  note ieee80211_phymode was intentionally not used here
	o correct ieee80211_rate2plcp; was using ralink-proprietary codes
	  for CCK rates instead of what's in the IEEE spec

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_phy.c#7 edit
.. //depot/projects/vap/sys/net80211/ieee80211_phy.h#6 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_phy.c#7 (text+ko) ====

@@ -309,9 +309,9 @@
  * XXX might be a candidate for inline
  */
 uint8_t
-ieee80211_plcp2rate(uint8_t plcp, int ofdm)
+ieee80211_plcp2rate(uint8_t plcp, enum ieee80211_phytype type)
 {
-	if (ofdm) {
+	if (type == IEEE80211_T_OFDM) {
 		static const uint8_t ofdm_plcp2rate[16] = {
 			[0xb]	= 12,
 			[0xf]	= 18,
@@ -323,7 +323,8 @@
 			[0xc]	= 108
 		};
 		return ofdm_plcp2rate[plcp & 0xf];
-	} else {
+	}
+	if (type == IEEE80211_T_CCK) {
 		static const uint8_t cck_plcp2rate[16] = {
 			[0xa]	= 2,	/* 0x0a */
 			[0x4]	= 4,	/* 0x14 */
@@ -333,21 +334,17 @@
 		};
 		return cck_plcp2rate[plcp & 0xf];
 	}
+	return 0;
 }
 
 /*
  * Covert 802.11 rate to PLCP signal.
  */
 uint8_t
-ieee80211_rate2plcp(int rate)
+ieee80211_rate2plcp(int rate, enum ieee80211_phytype type)
 {
+	/* XXX ignore type for now since rates are unique */
 	switch (rate) {
-	/* CCK rates (returned values are device-dependent) */
-	case 2:		return 0x0;
-	case 4:		return 0x1;
-	case 11:	return 0x2;
-	case 22:	return 0x3;
-
 	/* OFDM rates (cf IEEE Std 802.11a-1999, pp. 14 Table 80) */
 	case 12:	return 0xb;
 	case 18:	return 0xf;
@@ -357,9 +354,17 @@
 	case 72:	return 0xd;
 	case 96:	return 0x8;
 	case 108:	return 0xc;
+	/* CCK rates (IEEE Std 802.11b-1999 page 15, subclause 18.2.3.3) */
+	case 2:		return 10;
+	case 4:		return 20;
+	case 11:	return 55;
+	case 22:	return 110;
+	/* IEEE Std 802.11g-2003 page 19, subclause 19.3.2.1 */
+	case 44:	return 220;
 	}
-	return 0xff;		/* XXX unsupported/unknown rate */
+	return 0;		/* XXX unsupported/unknown rate */
 }
+
 /*
  * Compute the time to transmit a frame of length frameLen bytes
  * using the specified rate, phy, and short preamble setting.

==== //depot/projects/vap/sys/net80211/ieee80211_phy.h#6 (text+ko) ====

@@ -140,10 +140,10 @@
 /*
  * Convert PLCP signal/rate field to 802.11 rate code (.5Mbits/s)
  */
-uint8_t		ieee80211_plcp2rate(uint8_t, int);
+uint8_t		ieee80211_plcp2rate(uint8_t, enum ieee80211_phytype);
 /*
  * Convert 802.11 rate code to PLCP signal.
  */
-uint8_t		ieee80211_rate2plcp(int);
+uint8_t		ieee80211_rate2plcp(int, enum ieee80211_phytype);
 #endif	/* _KERNEL */
 #endif	/* !_NET80211_IEEE80211_PHY_H_ */



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