[PATCH ath-next 2/6] wifi: ath12k: derive MLD max simultaneous links by hw policy

Hangtian Zhu hangtian.zhu at oss.qualcomm.com
Wed Nov 25 18:07:23 PST 2026


On infrastructure-focused chipsets, firmware may report a maximum
simultaneous-link count that does not reflect the available radio
combination. When the counts differ, converting the firmware value to
N-1 still advertises an incorrect Max Number Of Simultaneous Links in
the wiphy MLD capabilities exposed to userspace and in MLO association
requests. Userspace and peers therefore see a simultaneous-link limit
that does not describe the configured hardware.

Add mlo_max_simul_links_by_num_radios in struct ath12k_hw_params and
use it to select between firmware-field conversion and radio-count-based
derivation of the encoded max simultaneous links value.

mlo_max_simul_links_by_num_radios is enabled for
QCN9274/QCN6432/IPQ5332/IPQ5424 and disabled for WCN7850/QCC2072.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

Signed-off-by: Hangtian Zhu <hangtian.zhu at oss.qualcomm.com>
---
 drivers/net/wireless/ath/ath12k/hw.h       |  1 +
 drivers/net/wireless/ath/ath12k/wifi7/hw.c |  7 +++
 drivers/net/wireless/ath/ath12k/wmi.c      | 67 ++++++++++++++++++----
 3 files changed, 63 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/hw.h b/drivers/net/wireless/ath/ath12k/hw.h
index 138e556ac679..7cd357f9429b 100644
--- a/drivers/net/wireless/ath/ath12k/hw.h
+++ b/drivers/net/wireless/ath/ath12k/hw.h
@@ -218,6 +218,7 @@ struct ath12k_hw_params {
 	u32 otp_board_id_register;
 
 	bool supports_sta_ps;
+	bool mlo_max_simul_links_by_num_radios;
 
 	const guid_t *acpi_guid;
 	bool supports_dynamic_smps_6ghz;
diff --git a/drivers/net/wireless/ath/ath12k/wifi7/hw.c b/drivers/net/wireless/ath/ath12k/wifi7/hw.c
index 48a2f6da16ef..eef99b664748 100644
--- a/drivers/net/wireless/ath/ath12k/wifi7/hw.c
+++ b/drivers/net/wireless/ath/ath12k/wifi7/hw.c
@@ -472,6 +472,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		.otp_board_id_register = QCN9274_QFPROM_RAW_RFA_PDET_ROW13_LSB,
 
 		.supports_sta_ps = false,
+		.mlo_max_simul_links_by_num_radios = true,
 
 		.acpi_guid = NULL,
 		.supports_dynamic_smps_6ghz = true,
@@ -571,6 +572,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		.otp_board_id_register = 0,
 
 		.supports_sta_ps = true,
+		.mlo_max_simul_links_by_num_radios = false,
 
 		.acpi_guid = &wcn7850_uuid,
 		.supports_dynamic_smps_6ghz = false,
@@ -666,6 +668,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		.otp_board_id_register = QCN9274_QFPROM_RAW_RFA_PDET_ROW13_LSB,
 
 		.supports_sta_ps = false,
+		.mlo_max_simul_links_by_num_radios = true,
 
 		.acpi_guid = NULL,
 		.supports_dynamic_smps_6ghz = true,
@@ -759,6 +762,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		.otp_board_id_register = 0,
 
 		.supports_sta_ps = false,
+		.mlo_max_simul_links_by_num_radios = true,
 
 		.acpi_guid = NULL,
 		.supports_dynamic_smps_6ghz = false,
@@ -855,6 +859,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		.otp_board_id_register = 0,
 
 		.supports_sta_ps = true,
+		.mlo_max_simul_links_by_num_radios = false,
 
 		.acpi_guid = &wcn7850_uuid,
 		.supports_dynamic_smps_6ghz = false,
@@ -949,6 +954,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		.otp_board_id_register = 0,
 
 		.supports_sta_ps = false,
+		.mlo_max_simul_links_by_num_radios = true,
 
 		.acpi_guid = NULL,
 		.supports_dynamic_smps_6ghz = false,
@@ -1039,6 +1045,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		.otp_board_id_register = 0,
 
 		.supports_sta_ps = false,
+		.mlo_max_simul_links_by_num_radios = true,
 
 		.acpi_guid = NULL,
 		.supports_dynamic_smps_6ghz = false,
diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index d1af43ede2ae..5cf104536dbf 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -5293,22 +5293,69 @@ static void ath12k_wmi_eht_caps_parse(struct ath12k_pdev *pdev, u32 band,
 	cap_band->eht_cap_info_internal = le32_to_cpu(cap_info_internal);
 }
 
-static u32 ath12k_wmi_get_spec_encoded_mld_cap(struct ath12k_base *ab, u32 mld_cap)
+static u8 ath12k_wmi_get_max_simul_links_by_num_radios(struct ath12k_base *ab)
 {
 	struct ath12k_hw_group *ag = ath12k_ab_to_ag(ab);
-	u8 max_simul_links;
+	u8 max_simul_links = 0;
+	int i;
 
 	/*
-	 * Firmware reports Max Number Of Simultaneous Links as raw N while
-	 * IEEE 802.11be MLD Capabilities and Operations encodes it as N-1.
+	 * On infrastructure-focused chipsets, firmware may report max
+	 * simultaneous links independent of active radio combination.
+	 * Derive the encoded value from the number of available radios.
 	 */
-	max_simul_links = u32_get_bits(mld_cap, IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS);
+	if (ag->mlo_capable) {
+		for (i = 0; i < ag->num_devices; i++) {
+			struct ath12k_base *partner_ab = ath12k_ag_to_ab(ag, i);
+
+			if (!partner_ab)
+				continue;
+
+			max_simul_links += partner_ab->qmi.num_radios;
+		}
+	} else {
+		max_simul_links = ab->num_radios;
+	}
+
+	if (!max_simul_links)
+		return 0;
+
+	return min_t(u8, max_simul_links - 1,
+		     FIELD_MAX(IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS));
+}
+
+static u8 ath12k_wmi_get_max_simul_links_from_fw(struct ath12k_base *ab, u32 mld_cap)
+{
+	struct ath12k_hw_group *ag = ath12k_ab_to_ag(ab);
+	u8 max_simul_links;
+
+	max_simul_links = u32_get_bits(mld_cap,
+				       IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS);
 	if (max_simul_links)
-		max_simul_links--;
-	else if (ag && ag->mlo_capable)
+		return max_simul_links - 1;
+
+	if (ag->mlo_capable)
 		ath12k_warn(ab,
 			    "firmware reported invalid max simul links value 0 in mld_cap 0x%x\n",
 			    mld_cap);
+	return 0;
+}
+
+static u32
+ath12k_wmi_get_spec_encoded_mld_cap(struct ath12k_base *ab,
+				    const struct ath12k_wmi_caps_ext_params *caps)
+{
+	u32 mld_cap = le32_to_cpu(caps->mld_capability);
+	u8 max_simul_links;
+
+	/*
+	 * Firmware reports Max Number Of Simultaneous Links as raw N while
+	 * IEEE 802.11be MLD Capabilities and Operations encodes it as N-1.
+	 */
+	if (ab->hw_params->mlo_max_simul_links_by_num_radios)
+		max_simul_links = ath12k_wmi_get_max_simul_links_by_num_radios(ab);
+	else
+		max_simul_links = ath12k_wmi_get_max_simul_links_from_fw(ab, mld_cap);
 
 	return u32_replace_bits(mld_cap, max_simul_links,
 				IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS);
@@ -5319,7 +5366,6 @@ ath12k_wmi_tlv_mac_phy_caps_ext_parse(struct ath12k_base *ab,
 				      const struct ath12k_wmi_caps_ext_params *caps,
 				      struct ath12k_pdev *pdev)
 {
-	u32 mld_cap;
 	u32 bands;
 	int i;
 
@@ -5365,11 +5411,8 @@ ath12k_wmi_tlv_mac_phy_caps_ext_parse(struct ath12k_base *ab,
 					  caps->eht_cap_info_internal);
 	}
 
-	mld_cap = le32_to_cpu(caps->mld_capability);
-	mld_cap = ath12k_wmi_get_spec_encoded_mld_cap(ab, mld_cap);
-
 	pdev->cap.eml_cap = le32_to_cpu(caps->eml_capability);
-	pdev->cap.mld_cap = mld_cap;
+	pdev->cap.mld_cap = ath12k_wmi_get_spec_encoded_mld_cap(ab, caps);
 
 	return 0;
 }
-- 
2.25.1




More information about the ath12k mailing list