diff options
author | sam <sam@FreeBSD.org> | 2008-05-12 00:32:52 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2008-05-12 00:32:52 +0000 |
commit | 84c4dbca4f8c896454fea4783d326b6ae762c495 (patch) | |
tree | 8d1e3a21c6ef5e265717fe9a3c927a97d5d6b097 /sys/net80211 | |
parent | f663b621286051ac42452779cf814624994dae88 (diff) | |
download | FreeBSD-src-84c4dbca4f8c896454fea4783d326b6ae762c495.zip FreeBSD-src-84c4dbca4f8c896454fea4783d326b6ae762c495.tar.gz |
Update PLCP<->rate mapping support:
o correct mapping of CCK rates to PLCP; was using nonstandard Ralink
values which just happened to also be used by Zydas (so went unnoticed)
o change ieee80211_plcp2rate api to take a phy type instead of a flag
that indicates ofdm/!ofdm
o update drivers to match (restore per-driver code to map rate->PLCP)
Reviewed by: sephe, weongyo, thompsa
Diffstat (limited to 'sys/net80211')
-rw-r--r-- | sys/net80211/ieee80211_phy.c | 27 | ||||
-rw-r--r-- | sys/net80211/ieee80211_phy.h | 4 |
2 files changed, 18 insertions, 13 deletions
diff --git a/sys/net80211/ieee80211_phy.c b/sys/net80211/ieee80211_phy.c index e1c847f..4dd4b97 100644 --- a/sys/net80211/ieee80211_phy.c +++ b/sys/net80211/ieee80211_phy.c @@ -309,9 +309,9 @@ ieee80211_get_ratetable(struct ieee80211_channel *c) * 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 @@ ieee80211_plcp2rate(uint8_t plcp, int ofdm) [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 @@ ieee80211_plcp2rate(uint8_t plcp, int ofdm) }; 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 @@ ieee80211_rate2plcp(int rate) 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. diff --git a/sys/net80211/ieee80211_phy.h b/sys/net80211/ieee80211_phy.h index 2b5adcf..9e1f532 100644 --- a/sys/net80211/ieee80211_phy.h +++ b/sys/net80211/ieee80211_phy.h @@ -140,10 +140,10 @@ uint16_t ieee80211_compute_duration(const struct ieee80211_rate_table *, /* * 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_ */ |