Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1343475pxb; Tue, 26 Oct 2021 07:22:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJww4BS+CtdQCqIVJrI//3qY+npi0AQ5gDBKClBJbE8LMPzvAqu3EkZqXhLBn0fav3+rWqFV X-Received: by 2002:aa7:99c3:0:b0:47b:e21d:7315 with SMTP id v3-20020aa799c3000000b0047be21d7315mr18464590pfi.35.1635258135890; Tue, 26 Oct 2021 07:22:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635258135; cv=none; d=google.com; s=arc-20160816; b=GLE7Mr3owB7KC2Rif13juYNfmqYRi3XAsDRu8VoHoB2A10Nk0QgdAAMCQdyY49Slnk vk+DgViXCihtIeGMhxl7Cugw7KcZ/sKfn95jK1q42CLRDkwc9KzAJWH2wZrpd9Qn3hU1 YmE36+bzNySBYan/xSnM3pn9A92psD4ci8BfPhTh6gZAZKuOwIVAHRqJCR9xg1ZcslWR O99gxgsSUpE8ADuDqatyYQCuqhn8WMSWrAyRsV83VKwmFIh5MZcZyVLVhZuITZgjQsQk 5u4AYQSMWLK3Ti4IW2d4r5l1q3unU8RZXyIx7FNu6+lrWy4byUCi1PP9PZksKF3olGWA fBng== 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=N4FQ+ESHIEwX2dIl8VLFLizSBZV3arl7rG3DDOVO4+Y=; b=072g2Kc0tGTF9EvfHtc+M9tFy/Bb9ddb+jhx2DTayNWBfuSv5k6KYjDfMulOjnYv/3 5PJz7pFudHxhrZ/2uHL31ioyN2/GocQQZzb+8i/1js0qGr2jAhKFmawM45vmpGlgb25X Z23nQiA2HAOKyeGfYMJ8yopE3plSruKPxnKkW984HZSSHd+BmeOMPW9QTmiBOaNMjeuF rJTuZ+UDlFnRqDNzfjkvrJJcM1NdmvODm4M/WZGLXdNRb/xAtRI2IhC+hIIQjo2OKzft Iha4nySB+Ccw9sIpUKaF7soBGb6WZpWQ6bOs7I5p5EADKODP00TE2DO5QHuD95UQ+nef 5qkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=pBXJWuNC; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si24863961plx.206.2021.10.26.07.22.06; Tue, 26 Oct 2021 07:22:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=pBXJWuNC; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 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 S235525AbhJZLWa (ORCPT + 67 others); Tue, 26 Oct 2021 07:22:30 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:47817 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235506AbhJZLWa (ORCPT ); Tue, 26 Oct 2021 07:22:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1635247207; x=1666783207; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=N4FQ+ESHIEwX2dIl8VLFLizSBZV3arl7rG3DDOVO4+Y=; b=pBXJWuNCNmbuoPzdp3xbzHX8fFr6T2Mv9ucoJq9kUbNJF9J6kBtOMTXM l9SSkfdpiGg+5yMkJ+c06lM3zHhFtAWFpcEeKC0Z0s4bldPAGHBY3Kykj C5HdyutM2KPEaFR7+pp3ZIzjIcEaz1nrd96Iq1N3JY0jreDgcGuGRWTk6 I=; Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 26 Oct 2021 04:20:07 -0700 X-QCInternal: smtphost Received: from nalasex01a.na.qualcomm.com ([10.47.209.196]) by ironmsg-lv-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2021 04:20:07 -0700 Received: from wgong-HP3-Z230-SFF-Workstation.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.922.7; Tue, 26 Oct 2021 04:20:04 -0700 From: Wen Gong To: CC: , Subject: [PATCH 13/15] ath11k: discard BSS_CHANGED_TXPOWER when EXT_TPC_REG_SUPPORT for 6 GHz Date: Tue, 26 Oct 2021 07:19:11 -0400 Message-ID: <20211026111913.7346-14-quic_wgong@quicinc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211026111913.7346-1-quic_wgong@quicinc.com> References: <20211026111913.7346-1-quic_wgong@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) Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org When station is connected to a 6 GHz AP, it has 2 way to configure the power limit to firmware. The first way is to send 2 wmi command 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 in this patch and select the second way in the subsequent patch. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 Signed-off-by: Wen Gong --- drivers/net/wireless/ath/ath11k/core.h | 6 ++++++ drivers/net/wireless/ath/ath11k/mac.c | 19 +++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 6969e0a6fc7b..6ef639975725 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -1017,4 +1017,10 @@ static inline bool ath11k_support_6G_cc_ext(struct ath11k *ar) return ath11k_support_cc_ext(ar->ab) && ar->supports_6ghz; } +static inline bool ath11k_support_tpc_ext(struct ath11k *ar) +{ + return ath11k_support_6G_cc_ext(ar) && + test_bit(WMI_TLV_SERVICE_EXT_TPC_REG_SUPPORT, ar->ab->wmi_ab.svc_map); +} + #endif /* _CORE_H_ */ diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index ed2dc4c81de8..301e08a85f47 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -2170,6 +2170,16 @@ static int ath11k_mac_config_obss_pd(struct ath11k *ar, return 0; } +static bool ath11k_mac_station_support_tpc(struct ath11k *ar, + struct ath11k_vif *arvif, + struct cfg80211_chan_def *chandef) +{ + return ath11k_support_tpc_ext(ar) && + arvif->vdev_type == WMI_VDEV_TYPE_STA && + 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, @@ -2353,8 +2363,13 @@ static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw, ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac vdev_id %i txpower %d\n", arvif->vdev_id, info->txpower); - arvif->txpower = info->txpower; - ath11k_mac_txpower_recalc(ar); + if (ath11k_mac_station_support_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_MCAST_RATE && -- 2.31.1