Date: Fri, 31 May 2013 22:23:17 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r251205 - user/adrian/net80211_tx/sys/net80211 Message-ID: <201305312223.r4VMNHS7092307@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Fri May 31 22:23:17 2013 New Revision: 251205 URL: http://svnweb.freebsd.org/changeset/base/251205 Log: Assert if the high bit in the passed in rate value is set for these routines. Since MCS rates will trip these routines up, let's just enforce for now that the caller strip out the high bit of any basic rate. Modified: user/adrian/net80211_tx/sys/net80211/ieee80211_phy.h Modified: user/adrian/net80211_tx/sys/net80211/ieee80211_phy.h ============================================================================== --- user/adrian/net80211_tx/sys/net80211/ieee80211_phy.h Fri May 31 22:21:37 2013 (r251204) +++ user/adrian/net80211_tx/sys/net80211/ieee80211_phy.h Fri May 31 22:23:17 2013 (r251205) @@ -85,7 +85,14 @@ const struct ieee80211_rate_table *ieee8 static __inline__ uint8_t ieee80211_ack_rate(const struct ieee80211_rate_table *rt, uint8_t rate) { - uint8_t cix = rt->info[rt->rateCodeToIndex[rate]].ctlRateIndex; + /* + * XXX Assert this is for a legacy rate; not for an MCS rate. + * If the caller wishes to use it for a basic rate, they should + * clear the high bit first. + */ + KASSERT(! (rate & 0x80), ("rate %d is basic/mcs?", rate)); + + uint8_t cix = rt->info[rt->rateCodeToIndex[rate & IEEE80211_RATE_VAL]].ctlRateIndex; KASSERT(cix != (uint8_t)-1, ("rate %d has no info", rate)); return rt->info[cix].dot11Rate; } @@ -93,7 +100,14 @@ ieee80211_ack_rate(const struct ieee8021 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; + /* + * XXX Assert this is for a legacy rate; not for an MCS rate. + * If the caller wishes to use it for a basic rate, they should + * clear the high bit first. + */ + KASSERT(! (rate & 0x80), ("rate %d is basic/mcs?", rate)); + + uint8_t cix = rt->info[rt->rateCodeToIndex[rate & IEEE80211_RATE_VAL]].ctlRateIndex; KASSERT(cix != (uint8_t)-1, ("rate %d has no info", rate)); return rt->info[cix].dot11Rate; } @@ -101,7 +115,14 @@ ieee80211_ctl_rate(const struct ieee8021 static __inline__ enum ieee80211_phytype ieee80211_rate2phytype(const struct ieee80211_rate_table *rt, uint8_t rate) { - uint8_t rix = rt->rateCodeToIndex[rate]; + /* + * XXX Assert this is for a legacy rate; not for an MCS rate. + * If the caller wishes to use it for a basic rate, they should + * clear the high bit first. + */ + KASSERT(! (rate & 0x80), ("rate %d is basic/mcs?", rate)); + + uint8_t rix = rt->rateCodeToIndex[rate & IEEE80211_RATE_VAL]; KASSERT(rix != (uint8_t)-1, ("rate %d has no info", rate)); return rt->info[rix].phy; } @@ -109,6 +130,13 @@ ieee80211_rate2phytype(const struct ieee static __inline__ int ieee80211_isratevalid(const struct ieee80211_rate_table *rt, uint8_t rate) { + /* + * XXX Assert this is for a legacy rate; not for an MCS rate. + * If the caller wishes to use it for a basic rate, they should + * clear the high bit first. + */ + KASSERT(! (rate & 0x80), ("rate %d is basic/mcs?", rate)); + return rt->rateCodeToIndex[rate] != (uint8_t)-1; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305312223.r4VMNHS7092307>