Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/rtwn/if_rtwn_rx.c
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | rtwn_get_rates(struct rtwn_softc *sc, const struct ieee80211_rateset *rs, | ||||
/* Get rates mask. */ | /* Get rates mask. */ | ||||
rates = 0; | rates = 0; | ||||
maxrate = 0; | maxrate = 0; | ||||
/* This is for 11bg */ | /* This is for 11bg */ | ||||
for (i = 0; i < rs->rs_nrates; i++) { | for (i = 0; i < rs->rs_nrates; i++) { | ||||
/* Convert 802.11 rate to HW rate index. */ | /* Convert 802.11 rate to HW rate index. */ | ||||
ridx = rate2ridx(IEEE80211_RV(rs->rs_rates[i])); | ridx = rate_idx2ridx(rs->rates[i].rs_index); | ||||
if (ridx == RTWN_RIDX_UNKNOWN) /* Unknown rate, skip. */ | if (ridx == RTWN_RIDX_UNKNOWN) /* Unknown rate, skip. */ | ||||
continue; | continue; | ||||
if (((rs->rs_rates[i] & IEEE80211_RATE_BASIC) != 0) || | if (rs->rates[i].rs_basic || !basic_rates) { | ||||
!basic_rates) { | |||||
rates |= 1 << ridx; | rates |= 1 << ridx; | ||||
if (ridx > maxrate) | if (ridx > maxrate) | ||||
maxrate = ridx; | maxrate = ridx; | ||||
} | } | ||||
} | } | ||||
/* If we're doing 11n, enable 11n rates */ | /* If we're doing 11n, enable 11n rates */ | ||||
if (rs_ht != NULL && !basic_rates) { | if (rs_ht != NULL) { | ||||
for (i = 0; i < rs_ht->rs_nrates; i++) { | for (i = 0; i < rs_ht->rs_nrates; i++) { | ||||
if ((rs_ht->rs_rates[i] & 0x7f) > 0xf) | if (!rs_ht->rates[i].rs_basic && basic_rates) | ||||
continue; | continue; | ||||
/* 11n rates start at index 12 */ | |||||
ridx = RTWN_RIDX_HT_MCS((rs_ht->rs_rates[i]) & 0xf); | ridx = rate_idx2ridx(rs_ht->rates[i].rs_index); | ||||
if (ridx == RTWN_RIDX_UNKNOWN) | |||||
continue; | |||||
rates |= (1 << ridx); | rates |= (1 << ridx); | ||||
/* Guard against the rate table being oddly ordered */ | /* Guard against the rate table being oddly ordered */ | ||||
if (ridx > maxrate) | if (ridx > maxrate) | ||||
maxrate = ridx; | maxrate = ridx; | ||||
} | } | ||||
} | } | ||||
/* XXX VHT? */ | |||||
RTWN_DPRINTF(sc, RTWN_DEBUG_RA, | RTWN_DPRINTF(sc, RTWN_DEBUG_RA, | ||||
"%s: rates 0x%08X, maxrate %d\n", __func__, rates, maxrate); | "%s: rates 0x%08X, maxrate %d\n", __func__, rates, maxrate); | ||||
if (rates_p != NULL) | if (rates_p != NULL) | ||||
*rates_p = rates; | *rates_p = rates; | ||||
if (maxrate_p != NULL) | if (maxrate_p != NULL) | ||||
*maxrate_p = maxrate; | *maxrate_p = maxrate; | ||||
▲ Show 20 Lines • Show All 411 Lines • Show Last 20 Lines |