[iwm] Add the BSS's basic rates to iwm's LQ command, not all the rates.

Makes the firmware use appropriate Tx rates for ACKs.

Obtained from: dragonflybsd.git ab1d3efc208e797c1e09759cd506c95c0aeaa06e
This commit is contained in:
Adrian Chadd 2017-03-25 02:55:13 +00:00
parent cd20383e4a
commit 6c3c52590e
3 changed files with 27 additions and 8 deletions

View File

@ -4291,6 +4291,21 @@ iwm_node_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN])
M_NOWAIT | M_ZERO);
}
uint8_t
iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx)
{
int i;
uint8_t rval;
for (i = 0; i < rs->rs_nrates; i++) {
rval = (rs->rs_rates[i] & IEEE80211_RATE_VAL);
if (rval == iwm_rates[ridx].rate)
return rs->rs_rates[i];
}
return 0;
}
static void
iwm_setrates(struct iwm_softc *sc, struct iwm_node *in)
{

View File

@ -162,24 +162,28 @@ __FBSDID("$FreeBSD$");
static void
iwm_mvm_ack_rates(struct iwm_softc *sc, int is2ghz,
int *cck_rates, int *ofdm_rates)
int *cck_rates, int *ofdm_rates, struct iwm_node *in)
{
int lowest_present_ofdm = 100;
int lowest_present_cck = 100;
uint8_t cck = 0;
uint8_t ofdm = 0;
int i;
struct ieee80211_rateset *rs = &in->in_ni.ni_rates;
if (is2ghz) {
for (i = 0; i <= IWM_LAST_CCK_RATE; i++) {
for (i = IWM_FIRST_CCK_RATE; i <= IWM_LAST_CCK_RATE; i++) {
if ((iwm_ridx2rate(rs, i) & IEEE80211_RATE_BASIC) == 0)
continue;
cck |= (1 << i);
if (lowest_present_cck > i)
lowest_present_cck = i;
}
}
for (i = IWM_FIRST_OFDM_RATE; i <= IWM_LAST_NON_HT_RATE; i++) {
int adj = i - IWM_FIRST_OFDM_RATE;
ofdm |= (1 << adj);
if ((iwm_ridx2rate(rs, i) & IEEE80211_RATE_BASIC) == 0)
continue;
ofdm |= (1 << (i - IWM_FIRST_OFDM_RATE));
if (lowest_present_ofdm > i)
lowest_present_ofdm = i;
}
@ -307,7 +311,7 @@ iwm_mvm_mac_ctxt_cmd_common(struct iwm_softc *sc, struct iwm_node *in,
} else {
is2ghz = 1;
}
iwm_mvm_ack_rates(sc, is2ghz, &cck_ack_rates, &ofdm_ack_rates);
iwm_mvm_ack_rates(sc, is2ghz, &cck_ack_rates, &ofdm_ack_rates, in);
cmd->cck_rates = htole32(cck_ack_rates);
cmd->ofdm_rates = htole32(ofdm_ack_rates);
@ -446,13 +450,11 @@ iwm_mvm_mac_ctxt_cmd_station(struct iwm_softc *sc, struct ieee80211vap *vap,
{
struct ieee80211_node *ni = vap->iv_bss;
struct iwm_node *in = IWM_NODE(ni);
struct iwm_mac_ctx_cmd cmd;
struct iwm_mac_ctx_cmd cmd = {};
IWM_DPRINTF(sc, IWM_DEBUG_RESET,
"%s: called; action=%d\n", __func__, action);
memset(&cmd, 0, sizeof(cmd));
/* Fill the common data for all mac context types */
iwm_mvm_mac_ctxt_cmd_common(sc, in, &cmd, action);

View File

@ -120,6 +120,8 @@ extern int iwm_dma_contig_alloc(bus_dma_tag_t tag, struct iwm_dma_info *dma,
bus_size_t size, bus_size_t alignment);
extern void iwm_dma_contig_free(struct iwm_dma_info *);
extern uint8_t iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx);
static inline uint8_t
iwm_mvm_get_valid_tx_ant(struct iwm_softc *sc)
{