v2: change per comments of johannes.
including code style, code logic, patch merge, commit log...
It introduced some new concept:
power type of AP(STANDARD_POWER_AP, INDOOR_AP, VERY_LOW_POWER_AP)
power type of STATION(DEFAULT_CLIENT, SUBORDINATE_CLIENT)
power spectral density(psd)
This patchset for cfg80211/mac80211 is to add the definition of new
concept of 6G and add basic parse of IE(transmit power envelope
element) in beacon and save power spectral density(psd) reported
by lower-driver for 6G channel, the info will be passed to lower
driver when connecting to 6G AP.
Wen Gong (8):
cfg80211: add power type definition for 6 GHz
mac80211: add definition of regulatory info in 6 GHz operation
information
mac80211: add parse regulatory info in 6 GHz operation information
cfg80211: add definition for 6 GHz power spectral density(psd)
cfg80211: save power spectral density(psd) of regulatory rule
mac80211: add definition for transmit power envelope element
mac80211: add parse transmit power envelope element
mac80211: save transmit power envelope element and power constraint
include/linux/ieee80211.h | 43 +++++++++++++++++++++++++++++++++++-
include/net/cfg80211.h | 7 ++++++
include/net/mac80211.h | 6 +++++
include/net/regulatory.h | 1 +
include/uapi/linux/nl80211.h | 36 ++++++++++++++++++++++++++++++
net/mac80211/chan.c | 9 ++++++++
net/mac80211/ieee80211_i.h | 3 +++
net/mac80211/mlme.c | 26 ++++++++++++++++++++++
net/mac80211/util.c | 19 ++++++++++++++++
net/wireless/reg.c | 14 ++++++++++++
10 files changed, 163 insertions(+), 1 deletion(-)
--
2.31.1
The transmit power envelope elements in beacon is used to calculate
the power limit by lower driver, and sometimes it has more than
one elements in a beacon frame.
This is to add parse the transmit power envelope elements, then it
will be saved and transfer to lower driver to calculate the power
limit.
Signed-off-by: Wen Gong <[email protected]>
---
net/mac80211/ieee80211_i.h | 3 +++
net/mac80211/util.c | 9 +++++++++
2 files changed, 12 insertions(+)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 648696b49f89..bb62de5e3758 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1494,6 +1494,7 @@ struct ieee802_11_elems {
const struct ieee80211_he_spr *he_spr;
const struct ieee80211_mu_edca_param_set *mu_edca_param_set;
const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
+ const struct ieee80211_tx_pwr_env *tx_pwr_env[IEEE80211_TPE_MAX_IE_COUNT];
const u8 *uora_element;
const u8 *mesh_id;
const u8 *peering;
@@ -1544,6 +1545,8 @@ struct ieee802_11_elems {
u8 perr_len;
u8 country_elem_len;
u8 bssid_index_len;
+ u8 tx_pwr_env_len[IEEE80211_TPE_MAX_IE_COUNT];
+ u8 tx_pwr_env_num;
/* whether a parse error occurred while retrieving these elements */
bool parse_error;
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index cb1c35d8ef48..12c70cc30461 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1336,6 +1336,15 @@ _ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
elems->rsnx = pos;
elems->rsnx_len = elen;
break;
+ case WLAN_EID_TX_POWER_ENVELOPE:
+ if (elems->tx_pwr_env_num >= ARRAY_SIZE(elems->tx_pwr_env) ||
+ elen < 1)
+ break;
+
+ elems->tx_pwr_env[elems->tx_pwr_env_num] = (void *)pos;
+ elems->tx_pwr_env_len[elems->tx_pwr_env_num] = elen;
+ elems->tx_pwr_env_num++;
+ break;
case WLAN_EID_EXTENSION:
ieee80211_parse_extension_element(calc_crc ?
&crc : NULL,
--
2.31.1
IEEE Std 802.11ax™-2021 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 | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index deb2f536d104..65f5100052df 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -2290,6 +2290,43 @@ struct ieee80211_he_6ghz_oper {
u8 minrate;
} __packed;
+/**
+ * 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 max 8 Transmit Power Envelope element.
+ */
+#define IEEE80211_TPE_MAX_IE_COUNT 8
+/**
+ * In "Table 9-277—Meaning of Maximum Transmit Power Count subfield"
+ * of "IEEE Std 802.11ax™‐2021", the max power level is 8.
+ */
+#define IEEE80211_MAX_NUM_PWR_LEVEL 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 IEEE80211_TX_PWR_ENV_INFO_COUNT 0x7
+#define IEEE80211_TX_PWR_ENV_INFO_INTERPRET 0x38
+#define IEEE80211_TX_PWR_ENV_INFO_CATEGORY 0xC0
+
/*
* 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
@@ -2871,7 +2908,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
Hi johannes,
Could I get your comments on this v2 patches?
On 2021-08-20 20:20, Wen Gong wrote:
> v2: change per comments of johannes.
> including code style, code logic, patch merge, commit log...
>
> It introduced some new concept:
> power type of AP(STANDARD_POWER_AP, INDOOR_AP, VERY_LOW_POWER_AP)
> power type of STATION(DEFAULT_CLIENT, SUBORDINATE_CLIENT)
> power spectral density(psd)
>
> This patchset for cfg80211/mac80211 is to add the definition of new
> concept of 6G and add basic parse of IE(transmit power envelope
> element) in beacon and save power spectral density(psd) reported
> by lower-driver for 6G channel, the info will be passed to lower
> driver when connecting to 6G AP.
>
> Wen Gong (8):
> cfg80211: add power type definition for 6 GHz
> mac80211: add definition of regulatory info in 6 GHz operation
> information
> mac80211: add parse regulatory info in 6 GHz operation information
> cfg80211: add definition for 6 GHz power spectral density(psd)
> cfg80211: save power spectral density(psd) of regulatory rule
> mac80211: add definition for transmit power envelope element
> mac80211: add parse transmit power envelope element
> mac80211: save transmit power envelope element and power constraint
>
> include/linux/ieee80211.h | 43 +++++++++++++++++++++++++++++++++++-
> include/net/cfg80211.h | 7 ++++++
> include/net/mac80211.h | 6 +++++
> include/net/regulatory.h | 1 +
> include/uapi/linux/nl80211.h | 36 ++++++++++++++++++++++++++++++
> net/mac80211/chan.c | 9 ++++++++
> net/mac80211/ieee80211_i.h | 3 +++
> net/mac80211/mlme.c | 26 ++++++++++++++++++++++
> net/mac80211/util.c | 19 ++++++++++++++++
> net/wireless/reg.c | 14 ++++++++++++
> 10 files changed, 163 insertions(+), 1 deletion(-)
On Fri, 2021-08-20 at 08:20 -0400, Wen Gong wrote:
>
> + case WLAN_EID_TX_POWER_ENVELOPE:
> + if (elems->tx_pwr_env_num >= ARRAY_SIZE(elems->tx_pwr_env) ||
> + elen < 1)
> + break;
IMHO this should also check the max length, but I'll fix that.
johannes
On Fri, 2021-08-20 at 08:20 -0400, Wen Gong wrote:
> IEEE Std 802.11ax™-2021 have some change for transmit power envelope
> element. This patch to add the definition of it.
>
Generally: I'm sure Kalle has some page on this, but your commit
messages could use some work - you don't need to say "this patch" for
example, that's entirely obvious :)
>
> +/**
not actually kernel-doc, but I can fix
> + * 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 max 8 Transmit Power Envelope element.
very long lines, will fix that too
johannes