Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp693377rwd; Wed, 7 Jun 2023 05:50:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5DEXzzdL9nkqVYaM3gRWH9BEbrU/oihmWfx2rK4ZIuxekHabIQNvmsTSnuZErn9s18j2Xl X-Received: by 2002:a05:6a00:1308:b0:64d:40e0:5580 with SMTP id j8-20020a056a00130800b0064d40e05580mr5553941pfu.3.1686142220334; Wed, 07 Jun 2023 05:50:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686142220; cv=none; d=google.com; s=arc-20160816; b=q6Tj8pUdqa/E/EJ/5lq38qmIqHHSw02Z3/yXwLUV24N1s2qk6czcDfKeAA7Fb3a6Vw u90TJB/eycuHPsvQERYrAfp5RvIGZ144mph2z9ULvG4Pl3fgf+ixtQy5EeVTfVIqTb/t YQsIMVi49iz8fVHbEoJPNfueCS6huvtYzkYcOq7QtKZnorK+RC6Y+bW+9c105sEOzkas tb2eQPV9E1vCyU3VBSKQve68VwxUM4PeN/tGXLiyYGwOkMnitFQaOHcbT8S2Mp2eo2ud IJKbVbYAck+TKafuFIXRvdTa0ERTMZup0pNYE/X7JV+A2PhMff9Bb0bY8LOgxpr33Dls 1t2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=H0ijGqhLhH5gW3vSAhIBrdHc9At3Gf0qWB7slmkZOzg=; b=g1hSvtd1nnjRrpIRQj1xlDpYWpWuYiqNAmTrkRZ416RQebTD7Ti9MzVUtjXoF7BxvJ LBzAfOx1bhtF55IcNmZj7I7I+xL8GHCsA8rhIsNWmwHQvd//sTOZKWO0uxORnljLxEmA QXTsZGR69eFJtvCcRs1Lf006yNMnMWFjPlYIdZhZWEadJugNIM7RoK0B0vCcQxJp6BEM q/J3Y9/PKA2etPR8jMIdn99AMOhzznI3ubVSxmW+z+hzZRwwkZO/zq6sieR9U/fIMQga mFo3ctFF6KIxy7nqmyLIU/Wkv4RXARdustg5/4J2ag6KzsGFMecrheAKbrlgWSaPRogi L16Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=BPCSrSp9; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h189-20020a636cc6000000b0053eefa04dc0si8771871pgc.276.2023.06.07.05.50.10; Wed, 07 Jun 2023 05:50:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=BPCSrSp9; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233859AbjFGMsQ (ORCPT + 61 others); Wed, 7 Jun 2023 08:48:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241075AbjFGMrk (ORCPT ); Wed, 7 Jun 2023 08:47:40 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 743EE2129 for ; Wed, 7 Jun 2023 05:47:19 -0700 (PDT) Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 357BfVik021976; Wed, 7 Jun 2023 12:47:11 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-type; s=qcppdkim1; bh=H0ijGqhLhH5gW3vSAhIBrdHc9At3Gf0qWB7slmkZOzg=; b=BPCSrSp9wWkW5dSJuMEOtIKaS+vBt9wp9YCnK/rug1LeMNaThtKlpZzacz4hLGF23PLx E+5LJ4NWFMzcgYtn4vwImVnvUV519VrN5xf/vHSDI52EW9nxEFm67x5WLHotp0ihc+NA QC42Xg5MEFPLfbv9dR4BoVqAx7lUcRXvW40Byruxurv8BAZMqyfRvS8d6DTnNxaecEUb qb13I6ZraIk/CM3TMwybdoGvcncKdr0i7/XMvheLzqjo4LLLnGk/n3OymmDZpOgjc+ef IaORi1owcLK6FbpPNvsUUGdnt3b4UDMDb/ZHep9AC4YNOMhKXwWhRA4wXlNm6r6+T5Gz mw== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3r2rbtg7b8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 07 Jun 2023 12:47:10 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 357Cl9hE011504 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 7 Jun 2023 12:47:09 GMT Received: from adisi-linux.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 7 Jun 2023 05:47:07 -0700 From: Aditya Kumar Singh To: CC: , , "Aditya Kumar Singh" Subject: [PATCH 3/3] wifi: ath11k: fix Tx power value during active CAC Date: Wed, 7 Jun 2023 18:16:47 +0530 Message-ID: <20230607124647.27682-4-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230607124647.27682-1-quic_adisi@quicinc.com> References: <20230607124647.27682-1-quic_adisi@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: LNR44IuoPjRitceWiXkf9jFLKuFCFH2t X-Proofpoint-ORIG-GUID: LNR44IuoPjRitceWiXkf9jFLKuFCFH2t X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-07_06,2023-06-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 phishscore=0 impostorscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306070107 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Tx power is fetched from firmware's pdev stats. However, during active CAC, firmware does not fill the current Tx power and sends the max initialised value filled during firmware init. If host sends this power to user space, this is wrong since in certain situations, the Tx power could be greater than the max allowed by the regulatory. Hence, host should not be fetching the Tx power during an active CAC. Fix this issue by returning Tx power as 0 during active CAC since it is known that during CAC, there will be no transmission happening. Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 Fixes: 9a2aa68afe3d ("wifi: ath11k: add get_txpower mac ops") Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath11k/mac.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 31982545266b..9707910928b4 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -9045,6 +9045,14 @@ static int ath11k_mac_op_get_txpower(struct ieee80211_hw *hw, if (ar->state != ATH11K_STATE_ON) goto err_fallback; + /* Firmware doesn't provide Tx power during CAC hence no need to fetch + * the stats. + */ + if (test_bit(ATH11K_CAC_RUNNING, &ar->dev_flags)) { + mutex_unlock(&ar->conf_mutex); + return -EAGAIN; + } + req_param.pdev_id = ar->pdev->pdev_id; req_param.stats_id = WMI_REQUEST_PDEV_STAT; -- 2.17.1