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 <[email protected]>
---
net/wireless/reg.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
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;
}
--
2.31.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
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
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
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