Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2148146lqb; Mon, 27 May 2024 09:17:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUYJUS8+o1NaKAYd5ZExa4kj33k0VWGQzZQQBDLtmBvNpJ4yGeB84/rW38McQi5QKpDmK0cdI99RYhMI1ybd1Wp62t5VVYmqIE/7pDEDg== X-Google-Smtp-Source: AGHT+IE4h0YqT/mXLGUE3Vm59S4uXZgLfJty1/lZ69eFyd+aQne0dhIVmg0rHIYe7kdX912/1Yii X-Received: by 2002:a17:906:abd0:b0:a5a:896f:9be0 with SMTP id a640c23a62f3a-a62642eb70bmr753823866b.27.1716826629028; Mon, 27 May 2024 09:17:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716826629; cv=pass; d=google.com; s=arc-20160816; b=PysluhtBl8vRNll2JD/f+PFxCkjQ/hVj26EXWWfO3NrUpD2RxOD36gQb1PFhF1rJF7 8F4qER1jeqwFY+Tb6QmUBt/oM8+Tx8+PH46FAnm42rqbGGiZ4ZEZbZOchvZPr0sem1CY NaicfL5/Qt5lF2NZMyoDj6YI3TcC2xp0H8MDzGuWlWDerQDPWj5pYQ3/ellY/Ee96dny 72LmrpCA5QV5IanCGGePLXj53yChwZn9aoE3MQ9Uhg62VmPoDQUdhjIzMjenbZkQc+6p sB2w4Lpa6UWDReDyeVXXCXgL5JHrJEmqsIhjMy/57QoB2AZg7qZKZ2bHVSLNiyvnLb5P QxNw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:organization:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=SJZ0aZfeYIU63gKZiOleI8lZgjbUOFD6EGaRevsQ9hg=; fh=ztwkw9qk9c2heXYYrLSTMVfalpED2aAY+AsJka3nW4o=; b=UcZ5oPACG0pWQ0bP30eP2XWZfvjEX18GdJEYUVm5bdDq7XPOp/mdLVfG1fIhFlTbP7 3Ddjduh6Y/G4e/X6Q8Pj65AsfBvbftGAfqbwM4S26JwB7gMiNjj0fFFrDu4rmBsr1seS 96CaN41n2CaFYwxGmaSOoVrY69LQ0fK9doiLtw7HQIYlb/NeYV3SFDcLBLDP6NoRIkCw nsB+ZY4bTnPqVOLTP+YZRJzo1ROSTmuDNjDvRvG9K1PMDF8JuOODEZpkB8YGTb2iom5N EYyCOaW27Hf9H77FwjRiOa3YWdqWW4yUBziOrXGomyMwhZlPiF9/WEiDw8vmFueIxWgV O1NA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SrAe79Y0; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-wireless+bounces-8120-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8120-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a626cd9013asi394245666b.740.2024.05.27.09.17.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 09:17:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8120-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SrAe79Y0; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-wireless+bounces-8120-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8120-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 981EA1F2156D for ; Mon, 27 May 2024 16:17:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2DFA615A874; Mon, 27 May 2024 16:06:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SrAe79Y0" X-Original-To: linux-wireless@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 660E715D5D2 for ; Mon, 27 May 2024 16:06:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716825995; cv=none; b=CZuFm8DA2oUIP/8+vQQBbTwUtWC/QmdxZqgdogn7UpF/rkt0w/a+fDKHIHq9dR6jfG2Bg8doaZiE95e/do0dXob36lxX7cusX8GR9eYOtd9qVyjM9xJ0V/hLwlMY2sTnpiWZHDqKF6bvCk7WCgc61And/IHb8gG0/T4u9Dm0S3U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716825995; c=relaxed/simple; bh=c4GBhdjRv1DldMu0+bvicmxHq/r6v+Y95sJs0PPz5/U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=g2i9lPA8iNikgQpEtFwse/5isfEgvLMNnuinR8n6TdMtpMESO0IpV89i4cqYzVbiK8VonWL+i11Gi7AnPR39BkHDAr1XkbhHfq8/TaFrEdzFqDxQqkj4azVTGeURpWzJb33wyNhEnvXN1AHo1aWrlObv3k/FZOEz3mwA2/ztfkc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=SrAe79Y0; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716825994; x=1748361994; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=c4GBhdjRv1DldMu0+bvicmxHq/r6v+Y95sJs0PPz5/U=; b=SrAe79Y0u2IbDfrkxHK/kEVyUbNn/Dpbo4zi9S3E8OQC0xITimMdIOcH 0FsZKEaAxLuzH2vpp2StCSNIirK/QmhTcyczXFpRtsHASNvcylMNx34Km c4sQEsxCC27ti2Wfk2UE8z3q3AZy6Kn7NXpcZzKJOAJvT3vcJxJ3pMO8Z JiBsp9hnc8bc/75KwhTSWm7B+nx1TQYHkX2dFv4HupBY8pMeI1I7Be7ch KhdMjakqGQPOK5A3Zw2HrG5kWOL2yx6TF4PsRI6M48xNFmhE7NSCEi2Mx u/w7d5tBLeYNDUk+Y1uWtYIV0uf24/poN7OWg6g/NkgbckeRMWRkq3F6I A==; X-CSE-ConnectionGUID: qcAB4I0ZQtS/CWvSJWhv8A== X-CSE-MsgGUID: IFqX0KcESYKhCVQvRZXiew== X-IronPort-AV: E=McAfee;i="6600,9927,11085"; a="13002079" X-IronPort-AV: E=Sophos;i="6.08,193,1712646000"; d="scan'208";a="13002079" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2024 09:06:34 -0700 X-CSE-ConnectionGUID: 9OQxxAzkQb2WOYYwcIOq2Q== X-CSE-MsgGUID: d7kItj29TNShBdzXcE47RA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,193,1712646000"; d="scan'208";a="35407088" Received: from weis0040.iil.intel.com ([10.12.217.108]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2024 09:06:32 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg , Mukesh Sisodiya Subject: [PATCH 06/20] wifi: iwlwifi: mvm: handle TPE advertised by AP Date: Mon, 27 May 2024 19:06:01 +0300 Message-Id: <20240527190228.32f1e2e1447c.I58ac91c38585362aa42bb4a8a59c7d88e67bc40b@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527160615.1549563-1-miriam.rachel.korenblit@intel.com> References: <20240527160615.1549563-1-miriam.rachel.korenblit@intel.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Israel (74) Limited Content-Transfer-Encoding: 8bit From: Johannes Berg 6 GHz BSS SP client shall respect TX power limits advertised by the AP in TPE elements, send the data to the firmware using the AP_TX_POWER_CONSTRAINTS_CMD command, so do that. Co-developed-by: Mukesh Sisodiya Signed-off-by: Mukesh Sisodiya Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 11 ++++ .../wireless/intel/iwlwifi/mvm/mld-mac80211.c | 55 ++++++++++++++++--- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 6 ++ 3 files changed, 63 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 752fdb6a783f..88bc0baabf7e 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -2768,6 +2768,13 @@ iwl_mvm_bss_info_changed_station_common(struct iwl_mvm *mvm, if (changes & BSS_CHANGED_BANDWIDTH) iwl_mvm_update_link_smps(vif, link_conf); + + if (changes & BSS_CHANGED_TPE) { + IWL_DEBUG_CALIB(mvm, "Changing TPE\n"); + iwl_mvm_send_ap_tx_power_constraint_cmd(mvm, vif, + link_conf, + false); + } } static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, @@ -5122,6 +5129,10 @@ static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm, } iwl_mvm_update_quotas(mvm, false, NULL); + + iwl_mvm_send_ap_tx_power_constraint_cmd(mvm, vif, + link_conf, + false); } goto out; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c index 00433d1c8564..b2b6dbdcc44f 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c @@ -345,6 +345,11 @@ __iwl_mvm_mld_assign_vif_chanctx(struct iwl_mvm *mvm, rcu_read_unlock(); } + if (vif->type == NL80211_IFTYPE_STATION) + iwl_mvm_send_ap_tx_power_constraint_cmd(mvm, vif, + link_conf, + false); + /* then activate */ ret = iwl_mvm_link_changed(mvm, vif, link_conf, LINK_CONTEXT_MODIFY_ACTIVE | @@ -524,9 +529,37 @@ static void iwl_mvm_mld_unassign_vif_chanctx(struct ieee80211_hw *hw, } static void +iwl_mvm_tpe_sta_cmd_data(struct iwl_txpower_constraints_cmd *cmd, + const struct ieee80211_bss_conf *bss_info) +{ + u8 i; + + /* + * NOTE: the 0 here is IEEE80211_TPE_CAT_6GHZ_DEFAULT, + * we fully ignore IEEE80211_TPE_CAT_6GHZ_SUBORDINATE + */ + + BUILD_BUG_ON(ARRAY_SIZE(cmd->psd_pwr) != + ARRAY_SIZE(bss_info->tpe.psd_local[0].power)); + + /* if not valid, mac80211 puts default (max value) */ + for (i = 0; i < ARRAY_SIZE(cmd->psd_pwr); i++) + cmd->psd_pwr[i] = min(bss_info->tpe.psd_local[0].power[i], + bss_info->tpe.psd_reg_client[0].power[i]); + + BUILD_BUG_ON(ARRAY_SIZE(cmd->eirp_pwr) != + ARRAY_SIZE(bss_info->tpe.max_local[0].power)); + + for (i = 0; i < ARRAY_SIZE(cmd->eirp_pwr); i++) + cmd->eirp_pwr[i] = min(bss_info->tpe.max_local[0].power[i], + bss_info->tpe.max_reg_client[0].power[i]); +} + +void iwl_mvm_send_ap_tx_power_constraint_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf) + struct ieee80211_bss_conf *bss_conf, + bool is_ap) { struct iwl_txpower_constraints_cmd cmd = {}; struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); @@ -546,19 +579,22 @@ iwl_mvm_send_ap_tx_power_constraint_cmd(struct iwl_mvm *mvm, link_info->fw_link_id == IWL_MVM_FW_LINK_ID_INVALID) return; - if (bss_conf->chanreq.oper.chan->band != NL80211_BAND_6GHZ || - bss_conf->chanreq.oper.chan->flags & - IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT) + if (bss_conf->chanreq.oper.chan->band != NL80211_BAND_6GHZ) return; cmd.link_id = cpu_to_le16(link_info->fw_link_id); - /* - * Currently supporting VLP Soft AP only. - */ - cmd.ap_type = cpu_to_le16(IWL_6GHZ_AP_TYPE_VLP); memset(cmd.psd_pwr, DEFAULT_TPE_TX_POWER, sizeof(cmd.psd_pwr)); memset(cmd.eirp_pwr, DEFAULT_TPE_TX_POWER, sizeof(cmd.eirp_pwr)); + if (is_ap) { + cmd.ap_type = cpu_to_le16(IWL_6GHZ_AP_TYPE_VLP); + } else if (bss_conf->power_type == IEEE80211_REG_UNSET_AP) { + return; + } else { + cmd.ap_type = cpu_to_le16(bss_conf->power_type - 1); + iwl_mvm_tpe_sta_cmd_data(&cmd, bss_conf); + } + ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(PHY_OPS_GROUP, AP_TX_POWER_CONSTRAINTS_CMD), @@ -580,7 +616,8 @@ static int iwl_mvm_mld_start_ap_ibss(struct ieee80211_hw *hw, guard(mvm)(mvm); if (vif->type == NL80211_IFTYPE_AP) - iwl_mvm_send_ap_tx_power_constraint_cmd(mvm, vif, link_conf); + iwl_mvm_send_ap_tx_power_constraint_cmd(mvm, vif, + link_conf, true); /* Send the beacon template */ ret = iwl_mvm_mac_ctxt_beacon_changed(mvm, vif, link_conf); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index f3d9b8355c6b..9b939225990a 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -2962,4 +2962,10 @@ iwl_mvm_bt_coex_calculate_esr_mode(struct iwl_mvm *mvm, bool primary); int iwl_mvm_esr_non_bss_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, unsigned int link_id, bool active); + +void +iwl_mvm_send_ap_tx_power_constraint_cmd(struct iwl_mvm *mvm, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *bss_conf, + bool is_ap); #endif /* __IWL_MVM_H__ */ -- 2.34.1