AP MLD: Simplify for_each_mld_link() macro

for_each_mld_link() macro used three nested for loops. Since now the
affliated links are linked together via a linked list, the logic can be
improved by using dl_list_for_each() macro instead which uses one for
loop.

Modify for_each_mld_link() macro to use dl_list_for_each() instead.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
This commit is contained in:
Aditya Kumar Singh 2024-03-28 23:46:31 +05:30 committed by Jouni Malinen
parent ae1a9909e0
commit 16aea07e50
3 changed files with 5 additions and 26 deletions

View file

@ -957,7 +957,6 @@ static void hostapd_fill_probe_resp_ml_params(struct hostapd_data *hapd,
{
struct probe_resp_params sta_info_params;
struct hostapd_data *link;
unsigned int probed_mld_id, i, j;
params->mld_ap = NULL;
params->mld_info = os_zalloc(sizeof(*params->mld_info));
@ -968,14 +967,7 @@ static void hostapd_fill_probe_resp_ml_params(struct hostapd_data *hapd,
"MLD: Got ML probe request with AP MLD ID %d for links %04x",
mld_id, links);
/*
* We want to include the AP MLD ID in the response if it was
* included in the request.
*/
probed_mld_id = mld_id != -1 ? mld_id : hostapd_get_mld_id(hapd);
for_each_mld_link(link, i, j, hapd->iface->interfaces,
probed_mld_id) {
for_each_mld_link(link, hapd) {
struct mld_link_info *link_info;
size_t buflen;
u8 mld_link_id = link->mld_link_id;

View file

@ -827,19 +827,8 @@ struct hostapd_data * hostapd_mld_get_first_bss(struct hostapd_data *hapd);
bool hostapd_mld_is_first_bss(struct hostapd_data *hapd);
#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 && \
hostapd_get_mld_id(_link) == _mld_id; \
_link = NULL)
#define for_each_mld_link(partner, self) \
dl_list_for_each(partner, &self->mld->links, struct hostapd_data, link)
#else /* CONFIG_IEEE80211BE */
@ -848,7 +837,7 @@ static inline bool hostapd_mld_is_first_bss(struct hostapd_data *hapd)
return true;
}
#define for_each_mld_link(_link, _bss_idx, _iface_idx, _ifaces, _mld_id) \
#define for_each_mld_link(partner, self) \
if (false)
#endif /* CONFIG_IEEE80211BE */

View file

@ -1761,10 +1761,8 @@ static void ap_sta_remove_link_sta(struct hostapd_data *hapd,
struct sta_info *sta)
{
struct hostapd_data *tmp_hapd;
unsigned int i, j;
for_each_mld_link(tmp_hapd, i, j, hapd->iface->interfaces,
hostapd_get_mld_id(hapd)) {
for_each_mld_link(tmp_hapd, hapd) {
struct sta_info *tmp_sta;
if (hapd == tmp_hapd)