diff mbox series

[v2,5/8] cfg80211: save power spectral density(psd) of regulatory rule

Message ID 20210820122041.12157-6-wgong@codeaurora.org
State Superseded
Headers show
Series cfg80211/mac80211: Add support for 6GHZ STA for various modes : LPI, SP and VLP | expand

Commit Message

Wen Gong Aug. 20, 2021, 12:20 p.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 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Johannes Berg Aug. 26, 2021, 8:25 a.m. UTC | #1
I was going to apply this and patch 4 squashed, saying:


    cfg80211: regulatory: handle 6 GHz power spectral density (PSD)
    
    6 GHz regulatory domains introduce power spectral density (PSD).
    Allow wiphy-specific regulatory rules to specify these values.

but ...
> 

> +		if (chan->flags & IEEE80211_CHAN_PSD)

> +			chan->psd = min_t(s8, rrule1->psd, rrule1->psd);

> +


This is obviously wrong?

johannes
Wen Gong Aug. 26, 2021, 10:43 a.m. UTC | #2
On 2021-08-26 16:25, Johannes Berg wrote:
> I was going to apply this and patch 4 squashed, saying:

> 

> 

>     cfg80211: regulatory: handle 6 GHz power spectral density (PSD)

> 

>     6 GHz regulatory domains introduce power spectral density (PSD).

>     Allow wiphy-specific regulatory rules to specify these values.

> 

> but ...

>> 

>> +		if (chan->flags & IEEE80211_CHAN_PSD)

>> +			chan->psd = min_t(s8, rrule1->psd, rrule1->psd);

>> +

> 

> This is obviously wrong?

Yes it should change like this:

	if ((rrule1->flags & NL80211_RRF_PSD) && (rrule1->flags & 
NL80211_RRF_PSD))
		chan->psd = min_t(s8, rrule1->psd, rrule1->psd);
	else
		chan->flags &= ~NL80211_RRF_PSD;

> 

> johannes
Johannes Berg Aug. 26, 2021, 10:56 a.m. UTC | #3
On Thu, 2021-08-26 at 18:43 +0800, Wen Gong wrote:
> On 2021-08-26 16:25, Johannes Berg wrote:

> > I was going to apply this and patch 4 squashed, saying:

> > 

> > 

> >     cfg80211: regulatory: handle 6 GHz power spectral density (PSD)

> > 

> >     6 GHz regulatory domains introduce power spectral density (PSD).

> >     Allow wiphy-specific regulatory rules to specify these values.

> > 

> > but ...

> > > 

> > > +		if (chan->flags & IEEE80211_CHAN_PSD)

> > > +			chan->psd = min_t(s8, rrule1->psd, rrule1->psd);

> > > +

> > 

> > This is obviously wrong?

> Yes it should change like this:

> 

> 	if ((rrule1->flags & NL80211_RRF_PSD) && (rrule1->flags & 

> NL80211_RRF_PSD))

> 		chan->psd = min_t(s8, rrule1->psd, rrule1->psd);


One of those still should be rrule2 :)

johannes
Wen Gong Aug. 26, 2021, 10:58 a.m. UTC | #4
On 2021-08-26 18:56, Johannes Berg wrote:
> On Thu, 2021-08-26 at 18:43 +0800, Wen Gong wrote:

>> On 2021-08-26 16:25, Johannes Berg wrote:

>> > I was going to apply this and patch 4 squashed, saying:

>> >

>> >

>> >     cfg80211: regulatory: handle 6 GHz power spectral density (PSD)

>> >

>> >     6 GHz regulatory domains introduce power spectral density (PSD).

>> >     Allow wiphy-specific regulatory rules to specify these values.

>> >

>> > but ...

>> > >

>> > > +		if (chan->flags & IEEE80211_CHAN_PSD)

>> > > +			chan->psd = min_t(s8, rrule1->psd, rrule1->psd);

>> > > +

>> >

>> > This is obviously wrong?

>> Yes it should change like this:

>> 

>> 	if ((rrule1->flags & NL80211_RRF_PSD) && (rrule1->flags &

>> NL80211_RRF_PSD))

>> 		chan->psd = min_t(s8, rrule1->psd, rrule1->psd);

> 

> One of those still should be rrule2 :)

> 

yes
     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;
> johannes
diff mbox series

Patch

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 0406ce7334fa..602d95e8bde6 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1583,6 +1583,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;
 }
 
@@ -1787,6 +1789,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;
 	}
 
@@ -1807,6 +1812,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
@@ -1876,6 +1884,9 @@  static void handle_channel_adjacent_rules(struct wiphy *wiphy,
 							 rrule2->dfs_cac_ms);
 		}
 
+		if (chan->flags & IEEE80211_CHAN_PSD)
+			chan->psd = min_t(s8, rrule1->psd, rrule1->psd);
+
 		return;
 	}
 
@@ -2533,6 +2544,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;
 }