iwlwifi: mvm: Add support for new rate_n_flags in tx_cmd.
As part of the new rate_n_flags, tx_cmd API has changed. Add support for these changes. Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20211017162352.26efa51624b1.Ic96ae4d81b3ff07fb514df2b5f6a8e470e4d3778@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
This commit is contained in:
parent
1b6598c3dc
commit
d35d95ce8b
@ -267,7 +267,8 @@ struct iwl_tx_cmd_gen2 {
|
||||
struct iwl_dram_sec_info dram_info;
|
||||
__le32 rate_n_flags;
|
||||
struct ieee80211_hdr hdr[];
|
||||
} __packed; /* TX_CMD_API_S_VER_7 */
|
||||
} __packed; /* TX_CMD_API_S_VER_7,
|
||||
TX_CMD_API_S_VER_9 */
|
||||
|
||||
/**
|
||||
* struct iwl_tx_cmd_gen3 - TX command struct to FW for AX210+ devices
|
||||
@ -290,7 +291,8 @@ struct iwl_tx_cmd_gen3 {
|
||||
__le32 rate_n_flags;
|
||||
__le64 ttl;
|
||||
struct ieee80211_hdr hdr[];
|
||||
} __packed; /* TX_CMD_API_S_VER_8 */
|
||||
} __packed; /* TX_CMD_API_S_VER_8,
|
||||
TX_CMD_API_S_VER_10 */
|
||||
|
||||
/*
|
||||
* TX response related data
|
||||
|
@ -1240,7 +1240,7 @@ static int _iwl_dbgfs_inject_beacon_ie(struct iwl_mvm *mvm, char *bin, int len)
|
||||
mvmvif = iwl_mvm_vif_from_mac80211(vif);
|
||||
info = IEEE80211_SKB_CB(beacon);
|
||||
rate = iwl_mvm_mac_ctxt_get_lowest_rate(info, vif);
|
||||
flags = iwl_mvm_mac80211_idx_to_hwrate(rate);
|
||||
flags = iwl_mvm_mac80211_idx_to_hwrate(mvm->fw, rate);
|
||||
|
||||
if (rate == IWL_FIRST_CCK_RATE)
|
||||
flags |= IWL_MAC_BEACON_CCK;
|
||||
|
@ -844,7 +844,8 @@ static void iwl_mvm_mac_ctxt_set_tx(struct iwl_mvm *mvm,
|
||||
|
||||
rate = iwl_mvm_mac_ctxt_get_lowest_rate(info, vif);
|
||||
|
||||
tx->rate_n_flags |= cpu_to_le32(iwl_mvm_mac80211_idx_to_hwrate(rate));
|
||||
tx->rate_n_flags |=
|
||||
cpu_to_le32(iwl_mvm_mac80211_idx_to_hwrate(mvm->fw, rate));
|
||||
if (rate == IWL_FIRST_CCK_RATE)
|
||||
tx->rate_n_flags |= cpu_to_le32(RATE_MCS_CCK_MSK_V1);
|
||||
|
||||
@ -930,7 +931,7 @@ static int iwl_mvm_mac_ctxt_send_beacon_v9(struct iwl_mvm *mvm,
|
||||
struct ieee80211_chanctx_conf *ctx;
|
||||
int channel;
|
||||
|
||||
flags = iwl_mvm_mac80211_idx_to_hwrate(rate);
|
||||
flags = iwl_mvm_mac80211_idx_to_hwrate(mvm->fw, rate);
|
||||
|
||||
if (rate == IWL_FIRST_CCK_RATE)
|
||||
flags |= IWL_MAC_BEACON_CCK;
|
||||
|
@ -1448,7 +1448,7 @@ int iwl_mvm_legacy_rate_to_mac80211_idx(u32 rate_n_flags,
|
||||
void iwl_mvm_hwrate_to_tx_rate(u32 rate_n_flags,
|
||||
enum nl80211_band band,
|
||||
struct ieee80211_tx_rate *r);
|
||||
u8 iwl_mvm_mac80211_idx_to_hwrate(int rate_idx);
|
||||
u8 iwl_mvm_mac80211_idx_to_hwrate(const struct iwl_fw *fw, int rate_idx);
|
||||
u8 iwl_mvm_mac80211_ac_to_ucode_ac(enum ieee80211_ac_numbers ac);
|
||||
|
||||
static inline void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm)
|
||||
|
@ -268,6 +268,7 @@ static u32 iwl_mvm_get_tx_rate(struct iwl_mvm *mvm,
|
||||
int rate_idx = -1;
|
||||
u8 rate_plcp;
|
||||
u32 rate_flags = 0;
|
||||
bool is_cck;
|
||||
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
|
||||
|
||||
/* info->control is only relevant for non HW rate control */
|
||||
@ -299,11 +300,18 @@ static u32 iwl_mvm_get_tx_rate(struct iwl_mvm *mvm,
|
||||
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);
|
||||
rate_plcp = iwl_mvm_mac80211_idx_to_hwrate(mvm->fw, rate_idx);
|
||||
is_cck = (rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE);
|
||||
|
||||
/* Set CCK flag as needed */
|
||||
if ((rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE))
|
||||
/* Set CCK or OFDM flag */
|
||||
if (iwl_fw_lookup_cmd_ver(mvm->fw, LONG_GROUP, TX_CMD, 0) > 8) {
|
||||
if (!is_cck)
|
||||
rate_flags |= RATE_MCS_LEGACY_OFDM_MSK;
|
||||
else
|
||||
rate_flags |= RATE_MCS_CCK_MSK;
|
||||
} else if (is_cck) {
|
||||
rate_flags |= RATE_MCS_CCK_MSK_V1;
|
||||
}
|
||||
|
||||
return (u32)rate_plcp | rate_flags;
|
||||
}
|
||||
|
@ -152,9 +152,17 @@ int iwl_mvm_legacy_rate_to_mac80211_idx(u32 rate_n_flags,
|
||||
return -1;
|
||||
}
|
||||
|
||||
u8 iwl_mvm_mac80211_idx_to_hwrate(int rate_idx)
|
||||
u8 iwl_mvm_mac80211_idx_to_hwrate(const struct iwl_fw *fw, int rate_idx)
|
||||
{
|
||||
/* Get PLCP rate for tx_cmd->rate_n_flags */
|
||||
if (iwl_fw_lookup_cmd_ver(fw, LONG_GROUP,
|
||||
TX_CMD, 0) > 8)
|
||||
/* In the new rate legacy rates are indexed:
|
||||
* 0 - 3 for CCK and 0 - 7 for OFDM.
|
||||
*/
|
||||
return (rate_idx >= IWL_FIRST_OFDM_RATE ?
|
||||
rate_idx - IWL_FIRST_OFDM_RATE :
|
||||
rate_idx);
|
||||
|
||||
return iwl_fw_rate_idx_to_plcp(rate_idx);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user