diff mbox series

[v4,4/6] cfg80211: save power spectral density(psd) of regulatory rule

Message ID 20210924100052.32029-5-wgong@codeaurora.org (mailing list archive)
State Changes Requested
Delegated to: Johannes Berg
Headers show
Series cfg80211/mac80211: Add support for 6GHZ STA for various modes : LPI, SP and VLP | expand

Commit Message

Wen Gong Sept. 24, 2021, 10 a.m. UTC
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 <wgong@codeaurora.org>
---
 net/wireless/reg.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Johannes Berg Sept. 27, 2021, 11:27 a.m. UTC | #1
On Fri, 2021-09-24 at 06:00 -0400, Wen Gong wrote:
> 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 <wgong@codeaurora.org>
> ---
>  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;

I went to go squash this with patch 3 and took a closer look, and then I
realized you're doing this weird.

Please when you resend also squash this - it's a bit weird to read in
two patches.

However, I think this is missing a lot of things - we already talked
about the regulatory database, and while that'd be nice, I guess I
conceded that you don't really have to do it now.

However, for visibility reasons, I *really* think you need to add
nl80211 attributes for all of this data - when the regdomain is dumped
in nl80211_put_regdom() you would have the flag now (it dumps the value
of reg_rule->flags in NL80211_ATTR_REG_RULE_FLAGS), but you didn't add
the value of reg_rule->psd which you've added.

Similarly, you're not adding the PSD flag nor the PSD value for the
*channel* in nl80211_msg_put_channel(), both of which I think you should
have for visibility into what's going on in the kernel/driver.

I've applied all the other patches, so please just resend 3 and 4,
squashed into a single patch, with the fixes.

johannes
Wen Gong Sept. 28, 2021, 9:05 a.m. UTC | #2
On 2021-09-27 19:27, Johannes Berg wrote:
> On Fri, 2021-09-24 at 06:00 -0400, Wen Gong wrote:
>> 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 <wgong@codeaurora.org>
>> ---
>>  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;
> 
> I went to go squash this with patch 3 and took a closer look, and then 
> I
> realized you're doing this weird.
> 
> Please when you resend also squash this - it's a bit weird to read in
> two patches.
> 
> However, I think this is missing a lot of things - we already talked
> about the regulatory database, and while that'd be nice, I guess I
> conceded that you don't really have to do it now.
> 
> However, for visibility reasons, I *really* think you need to add
> nl80211 attributes for all of this data - when the regdomain is dumped
> in nl80211_put_regdom() you would have the flag now (it dumps the value
> of reg_rule->flags in NL80211_ATTR_REG_RULE_FLAGS), but you didn't add
> the value of reg_rule->psd which you've added.
> 
> Similarly, you're not adding the PSD flag nor the PSD value for the
> *channel* in nl80211_msg_put_channel(), both of which I think you 
> should
> have for visibility into what's going on in the kernel/driver.
> 
> I've applied all the other patches, so please just resend 3 and 4,
> squashed into a single patch, with the fixes.
> 

Thanks

I have sent "[PATCH v5] cfg80211: save power spectral density(psd) of 
regulatory rule"
for this.

> johannes
diff mbox series

Patch

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;
 }