From: Johannes Berg Date: Wed, 27 May 2026 20:05:03 +0000 (+0300) Subject: wifi: iwlwifi: mvm: rename iwl_mvm_mac80211_idx_to_hwrate() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18928cd2b08e4efa0e09597710c2e7b768bab864;p=thirdparty%2Fkernel%2Fstable.git wifi: iwlwifi: mvm: rename iwl_mvm_mac80211_idx_to_hwrate() Given that we now use v3 rates with FW index throughout, _to_hwrate() is confusing, since the hardware still uses the PLCP value, the driver just doesn't see that now (as it talks to firmware, not hardware.) Rename this to iwl_mvm_rate_idx_to_fw_idx() to more clearly indicate what it's doing. Signed-off-by: Johannes Berg Link: https://patch.msgid.link/20260527230313.a60c8aea5b6c.I6af48d5d9748e184eed9d3437d312291cab61d7f@changeid Signed-off-by: Miri Korenblit --- diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c index 8ffa72aca3cf..3e5084d10a60 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c @@ -935,7 +935,7 @@ u16 iwl_mvm_mac_ctxt_get_beacon_flags(const struct iwl_fw *fw, u8 rate_idx) : IWL_MAC_BEACON_CCK_V1; if (iwl_fw_lookup_cmd_ver(fw, TX_CMD, 0) > 8) - flags |= iwl_mvm_mac80211_idx_to_hwrate(fw, rate_idx); + flags |= iwl_mvm_rate_idx_to_fw_idx(fw, rate_idx); else flags |= iwl_fw_rate_idx_to_plcp(rate_idx); @@ -998,7 +998,7 @@ static void iwl_mvm_mac_ctxt_set_tx(struct iwl_mvm *mvm, else rate_n_flags |= RATE_MCS_MOD_TYPE_LEGACY_OFDM; - rate_n_flags |= iwl_mvm_mac80211_idx_to_hwrate(mvm->fw, rate); + rate_n_flags |= iwl_mvm_rate_idx_to_fw_idx(mvm->fw, rate); tx_params->rate_n_flags = iwl_mvm_v3_rate_to_fw(rate_n_flags, mvm->fw_rates_ver); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index be89b84204fb..393acf5c5f55 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -1653,7 +1653,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(const struct iwl_fw *fw, int rate_idx); +u8 iwl_mvm_rate_idx_to_fw_idx(const struct iwl_fw *fw, int rate_idx); u8 iwl_mvm_mac80211_ac_to_ucode_ac(enum ieee80211_ac_numbers ac); bool iwl_mvm_is_nic_ack_enabled(struct iwl_mvm *mvm, struct ieee80211_vif *vif); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c index bca13417e82c..dc69c71faa76 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* - * Copyright (C) 2012-2014, 2018-2025 Intel Corporation + * Copyright (C) 2012-2014, 2018-2026 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH */ @@ -268,7 +268,6 @@ static u32 iwl_mvm_convert_rate_idx(struct iwl_mvm *mvm, int rate_idx) { u32 rate_flags = 0; - u8 rate_plcp; bool is_cck; /* if the rate isn't a well known legacy rate, take the lowest one */ @@ -277,8 +276,9 @@ static u32 iwl_mvm_convert_rate_idx(struct iwl_mvm *mvm, info, info->control.vif); - /* Get PLCP rate for tx_cmd->rate_n_flags */ - rate_plcp = iwl_mvm_mac80211_idx_to_hwrate(mvm->fw, rate_idx); + /* Get FW rate for tx_cmd->rate_n_flags */ + rate_flags |= iwl_mvm_rate_idx_to_fw_idx(mvm->fw, rate_idx); + is_cck = (rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE); @@ -288,7 +288,7 @@ static u32 iwl_mvm_convert_rate_idx(struct iwl_mvm *mvm, else rate_flags |= RATE_MCS_MOD_TYPE_CCK; - return (u32)rate_plcp | rate_flags; + return rate_flags; } static u32 iwl_mvm_get_inject_tx_rate(struct iwl_mvm *mvm, diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c index f052537e9567..8aba9768afcf 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c @@ -157,7 +157,7 @@ int iwl_mvm_legacy_rate_to_mac80211_idx(u32 rate_n_flags, return -1; } -u8 iwl_mvm_mac80211_idx_to_hwrate(const struct iwl_fw *fw, int rate_idx) +u8 iwl_mvm_rate_idx_to_fw_idx(const struct iwl_fw *fw, int rate_idx) { return rate_idx >= IWL_FIRST_OFDM_RATE ? rate_idx - IWL_FIRST_OFDM_RATE :