PERFORCE change 137842 for review
Sam Leffler
sam at FreeBSD.org
Sun Mar 16 17:13:08 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=137842
Change 137842 by sam at sam_ebb on 2008/03/16 17:12:39
o add ieee80211_rate2plcp to convert an 802.11 rate to a
PLCP signal value
o add ieee80211_ctl_rate to return the rate to send a ctl frame
given a tx rate; this is same as the ack rate but duplicated
for clarity
Affected files ...
.. //depot/projects/vap/sys/net80211/ieee80211_phy.c#4 edit
.. //depot/projects/vap/sys/net80211/ieee80211_phy.h#4 edit
Differences ...
==== //depot/projects/vap/sys/net80211/ieee80211_phy.c#4 (text+ko) ====
@@ -339,6 +339,31 @@
}
/*
+ * Covert 802.11 rate to PLCP signal.
+ */
+uint8_t
+ieee80211_rate2plcp(int rate)
+{
+ 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;
+ case 24: return 0xa;
+ case 36: return 0xe;
+ case 48: return 0x9;
+ case 72: return 0xd;
+ case 96: return 0x8;
+ case 108: return 0xc;
+ }
+ return 0xff; /* XXX unsupported/unknown rate */
+}
+/*
* Compute the time to transmit a frame of length frameLen bytes
* using the specified rate, phy, and short preamble setting.
* SIFS is included.
==== //depot/projects/vap/sys/net80211/ieee80211_phy.h#4 (text+ko) ====
@@ -88,6 +88,14 @@
return rt->info[cix].dot11Rate;
}
+static __inline__ uint8_t
+ieee80211_ctl_rate(const struct ieee80211_rate_table *rt, uint8_t rate)
+{
+ uint8_t cix = rt->info[rt->rateCodeToIndex[rate]].ctlRateIndex;
+ KASSERT(cix != (uint8_t)-1, ("rate %d has no info", rate));
+ return rt->info[cix].dot11Rate;
+}
+
static __inline__ enum ieee80211_phytype
ieee80211_rate2phytype(const struct ieee80211_rate_table *rt, uint8_t rate)
{
@@ -130,8 +138,12 @@
uint16_t ieee80211_compute_duration(const struct ieee80211_rate_table *,
uint32_t frameLen, uint16_t rate, int isShortPreamble);
/*
- * Covert PLCP signal/rate field to 802.11 rate code (.5Mbits/s)
+ * Convert PLCP signal/rate field to 802.11 rate code (.5Mbits/s)
*/
uint8_t ieee80211_plcp2rate(uint8_t, int);
+/*
+ * Convert 802.11 rate code to PLCP signal.
+ */
+uint8_t ieee80211_rate2plcp(int);
#endif /* _KERNEL */
#endif /* !_NET80211_IEEE80211_PHY_H_ */
More information about the p4-projects
mailing list