mirror of
https://git.freebsd.org/src.git
synced 2026-01-16 23:02:24 +00:00
net80211: change ieee80211_ratectl_rate() to not return a rix
There are only a few places where the returned rix is used: * linuxkpi - logging * bwi/bwn - used for finding a fallback rate to choose, which honestly should be returned by the ratectl API * iwm - building the rateset to program into firmware Everyone else uses the dot11rate value in ni->ni_txnode. This is a precursor for VHT and later rate support; where currently there aren't rate tables in ieee80211_phy.c for VHT and later rates. Although it's likely doable to add tables for VHT, 11ax and MU-OFDMA (HE) rates are sufficiently larger/different to just not fit in the current scheme without more refactoring. Differential Revision: https://reviews.freebsd.org/D48603 Reviewed by: bz, thj
This commit is contained in:
parent
7067450010
commit
46de4d9fc2
5 changed files with 39 additions and 29 deletions
|
|
@ -6921,7 +6921,6 @@ linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *hw,
|
|||
}
|
||||
|
||||
if (ni != NULL) {
|
||||
int ridx __unused;
|
||||
#ifdef LINUXKPI_DEBUG_80211
|
||||
int old_rate;
|
||||
|
||||
|
|
@ -6946,15 +6945,15 @@ linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *hw,
|
|||
|
||||
IMPROVE("only update of rate matches but that requires us to get a proper rate");
|
||||
ieee80211_ratectl_tx_complete(ni, &txs);
|
||||
ridx = ieee80211_ratectl_rate(ni->ni_vap->iv_bss, NULL, 0);
|
||||
ieee80211_ratectl_rate(ni->ni_vap->iv_bss, NULL, 0);
|
||||
|
||||
#ifdef LINUXKPI_DEBUG_80211
|
||||
if (linuxkpi_debug_80211 & D80211_TRACE_TX) {
|
||||
printf("TX-RATE: %s: old %d new %d ridx %d, "
|
||||
printf("TX-RATE: %s: old %d new %d "
|
||||
"long_retries %d\n", __func__,
|
||||
old_rate,
|
||||
ieee80211_node_get_txrate_dot11rate(ni->ni_vap->iv_bss),
|
||||
ridx, txs.long_retries);
|
||||
txs.long_retries);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2916,7 +2916,7 @@ bwi_encap(struct bwi_softc *sc, int idx, struct mbuf *m,
|
|||
uint32_t mac_ctrl;
|
||||
uint16_t phy_ctrl;
|
||||
bus_addr_t paddr;
|
||||
int type, ismcast, pkt_len, error, rix;
|
||||
int type, ismcast, pkt_len, error;
|
||||
#if 0
|
||||
const uint8_t *p;
|
||||
int i;
|
||||
|
|
@ -2943,15 +2943,10 @@ bwi_encap(struct bwi_softc *sc, int idx, struct mbuf *m,
|
|||
} else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) {
|
||||
rate = rate_fb = tp->ucastrate;
|
||||
} else {
|
||||
rix = ieee80211_ratectl_rate(ni, NULL, pkt_len);
|
||||
ieee80211_ratectl_rate(ni, NULL, pkt_len);
|
||||
rate = ieee80211_node_get_txrate_dot11rate(ni);
|
||||
|
||||
if (rix > 0) {
|
||||
rate_fb = ni->ni_rates.rs_rates[rix-1] &
|
||||
IEEE80211_RATE_VAL;
|
||||
} else {
|
||||
rate_fb = rate;
|
||||
}
|
||||
/* TODO: assign rate_fb the previous rate, if available */
|
||||
rate_fb = rate;
|
||||
}
|
||||
tb->tb_rate[0] = rate;
|
||||
tb->tb_rate[1] = rate_fb;
|
||||
|
|
|
|||
|
|
@ -6394,7 +6394,7 @@ bwn_set_txhdr(struct bwn_mac *mac, struct ieee80211_node *ni,
|
|||
uint8_t *prot_ptr;
|
||||
unsigned int len;
|
||||
uint32_t macctl = 0;
|
||||
int rts_rate, rts_rate_fb, ismcast, isshort, rix, type;
|
||||
int rts_rate, rts_rate_fb, ismcast, isshort, type;
|
||||
uint16_t phyctl = 0;
|
||||
uint8_t rate, rate_fb;
|
||||
int fill_phy_ctl1 = 0;
|
||||
|
|
@ -6420,14 +6420,10 @@ bwn_set_txhdr(struct bwn_mac *mac, struct ieee80211_node *ni,
|
|||
else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE)
|
||||
rate = rate_fb = tp->ucastrate;
|
||||
else {
|
||||
rix = ieee80211_ratectl_rate(ni, NULL, 0);
|
||||
ieee80211_ratectl_rate(ni, NULL, 0);
|
||||
rate = ieee80211_node_get_txrate_dot11rate(ni);
|
||||
|
||||
if (rix > 0)
|
||||
rate_fb = ni->ni_rates.rs_rates[rix - 1] &
|
||||
IEEE80211_RATE_VAL;
|
||||
else
|
||||
rate_fb = rate;
|
||||
/* TODO: assign rate_fb the previous rate, if available */
|
||||
rate_fb = rate;
|
||||
}
|
||||
|
||||
sc->sc_tx_rate = rate;
|
||||
|
|
|
|||
|
|
@ -3502,11 +3502,11 @@ iwm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt,
|
|||
if (rate_matched) {
|
||||
ieee80211_ratectl_tx_complete(ni, txs);
|
||||
|
||||
int rix = ieee80211_ratectl_rate(vap->iv_bss, NULL, 0);
|
||||
ieee80211_ratectl_rate(vap->iv_bss, NULL, 0);
|
||||
new_rate = ieee80211_node_get_txrate_dot11rate(vap->iv_bss);
|
||||
if (new_rate != 0 && new_rate != cur_rate) {
|
||||
struct iwm_node *in = IWM_NODE(vap->iv_bss);
|
||||
iwm_setrates(sc, in, rix);
|
||||
iwm_setrates(sc, in, new_rate);
|
||||
iwm_send_lq_cmd(sc, &in->in_lq, FALSE);
|
||||
}
|
||||
}
|
||||
|
|
@ -4270,7 +4270,7 @@ iwm_rate2ridx(struct iwm_softc *sc, uint8_t rate)
|
|||
|
||||
|
||||
static void
|
||||
iwm_setrates(struct iwm_softc *sc, struct iwm_node *in, int rix)
|
||||
iwm_setrates(struct iwm_softc *sc, struct iwm_node *in, int dot11rate)
|
||||
{
|
||||
struct ieee80211_node *ni = &in->in_ni;
|
||||
struct iwm_lq_cmd *lq = &in->in_lq;
|
||||
|
|
@ -4278,8 +4278,27 @@ iwm_setrates(struct iwm_softc *sc, struct iwm_node *in, int rix)
|
|||
int nrates = rs->rs_nrates;
|
||||
int i, ridx, tab = 0;
|
||||
// int txant = 0;
|
||||
int rix;
|
||||
|
||||
KASSERT(rix >= 0 && rix < nrates, ("invalid rix"));
|
||||
/*
|
||||
* Look up the rate index for the given legacy rate from
|
||||
* the rs_rates table. Default to the lowest rate if it's
|
||||
* not found (which is obviously hugely problematic.)
|
||||
*/
|
||||
rix = -1;
|
||||
for (i = 0; i < nrates; i++) {
|
||||
int rate = rs->rs_rates[i] & IEEE80211_RATE_VAL;
|
||||
if (rate == dot11rate) {
|
||||
rix = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (rix < 0) {
|
||||
device_printf(sc->sc_dev,
|
||||
"%s: failed to lookup dot11rate (%d)\n",
|
||||
__func__, dot11rate);
|
||||
rix = 0;
|
||||
}
|
||||
|
||||
if (nrates > nitems(lq->rs_table)) {
|
||||
device_printf(sc->sc_dev,
|
||||
|
|
@ -4559,8 +4578,9 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
|
|||
iwm_enable_beacon_filter(sc, ivp);
|
||||
iwm_power_update_mac(sc);
|
||||
iwm_update_quotas(sc, ivp);
|
||||
int rix = ieee80211_ratectl_rate(&in->in_ni, NULL, 0);
|
||||
iwm_setrates(sc, in, rix);
|
||||
ieee80211_ratectl_rate(&in->in_ni, NULL, 0);
|
||||
iwm_setrates(sc, in,
|
||||
ieee80211_node_get_txrate_dot11rate(&in->in_ni));
|
||||
|
||||
if ((error = iwm_send_lq_cmd(sc, &in->in_lq, TRUE)) != 0) {
|
||||
device_printf(sc->sc_dev,
|
||||
|
|
|
|||
|
|
@ -127,12 +127,12 @@ ieee80211_ratectl_node_deinit(struct ieee80211_node *ni)
|
|||
vap->iv_rate->ir_node_deinit(ni);
|
||||
}
|
||||
|
||||
static int __inline
|
||||
static void __inline
|
||||
ieee80211_ratectl_rate(struct ieee80211_node *ni, void *arg, uint32_t iarg)
|
||||
{
|
||||
const struct ieee80211vap *vap = ni->ni_vap;
|
||||
|
||||
return vap->iv_rate->ir_rate(ni, arg, iarg);
|
||||
vap->iv_rate->ir_rate(ni, arg, iarg);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue