rtwn(4): de-hardcode ('h/w rate index' - 'corresponding MCS index') constant
This commit is contained in:
parent
45880e40f4
commit
5366d448e4
@ -36,7 +36,9 @@
|
|||||||
#define RTWN_RIDX_OFDM36 9
|
#define RTWN_RIDX_OFDM36 9
|
||||||
#define RTWN_RIDX_OFDM48 10
|
#define RTWN_RIDX_OFDM48 10
|
||||||
#define RTWN_RIDX_OFDM54 11
|
#define RTWN_RIDX_OFDM54 11
|
||||||
#define RTWN_RIDX_HT_MCS(i) (12 + (i))
|
|
||||||
|
#define RTWN_RIDX_HT_MCS_SHIFT 12
|
||||||
|
#define RTWN_RIDX_HT_MCS(i) (RTWN_RIDX_HT_MCS_SHIFT + (i))
|
||||||
|
|
||||||
#define RTWN_RIDX_COUNT 28
|
#define RTWN_RIDX_COUNT 28
|
||||||
#define RTWN_RIDX_UNKNOWN (uint8_t)-1
|
#define RTWN_RIDX_UNKNOWN (uint8_t)-1
|
||||||
@ -53,8 +55,7 @@ static __inline uint8_t
|
|||||||
rate2ridx(uint8_t rate)
|
rate2ridx(uint8_t rate)
|
||||||
{
|
{
|
||||||
if (rate & IEEE80211_RATE_MCS) {
|
if (rate & IEEE80211_RATE_MCS) {
|
||||||
/* 11n rates start at idx 12 */
|
return ((rate & 0xf) + RTWN_RIDX_HT_MCS_SHIFT);
|
||||||
return ((rate & 0xf) + 12);
|
|
||||||
}
|
}
|
||||||
switch (rate) {
|
switch (rate) {
|
||||||
/* 11g */
|
/* 11g */
|
||||||
|
@ -108,7 +108,8 @@ r88e_ratectl_tx_complete(struct rtwn_softc *sc, uint8_t *buf, int len)
|
|||||||
txs.long_retries = ntries;
|
txs.long_retries = ntries;
|
||||||
if (rpt->final_rate > RTWN_RIDX_OFDM54) { /* MCS */
|
if (rpt->final_rate > RTWN_RIDX_OFDM54) { /* MCS */
|
||||||
txs.final_rate =
|
txs.final_rate =
|
||||||
(rpt->final_rate - 12) | IEEE80211_RATE_MCS;
|
rpt->final_rate - RTWN_RIDX_HT_MCS_SHIFT;
|
||||||
|
txs.final_rate |= IEEE80211_RATE_MCS;
|
||||||
} else
|
} else
|
||||||
txs.final_rate = ridx2rate[rpt->final_rate];
|
txs.final_rate = ridx2rate[rpt->final_rate];
|
||||||
if (rpt->rptb1 & R88E_RPTB1_PKT_OK)
|
if (rpt->rptb1 & R88E_RPTB1_PKT_OK)
|
||||||
|
@ -140,7 +140,8 @@ r92c_get_rx_stats(struct rtwn_softc *sc, struct ieee80211_rx_stats *rxs,
|
|||||||
else
|
else
|
||||||
rxs->c_pktflags |= IEEE80211_RX_F_OFDM;
|
rxs->c_pktflags |= IEEE80211_RX_F_OFDM;
|
||||||
} else { /* MCS0~15. */
|
} else { /* MCS0~15. */
|
||||||
rxs->c_rate = IEEE80211_RATE_MCS | (rate - 12);
|
rxs->c_rate =
|
||||||
|
IEEE80211_RATE_MCS | (rate - RTWN_RIDX_HT_MCS_SHIFT);
|
||||||
rxs->c_pktflags |= IEEE80211_RX_F_HT;
|
rxs->c_pktflags |= IEEE80211_RX_F_HT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,8 @@ r12a_ratectl_tx_complete(struct rtwn_softc *sc, uint8_t *buf, int len)
|
|||||||
txs.long_retries = ntries;
|
txs.long_retries = ntries;
|
||||||
if (rpt->final_rate > RTWN_RIDX_OFDM54) { /* MCS */
|
if (rpt->final_rate > RTWN_RIDX_OFDM54) { /* MCS */
|
||||||
txs.final_rate =
|
txs.final_rate =
|
||||||
(rpt->final_rate - 12) | IEEE80211_RATE_MCS;
|
rpt->final_rate - RTWN_RIDX_HT_MCS_SHIFT;
|
||||||
|
txs.final_rate |= IEEE80211_RATE_MCS;
|
||||||
} else
|
} else
|
||||||
txs.final_rate = ridx2rate[rpt->final_rate];
|
txs.final_rate = ridx2rate[rpt->final_rate];
|
||||||
if (rpt->txrptb0 & R12A_TXRPTB0_RETRY_OVER)
|
if (rpt->txrptb0 & R12A_TXRPTB0_RETRY_OVER)
|
||||||
@ -310,7 +311,8 @@ r12a_get_rx_stats(struct rtwn_softc *sc, struct ieee80211_rx_stats *rxs,
|
|||||||
rxs->c_pktflags |= IEEE80211_RX_F_OFDM;
|
rxs->c_pktflags |= IEEE80211_RX_F_OFDM;
|
||||||
} else { /* MCS0~15. */
|
} else { /* MCS0~15. */
|
||||||
/* TODO: VHT rates */
|
/* TODO: VHT rates */
|
||||||
rxs->c_rate = IEEE80211_RATE_MCS | (rate - 12);
|
rxs->c_rate =
|
||||||
|
IEEE80211_RATE_MCS | (rate - RTWN_RIDX_HT_MCS_SHIFT);
|
||||||
rxs->c_pktflags |= IEEE80211_RX_F_HT;
|
rxs->c_pktflags |= IEEE80211_RX_F_HT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user