Commit 8884730e authored by Johannes Berg's avatar Johannes Berg

wifi: iwlwifi: mvm: rs-fw: properly access sband->iftype_data

We need to look up the correct version of this struct depending
on the interface type, rather than just checking if the pointer
is non-NULL. Fix that.

Fixes: befebbb3 ("iwlwifi: rs: consider LDPC capability in case of HE")
Fixes: b009cf71 ("iwlwifi: mvm: only enable HE DCM if we also support TX")
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230417113648.1fd54368a02c.Ie4db5e8ae224d9a4a63b528da5d63e1b957b9cef@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent c45217bd
...@@ -61,12 +61,14 @@ static u8 rs_fw_sgi_cw_support(struct ieee80211_link_sta *link_sta) ...@@ -61,12 +61,14 @@ static u8 rs_fw_sgi_cw_support(struct ieee80211_link_sta *link_sta)
} }
static u16 rs_fw_get_config_flags(struct iwl_mvm *mvm, static u16 rs_fw_get_config_flags(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
struct ieee80211_link_sta *link_sta, struct ieee80211_link_sta *link_sta,
struct ieee80211_supported_band *sband) struct ieee80211_supported_band *sband)
{ {
struct ieee80211_sta_ht_cap *ht_cap = &link_sta->ht_cap; struct ieee80211_sta_ht_cap *ht_cap = &link_sta->ht_cap;
struct ieee80211_sta_vht_cap *vht_cap = &link_sta->vht_cap; struct ieee80211_sta_vht_cap *vht_cap = &link_sta->vht_cap;
struct ieee80211_sta_he_cap *he_cap = &link_sta->he_cap; struct ieee80211_sta_he_cap *he_cap = &link_sta->he_cap;
const struct ieee80211_sta_he_cap *sband_he_cap;
bool vht_ena = vht_cap->vht_supported; bool vht_ena = vht_cap->vht_supported;
u16 flags = 0; u16 flags = 0;
...@@ -92,17 +94,19 @@ static u16 rs_fw_get_config_flags(struct iwl_mvm *mvm, ...@@ -92,17 +94,19 @@ static u16 rs_fw_get_config_flags(struct iwl_mvm *mvm,
IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD)) IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD))
flags |= IWL_TLC_MNG_CFG_FLAGS_LDPC_MSK; flags |= IWL_TLC_MNG_CFG_FLAGS_LDPC_MSK;
if (sband->iftype_data && sband->iftype_data->he_cap.has_he && sband_he_cap = ieee80211_get_he_iftype_cap(sband,
!(sband->iftype_data->he_cap.he_cap_elem.phy_cap_info[1] & ieee80211_vif_type_p2p(vif));
IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD)) if (sband_he_cap &&
!(sband_he_cap->he_cap_elem.phy_cap_info[1] &
IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD))
flags &= ~IWL_TLC_MNG_CFG_FLAGS_LDPC_MSK; flags &= ~IWL_TLC_MNG_CFG_FLAGS_LDPC_MSK;
if (he_cap->has_he && if (he_cap->has_he &&
(he_cap->he_cap_elem.phy_cap_info[3] & (he_cap->he_cap_elem.phy_cap_info[3] &
IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK && IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK &&
sband->iftype_data && sband_he_cap &&
sband->iftype_data->he_cap.he_cap_elem.phy_cap_info[3] & sband_he_cap->he_cap_elem.phy_cap_info[3] &
IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK)) IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK))
flags |= IWL_TLC_MNG_CFG_FLAGS_HE_DCM_NSS_1_MSK; flags |= IWL_TLC_MNG_CFG_FLAGS_HE_DCM_NSS_1_MSK;
return flags; return flags;
...@@ -576,9 +580,8 @@ void rs_fw_rate_init(struct iwl_mvm *mvm, ...@@ -576,9 +580,8 @@ void rs_fw_rate_init(struct iwl_mvm *mvm,
struct iwl_lq_sta_rs_fw *lq_sta; struct iwl_lq_sta_rs_fw *lq_sta;
struct iwl_tlc_config_cmd_v4 cfg_cmd = { struct iwl_tlc_config_cmd_v4 cfg_cmd = {
.max_ch_width = update ? .max_ch_width = update ?
rs_fw_bw_from_sta_bw(link_sta) : rs_fw_bw_from_sta_bw(link_sta) : IWL_TLC_MNG_CH_WIDTH_20MHZ,
IWL_TLC_MNG_CH_WIDTH_20MHZ, .flags = cpu_to_le16(rs_fw_get_config_flags(mvm, vif, link_sta,
.flags = cpu_to_le16(rs_fw_get_config_flags(mvm, link_sta,
sband)), sband)),
.chains = rs_fw_set_active_chains(iwl_mvm_get_valid_tx_ant(mvm)), .chains = rs_fw_set_active_chains(iwl_mvm_get_valid_tx_ant(mvm)),
.sgi_ch_width_supp = rs_fw_sgi_cw_support(link_sta), .sgi_ch_width_supp = rs_fw_sgi_cw_support(link_sta),
......
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