wifi: cfg80211: expose cfg80211_iter_rnr() to drivers

In mac80211 we'll need to look at reduced neighbor report
entries for channel switch purposes, so export the iteration
function to make that simpler.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240228095718.0954809964ef.I53e95c017aa71f14e8d1057afbbc75982ddb43df@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2024-02-28 09:55:41 +01:00
parent 5a21f0eae1
commit 22667035e5
2 changed files with 39 additions and 13 deletions

View File

@ -6870,6 +6870,38 @@ cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
return (const void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
}
/**
* enum cfg80211_rnr_iter_ret - reduced neighbor report iteration state
* @RNR_ITER_CONTINUE: continue iterating with the next entry
* @RNR_ITER_BREAK: break iteration and return success
* @RNR_ITER_ERROR: break iteration and return error
*/
enum cfg80211_rnr_iter_ret {
RNR_ITER_CONTINUE,
RNR_ITER_BREAK,
RNR_ITER_ERROR,
};
/**
* cfg80211_iter_rnr - iterate reduced neighbor report entries
* @elems: the frame elements to iterate RNR elements and then
* their entries in
* @elems_len: length of the elements
* @iter: iteration function, see also &enum cfg80211_rnr_iter_ret
* for the return value
* @iter_data: additional data passed to the iteration function
* Return: %true on success (after successfully iterating all entries
* or if the iteration function returned %RNR_ITER_BREAK),
* %false on error (iteration function returned %RNR_ITER_ERROR
* or elements were malformed.)
*/
bool cfg80211_iter_rnr(const u8 *elems, size_t elems_len,
enum cfg80211_rnr_iter_ret
(*iter)(void *data, u8 type,
const struct ieee80211_neighbor_ap_info *info,
const u8 *tbtt_info, u8 tbtt_info_len),
void *iter_data);
/**
* cfg80211_defragment_element - Defrag the given element data into a buffer
*

View File

@ -611,19 +611,12 @@ static int cfg80211_parse_ap_info(struct cfg80211_colocated_ap *entry,
return 0;
}
enum cfg80211_rnr_iter_ret {
RNR_ITER_CONTINUE,
RNR_ITER_BREAK,
RNR_ITER_ERROR,
};
static bool
cfg80211_iter_rnr(const u8 *elems, size_t elems_len,
enum cfg80211_rnr_iter_ret
(*iter)(void *data, u8 type,
const struct ieee80211_neighbor_ap_info *info,
const u8 *tbtt_info, u8 tbtt_info_len),
void *iter_data)
bool cfg80211_iter_rnr(const u8 *elems, size_t elems_len,
enum cfg80211_rnr_iter_ret
(*iter)(void *data, u8 type,
const struct ieee80211_neighbor_ap_info *info,
const u8 *tbtt_info, u8 tbtt_info_len),
void *iter_data)
{
const struct element *rnr;
const u8 *pos, *end;
@ -675,6 +668,7 @@ cfg80211_iter_rnr(const u8 *elems, size_t elems_len,
return true;
}
EXPORT_SYMBOL_GPL(cfg80211_iter_rnr);
struct colocated_ap_data {
const struct element *ssid_elem;