2021-05-19 03:37:42

by Wen Gong

[permalink] [raw]
Subject: [PATCH 6/9] mac80211: add definition for transmit power envelope element

IEEE P802.11ax™/D8.0 have some change for transmit power envelope
element. This patch to add the definition of it.

Signed-off-by: Wen Gong <[email protected]>
---
include/linux/ieee80211.h | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 894a2c4d7cb7..a39b5fc1dffc 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -2292,6 +2292,35 @@ struct ieee80211_he_6ghz_oper {
u8 minrate;
} __packed;

+#define IEEE80211_TPE_MAX_IE_COUNT 8
+#define IEEE80211_TPE_MAX_POWER_COUNT 8
+
+/* transmit power interpretation type of transmit power envelope element*/
+enum ieee80211_tx_power_intrpt_type {
+ IEEE80211_TPE_LOCAL_EIRP,
+ IEEE80211_TPE_LOCAL_EIRP_PSD,
+ IEEE80211_TPE_REG_CLIENT_EIRP,
+ IEEE80211_TPE_REG_CLIENT_EIRP_PSD,
+};
+
+/**
+ * struct ieee80211_tx_pwr_env
+ *
+ * This structure represents the "Transmit Power Envelope element"
+ */
+struct ieee80211_tx_pwr_env {
+ u8 tx_power_info;
+ s8 tx_power[IEEE80211_TPE_MAX_POWER_COUNT];
+} __packed;
+
+#define TX_PWR_ENV_INFO_COUNT GENMASK(2, 0)
+#define TX_PWR_ENV_INFO_INTERPRET GENMASK(5, 3)
+#define TX_PWR_ENV_INFO_CATEGORY GENMASK(7, 6)
+
+#define GET_TX_PWR_ENV_COUNT(fv) FIELD_GET(TX_PWR_ENV_INFO_COUNT, fv)
+#define GET_TX_PWR_ENV_INTERPRET(fv) FIELD_GET(TX_PWR_ENV_INFO_INTERPRET, fv)
+#define GET_TX_PWR_ENV_CATEGORY(fv) FIELD_GET(TX_PWR_ENV_INFO_CATEGORY, fv)
+
/*
* ieee80211_he_oper_size - calculate 802.11ax HE Operations IE size
* @he_oper_ie: byte data of the He Operations IE, stating from the byte
@@ -2873,7 +2902,7 @@ enum ieee80211_eid {
WLAN_EID_VHT_OPERATION = 192,
WLAN_EID_EXTENDED_BSS_LOAD = 193,
WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194,
- WLAN_EID_VHT_TX_POWER_ENVELOPE = 195,
+ WLAN_EID_TX_POWER_ENVELOPE = 195,
WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196,
WLAN_EID_AID = 197,
WLAN_EID_QUIET_CHANNEL = 198,
--
2.31.1



2021-07-23 09:31:10

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 6/9] mac80211: add definition for transmit power envelope element

On Mon, 2021-05-17 at 16:19 -0400, Wen Gong wrote:
>
> +#define TX_PWR_ENV_INFO_COUNT GENMASK(2, 0)
> +#define TX_PWR_ENV_INFO_INTERPRET GENMASK(5, 3)
> +#define TX_PWR_ENV_INFO_CATEGORY GENMASK(7, 6)

Personally, I'm not a big fan of GENMASK(), seems more complicated to me
than
0x0007
0x0038
0x00c0

but YMMV :)

We haven't really used GENMASK here anywhere else, have we?


> +#define GET_TX_PWR_ENV_COUNT(fv) FIELD_GET(TX_PWR_ENV_INFO_COUNT, fv)
> +#define GET_TX_PWR_ENV_INTERPRET(fv) FIELD_GET(TX_PWR_ENV_INFO_INTERPRET, fv)
> +#define GET_TX_PWR_ENV_CATEGORY(fv) FIELD_GET(TX_PWR_ENV_INFO_CATEGORY, fv)

I don't think we really need these, and we should be using u*_get_bits()
anyway rather than FIELD_GET.

johannes

2021-07-23 09:32:23

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 6/9] mac80211: add definition for transmit power envelope element

On Mon, 2021-05-17 at 16:19 -0400, Wen Gong wrote:
>
>
> +#define IEEE80211_TPE_MAX_IE_COUNT 8

Is this actually a spec limit?

johannes

2021-07-30 10:28:45

by Wen Gong

[permalink] [raw]
Subject: Re: [PATCH 6/9] mac80211: add definition for transmit power envelope element

On 2021-07-23 17:31, Johannes Berg wrote:
> On Mon, 2021-05-17 at 16:19 -0400, Wen Gong wrote:
>>
>>
>> +#define IEEE80211_TPE_MAX_IE_COUNT 8
>
> Is this actually a spec limit?
>
> johannes

Yes,
In "9.4.2.161 Transmit Power Envelope element" of "IEEE Std
802.11ax™‐2021",
It show 4 types in "Table 9-275a—Maximum Transmit Power Interpretation
subfield encoding".
And it has 2 category for each type in "Table E-12—Regulatory Info
subfield encoding in the United States".
So it it totally 8.