Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp785805rdb; Mon, 29 Jan 2024 20:04:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IFODBapmYd/2EkXjwnhCP0DRhLwafsk5j/mc+cjvsvyblfd6VdlVgVBCJnIMxjKlqHWMbrV X-Received: by 2002:a9d:69d3:0:b0:6e1:7b4:832c with SMTP id v19-20020a9d69d3000000b006e107b4832cmr7378605oto.8.1706587462801; Mon, 29 Jan 2024 20:04:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706587462; cv=pass; d=google.com; s=arc-20160816; b=VYa8R2vlfLhbnDgEug+lJnhJ6ewuOCakqW15iSLtp9xEZ05fmuym49z5V90JJyikN8 KDnx4nwWZnt3v8HGN0LjRNo4/9xMpIW6QZCsP94fE8M9qH2VD4d5zxX3SOzwTvDhpOA2 gw0nVBf7CurgNF+Ip8iqpYPXUR2yWsYKmY0A02fLMcx4/jg+xsAdDAoq8JAwcf9Z9qiu 4aUJLQWkNVONNjOCWJpOvBlzvUeGy743tBmxNq2It23SM4K++iPQqXliIeLL1TQ1l4wH ALi7Axbyt5DwgafRJc7ot5jBzFz5KmMgoCPxsTWAJonWjrOAN82Pi51HqifrIcpCX2CI 0irw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Fn6Kl9oN+UVJQyDwTXWb8C+1OKShTrJqFfwiR3nrs2A=; fh=tw92pu/QJZoAApELClxbVgntRJlAnp7hd1eZuM7KOXw=; b=D3MRaNdiu6uX+UbbhvptO74Rh71HoIoklqsZBkiCzO+Y9A4p8k5CQRax7zenWcoaeJ THGPnc57IOA5rCXhCbXaETDgj7x0+51p067xs/jaGQp168eH06kv43z3gpdgEIs6CKNJ vFsch3/qIAPUSqoJ4K4df4EtRltbjbSDpUPyc2GzAPl06rC7XFhWMmgRW3HyKujYtZWv Viu1qt4Mb6He6WNNHi0jQLB7ul+j+IaS8wb0QiL80uiD+4qJ90cGBFLqamlUCuiv1Jkh SWdHqrw3SYe9QP3qD1dxO/rFxhD7Jw1wRhqgw6O3EbX1Eg9d+NPqg1u6LyMgSU8DoPO8 eP2A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FG1RfM8F; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-2765-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2765-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=1; AJvYcCU66n0fGAg3pPCQ7WitxuBSWx035+VSgslKkSJn0pGeiISaa8KetolVfwEaaNM2Pv5NQzD9iE8RtwlFjTGQ/fEugNSte7CBSfQ8xGhQrA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e8-20020a631e08000000b005d8e22d633bsi621136pge.70.2024.01.29.20.04.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 20:04:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-2765-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FG1RfM8F; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-2765-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2765-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6D325288A57 for ; Tue, 30 Jan 2024 04:04:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 478E8381A1; Tue, 30 Jan 2024 04:03:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="FG1RfM8F" X-Original-To: linux-wireless@vger.kernel.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A03AF3771E for ; Tue, 30 Jan 2024 04:03:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706587425; cv=none; b=vFxNUJ0P9kI37SP/iWA0o6huFMHOzHa7OggedaANX9b2kp9e9uYFSNTn1q6mCbJIcu+VApdC9SH8glokYwIEkUeddAlNe4d+FIe6A73RzZyurPCpcEWjLpRDTUPGHELRJm1/lpTBgx7xXAh4N9aOidvHNQ6SLUQT0CK1MXKHJNI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706587425; c=relaxed/simple; bh=zkFY+A9INDpRrE9ZFhSR1fYzVqWuPuq1ipHSjrUTV/0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ht2SYDVXoZ1SQLmUarVW6RCVLGt/uRlb1buaqHluVpMkAfI4EJLHcCI7Ejs4Dg/pz6GJXop3mh6mS/6xJTO+2EU8yF2K4sd2C2Bf5JbhAn7gmjN4rMX6/h9dEkqYLVDqeRzlJTirMg5r6UnZIMxA0C5QTnwulrgmG1seCtHJeZ4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=FG1RfM8F; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40U3bC7x003749; Tue, 30 Jan 2024 04:03:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=Fn6Kl9oN+UVJQyDwTXWb8C+1OKShTrJqFfwiR3nrs2A=; b=FG 1RfM8FO6Rhd/s2OrrcYTTkfcuXzDR3gLxDoHmq617xHOXiL7dhjAkVCRqnzjrvZK wkJNggEktD8iOCYSo9PNNEsvtWQ53Rsz6OEXlEB2KuPqYT1AsbeijwZ4qalPczGH LzNhWbfG7VdqRIJV6kJiljk+FpaQRoaFJTWuH9m/0TvYMaYShXXGy5pR5hbGR+m6 Hol0Dlg/I+Jq0+1gr6r53UQQ0G7TJESZ6ztEjwam2hhrTjjvt0KjcjNnL96A5UKG ReHRK/S4/jxpsRhlgptoZAZaEnTpyUuI2++j7jMqdC8PL8YXM7LhWd2kG+VbJmWn gnAQc4bWLzRCthbxSriA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vxsc201tu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 Jan 2024 04:03:40 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40U43d4q027070 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 Jan 2024 04:03:39 GMT Received: from yk-E5440.qca.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 29 Jan 2024 20:03:37 -0800 From: Kang Yang To: CC: , 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 Message-ID: <20240130040303.370590-10-quic_kangyang@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240130040303.370590-1-quic_kangyang@quicinc.com> References: <20240130040303.370590-1-quic_kangyang@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 2g7sSxOUjrMZX1ETUWdIQjdxJR3_nMBL X-Proofpoint-ORIG-GUID: 2g7sSxOUjrMZX1ETUWdIQjdxJR3_nMBL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-29_15,2024-01-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 spamscore=0 mlxscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401190000 definitions=main-2401300026 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 --- 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