Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp957156rdf; Wed, 22 Nov 2023 01:18:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhnrS7lvBH960sl6Xh8wN6OGPOCDSgrUnSHQVR128vKty5y7BbTyMtA/lRpwjxehKeQw2F X-Received: by 2002:a05:6e02:2413:b0:35a:f49e:eb65 with SMTP id bs19-20020a056e02241300b0035af49eeb65mr2121852ilb.32.1700644709957; Wed, 22 Nov 2023 01:18:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700644709; cv=none; d=google.com; s=arc-20160816; b=OBNoLXWYLYSB2LslxpX9sVoMj+MFYLAFoyoOW2Eo0Ukb/DaEGvPGpJ2Y775z7NPMbF FoVpRmS7jCKqRr3Myc+trkUaS9D03ugY4KhMyxJd66g1gxLLFiORtIsQ/85F+lRaFqT3 bFxSwTxJukfNqea0/Oaox7pv+e4eUW+TNRhaLp8c6D/xKHlOm278hIwqODA9ovMjwJH8 FuXSXAkMVXrOlaBt+QfguN5DlJkSgovOizpnebODwd6Fqq7UMvLD0ON4kdZZiZfMJFFO L8YohCssU+mhYhrgH9rGCDeyq/iUrJUS99ZFUeRzwqQCO7sU3OmAmQGVZ85saBXMnaNN lTSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dyw3E3ZFpDZGkHkr15hkuTJIJdSP0xyeJiGaADDOqaQ=; fh=HNEfiow5aIDtnUkYYiB/tbonwaEcG8+i6SMa583BOko=; b=GK59f/4Yf8YKARgYE/FjhmbsBFytSsVVJJ8LlKmU1uyjX0NzD2LRCWFAtEecptol6f MsBI5+usknmS+ZtYjort2Ka5XkcPrSRkf41mfLP3diOaBWY4/2dVA/36YBQbJ1zok2Vs I+Lyzqka4335zexHmHSeBRT+1Ge7tgdFsDg6Mf8Z6SQkjKsOsyS7lNiIGoqeBTwY7TuL PJHa4ZRuYqHahIDLZNevAW9TeVIZvf3K+9jss6Qp/ig4YMopd+Js+SwnsjwgfA2zoC7y GTsxV/YH02y+4L5h3/0KfUYrdtv8ZOmTZR9Ve6zPPlElbYfUp1Ooa97wDJPqk8MWHP/P PBog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Y2V45ebV; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id s1-20020a056a0008c100b006be0f482c0fsi13226767pfu.63.2023.11.22.01.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 01:18:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Y2V45ebV; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 4BC5880EE71B; Wed, 22 Nov 2023 01:18:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235165AbjKVJSO (ORCPT + 54 others); Wed, 22 Nov 2023 04:18:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235206AbjKVJRy (ORCPT ); Wed, 22 Nov 2023 04:17:54 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DB0710F7 for ; Wed, 22 Nov 2023 01:16:30 -0800 (PST) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AM5oXn6027375; Wed, 22 Nov 2023 09:16:27 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=dyw3E3ZFpDZGkHkr15hkuTJIJdSP0xyeJiGaADDOqaQ=; b=Y2V45ebVIPVmV98m0adfslNgh1PbU+m3aOLf7GAxHBkn8tnrca36c6C8qQx0Cf1guYip qNlY2/iLNzh/m8TY1F/KTXhP6/vmIcShmMfPPPHPJdW/Ozw541mOUx2OaNGqyGt2eYLV EDgK4eqt0YHPyPxpcJ6HdiiQ97WmRPOzhfw2RDXXtIZfhr7BhzSIFNmReCdk42v6NKwf TNSCvBXSsewSETyJZN/BT3J1v/Us/d07+MnDV6HoTDrRXUVpTkdfRFqRz8mJDViiLQki JexsqDTl8va/0NgMh0gRVSvgmX8YnRnX7kiCBocz349e1l6NmbjTWKWd2WTpOIHL/LGx Vg== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ugxn8jdtd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Nov 2023 09:16:27 +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 3AM9GQiu016765 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Nov 2023 09:16:26 GMT Received: from bqiang-Celadon-RN.lan (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.1118.40; Wed, 22 Nov 2023 01:16:25 -0800 From: Baochen Qiang To: CC: Subject: [PATCH v7 12/12] wifi: ath11k: discard BSS_CHANGED_TXPOWER when EXT_TPC_REG_SUPPORT for 6 GHz Date: Wed, 22 Nov 2023 17:15:53 +0800 Message-ID: <20231122091553.10837-13-quic_bqiang@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231122091553.10837-1-quic_bqiang@quicinc.com> References: <20231122091553.10837-1-quic_bqiang@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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-ORIG-GUID: kMcaxfBDthXbAkU7k7bPGys0695KvEgm X-Proofpoint-GUID: kMcaxfBDthXbAkU7k7bPGys0695KvEgm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-22_06,2023-11-21_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 impostorscore=0 adultscore=0 mlxlogscore=999 clxscore=1015 spamscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311220064 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 22 Nov 2023 01:18:27 -0800 (PST) From: Wen Gong When station is connected to a 6 GHz AP, it has 2 ways to configure the power limit to firmware. The first way is to send 2 WMI commands WMI_PDEV_PARAM_TXPOWER_LIMIT2G/WMI_PDEV_PARAM_TXPOWER_LIMIT5G to firmware, the second way is to send WMI_VDEV_SET_TPC_POWER_CMDID to firmware which include more parameters for power control. When firmware support SERVICE_EXT_TPC_REG, it means firmware support the second way for WMI_VDEV_SET_TPC_POWER_CMDID, then ath11k discard BSS_CHANGED_TXPOWER flag from mac80211 which is used to the first way for 6 GHz band and select the second way. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23 Signed-off-by: Wen Gong Signed-off-by: Baochen Qiang --- v7: 1. squash original patch 11 and patch 13. 2. s/wmi command/WMI commands/ 3. s/way/ways/ 4. add TODO tag for CSA. drivers/net/wireless/ath/ath11k/mac.c | 33 +++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 2520f78c9c0b..254cb0427d12 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -3397,6 +3397,18 @@ static int ath11k_mac_config_obss_pd(struct ath11k *ar, return 0; } +static bool ath11k_mac_supports_station_tpc(struct ath11k *ar, + struct ath11k_vif *arvif, + const struct cfg80211_chan_def *chandef) +{ + return ath11k_wmi_supports_6ghz_cc_ext(ar) && + test_bit(WMI_TLV_SERVICE_EXT_TPC_REG_SUPPORT, ar->ab->wmi_ab.svc_map) && + arvif->vdev_type == WMI_VDEV_TYPE_STA && + arvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE && + chandef->chan && + chandef->chan->band == NL80211_BAND_6GHZ; +} + static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *info, @@ -3596,9 +3608,13 @@ static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw, if (changed & BSS_CHANGED_TXPOWER) { ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev_id %i txpower %d\n", arvif->vdev_id, info->txpower); - - arvif->txpower = info->txpower; - ath11k_mac_txpower_recalc(ar); + if (ath11k_mac_supports_station_tpc(ar, arvif, &info->chandef)) { + ath11k_dbg(ar->ab, ATH11K_DBG_MAC, + "discard tx power, change to set TPC power\n"); + } else { + arvif->txpower = info->txpower; + ath11k_mac_txpower_recalc(ar); + } } if (changed & BSS_CHANGED_PS && @@ -7279,6 +7295,15 @@ ath11k_mac_vdev_start_restart(struct ath11k_vif *arvif, return ret; } + /* TODO: For now we only set TPC power here. However when + * channel changes, say CSA, it should be updated again. + */ + if (ath11k_mac_supports_station_tpc(ar, arvif, chandef)) { + ath11k_mac_fill_reg_tpc_info(ar, arvif->vif, &arvif->chanctx); + ath11k_wmi_send_vdev_set_tpc_power(ar, arvif->vdev_id, + &arvif->reg_tpc_info); + } + if (!restart) ar->num_started_vdevs++; @@ -8093,7 +8118,7 @@ ath11k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw, goto out; } ath11k_reg_handle_chan_list(ab, reg_info, power_type); - + arvif->chanctx = *ctx; ath11k_mac_parse_tx_pwr_env(ar, vif, ctx); } -- 2.25.1