Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2556631rdb; Mon, 4 Dec 2023 00:14:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IFx5i84DAaIpbfKwbVoBnBqGvC7naDsmM5GMHqXyIX9/DhCsup7VbB8g3cvgmHnhps53BsC X-Received: by 2002:a17:90a:4a8e:b0:286:c398:841b with SMTP id f14-20020a17090a4a8e00b00286c398841bmr180037pjh.58.1701677680614; Mon, 04 Dec 2023 00:14:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701677680; cv=none; d=google.com; s=arc-20160816; b=JsGYFrtcnG2ItRlMPrlmVc3pB7mCFqt4nCZxAFSq9RjIj+I7K3uDDjDgbhDQOQKCaq MRYXwVlX5SVMcCkd5Z/R1sYdrPkgvxClfZH5eo6YKdSkjx+qJ9WRCOz1dJYMqnX2tQ5P zd1cEeJw/IBJl1o5LBAlTkbFGJLrj49uU9TejPVeIht8y3RhWJLYj32dQS4lT2/S5V4D 6GwsDNKH5fzygH/KodqYn4cSK9Rih7eVzJ1f1b7Cm4hqawCE00nQlpyiaSAz4NwKS5LJ c/tGJb7vFr9UFiRDjXAPezg3c4VKNH64TyCgGhoO4ZslSmqX7cyHX5iJaPFoZClBuUVU Cbjw== 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=xro87ZzoWEwkL7fzoxplIk829T8c9X6jA2hV1SIVUqs=; fh=HNEfiow5aIDtnUkYYiB/tbonwaEcG8+i6SMa583BOko=; b=SMWJMWM/g5n8Kuyhb+E41VDnPiMKlajL/8iIK53jzgAhjg8O3uyaEj37o4pvMpJP2l 0iC8Op/bbpjQw8l5jMcEoqni7c4pa0TDeA/P+1VU6ajg76+Jmc1/Bij6/rpxgSUQGl+d zhFdbbeCfwuzbuR7jFZuuuXYxjKmlLqCFXyScFwvoajP7tW02ItSCUDHheXEl43lMHX5 BOV3wodZAeBIfAskn9Q9L+01AMo5ZzQYYYwI+wjGQ1gecwfEDdTfKdV5ETX8rYCUFoC+ quj5NNdD4yR0r3BflzIyD8k2m1EJhLpcnYI/IM5mIcCouPsaPnFXbSqm3XqZnXoNdYOO 0cSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GUSmljcW; spf=pass (google.com: domain of linux-wireless+bounces-369-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-369-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id jk17-20020a170903331100b001d055315494si5173179plb.540.2023.12.04.00.14.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 00:14:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-369-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=GUSmljcW; spf=pass (google.com: domain of linux-wireless+bounces-369-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-369-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 7FF6E280FC2 for ; Mon, 4 Dec 2023 08:14:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6932F171B8; Mon, 4 Dec 2023 08:13:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="GUSmljcW" X-Original-To: linux-wireless@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EC53F0 for ; Mon, 4 Dec 2023 00:13:55 -0800 (PST) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B46K22u013187; Mon, 4 Dec 2023 08:13:53 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=xro87ZzoWEwkL7fzoxplIk829T8c9X6jA2hV1SIVUqs=; b=GUSmljcWjFjtwJ8Vr0LSgYDiAF7lM0+4NRbVKcatpe5nCO3b25pVBFMHMUNYPO3fByhB /dgB0/drn1W1+yIQWnK9X6Dq7mwXNfRPfX7BaYGASKx97ofz2GA7zMNCYGaLI58dfQ82 WuAGyCeH+v/LgNidpRMDRBYjnwJYjYB42A6s2WInWDCTMTMt96cf9Q5+lGwou1RPQ3O9 O/HNU88ihe7PUT0s18kmPUIbLnZARz95aFWwv48Jps1FX2mLFgbCgKtqWfQdXIxkPkgA 6L+ag0rfwP9Oy/X/2BxCdTpoFvH2dfTpSy+vjmdrCBbE7iO3HPtSH5fU3BLPZ7XbXjRk fw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3us81ygdp3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 04 Dec 2023 08:13:52 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3B48DpqB021139 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 4 Dec 2023 08:13:51 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, 4 Dec 2023 00:13:50 -0800 From: Baochen Qiang To: CC: Subject: [PATCH v8 12/12] wifi: ath11k: discard BSS_CHANGED_TXPOWER when EXT_TPC_REG_SUPPORT for 6 GHz Date: Mon, 4 Dec 2023 16:13:23 +0800 Message-ID: <20231204081323.5582-13-quic_bqiang@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231204081323.5582-1-quic_bqiang@quicinc.com> References: <20231204081323.5582-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-ORIG-GUID: ZcxkrKHsL_9_LAAD4VHV709xVbnzGZ19 X-Proofpoint-GUID: ZcxkrKHsL_9_LAAD4VHV709xVbnzGZ19 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-04_06,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 adultscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 suspectscore=0 malwarescore=0 clxscore=1015 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312040061 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 --- 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 | 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