[PATCH ath-next 4/6] wifi: ath12k: fill MLO simultaneous-link fields in peer assoc WMI
From: Hangtian Zhu
Date: Wed Nov 25 2026 - 21:07:50 EST
Populate max_num_simultaneous_links and
recommended_max_num_simultaneous_links for MLO station-mode peer
association and pass raw counts to firmware in the WMI peer-assoc
command.
Derive the local maximum from the station iftype's advertised MLD
capabilities and operations instead of caching another copy in
ath12k_hw. Convert its IEEE 802.11be N-1 encoding to raw N when
preparing the peer-association argument.
Read the AP recommendation from sta->ext_mld_capa_ops, which mac80211
already tracks before the station enters IEEE80211_STA_ASSOC. The
recommendation is a raw count; use the local maximum when it is zero,
reserved (one), or exceeds that maximum.
Leave the new fields zero in AP mode: the current station API does not
provide the non-AP peer's maximum simultaneous-link capability, and
the AP's own capability is not a valid substitute.
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@xxxxxxxxxxxxxxxx>
---
drivers/net/wireless/ath/ath12k/mac.c | 29 +++++++++++++++++++++++++++
drivers/net/wireless/ath/ath12k/wmi.c | 4 ++++
drivers/net/wireless/ath/ath12k/wmi.h | 9 +++++++++
3 files changed, 42 insertions(+)
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index e78c711b7832..2d7ee2ab9d6d 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -3529,13 +3529,17 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar,
static void ath12k_peer_assoc_h_mlo(struct ath12k_link_sta *arsta,
struct ath12k_wmi_peer_assoc_arg *arg)
{
+ struct ieee80211_vif *vif = ath12k_ahvif_to_vif(arsta->arvif->ahvif);
struct ieee80211_sta *sta = ath12k_ahsta_to_sta(arsta->ahsta);
+ const struct wiphy_iftype_ext_capab *iftype_ext_capa;
struct peer_assoc_mlo_params *ml = &arg->ml;
struct ath12k_sta *ahsta = arsta->ahsta;
struct ath12k_link_sta *arsta_p;
struct ath12k_link_vif *arvif;
struct ath12k_hw *ah = arsta->arvif->ar->ah;
unsigned long links;
+ u8 rec_max_links;
+ u8 max_links;
u8 link_id;
int i;
@@ -3573,6 +3577,31 @@ static void ath12k_peer_assoc_h_mlo(struct ath12k_link_sta *arsta,
ml->ieee_link_id = arsta->link_id;
ml->num_partner_links = 0;
ml->eml_cap = sta->eml_cap;
+
+ if (vif->type == NL80211_IFTYPE_STATION) {
+ iftype_ext_capa = cfg80211_get_iftype_ext_capa(ah->hw->wiphy,
+ vif->type);
+ /*
+ * MLD Capabilities and Operations uses N-1 encoding
+ * (IEEE 802.11be Table 9-417n); firmware peer assoc uses raw N.
+ */
+ max_links = u16_get_bits(iftype_ext_capa->mld_capa_and_ops,
+ IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS) + 1;
+ rec_max_links =
+ u16_get_bits(sta->ext_mld_capa_ops,
+ IEEE80211_EHT_ML_EXT_MLD_CAPA_OP_RECO_MAX_LINKS_MASK);
+ /*
+ * Figure 9-1074t / Table 9-417o define Recommended Max
+ * Simultaneous Links as raw count L (0 no recommendation,
+ * 1 reserved).
+ */
+ if (rec_max_links <= 1 || rec_max_links > max_links)
+ rec_max_links = max_links;
+
+ ml->max_num_simultaneous_links = max_links;
+ ml->recommended_max_num_simultaneous_links = rec_max_links;
+ }
+
links = ahsta->links_map;
rcu_read_lock();
diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index 5cf104536dbf..443d29fdd763 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -2473,6 +2473,10 @@ int ath12k_wmi_send_peer_assoc_cmd(struct ath12k *ar,
ml_params->logical_link_idx = cpu_to_le32(arg->ml.logical_link_idx);
ml_params->ml_peer_id = cpu_to_le32(arg->ml.ml_peer_id);
ml_params->ieee_link_id = cpu_to_le32(arg->ml.ieee_link_id);
+ ml_params->max_num_simultaneous_links =
+ cpu_to_le32(arg->ml.max_num_simultaneous_links);
+ ml_params->recommended_max_num_simultaneous_links =
+ cpu_to_le32(arg->ml.recommended_max_num_simultaneous_links);
eml_cap = arg->ml.eml_cap;
if (u16_get_bits(eml_cap, IEEE80211_EML_CAP_EMLSR_SUPP)) {
diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
index 843f1d11f9c8..204eebb1d0c7 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.h
+++ b/drivers/net/wireless/ath/ath12k/wmi.h
@@ -3926,6 +3926,8 @@ struct peer_assoc_mlo_params {
u8 num_partner_links;
struct wmi_ml_partner_info partner_info[ATH12K_WMI_MLO_MAX_LINKS];
u16 eml_cap;
+ u8 max_num_simultaneous_links;
+ u8 recommended_max_num_simultaneous_links;
};
struct wmi_rate_set_arg {
@@ -4031,6 +4033,13 @@ struct wmi_peer_assoc_mlo_params {
__le32 emlsr_trans_timeout_us;
__le32 emlsr_trans_delay_us;
__le32 emlsr_padding_delay_us;
+ __le32 msd_dur_subfield;
+ __le32 msd_ofdm_ed_thr;
+ __le32 msd_max_num_txops;
+ __le32 max_num_simultaneous_links;
+ __le32 nstr_indication_bitmap;
+ __le32 recommended_max_num_simultaneous_links;
+ __le32 ml_reconfig;
} __packed;
struct wmi_peer_assoc_complete_cmd {
--
2.25.1