From patchwork Tue Oct 19 16:25:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You-Sheng Yang X-Patchwork-Id: 1543524 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HYfL35WT4z9sR4 for ; Wed, 20 Oct 2021 03:27:55 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1mcrxq-0007mR-FQ; Tue, 19 Oct 2021 16:27:46 +0000 Received: from mail-pg1-f170.google.com ([209.85.215.170]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mcrx6-0006sB-1k for kernel-team@lists.ubuntu.com; Tue, 19 Oct 2021 16:27:00 +0000 Received: by mail-pg1-f170.google.com with SMTP id e65so17448284pgc.5 for ; Tue, 19 Oct 2021 09:26:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dQV0g8obz+l4M20Lc8PVCMrFsujLh0mix8tAsbILlgw=; b=a+w6cYqssJHwc7UuKZ4GLRMc0EZdcq/3mZL3pu/Y1gHK9lEBIYXUydEBCeqQxhYMZ1 wPcAaDitRp15YEiBwI0IojaQjf8M2SDgM9r1IdqkacU0RSjjin2Ivs5sOLqV3CyVo54y rGe0ulGsAzvpv/WIUMn8Oz4uFPMd0M/rlbQH60f8FUhTCIRFTqnr8kVKUK1/vVEKq8x0 yklSv84o2QL7rZehvXAh3Tp+XuQk8mfgIPfumDH6X30eG3rVoZVa5v6Uxyu1edgX2vEN dPXqgwynHd6XBckdaAIOP3UWfM97TbGt4e4zlQR1keDAVhRDHvJj/93wp9tzZloO7KOP Lm8g== X-Gm-Message-State: AOAM531RiPncw2F1gpZkx8A9vgn2cMFWvest2dTRB59Hn1AVxLdokXHW eKfuKlIOM0T2Mvo2XdufB1noex0mm+g= X-Google-Smtp-Source: ABdhPJystbBK5RLgaig9/25ed25sGjOVGalNbHgL8rMJ3FIS/JO8rBClXL1bkLJ3g1Su7c7U3RLvUw== X-Received: by 2002:a63:d64c:: with SMTP id d12mr29911221pgj.186.1634660802459; Tue, 19 Oct 2021 09:26:42 -0700 (PDT) Received: from localhost (220-142-196-159.dynamic-ip.hinet.net. [220.142.196.159]) by smtp.gmail.com with ESMTPSA id g11sm16338819pgn.41.2021.10.19.09.26.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Oct 2021 09:26:41 -0700 (PDT) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH 29/33][SRU][OEM-5.13] mac80211: save transmit power envelope element and power constraint Date: Wed, 20 Oct 2021 00:25:44 +0800 Message-Id: <20211019162548.1408217-30-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211019162548.1408217-1-vicamo.yang@canonical.com> References: <20211019162548.1408217-1-vicamo.yang@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.215.170; envelope-from=vicamo@gmail.com; helo=mail-pg1-f170.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Wen Gong BugLink: https://bugs.launchpad.net/bugs/1939528 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 Link: https://lore.kernel.org/r/20210924100052.32029-7-wgong@codeaurora.org Signed-off-by: Johannes Berg (backported from commit 63214f02cff9ebd57be00e143de12107c66f5394) Signed-off-by: You-Sheng Yang --- include/net/mac80211.h | 6 ++++++ net/mac80211/mlme.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 9b4525f7be98c..ed4556c8d45e4 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -632,6 +632,9 @@ struct ieee80211_fils_discovery { * @beacon_tx_rate: The configured beacon transmit rate that needs to be passed * to driver when rate control is offloaded to firmware. * @power_type: power type of BSS for 6 GHz + * @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; @@ -702,6 +705,9 @@ struct ieee80211_bss_conf { bool s1g; struct cfg80211_bitrate_mask beacon_tx_rate; enum ieee80211_ap_reg_power power_type; + 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/mlme.c b/net/mac80211/mlme.c index da51e574880f0..3695d2d96176f 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -2334,6 +2334,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, { struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; struct ieee80211_local *local = sdata->local; + struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; u32 changed = 0; struct ieee80211_prep_tx_info info = { .subtype = stype, @@ -2483,6 +2484,10 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, cancel_delayed_work_sync(&ifmgd->tx_tspec_wk); sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM; + + 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)); } static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata) @@ -5122,6 +5127,30 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE)) { he_oper = elems->he_operation; + if (is_6ghz) { + struct ieee80211_bss_conf *bss_conf; + u8 i, j = 0; + + bss_conf = &sdata->vif.bss_conf; + + 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; }