wlan-ap-Telecominfraproject/feeds/qca/hostapd/patches/r04-005-hostapd-fix-advertisement-of-MLD-capabilities.patch
John Crispin 008ca9618d
Some checks failed
Build OpenWrt/uCentral images / build (cig_wf186h) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf186w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf188n) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf189) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf196) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-a1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-b1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap102) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap104) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap105) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap111) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap112) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_3) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xe) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (indio_um-305ax) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sercomm_ap72tip) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630c-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-211g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-id2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-od2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr5018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018-v4) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax820) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax840) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap640) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap650) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap655) (push) Has been cancelled
Build OpenWrt/uCentral images / trigger-testing (push) Has been cancelled
Build OpenWrt/uCentral images / create-x64_vm-ami (push) Has been cancelled
ipq95xx: import ath12.4-cs kernel and drivers
Signed-off-by: John Crispin <john@phrozen.org>
2024-10-20 09:25:13 +02:00

116 lines
4.4 KiB
Diff

From 5df64a2710bef8bc8b7c0f7a633ef8cf6d8296f5 Mon Sep 17 00:00:00 2001
From: Aditya Kumar Singh <quic_adisi@quicinc.com>
Date: Mon, 11 Dec 2023 18:04:39 +0530
Subject: [PATCH] hostapd: fix advertisement of MLD capabilities
Currently, hostapd directly advertises the MLD capabilites received from driver.
Since this info is exchanged during init time only, driver will advertise the max
supported possible values. Hostapd should parse it and then based on current
situation should fill the values accordingly.
For example, Max number of simultaneous links is supposed to be value between 0
and 14, which is the number of affiliated APs minus 1. Driver advertises this
value as 5 and hostapd, irrespective of current active links, it puts 5 in the
frames.
Fix this issue by parsing the value and at the same time using the values as
per the current situation of the links. The advertised values will be used
as the upper limit.
While at it, also print the MLD capabilities in debug print.
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
src/ap/ieee802_11_eht.c | 29 +++++++++++++++++++++++++----
src/common/ieee802_11_defs.h | 5 +++++
src/drivers/driver_nl80211_capa.c | 4 ++++
3 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c
index 48c9d63e1736..c581ff8c356d 100644
--- a/src/ap/ieee802_11_eht.c
+++ b/src/ap/ieee802_11_eht.c
@@ -555,13 +555,13 @@ u8 * hostapd_eid_eht_basic_ml(struct hostapd_data *hapd, u8 *eid,
struct mld_link_info *info, bool include_mld_id)
{
struct wpabuf *buf;
- u16 control;
+ u16 control, mld_cap;
u8 *pos = eid;
const u8 *ptr;
size_t len, slice_len;
u8 link_id;
u8 common_info_len;
-
+ u8 max_simul_links, tid_to_link_map, active_links;
/*
* As the Multi-Link element can exceed the size of 255 bytes need to
* first build it and then handle fragmentation.
@@ -609,9 +609,30 @@ u8 * hostapd_eid_eht_basic_ml(struct hostapd_data *hapd, u8 *eid,
wpabuf_put_le16(buf, hapd->iface->mld_eml_capa);
}
+ mld_cap = hapd->iface->mld_mld_capa;
+ max_simul_links = mld_cap & MLE_MLD_CAP_MAX_SIMULTANEOUS_LINK_MASK;
+ tid_to_link_map = (mld_cap & MLE_MLD_CAP_TID_TO_LINK_MAP_MASK) >>
+ MLE_MLD_CAP_TID_TO_LINK_MAP_SHIFT;
+ active_links = hapd->mld->num_links - 1;
+
+ if (active_links > max_simul_links) {
+ wpa_printf(MSG_ERROR, "MLD: Error in max simultaneous links, advertised: %x current: %x",
+ max_simul_links, active_links);
+ active_links = max_simul_links;
+ }
+
+ mld_cap &= ~MLE_MLD_CAP_MAX_SIMULTANEOUS_LINK_MASK;
+ mld_cap |= (active_links & MLE_MLD_CAP_MAX_SIMULTANEOUS_LINK_MASK);
+
+ /* TODO: advertise T2LM based on driver support as well */
+ tid_to_link_map = MLE_MLD_CAP_TID_TO_LINK_MAP_DISABLED;
+
+ mld_cap &= ~MLE_MLD_CAP_TID_TO_LINK_MAP_MASK;
+ mld_cap |= (tid_to_link_map << MLE_MLD_CAP_TID_TO_LINK_MAP_SHIFT);
+
wpa_printf(MSG_DEBUG, "MLD: MLD Capabilities and Operations=0x%x",
- hapd->iface->mld_mld_capa);
- wpabuf_put_le16(buf, hapd->iface->mld_mld_capa);
+ mld_cap);
+ wpabuf_put_le16(buf, mld_cap);
if (include_mld_id) {
wpa_printf(MSG_DEBUG, "MLD: AP MLD ID=0x%x",
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index 47d1b7928ca8..8ae8e4a917c4 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -2662,6 +2662,11 @@ struct ieee80211_eht_capabilities {
#define BASIC_MULTI_LINK_CTRL_PRES_MLD_CAPA 0x0100
#define BASIC_MULTI_LINK_CTRL_PRES_AP_MLD_ID 0x0200
+#define MLE_MLD_CAP_MAX_SIMULTANEOUS_LINK_MASK ((u8) (BIT(0) | BIT(1) | BIT(2) | BIT(3)))
+#define MLE_MLD_CAP_TID_TO_LINK_MAP_SHIFT 5
+#define MLE_MLD_CAP_TID_TO_LINK_MAP_MASK ((u8) (BIT(5) | BIT(6)))
+#define MLE_MLD_CAP_TID_TO_LINK_MAP_DISABLED 0
+
/*
* STA Control field definitions of Per-STA Profile subelement in Basic
* Multi-Link element as described in Figure 9-1002n: STA Control field format.
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
index 9db6f7aa58af..3c179efcc228 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -870,6 +870,10 @@ static void wiphy_info_extended_capab(struct wpa_driver_nl80211_data *drv,
nla_get_u16(tb1[NL80211_ATTR_MLD_CAPA_AND_OPS]);
}
+ wpa_printf(MSG_DEBUG,
+ "nl80211: EML Capability: 0x%x MLD Capability: 0x%x",
+ capa->eml_capa, capa->mld_capa_and_ops);
+
drv->num_iface_capa++;
if (drv->num_iface_capa == NL80211_IFTYPE_MAX)
break;
--
2.17.1