return ret;
}
+static inline u8 _rtl_rate_id(struct ieee80211_hw *hw,
+ struct rtl_sta_info *sta_entry,
+ int rate_index)
+{
+ struct rtl_priv *rtlpriv = rtl_priv(hw);
+
+ if (rtlpriv->cfg->spec_ver & RTL_SPEC_NEW_RATEID) {
+ int wireless_mode = sta_entry ?
+ sta_entry->wireless_mode : WIRELESS_MODE_G;
+
+ return rtl_mrate_idx_to_arfr_id(hw, rate_index, wireless_mode);
+ } else {
+ return rate_index;
+ }
+}
+
static void _rtl_txrate_selectmode(struct ieee80211_hw *hw,
struct ieee80211_sta *sta,
struct rtl_tcb_desc *tcb_desc)
{
-#define SET_RATE_ID(rate_id) \
- ((rtlpriv->cfg->spec_ver & RTL_SPEC_NEW_RATEID) ? \
- rtl_mrate_idx_to_arfr_id(hw, rate_id, \
- (sta_entry ? sta_entry->wireless_mode : \
- WIRELESS_MODE_G)) : \
- rate_id)
-
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
struct rtl_sta_info *sta_entry = NULL;
- u8 ratr_index = SET_RATE_ID(RATR_INX_WIRELESS_MC);
+ u8 ratr_index = _rtl_rate_id(hw, sta_entry, RATR_INX_WIRELESS_MC);
if (sta) {
sta_entry = (struct rtl_sta_info *)sta->drv_priv;
rtlpriv->cfg->maps[RTL_RC_CCK_RATE2M];
tcb_desc->use_driver_rate = 1;
tcb_desc->ratr_index =
- SET_RATE_ID(RATR_INX_WIRELESS_MC);
+ _rtl_rate_id(hw, sta_entry,
+ RATR_INX_WIRELESS_MC);
} else {
tcb_desc->ratr_index = ratr_index;
}
; /* use sta_entry->ratr_index */
else if (mac->mode == WIRELESS_MODE_AC_5G)
tcb_desc->ratr_index =
- SET_RATE_ID(RATR_INX_WIRELESS_AC_5N);
+ _rtl_rate_id(hw, sta_entry,
+ RATR_INX_WIRELESS_AC_5N);
else if (mac->mode == WIRELESS_MODE_AC_24G)
tcb_desc->ratr_index =
- SET_RATE_ID(RATR_INX_WIRELESS_AC_24N);
+ _rtl_rate_id(hw, sta_entry,
+ RATR_INX_WIRELESS_AC_24N);
else if (mac->mode == WIRELESS_MODE_N_24G)
tcb_desc->ratr_index =
- SET_RATE_ID(RATR_INX_WIRELESS_NGB);
+ _rtl_rate_id(hw, sta_entry,
+ RATR_INX_WIRELESS_NGB);
else if (mac->mode == WIRELESS_MODE_N_5G)
tcb_desc->ratr_index =
- SET_RATE_ID(RATR_INX_WIRELESS_NG);
+ _rtl_rate_id(hw, sta_entry,
+ RATR_INX_WIRELESS_NG);
else if (mac->mode & WIRELESS_MODE_G)
tcb_desc->ratr_index =
- SET_RATE_ID(RATR_INX_WIRELESS_GB);
+ _rtl_rate_id(hw, sta_entry,
+ RATR_INX_WIRELESS_GB);
else if (mac->mode & WIRELESS_MODE_B)
tcb_desc->ratr_index =
- SET_RATE_ID(RATR_INX_WIRELESS_B);
+ _rtl_rate_id(hw, sta_entry,
+ RATR_INX_WIRELESS_B);
else if (mac->mode & WIRELESS_MODE_A)
tcb_desc->ratr_index =
- SET_RATE_ID(RATR_INX_WIRELESS_G);
+ _rtl_rate_id(hw, sta_entry,
+ RATR_INX_WIRELESS_G);
} else if (mac->opmode == NL80211_IFTYPE_AP ||
mac->opmode == NL80211_IFTYPE_ADHOC) {
}
}
}
-#undef SET_RATE_ID
}
static void _rtl_query_bandwidth_mode(struct ieee80211_hw *hw,
struct ieee80211_sta *sta,
struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc)
{
-#define SET_RATE_ID(rate_id) \
- ((rtlpriv->cfg->spec_ver & RTL_SPEC_NEW_RATEID) ? \
- rtl_mrate_idx_to_arfr_id(hw, rate_id, \
- (sta_entry ? sta_entry->wireless_mode : \
- WIRELESS_MODE_G)) : \
- rate_id)
-
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_mac *rtlmac = rtl_mac(rtl_priv(hw));
struct ieee80211_hdr *hdr = rtl_get_hdr(skb);
if (!ieee80211_is_data(fc)) {
tcb_desc->use_driver_rate = true;
- tcb_desc->ratr_index = SET_RATE_ID(RATR_INX_WIRELESS_MC);
+ tcb_desc->ratr_index = _rtl_rate_id(hw, sta_entry,
+ RATR_INX_WIRELESS_MC);
tcb_desc->disable_ratefallback = 1;
tcb_desc->mac_id = 0;
tcb_desc->packet_bw = false;
*/
if (info->control.rates[0].idx == 0 || ieee80211_is_nullfunc(fc)) {
tcb_desc->use_driver_rate = true;
- tcb_desc->ratr_index = SET_RATE_ID(RATR_INX_WIRELESS_MC);
+ tcb_desc->ratr_index = _rtl_rate_id(hw, sta_entry,
+ RATR_INX_WIRELESS_MC);
tcb_desc->disable_ratefallback = 1;
} else if (sta && sta->vht_cap.vht_supported) {
_rtl_qurey_shortpreamble_mode(hw, tcb_desc, info);
_rtl_query_shortgi(hw, sta, tcb_desc, info);
_rtl_query_protection_mode(hw, tcb_desc, info);
-#undef SET_RATE_ID
}
bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb)