[PATCH ath-next 5/6] wifi: ath12k: add debugfs control for MLO simultaneous links

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


Add mlo_max_simultaneous_links under the per-radio ath12k debugfs
directory for MLO-capable hardware groups. The value uses IEEE 802.11be
N-1 encoding:
0 advertises one simultaneous link, 1 advertises two, and so on.

Use this control before station association or AP startup to validate
host-side MLD capability advertisement and exercise link-count-dependent
MLO behavior without firmware changes.

Bound writes to the first local radio's normalized firmware capability.
Infrastructure targets derive this field from the hardware-group radio
count; client targets using the firmware-count policy expose a single pdev.

Update only the station and AP iftype capability entries, leaving the
generic entry unchanged. Read the current value directly from the station
entry.

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/debugfs.c | 90 +++++++++++++++++++++++
 1 file changed, 90 insertions(+)

diff --git a/drivers/net/wireless/ath/ath12k/debugfs.c b/drivers/net/wireless/ath/ath12k/debugfs.c
index 12791e267d1a..657bdd4c7744 100644
--- a/drivers/net/wireless/ath/ath12k/debugfs.c
+++ b/drivers/net/wireless/ath/ath12k/debugfs.c
@@ -1587,6 +1587,89 @@ void ath12k_debugfs_fw_stats_register(struct ath12k *ar)
 	ath12k_fw_stats_init(ar);
 }
 
+static void ath12k_debugfs_set_mlo_max_simultaneous_links(struct ath12k_hw *ah,
+							  u8 max_links)
+{
+	int i;
+
+	lockdep_assert_wiphy(ah->hw->wiphy);
+
+	for (i = 0; i < ARRAY_SIZE(ah->iftypes_ext_capa); i++) {
+		enum nl80211_iftype iftype = ah->iftypes_ext_capa[i].iftype;
+
+		if (iftype != NL80211_IFTYPE_STATION && iftype != NL80211_IFTYPE_AP)
+			continue;
+
+		ah->iftypes_ext_capa[i].mld_capa_and_ops =
+			u16_replace_bits(ah->iftypes_ext_capa[i].mld_capa_and_ops,
+					 max_links,
+					 IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS);
+	}
+}
+
+static ssize_t ath12k_write_mlo_max_simultaneous_links(struct file *file,
+						       const char __user *ubuf,
+						       size_t count,
+						       loff_t *ppos)
+{
+	struct ath12k_hw *ah = file->private_data;
+	struct ath12k *ar;
+	u8 fw_max_links;
+	int ret;
+	u8 val;
+
+	ret = kstrtou8_from_user(ubuf, count, 0, &val);
+	if (ret)
+		return ret;
+
+	/*
+	 * debugfs value uses IEEE 802.11be encoded form (N-1), matching
+	 * MLD Capabilities and Operations per IEEE Std 802.11be-2024
+	 * Table 9-417n:
+	 * 0 means single-link, 1 means dual-link, etc.
+	 */
+	guard(wiphy)(ah->hw->wiphy);
+	ar = ath12k_ah_to_ar(ah, 0);
+	fw_max_links = u16_get_bits(ar->pdev->cap.mld_cap,
+				    IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS);
+	if (val > fw_max_links)
+		return -EINVAL;
+
+	ath12k_debugfs_set_mlo_max_simultaneous_links(ah, val);
+
+	return count;
+}
+
+static ssize_t ath12k_read_mlo_max_simultaneous_links(struct file *file,
+						      char __user *ubuf,
+						      size_t count,
+						      loff_t *ppos)
+{
+	const struct wiphy_iftype_ext_capab *iftype_ext_capa;
+	struct ath12k_hw *ah = file->private_data;
+	u8 max_links;
+	char buf[8];
+	int len;
+
+	scoped_guard(wiphy, ah->hw->wiphy) {
+		iftype_ext_capa = cfg80211_get_iftype_ext_capa(ah->hw->wiphy,
+							       NL80211_IFTYPE_STATION);
+		max_links = u16_get_bits(iftype_ext_capa->mld_capa_and_ops,
+					 IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS);
+	}
+	len = scnprintf(buf, sizeof(buf), "%u\n", max_links);
+
+	return simple_read_from_buffer(ubuf, count, ppos, buf, len);
+}
+
+static const struct file_operations fops_mlo_max_simultaneous_links = {
+	.read = ath12k_read_mlo_max_simultaneous_links,
+	.write = ath12k_write_mlo_max_simultaneous_links,
+	.open = simple_open,
+	.owner = THIS_MODULE,
+	.llseek = default_llseek,
+};
+
 void ath12k_debugfs_register(struct ath12k *ar)
 {
 	struct ath12k_base *ab = ar->ab;
@@ -1647,6 +1730,13 @@ void ath12k_debugfs_register(struct ath12k *ar)
 	debugfs_create_file("ext_rx_stats", 0644,
 			    ar->debug.debugfs_pdev, ar,
 			    &fops_extd_rx_stats);
+
+	if (!ab->ag->mlo_capable || IS_ERR_OR_NULL(ar->debug.debugfs_pdev))
+		return;
+
+	debugfs_create_file("mlo_max_simultaneous_links", 0644,
+			    ar->debug.debugfs_pdev, ah,
+			    &fops_mlo_max_simultaneous_links);
 }
 
 void ath12k_debugfs_unregister(struct ath12k *ar)
-- 
2.25.1




More information about the ath12k mailing list