From: Ramya Gnanasekar Wi-Fi 8 devices require host-programmed management frame queue addresses in the WMI PEER_ASSOC command and need the datapath layer to participate in peer association. Without this, management traffic fails to flow after association on such devices. Introduce four new arch ops: peer_assoc, link_peer_assoc, get_peer_mgmt_flowq, and get_peer_holq so the architecture-specific datapath can participate in the peer association sequence. peer_assoc and link_peer_assoc return 0 (treated as success/no-op) when the op is unregistered, since Wi-Fi 7 has no dp participation in peer assoc. get_peer_mgmt_flowq and get_peer_holq return -EOPNOTSUPP when unregistered; ath12k_peer_assoc_h_flowq() and ath12k_peer_assoc_h_holq() treat -EOPNOTSUPP as disabled and return 0, so peer association is not aborted, as expected for Wi-Fi 7 devices. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3 Signed-off-by: Ramya Gnanasekar Co-developed-by: Sriram R Signed-off-by: Sriram R --- drivers/net/wireless/ath/ath12k/dp.h | 57 ++++++++++ drivers/net/wireless/ath/ath12k/mac.c | 155 ++++++++++++++++++++++++-- 2 files changed, 201 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/dp.h b/drivers/net/wireless/ath/ath12k/dp.h index f439f43ed302..bac433ad0a7a 100644 --- a/drivers/net/wireless/ath/ath12k/dp.h +++ b/drivers/net/wireless/ath/ath12k/dp.h @@ -24,6 +24,7 @@ struct ath12k_link_vif; struct ath12k_ext_irq_grp; struct ath12k_dp_rx_tid; struct ath12k_dp_rx_tid_rxq; +struct ath12k_dp_vif; struct ath12k_dp_profile_params { u32 tx_comp_ring_size; @@ -416,6 +417,16 @@ struct ath12k_dp_arch_ops { struct ath12k_dp_peer_create_params *params); void (*peer_delete)(struct ath12k_hw *ah, u8 *addr, struct ieee80211_sta *sta); + int (*peer_assoc)(struct ath12k_dp *dp, struct ath12k_dp_hw *dp_hw, + struct ath12k_dp_vif *dp_vif, u8 *addr); + int (*link_peer_assoc)(struct ath12k_dp *dp, struct ath12k_dp_hw *dp_hw, + u8 *addr, u32 hw_link_id); + int (*get_peer_mgmt_flowq)(struct ath12k_dp *dp, struct ath12k_dp_hw *dp_hw, + u8 *addr, + struct ath12k_wmi_peer_assoc_flowq_arg *flowq_args); + int (*get_peer_holq)(struct ath12k_dp *dp, struct ath12k_dp_hw *dp_hw, + u8 *addr, + struct ath12k_wmi_peer_assoc_holq_arg *holq_args); }; struct ath12k_device_dp_tx_err_stats { @@ -705,6 +716,52 @@ ath12k_dp_arch_peer_delete(struct ath12k_dp *dp, dp->ops->peer_delete(ah, addr, sta); } +static inline int ath12k_dp_arch_peer_assoc(struct ath12k_dp *dp, + struct ath12k_dp_hw *dp_hw, + struct ath12k_dp_vif *dp_vif, + u8 *addr) +{ + if (dp->ops && dp->ops->peer_assoc) + return dp->ops->peer_assoc(dp, dp_hw, dp_vif, addr); + + return 0; +} + +static inline int +ath12k_dp_arch_link_peer_assoc(struct ath12k_dp *dp, + struct ath12k_dp_hw *dp_hw, + u8 *addr, u32 hw_link_id) +{ + if (dp->ops && dp->ops->link_peer_assoc) + return dp->ops->link_peer_assoc(dp, dp_hw, addr, hw_link_id); + + return 0; +} + +static inline int +ath12k_dp_arch_get_peer_mgmt_flowq(struct ath12k_dp *dp, + struct ath12k_dp_hw *dp_hw, + u8 *addr, + struct ath12k_wmi_peer_assoc_flowq_arg *flowq_args) +{ + if (dp->ops && dp->ops->get_peer_mgmt_flowq) + return dp->ops->get_peer_mgmt_flowq(dp, dp_hw, addr, flowq_args); + + return -EOPNOTSUPP; +} + +static inline int +ath12k_dp_arch_get_peer_holq(struct ath12k_dp *dp, + struct ath12k_dp_hw *dp_hw, + u8 *addr, + struct ath12k_wmi_peer_assoc_holq_arg *holq_args) +{ + if (dp->ops && dp->ops->get_peer_holq) + return dp->ops->get_peer_holq(dp, dp_hw, addr, holq_args); + + return -EOPNOTSUPP; +} + static inline u32 ath12k_dp_tx_comp_ring_size(const struct ath12k_dp_profile_params *p) { diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index c2e6e9601092..da780895caf1 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -3679,12 +3679,64 @@ static void ath12k_peer_assoc_h_mlo(struct ath12k_link_sta *arsta, rcu_read_unlock(); } -static void ath12k_peer_assoc_prepare(struct ath12k *ar, - struct ath12k_link_vif *arvif, - struct ath12k_link_sta *arsta, - struct ath12k_wmi_peer_assoc_arg *arg, - bool reassoc) +static int ath12k_peer_assoc_h_flowq(struct ath12k_link_sta *arsta, + struct ath12k_link_vif *arvif, + struct ath12k_wmi_peer_assoc_arg *arg) +{ + struct ieee80211_sta *sta = ath12k_ahsta_to_sta(arsta->ahsta); + struct ath12k *ar = arvif->ar; + int ret; + + ret = ath12k_dp_arch_get_peer_mgmt_flowq(ar->ab->dp, &ar->ah->dp_hw, + sta->addr, + &arg->flowq_args); + if (ret == -EOPNOTSUPP) { + arg->flowq_args.enabled = false; + return 0; + } + + if (ret) { + ath12k_warn(ar->ab, "failed to get peer mgmt flowq for %pM: %d\n", + sta->addr, ret); + return ret; + } + + return 0; +} + +static int ath12k_peer_assoc_h_holq(struct ath12k_link_sta *arsta, + struct ath12k_link_vif *arvif, + struct ath12k_wmi_peer_assoc_arg *arg) +{ + struct ieee80211_sta *sta = ath12k_ahsta_to_sta(arsta->ahsta); + struct ath12k *ar = arvif->ar; + int ret; + + ret = ath12k_dp_arch_get_peer_holq(ar->ab->dp, &ar->ah->dp_hw, + sta->addr, + &arg->holq_args); + if (ret == -EOPNOTSUPP) { + arg->holq_args.enabled = false; + return 0; + } + + if (ret) { + ath12k_warn(ar->ab, "failed to get peer holq for %pM: %d\n", + sta->addr, ret); + return ret; + } + + return 0; +} + +static int ath12k_peer_assoc_prepare(struct ath12k *ar, + struct ath12k_link_vif *arvif, + struct ath12k_link_sta *arsta, + struct ath12k_wmi_peer_assoc_arg *arg, + bool reassoc) { + int ret; + lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); memset(arg, 0, sizeof(*arg)); @@ -3702,9 +3754,19 @@ static void ath12k_peer_assoc_prepare(struct ath12k *ar, ath12k_peer_assoc_h_phymode(ar, arvif, arsta, arg); ath12k_peer_assoc_h_smps(arsta, arg); ath12k_peer_assoc_h_mlo(arsta, arg); + ret = ath12k_peer_assoc_h_flowq(arsta, arvif, arg); + if (ret) + return ret; + + ret = ath12k_peer_assoc_h_holq(arsta, arvif, arg); + if (ret) + return ret; arsta->peer_nss = arg->peer_nss; + /* TODO: amsdu_disable req? */ + + return 0; } static int ath12k_setup_peer_smps(struct ath12k *ar, struct ath12k_link_vif *arvif, @@ -4078,7 +4140,13 @@ static void ath12k_bss_assoc(struct ath12k *ar, return; } - ath12k_peer_assoc_prepare(ar, arvif, arsta, peer_arg, false); + ret = ath12k_peer_assoc_prepare(ar, arvif, arsta, peer_arg, false); + if (ret) { + ath12k_warn(ar->ab, "failed to prepare peer assoc for %pM: %d\n", + bss_conf->bssid, ret); + rcu_read_unlock(); + return; + } /* link_sta->he_cap must be protected by rcu_read_lock */ ret = ath12k_mac_vif_recalc_sta_he_txbf(ar, arvif, &link_sta->he_cap, &hemode); @@ -4106,6 +4174,14 @@ static void ath12k_bss_assoc(struct ath12k *ar, if (ret) return; + ret = ath12k_dp_arch_link_peer_assoc(ar->ab->dp, &ar->ah->dp_hw, + vif->cfg.ap_addr, ar->hw_link_id); + if (ret) { + ath12k_warn(ar->ab, "dp link peer assoc failed for %pM: %d\n", + vif->cfg.ap_addr, ret); + return; + } + ret = ath12k_setup_peer_smps(ar, arvif, bss_conf->bssid, &link_sta->ht_cap, &link_sta->he_6ghz_capa); if (ret) { @@ -4590,6 +4666,13 @@ void ath12k_mac_op_vif_cfg_changed(struct ieee80211_hw *hw, * bss info does not exist */ info = ath12k_mac_get_link_bss_conf(arvif); + if (ath12k_dp_arch_peer_assoc(ar->ab->dp, &ar->ah->dp_hw, + &ahvif->dp_vif, + vif->cfg.ap_addr)) { + ath12k_warn(ar->ab, "dp peer assoc failed for %pM\n", + vif->cfg.ap_addr); + return; + } ath12k_bss_assoc(ar, arvif, info); /* exclude assoc link as it is done above */ @@ -5093,10 +5176,18 @@ static void ath12k_mac_bss_info_changed(struct ath12k *ar, } if (changed & BSS_CHANGED_ASSOC) { - if (vif->cfg.assoc) + if (vif->cfg.assoc) { + if (ath12k_dp_arch_peer_assoc(ar->ab->dp, &ar->ah->dp_hw, + &ahvif->dp_vif, + vif->cfg.ap_addr)) { + ath12k_warn(ar->ab, "dp peer assoc failed for %pM\n", + vif->cfg.ap_addr); + return; + } ath12k_bss_assoc(ar, arvif, info); - else + } else { ath12k_bss_disassoc(ar, arvif); + } } if (changed & BSS_CHANGED_TXPOWER) { @@ -6683,7 +6774,9 @@ static int ath12k_mac_station_assoc(struct ath12k *ar, if (!peer_arg) return -ENOMEM; - ath12k_peer_assoc_prepare(ar, arvif, arsta, peer_arg, reassoc); + ret = ath12k_peer_assoc_prepare(ar, arvif, arsta, peer_arg, reassoc); + if (ret) + return ret; if (peer_arg->peer_nss < 1) { ath12k_warn(ar->ab, @@ -6735,6 +6828,14 @@ static int ath12k_mac_station_assoc(struct ath12k *ar, if (reassoc) return 0; + ret = ath12k_dp_arch_link_peer_assoc(ar->ab->dp, &ar->ah->dp_hw, + sta->addr, ar->hw_link_id); + if (ret) { + ath12k_warn(ar->ab, "dp link peer assoc failed for %pM: %d\n", + sta->addr, ret); + return ret; + } + ret = ath12k_setup_peer_smps(ar, arvif, arsta->addr, &link_sta->ht_cap, &link_sta->he_6ghz_capa); if (ret) { @@ -7040,8 +7141,14 @@ static void ath12k_sta_rc_update_wk(struct wiphy *wiphy, struct wiphy_work *wk) "failed to disable peer fixed rate for STA %pM ret %d\n", arsta->addr, err); - ath12k_peer_assoc_prepare(ar, arvif, arsta, - peer_arg, true); + err = ath12k_peer_assoc_prepare(ar, arvif, arsta, + peer_arg, true); + if (err) { + ath12k_warn(ar->ab, + "failed to prepare peer assoc for STA %pM: %d\n", + arsta->addr, err); + return; + } peer_arg->is_assoc = false; @@ -8005,6 +8112,18 @@ int ath12k_mac_op_sta_state(struct ieee80211_hw *hw, } ieee80211_set_active_links(vif, selected_links); + } else if (old_state == IEEE80211_STA_AUTH && + new_state == IEEE80211_STA_ASSOC && + (vif->type == NL80211_IFTYPE_AP || + vif->type == NL80211_IFTYPE_MESH_POINT || + vif->type == NL80211_IFTYPE_ADHOC)) { + ret = ath12k_dp_arch_peer_assoc(dp, &ah->dp_hw, &ahvif->dp_vif, + sta->addr); + if (ret) { + ath12k_hw_warn(ah, "unable to do dp assoc for sta %pM\n", + sta->addr); + goto exit; + } } /* Handle all the other state transitions in generic way */ @@ -10683,6 +10802,20 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif) goto err_dp_peer_del; } + ret = ath12k_dp_arch_peer_assoc(ab->dp, + &ah->dp_hw, + &ahvif->dp_vif, + arvif->bssid); + if (ret) { + ath12k_hw_warn(ah, "dp peer assoc failed for %pM: %d\n", + arvif->bssid, ret); + /* + * err_peer_del unwinds ath12k_peer_create() and falls + * through to err_dp_peer_del to release the dp_peer. + */ + goto err_peer_del; + } + ret = ath12k_mac_set_kickout(arvif); if (ret) { ath12k_warn(ar->ab, "failed to set vdev %i kickout parameters: %d\n", -- 2.34.1