Commit 6bd14aee authored by Johannes Berg's avatar Johannes Berg

wifi: mac80211: align ieee80211_mle_get_bss_param_ch_cnt()

Align the prototype of ieee80211_mle_get_bss_param_ch_cnt()
to also take a u8 * like the other functions, and make it
return -1 when the field isn't found, so that mac80211 can
check that instead of explicitly open-coding the check.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240216135047.583309181bc3.Ia61cb0b4fc034d5ac8fcfaf6f6fb2e115fadafe7@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 6b756efc
...@@ -4990,17 +4990,18 @@ static inline int ieee80211_mle_get_link_id(const u8 *data) ...@@ -4990,17 +4990,18 @@ static inline int ieee80211_mle_get_link_id(const u8 *data)
/** /**
* ieee80211_mle_get_bss_param_ch_cnt - returns the BSS parameter change count * ieee80211_mle_get_bss_param_ch_cnt - returns the BSS parameter change count
* @mle: the basic multi link element * @data: pointer to the basic multi link element
* *
* The element is assumed to be of the correct type (BASIC) and big enough, * The element is assumed to be of the correct type (BASIC) and big enough,
* this must be checked using ieee80211_mle_type_ok(). * this must be checked using ieee80211_mle_type_ok().
* *
* If the BSS parameter change count value can't be found (the presence bit * If the BSS parameter change count value can't be found (the presence bit
* for it is clear), 0 will be returned. * for it is clear), -1 will be returned.
*/ */
static inline u8 static inline int
ieee80211_mle_get_bss_param_ch_cnt(const struct ieee80211_multi_link_elem *mle) ieee80211_mle_get_bss_param_ch_cnt(const u8 *data)
{ {
const struct ieee80211_multi_link_elem *mle = (const void *)data;
u16 control = le16_to_cpu(mle->control); u16 control = le16_to_cpu(mle->control);
const u8 *common = mle->variable; const u8 *common = mle->variable;
...@@ -5008,7 +5009,7 @@ ieee80211_mle_get_bss_param_ch_cnt(const struct ieee80211_multi_link_elem *mle) ...@@ -5008,7 +5009,7 @@ ieee80211_mle_get_bss_param_ch_cnt(const struct ieee80211_multi_link_elem *mle)
common += sizeof(struct ieee80211_mle_basic_common_info); common += sizeof(struct ieee80211_mle_basic_common_info);
if (!(control & IEEE80211_MLC_BASIC_PRES_BSS_PARAM_CH_CNT)) if (!(control & IEEE80211_MLC_BASIC_PRES_BSS_PARAM_CH_CNT))
return 0; return -1;
if (control & IEEE80211_MLC_BASIC_PRES_LINK_ID) if (control & IEEE80211_MLC_BASIC_PRES_LINK_ID)
common += 1; common += 1;
......
...@@ -4202,13 +4202,14 @@ static bool ieee80211_assoc_config_link(struct ieee80211_link_data *link, ...@@ -4202,13 +4202,14 @@ static bool ieee80211_assoc_config_link(struct ieee80211_link_data *link,
*/ */
assoc_data->link[link_id].status = WLAN_STATUS_SUCCESS; assoc_data->link[link_id].status = WLAN_STATUS_SUCCESS;
if (elems->ml_basic) { if (elems->ml_basic) {
if (!(elems->ml_basic->control & int bss_param_ch_cnt =
cpu_to_le16(IEEE80211_MLC_BASIC_PRES_BSS_PARAM_CH_CNT))) { ieee80211_mle_get_bss_param_ch_cnt((const void *)elems->ml_basic);
if (bss_param_ch_cnt < 0) {
ret = false; ret = false;
goto out; goto out;
} }
link->u.mgd.bss_param_ch_cnt = link->u.mgd.bss_param_ch_cnt = bss_param_ch_cnt;
ieee80211_mle_get_bss_param_ch_cnt(elems->ml_basic);
} }
} else if (elems->parse_error & IEEE80211_PARSE_ERR_DUP_NEST_ML_BASIC || } else if (elems->parse_error & IEEE80211_PARSE_ERR_DUP_NEST_ML_BASIC ||
!elems->prof || !elems->prof ||
......
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