|
@@ -96,7 +96,6 @@ EXPORT_SYMBOL(iwl_rates);
|
|
|
void iwl_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags,
|
|
|
struct ieee80211_tx_info *info)
|
|
|
{
|
|
|
- int rate_index;
|
|
|
struct ieee80211_tx_rate *r = &info->control.rates[0];
|
|
|
|
|
|
info->antenna_sel_tx =
|
|
@@ -111,10 +110,7 @@ void iwl_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags,
|
|
|
r->flags |= IEEE80211_TX_RC_DUP_DATA;
|
|
|
if (rate_n_flags & RATE_MCS_SGI_MSK)
|
|
|
r->flags |= IEEE80211_TX_RC_SHORT_GI;
|
|
|
- rate_index = iwl_hwrate_to_plcp_idx(rate_n_flags);
|
|
|
- if (info->band == IEEE80211_BAND_5GHZ)
|
|
|
- rate_index -= IWL_FIRST_OFDM_RATE;
|
|
|
- r->idx = rate_index;
|
|
|
+ r->idx = iwl_hwrate_to_mac80211_idx(rate_n_flags, info->band);
|
|
|
}
|
|
|
EXPORT_SYMBOL(iwl_hwrate_to_tx_control);
|
|
|
|
|
@@ -149,6 +145,27 @@ int iwl_hwrate_to_plcp_idx(u32 rate_n_flags)
|
|
|
}
|
|
|
EXPORT_SYMBOL(iwl_hwrate_to_plcp_idx);
|
|
|
|
|
|
+int iwl_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band)
|
|
|
+{
|
|
|
+ int idx = 0;
|
|
|
+ int band_offset = 0;
|
|
|
+
|
|
|
+ /* HT rate format: mac80211 wants an MCS number, which is just LSB */
|
|
|
+ if (rate_n_flags & RATE_MCS_HT_MSK) {
|
|
|
+ idx = (rate_n_flags & 0xff);
|
|
|
+ return idx;
|
|
|
+ /* Legacy rate format, search for match in table */
|
|
|
+ } else {
|
|
|
+ if (band == IEEE80211_BAND_5GHZ)
|
|
|
+ band_offset = IWL_FIRST_OFDM_RATE;
|
|
|
+ for (idx = band_offset; idx < IWL_RATE_COUNT_LEGACY; idx++)
|
|
|
+ if (iwl_rates[idx].plcp == (rate_n_flags & 0xFF))
|
|
|
+ return idx - band_offset;
|
|
|
+ }
|
|
|
+
|
|
|
+ return -1;
|
|
|
+}
|
|
|
+
|
|
|
u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant)
|
|
|
{
|
|
|
int i;
|