rtlwifi: Add rtl_get_hal_edca_param() to generate register's format of EDCA.

Convert from the value of ieee80211_tx_queue_params to Realtek's
register value.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Ping-Ke Shih 2017-09-29 14:47:55 -05:00 committed by Kalle Valo
parent cdc9c7a032
commit c1816f1709
2 changed files with 40 additions and 0 deletions

View File

@ -1557,6 +1557,42 @@ void rtl_wait_tx_report_acked(struct ieee80211_hw *hw, u32 wait_ms)
"Wait 1ms (%d/%d) to disable key.\n", i, wait_ms);
}
}
u32 rtl_get_hal_edca_param(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
enum wireless_mode wirelessmode,
struct ieee80211_tx_queue_params *param)
{
u32 reg = 0;
u8 sifstime = 10;
u8 slottime = 20;
/* AIFS = AIFSN * slot time + SIFS */
switch (wirelessmode) {
case WIRELESS_MODE_A:
case WIRELESS_MODE_N_24G:
case WIRELESS_MODE_N_5G:
case WIRELESS_MODE_AC_5G:
case WIRELESS_MODE_AC_24G:
sifstime = 16;
slottime = 9;
break;
case WIRELESS_MODE_G:
slottime = (vif->bss_conf.use_short_slot ? 9 : 20);
break;
default:
break;
}
reg |= (param->txop & 0x7FF) << 16;
reg |= (fls(param->cw_max) & 0xF) << 12;
reg |= (fls(param->cw_min) & 0xF) << 8;
reg |= (param->aifs & 0x0F) * slottime + sifstime;
return reg;
}
EXPORT_SYMBOL_GPL(rtl_get_hal_edca_param);
/*********************************************************
*
* functions called by core.c

View File

@ -137,6 +137,10 @@ void rtl_tx_report_handler(struct ieee80211_hw *hw, u8 *tmp_buf,
u8 c2h_cmd_len);
bool rtl_check_tx_report_acked(struct ieee80211_hw *hw);
void rtl_wait_tx_report_acked(struct ieee80211_hw *hw, u32 wait_ms);
u32 rtl_get_hal_edca_param(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
enum wireless_mode wirelessmode,
struct ieee80211_tx_queue_params *param);
void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb);
void rtl_collect_scan_list(struct ieee80211_hw *hw, struct sk_buff *skb);