diff mbox series

[v2,3/8] mac80211: add parse regulatory info in 6 GHz operation information

Message ID 20210820122041.12157-4-wgong@codeaurora.org
State New
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
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 <wgong@codeaurora.org>
---
 net/mac80211/util.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Johannes Berg Aug. 26, 2021, 8:21 a.m. UTC | #1
On Fri, 2021-08-20 at 08:20 -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 <wgong@codeaurora.org>

> ---

>  net/mac80211/util.c | 10 ++++++++++

>  1 file changed, 10 insertions(+)

> 

> diff --git a/net/mac80211/util.c b/net/mac80211/util.c

> index 93d96a4f9c3e..cb1c35d8ef48 100644

> --- a/net/mac80211/util.c

> +++ b/net/mac80211/util.c

> @@ -3395,6 +3395,16 @@ 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);

>  

> 

> +	switch (u8_get_bits(he_6ghz_oper->control,

> +			    IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO)) {

> +	case IEEE80211_6GHZ_CTRL_REG_LPI_AP:

> +		he_chandef.power_type = NL80211_REG_LPI_AP;

> +		break;

> +	case IEEE80211_6GHZ_CTRL_REG_SP_AP:

> +		he_chandef.power_type = NL80211_REG_SP_AP;

> +		break;

> +	}


Now here you put it in the chandef, but don't propagate it anywhere if
channels are merged, etc. I don't think this can work correctly in all
but the most trivial use cases.

johannes
diff mbox series

Patch

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 93d96a4f9c3e..cb1c35d8ef48 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -3395,6 +3395,16 @@  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);
 
+	switch (u8_get_bits(he_6ghz_oper->control,
+			    IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO)) {
+	case IEEE80211_6GHZ_CTRL_REG_LPI_AP:
+		he_chandef.power_type = NL80211_REG_LPI_AP;
+		break;
+	case IEEE80211_6GHZ_CTRL_REG_SP_AP:
+		he_chandef.power_type = NL80211_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: