Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1178151rdb; Wed, 20 Sep 2023 01:40:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWc0ne07AO2BMUHRqRoqJj2zpXecjmqR6jHl3T9mJa5zRrBG/qj74VkaJjBUgFIn6RWmPb X-Received: by 2002:a17:902:dacd:b0:1bd:d92d:6b2 with SMTP id q13-20020a170902dacd00b001bdd92d06b2mr2259116plx.10.1695199228707; Wed, 20 Sep 2023 01:40:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695199228; cv=none; d=google.com; s=arc-20160816; b=wy1oTyP81uRO3/4WuBbOYIj8Qg+XLTetSYUR/X+sFBT8A8VZWicUCf/wXboEalwz/c RYMYUeFq+sVnrcZxWcOfAAQFNHQmEVTA55AznLEg/sL0ddzj9kEr7GHqRc8WDdfVcjt/ NmvQfJW5gcQ46WsvaPLpXLHfeqIcY956l5jiznZ1c3/I/f2rISEWH+y1o1XmuTfHBxPK Ba/jwPwY9OztczmZKWEWfzzyvlsBvRcJOBMoqh4t5FPwPo1+4bs/gbrAEjTersfgEqTL M4QBJl13HavIYsd3VO88dtmlGLVFZ99QfJJ6FnqtWx0Kny5OTFGrSwnE0uE3ty2VT6AY VN2A== 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=2HTi0K8uN9eUy+5fL6mzwZr+mGlPxQXM9PcsDS7UW1U=; fh=a9RQep1hjU/4gjvnAyyZ/jgKZXxYhr894cgqq3v+6lI=; b=uzt1fdn2r90uS5W0VpXoy0AUuyvHSyJS63Tpklh+TEThEMl89MK4TEfpaQIyVSDfXU 3cqbG1eXuFnAnCPm7yElTv01Bozfz1ENlrF2pfIRAZpR/DVck3WaMhRNltB3fLtF5ETw gsjDh9rxj9g/FktAT7eg+yv2NIAtFcJGWWJVASmdZXeOvxmCmS/jntIfoFshliiLTC7G 9t7G0hFVNehg/33LlLJ65IDbWm8uIq1SJWPIIF2xegBCtGAwPEIWUCbtBVNYoRzXteX0 BiRjhVmjAsP82ZLcoGz5vwPLp1KWKbVAcIC2/LoUY8IseQ9r9JTg2NvFS+hig1c5AShK q3Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ZDm8zi5h; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id y9-20020a17090264c900b001bdf69e297bsi7788657pli.588.2023.09.20.01.40.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 01:40:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ZDm8zi5h; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 3E34F81A43F3; Wed, 20 Sep 2023 01:24:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233354AbjITIYa (ORCPT + 56 others); Wed, 20 Sep 2023 04:24:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232799AbjITIY2 (ORCPT ); Wed, 20 Sep 2023 04:24:28 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1348999 for ; Wed, 20 Sep 2023 01:24:22 -0700 (PDT) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38K6EIIE032404; Wed, 20 Sep 2023 08:24:18 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=2HTi0K8uN9eUy+5fL6mzwZr+mGlPxQXM9PcsDS7UW1U=; b=ZDm8zi5hXMbntHk7Cr3W/KqZLVZ2w8+K6C7TwakuCwtgQuK8esivm++7fe+LuKMDPEWI 6NIqCiX2Ik9ga8IwN0n/OTYWMOyHtcHijGUesOQ0dJPEsxIpU4IQ/ucJ8RjLS11XdN21 HEJpKJWrmEd7aCBzLJjWrmAJP9oVrE8XLu5PhcJgi9YWlWp0AIKu/KVPUs45WsJYyflO 3O3WM44wH5PoRYWxDm10nuboShVQNrRupvlvflm9HKdeTH1DdJKm/Vkh52wOycovzI0F RwMoTmOeAiZSp8p+p+ybg88NUZuQcnAIXJF78YPEock4c4hK95RBNGrjoBZHWT0tXg61 8Q== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t78upjmhh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Sep 2023 08:24:18 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38K8OIgg031270 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Sep 2023 08:24:18 GMT 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.1118.36; Wed, 20 Sep 2023 01:24:16 -0700 From: Wen Gong To: CC: , , , Subject: [PATCH v6 06/13] wifi: ath11k: save power spectral density(psd) of regulatory rule Date: Wed, 20 Sep 2023 04:23:42 -0400 Message-ID: <20230920082349.29111-7-quic_wgong@quicinc.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230920082349.29111-1-quic_wgong@quicinc.com> References: <20230920082349.29111-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: 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: FGOWv4Ny0KWk8VaDVHFxF6xwtx3ePJkN X-Proofpoint-ORIG-GUID: FGOWv4Ny0KWk8VaDVHFxF6xwtx3ePJkN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-20_02,2023-09-19_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 phishscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 spamscore=0 clxscore=1015 adultscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309200067 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 20 Sep 2023 01:24:34 -0700 (PDT) Save the power spectral density(psd) report from firmware to struct ieee80211_reg_rule. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23 Signed-off-by: Wen Gong --- drivers/net/wireless/ath/ath11k/reg.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/reg.c b/drivers/net/wireless/ath/ath11k/reg.c index 0535ab8a28fa..622fb07eade0 100644 --- a/drivers/net/wireless/ath/ath11k/reg.c +++ b/drivers/net/wireless/ath/ath11k/reg.c @@ -413,6 +413,10 @@ static void ath11k_reg_intersect_rules(struct ieee80211_reg_rule *rule1, /* Use the flags of both the rules */ new_rule->flags = rule1->flags | rule2->flags; + if ((rule1->flags & NL80211_RRF_PSD) && (rule2->flags & NL80211_RRF_PSD)) + new_rule->psd = min_t(s8, rule1->psd, rule2->psd); + else + new_rule->flags &= ~NL80211_RRF_PSD; /* To be safe, lts use the max cac timeout of both rules */ new_rule->dfs_cac_ms = max_t(u32, rule1->dfs_cac_ms, @@ -516,13 +520,14 @@ ath11k_reg_adjust_bw(u16 start_freq, u16 end_freq, u16 max_bw) static void ath11k_reg_update_rule(struct ieee80211_reg_rule *reg_rule, u32 start_freq, u32 end_freq, u32 bw, u32 ant_gain, u32 reg_pwr, - u32 reg_flags) + s8 psd, u32 reg_flags) { reg_rule->freq_range.start_freq_khz = MHZ_TO_KHZ(start_freq); reg_rule->freq_range.end_freq_khz = MHZ_TO_KHZ(end_freq); reg_rule->freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw); reg_rule->power_rule.max_antenna_gain = DBI_TO_MBI(ant_gain); reg_rule->power_rule.max_eirp = DBM_TO_MBM(reg_pwr); + reg_rule->psd = psd; reg_rule->flags = reg_flags; } @@ -552,7 +557,7 @@ ath11k_reg_update_weather_radar_band(struct ath11k_base *ab, reg_rule->start_freq, ETSI_WEATHER_RADAR_BAND_LOW, bw, reg_rule->ant_gain, reg_rule->reg_power, - flags); + reg_rule->psd_eirp, flags); ath11k_dbg(ab, ATH11K_DBG_REG, "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", @@ -573,7 +578,7 @@ ath11k_reg_update_weather_radar_band(struct ath11k_base *ab, ath11k_reg_update_rule(regd->reg_rules + i, start_freq, end_freq, bw, reg_rule->ant_gain, - reg_rule->reg_power, flags); + reg_rule->reg_power, reg_rule->psd_eirp, flags); regd->reg_rules[i].dfs_cac_ms = ETSI_WEATHER_RADAR_BAND_CAC_TIMEOUT; @@ -594,7 +599,7 @@ ath11k_reg_update_weather_radar_band(struct ath11k_base *ab, ETSI_WEATHER_RADAR_BAND_HIGH, reg_rule->end_freq, bw, reg_rule->ant_gain, reg_rule->reg_power, - flags); + reg_rule->psd_eirp, flags); ath11k_dbg(ab, ATH11K_DBG_REG, "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", @@ -716,6 +721,8 @@ ath11k_reg_build_regd(struct ath11k_base *ab, reg_rule = reg_rule_6ghz + k++; max_bw = min_t(u16, reg_rule->max_bw, max_bw_6ghz); flags = NL80211_RRF_AUTO_BW; + if (reg_rule->psd_flag) + flags |= NL80211_RRF_PSD; } else { break; } @@ -726,7 +733,7 @@ ath11k_reg_build_regd(struct ath11k_base *ab, reg_rule->start_freq, reg_rule->end_freq, max_bw, reg_rule->ant_gain, reg_rule->reg_power, - flags); + reg_rule->psd_eirp, flags); /* Update dfs cac timeout if the dfs domain is ETSI and the * new rule covers weather radar band. -- 2.40.1