wifi: cfg80211: use ML element parsing helpers
Use the existing ML element parsing helpers and add a new one for this (ieee80211_mle_get_mld_id). Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://msgid.link/20240216135047.4da47b1f035b.I437a5570ac456449facb0b147851ef24a1e473c2@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
@@ -5115,6 +5115,44 @@ static inline u16 ieee80211_mle_get_mld_capa_op(const u8 *data)
|
||||
return get_unaligned_le16(common);
|
||||
}
|
||||
|
||||
/**
|
||||
* ieee80211_mle_get_mld_id - returns the MLD ID
|
||||
* @data: pointer to the multi link element
|
||||
*
|
||||
* The element is assumed to be of the correct type (BASIC) and big enough,
|
||||
* this must be checked using ieee80211_mle_type_ok().
|
||||
*
|
||||
* If the MLD ID is not present, 0 will be returned.
|
||||
*/
|
||||
static inline u8 ieee80211_mle_get_mld_id(const u8 *data)
|
||||
{
|
||||
const struct ieee80211_multi_link_elem *mle = (const void *)data;
|
||||
u16 control = le16_to_cpu(mle->control);
|
||||
const u8 *common = mle->variable;
|
||||
|
||||
/*
|
||||
* common points now at the beginning of
|
||||
* ieee80211_mle_basic_common_info
|
||||
*/
|
||||
common += sizeof(struct ieee80211_mle_basic_common_info);
|
||||
|
||||
if (!(control & IEEE80211_MLC_BASIC_PRES_MLD_ID))
|
||||
return 0;
|
||||
|
||||
if (control & IEEE80211_MLC_BASIC_PRES_LINK_ID)
|
||||
common += 1;
|
||||
if (control & IEEE80211_MLC_BASIC_PRES_BSS_PARAM_CH_CNT)
|
||||
common += 1;
|
||||
if (control & IEEE80211_MLC_BASIC_PRES_MED_SYNC_DELAY)
|
||||
common += 2;
|
||||
if (control & IEEE80211_MLC_BASIC_PRES_EML_CAPA)
|
||||
common += 2;
|
||||
if (control & IEEE80211_MLC_BASIC_PRES_MLD_CAPA_OP)
|
||||
common += 2;
|
||||
|
||||
return *common;
|
||||
}
|
||||
|
||||
/**
|
||||
* ieee80211_mle_size_ok - validate multi-link element size
|
||||
* @data: pointer to the element data
|
||||
|
||||
Reference in New Issue
Block a user