Commit 9c4f15ca authored by Miri Korenblit's avatar Miri Korenblit Committed by Johannes Berg

wifi: iwlwifi: mvm: Refactor STA_HE_CTXT_CMD sending flow

Refactor STA_HE_CTXT_CMD sending flow:

1. As the new MLD API is introduced, there are some common fields in
both the old and new APIs. The STA_HE_CTXT_CMD of the non-MLD API
has common fields with the link and mac commands of the new MLD API.
Put this common parts in functions so it can be used later by the
new MLD API.

2. The HE capability which indicates whether the NIC is ack-enabled or
not is the same for all bands. No need to take it from the specific
band which is currently in use. Take it from the low band - this
simplifies the code and doesn't require a phy_ctxt.
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.7ca960596953.Ifc3e816461abbd69c6fd87752342afcedfebc293@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 834f920e
...@@ -1996,6 +1996,59 @@ static void iwl_mvm_get_optimal_ppe_info(struct iwl_he_pkt_ext_v2 *pkt_ext, ...@@ -1996,6 +1996,59 @@ static void iwl_mvm_get_optimal_ppe_info(struct iwl_he_pkt_ext_v2 *pkt_ext,
} }
} }
/*
* This function sets the MU EDCA parameters ans returns whether MU EDCA
* is enabled or not
*/
static bool iwl_mvm_set_fw_mu_edca_params(struct iwl_mvm *mvm,
struct iwl_mvm_vif *mvmvif,
struct iwl_he_backoff_conf
*trig_based_txf)
{
int i;
/* Mark MU EDCA as enabled, unless none detected on some AC */
bool mu_edca_enabled = true;
for (i = 0; i < IEEE80211_NUM_ACS; i++) {
struct ieee80211_he_mu_edca_param_ac_rec *mu_edca =
&mvmvif->queue_params[i].mu_edca_param_rec;
u8 ac = iwl_mvm_mac80211_ac_to_ucode_ac(i);
if (!mvmvif->queue_params[i].mu_edca) {
mu_edca_enabled = false;
break;
}
trig_based_txf[ac].cwmin =
cpu_to_le16(mu_edca->ecw_min_max & 0xf);
trig_based_txf[ac].cwmax =
cpu_to_le16((mu_edca->ecw_min_max & 0xf0) >> 4);
trig_based_txf[ac].aifsn =
cpu_to_le16(mu_edca->aifsn & 0xf);
trig_based_txf[ac].mu_time =
cpu_to_le16(mu_edca->mu_edca_timer);
}
return mu_edca_enabled;
}
static bool iwl_mvm_is_nic_ack_enabled(struct iwl_mvm *mvm,
struct ieee80211_vif *vif)
{
const struct ieee80211_supported_band *sband;
const struct ieee80211_sta_he_cap *own_he_cap = NULL;
/* This capability is the same for all bands,
* so take it from one of them.
*/
sband = mvm->hw->wiphy->bands[NL80211_BAND_2GHZ];
own_he_cap = ieee80211_get_he_iftype_cap(sband,
ieee80211_vif_type_p2p(vif));
return (own_he_cap && (own_he_cap->he_cap_elem.mac_cap_info[2] &
IEEE80211_HE_MAC_CAP2_ACK_EN));
}
static void iwl_mvm_cfg_he_sta(struct iwl_mvm *mvm, static void iwl_mvm_cfg_he_sta(struct iwl_mvm *mvm,
struct ieee80211_vif *vif, u8 sta_id) struct ieee80211_vif *vif, u8 sta_id)
{ {
...@@ -2015,9 +2068,6 @@ static void iwl_mvm_cfg_he_sta(struct iwl_mvm *mvm, ...@@ -2015,9 +2068,6 @@ static void iwl_mvm_cfg_he_sta(struct iwl_mvm *mvm,
struct ieee80211_sta *sta; struct ieee80211_sta *sta;
u32 flags; u32 flags;
int i; int i;
const struct ieee80211_sta_he_cap *own_he_cap = NULL;
struct ieee80211_chanctx_conf *chanctx_conf;
const struct ieee80211_supported_band *sband;
void *cmd; void *cmd;
u8 nominal_padding; u8 nominal_padding;
...@@ -2045,16 +2095,6 @@ static void iwl_mvm_cfg_he_sta(struct iwl_mvm *mvm, ...@@ -2045,16 +2095,6 @@ static void iwl_mvm_cfg_he_sta(struct iwl_mvm *mvm,
rcu_read_lock(); rcu_read_lock();
chanctx_conf = rcu_dereference(vif->bss_conf.chanctx_conf);
if (WARN_ON(!chanctx_conf)) {
rcu_read_unlock();
return;
}
sband = mvm->hw->wiphy->bands[chanctx_conf->def.chan->band];
own_he_cap = ieee80211_get_he_iftype_cap(sband,
ieee80211_vif_type_p2p(vif));
sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_ctxt_cmd.sta_id]); sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_ctxt_cmd.sta_id]);
if (IS_ERR_OR_NULL(sta)) { if (IS_ERR_OR_NULL(sta)) {
rcu_read_unlock(); rcu_read_unlock();
...@@ -2211,28 +2251,9 @@ static void iwl_mvm_cfg_he_sta(struct iwl_mvm *mvm, ...@@ -2211,28 +2251,9 @@ static void iwl_mvm_cfg_he_sta(struct iwl_mvm *mvm,
rcu_read_unlock(); rcu_read_unlock();
/* Mark MU EDCA as enabled, unless none detected on some AC */ if (iwl_mvm_set_fw_mu_edca_params(mvm, mvmvif,
flags |= STA_CTXT_HE_MU_EDCA_CW; &sta_ctxt_cmd.trig_based_txf[0]))
for (i = 0; i < IEEE80211_NUM_ACS; i++) { flags |= STA_CTXT_HE_MU_EDCA_CW;
struct ieee80211_he_mu_edca_param_ac_rec *mu_edca =
&mvmvif->queue_params[i].mu_edca_param_rec;
u8 ac = iwl_mvm_mac80211_ac_to_ucode_ac(i);
if (!mvmvif->queue_params[i].mu_edca) {
flags &= ~STA_CTXT_HE_MU_EDCA_CW;
break;
}
sta_ctxt_cmd.trig_based_txf[ac].cwmin =
cpu_to_le16(mu_edca->ecw_min_max & 0xf);
sta_ctxt_cmd.trig_based_txf[ac].cwmax =
cpu_to_le16((mu_edca->ecw_min_max & 0xf0) >> 4);
sta_ctxt_cmd.trig_based_txf[ac].aifsn =
cpu_to_le16(mu_edca->aifsn);
sta_ctxt_cmd.trig_based_txf[ac].mu_time =
cpu_to_le16(mu_edca->mu_edca_timer);
}
if (vif->bss_conf.uora_exists) { if (vif->bss_conf.uora_exists) {
flags |= STA_CTXT_HE_TRIG_RND_ALLOC; flags |= STA_CTXT_HE_TRIG_RND_ALLOC;
...@@ -2243,8 +2264,7 @@ static void iwl_mvm_cfg_he_sta(struct iwl_mvm *mvm, ...@@ -2243,8 +2264,7 @@ static void iwl_mvm_cfg_he_sta(struct iwl_mvm *mvm,
(vif->bss_conf.uora_ocw_range >> 3) & 0x7; (vif->bss_conf.uora_ocw_range >> 3) & 0x7;
} }
if (own_he_cap && !(own_he_cap->he_cap_elem.mac_cap_info[2] & if (!iwl_mvm_is_nic_ack_enabled(mvm, vif))
IEEE80211_HE_MAC_CAP2_ACK_EN))
flags |= STA_CTXT_HE_NIC_NOT_ACK_ENABLED; flags |= STA_CTXT_HE_NIC_NOT_ACK_ENABLED;
if (vif->bss_conf.nontransmitted) { if (vif->bss_conf.nontransmitted) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment