Received: by 2002:a05:7412:b112:b0:f9:3106:f1c0 with SMTP id az18csp128316rdb; Mon, 18 Dec 2023 00:59:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+ttnoaP9kLW2utGXNxwWUqY4rRr7VOg8dNqJQ+EQiTwqyfSRbNu6pzB3FO6c2+lAbBUoW X-Received: by 2002:a17:907:6d1d:b0:a1c:7ded:a3e4 with SMTP id sa29-20020a1709076d1d00b00a1c7deda3e4mr5120093ejc.205.1702889999361; Mon, 18 Dec 2023 00:59:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702889999; cv=none; d=google.com; s=arc-20160816; b=BNl6WoeaQAywM3OJP8rV3GCZvM3hF52CqihFf+1MiLvtfsNed/Hn17mCoXMqLx2OAN IM0MjC+iy058iK7HPA/0DLjJLknehT5bShY7RnhThwClZN5SYYiMG7Xn3N1Wc56yWXdF r2lu/PhoaERG+czfv3hm1aUSmMWW0tMo7JQ+2i6c3yr1soWKMDWjZYRM0VjUS3XUV4Rl AYCQndxIwqHSNg1J/N/mo4D8IxCviDKMcvk+9aCP0eU0ZBXfJm6BCGUKEmc+YcmS2Yzf QAWROwMlSon1gCncq/ze53t5jc8IONMGxyAZn+h5demagpM3n4hioIRLZfpLdiG0JhLE zlvg== ARC-Message-Signature: i=1; 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=o+Yep8X1j0SEhhVYMflfGOuCkYqfud6ay9fk4BfZDyg=; fh=HNEfiow5aIDtnUkYYiB/tbonwaEcG8+i6SMa583BOko=; b=IsZRdqu3W7tsCnhNUTAsSYXAovoZiSuFU/GUwGExUU0DZZA6AaNPCxRb79QdLqjNC/ cPo6tIjRMGy085aE59nrMLLL1Y4B6Xxmvh4SC6KV7EybuLlF4DD2jE9J0BdlUuwpvpBP e80NO6/JCxi8fRViXh5VEwoKXbyOVPgIWUkdvVjKz5j45Lr2N4NXCMFrvNp2NrjNcwh/ vQ8BjRl333yh/7O0/QAdMXljksjXkKuLBFlmO1V/anC2fMGkXuHP0VAK9/YoxRu2qJU9 zF84T0nTQVEKSTbP+RygHE3ntCDQgh16gXtOiU8IXwvQh2FKa6o+HMEqegHUKxYaj0q8 lvMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=n6DQlsWK; spf=pass (google.com: domain of linux-wireless+bounces-905-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-905-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a10-20020a1709064a4a00b00a23537017acsi886264ejv.703.2023.12.18.00.59.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 00:59:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-905-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=n6DQlsWK; spf=pass (google.com: domain of linux-wireless+bounces-905-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-905-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 204441F22F88 for ; Mon, 18 Dec 2023 08:59:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6434612B7B; Mon, 18 Dec 2023 08:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="n6DQlsWK" 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 014AA125DD for ; Mon, 18 Dec 2023 08:59:15 +0000 (UTC) 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 (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BI702qw031757; Mon, 18 Dec 2023 08:59:12 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=o+Yep8X1j0SEhhVYMflfGOuCkYqfud6ay9fk4BfZDyg=; b=n6 DQlsWKbAk6KIKdG89MsUz7Ki8sakvAQjGUi4yA8S7scTdLHvVZIhyhZIImqfTVe6 gN+wf/AEltolmXA66pSKvnISfXrFTFegitQ39CYdLrh+JOV760cWRGVRQEZXgWTK zdgh6QxOBoP/kzqg1fbCwvokwjevViuKGDSMcAmiXLramoYLlTxm3FpwvWvna+De cffZZP0NWIsvudE3WuQwEpcQisftT204SZ2oLEyDMqnEBHWIIsMxPGgqCtulEfL8 +ShrYdFB6u0QB68j/h9frX+YztXViEISV/KeHIifg6K5SIqn+S+9ZhGspSpGDEu/ HckSaRls9OC+RR4A2MiQ== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3v1536utfn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Dec 2023 08:59:12 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BI8xB5R022845 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Dec 2023 08:59:11 GMT Received: from bqiang-Celadon-RN.qca.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.1118.40; Mon, 18 Dec 2023 00:59:10 -0800 From: Baochen Qiang To: CC: Subject: [PATCH v10 12/12] wifi: ath11k: use WMI_VDEV_SET_TPC_POWER_CMDID when EXT_TPC_REG_SUPPORT for 6 GHz Date: Mon, 18 Dec 2023 16:58:44 +0800 Message-ID: <20231218085844.2658-13-quic_bqiang@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231218085844.2658-1-quic_bqiang@quicinc.com> References: <20231218085844.2658-1-quic_bqiang@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: 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-GUID: 9h_QyCHFq6Qu_KoH7SOSJdJQOyCb5NTx X-Proofpoint-ORIG-GUID: 9h_QyCHFq6Qu_KoH7SOSJdJQOyCb5NTx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_01,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 spamscore=0 impostorscore=0 phishscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312180063 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 supports SERVICE_EXT_TPC_REG, it means firmware supports WMI_VDEV_SET_TPC_POWER_CMDID, then ath11k selects 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 --- v10: no change. v9: 1. do not discard txpower setting for BSS_CHANGED_TXPOWER. 2. rename subject and update commit log. v8: no change. 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 | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 9048dec5cda5..843d92dfcaf9 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,7 +3608,6 @@ 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); } @@ -7285,6 +7296,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++; @@ -8107,7 +8127,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