diff options
author | Johannes Berg <johannes.berg@intel.com> | 2022-06-28 17:49:12 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2022-07-15 11:43:17 +0200 |
commit | fd17bf041b40e3dac705c4313854becbe07b7557 (patch) | |
tree | d4c5ba285ab213d39f793c469a5abf496a0ebae2 /net/mac80211/ieee80211_i.h | |
parent | 5cd212cb6415aa604ada17d5150847fd65d27337 (diff) |
wifi: mac80211: refactor elements parsing with parameter struct
Refactor the element parsing into a version that has
a parameter struct so we can add more parameters more
easily in the future.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/ieee80211_i.h')
-rw-r--r-- | net/mac80211/ieee80211_i.h | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index a0743c78d171..2cf13ea4c9f7 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -2138,11 +2138,51 @@ static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, ieee80211_tx_skb_tid(sdata, skb, 7); } -struct ieee802_11_elems *ieee802_11_parse_elems_crc(const u8 *start, size_t len, - bool action, - u64 filter, u32 crc, - const u8 *transmitter_bssid, - const u8 *bss_bssid); +/** + * struct ieee80211_elems_parse_params - element parsing parameters + * @start: pointer to the elements + * @len: length of the elements + * @action: %true if the elements came from an action frame + * @filter: bitmap of element IDs to filter out while calculating + * the element CRC + * @crc: CRC starting value + * @transmitter_bssid: transmitter BSSID to parse the multi-BSSID + * element + * @bss_bssid: BSSID of the BSS we want to obtain elements for + * when parsing the multi-BSSID element + */ +struct ieee80211_elems_parse_params { + const u8 *start; + size_t len; + bool action; + u64 filter; + u32 crc; + const u8 *transmitter_bssid; + const u8 *bss_bssid; +}; + +struct ieee802_11_elems * +ieee802_11_parse_elems_full(struct ieee80211_elems_parse_params *params); + +static inline struct ieee802_11_elems * +ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action, + u64 filter, u32 crc, + const u8 *transmitter_bssid, + const u8 *bss_bssid) +{ + struct ieee80211_elems_parse_params params = { + .start = start, + .len = len, + .action = action, + .filter = filter, + .crc = crc, + .transmitter_bssid = transmitter_bssid, + .bss_bssid = bss_bssid, + }; + + return ieee802_11_parse_elems_full(¶ms); +} + static inline struct ieee802_11_elems * ieee802_11_parse_elems(const u8 *start, size_t len, bool action, const u8 *transmitter_bssid, |