]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP: MLO: Add helper to iterate all links of an AP MLD
authorBenjamin Berg <benjamin.berg@intel.com>
Mon, 20 Nov 2023 23:51:34 +0000 (01:51 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 25 Nov 2023 16:30:57 +0000 (18:30 +0200)
Add a simple for_each_mld_link helper that sets first variable to the
hapd data for every link. It takes the interfaces and MLD ID as
arguments and two extra integers as scratch variables (for the interface
and bss offsets).

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
src/ap/hostapd.h

index 8987b33375d2aba9ab0e520ce3544595a279569a..3dba121c6cb8973bb0790c2ef37b84216d3c6388 100644 (file)
@@ -777,4 +777,23 @@ struct hostapd_data * hostapd_mld_get_link_bss(struct hostapd_data *hapd,
                                               u8 link_id);
 int hostapd_link_remove(struct hostapd_data *hapd, u32 count);
 
+#ifdef CONFIG_IEEE80211BE
+#define for_each_mld_link(_link, _bss_idx, _iface_idx, _ifaces, _mld_id) \
+       for (_iface_idx = 0;                                            \
+            _iface_idx < (_ifaces)->count;                             \
+            _iface_idx++)                                              \
+               for (_bss_idx = 0;                                      \
+                    _bss_idx <                                         \
+                       (_ifaces)->iface[_iface_idx]->num_bss;          \
+                    _bss_idx++)                                        \
+                       for (_link =                                    \
+                            (_ifaces)->iface[_iface_idx]->bss[_bss_idx]; \
+                           _link && _link->conf->mld_ap &&             \
+                               _link->conf->mld_id == _mld_id;         \
+                           _link = NULL)
+#else /* CONFIG_IEEE80211BE */
+#define for_each_mld_link(_link, _bss_idx, _iface_idx, _ifaces, _mld_id) \
+       if (false)
+#endif /* CONFIG_IEEE80211BE */
+
 #endif /* HOSTAPD_H */