| From f5102b209870065c3e3719dd113892eafd4bb59e Mon Sep 17 00:00:00 2001 |
| From: Aditya Kumar Singh <quic_adisi@quicinc.com> |
| Date: Thu, 28 Mar 2024 23:46:31 +0530 |
| Subject: [PATCH 001/104] hostapd: MLO: fix for_each_mld_link macro |
| |
| Currently for_each_mld_link macro uses 3 nested for loops. Since now the |
| affliated links are linked together via linked list, the logic can |
| be improvised 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> |
| --- |
| src/ap/beacon.c | 10 +--------- |
| src/ap/hostapd.h | 17 +++-------------- |
| src/ap/sta_info.c | 4 +--- |
| 3 files changed, 5 insertions(+), 26 deletions(-) |
| |
| diff --git a/src/ap/beacon.c b/src/ap/beacon.c |
| index 32865f667..195c7bbd9 100644 |
| --- a/src/ap/beacon.c |
| +++ b/src/ap/beacon.c |
| @@ -945,7 +945,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)); |
| @@ -956,14 +955,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; |
| diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h |
| index affe4f604..d12efb104 100644 |
| --- a/src/ap/hostapd.h |
| +++ b/src/ap/hostapd.h |
| @@ -817,19 +817,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 */ |
| |
| @@ -838,7 +827,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 */ |
| diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c |
| index 122880a3d..2423ff189 100644 |
| --- a/src/ap/sta_info.c |
| +++ b/src/ap/sta_info.c |
| @@ -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) |
| -- |
| 2.39.2 |
| |