Commit d1256c15 authored by Johannes Berg's avatar Johannes Berg

wifi: mac80211: add and use a link iteration macro

In the channel context code we have quite a few instances
of nested loops iterating the interfaces and then links.
Add a new for_each_sdata_link() macro and use it. Also,
since it's easier, convert all the loops and a few other
places away from RCU as we now hold the wiphy mutex
everywhere anyway.

This does cause a little bit more work (such as checking
interface types for each link of an interface rather than
not iterating links in some cases), but that's not a huge
issue and seems like an acceptable trade-off, readability
is important too.

Link: https://msgid.link/20240129194108.7240829bd96d.I5ccbb8dd019cbcb5326c85d76121359225d6541a@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 6092077a
This diff is collapsed.
......@@ -1181,6 +1181,19 @@ struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
#define sdata_dereference(p, sdata) \
wiphy_dereference(sdata->local->hw.wiphy, p)
#define for_each_sdata_link(_local, _link) \
/* outer loop just to define the variables ... */ \
for (struct ieee80211_sub_if_data *___sdata = NULL; \
!___sdata; \
___sdata = (void *)~0 /* always stop */) \
list_for_each_entry(___sdata, &(_local)->interfaces, list) \
if (ieee80211_sdata_running(___sdata)) \
for (int ___link_id = 0; \
___link_id < ARRAY_SIZE(___sdata->link); \
___link_id++) \
if ((_link = wiphy_dereference((local)->hw.wiphy, \
___sdata->link[___link_id])))
static inline int
ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems,
struct cfg80211_rnr_elems *rnr_elems,
......
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