|
@@ -299,6 +299,50 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
|
|
|
cpu_to_le16(iwl_mvm_tx_csum(mvm, skb, hdr, info));
|
|
|
}
|
|
|
|
|
|
+static u32 iwl_mvm_get_tx_rate(struct iwl_mvm *mvm,
|
|
|
+ struct ieee80211_tx_info *info,
|
|
|
+ struct ieee80211_sta *sta)
|
|
|
+{
|
|
|
+ int rate_idx;
|
|
|
+ u8 rate_plcp;
|
|
|
+ u32 rate_flags;
|
|
|
+
|
|
|
+ /* HT rate doesn't make sense for a non data frame */
|
|
|
+ WARN_ONCE(info->control.rates[0].flags & IEEE80211_TX_RC_MCS,
|
|
|
+ "Got an HT rate (flags:0x%x/mcs:%d) for a non data frame\n",
|
|
|
+ info->control.rates[0].flags,
|
|
|
+ info->control.rates[0].idx);
|
|
|
+
|
|
|
+ rate_idx = info->control.rates[0].idx;
|
|
|
+ /* if the rate isn't a well known legacy rate, take the lowest one */
|
|
|
+ if (rate_idx < 0 || rate_idx >= IWL_RATE_COUNT_LEGACY)
|
|
|
+ rate_idx = rate_lowest_index(
|
|
|
+ &mvm->nvm_data->bands[info->band], sta);
|
|
|
+
|
|
|
+ /* For 5 GHZ band, remap mac80211 rate indices into driver indices */
|
|
|
+ if (info->band == NL80211_BAND_5GHZ)
|
|
|
+ rate_idx += IWL_FIRST_OFDM_RATE;
|
|
|
+
|
|
|
+ /* For 2.4 GHZ band, check that there is no need to remap */
|
|
|
+ BUILD_BUG_ON(IWL_FIRST_CCK_RATE != 0);
|
|
|
+
|
|
|
+ /* Get PLCP rate for tx_cmd->rate_n_flags */
|
|
|
+ rate_plcp = iwl_mvm_mac80211_idx_to_hwrate(rate_idx);
|
|
|
+
|
|
|
+ if (info->band == NL80211_BAND_2GHZ &&
|
|
|
+ !iwl_mvm_bt_coex_is_shared_ant_avail(mvm))
|
|
|
+ rate_flags = mvm->cfg->non_shared_ant << RATE_MCS_ANT_POS;
|
|
|
+ else
|
|
|
+ rate_flags =
|
|
|
+ BIT(mvm->mgmt_last_antenna_idx) << RATE_MCS_ANT_POS;
|
|
|
+
|
|
|
+ /* Set CCK flag as needed */
|
|
|
+ if ((rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE))
|
|
|
+ rate_flags |= RATE_MCS_CCK_MSK;
|
|
|
+
|
|
|
+ return (u32)rate_plcp | rate_flags;
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* Sets the fields in the Tx cmd that are rate related
|
|
|
*/
|
|
@@ -306,10 +350,6 @@ void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, struct iwl_tx_cmd *tx_cmd,
|
|
|
struct ieee80211_tx_info *info,
|
|
|
struct ieee80211_sta *sta, __le16 fc)
|
|
|
{
|
|
|
- u32 rate_flags;
|
|
|
- int rate_idx;
|
|
|
- u8 rate_plcp;
|
|
|
-
|
|
|
/* Set retry limit on RTS packets */
|
|
|
tx_cmd->rts_retry_limit = IWL_RTS_DFAULT_RETRY_LIMIT;
|
|
|
|
|
@@ -338,46 +378,12 @@ void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, struct iwl_tx_cmd *tx_cmd,
|
|
|
cpu_to_le32(TX_CMD_FLG_ACK | TX_CMD_FLG_BAR);
|
|
|
}
|
|
|
|
|
|
- /* HT rate doesn't make sense for a non data frame */
|
|
|
- WARN_ONCE(info->control.rates[0].flags & IEEE80211_TX_RC_MCS,
|
|
|
- "Got an HT rate (flags:0x%x/mcs:%d) for a non data frame (fc:0x%x)\n",
|
|
|
- info->control.rates[0].flags,
|
|
|
- info->control.rates[0].idx,
|
|
|
- le16_to_cpu(fc));
|
|
|
-
|
|
|
- rate_idx = info->control.rates[0].idx;
|
|
|
- /* if the rate isn't a well known legacy rate, take the lowest one */
|
|
|
- if (rate_idx < 0 || rate_idx >= IWL_RATE_COUNT_LEGACY)
|
|
|
- rate_idx = rate_lowest_index(
|
|
|
- &mvm->nvm_data->bands[info->band], sta);
|
|
|
-
|
|
|
- /* For 5 GHZ band, remap mac80211 rate indices into driver indices */
|
|
|
- if (info->band == NL80211_BAND_5GHZ)
|
|
|
- rate_idx += IWL_FIRST_OFDM_RATE;
|
|
|
-
|
|
|
- /* For 2.4 GHZ band, check that there is no need to remap */
|
|
|
- BUILD_BUG_ON(IWL_FIRST_CCK_RATE != 0);
|
|
|
-
|
|
|
- /* Get PLCP rate for tx_cmd->rate_n_flags */
|
|
|
- rate_plcp = iwl_mvm_mac80211_idx_to_hwrate(rate_idx);
|
|
|
-
|
|
|
mvm->mgmt_last_antenna_idx =
|
|
|
iwl_mvm_next_antenna(mvm, iwl_mvm_get_valid_tx_ant(mvm),
|
|
|
mvm->mgmt_last_antenna_idx);
|
|
|
|
|
|
- if (info->band == NL80211_BAND_2GHZ &&
|
|
|
- !iwl_mvm_bt_coex_is_shared_ant_avail(mvm))
|
|
|
- rate_flags = mvm->cfg->non_shared_ant << RATE_MCS_ANT_POS;
|
|
|
- else
|
|
|
- rate_flags =
|
|
|
- BIT(mvm->mgmt_last_antenna_idx) << RATE_MCS_ANT_POS;
|
|
|
-
|
|
|
- /* Set CCK flag as needed */
|
|
|
- if ((rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE))
|
|
|
- rate_flags |= RATE_MCS_CCK_MSK;
|
|
|
-
|
|
|
/* Set the rate in the TX cmd */
|
|
|
- tx_cmd->rate_n_flags = cpu_to_le32((u32)rate_plcp | rate_flags);
|
|
|
+ tx_cmd->rate_n_flags = cpu_to_le32(iwl_mvm_get_tx_rate(mvm, info, sta));
|
|
|
}
|
|
|
|
|
|
static inline void iwl_mvm_set_tx_cmd_pn(struct ieee80211_tx_info *info,
|