From patchwork Fri Aug 20 12:20:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Gong X-Patchwork-Id: 500819 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6542C4338F for ; Fri, 20 Aug 2021 12:20:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BD3196108F for ; Fri, 20 Aug 2021 12:20:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240189AbhHTMVb (ORCPT ); Fri, 20 Aug 2021 08:21:31 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:53290 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238064AbhHTMV3 (ORCPT ); Fri, 20 Aug 2021 08:21:29 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1629462051; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=B1eeBXXRanM2y/whbXRJaHJkVYC5X+/SfXDWh1SVWAw=; b=doX8aMULlyp9cHhS+u+qx12850crvhYz1lMgcffmB+BP5GtEC8c4lcbBdu2tqxXSbAZdCxaE SVr+WpfKmZMxD/NDkxj3dXxFhYywB0rRy+DaHLUC8wayUdRnChIM+Uv3TjELh6gyUsJWZU/L PqPK9ypVDJG6+2N9uuHPm1pKZu4= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-east-1.postgun.com with SMTP id 611f9e229b8228d0d0a4158a (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 20 Aug 2021 12:20:50 GMT Sender: wgong=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 26602C4338F; Fri, 20 Aug 2021 12:20:50 +0000 (UTC) Received: from wgong-HP3-Z230-SFF-Workstation.qca.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: wgong) by smtp.codeaurora.org (Postfix) with ESMTPSA id A3166C43460; Fri, 20 Aug 2021 12:20:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org A3166C43460 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org From: Wen Gong To: johannes@sipsolutions.net, ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, wgong@codeaurora.org Subject: [PATCH v2 1/8] cfg80211: add power type definition for 6 GHz Date: Fri, 20 Aug 2021 08:20:34 -0400 Message-Id: <20210820122041.12157-2-wgong@codeaurora.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210820122041.12157-1-wgong@codeaurora.org> References: <20210820122041.12157-1-wgong@codeaurora.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 6 GHz regulatory domains introduces different modes for 6 GHz AP operations Low Power Indoor(LPI), Standard Power(SP) and Very Low Power(VLP). 6 GHz STAs could be operated as either Regular or Subordinate clients. This patch is define the flags for power type of AP and STATION mode. Signed-off-by: Wen Gong --- include/net/cfg80211.h | 2 ++ include/uapi/linux/nl80211.h | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 58c2cd417e89..f17a4d1202fc 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -676,6 +676,7 @@ struct key_params { * chan will define the primary channel and all other * parameters are ignored. * @freq1_offset: offset from @center_freq1, in KHz + * @power_type: power type of BSS for 6 GHz */ struct cfg80211_chan_def { struct ieee80211_channel *chan; @@ -684,6 +685,7 @@ struct cfg80211_chan_def { u32 center_freq2; struct ieee80211_edmg edmg; u16 freq1_offset; + enum nl80211_ap_reg_power power_type; }; /* diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index f962c06e9818..ab1d4aa85272 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -4088,6 +4088,40 @@ enum nl80211_dfs_regions { NL80211_DFS_JP = 3, }; +/** + * enum nl80211_ap_reg_power - regulatory power for a Access Point + * + * @NL80211_REG_UNSET_AP: Access Point has no regulatory power mode + * @NL80211_REG_LPI: Indoor Access Point + * @NL80211_REG_SP: Standard power Access Point + * @NL80211_REG_VLP: Very low power Access Point + */ +enum nl80211_ap_reg_power { + NL80211_REG_UNSET_AP, + NL80211_REG_LPI_AP, + NL80211_REG_SP_AP, + NL80211_REG_VLP_AP, + NL80211_REG_AP_POWER_AFTER_LAST, + NL80211_REG_AP_POWER_MAX = + NL80211_REG_AP_POWER_AFTER_LAST - 1, +}; + +/** + * enum nl80211_client_reg_power - regulatory power for a client + * + * @NL80211_REG_UNSET_CLIENT: Client has no regulatory power mode + * @NL80211_REG_DEFAULT_CLIENT: Default Client + * @NL80211_REG_SUBORDINATE_CLIENT: Subordinate Client + */ +enum nl80211_client_reg_power { + NL80211_REG_UNSET_CLIENT, + NL80211_REG_DEFAULT_CLIENT, + NL80211_REG_SUBORDINATE_CLIENT, + NL80211_REG_CLIENT_POWER_AFTER_LAST, + NL80211_REG_CLIENT_POWER_MAX = + NL80211_REG_CLIENT_POWER_AFTER_LAST - 1, +}; + /** * enum nl80211_user_reg_hint_type - type of user regulatory hint * From patchwork Fri Aug 20 12:20:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wen Gong X-Patchwork-Id: 500816 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABEE8C432BE for ; Fri, 20 Aug 2021 12:21:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9003F60FE7 for ; Fri, 20 Aug 2021 12:21:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240458AbhHTMVp (ORCPT ); Fri, 20 Aug 2021 08:21:45 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:52794 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240340AbhHTMVm (ORCPT ); Fri, 20 Aug 2021 08:21:42 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1629462064; h=Content-Transfer-Encoding: Content-Type: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=zvEJtpbingpsiN3/ToulAmxrC6ZipGNFY5kyMai1SfE=; b=ET2HrGA+AfsAzQwTwE6bam2LSrwWgFYq/sEjAPKb7qr5G6jzcXM6cKzMAjc5vOlPDq8t5LED 1E95tLomfZe8TA68J02PgXIxdx1jUDPnkIH8A3o7i4OvnKE0/45g//Dd7O0ZfJvGfu/fx0WO 4aYBt2GyjdRGn5J96mCBmYZy0ds= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n03.prod.us-west-2.postgun.com with SMTP id 611f9e241d4eeff4c395e158 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 20 Aug 2021 12:20:52 GMT Sender: wgong=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id E5774C4360D; Fri, 20 Aug 2021 12:20:51 +0000 (UTC) Received: from wgong-HP3-Z230-SFF-Workstation.qca.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: wgong) by smtp.codeaurora.org (Postfix) with ESMTPSA id 44FEAC4360C; Fri, 20 Aug 2021 12:20:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 44FEAC4360C Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org From: Wen Gong To: johannes@sipsolutions.net, ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, wgong@codeaurora.org Subject: [PATCH v2 2/8] mac80211: add definition of regulatory info in 6 GHz operation information Date: Fri, 20 Aug 2021 08:20:35 -0400 Message-Id: <20210820122041.12157-3-wgong@codeaurora.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210820122041.12157-1-wgong@codeaurora.org> References: <20210820122041.12157-1-wgong@codeaurora.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org IEEE Std 802.11ax™-2021 added regulatory info subfield in HE operation element, this patch is to add it in mac80211 definition. Signed-off-by: Wen Gong --- include/linux/ieee80211.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 68d8b9cdd3b8..deb2f536d104 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -2264,6 +2264,9 @@ ieee80211_he_ppe_size(u8 ppe_thres_hdr, const u8 *phy_cap_info) #define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR 0x40000000 #define IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED 0x80000000 +#define IEEE80211_6GHZ_CTRL_REG_LPI_AP 0 +#define IEEE80211_6GHZ_CTRL_REG_SP_AP 1 + /** * ieee80211_he_6ghz_oper - HE 6 GHz operation Information field * @primary: primary channel @@ -2280,6 +2283,7 @@ struct ieee80211_he_6ghz_oper { #define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_80MHZ 2 #define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_160MHZ 3 #define IEEE80211_HE_6GHZ_OPER_CTRL_DUP_BEACON 0x4 +#define IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO 0x38 u8 control; u8 ccfs0; u8 ccfs1; From patchwork Fri Aug 20 12:20:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Gong X-Patchwork-Id: 501269 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AA00C432BE for ; Fri, 20 Aug 2021 12:20:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B52760FE8 for ; Fri, 20 Aug 2021 12:20:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240402AbhHTMVd (ORCPT ); Fri, 20 Aug 2021 08:21:33 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:14158 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238064AbhHTMVc (ORCPT ); Fri, 20 Aug 2021 08:21:32 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1629462054; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=gYPhCj6vSaMMPbRt9/kJHWdB9b96bS7GiHWcKDc4lt8=; b=p/0gBnrTmiSDkEpZpQMflC0iGA+NFcJ2U/n7ngaO+l8gmD3psNAOQNI/q0azLiTGfEGxBHHS eWHr1w9j8mB8g/tLkrzgRy3r3jeh6NA5GXfbsae6Njs5IriwgQqChIXbpom99BBulYoOgjSx SUrUGZTALitk5+b5l7nYcWEzQxs= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n03.prod.us-west-2.postgun.com with SMTP id 611f9e251d4eeff4c395e5bf (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 20 Aug 2021 12:20:53 GMT Sender: wgong=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 6E451C4360C; Fri, 20 Aug 2021 12:20:53 +0000 (UTC) Received: from wgong-HP3-Z230-SFF-Workstation.qca.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: wgong) by smtp.codeaurora.org (Postfix) with ESMTPSA id CBF5DC4338F; Fri, 20 Aug 2021 12:20:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org CBF5DC4338F Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org From: Wen Gong To: johannes@sipsolutions.net, ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, wgong@codeaurora.org Subject: [PATCH v2 3/8] mac80211: add parse regulatory info in 6 GHz operation information Date: Fri, 20 Aug 2021 08:20:36 -0400 Message-Id: <20210820122041.12157-4-wgong@codeaurora.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210820122041.12157-1-wgong@codeaurora.org> References: <20210820122041.12157-1-wgong@codeaurora.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- 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; + } + switch (u8_get_bits(he_6ghz_oper->control, IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH)) { case IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_20MHZ: From patchwork Fri Aug 20 12:20:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Gong X-Patchwork-Id: 500818 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65038C4338F for ; Fri, 20 Aug 2021 12:21:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4CFF360F45 for ; Fri, 20 Aug 2021 12:21:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240405AbhHTMVe (ORCPT ); Fri, 20 Aug 2021 08:21:34 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:45228 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240329AbhHTMVd (ORCPT ); Fri, 20 Aug 2021 08:21:33 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1629462055; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=jnwcZqup2t+Kfk4f7HioOXGRaUIsvZg7Fv79FCZApHk=; b=dtzS13V0KTPb0Ka/raVmP+280dD0PPvA9Nb96r7RmSjK3EV7vwkmsyiXAwAvfEmspTQSECYa FCpFTdhlhNCIHLl38oI0wG0pxNO1J4nNkHB5eJjW/vgF83+Qid68Op9gz8GWHGJ+G/i+f3Gc 8r2idH8Pc6jZLRZx54+MfJNOmEA= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n03.prod.us-west-2.postgun.com with SMTP id 611f9e261d4eeff4c395e97d (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 20 Aug 2021 12:20:54 GMT Sender: wgong=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id C7556C4360D; Fri, 20 Aug 2021 12:20:54 +0000 (UTC) Received: from wgong-HP3-Z230-SFF-Workstation.qca.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: wgong) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5D9FAC43460; Fri, 20 Aug 2021 12:20:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 5D9FAC43460 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org From: Wen Gong To: johannes@sipsolutions.net, ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, wgong@codeaurora.org Subject: [PATCH v2 4/8] cfg80211: add definition for 6 GHz power spectral density(psd) Date: Fri, 20 Aug 2021 08:20:37 -0400 Message-Id: <20210820122041.12157-5-wgong@codeaurora.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210820122041.12157-1-wgong@codeaurora.org> References: <20210820122041.12157-1-wgong@codeaurora.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 6 GHz regulatory domains introduces power spectral density(psd). This patch is define the flags for psd. Signed-off-by: Wen Gong --- include/net/cfg80211.h | 5 +++++ include/net/regulatory.h | 1 + include/uapi/linux/nl80211.h | 2 ++ 3 files changed, 8 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index f17a4d1202fc..27326e5d5ff3 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -108,6 +108,8 @@ struct wiphy; * on this channel. * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted * on this channel. + * @IEEE80211_CHAN_PSD: power spectral density (in dBm) + * on this channel. * */ enum ieee80211_channel_flags { @@ -130,6 +132,7 @@ enum ieee80211_channel_flags { IEEE80211_CHAN_4MHZ = 1<<16, IEEE80211_CHAN_8MHZ = 1<<17, IEEE80211_CHAN_16MHZ = 1<<18, + IEEE80211_CHAN_PSD = 1<<19, }; #define IEEE80211_CHAN_NO_HT40 \ @@ -163,6 +166,7 @@ enum ieee80211_channel_flags { * on this channel. * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered. * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels. + * @psd: power spectral density (in dBm) */ struct ieee80211_channel { enum nl80211_band band; @@ -179,6 +183,7 @@ struct ieee80211_channel { enum nl80211_dfs_state dfs_state; unsigned long dfs_state_entered; unsigned int dfs_cac_ms; + s8 psd; }; /** diff --git a/include/net/regulatory.h b/include/net/regulatory.h index 47f06f6f5a67..ed20004fb6a9 100644 --- a/include/net/regulatory.h +++ b/include/net/regulatory.h @@ -221,6 +221,7 @@ struct ieee80211_reg_rule { u32 flags; u32 dfs_cac_ms; bool has_wmm; + s8 psd; }; struct ieee80211_regdomain { diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index ab1d4aa85272..9ac1dc551cbc 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -4043,6 +4043,7 @@ enum nl80211_sched_scan_match_attr { * @NL80211_RRF_NO_80MHZ: 80MHz operation not allowed * @NL80211_RRF_NO_160MHZ: 160MHz operation not allowed * @NL80211_RRF_NO_HE: HE operation not allowed + * @NL80211_RRF_PSD: channels has power spectral density value */ enum nl80211_reg_rule_flags { NL80211_RRF_NO_OFDM = 1<<0, @@ -4061,6 +4062,7 @@ enum nl80211_reg_rule_flags { NL80211_RRF_NO_80MHZ = 1<<15, NL80211_RRF_NO_160MHZ = 1<<16, NL80211_RRF_NO_HE = 1<<17, + NL80211_RRF_PSD = 1<<18, }; #define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR From patchwork Fri Aug 20 12:20:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Gong X-Patchwork-Id: 501266 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BE8AC4320A for ; Fri, 20 Aug 2021 12:21:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 12F5460F45 for ; Fri, 20 Aug 2021 12:21:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240587AbhHTMVw (ORCPT ); Fri, 20 Aug 2021 08:21:52 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:45228 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240586AbhHTMVv (ORCPT ); Fri, 20 Aug 2021 08:21:51 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1629462073; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=RTUiezN9FbKIsshyxNe23rZMeP1NaJDLEYiD0lv96m4=; b=G+EtpBXFz6rNBiU1GhT7OifYQ75UIaq8TgptuGF+rZqKSdp2ZI6O0PWlGxSkIs6zbrHesZP+ QItJyMCzu8+CI+HYpKzOFynYBAFtrWF6MwZSdZv54jxMcRU1LDcE2JfI6MHI7W/dsdP92kOt SvFoekg5rclD8YVy/PfIWn5AoWo= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n06.prod.us-east-1.postgun.com with SMTP id 611f9e2989fbdf3ffe7b8de8 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 20 Aug 2021 12:20:57 GMT Sender: wgong=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 9404FC4360C; Fri, 20 Aug 2021 12:20:56 +0000 (UTC) Received: from wgong-HP3-Z230-SFF-Workstation.qca.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: wgong) by smtp.codeaurora.org (Postfix) with ESMTPSA id E2EF4C4360D; Fri, 20 Aug 2021 12:20:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org E2EF4C4360D Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org From: Wen Gong To: johannes@sipsolutions.net, ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, wgong@codeaurora.org Subject: [PATCH v2 5/8] cfg80211: save power spectral density(psd) of regulatory rule Date: Fri, 20 Aug 2021 08:20:38 -0400 Message-Id: <20210820122041.12157-6-wgong@codeaurora.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210820122041.12157-1-wgong@codeaurora.org> References: <20210820122041.12157-1-wgong@codeaurora.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- 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; } From patchwork Fri Aug 20 12:20:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wen Gong X-Patchwork-Id: 500817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A261C4338F for ; Fri, 20 Aug 2021 12:21:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E3F260F45 for ; Fri, 20 Aug 2021 12:21:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240508AbhHTMVj (ORCPT ); Fri, 20 Aug 2021 08:21:39 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:14158 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240522AbhHTMVh (ORCPT ); Fri, 20 Aug 2021 08:21:37 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1629462060; h=Content-Transfer-Encoding: Content-Type: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=FWAdQvk77qrO6Tl6VfjrO/jDpGXvuqY5rxBG+Qw/HHI=; b=dfoIXuiWQ+ZQa6cTaO6ORTTpqIHZ9TVcbBC02bKuqW1jzfLXWQSSmGwfJssqmoLBv5ExeNVY jNkgeZHeyQVz+8mTdjMfJznQAwf608myKsOTeuSiq0++2HYDTqDPbHXdA6C/hGM/FTtP0O4P i+5VTl3SvqCGwJv72wr0m36KbN4= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-east-1.postgun.com with SMTP id 611f9e2a89fbdf3ffe7b9398 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 20 Aug 2021 12:20:58 GMT Sender: wgong=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 183F5C43618; Fri, 20 Aug 2021 12:20:58 +0000 (UTC) Received: from wgong-HP3-Z230-SFF-Workstation.qca.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: wgong) by smtp.codeaurora.org (Postfix) with ESMTPSA id 7EDD2C43616; Fri, 20 Aug 2021 12:20:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 7EDD2C43616 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org From: Wen Gong To: johannes@sipsolutions.net, ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, wgong@codeaurora.org Subject: [PATCH v2 6/8] mac80211: add definition for transmit power envelope element Date: Fri, 20 Aug 2021 08:20:39 -0400 Message-Id: <20210820122041.12157-7-wgong@codeaurora.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210820122041.12157-1-wgong@codeaurora.org> References: <20210820122041.12157-1-wgong@codeaurora.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- 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, From patchwork Fri Aug 20 12:20:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Gong X-Patchwork-Id: 501267 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5616BC4338F for ; Fri, 20 Aug 2021 12:21:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D9A460FE6 for ; Fri, 20 Aug 2021 12:21:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240554AbhHTMVk (ORCPT ); Fri, 20 Aug 2021 08:21:40 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:53290 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240329AbhHTMVj (ORCPT ); Fri, 20 Aug 2021 08:21:39 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1629462061; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=JsGCfZQIQ3Z0P9pypU2AKrMWSoy/ba8cpre//PAvbvU=; b=s/Oe+4yUVfUeSFKd7spHgltPZ1n2H7m8GkqJPD0N1Etzdk5L8h82OZzzTleEiUHLYHONM5Uw T8lND70pbH8WBaK29uWjP9dIHH9NKzZOn92DHhMzGR50a9ED0cLgnWw4z4ZzenkBCHkmh7L4 pnBSuj02EaSPmpJP0wPcM1gXSQk= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-east-1.postgun.com with SMTP id 611f9e2c89fbdf3ffe7b9ac6 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 20 Aug 2021 12:21:00 GMT Sender: wgong=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id B6159C43616; Fri, 20 Aug 2021 12:20:59 +0000 (UTC) Received: from wgong-HP3-Z230-SFF-Workstation.qca.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: wgong) by smtp.codeaurora.org (Postfix) with ESMTPSA id 13FD0C4338F; Fri, 20 Aug 2021 12:20:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 13FD0C4338F Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org From: Wen Gong To: johannes@sipsolutions.net, ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, wgong@codeaurora.org Subject: [PATCH v2 7/8] mac80211: add parse transmit power envelope element Date: Fri, 20 Aug 2021 08:20:40 -0400 Message-Id: <20210820122041.12157-8-wgong@codeaurora.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210820122041.12157-1-wgong@codeaurora.org> References: <20210820122041.12157-1-wgong@codeaurora.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- 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, From patchwork Fri Aug 20 12:20:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Gong X-Patchwork-Id: 500815 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A39FC4320A for ; Fri, 20 Aug 2021 12:21:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 84EE260F45 for ; Fri, 20 Aug 2021 12:21:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239917AbhHTMWB (ORCPT ); Fri, 20 Aug 2021 08:22:01 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:53290 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240613AbhHTMV5 (ORCPT ); Fri, 20 Aug 2021 08:21:57 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1629462079; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=x/Cgq183T9f89XOOcwri40VOSTuVlC/dB43M5oaeiNc=; b=rDH0GxiEaYjkJPldProZUbwBGhx8d8sZQ1k2I8d0cCWgmRpHyhIxh4o1xxHtpqib+kcJXRAB OxbCE4rcSKq5LQ5xj/C5qMEo0+TD9jilVLte/lnFmJsfPj0C9SYAe/AT6ZylJ4eitv/caqRN yz+fFWt0kQ7xW3uMBe6O+ZOdv7s= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n07.prod.us-east-1.postgun.com with SMTP id 611f9e2d0f9b337f11cd3ab6 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 20 Aug 2021 12:21:01 GMT Sender: wgong=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 4FE75C43460; Fri, 20 Aug 2021 12:21:01 +0000 (UTC) Received: from wgong-HP3-Z230-SFF-Workstation.qca.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: wgong) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9CEC0C43460; Fri, 20 Aug 2021 12:20:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 9CEC0C43460 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org From: Wen Gong To: johannes@sipsolutions.net, ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, wgong@codeaurora.org Subject: [PATCH v2 8/8] mac80211: save transmit power envelope element and power constraint Date: Fri, 20 Aug 2021 08:20:41 -0400 Message-Id: <20210820122041.12157-9-wgong@codeaurora.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210820122041.12157-1-wgong@codeaurora.org> References: <20210820122041.12157-1-wgong@codeaurora.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This is to save the transmit power envelope element and power constraint in struct ieee80211_bss_conf for 6 GHz. Lower driver will use this info to calculate the power limit. Signed-off-by: Wen Gong --- include/net/mac80211.h | 6 ++++++ net/mac80211/chan.c | 9 +++++++++ net/mac80211/mlme.c | 26 ++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index e89530d0d9c6..6e11e122e364 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -631,6 +631,9 @@ struct ieee80211_fils_discovery { * @s1g: BSS is S1G BSS (affects Association Request format). * @beacon_tx_rate: The configured beacon transmit rate that needs to be passed * to driver when rate control is offloaded to firmware. + * @tx_pwr_env: transmit power envelope array of BSS. + * @tx_pwr_env_num: number of @tx_pwr_env. + * @pwr_reduction: power constraint of BSS. */ struct ieee80211_bss_conf { const u8 *bssid; @@ -700,6 +703,9 @@ struct ieee80211_bss_conf { u32 unsol_bcast_probe_resp_interval; bool s1g; struct cfg80211_bitrate_mask beacon_tx_rate; + struct ieee80211_tx_pwr_env tx_pwr_env[IEEE80211_TPE_MAX_IE_COUNT]; + u8 tx_pwr_env_num; + u8 pwr_reduction; }; /** diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 907bb1f748a1..149d4ac798f6 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -721,6 +721,15 @@ static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata, lockdep_is_held(&local->chanctx_mtx)); if (conf) { + if (conf->def.chan->band == NL80211_BAND_6GHZ) { + struct ieee80211_bss_conf *bss_conf; + + bss_conf = &sdata->vif.bss_conf; + bss_conf->pwr_reduction = 0; + bss_conf->tx_pwr_env_num = 0; + memset(bss_conf->tx_pwr_env, 0, sizeof(bss_conf->tx_pwr_env)); + } + curr_ctx = container_of(conf, struct ieee80211_chanctx, conf); drv_unassign_vif_chanctx(local, sdata, curr_ctx); diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 2480bd0577bb..a6d66b4ad7ee 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -5070,6 +5070,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE)) { const struct cfg80211_bss_ies *ies; + struct ieee80211_bss_conf *bss_conf; const u8 *he_oper_ie; ies = rcu_dereference(cbss->ies); @@ -5081,6 +5082,31 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, else he_oper = NULL; + if (is_6ghz) { + struct ieee802_11_elems elems; + u8 i, j = 0; + + ieee802_11_parse_elems(ies->data, ies->len, false, &elems, + NULL, NULL); + + if (elems.pwr_constr_elem) + bss_conf->pwr_reduction = *elems.pwr_constr_elem; + + BUILD_BUG_ON(ARRAY_SIZE(bss_conf->tx_pwr_env) != + ARRAY_SIZE(elems.tx_pwr_env)); + + for (i = 0; i < elems.tx_pwr_env_num; i++) { + if (elems.tx_pwr_env_len[i] > + sizeof(bss_conf->tx_pwr_env[j])) + continue; + + bss_conf->tx_pwr_env_num++; + memcpy(&bss_conf->tx_pwr_env[j], elems.tx_pwr_env[i], + elems.tx_pwr_env_len[i]); + j++; + } + } + if (!ieee80211_verify_sta_he_mcs_support(sband, he_oper)) ifmgd->flags |= IEEE80211_STA_DISABLE_HE; }