wlan-ap-Telecominfraproject/feeds/ipq95xx/mac80211/patches/qca/788-wifi-ath12k-move-peer-delete-after-vdev-stop-of-stat.patch
John Crispin 144c5d00f4 ipq95xx/mac80211: update to ATH12.3-CS
Signed-off-by: John Crispin <john@phrozen.org>
2024-02-28 18:56:21 +01:00

134 lines
5.2 KiB
Diff

From e276c98058882d6121e64cced3217ae79d1dd940 Mon Sep 17 00:00:00 2001
From: Wen Gong <quic_wgong@quicinc.com>
Date: Fri, 22 Jul 2022 06:17:52 -0400
Subject: [PATCH 031/112] wifi: ath12k: move peer delete after vdev stop of
station for WCN7850
When station connect to AP, the wmi command sequence is:
peer_create->vdev_start->vdev_up
and sequence of station disconnect fo AP is:
peer_delete->vdev_down->vdev_stop
The sequence of disconnect is not opposite of connect, it caused firmware
crash when it handle wmi vdev stop cmd when the AP is support TWT of
802.11 ax, because firmware need access the bss peer for vdev stop cmd.
[ 390.438564] ath12k_pci 0000:05:00.0: wmi cmd send 0x6001 ret 0
[ 390.438567] ath12k_pci 0000:05:00.0: WMI peer create vdev_id 0 peer_addr c4:04:15:3b:e0:39
[ 390.472724] ath12k_pci 0000:05:00.0: mac vdev 0 start center_freq 2437 phymode 11ax-he20-2g
[ 390.472731] ath12k_pci 0000:05:00.0: wmi cmd send 0x5003 ret 0
[ 390.560849] ath12k_pci 0000:05:00.0: wmi cmd send 0x5005 ret 0
[ 390.560850] ath12k_pci 0000:05:00.0: WMI mgmt vdev up id 0x0 assoc id 1 bssid c4:04:15:3b:e0:39
[ 399.432896] ath12k_pci 0000:05:00.0: WMI peer delete vdev_id 0 peer_addr c4:04:15:3b:e0:39
[ 399.432902] ath12k_pci 0000:05:00.0: wmi cmd send 0x6002 ret 0
[ 399.441380] ath12k_pci 0000:05:00.0: wmi cmd send 0x5007 ret 0
[ 399.441381] ath12k_pci 0000:05:00.0: WMI vdev down id 0x0
[ 399.454681] ath12k_pci 0000:05:00.0: wmi cmd send 0x5006 ret 0
[ 399.454682] ath12k_pci 0000:05:00.0: WMI vdev stop id 0x0
The opposite sequence of disconnect should be:
vdev_down->vdev_stop->peer_delete
This patch change the sequence of disconnect for station as above
opposite sequence for WCN7850, firmware not crash again with this patch.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-02582-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1
Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
Signed-off-by: Amutha Ravikumar <quic_aravikum@quicinc.com>
---
drivers/net/wireless/ath/ath12k/mac.c | 39 +++++++++++++++++++++------
1 file changed, 31 insertions(+), 8 deletions(-)
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -6679,6 +6679,9 @@ static void ath12k_mac_station_post_remo
struct ath12k_peer *peer;
struct ath12k_sta *ahsta = arsta->ahsta;
struct ieee80211_sta *sta;
+ struct ath12k_vif *ahvif = arvif->ahvif;
+ struct ieee80211_vif *vif = ahvif->vif;
+ bool skip_peer_delete;
sta = container_of((void *)ahsta, struct ieee80211_sta, drv_priv);
@@ -6686,8 +6689,13 @@ static void ath12k_mac_station_post_remo
mutex_lock(&ar->ab->tbl_mtx_lock);
spin_lock_bh(&ar->ab->base_lock);
+ skip_peer_delete = ar->ab->hw_params->vdev_start_delay &&
+ vif->type == NL80211_IFTYPE_STATION;
+
peer = ath12k_peer_find(ar->ab, arvif->vdev_id, arsta->addr);
- if (peer && peer->sta == sta) {
+ if (skip_peer_delete && peer) {
+ peer->sta = NULL;
+ } else if (peer && peer->sta == sta) {
ath12k_warn(ar->ab, "Found peer entry %pM n vdev %i after it was supposedly removed\n",
arsta->addr, arvif->vdev_id);
ath12k_peer_rhash_delete(ar->ab, peer);
@@ -6719,6 +6727,9 @@ static int ath12k_mac_station_remove(str
struct ath12k_sta *ahsta = arsta->ahsta;
struct ieee80211_sta *sta;
int ret;
+ struct ath12k_vif *ahvif = arvif->ahvif;
+ struct ieee80211_vif *vif = ahvif->vif;
+ bool skip_peer_delete;
sta = container_of((void *)ahsta, struct ieee80211_sta, drv_priv);
@@ -6730,15 +6741,20 @@ static int ath12k_mac_station_remove(str
ath12k_dp_peer_cleanup(ar, arvif->vdev_id, arsta->addr);
- ret = ath12k_peer_delete(ar, arvif->vdev_id, arsta->addr);
- if (ret)
- ath12k_warn(ar->ab, "Failed to delete peer: %pM for VDEV: %d\n",
- arsta->addr, arvif->vdev_id);
- else
- ath12k_dbg(ar->ab, ATH12K_DBG_PEER, "Removed peer: %pM for VDEV: %d\n",
- arsta->addr, arvif->vdev_id);
+ skip_peer_delete = ar->ab->hw_params->vdev_start_delay &&
+ vif->type == NL80211_IFTYPE_STATION;
- ath12k_mac_station_post_remove(ar, arvif, arsta);
+ if (!skip_peer_delete) {
+ ret = ath12k_peer_delete(ar, arvif->vdev_id, arsta->addr);
+ if (ret)
+ ath12k_warn(ar->ab, "Failed to delete peer: %pM for VDEV: %d\n",
+ arsta->addr, arvif->vdev_id);
+ else
+ ath12k_dbg(ar->ab, ATH12K_DBG_PEER, "Removed peer: %pM for VDEV: %d\n",
+ arsta->addr, arvif->vdev_id);
+
+ ath12k_mac_station_post_remove(ar, arvif, arsta);
+ }
return ret;
}
@@ -12936,6 +12952,19 @@ ath12k_mac_op_unassign_vif_chanctx(struc
}
if (ab->hw_params->vdev_start_delay &&
+ ahvif->vdev_type == WMI_VDEV_TYPE_STA) {
+ ret = ath12k_peer_delete(ar, arvif->vdev_id, arvif->bssid);
+ if (ret)
+ ath12k_warn(ar->ab,
+ "failed to delete peer %pM for vdev %d: %d\n",
+ arvif->bssid, arvif->vdev_id, ret);
+ else
+ ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
+ "mac removed peer %pM vdev %d after vdev stop\n",
+ arvif->bssid, arvif->vdev_id);
+ }
+
+ if (ab->hw_params->vdev_start_delay &&
ahvif->vdev_type == WMI_VDEV_TYPE_MONITOR)
ath12k_wmi_vdev_down(ar, arvif->vdev_id);