Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp958994lqd; Thu, 25 Apr 2024 01:40:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXBK6YKZeoim2A0JvYvpR9u1AV4WtXlAV70qQ1uM5gCLAohMB5sx5VRnIsRHQyx1RM4K4YR426xgOOnoJIUoRJ5L12iHZ+4MACHfTRx7w== X-Google-Smtp-Source: AGHT+IGoZuYQarVebrjI2PRv78YdgG+znUO3upjwEPWLK/kMhSlFQLiIuQaOlF0/LCteo53Jl63B X-Received: by 2002:a05:620a:3728:b0:78f:15b0:bfe3 with SMTP id de40-20020a05620a372800b0078f15b0bfe3mr6953182qkb.44.1714034410949; Thu, 25 Apr 2024 01:40:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714034410; cv=pass; d=google.com; s=arc-20160816; b=Pdgvh43ekLAVyTJhdQuhezyuQns0TlJZRswLtrC9ebUqPmgrAHTwyDhqCmEtrj9c1U tX5b7UhO1uC2SfBdENdG0DR3be+amv0KHo7tR9OsL3CKt0ONJOqWowlhGRh7/lySeY9H 5Z5JNiP/fzME/a+eV9cWD9Hc+4G9bz3vUYZaJDW3A7iOhZODoN9JphVBINk3r+fmgs1D PAC30Ekh26KYrhDCaIKxm3E2yO3k8ra+xY2ePlN77aPLSlW7ut9T7wYI9VFdvAlb/LcN kLw+51SXTBIvdH0oT2W6+yQ/3axpQXft65GIR4ZrzFszlKarzeXikKxuWYQGe0Su62f6 Y1sQ== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=hHIIahfKFhzjcat/h30ruUc9MTCPLWnaQZOICHYEG1U=; fh=FeRHs2WX8VAc5wtea+afpOiGBDI/QNqygA2b1gY4TiI=; b=I2lOSdBoIGkiOsxVHLvpB1/pFxlbS2vKT67DgzTCz3ahDywNHSfjujlS7uJdvfPRD5 IT5qCRMv+01cKFZApy9aOg4XGEsodT3JGpqDW932vYnHE0zdJIY3nWYqRST8fribOQuD KDnTgFLMb0GWcL7bJENDRWPwR8rQTQfuSk4OpAGWpkkMBH46Wo5dGR8ZNd9bu/GowGcZ h6BJnLJoYG/htN9/+Ij0X0iq7lWo5vE1z7qcvOBy7JA1vQ5B1i9Oh6mb7AxO/zbXtNg/ R4sdoYPyDuEw719oUdvFNHi9imnblS+LeARdFWdItibM9xqMwBfvDshDHNLs60u+lyJD Ypsw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=MdEiqFbS; 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-6821-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6821-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g3-20020ae9e103000000b0078eb967b9d3si16487589qkm.369.2024.04.25.01.40.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 01:40:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6821-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=MdEiqFbS; 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-6821-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6821-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9CE531C22A84 for ; Thu, 25 Apr 2024 08:40:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E8F727489; Thu, 25 Apr 2024 08:40:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="MdEiqFbS" 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 EF5ED7C085 for ; Thu, 25 Apr 2024 08:40:07 +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=1714034409; cv=none; b=RHLPrwZk94j2bwZ4EL838gIVmwpqd/48TSV6pPOmTqkb1or+RIsyHfB5vxwwEGK2sxo5+jGiWKbd29FOMtHmvpbRIv9Wfp+EYXYsGRalsHwZcaoI4iDZhbKxX3QdENpR2kaMEdAVBjZrDJth9fwebokr50te9Fm/0wgaaL5THPA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714034409; c=relaxed/simple; bh=rcITST1ndqvQWjE4b6AksspjYHYEaCFfUNnPpb7lvNs=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=qbhwYUzeESunl1h6Yz9tq4mx9zubYFYSFQE47INWRtydcMImfTOVIK+pP66Gsy61nKU3tUpoAwZL+dkY9gkPgzcDLN9rqfktlub5uC+3wHui1Kc/oYVGjrfjTR2w2eoSKwAwFxkw2OM9PIY+QsH6wt2oaj6yL3UGoWVPU7VF6BA= 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=MdEiqFbS; 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 (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43P6aFET004208; Thu, 25 Apr 2024 08:40:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=qcppdkim1; bh=hHIIahfKFhzjcat/h30r uUc9MTCPLWnaQZOICHYEG1U=; b=MdEiqFbSoIdv/fwy4aXOl6Kzt1TRWtLXJbop zH5L3NdT3I46hBhgUVvp33aPZd0Gz2ewwEEO6mLfAoxvHQQEG9MhFTfg5JwaHC9c lKPHyCfKnvL6bsJffHkQIfjaxDZZfDsi6yutXN4CCMIdWQ+7iCH2d5/Wv3TTzlNc vPWPhntS8NyxcnWM00JddbGDoWSiexv2hP2tRyxTWno2xfheA1au3u8tTaZG9Cbi Mk9iWdXtjt3wSbN2G/4ppv4O5PWH2iFY7pfbWDc6IgAPbhgLThc4G2DtyiS/9oG0 eWhER5VTsfWZBRAu/uIxOxdahQGJpPWdXIT/1eFbPnzJrg25Jw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xqenghbef-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 08:40:01 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 43P8e09X013158 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 08:40:00 GMT Received: from lingbok-Birman-PHX.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.1544.9; Thu, 25 Apr 2024 01:39:59 -0700 From: Lingbo Kong To: CC: , Subject: [PATCH] wifi: ath12k: fix the problem that down grade phy mode operation Date: Thu, 25 Apr 2024 16:38:37 +0800 Message-ID: <20240425083837.5340-1-quic_lingbok@quicinc.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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: _XR6Iosifn4s3VJGoGkx30r_259KMPeR X-Proofpoint-ORIG-GUID: _XR6Iosifn4s3VJGoGkx30r_259KMPeR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-04-25_07,2024-04-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 mlxlogscore=999 priorityscore=1501 phishscore=0 adultscore=0 malwarescore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404250061 Currently, when using WCN7850 or QCN9274 as AP, ath12k always performs down grade phy mode operation regardless of whether the firmware supports EHT capability or not and then vdev will start in HE mode. When stations that support EHT capability try to connect to the AP, the AP will set phy mode to EHT after receiving the association request packet, and then send WMI_PEER_ASSOC_CMDID command to firmware, AP’s firmware will crash. This is because when the ath12k_mac_copy_sband_iftype_data() function handles EHT capability, it does not copy the EHT capability into the iftype[band][type] array according to the interface type. So, interface type should not be used as an index to get eht_cap in ath12k_mac_check_down_grade_phy_mode() function. To address this issue, use types_mask to select the eht_cap in ath12k_mac_check_down_grade_phy_mode() function. This patch affects QCN9274 and WCN7850 because they have the same issue. Hostapd log: wlo1: STA 02:03:7f:37:12:34 IEEE 802.11: Could not set STA to kernel driver Kernel log: [270894.816076] ath12k_pci 0000:03:00.0: failed to send WMI_PEER_SET_PARAM cmd [270894.816111] ath12k_pci 0000:03:00.0: failed to setup peer SMPS for vdev 0: -108 [270894.816122] ath12k_pci 0000:03:00.0: Failed to associate station: 02:03:7f:37:12:34 [270894.843389] ieee80211 phy5: Hardware restart was requested [270894.843517] ath12k_pci 0000:03:00.0: failed to lookup peer 02:03:7f:37:12:34 on vdev 0 [270894.843616] ath12k_pci 0000:03:00.0: failed to send WMI_PEER_DELETE cmd [270894.843650] ath12k_pci 0000:03:00.0: failed to delete peer vdev_id 0 addr 02:03:7f:37:12:34 ret -108 [270894.843663] ath12k_pci 0000:03:00.0: Failed to delete peer: 02:03:7f:37:12:34 for VDEV: 0 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: Lingbo Kong --- drivers/net/wireless/ath/ath12k/mac.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 56b1f8b6844e..805cb084484a 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -6754,14 +6754,24 @@ ath12k_mac_check_down_grade_phy_mode(struct ath12k *ar, enum nl80211_band band, enum nl80211_iftype type) { - struct ieee80211_sta_eht_cap *eht_cap; + struct ieee80211_sta_eht_cap *eht_cap = NULL; enum wmi_phy_mode down_mode; + int n = ar->mac.sbands[band].n_iftype_data; + int i; + struct ieee80211_sband_iftype_data *data; if (mode < MODE_11BE_EHT20) return mode; - eht_cap = &ar->mac.iftype[band][type].eht_cap; - if (eht_cap->has_eht) + data = ar->mac.iftype[band]; + for (i = 0; i < n; i++) { + if (data[i].types_mask & BIT(type)) { + eht_cap = &data[i].eht_cap; + break; + } + } + + if (eht_cap && eht_cap->has_eht) return mode; switch (mode) { base-commit: 326f8f68f28b0b831233acfabffb486a5b0f4717 -- 2.34.1