Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1424692pxb; Fri, 24 Sep 2021 04:21:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0xmSWEUGbM66hP1jZXrzqkqMc/c6rqv1ZacJ/2b1fDt4OPmG6oHB2AT4D8S5bAKtZM/44 X-Received: by 2002:a05:6e02:13d4:: with SMTP id v20mr7876151ilj.247.1632482494276; Fri, 24 Sep 2021 04:21:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632482494; cv=none; d=google.com; s=arc-20160816; b=S+D3DQHGXu6UetVC9UzLnesNV96MeW/zZlkJ3rMH/Rqay5wT/JshN1MzJjTgvgQLvo IOdIer1UXP5L0ON/moe7IA3Lw1U749iL2oClpPeVFqld+GzxzhJWlnOTD/g2KbW4J1NH LEqFagHiootlAAO2RdxYlOgCcsmwYCpND7OWr0l0xuzuoQ1n589YHS07FcR4KbXweFby iizThN2sgrKYza4AbyLd0kC7RTtin4TF2T1KLnVFJT7syGXLp7Cy4vFKtfleS+ivuXMM gdSh2e4QBuGRFUwwtKxUpbjKOur3N/gNLHLQIJnI/r7vpeVZQ74YjmQTpwgRcolLV/In v/5w== 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 :dmarc-filter:sender:dkim-signature; bh=Pt8h91TPQALzZ+Za7yhcYdxsR4u3ojYcy2HyN7QoAHE=; b=KzOnQkpjTy9p2hFYiSYr3okYQboX9aY3HMrxxcZazgS9nTc8uSMkZVZIxrjZe3TBrF PXPjForZviYMT1uCBkShwqr/AvXYrI2UGDmNQfUbsoMSBhdx1E1eYhcjJ9CZnGTJPXJF G09fDJeor3Vp8wFR82WyrLdnFVijOcuy7R0Nw6VEmekPvYWiCwp3R+sZSzFnICUjQUDL B/MsFBf8FwqgOJUZAVTfWZDWrNrXvukpY6DhLH27WvKPSAG479BsgC/YRJqFf99I2Qvo wWpebfdYGAFPYDitrL6AqwJeAN2RccsIC2h7o4+2l5j1iDRiMK5t0Jt1CjBA0a3mKlTh 3rRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=fPQCsOdi; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e10si9686576ioc.1.2021.09.24.04.21.24; Fri, 24 Sep 2021 04:21:34 -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=@mg.codeaurora.org header.s=smtp header.b=fPQCsOdi; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245440AbhIXKD3 (ORCPT + 78 others); Fri, 24 Sep 2021 06:03:29 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:62796 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245445AbhIXKD3 (ORCPT ); Fri, 24 Sep 2021 06:03:29 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1632477716; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=Pt8h91TPQALzZ+Za7yhcYdxsR4u3ojYcy2HyN7QoAHE=; b=fPQCsOdiL/4IpBnu4zXHgtQQFLX6v3HdIVyVWNvWWSffJxqpXZgmt8gEt6vD8QR0Yh838i4g kVwJDmwcrCcURsBK1s4k99xC1beE/rewxzyEaCNWUDObt8P9IAfF1BGgE91zlXpjbwciM2XX 6AB06d5i0c2QbkAbs9o2CqE9ShU= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-east-1.postgun.com with SMTP id 614da1f2bd6681d8ed4b8341 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 24 Sep 2021 10:01:22 GMT Sender: wgong=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 81FA0C4360C; Fri, 24 Sep 2021 10:01:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from wgong-HP3-Z230-SFF-Workstation.qca.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: wgong) by smtp.codeaurora.org (Postfix) with ESMTPSA id F0B3FC4360C; Fri, 24 Sep 2021 10:01:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org F0B3FC4360C Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org From: Wen Gong To: johannes@sipsolutions.net, ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, wgong@codeaurora.org Subject: [PATCH v4 4/6] cfg80211: save power spectral density(psd) of regulatory rule Date: Fri, 24 Sep 2021 06:00:50 -0400 Message-Id: <20210924100052.32029-5-wgong@codeaurora.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924100052.32029-1-wgong@codeaurora.org> References: <20210924100052.32029-1-wgong@codeaurora.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The power spectral density(psd) of regulatory rule should be take effect to the channels. This patch is to save the values to the channel which has psd value. Signed-off-by: Wen Gong --- net/wireless/reg.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/net/wireless/reg.c b/net/wireless/reg.c index df87c7f3a049..8f765befb9bc 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -1590,6 +1590,8 @@ static u32 map_regdom_flags(u32 rd_flags) channel_flags |= IEEE80211_CHAN_NO_160MHZ; if (rd_flags & NL80211_RRF_NO_HE) channel_flags |= IEEE80211_CHAN_NO_HE; + if (rd_flags & NL80211_RRF_PSD) + channel_flags |= IEEE80211_CHAN_PSD; return channel_flags; } @@ -1794,6 +1796,9 @@ static void handle_channel_single_rule(struct wiphy *wiphy, chan->dfs_cac_ms = reg_rule->dfs_cac_ms; } + if (chan->flags & IEEE80211_CHAN_PSD) + chan->psd = reg_rule->psd; + return; } @@ -1814,6 +1819,9 @@ static void handle_channel_single_rule(struct wiphy *wiphy, chan->dfs_cac_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; } + if (chan->flags & IEEE80211_CHAN_PSD) + chan->psd = reg_rule->psd; + if (chan->orig_mpwr) { /* * Devices that use REGULATORY_COUNTRY_IE_FOLLOW_POWER @@ -1883,6 +1891,12 @@ static void handle_channel_adjacent_rules(struct wiphy *wiphy, rrule2->dfs_cac_ms); } + if ((rrule1->flags & NL80211_RRF_PSD) && + (rrule2->flags & NL80211_RRF_PSD)) + chan->psd = min_t(s8, rrule1->psd, rrule2->psd); + else + chan->flags &= ~NL80211_RRF_PSD; + return; } @@ -2540,6 +2554,9 @@ static void handle_channel_custom(struct wiphy *wiphy, chan->dfs_cac_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; } + if (chan->flags & IEEE80211_CHAN_PSD) + chan->psd = reg_rule->psd; + chan->max_power = chan->max_reg_power; } -- 2.31.1