Commit bac2fd3d authored by Johannes Berg's avatar Johannes Berg

mac80211: remove use of ieee80211_get_he_sta_cap()

All uses of ieee80211_get_he_sta_cap() were actually wrong,
in net/mac80211/mlme.c they were wrong because that code is
also used for P2P (which is a different interface type), in
net/mac80211/main.c that should check all interface types.
Fix all that.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210618133832.ede114bc8b46.Ibcd9a5d98430e936344eb6d242ef8a65c2f59b74@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 64a87472
...@@ -120,7 +120,9 @@ ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata, ...@@ -120,7 +120,9 @@ ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,
memset(he_cap, 0, sizeof(*he_cap)); memset(he_cap, 0, sizeof(*he_cap));
if (!he_cap_ie || !ieee80211_get_he_sta_cap(sband)) if (!he_cap_ie ||
!ieee80211_get_he_iftype_cap(sband,
ieee80211_vif_type_p2p(&sdata->vif)))
return; return;
/* Make sure size is OK */ /* Make sure size is OK */
......
...@@ -1010,8 +1010,13 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) ...@@ -1010,8 +1010,13 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
supp_ht = supp_ht || sband->ht_cap.ht_supported; supp_ht = supp_ht || sband->ht_cap.ht_supported;
supp_vht = supp_vht || sband->vht_cap.vht_supported; supp_vht = supp_vht || sband->vht_cap.vht_supported;
if (!supp_he) for (i = 0; i < sband->n_iftype_data; i++) {
supp_he = !!ieee80211_get_he_sta_cap(sband); const struct ieee80211_sband_iftype_data *iftd;
iftd = &sband->iftype_data[i];
supp_he = supp_he || (iftd && iftd->he_cap.has_he);
}
/* HT, VHT, HE require QoS, thus >= 4 queues */ /* HT, VHT, HE require QoS, thus >= 4 queues */
if (WARN_ON(local->hw.queues < IEEE80211_NUM_ACS && if (WARN_ON(local->hw.queues < IEEE80211_NUM_ACS &&
......
...@@ -384,7 +384,9 @@ static int ieee80211_config_bw(struct ieee80211_sub_if_data *sdata, ...@@ -384,7 +384,9 @@ static int ieee80211_config_bw(struct ieee80211_sub_if_data *sdata,
/* don't check HE if we associated as non-HE station */ /* don't check HE if we associated as non-HE station */
if (ifmgd->flags & IEEE80211_STA_DISABLE_HE || if (ifmgd->flags & IEEE80211_STA_DISABLE_HE ||
!ieee80211_get_he_sta_cap(sband)) !ieee80211_get_he_iftype_cap(sband,
ieee80211_vif_type_p2p(&sdata->vif)))
he_oper = NULL; he_oper = NULL;
if (WARN_ON_ONCE(!sta)) if (WARN_ON_ONCE(!sta))
...@@ -642,7 +644,8 @@ static void ieee80211_add_he_ie(struct ieee80211_sub_if_data *sdata, ...@@ -642,7 +644,8 @@ static void ieee80211_add_he_ie(struct ieee80211_sub_if_data *sdata,
rcu_read_unlock(); rcu_read_unlock();
he_cap = ieee80211_get_he_sta_cap(sband); he_cap = ieee80211_get_he_iftype_cap(sband,
ieee80211_vif_type_p2p(&sdata->vif));
if (!he_cap || !reg_cap) if (!he_cap || !reg_cap)
return; return;
...@@ -3218,12 +3221,14 @@ static int ieee80211_recalc_twt_req(struct ieee80211_sub_if_data *sdata, ...@@ -3218,12 +3221,14 @@ static int ieee80211_recalc_twt_req(struct ieee80211_sub_if_data *sdata,
return 0; return 0;
} }
static bool ieee80211_twt_bcast_support(struct ieee80211_bss_conf *bss_conf, static bool ieee80211_twt_bcast_support(struct ieee80211_sub_if_data *sdata,
struct ieee80211_bss_conf *bss_conf,
struct ieee80211_supported_band *sband, struct ieee80211_supported_band *sband,
struct sta_info *sta) struct sta_info *sta)
{ {
const struct ieee80211_sta_he_cap *own_he_cap = const struct ieee80211_sta_he_cap *own_he_cap =
ieee80211_get_he_sta_cap(sband); ieee80211_get_he_iftype_cap(sband,
ieee80211_vif_type_p2p(&sdata->vif));
return bss_conf->he_support && return bss_conf->he_support &&
(sta->sta.he_cap.he_cap_elem.mac_cap_info[2] & (sta->sta.he_cap.he_cap_elem.mac_cap_info[2] &
...@@ -3449,7 +3454,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, ...@@ -3449,7 +3454,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
} }
bss_conf->twt_broadcast = bss_conf->twt_broadcast =
ieee80211_twt_bcast_support(bss_conf, sband, sta); ieee80211_twt_bcast_support(sdata, bss_conf, sband, sta);
if (bss_conf->he_support) { if (bss_conf->he_support) {
bss_conf->he_bss_color.color = bss_conf->he_bss_color.color =
...@@ -4851,11 +4856,13 @@ static u8 ieee80211_ht_vht_rx_chains(struct ieee80211_sub_if_data *sdata, ...@@ -4851,11 +4856,13 @@ static u8 ieee80211_ht_vht_rx_chains(struct ieee80211_sub_if_data *sdata,
} }
static bool static bool
ieee80211_verify_sta_he_mcs_support(struct ieee80211_supported_band *sband, ieee80211_verify_sta_he_mcs_support(struct ieee80211_sub_if_data *sdata,
struct ieee80211_supported_band *sband,
const struct ieee80211_he_operation *he_op) const struct ieee80211_he_operation *he_op)
{ {
const struct ieee80211_sta_he_cap *sta_he_cap = const struct ieee80211_sta_he_cap *sta_he_cap =
ieee80211_get_he_sta_cap(sband); ieee80211_get_he_iftype_cap(sband,
ieee80211_vif_type_p2p(&sdata->vif));
u16 ap_min_req_set; u16 ap_min_req_set;
int i; int i;
...@@ -4949,7 +4956,8 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, ...@@ -4949,7 +4956,8 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
ifmgd->flags |= IEEE80211_STA_DISABLE_HE; ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
} }
if (!ieee80211_get_he_sta_cap(sband)) if (!ieee80211_get_he_iftype_cap(sband,
ieee80211_vif_type_p2p(&sdata->vif)))
ifmgd->flags |= IEEE80211_STA_DISABLE_HE; ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
rcu_read_lock(); rcu_read_lock();
...@@ -5007,7 +5015,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, ...@@ -5007,7 +5015,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
else else
he_oper = NULL; he_oper = NULL;
if (!ieee80211_verify_sta_he_mcs_support(sband, he_oper)) if (!ieee80211_verify_sta_he_mcs_support(sdata, sband, he_oper))
ifmgd->flags |= IEEE80211_STA_DISABLE_HE; ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
} }
......
...@@ -1937,7 +1937,8 @@ static int ieee80211_build_preq_ies_band(struct ieee80211_sub_if_data *sdata, ...@@ -1937,7 +1937,8 @@ static int ieee80211_build_preq_ies_band(struct ieee80211_sub_if_data *sdata,
*offset = noffset; *offset = noffset;
} }
he_cap = ieee80211_get_he_sta_cap(sband); he_cap = ieee80211_get_he_iftype_cap(sband,
ieee80211_vif_type_p2p(&sdata->vif));
if (he_cap) { if (he_cap) {
pos = ieee80211_ie_build_he_cap(pos, he_cap, end); pos = ieee80211_ie_build_he_cap(pos, he_cap, end);
if (!pos) if (!pos)
......
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