Commit 3dc05935 authored by Johannes Berg's avatar Johannes Berg

wifi: mac80211: use only channel width in ieee80211_parse_bitrates()

For MLO, we may not have a full chandef here later, so change
the API to pass only the width.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 19654a61
...@@ -1633,7 +1633,7 @@ static int sta_link_apply_parameters(struct ieee80211_local *local, ...@@ -1633,7 +1633,7 @@ static int sta_link_apply_parameters(struct ieee80211_local *local,
if (params->supported_rates && if (params->supported_rates &&
params->supported_rates_len) { params->supported_rates_len) {
ieee80211_parse_bitrates(&link->conf->chandef, ieee80211_parse_bitrates(link->conf->chandef.width,
sband, params->supported_rates, sband, params->supported_rates,
params->supported_rates_len, params->supported_rates_len,
&link_sta->pub->supp_rates[sband->band]); &link_sta->pub->supp_rates[sband->band]);
...@@ -2518,7 +2518,7 @@ static int ieee80211_change_bss(struct wiphy *wiphy, ...@@ -2518,7 +2518,7 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
} }
if (params->basic_rates) { if (params->basic_rates) {
ieee80211_parse_bitrates(&sdata->vif.bss_conf.chandef, ieee80211_parse_bitrates(sdata->vif.bss_conf.chandef.width,
wiphy->bands[sband->band], wiphy->bands[sband->band],
params->basic_rates, params->basic_rates,
params->basic_rates_len, params->basic_rates_len,
......
...@@ -1102,9 +1102,9 @@ sdata_assert_lock(struct ieee80211_sub_if_data *sdata) ...@@ -1102,9 +1102,9 @@ sdata_assert_lock(struct ieee80211_sub_if_data *sdata)
} }
static inline int static inline int
ieee80211_chandef_get_shift(struct cfg80211_chan_def *chandef) ieee80211_chanwidth_get_shift(enum nl80211_chan_width width)
{ {
switch (chandef->width) { switch (width) {
case NL80211_CHAN_WIDTH_5: case NL80211_CHAN_WIDTH_5:
return 2; return 2;
case NL80211_CHAN_WIDTH_10: case NL80211_CHAN_WIDTH_10:
...@@ -1114,6 +1114,12 @@ ieee80211_chandef_get_shift(struct cfg80211_chan_def *chandef) ...@@ -1114,6 +1114,12 @@ ieee80211_chandef_get_shift(struct cfg80211_chan_def *chandef)
} }
} }
static inline int
ieee80211_chandef_get_shift(struct cfg80211_chan_def *chandef)
{
return ieee80211_chanwidth_get_shift(chandef->width);
}
static inline int static inline int
ieee80211_vif_get_shift(struct ieee80211_vif *vif) ieee80211_vif_get_shift(struct ieee80211_vif *vif)
{ {
...@@ -2346,7 +2352,7 @@ u8 *ieee80211_ie_build_he_cap(ieee80211_conn_flags_t disable_flags, u8 *pos, ...@@ -2346,7 +2352,7 @@ u8 *ieee80211_ie_build_he_cap(ieee80211_conn_flags_t disable_flags, u8 *pos,
void ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata, void ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata,
struct sk_buff *skb); struct sk_buff *skb);
u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef); u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef);
int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef, int ieee80211_parse_bitrates(enum nl80211_chan_width width,
const struct ieee80211_supported_band *sband, const struct ieee80211_supported_band *sband,
const u8 *srates, int srates_len, u32 *rates); const u8 *srates, int srates_len, u32 *rates);
int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata,
......
...@@ -819,7 +819,8 @@ static int ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) ...@@ -819,7 +819,8 @@ static int ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
* in the association request (e.g. D-Link DAP 1353 in * in the association request (e.g. D-Link DAP 1353 in
* b-only mode)... * b-only mode)...
*/ */
rates_len = ieee80211_parse_bitrates(&chanctx_conf->def, sband, rates_len = ieee80211_parse_bitrates(chanctx_conf->def.width,
sband,
assoc_data->supp_rates, assoc_data->supp_rates,
assoc_data->supp_rates_len, assoc_data->supp_rates_len,
&rates); &rates);
......
...@@ -3689,12 +3689,12 @@ bool ieee80211_chandef_s1g_oper(const struct ieee80211_s1g_oper_ie *oper, ...@@ -3689,12 +3689,12 @@ bool ieee80211_chandef_s1g_oper(const struct ieee80211_s1g_oper_ie *oper,
return true; return true;
} }
int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef, int ieee80211_parse_bitrates(enum nl80211_chan_width width,
const struct ieee80211_supported_band *sband, const struct ieee80211_supported_band *sband,
const u8 *srates, int srates_len, u32 *rates) const u8 *srates, int srates_len, u32 *rates)
{ {
u32 rate_flags = ieee80211_chandef_rate_flags(chandef); u32 rate_flags = ieee80211_chanwidth_rate_flags(width);
int shift = ieee80211_chandef_get_shift(chandef); int shift = ieee80211_chanwidth_get_shift(width);
struct ieee80211_rate *br; struct ieee80211_rate *br;
int brate, rate, i, j, count = 0; int brate, rate, i, j, count = 0;
......
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