All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kang Yang <quic_kangyang@quicinc.com>
To: <ath12k@lists.infradead.org>
Cc: <linux-wireless@vger.kernel.org>, <quic_kangyang@quicinc.com>
Subject: [PATCH v6 09/11] wifi: ath12k: move peer delete after vdev stop of station for WCN7850
Date: Tue, 30 Jan 2024 12:03:01 +0800	[thread overview]
Message-ID: <20240130040303.370590-10-quic_kangyang@quicinc.com> (raw)
In-Reply-To: <20240130040303.370590-1-quic_kangyang@quicinc.com>

In current code, when STA/P2P Client connect to AP/P2P GO, the WMI
command sequence is:

peer_create->vdev_start->vdev_up

And sequence of STA/P2P Client disconnect from AP/P2P GO is:

peer_delete->vdev_down->vdev_stop

This sequence of disconnect is not opposite of connect. For STA or P2P
GO, bss peer is not needed by firmware during handling vdev stop
command. So with this sequence, STA and P2P GO can work normally.

But for P2P Client, firmware needs bss peer in some functions during
handling vdev stop command. The opposite sequence of disconnect should
be:

vdev_down->vdev_stop->peer_delete

So change the sequence of disconnect as above opposite sequence for
WCN7850.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Kang Yang <quic_kangyang@quicinc.com>
---

v6: no change.
v5: no change.
v4: no change.
v3: no change.
v2: add Tested-on tag of QCN9274.

---
 drivers/net/wireless/ath/ath12k/mac.c | 99 +++++++++++++++------------
 1 file changed, 54 insertions(+), 45 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 1377b710bdcb..6b8b92d22553 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -1083,6 +1083,46 @@ static int ath12k_mac_monitor_stop(struct ath12k *ar)
 	return ret;
 }
 
+static int ath12k_mac_vdev_stop(struct ath12k_vif *arvif)
+{
+	struct ath12k *ar = arvif->ar;
+	int ret;
+
+	lockdep_assert_held(&ar->conf_mutex);
+
+	reinit_completion(&ar->vdev_setup_done);
+
+	ret = ath12k_wmi_vdev_stop(ar, arvif->vdev_id);
+	if (ret) {
+		ath12k_warn(ar->ab, "failed to stop WMI vdev %i: %d\n",
+			    arvif->vdev_id, ret);
+		goto err;
+	}
+
+	ret = ath12k_mac_vdev_setup_sync(ar);
+	if (ret) {
+		ath12k_warn(ar->ab, "failed to synchronize setup for vdev %i: %d\n",
+			    arvif->vdev_id, ret);
+		goto err;
+	}
+
+	WARN_ON(ar->num_started_vdevs == 0);
+
+	ar->num_started_vdevs--;
+	ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "vdev %pM stopped, vdev_id %d\n",
+		   arvif->vif->addr, arvif->vdev_id);
+
+	if (test_bit(ATH12K_CAC_RUNNING, &ar->dev_flags)) {
+		clear_bit(ATH12K_CAC_RUNNING, &ar->dev_flags);
+		ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "CAC Stopped for vdev %d\n",
+			   arvif->vdev_id);
+	}
+
+	return 0;
+err:
+	return ret;
+}
+
 static int ath12k_mac_config(struct ath12k *ar, u32 changed)
 {
 	struct ieee80211_hw *hw = ath12k_ar_to_hw(ar);
@@ -3905,6 +3945,13 @@ static int ath12k_mac_op_sta_state(struct ieee80211_hw *hw,
 				    sta->addr, arvif->vdev_id);
 	} else if ((old_state == IEEE80211_STA_NONE &&
 		    new_state == IEEE80211_STA_NOTEXIST)) {
+		if (arvif->vdev_type == WMI_VDEV_TYPE_STA) {
+			ath12k_bss_disassoc(ar, arvif);
+			ret = ath12k_mac_vdev_stop(arvif);
+			if (ret)
+				ath12k_warn(ar->ab, "failed to stop vdev %i: %d\n",
+					    arvif->vdev_id, ret);
+		}
 		ath12k_dp_peer_cleanup(ar, arvif->vdev_id, sta->addr);
 
 		ret = ath12k_peer_delete(ar, arvif->vdev_id, sta->addr);
@@ -6336,46 +6383,6 @@ ath12k_mac_vdev_start_restart(struct ath12k_vif *arvif,
 	return 0;
 }
 
-static int ath12k_mac_vdev_stop(struct ath12k_vif *arvif)
-{
-	struct ath12k *ar = arvif->ar;
-	int ret;
-
-	lockdep_assert_held(&ar->conf_mutex);
-
-	reinit_completion(&ar->vdev_setup_done);
-
-	ret = ath12k_wmi_vdev_stop(ar, arvif->vdev_id);
-	if (ret) {
-		ath12k_warn(ar->ab, "failed to stop WMI vdev %i: %d\n",
-			    arvif->vdev_id, ret);
-		goto err;
-	}
-
-	ret = ath12k_mac_vdev_setup_sync(ar);
-	if (ret) {
-		ath12k_warn(ar->ab, "failed to synchronize setup for vdev %i: %d\n",
-			    arvif->vdev_id, ret);
-		goto err;
-	}
-
-	WARN_ON(ar->num_started_vdevs == 0);
-
-	ar->num_started_vdevs--;
-	ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "vdev %pM stopped, vdev_id %d\n",
-		   arvif->vif->addr, arvif->vdev_id);
-
-	if (test_bit(ATH12K_CAC_RUNNING, &ar->dev_flags)) {
-		clear_bit(ATH12K_CAC_RUNNING, &ar->dev_flags);
-		ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "CAC Stopped for vdev %d\n",
-			   arvif->vdev_id);
-	}
-
-	return 0;
-err:
-	return ret;
-}
-
 static int ath12k_mac_vdev_start(struct ath12k_vif *arvif,
 				 struct ieee80211_chanctx_conf *ctx)
 {
@@ -6742,11 +6749,13 @@ ath12k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw,
 		arvif->is_started = false;
 	}
 
-	ret = ath12k_mac_vdev_stop(arvif);
-	if (ret)
-		ath12k_warn(ab, "failed to stop vdev %i: %d\n",
-			    arvif->vdev_id, ret);
-
+	if (arvif->vdev_type != WMI_VDEV_TYPE_STA) {
+		ath12k_bss_disassoc(ar, arvif);
+		ret = ath12k_mac_vdev_stop(arvif);
+		if (ret)
+			ath12k_warn(ab, "failed to stop vdev %i: %d\n",
+				    arvif->vdev_id, ret);
+	}
 	arvif->is_started = false;
 
 	if (ab->hw_params->vdev_start_delay &&
-- 
2.34.1


  parent reply	other threads:[~2024-01-30  4:03 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-30  4:02 [PATCH v6 00/11] wifi: ath12k: P2P support for WCN7850 Kang Yang
2024-01-30  4:02 ` [PATCH v6 01/11] wifi: ath12k: fix broken structure wmi_vdev_create_cmd Kang Yang
2024-01-30 16:48   ` Jeff Johnson
2024-02-05 15:46   ` Kalle Valo
2024-02-07 15:07   ` Kalle Valo
2024-01-30  4:02 ` [PATCH v6 02/11] wifi: ath12k: fix incorrect logic of calculating vdev_stats_id Kang Yang
2024-01-30 16:51   ` Jeff Johnson
2024-02-05 15:33     ` Kalle Valo
2024-01-30  4:02 ` [PATCH v6 03/11] wifi: ath12k: change interface combination for P2P mode Kang Yang
2024-01-30 16:52   ` Jeff Johnson
2024-01-30  4:02 ` [PATCH v6 04/11] wifi: ath12k: add P2P IE in beacon template Kang Yang
2024-01-30 17:02   ` Jeff Johnson
2024-02-05 16:24     ` Kalle Valo
2024-02-05 16:17   ` Kalle Valo
2024-02-05 16:35     ` Jeff Johnson
2024-02-06  9:52       ` Kalle Valo
2024-01-30  4:02 ` [PATCH v6 05/11] wifi: ath12k: implement handling of P2P NoA event Kang Yang
2024-01-30 17:14   ` Jeff Johnson
2024-02-02 13:53   ` Kalle Valo
2024-02-02 16:25     ` Jeff Johnson
2024-02-06  2:21     ` Kang Yang
2024-02-06  9:56       ` Kalle Valo
2024-02-06 16:11   ` Kalle Valo
2024-02-06 18:17     ` Kalle Valo
2024-02-07 17:43       ` Jeff Johnson
2024-02-07  4:36     ` Kang Yang
2024-01-30  4:02 ` [PATCH v6 06/11] wifi: ath12k: implement remain on channel for P2P mode Kang Yang
2024-01-30 17:16   ` Jeff Johnson
2024-01-30  4:02 ` [PATCH v6 07/11] wifi: ath12k: change WLAN_SCAN_PARAMS_MAX_IE_LEN from 256 to 512 Kang Yang
2024-01-30 17:19   ` Jeff Johnson
2024-01-30  4:03 ` [PATCH v6 08/11] wifi: ath12k: allow specific mgmt frame tx while vdev is not up Kang Yang
2024-01-30 17:23   ` Jeff Johnson
2024-02-06 16:24   ` Kalle Valo
2024-02-07  4:44     ` Kang Yang
2024-03-07  9:46     ` Kang Yang
2024-01-30  4:03 ` Kang Yang [this message]
2024-01-30 17:24   ` [PATCH v6 09/11] wifi: ath12k: move peer delete after vdev stop of station for WCN7850 Jeff Johnson
2024-01-30  4:03 ` [PATCH v6 10/11] wifi: ath12k: designating channel frequency for ROC scan Kang Yang
2024-01-30 17:24   ` Jeff Johnson
2024-01-30  4:03 ` [PATCH v6 11/11] wifi: ath12k: advertise P2P dev support for WCN7850 Kang Yang
2024-01-30 17:25   ` Jeff Johnson
2024-02-05 15:40 ` [PATCH v6 00/11] wifi: ath12k: P2P " Kalle Valo
2024-02-07  6:50   ` Kang Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240130040303.370590-10-quic_kangyang@quicinc.com \
    --to=quic_kangyang@quicinc.com \
    --cc=ath12k@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.