2021-09-24 10:03:27

by Wen Gong

[permalink] [raw]
Subject: [PATCH v4 2/6] mac80211: add parse regulatory info in 6 GHz operation information

This patch is to convert the regulatory info subfield in HE operation
element to power type and save in struct cfg80211_chan_def.

Signed-off-by: Wen Gong <[email protected]>
---
net/mac80211/util.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index ca8008ba9b1f..66e48f29495a 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -3385,6 +3385,7 @@ bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata,
const struct ieee80211_sta_he_cap *he_cap;
struct cfg80211_chan_def he_chandef = *chandef;
const struct ieee80211_he_6ghz_oper *he_6ghz_oper;
+ struct ieee80211_bss_conf *bss_conf;
bool support_80_80, support_160;
u8 he_phy_cap;
u32 freq;
@@ -3428,6 +3429,18 @@ bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata,
NL80211_BAND_6GHZ);
he_chandef.chan = ieee80211_get_channel(sdata->local->hw.wiphy, freq);

+ bss_conf = &sdata->vif.bss_conf;
+
+ switch (u8_get_bits(he_6ghz_oper->control,
+ IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO)) {
+ case IEEE80211_6GHZ_CTRL_REG_LPI_AP:
+ bss_conf->power_type = IEEE80211_REG_LPI_AP;
+ break;
+ case IEEE80211_6GHZ_CTRL_REG_SP_AP:
+ bss_conf->power_type = IEEE80211_REG_SP_AP;
+ break;
+ }
+
switch (u8_get_bits(he_6ghz_oper->control,
IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH)) {
case IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_20MHZ:
--
2.31.1


2021-09-27 11:23:26

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH v4 2/6] mac80211: add parse regulatory info in 6 GHz operation information

On Fri, 2021-09-24 at 06:00 -0400, Wen Gong wrote:
> This patch is to convert the regulatory info subfield in HE operation
> element to power type and save in struct cfg80211_chan_def.
>
> Signed-off-by: Wen Gong <[email protected]>
> ---
>  net/mac80211/util.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/net/mac80211/util.c b/net/mac80211/util.c
> index ca8008ba9b1f..66e48f29495a 100644
> --- a/net/mac80211/util.c
> +++ b/net/mac80211/util.c
> @@ -3385,6 +3385,7 @@ bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata,
>   const struct ieee80211_sta_he_cap *he_cap;
>   struct cfg80211_chan_def he_chandef = *chandef;
>   const struct ieee80211_he_6ghz_oper *he_6ghz_oper;
> + struct ieee80211_bss_conf *bss_conf;
>   bool support_80_80, support_160;
>   u8 he_phy_cap;
>   u32 freq;
> @@ -3428,6 +3429,18 @@ bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata,
>   NL80211_BAND_6GHZ);
>   he_chandef.chan = ieee80211_get_channel(sdata->local->hw.wiphy, freq);
>  
>
>
>
> + bss_conf = &sdata->vif.bss_conf;
> +
> + switch (u8_get_bits(he_6ghz_oper->control,
> + IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO)) {
> + case IEEE80211_6GHZ_CTRL_REG_LPI_AP:
> + bss_conf->power_type = IEEE80211_REG_LPI_AP;
> + break;
> + case IEEE80211_6GHZ_CTRL_REG_SP_AP:
> + bss_conf->power_type = IEEE80211_REG_SP_AP;
> + break;
> + }

I added a default case here to set it to UNSET, so that if you
disconnect and reconnect etc. you don't get stale data.

johannes