From patchwork Mon May 6 07:04:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13654983 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 2698D4F88E for ; Mon, 6 May 2024 07:04:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979072; cv=none; b=CriG9jHhk5InVgw0PwjHBgjnveXYDRroAlO+UJlzuDtHbFDyGOh5GgMP6V/30BCssgcARg3ire5aDZvfWjJnT6MFuTJ21yiYgbtH1ASZb10oKvKp0E0UwifpXpH64nOkHPmkRF2UulORUj9X7STLpCo11rTj9MAc9ua8uCxy2v0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979072; c=relaxed/simple; bh=ZLoTURKTxY74alA2+UqptR0K2hc7FGiSBgbZayJb6aA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Tw9mlqZhFShjZ9KAD8dfrN14j8OuOI8WhBcN23KcEUL2FxqUtT8fwSL8Gp3lhGul8ZURv1TxIeQ5BW/bXZ2Pjmn4yBFaAtRv9zW3iu9zrSxrDVYtEhIyiMMh+BLZ9ovP1QBVSEfxa4ZmRGQ9Hd7drkWr6w671x6weINxWa/GX24= 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=BEnuNCKP; arc=none smtp.client-ip=198.175.65.21 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BEnuNCKP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714979071; x=1746515071; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZLoTURKTxY74alA2+UqptR0K2hc7FGiSBgbZayJb6aA=; b=BEnuNCKPISwHQgFufbUOnLYF7Q76yOwqX6SCJIa9RrKOc1qzrA+xbGds ZYFU4XYGdckyInHA6EZHast9X1PBVpIOLgnMOjZZRDmFRlXxWc95WmlS+ DBjIOcsWwhtVQu1dXbj3/eIKWP9hqPRQiLSGCJRGmHcWDVOEUf4iwrNHW Ke+8FT0cGslfKx4YPJme4b3lrxNXBLtkeFKNOOZHN/8v2yQPFVd1esVnL J7OtArEpeRKbHogCpXQis27jhaLwNdIFTPtXxep2R8CD01MaO9utKIWsE hG5vfO5LvFA48Ial/f9fyqv2JGJUFsmTXzQLcGpHoknF3qN9DmnZGUrfZ A==; X-CSE-ConnectionGUID: +J7JuTGkQNWo3v6ee119Kg== X-CSE-MsgGUID: dFJKzMLnTFa2XLExJWWMjA== X-IronPort-AV: E=McAfee;i="6600,9927,11064"; a="10638136" X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="10638136" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:30 -0700 X-CSE-ConnectionGUID: pJU3m0HMS9SQfkX+1PQmZg== X-CSE-MsgGUID: UpRc3/37TxuJu8U2MK6AOw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="59264837" Received: from weis0040.iil.intel.com ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:28 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 01/15] wifi: iwlwifi: mvm: use already determined cmd_id Date: Mon, 6 May 2024 10:04:05 +0300 Message-Id: <20240506095953.f894ede03b26.I18f03c272b1c0807767f2713f3ffbb2941c57d9b@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506070419.1821330-1-miriam.rachel.korenblit@intel.com> References: <20240506070419.1821330-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 From: Johannes Berg In iwl_mvm_rs_fw_rate_init() we have a variable cmd_id that holds the command ID, so we can just use that instead of the various calculations of it. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c index 00860feefa7a..3ba62fb2c85e 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c @@ -654,10 +654,7 @@ void iwl_mvm_rs_fw_rate_init(struct iwl_mvm *mvm, */ sta->deflink.agg.max_amsdu_len = max_amsdu_len; - cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, - WIDE_ID(DATA_PATH_GROUP, - TLC_MNG_CONFIG_CMD), - 0); + cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 0); IWL_DEBUG_RATE(mvm, "TLC CONFIG CMD, sta_id=%d, max_ch_width=%d, mode=%d\n", cfg_cmd.sta_id, cfg_cmd.max_ch_width, cfg_cmd.mode); IWL_DEBUG_RATE(mvm, "TLC CONFIG CMD, chains=0x%X, ch_wid_supp=%d, flags=0x%X\n", @@ -693,9 +690,7 @@ void iwl_mvm_rs_fw_rate_init(struct iwl_mvm *mvm, u16 cmd_size = sizeof(cfg_cmd_v3); /* In old versions of the API the struct is 4 bytes smaller */ - if (iwl_fw_lookup_cmd_ver(mvm->fw, - WIDE_ID(DATA_PATH_GROUP, - TLC_MNG_CONFIG_CMD), 0) < 3) + if (iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 0) < 3) cmd_size -= 4; ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, CMD_ASYNC, cmd_size, From patchwork Mon May 6 07:04:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13654984 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 97D68524AE for ; Mon, 6 May 2024 07:04:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979073; cv=none; b=QT6mg9qNPD+dpsK4K3baFTIo8gP16+bzame+Dmh7fyHmr+ZJKguFJtf+STCa3J5E9Y2tWWoPTHNl0Mm5J84Tungt6aEWIZUc+3N3hOmt3/OTkFan6EnUBLN98+N6WuhrNURfYxBIp1zygg+cMDhEGiG2kdzS/wLxxwpOq8gO0ws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979073; c=relaxed/simple; bh=Hi4BDeSPRAiODk56O95/3/fxkoo18zgixTcnLoXqqUI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Y+TdlVB66F2f4xNRygMUbSQXZ6Z55qbsY6d8uvesb7LJp/iqG9IwCJfS/HY8C9XxQwkWgVgM9xJp2cnAHdRB371QF6CLtIF7lPapaedRt8+I+clxhUPgoemgGonJbpvxrz2Yb6lMgKXJfIoNezgcnur/Y5I363anYMljBHhojWI= 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=bgOasywn; arc=none smtp.client-ip=198.175.65.21 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bgOasywn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714979072; x=1746515072; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Hi4BDeSPRAiODk56O95/3/fxkoo18zgixTcnLoXqqUI=; b=bgOasywnOV8s3n9nUoS5vStcxQ6NjXT2Kt6yApxJkd4bIQxhUMV0/6d+ TV9ScHwsXsB2ZrZAPX8ZAYrb2ry0oKT+GSOxkyq8BPhshA7S9OsFRnvvs 3ezq8Oj2yup9YO02SVUfIjgquFQkoI1RFGdfGo03ViiCxVWmqmOBO5Qon zYYZ+f3Xc3QlkhCO6Pp3mPLnfBkWAjVlyQsNUa/JXcIOOWS8bJ38FOrat ++eiNqhQUgvQ4u00WWIMVzdaO/u7j136sBeWIzHdnGbv71VnKjcDxclOs iyPMuoqhghtykBFPEqpa//ipaGTm6n73hDCi4jobC7JVX+3RlhRXalT91 Q==; X-CSE-ConnectionGUID: hv+6SW5WSG2rLazD7Tkt6A== X-CSE-MsgGUID: Ajg2Lp5tQMOXjbzXQNK2fQ== X-IronPort-AV: E=McAfee;i="6600,9927,11064"; a="10638153" X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="10638153" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:32 -0700 X-CSE-ConnectionGUID: yVqy1g7JRmi9gUCVFIqNlA== X-CSE-MsgGUID: ERNn4i8wRA+yLmTOYAHvmw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="59264867" Received: from weis0040.iil.intel.com ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:30 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 02/15] wifi: iwlwifi: mvm: fix primary link setting Date: Mon, 6 May 2024 10:04:06 +0300 Message-Id: <20240506095953.779bf6949053.Ia9297991ff2fdc82ae7c730e0069e2dd6e5f2902@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506070419.1821330-1-miriam.rachel.korenblit@intel.com> References: <20240506070419.1821330-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 mvmvif::primary link holds the ID and not a bitmap. Fix this Fixes: 07bf5297d392 ("wifi: iwlwifi: mvm: Implement new link selection algorithm") Signed-off-by: Miri Korenblit Reviewed-by: Johannes Berg --- drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c index bceafd551e8f..0a3b7284eedd 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c @@ -1212,7 +1212,7 @@ iwl_mvm_mld_change_vif_links(struct ieee80211_hw *hw, * Ensure we always have a valid primary_link, the real * decision happens later when PHY is activated. */ - mvmvif->primary_link = BIT(__ffs(new_links)); + mvmvif->primary_link = __ffs(new_links); } out_err: From patchwork Mon May 6 07:04:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13654985 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 5908B5338C for ; Mon, 6 May 2024 07:04:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979075; cv=none; b=SOgpCwY1lraTz0IZykMDjj3AbHaJRBAsl6i18L05zMm48tNI71Y7mBjeXUj8TZFyFgAmURf8OMWDheBQrALm0yzoqiP/4XRfiRq6/Jed53oWLH6QXBlVKX51G8OfkcoQsuKh8GO+Kq5HlEnIYEXYbo/14aYY78uG3A4tTPxIn7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979075; c=relaxed/simple; bh=enZ2varsg2W+zqST+fKjv9C0gYuntYzN0VElq7IDB6I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gaQnkpzu8okIOfiCvMHNwhbDXMthQUPKDw6eiXpThVlxGNiStvq2v0a4b2Ho5rxsQqcqvUxe4QuHouJ0rrSVRaEN+uIY6jbGj8Vqjp/WRszQ3hXrUaZXiEv1/ia5tdMehAM2z80lZBb7nimUkGrctcRgGiHSqfgDAMh6Udssxmc= 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=MDzjv9C9; arc=none smtp.client-ip=198.175.65.21 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MDzjv9C9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714979074; x=1746515074; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=enZ2varsg2W+zqST+fKjv9C0gYuntYzN0VElq7IDB6I=; b=MDzjv9C9D+j0KdMgbrPppRlEtfl41TCUGyUcpvCmf0LUxmMxXJlMSGkM C561JX2zIz8OgWHFlXMqaxLoS9wKyBzThd7mq1SKWWzTAE81KLK/6Gvhv GhD8Efr8+HsvlNbKi4GsetsB0ncXwEqSYJoB5q+P30bOxQn+jQ2tnhQog bOvK7CtZ67x56AkxPTfDhxom45InNUvXWbhxqKTn3ecZf5r1w8s54BtVz NxeXzVcggjPRRTSgwY1Y9Yz1bCzPOn+113zWy889E3VFKUWCo0yUtmKOi HLJ+UGWFvarXJGo+7MLkVpmGMxG5sobhV8NW0QhVCoPi97lC983dJU6gl Q==; X-CSE-ConnectionGUID: YjeMhZccRjCD9x0MlTRm4Q== X-CSE-MsgGUID: dkXfD22USISXVv/UZ5yrEg== X-IronPort-AV: E=McAfee;i="6600,9927,11064"; a="10638166" X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="10638166" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:34 -0700 X-CSE-ConnectionGUID: tWgr8WLARwamJOPF2NAjXA== X-CSE-MsgGUID: 9au8zrEAStO/9TFZj0VI2A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="59264876" Received: from weis0040.iil.intel.com ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:32 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org Subject: [PATCH 03/15] wifi: iwlwifi: bump FW API to 90 for BZ/SC devices Date: Mon, 6 May 2024 10:04:07 +0300 Message-Id: <20240506095953.4e4b19128b56.I2f9196191f1ea78e96e92f9db8ecb3cc9bbfd9b3@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506070419.1821330-1-miriam.rachel.korenblit@intel.com> References: <20240506070419.1821330-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 Start supporting API version 90 for new devices. Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/cfg/bz.c | 2 +- drivers/net/wireless/intel/iwlwifi/cfg/sc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/bz.c b/drivers/net/wireless/intel/iwlwifi/cfg/bz.c index 6c01859b4323..bc98b87cf2a1 100644 --- a/drivers/net/wireless/intel/iwlwifi/cfg/bz.c +++ b/drivers/net/wireless/intel/iwlwifi/cfg/bz.c @@ -10,7 +10,7 @@ #include "fw/api/txq.h" /* Highest firmware API version supported */ -#define IWL_BZ_UCODE_API_MAX 89 +#define IWL_BZ_UCODE_API_MAX 90 /* Lowest firmware API version supported */ #define IWL_BZ_UCODE_API_MIN 80 diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/sc.c b/drivers/net/wireless/intel/iwlwifi/cfg/sc.c index dbbcb2d0968c..9b79279fd76c 100644 --- a/drivers/net/wireless/intel/iwlwifi/cfg/sc.c +++ b/drivers/net/wireless/intel/iwlwifi/cfg/sc.c @@ -10,7 +10,7 @@ #include "fw/api/txq.h" /* Highest firmware API version supported */ -#define IWL_SC_UCODE_API_MAX 89 +#define IWL_SC_UCODE_API_MAX 90 /* Lowest firmware API version supported */ #define IWL_SC_UCODE_API_MIN 82 From patchwork Mon May 6 07:04:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13654986 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 6C8A85338C for ; Mon, 6 May 2024 07:04:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979077; cv=none; b=EJ6SkNb7AX93O5OS3XWEouFCBrF8oeHzaPRhNPj8vq1Bi1BhNtgM1D7QDHggEwCfg1xtuOFkZxGytZsLqfWjA4jOhA/D1cQOcAPkjdtes2XmD3q84c5D+pj12Z+QJEQmzQIn8mNoBV9rfYpJg7tMTkspfZ5PF20pfEApA9GCrsg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979077; c=relaxed/simple; bh=9+w4tbf2P1oZuyqL6uqj6BLPx+t2wTdP2J0hca9hB40=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VS18n8bCM4NIm4BRfXV4puexrRY1yy6Y7RiNZF1U6RKvEBPt8AU/cI6xVfRjimysxqID5nTktH3hpqtEruvoB1YkuiCV+FxX5L3G4nFTBXSoa8VQz6TEQKMtMFSBLOsuMHn3hUROXBuTLDhSBdhTfkx0wTayxKozJ89MuXDT6+U= 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=jxchMeI3; arc=none smtp.client-ip=198.175.65.21 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="jxchMeI3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714979077; x=1746515077; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9+w4tbf2P1oZuyqL6uqj6BLPx+t2wTdP2J0hca9hB40=; b=jxchMeI3k+ADrThQ1O24LF8D3Cma0WHDUjBK/ileb6eP86MXWo7rM6oI 0akD32coSCzaonq2Gvn4PXzBPkOkGA5BiU1r2+I35+u2gh5T1DJ4lXYNH PNBQ9+zL2BI72bXClUfm17HkH3du22QrH4OQQNVflV9HugfVe6VDAzSfF tu6D2e0yIRkRw/vxmnslymaMx2f1RUAyrfeKrbFmycybp7ldeKXw8hAbG SsrTWDcHBxQSZendYys9DiJ/aj7aty2cxqgqJZ0zlbbLxTIoEDwckjnKK bAXt8+fATs5XXAp3PpSRH9tayWG1HYOkTnE8SlVThw/I39IEow4mqHxXv g==; X-CSE-ConnectionGUID: /g7hRdcMQHWxv2tmCmedpw== X-CSE-MsgGUID: eX0ufEkPRCSRemDid+Cl3Q== X-IronPort-AV: E=McAfee;i="6600,9927,11064"; a="10638173" X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="10638173" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:36 -0700 X-CSE-ConnectionGUID: Hj0XpNv2T2awzG3Xgt9UGA== X-CSE-MsgGUID: dPAilluVS7KOZutT2/yGiw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="59264900" Received: from weis0040.iil.intel.com ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:34 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Yedidya Benshimol Subject: [PATCH 04/15] wifi: iwlwifi: mvm: Add active EMLSR blocking reasons prints Date: Mon, 6 May 2024 10:04:08 +0300 Message-Id: <20240506095953.1e34fe2c3e51.Ia7db0392d81818ceb70a7b199d3f5fa8a4ad198d@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506070419.1821330-1-miriam.rachel.korenblit@intel.com> References: <20240506070419.1821330-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 From: Yedidya Benshimol Upon adding/removing an EMLSR blocking reason add to the print the EMLSR disabling mask Signed-off-by: Yedidya Benshimol Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/link.c | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/link.c b/drivers/net/wireless/intel/iwlwifi/mvm/link.c index 8252b24b5aca..5c17120dcc2a 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/link.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/link.c @@ -33,6 +33,19 @@ static const char *iwl_get_esr_state_string(enum iwl_mvm_esr_state state) return iwl_mvm_esr_states_names[offs]; } +static void iwl_mvm_print_esr_state(struct iwl_mvm *mvm, u32 mask) +{ +#define NAME_FMT(x) "%s" +#define NAME_PR(x) (mask & IWL_MVM_ESR_##x) ? "[" #x "]" : "", + IWL_DEBUG_INFO(mvm, + "EMLSR state = " HANDLE_ESR_REASONS(NAME_FMT) + " (0x%x)\n", + HANDLE_ESR_REASONS(NAME_PR) + mask); +#undef NAME_FMT +#undef NAME_PR +} + static u32 iwl_mvm_get_free_fw_link_id(struct iwl_mvm *mvm, struct iwl_mvm_vif *mvm_vif) { @@ -708,16 +721,12 @@ iwl_mvm_esr_disallowed_with_link(struct ieee80211_vif *vif, if (conf->csa_active) ret |= IWL_MVM_ESR_EXIT_CSA; -#define NAME_FMT(x) "%s" -#define NAME_PR(x) (ret & IWL_MVM_ESR_##x) ? "[" #x "]" : "", - - if (ret) + if (ret) { IWL_DEBUG_INFO(mvm, - "Link %d is not allowed for esr. reason = " - HANDLE_ESR_REASONS(NAME_FMT) " (0x%x)\n", - link->link_id, - HANDLE_ESR_REASONS(NAME_PR) - ret); + "Link %d is not allowed for esr\n", + link->link_id); + iwl_mvm_print_esr_state(mvm, ret); + } return ret; } @@ -1016,10 +1025,12 @@ void iwl_mvm_block_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif, if (WARN_ON(!(reason & IWL_MVM_BLOCK_ESR_REASONS))) return; - if (!(mvmvif->esr_disable_reason & reason)) + if (!(mvmvif->esr_disable_reason & reason)) { IWL_DEBUG_INFO(mvm, "Blocking EMLSR mode. reason = %s (0x%x)\n", iwl_get_esr_state_string(reason), reason); + iwl_mvm_print_esr_state(mvm, mvmvif->esr_disable_reason); + } mvmvif->esr_disable_reason |= reason; @@ -1107,11 +1118,12 @@ void iwl_mvm_unblock_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif, if (!(mvmvif->esr_disable_reason & reason)) return; + mvmvif->esr_disable_reason &= ~reason; + IWL_DEBUG_INFO(mvm, "Unblocking EMLSR mode. reason = %s (0x%x)\n", iwl_get_esr_state_string(reason), reason); - - mvmvif->esr_disable_reason &= ~reason; + iwl_mvm_print_esr_state(mvm, mvmvif->esr_disable_reason); if (!mvmvif->esr_disable_reason) iwl_mvm_esr_unblocked(mvm, vif); From patchwork Mon May 6 07:04:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13654987 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 46725136E3B for ; Mon, 6 May 2024 07:04:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979079; cv=none; b=gINXho/T3QYsOCwkAYsske4vFfHASoyR7eU7UUt3BxbC67OBwUQTWMY2eDX8d+Bz6rYohi5MsxVYFxRsGMjaTQ+h/e4VXo6INKGQ8NjZ+5rgjhG7mSXZPVxzhE9qPw877eJcPxh1/WbPU7hlr/7mbzRz92/Ye1rGAZpxWYYy8mg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979079; c=relaxed/simple; bh=HFj3x3fBA4CPZUDwNEnBz8uTrLXThsh+3Yb3h+yY/O8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=D8t4S+TWUabKxZl4pyJCJVbH5kI11HADYz1Ixs0hyq9iU+8LfpbP3Z43p+/A/qXCKTYkmdPONcl47n5TCxHJp/2GJchw7wChBabyTnvEgtkhdoIdMGpZWxMWqxnst1cwaGkhfzKWeXOVt4FYDmJxATHkQPDiEQylJuw5cWYloPc= 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=XhGMvMKb; arc=none smtp.client-ip=198.175.65.21 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XhGMvMKb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714979079; x=1746515079; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HFj3x3fBA4CPZUDwNEnBz8uTrLXThsh+3Yb3h+yY/O8=; b=XhGMvMKbuPMYt3hhzoVEPIHJUrFZWFyMbUb7VpiTZ/Z2quksp4aFvs8J Z39w01Mtsr+pTFAkFo2pUinVbKkonRnrp+x2JjADFTsfEwmpewN+gxggC 6W0xAFp+fCo3lMvKnUHtq3ECQ9/O4FWdijNpoAWB/DEx4umCeHD3/Dbhd pc4urNkv4xerBBoCwstIItMaJDBPeM/Xe1y0yZ7qU896wh6GnJssJZG5l BWNpio6beyVFro2qwoj6iSl5ys5KYF4pStbtEwtYoB0xyVkEb1N89TbCh QKN6x9PGiKUYiQOYUrIlDP/SK671KpWAOikfmRcMI594+u5HPbeRj+wmw Q==; X-CSE-ConnectionGUID: 4HrTEQ+gQ6iYg8Q08KeqyA== X-CSE-MsgGUID: HgVeScmqQSCnMzNPvCUrkA== X-IronPort-AV: E=McAfee;i="6600,9927,11064"; a="10638180" X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="10638180" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:38 -0700 X-CSE-ConnectionGUID: J/P14oKwTdmlQbf6+O7fNw== X-CSE-MsgGUID: MAExFwNETn6NzxppqhNTVQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="59264908" Received: from weis0040.iil.intel.com ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:36 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Yedidya Benshimol , Johannes Berg Subject: [PATCH 05/15] wifi: iwlwifi: mvm: add a debugfs for reading EMLSR blocking reasons Date: Mon, 6 May 2024 10:04:09 +0300 Message-Id: <20240506095953.6d494a335e81.Ic0fa6a9636e3c1a3b1420e85e704a19d4a56e8d9@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506070419.1821330-1-miriam.rachel.korenblit@intel.com> References: <20240506070419.1821330-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 From: Yedidya Benshimol Add a reading for all active EMLSR blocking reasons for testing purposes. Signed-off-by: Yedidya Benshimol Reviewed-by: Johannes Berg Signed-off-by: Miri Korenblit --- .../wireless/intel/iwlwifi/mvm/debugfs-vif.c | 41 +++++++++++++++++-- drivers/net/wireless/intel/iwlwifi/mvm/link.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 + 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c index 213de638f132..17c97dfbc62a 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c @@ -722,8 +722,41 @@ static ssize_t iwl_dbgfs_int_mlo_scan_write(struct ieee80211_vif *vif, return ret ?: count; } -static ssize_t iwl_dbgfs_block_esr_write(struct ieee80211_vif *vif, char *buf, - size_t count, loff_t *ppos) +static ssize_t iwl_dbgfs_esr_disable_reason_read(struct file *file, + char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct ieee80211_vif *vif = file->private_data; + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); + struct iwl_mvm *mvm = mvmvif->mvm; + unsigned long esr_mask; + char *buf; + int bufsz, pos, i; + ssize_t rv; + + mutex_lock(&mvm->mutex); + esr_mask = mvmvif->esr_disable_reason; + mutex_unlock(&mvm->mutex); + + bufsz = hweight32(esr_mask) * 32 + 40; + buf = kmalloc(bufsz, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + pos = scnprintf(buf, bufsz, "EMLSR state: '0x%lx'\nreasons:\n", + esr_mask); + for_each_set_bit(i, &esr_mask, BITS_PER_LONG) + pos += scnprintf(buf + pos, bufsz - pos, " - %s\n", + iwl_get_esr_state_string(BIT(i))); + + rv = simple_read_from_buffer(user_buf, count, ppos, buf, pos); + kfree(buf); + return rv; +} + +static ssize_t iwl_dbgfs_esr_disable_reason_write(struct ieee80211_vif *vif, + char *buf, size_t count, + loff_t *ppos) { struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm *mvm = mvmvif->mvm; @@ -769,7 +802,7 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(rx_phyinfo, 10); MVM_DEBUGFS_READ_WRITE_FILE_OPS(quota_min, 32); MVM_DEBUGFS_READ_FILE_OPS(os_device_timediff); MVM_DEBUGFS_WRITE_FILE_OPS(int_mlo_scan, 32); -MVM_DEBUGFS_WRITE_FILE_OPS(block_esr, 32); +MVM_DEBUGFS_READ_WRITE_FILE_OPS(esr_disable_reason, 32); void iwl_mvm_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { @@ -800,7 +833,7 @@ void iwl_mvm_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif) debugfs_create_bool("ftm_unprotected", 0200, mvmvif->dbgfs_dir, &mvmvif->ftm_unprotected); MVM_DEBUGFS_ADD_FILE_VIF(int_mlo_scan, mvmvif->dbgfs_dir, 0200); - MVM_DEBUGFS_ADD_FILE_VIF(block_esr, mvmvif->dbgfs_dir, 0600); + MVM_DEBUGFS_ADD_FILE_VIF(esr_disable_reason, mvmvif->dbgfs_dir, 0600); if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p && mvmvif == mvm->bf_allowed_vif) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/link.c b/drivers/net/wireless/intel/iwlwifi/mvm/link.c index 5c17120dcc2a..21b5cc0413fe 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/link.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/link.c @@ -22,7 +22,7 @@ static const char *const iwl_mvm_esr_states_names[] = { HANDLE_ESR_REASONS(NAME_ENTRY) }; -static const char *iwl_get_esr_state_string(enum iwl_mvm_esr_state state) +const char *iwl_get_esr_state_string(enum iwl_mvm_esr_state state) { int offs = ilog2(state); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index 56467b9de7f1..cb4088149d85 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -385,6 +385,8 @@ enum iwl_mvm_esr_state { #define IWL_MVM_BLOCK_ESR_REASONS 0xffff +const char *iwl_get_esr_state_string(enum iwl_mvm_esr_state state); + /** * struct iwl_mvm_esr_exit - details of the last exit from EMLSR mode. * @reason: The reason for the last exit from EMLSR. From patchwork Mon May 6 07:04:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13654988 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 C59FB5464A for ; Mon, 6 May 2024 07:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979089; cv=none; b=DsKpzxxYWfhBpg6Ar3IXUXyeVrGUPG8KDMniOaA41Tweul0zyY0Wp02TLZjr2WaxVxpTjPx0mKFy9hcc+C0dXGGQY/kXhfQpxHtbJ7X6+w2QmcIKSYkdmuwoSQdywlYjPCdl6RoDz7eVt0XoxBFE+EtTjCqGEnyS1Yrr5fHPHIQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979089; c=relaxed/simple; bh=4C+NKqjDDkmy+8QLLd67L+s0Nt8cHMl1dUa8gu2WtSM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Lze5dOtP20ZzxypstI54eEkimQZHVZlQrDi4AHfHX8XRCNPpGQfNpXNhGb1woL4sHxh5X6IJhTfQE+/8UHohNd1PEjxh1o+enh4CII/dsbvi6aR2DY9sobS8i9OPsWEwnx7FhJV2eGnYmXxk9yzr+DtQN3+9XLIuebabA1Dmrd4= 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=EUwtPTQi; arc=none smtp.client-ip=198.175.65.21 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="EUwtPTQi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714979088; x=1746515088; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4C+NKqjDDkmy+8QLLd67L+s0Nt8cHMl1dUa8gu2WtSM=; b=EUwtPTQiUGJRHQDB+EB7jfA8+2FrVkEf5ZrN+w0DHE76hth0Hl7g4RKO Wm3DZ+pNMcigxtptbDZTIAAn8aMkbVNwOISjPH+Z6OzxKVf6HPF3VOZlc vtHf8n66aza6yjTqV8Oyz5D3y0HSY5x9D4hh0IkW2qkZ04NuyS+csWN9P 3cOki9suvcy8ey0JiQ8tmc7Ket7UG05hZbN930GqVabhXYO7XzaCYfOJt fZn2eXnWlDrN92SQ8GrmutD/pxKrRKG37SAbODJGf9LqcEk9QMXT4U4F+ pEOMZ3yHUY2Rf9aIG/kxG4Alg41eOJy58+mZvfuQsZRTquiOSC7/Rr1H3 w==; X-CSE-ConnectionGUID: TdWxGZwoSEywOxhK8mEqyA== X-CSE-MsgGUID: aZsj8N8qTUGzzK4veNdUpQ== X-IronPort-AV: E=McAfee;i="6600,9927,11064"; a="10638195" X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="10638195" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:40 -0700 X-CSE-ConnectionGUID: v5L9qm6wSiKSALPDeSb5jQ== X-CSE-MsgGUID: hFENejD6TeW4yy5fwcenlw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="59264919" Received: from weis0040.iil.intel.com ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:38 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Yedidya Benshimol Subject: [PATCH 06/15] wifi: iwlwifi: mvm: Add a print for invalid link pair due to bandwidth Date: Mon, 6 May 2024 10:04:10 +0300 Message-Id: <20240506095953.9e57ad898cf4.Id8edfd5e3774ea6475d5f4178ab7ea75a870ef95@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506070419.1821330-1-miriam.rachel.korenblit@intel.com> References: <20240506070419.1821330-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 From: Yedidya Benshimol When validating a link pair for EMLSR, add a print for invalid link pair due to bandwidth Signed-off-by: Yedidya Benshimol Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/link.c | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/link.c b/drivers/net/wireless/intel/iwlwifi/mvm/link.c index 21b5cc0413fe..b0568c74a15b 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/link.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/link.c @@ -691,12 +691,11 @@ s8 iwl_mvm_get_esr_rssi_thresh(struct iwl_mvm *mvm, } static u32 -iwl_mvm_esr_disallowed_with_link(struct ieee80211_vif *vif, +iwl_mvm_esr_disallowed_with_link(struct iwl_mvm *mvm, + struct ieee80211_vif *vif, const struct iwl_mvm_link_sel_data *link, bool primary) { - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - struct iwl_mvm *mvm = mvmvif->mvm; struct wiphy *wiphy = mvm->hw->wiphy; struct ieee80211_bss_conf *conf; enum iwl_mvm_esr_state ret = 0; @@ -735,20 +734,30 @@ bool iwl_mvm_mld_valid_link_pair(struct ieee80211_vif *vif, const struct iwl_mvm_link_sel_data *a, const struct iwl_mvm_link_sel_data *b) { - /* Per-link considerations */ - if (iwl_mvm_esr_disallowed_with_link(vif, a, true) || - iwl_mvm_esr_disallowed_with_link(vif, b, false)) - return false; + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); + struct iwl_mvm *mvm = mvmvif->mvm; + enum iwl_mvm_esr_state ret = 0; - if (a->chandef->width != b->chandef->width) + /* Per-link considerations */ + if (iwl_mvm_esr_disallowed_with_link(mvm, vif, a, true) || + iwl_mvm_esr_disallowed_with_link(mvm, vif, b, false)) return false; - if (!(a->chandef->chan->band == NL80211_BAND_6GHZ && + if (a->chandef->width != b->chandef->width || + !(a->chandef->chan->band == NL80211_BAND_6GHZ && b->chandef->chan->band == NL80211_BAND_5GHZ)) + ret |= IWL_MVM_ESR_EXIT_BANDWIDTH; + + if (ret) { + IWL_DEBUG_INFO(mvm, + "Links %d and %d are not a valid pair for EMLSR\n", + a->link_id, b->link_id); + iwl_mvm_print_esr_state(mvm, ret); return false; + } + + return true; - /* Per-combination considerations */ - return a->chandef->chan->band != b->chandef->chan->band; } EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_mvm_mld_valid_link_pair); From patchwork Mon May 6 07:04:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13654989 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 6317A6BFD4 for ; Mon, 6 May 2024 07:04:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979092; cv=none; b=F6hE9dlmp/8VqULH8YIleGE730iRmgkdxaAsXCj1j5Q0X2XkWVpbb+qHQeYL+36O3/oXMvCFzZdQlWD3wq64undKsRn7aTMC8XkicuVrc8hp6T1W4Vbhe1jFgj4STo1EafWnFgZSs+qJq1xDNBjNTk3T7VHUpcVgofhFxLgmlrY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979092; c=relaxed/simple; bh=6mbx6aXnDh3aO1zM2Yii8Ssp7YCaKk5LCrFOYjkOa6Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WD3U+uXe6hH7Go2dOMBAyQM/R5GWOgyjZFs0JcqlvV9w2C68UD/u7yYBFiTgmi1Qu1ONfa4IE40A5/9j0kM/nKGFoS4yZAdgfHMcSohNk9yUIgAc9Pod58kuo4Yni3BYFlbDhTJswF2bc32BgKmlO1mniAa6adhgvo0ENJNcoWE= 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=atqjDKEf; arc=none smtp.client-ip=198.175.65.21 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="atqjDKEf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714979091; x=1746515091; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6mbx6aXnDh3aO1zM2Yii8Ssp7YCaKk5LCrFOYjkOa6Q=; b=atqjDKEfzePiTWnbmWPDs554W073L+s3qAacHmRFxNDFe4uut2fJScJS AdgLiGmFXE8EkHBiAsxUuio64jWJq6KioDeSwmBdzpr1SiOQt5kL5tO68 ZFafkRTNrf4nUwY2QxH7ZipZCkvXinM6nldhBHwASvbteXUxPsG6SeMYp wm7MwI0zs1tEnee20uk9Jj9OAfC8m6cOkAZ4JR25rzwDs0ZR/MvPkx20/ etpef3EEZmWdt96LH9c7SU/+3thvANgkQZKIEX4fwN34ERPINIANnXy37 srg0LshvRtUTDxa7r6TEQcJTaK4KO5RXuOCXhjbSYg1IbtT1uXr4dCzak g==; X-CSE-ConnectionGUID: v19wHC6vQM+6sA8lR56i6g== X-CSE-MsgGUID: ak2yeC7wRamLkifndoTK3A== X-IronPort-AV: E=McAfee;i="6600,9927,11064"; a="10638207" X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="10638207" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:43 -0700 X-CSE-ConnectionGUID: LKLER9tRSmasPOD7edo76g== X-CSE-MsgGUID: sr0TcyoBTQG3RgDQJ0GChA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="59264928" Received: from weis0040.iil.intel.com ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:41 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Ilan Peer Subject: [PATCH 07/15] wifi: iwlwifi: mvm: Fix race in scan completion Date: Mon, 6 May 2024 10:04:11 +0300 Message-Id: <20240506095953.1f484a86324b.I63ed445a47f144546948c74ae6df85587fdb4ce3@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506070419.1821330-1-miriam.rachel.korenblit@intel.com> References: <20240506070419.1821330-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 From: Ilan Peer The move of the scan complete notification handling to the wiphy worker introduced a race between scan complete notification and scan abort: - The wiphy lock is held, e.g., for rfkill handling etc. - Scan complete notification is received but not handled yet. - Scan abort is triggered, and scan abort is sent to the FW. Once the scan abort command is sent successfully, the flow synchronously waits for the scan complete notification. However, as the scan complete notification was already received but not processed yet, this hangs for a second and continues leaving the scan status in an inconsistent state. - Once scan complete handling is started (when the wiphy lock is not held) since the scan status is not an inconsistent state, a warning is issued and the scan complete notification is not handled. To fix this issue, switch back the scan complete notification to be asynchronously handling, and only move the link selection logic to a worker (which was the original reason for the move to use wiphy lock). While at it, refactor some prints to improve debug data. Fixes: 07bf5297d392 ("wifi: iwlwifi: mvm: Implement new link selection algorithm") Signed-off-by: Ilan Peer Signed-off-by: Miri Korenblit --- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 1 + drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 + drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 27 +++++++++- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 54 +++++++++---------- 4 files changed, 55 insertions(+), 29 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 57a0d8af9b28..fb49deda3346 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -1350,6 +1350,7 @@ void iwl_mvm_mac_stop(struct ieee80211_hw *hw) iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_INT_MLO, false); mutex_unlock(&mvm->mutex); + wiphy_work_cancel(mvm->hw->wiphy, &mvm->trig_link_selection_wk); wiphy_work_flush(mvm->hw->wiphy, &mvm->async_handlers_wiphy_wk); flush_work(&mvm->async_handlers_wk); flush_work(&mvm->add_stream_wk); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index cb4088149d85..b292276de4ae 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -937,6 +937,8 @@ struct iwl_mvm { /* For async rx handlers that require the wiphy lock */ struct wiphy_work async_handlers_wiphy_wk; + struct wiphy_work trig_link_selection_wk; + struct work_struct roc_done_wk; unsigned long init_status; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index 155a44e8ab07..b27a03207938 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -383,7 +383,7 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = { iwl_mvm_rx_scan_match_found, RX_HANDLER_SYNC), RX_HANDLER(SCAN_COMPLETE_UMAC, iwl_mvm_rx_umac_scan_complete_notif, - RX_HANDLER_ASYNC_LOCKED_WIPHY, + RX_HANDLER_ASYNC_LOCKED, struct iwl_umac_scan_complete), RX_HANDLER(SCAN_ITERATION_COMPLETE_UMAC, iwl_mvm_rx_umac_scan_iter_complete_notif, RX_HANDLER_SYNC, @@ -1171,6 +1171,27 @@ static const struct iwl_mei_ops mei_ops = { .nic_stolen = iwl_mvm_mei_nic_stolen, }; +static void iwl_mvm_find_link_selection_vif(void *_data, u8 *mac, + struct ieee80211_vif *vif) +{ + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); + + if (ieee80211_vif_is_mld(vif) && mvmvif->authorized) + iwl_mvm_select_links(mvmvif->mvm, vif); +} + +static void iwl_mvm_trig_link_selection(struct wiphy *wiphy, + struct wiphy_work *wk) +{ + struct iwl_mvm *mvm = + container_of(wk, struct iwl_mvm, trig_link_selection_wk); + + ieee80211_iterate_active_interfaces(mvm->hw, + IEEE80211_IFACE_ITER_NORMAL, + iwl_mvm_find_link_selection_vif, + NULL); +} + static struct iwl_op_mode * iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, const struct iwl_fw *fw, struct dentry *dbgfs_dir) @@ -1302,6 +1323,10 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, wiphy_work_init(&mvm->async_handlers_wiphy_wk, iwl_mvm_async_handlers_wiphy_wk); + + wiphy_work_init(&mvm->trig_link_selection_wk, + iwl_mvm_trig_link_selection); + init_waitqueue_head(&mvm->rx_sync_waitq); mvm->queue_sync_state = 0; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c index 433280b3c03e..49ec515b5bad 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c @@ -3178,23 +3178,6 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, return ret; } -static void iwl_mvm_find_link_selection_vif(void *_data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - - if (ieee80211_vif_is_mld(vif) && mvmvif->authorized) - iwl_mvm_select_links(mvmvif->mvm, vif); -} - -static void iwl_mvm_post_scan_link_selection(struct iwl_mvm *mvm) -{ - ieee80211_iterate_active_interfaces(mvm->hw, - IEEE80211_IFACE_ITER_NORMAL, - iwl_mvm_find_link_selection_vif, - NULL); -} - void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb) { @@ -3206,6 +3189,21 @@ void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm, mvm->mei_scan_filter.is_mei_limited_scan = false; + IWL_DEBUG_SCAN(mvm, + "Scan completed: uid=%u type=%u, status=%s, EBS=%s\n", + uid, mvm->scan_uid_status[uid], + notif->status == IWL_SCAN_OFFLOAD_COMPLETED ? + "completed" : "aborted", + iwl_mvm_ebs_status_str(notif->ebs_status)); + + IWL_DEBUG_SCAN(mvm, "Scan completed: scan_status=0x%x\n", + mvm->scan_status); + + IWL_DEBUG_SCAN(mvm, + "Scan completed: line=%u, iter=%u, elapsed time=%u\n", + notif->last_schedule, notif->last_iter, + __le32_to_cpu(notif->time_from_last_iter)); + if (WARN_ON(!(mvm->scan_uid_status[uid] & mvm->scan_status))) return; @@ -3244,16 +3242,9 @@ void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm, } mvm->scan_status &= ~mvm->scan_uid_status[uid]; - IWL_DEBUG_SCAN(mvm, - "Scan completed, uid %u type %u, status %s, EBS status %s\n", - uid, mvm->scan_uid_status[uid], - notif->status == IWL_SCAN_OFFLOAD_COMPLETED ? - "completed" : "aborted", - iwl_mvm_ebs_status_str(notif->ebs_status)); - IWL_DEBUG_SCAN(mvm, - "Last line %d, Last iteration %d, Time from last iteration %d\n", - notif->last_schedule, notif->last_iter, - __le32_to_cpu(notif->time_from_last_iter)); + + IWL_DEBUG_SCAN(mvm, "Scan completed: after update: scan_status=0x%x\n", + mvm->scan_status); if (notif->ebs_status != IWL_SCAN_EBS_SUCCESS && notif->ebs_status != IWL_SCAN_EBS_INACTIVE) @@ -3262,7 +3253,7 @@ void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm, mvm->scan_uid_status[uid] = 0; if (select_links) - iwl_mvm_post_scan_link_selection(mvm); + wiphy_work_queue(mvm->hw->wiphy, &mvm->trig_link_selection_wk); } void iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm, @@ -3487,6 +3478,10 @@ int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify) { int ret; + IWL_DEBUG_SCAN(mvm, + "Request to stop scan: type=0x%x, status=0x%x\n", + type, mvm->scan_status); + if (!(mvm->scan_status & type)) return 0; @@ -3498,6 +3493,9 @@ int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify) ret = iwl_mvm_scan_stop_wait(mvm, type); if (!ret) mvm->scan_status |= type << IWL_MVM_SCAN_STOPPING_SHIFT; + else + IWL_DEBUG_SCAN(mvm, "Failed to stop scan\n"); + out: /* Clear the scan status so the next scan requests will * succeed and mark the scan as stopping, so that the Rx From patchwork Mon May 6 07:04:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13654990 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 B573250263 for ; Mon, 6 May 2024 07:04:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979097; cv=none; b=UGkJJTXyFR8MSIVolYNqLOf8WeYJFfT1L6GhjOqj8YGoCWglo2dIC/XciEArBwYInIfr2WtMFEMex3sfnFprLHGuMW435+FS7qpnd6aBPPAzxpBnECL2YCnRKQrjQmHHLt6xno0bT/NjiTR1n2rmRGzZ3E0u1hZc5ek9tJocflQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979097; c=relaxed/simple; bh=MUQSYQ+lgbOX9qrW52+esnLzPIqOBRUE+0QDq/uu/38=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rQlpmhawE2gnADwHDzDFq1LFk8n700rOP/Xs6V04Z6aTLHa9uiaH2UveR1jWmtScGi29qByebFgJpoDu0JMS6nunlK5zdy6JBYgntOLKtgK1RudRYs4DD4Lf7aqzzcl0i2b3V3q3OCi1VECVOD8Sh7LH6Q0Ftoc8oLHrZtCRyow= 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=iDUfPf1l; arc=none smtp.client-ip=198.175.65.21 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="iDUfPf1l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714979096; x=1746515096; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MUQSYQ+lgbOX9qrW52+esnLzPIqOBRUE+0QDq/uu/38=; b=iDUfPf1lH/02t23xbTmJCCSoQZgZs3WeGsZ78asb3NcpmKwJXHU1j5nB +JgA7NJIyEtllawhhs+OL9Wx6b1S2ACFTv30dwtFl5Edw5o0h/Kty/9D2 vlqmSRAsDVpyBfBW3DhWttRp0XI7qYpLb7jlPVtsDLJZUjxl5xNkDqCDg AUG5z0kUuFuQIn2KOhC8J7ElN6iUEqs/CPvsjk0E2+0rexanhBfqgD44H euTzGUbrwBYvHY2mrlW0WFa7V9w7h6/jnKjz4B87OzPIpj6LkE9tMZAx0 lUKCvjnaV1to8pKAaoSlqixO4RyCjQKRnC8wSfsmVWlCltRWmy3H1+J/F A==; X-CSE-ConnectionGUID: Qx6viz+RSCC6VbLTa3KscQ== X-CSE-MsgGUID: sIBSejUKSnqaF67G67MwhA== X-IronPort-AV: E=McAfee;i="6600,9927,11064"; a="10638221" X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="10638221" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:44 -0700 X-CSE-ConnectionGUID: /3oDjQb8Rp+BXAXlKT1G1g== X-CSE-MsgGUID: QqPNvHXyQ5KZ/y+5yw29oQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="59264931" Received: from weis0040.iil.intel.com ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:42 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Benjamin Berg Subject: [PATCH 08/15] wifi: iwlwifi: mvm: add the firmware API for channel survey Date: Mon, 6 May 2024 10:04:12 +0300 Message-Id: <20240506095953.1facde532676.I3864ac4bc0fecb7fd5136e85c07585ab7100234b@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506070419.1821330-1-miriam.rachel.korenblit@intel.com> References: <20240506070419.1821330-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 From: Benjamin Berg When requested, the firmware can return per-channel survey information generally used for ACS (automatic channel selection). Add the API for this, which consists of a flag and a new channel survey notification. Signed-off-by: Benjamin Berg Signed-off-by: Miri Korenblit --- .../net/wireless/intel/iwlwifi/fw/api/scan.h | 33 ++++++++++++++++++- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 1 + 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h b/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h index 93078f8cc08c..6684506f4fc4 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* - * Copyright (C) 2012-2014, 2018-2023 Intel Corporation + * Copyright (C) 2012-2014, 2018-2024 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH */ @@ -13,6 +13,10 @@ * enum iwl_scan_subcmd_ids - scan commands */ enum iwl_scan_subcmd_ids { + /** + * @CHANNEL_SURVEY_NOTIF: &struct iwl_umac_scan_channel_survey_notif + */ + CHANNEL_SURVEY_NOTIF = 0xFB, /** * @OFFLOAD_MATCH_INFO_NOTIF: &struct iwl_scan_offload_match_info */ @@ -62,6 +66,8 @@ struct iwl_ssid_ie { #define IWL_FAST_SCHED_SCAN_ITERATIONS 3 #define IWL_MAX_SCHED_SCAN_PLANS 2 +#define IWL_MAX_NUM_NOISE_RESULTS 22 + enum scan_framework_client { SCAN_CLIENT_SCHED_SCAN = BIT(0), SCAN_CLIENT_NETDETECT = BIT(1), @@ -642,10 +648,13 @@ enum iwl_umac_scan_general_flags { * notification per channel or not. * @IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER: Whether to allow channel * reorder optimization or not. + * @IWL_UMAC_SCAN_GEN_FLAGS2_COLLECT_CHANNEL_STATS: Enable channel statistics + * collection when #IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE is set. */ enum iwl_umac_scan_general_flags2 { IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL = BIT(0), IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER = BIT(1), + IWL_UMAC_SCAN_GEN_FLAGS2_COLLECT_CHANNEL_STATS = BIT(3), }; /** @@ -1258,4 +1267,26 @@ struct iwl_umac_scan_iter_complete_notif { struct iwl_scan_results_notif results[]; } __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_2 */ +/** + * struct iwl_umac_scan_channel_survey_notif - data for survey + * @channel: the channel scanned + * @band: band of channel + * @noise: noise floor measurements in negative dBm, invalid 0xff + * @reserved: for future use and alignment + * @active_time: time in ms the radio was turned on (on the channel) + * @busy_time: time in ms the channel was sensed busy, 0 for a clean channel + * @tx_time: time the radio spent transmitting data + * @rx_time: time the radio spent receiving data + */ +struct iwl_umac_scan_channel_survey_notif { + __le32 channel; + __le32 band; + u8 noise[IWL_MAX_NUM_NOISE_RESULTS]; + u8 reserved[2]; + __le32 active_time; + __le32 busy_time; + __le32 tx_time; + __le32 rx_time; +} __packed; /* SCAN_CHANNEL_SURVEY_NTF_API_S_VER_1 */ + #endif /* __iwl_fw_api_scan_h__ */ diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index b27a03207938..c52e69743c80 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -651,6 +651,7 @@ static const struct iwl_hcmd_names iwl_mvm_statistics_names[] = { * Access is done through binary search */ static const struct iwl_hcmd_names iwl_mvm_scan_names[] = { + HCMD_NAME(CHANNEL_SURVEY_NOTIF), HCMD_NAME(OFFLOAD_MATCH_INFO_NOTIF), }; From patchwork Mon May 6 07:04:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13654991 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 AE70F7D06E for ; Mon, 6 May 2024 07:05:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979102; cv=none; b=rgYBzgkaMyCfRLyTN4PgSeL+HuqB5Zd2PsWAbOIDH9W9+CrZZXCoSk3PmpbVSsM7HbZm8Mf5XECJ46YuO1TIPt9EZXZyAzt8eL2gpbubnaHxBDf4XcatBbp8g3LG2iO9bVEZF7k6N2X6fhlq982hVbkOX/V78/MwOypDg1MIBIE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979102; c=relaxed/simple; bh=3U2BZfBTvpua7ZjFzZLVWVoMhsySPr51YqLlIROId6w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AGdtnLvg2AhEkOahhYTWmrhYkV4kR/mQobjL6zdZF4HvVc0mSL8CoXb4w4rHsH13DSpI9eV+cd9bI2IrPMxbRTMm9DWo8L0WitVZ97mh7UOu/I8M0JhzRDM8JYaC2/PMlFxyjPfIL6GgUXi3vLk3xJxP8+cfd3Ef1Oi8eruHzH0= 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=BJqK/q6d; arc=none smtp.client-ip=198.175.65.21 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BJqK/q6d" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714979101; x=1746515101; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3U2BZfBTvpua7ZjFzZLVWVoMhsySPr51YqLlIROId6w=; b=BJqK/q6drEyUqDSeDk07m7nPdeSpoqEiEbvqpEUbv4Gv44fM+e2zr/Jc qcNkGqGg5+8fY18o4L3OiVRXlcGw2u9XGcz3JDGWdmxP2sCGIUObvKILT tNnm8lf2706pStwXQ1KXl9Ui7d1yOKx7+TqJ7laK0WbngueiNPg604IIl XGFdzcPNp2AmQpbAndHHt9n61ga+H2luqZkFroOk+KWGycOFYS3n/HXLQ JXaElqKbq8OeRnUptX2stzii3hIVmWrLPzxv1RYxHbGFZ8K456Cg9WWg1 N0o6KVxphi/bAc8tNgk1EtC9IvSWtwjSZrcjZhkGE2VYvy/lS4cLvK/PO w==; X-CSE-ConnectionGUID: oLRPFUGqS5yQkceFs0FUnA== X-CSE-MsgGUID: W/jnFy2IR1aN+Q/vbbVQvw== X-IronPort-AV: E=McAfee;i="6600,9927,11064"; a="10638228" X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="10638228" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:46 -0700 X-CSE-ConnectionGUID: A+zytjR8Rv60b04YUg4txA== X-CSE-MsgGUID: bjJq1XjXTlmOhnHZTLko9A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="59264935" Received: from weis0040.iil.intel.com ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:43 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Benjamin Berg Subject: [PATCH 09/15] wifi: iwlwifi: mvm: record and return channel survey information Date: Mon, 6 May 2024 10:04:13 +0300 Message-Id: <20240506095953.9287591a5999.I54a3f9f6480d3694e67eea1cb4f5853beace2780@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506070419.1821330-1-miriam.rachel.korenblit@intel.com> References: <20240506070419.1821330-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 From: Benjamin Berg While doing a passive scan, the firmware will report per-channel survey information. This information is primarily useful for hostapd when doing an ACS (Automatic Channel Selection). Collect this information and add it to the result set when getting the survey information. Signed-off-by: Benjamin Berg Signed-off-by: Miri Korenblit --- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 71 +++++- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 35 +++ drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 4 + drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 216 +++++++++++++++++- .../wireless/intel/iwlwifi/mvm/tests/Makefile | 2 +- .../wireless/intel/iwlwifi/mvm/tests/scan.c | 110 +++++++++ 6 files changed, 430 insertions(+), 8 deletions(-) create mode 100644 drivers/net/wireless/intel/iwlwifi/mvm/tests/scan.c diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index fb49deda3346..486a6b8f3c97 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -5899,6 +5899,65 @@ void iwl_mvm_mac_flush_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mutex_unlock(&mvm->mutex); } +static int iwl_mvm_mac_get_acs_survey(struct iwl_mvm *mvm, int idx, + struct survey_info *survey) +{ + int chan_idx; + enum nl80211_band band; + int ret; + + mutex_lock(&mvm->mutex); + + if (!mvm->acs_survey) { + ret = -ENOENT; + goto out; + } + + /* Find and return the next entry that has a non-zero active time */ + for (band = 0; band < NUM_NL80211_BANDS; band++) { + struct ieee80211_supported_band *sband = + mvm->hw->wiphy->bands[band]; + + if (!sband) + continue; + + for (chan_idx = 0; chan_idx < sband->n_channels; chan_idx++) { + struct iwl_mvm_acs_survey_channel *info = + &mvm->acs_survey->bands[band][chan_idx]; + + if (!info->time) + continue; + + /* Found (the next) channel to report */ + survey->channel = &sband->channels[chan_idx]; + survey->filled = SURVEY_INFO_TIME | + SURVEY_INFO_TIME_BUSY | + SURVEY_INFO_TIME_RX | + SURVEY_INFO_TIME_TX; + survey->time = info->time; + survey->time_busy = info->time_busy; + survey->time_rx = info->time_rx; + survey->time_tx = info->time_tx; + survey->noise = info->noise; + if (survey->noise < 0) + survey->filled |= SURVEY_INFO_NOISE_DBM; + + /* Clear time so that channel is only reported once */ + info->time = 0; + + ret = 0; + goto out; + } + } + + ret = -ENOENT; + +out: + mutex_unlock(&mvm->mutex); + + return ret; +} + int iwl_mvm_mac_get_survey(struct ieee80211_hw *hw, int idx, struct survey_info *survey) { @@ -5911,14 +5970,18 @@ int iwl_mvm_mac_get_survey(struct ieee80211_hw *hw, int idx, memset(survey, 0, sizeof(*survey)); - /* only support global statistics right now */ - if (idx != 0) - return -ENOENT; - if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS)) return -ENOENT; + /* + * Return the beacon stats at index zero and pass on following indices + * to the function returning the full survey, most likely for ACS + * (Automatic Channel Selection). + */ + if (idx > 0) + return iwl_mvm_mac_get_acs_survey(mvm, idx - 1, survey); + mutex_lock(&mvm->mutex); if (iwl_mvm_firmware_running(mvm)) { diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index b292276de4ae..b96568f5640c 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -918,6 +918,35 @@ struct iwl_mei_scan_filter { struct work_struct scan_work; }; +/** + * struct iwl_mvm_acs_survey_channel - per-channel survey information + * + * Stripped down version of &struct survey_info. + * + * @time: time in ms the radio was on the channel + * @time_busy: time in ms the channel was sensed busy + * @time_tx: time in ms spent transmitting data + * @time_rx: time in ms spent receiving data + * @noise: channel noise in dBm + */ +struct iwl_mvm_acs_survey_channel { + u32 time; + u32 time_busy; + u32 time_tx; + u32 time_rx; + s8 noise; +}; + +struct iwl_mvm_acs_survey { + struct iwl_mvm_acs_survey_channel *bands[NUM_NL80211_BANDS]; + + /* Overall number of channels */ + int n_channels; + + /* Storage space for per-channel information follows */ + struct iwl_mvm_acs_survey_channel channels[] __counted_by(n_channels); +}; + struct iwl_mvm { /* for logger access */ struct device *dev; @@ -1287,6 +1316,8 @@ struct iwl_mvm { struct iwl_mei_scan_filter mei_scan_filter; + struct iwl_mvm_acs_survey *acs_survey; + bool statistics_clear; }; @@ -2033,6 +2064,8 @@ unsigned int iwl_mvm_get_link_grade(struct ieee80211_bss_conf *link_conf); bool iwl_mvm_mld_valid_link_pair(struct ieee80211_vif *vif, const struct iwl_mvm_link_sel_data *a, const struct iwl_mvm_link_sel_data *b); + +s8 iwl_mvm_average_dbm_values(const struct iwl_umac_scan_channel_survey_notif *notif); #endif /* AP and IBSS */ @@ -2115,6 +2148,8 @@ int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm); void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm); void iwl_mvm_scan_timeout_wk(struct work_struct *work); int iwl_mvm_int_mlo_scan(struct iwl_mvm *mvm, struct ieee80211_vif *vif); +void iwl_mvm_rx_channel_survey_notif(struct iwl_mvm *mvm, + struct iwl_rx_cmd_buffer *rxb); /* Scheduled scan */ void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm, diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index c52e69743c80..53283d052e18 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -473,6 +473,9 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = { RX_HANDLER_GRP(MAC_CONF_GROUP, ROC_NOTIF, iwl_mvm_rx_roc_notif, RX_HANDLER_SYNC, struct iwl_roc_notif), + RX_HANDLER_GRP(SCAN_GROUP, CHANNEL_SURVEY_NOTIF, + iwl_mvm_rx_channel_survey_notif, RX_HANDLER_ASYNC_LOCKED, + struct iwl_umac_scan_channel_survey_notif), }; #undef RX_HANDLER #undef RX_HANDLER_GRP @@ -1582,6 +1585,7 @@ static void iwl_op_mode_mvm_stop(struct iwl_op_mode *op_mode) kfree(mvm->temp_nvm_data); for (i = 0; i < NVM_MAX_NUM_SECTIONS; i++) kfree(mvm->nvm_sections[i].data); + kfree(mvm->acs_survey); cancel_delayed_work_sync(&mvm->tcm.work); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c index 49ec515b5bad..a7ec172eeade 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c @@ -226,6 +226,14 @@ iwl_mvm_scan_type _iwl_mvm_get_scan_type(struct iwl_mvm *mvm, .global_cnt = 0, }; + /* + * A scanning AP interface probably wants to generate a survey to do + * ACS (automatic channel selection). + * Force a non-fragmented scan in that case. + */ + if (vif && ieee80211_vif_type_p2p(vif) == NL80211_IFTYPE_AP) + return IWL_SCAN_TYPE_WILD; + ieee80211_iterate_active_interfaces_atomic(mvm->hw, IEEE80211_IFACE_ITER_NORMAL, iwl_mvm_scan_iterator, @@ -852,11 +860,13 @@ static inline bool iwl_mvm_scan_use_ebs(struct iwl_mvm *mvm, * 4. it's not a p2p find operation. * 5. we are not in low latency mode, * or if fragmented ebs is supported by the FW + * 6. the VIF is not an AP interface (scan wants survey results) */ return ((capa->flags & IWL_UCODE_TLV_FLAGS_EBS_SUPPORT) && mvm->last_ebs_successful && IWL_MVM_ENABLE_EBS && vif->type != NL80211_IFTYPE_P2P_DEVICE && - (!low_latency || iwl_mvm_is_frag_ebs_supported(mvm))); + (!low_latency || iwl_mvm_is_frag_ebs_supported(mvm)) && + ieee80211_vif_type_p2p(vif) != NL80211_IFTYPE_AP); } static inline bool iwl_mvm_is_regular_scan(struct iwl_mvm_scan_params *params) @@ -2124,7 +2134,8 @@ static u16 iwl_mvm_scan_umac_flags_v2(struct iwl_mvm *mvm, static u8 iwl_mvm_scan_umac_flags2(struct iwl_mvm *mvm, struct iwl_mvm_scan_params *params, - struct ieee80211_vif *vif, int type) + struct ieee80211_vif *vif, int type, + u16 gen_flags) { u8 flags = 0; @@ -2144,6 +2155,13 @@ static u8 iwl_mvm_scan_umac_flags2(struct iwl_mvm *mvm, IWL_UCODE_TLV_CAPA_SCAN_DONT_TOGGLE_ANT)) flags |= IWL_UMAC_SCAN_GEN_PARAMS_FLAGS2_DONT_TOGGLE_ANT; + /* Passive and AP interface -> ACS (automatic channel selection) */ + if (gen_flags & IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE && + ieee80211_vif_type_p2p(vif) == NL80211_IFTYPE_AP && + iwl_fw_lookup_notif_ver(mvm->fw, SCAN_GROUP, CHANNEL_SURVEY_NOTIF, + 0) >= 1) + flags |= IWL_UMAC_SCAN_GEN_FLAGS2_COLLECT_CHANNEL_STATS; + return flags; } @@ -2513,7 +2531,8 @@ static int iwl_mvm_scan_umac_v14_and_above(struct iwl_mvm *mvm, gen_flags = iwl_mvm_scan_umac_flags_v2(mvm, params, vif, type); if (version >= 15) - gen_flags2 = iwl_mvm_scan_umac_flags2(mvm, params, vif, type); + gen_flags2 = iwl_mvm_scan_umac_flags2(mvm, params, vif, type, + gen_flags); else gen_flags2 = 0; @@ -3602,3 +3621,194 @@ int iwl_mvm_int_mlo_scan(struct iwl_mvm *mvm, struct ieee80211_vif *vif) return iwl_mvm_int_mlo_scan_start(mvm, vif, channels, n_channels); } + +static int iwl_mvm_chanidx_from_phy(struct iwl_mvm *mvm, + enum nl80211_band band, + u16 phy_chan_num) +{ + struct ieee80211_supported_band *sband = mvm->hw->wiphy->bands[band]; + int chan_idx; + + if (WARN_ON_ONCE(!sband)) + return -EINVAL; + + for (chan_idx = 0; chan_idx < sband->n_channels; chan_idx++) { + struct ieee80211_channel *channel = &sband->channels[chan_idx]; + + if (channel->hw_value == phy_chan_num) + return chan_idx; + } + + return -EINVAL; +} + +static u32 iwl_mvm_div_by_db(u32 value, u8 db) +{ + /* + * 2^32 * 10**(i / 10) for i = [1, 10], skipping 0 and simply stopping + * at 10 dB and looping instead of using a much larger table. + * + * Using 64 bit math is overkill, but means the helper does not require + * a limit on the input range. + */ + static const u32 db_to_val[] = { + 0xcb59185e, 0xa1866ba8, 0x804dce7a, 0x65ea59fe, 0x50f44d89, + 0x404de61f, 0x331426af, 0x2892c18b, 0x203a7e5b, 0x1999999a, + }; + + while (value && db > 0) { + u8 change = min_t(u8, db, ARRAY_SIZE(db_to_val)); + + value = (((u64)value) * db_to_val[change - 1]) >> 32; + + db -= change; + } + + return value; +} + +VISIBLE_IF_IWLWIFI_KUNIT s8 +iwl_mvm_average_dbm_values(const struct iwl_umac_scan_channel_survey_notif *notif) +{ + s8 average_magnitude; + u32 average_factor; + s8 sum_magnitude = -128; + u32 sum_factor = 0; + int i, count = 0; + + /* + * To properly average the decibel values (signal values given in dBm) + * we need to do the math in linear space. Doing a linear average of + * dB (dBm) values is a bit annoying though due to the large range of + * at least -10 to -110 dBm that will not fit into a 32 bit integer. + * + * A 64 bit integer should be sufficient, but then we still have the + * problem that there are no directly usable utility functions + * available. + * + * So, lets not deal with that and instead do much of the calculation + * with a 16.16 fixed point integer along with a base in dBm. 16.16 bit + * gives us plenty of head-room for adding up a few values and even + * doing some math on it. And the tail should be accurate enough too + * (1/2^16 is somewhere around -48 dB, so effectively zero). + * + * i.e. the real value of sum is: + * sum = sum_factor / 2^16 * 10^(sum_magnitude / 10) mW + * + * However, that does mean we need to be able to bring two values to + * a common base, so we need a helper for that. + * + * Note that this function takes an input with unsigned negative dBm + * values but returns a signed dBm (i.e. a negative value). + */ + + for (i = 0; i < ARRAY_SIZE(notif->noise); i++) { + s8 val_magnitude; + u32 val_factor; + + if (notif->noise[i] == 0xff) + continue; + + val_factor = 0x10000; + val_magnitude = -notif->noise[i]; + + if (val_magnitude <= sum_magnitude) { + u8 div_db = sum_magnitude - val_magnitude; + + val_factor = iwl_mvm_div_by_db(val_factor, div_db); + val_magnitude = sum_magnitude; + } else { + u8 div_db = val_magnitude - sum_magnitude; + + sum_factor = iwl_mvm_div_by_db(sum_factor, div_db); + sum_magnitude = val_magnitude; + } + + sum_factor += val_factor; + count++; + } + + /* No valid noise measurement, return a very high noise level */ + if (count == 0) + return 0; + + average_magnitude = sum_magnitude; + average_factor = sum_factor / count; + + /* + * average_factor will be a number smaller than 1.0 (0x10000) at this + * point. What we need to do now is to adjust average_magnitude so that + * average_factor is between -0.5 dB and 0.5 dB. + * + * Just do -1 dB steps and find the point where + * -0.5 dB * -i dB = 0x10000 * 10^(-0.5/10) / i dB + * = div_by_db(0xe429, i) + * is smaller than average_factor. + */ + for (i = 0; average_factor < iwl_mvm_div_by_db(0xe429, i); i++) { + /* nothing */ + } + + return average_magnitude - i; +} +EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_mvm_average_dbm_values); + +void iwl_mvm_rx_channel_survey_notif(struct iwl_mvm *mvm, + struct iwl_rx_cmd_buffer *rxb) +{ + struct iwl_rx_packet *pkt = rxb_addr(rxb); + const struct iwl_umac_scan_channel_survey_notif *notif = + (void *)pkt->data; + struct iwl_mvm_acs_survey_channel *info; + enum nl80211_band band; + int chan_idx; + + lockdep_assert_held(&mvm->mutex); + + if (!mvm->acs_survey) { + size_t n_channels = 0; + + for (band = 0; band < NUM_NL80211_BANDS; band++) { + if (!mvm->hw->wiphy->bands[band]) + continue; + + n_channels += mvm->hw->wiphy->bands[band]->n_channels; + } + + mvm->acs_survey = kzalloc(struct_size(mvm->acs_survey, + channels, n_channels), + GFP_KERNEL); + + if (!mvm->acs_survey) + return; + + mvm->acs_survey->n_channels = n_channels; + n_channels = 0; + for (band = 0; band < NUM_NL80211_BANDS; band++) { + if (!mvm->hw->wiphy->bands[band]) + continue; + + mvm->acs_survey->bands[band] = + &mvm->acs_survey->channels[n_channels]; + n_channels += mvm->hw->wiphy->bands[band]->n_channels; + } + } + + band = iwl_mvm_nl80211_band_from_phy(le32_to_cpu(notif->band)); + chan_idx = iwl_mvm_chanidx_from_phy(mvm, band, + le32_to_cpu(notif->channel)); + if (WARN_ON_ONCE(chan_idx < 0)) + return; + + IWL_DEBUG_SCAN(mvm, "channel survey received for freq %d\n", + mvm->hw->wiphy->bands[band]->channels[chan_idx].center_freq); + + info = &mvm->acs_survey->bands[band][chan_idx]; + + /* Times are all in ms */ + info->time = le32_to_cpu(notif->active_time); + info->time_busy = le32_to_cpu(notif->busy_time); + info->time_rx = le32_to_cpu(notif->rx_time); + info->time_tx = le32_to_cpu(notif->tx_time); + info->noise = iwl_mvm_average_dbm_values(notif); +} diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tests/Makefile b/drivers/net/wireless/intel/iwlwifi/mvm/tests/Makefile index b13aebbf7d5e..6bd56a28cffd 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tests/Makefile +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tests/Makefile @@ -1,3 +1,3 @@ -iwlmvm-tests-y += module.o links.o +iwlmvm-tests-y += module.o links.o scan.o obj-$(CONFIG_IWLWIFI_KUNIT_TESTS) += iwlmvm-tests.o diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tests/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/tests/scan.c new file mode 100644 index 000000000000..d3b6a57c3ebe --- /dev/null +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tests/scan.c @@ -0,0 +1,110 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * KUnit tests for channel helper functions + * + * Copyright (C) 2024 Intel Corporation + */ +#include +#include "../mvm.h" +#include + +MODULE_IMPORT_NS(EXPORTED_FOR_KUNIT_TESTING); + +static const struct acs_average_db_case { + const char *desc; + u8 neg_dbm[22]; + s8 result; +} acs_average_db_cases[] = { + { + .desc = "Smallest possible value, all filled", + .neg_dbm = { + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128 + }, + .result = -128, + }, + { + .desc = "Biggest possible value, all filled", + .neg_dbm = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, + }, + .result = 0, + }, + { + .desc = "Smallest possible value, partial filled", + .neg_dbm = { + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, + }, + .result = -128, + }, + { + .desc = "Biggest possible value, partial filled", + .neg_dbm = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, + }, + .result = 0, + }, + { + .desc = "Adding -80dBm to -75dBm until it is still rounded to -79dBm", + .neg_dbm = { + 75, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 0xff, 0xff, 0xff, + 0xff, 0xff, + }, + .result = -79, + }, + { + .desc = "Adding -80dBm to -75dBm until it is just rounded to -80dBm", + .neg_dbm = { + 75, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 0xff, 0xff, + 0xff, 0xff, + }, + .result = -80, + }, +}; + +KUNIT_ARRAY_PARAM_DESC(acs_average_db, acs_average_db_cases, desc) + +static void test_acs_average_db(struct kunit *test) +{ + const struct acs_average_db_case *params = test->param_value; + struct iwl_umac_scan_channel_survey_notif notif; + int i; + + /* Test the values in the given order */ + for (i = 0; i < ARRAY_SIZE(params->neg_dbm); i++) + notif.noise[i] = params->neg_dbm[i]; + KUNIT_ASSERT_EQ(test, + iwl_mvm_average_dbm_values(¬if), + params->result); + + /* Test in reverse order */ + for (i = 0; i < ARRAY_SIZE(params->neg_dbm); i++) + notif.noise[ARRAY_SIZE(params->neg_dbm) - i - 1] = + params->neg_dbm[i]; + KUNIT_ASSERT_EQ(test, + iwl_mvm_average_dbm_values(¬if), + params->result); +} + +static struct kunit_case acs_average_db_case[] = { + KUNIT_CASE_PARAM(test_acs_average_db, acs_average_db_gen_params), + {} +}; + +static struct kunit_suite acs_average_db = { + .name = "iwlmvm-acs-average-db", + .test_cases = acs_average_db_case, +}; + +kunit_test_suite(acs_average_db); From patchwork Mon May 6 07:04:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13654992 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 D996F6D1A3 for ; Mon, 6 May 2024 07:05:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979104; cv=none; b=r5gTuDT5SwzOOIWqFm65iLAh8qnMgLY/9jwtPCxY6Ub1mS6SILqAnoKPYjoJvPcBkwfwkuSEu9qO03wHNwYSwyWaXSO9Xwx4LEGrqQfT41PYAM4/dQUFCmIm+SkWiFUg0Wt739xrcq7HWqM/S3INYxeEQc5ElNyVzGTMu8Zm164= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979104; c=relaxed/simple; bh=vW38m0CmhK5Ur94Y5pn5dk44eDscKzA8VDcCYQCYfJQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Bs/rCw4iXfkw8KeehO/8kssh2Cgp7PvDyJhQOSVa4kyQtJPUlqF7I8qPOvQej1Pc/N3QMm9Gta8m5bv9WDTfIq/MiCRt5eLHTKp4lEw6GtfHgXcGgDt3ZyWG4X0EnZxkQrA0Qb7Pgrfi/X597BA10IrooY/6jsZ3mKQT5dVc+mw= 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=GOLq6Zgu; arc=none smtp.client-ip=198.175.65.21 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GOLq6Zgu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714979103; x=1746515103; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vW38m0CmhK5Ur94Y5pn5dk44eDscKzA8VDcCYQCYfJQ=; b=GOLq6ZgufLVJFxal+RUP0dqPPUNW8GYGCmq7dRZB2386/jlnU7GAkkkQ potHWxYzkANRvVcSuvXv1xgGZhu+QwwxE6R+P0P02dzLc79fMGclL6vdE lEMPTQU2J5P1UwdLNhBMB1Dogapx4DVXHmOb+H66ZPeQUS0cE1AC6OI5E zYQvKKb9iHqNWMfnDFJKClm2bvhwxmpQHOnXYlBcrVeXv/9tcGE+4kJaO rfBvA//cdVX+T5W/mopbDKsVLf9F12dcMCmYIi3kz34vk0O9j1+ShPyid OsAP+xKH0oPz7rD5ABX56KgT0S2eyP/9YZ+WSUfL0EYnTo5PoPN2GbCuQ Q==; X-CSE-ConnectionGUID: iPcC79E/SmiNVw4x8Z35nQ== X-CSE-MsgGUID: 5MjeDORXTtqlSBY5pBg9ZQ== X-IronPort-AV: E=McAfee;i="6600,9927,11064"; a="10638234" X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="10638234" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:47 -0700 X-CSE-ConnectionGUID: lm+8EON1SPWzgJBgwrr3Kw== X-CSE-MsgGUID: RSwR3WdATvKK+xc8dmuzjg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="59264943" Received: from weis0040.iil.intel.com ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:45 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Daniel Gabay , Ofer Kimelman Subject: [PATCH 10/15] wifi: iwlwifi: Force SCU_ACTIVE for specific platforms Date: Mon, 6 May 2024 10:04:14 +0300 Message-Id: <20240506095953.3d0c56c2bb1a.I97d9da402890d2085b5698666cceffc417b6b6df@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506070419.1821330-1-miriam.rachel.korenblit@intel.com> References: <20240506070419.1821330-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 From: Daniel Gabay Firmware 0x2F7 assert observed in Dell platforms when using GL HW. This issue is mitigated by setting SCU_FORCE_ACTIVE during platform low power states. Driver shall indicate firmware to force SCU active by setting bit 29 in context info prph scratch control flags. This mitigation is limited to Dell platforms with GL HW only. Signed-off-by: Daniel Gabay Reviewed-by: Ofer Kimelman Signed-off-by: Miri Korenblit --- .../intel/iwlwifi/iwl-context-info-gen3.h | 5 ++- .../intel/iwlwifi/pcie/ctxt-info-gen3.c | 31 ++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-context-info-gen3.h b/drivers/net/wireless/intel/iwlwifi/iwl-context-info-gen3.h index 1379dc2d231b..5b62933134cf 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-context-info-gen3.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-context-info-gen3.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* - * Copyright (C) 2018, 2020-2023 Intel Corporation + * Copyright (C) 2018, 2020-2024 Intel Corporation */ #ifndef __iwl_context_info_file_gen3_h__ #define __iwl_context_info_file_gen3_h__ @@ -56,6 +56,8 @@ enum iwl_prph_scratch_mtr_format { * @IWL_PRPH_SCRATCH_RB_SIZE_EXT_8K: 8kB RB size * @IWL_PRPH_SCRATCH_RB_SIZE_EXT_12K: 12kB RB size * @IWL_PRPH_SCRATCH_RB_SIZE_EXT_16K: 16kB RB size + * @IWL_PRPH_SCRATCH_SCU_FORCE_ACTIVE: Indicate fw to set SCU_FORCE_ACTIVE + * upon reset. */ enum iwl_prph_scratch_flags { IWL_PRPH_SCRATCH_IMR_DEBUG_EN = BIT(1), @@ -71,6 +73,7 @@ enum iwl_prph_scratch_flags { IWL_PRPH_SCRATCH_RB_SIZE_EXT_8K = 8 << 20, IWL_PRPH_SCRATCH_RB_SIZE_EXT_12K = 9 << 20, IWL_PRPH_SCRATCH_RB_SIZE_EXT_16K = 10 << 20, + IWL_PRPH_SCRATCH_SCU_FORCE_ACTIVE = BIT(29), }; /* diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c index c8fc8b4fd85c..ebf11f276b20 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c @@ -1,13 +1,34 @@ // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2024 Intel Corporation */ +#include #include "iwl-trans.h" #include "iwl-fh.h" #include "iwl-context-info-gen3.h" #include "internal.h" #include "iwl-prph.h" +static const struct dmi_system_id dmi_force_scu_active_approved_list[] = { + { .ident = "DELL", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + }, + }, + { .ident = "DELL", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + }, + }, + /* keep last */ + {} +}; + +static bool iwl_is_force_scu_active_approved(void) +{ + return !!dmi_check_system(dmi_force_scu_active_approved_list); +} + static void iwl_pcie_ctxt_info_dbg_enable(struct iwl_trans *trans, struct iwl_prph_scratch_hwm_cfg *dbg_cfg, @@ -128,6 +149,14 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, if (trans->trans_cfg->imr_enabled) control_flags |= IWL_PRPH_SCRATCH_IMR_DEBUG_EN; + if (CSR_HW_REV_TYPE(trans->hw_rev) == IWL_CFG_MAC_TYPE_GL && + iwl_is_force_scu_active_approved()) { + control_flags |= IWL_PRPH_SCRATCH_SCU_FORCE_ACTIVE; + IWL_DEBUG_FW(trans, + "Context Info: Set SCU_FORCE_ACTIVE (0x%x) in control_flags\n", + IWL_PRPH_SCRATCH_SCU_FORCE_ACTIVE); + } + /* initialize RX default queue */ prph_sc_ctrl->rbd_cfg.free_rbd_addr = cpu_to_le64(trans_pcie->rxq->bd_dma); From patchwork Mon May 6 07:04:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13654993 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 33AE184DFA for ; Mon, 6 May 2024 07:05:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979104; cv=none; b=PG0+vDEe1MxCjFt1K6fqLLxBIAL8mroJ7lO0SHP3C+MsjJ9wvWQ3bktZC7heF1RxkU4/rIsgwxFLFEXaeHjhV49N7oezQUe3tNhjtM94aiN0I0ZMnM+TJn2b13fihhXpvtW9ZdCoT2YthV5lpSoqZm/xzfr5RuuKp91Abq2jHbU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979104; c=relaxed/simple; bh=jRVwnHxKIwZHdZWVps26pPuLu5rVFlQanT1/nnl7FaA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YtOWOtHS8xcl62x7ciTUxGr1kGdlAp0p1OzzhqLIChaxuEpASBdk5HeF8ia1yuHP5K2z1wPh7dLcoNgvbYJK9BDLWMx2XZKppwPwcJzm7HcHbS1TdObY4yTxotgHCP342+AuycOdN/bdeCj4h15rAo5TH3725zyeCWZQTsqkUdM= 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=H3c/9DqT; arc=none smtp.client-ip=198.175.65.21 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="H3c/9DqT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714979104; x=1746515104; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jRVwnHxKIwZHdZWVps26pPuLu5rVFlQanT1/nnl7FaA=; b=H3c/9DqTkyyNjVeKKMY1QB3iqEKbvypm/J+KUGCNCfRMXDFEPfWmaPJI Ip9JtzBJUGnBjlApRXN0qyHPDAM5HhJre0cUsXzKZcNJZdxO675EzQrLn fx/SXJSPfW3HCeI3qt1iJqyocjV91+XzKLegK5JNS4qfuddYSFQS1LxGv HaPilMr/zI259Ac6TZaG5MLI7HxouIq38peJIU4f46frwMsl9pj1KBdeg 4Ygu7y+nR9VgpiVFo/ei2aWJrH5lOXlkI2C3PE2yVmXIxcWHQxWaHUCEq TlJB/aPEqeKUCox6Y87HnXwk1yPuKmjDI/azk5Nm2e2IOi85aFAZaBI+s w==; X-CSE-ConnectionGUID: EhWtTNMRQE+F35PX1SSuMQ== X-CSE-MsgGUID: wsua3YY+QhqLwlHEqeI86w== X-IronPort-AV: E=McAfee;i="6600,9927,11064"; a="10638243" X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="10638243" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:49 -0700 X-CSE-ConnectionGUID: vMktc04KQ0aFJY38zgpbfQ== X-CSE-MsgGUID: gFXadkw6SDeDZPwf/hUNgg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="59264958" Received: from weis0040.iil.intel.com ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:47 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 11/15] wifi: iwlwifi: mvm: align UATS naming with firmware Date: Mon, 6 May 2024 10:04:15 +0300 Message-Id: <20240506095953.b0dfe17d5f44.I8f5f5a831c7b934ce3140f838315827c018103bb@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506070419.1821330-1-miriam.rachel.korenblit@intel.com> References: <20240506070419.1821330-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 From: Johannes Berg The firmware has different names for this, which is confusing as even the convention of having the firmware name in a comment after the struct definition wasn't met here. Fix the naming, but keep UATS in some of it since that's the BIOS name. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h | 10 +++++----- drivers/net/wireless/intel/iwlwifi/fw/runtime.h | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 9 +++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h b/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h index c9c0329f5778..a08497a04733 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h @@ -46,9 +46,9 @@ enum iwl_regulatory_and_nvm_subcmd_ids { SAR_OFFSET_MAPPING_TABLE_CMD = 0x4, /** - * @UATS_TABLE_CMD: &struct iwl_uats_table_cmd + * @MCC_ALLOWED_AP_TYPE_CMD: &struct iwl_mcc_allowed_ap_type_cmd */ - UATS_TABLE_CMD = 0x5, + MCC_ALLOWED_AP_TYPE_CMD = 0x5, /** * @PNVM_INIT_COMPLETE_NTFY: &struct iwl_pnvm_init_complete_ntfy @@ -701,13 +701,13 @@ struct iwl_pnvm_init_complete_ntfy { #define UATS_TABLE_COL_SIZE 13 /** - * struct iwl_uats_table_cmd - struct for UATS_TABLE_CMD + * struct iwl_mcc_allowed_ap_type_cmd - struct for MCC_ALLOWED_AP_TYPE_CMD * @offset_map: mapping a mcc to UHB AP type support (UATS) allowed * @reserved: reserved */ -struct iwl_uats_table_cmd { +struct iwl_mcc_allowed_ap_type_cmd { u8 offset_map[UATS_TABLE_ROW_SIZE][UATS_TABLE_COL_SIZE]; __le16 reserved; -} __packed; /* UATS_TABLE_CMD_S_VER_1 */ +} __packed; /* MCC_ALLOWED_AP_TYPE_CMD_API_S_VER_1 */ #endif /* __iwl_fw_api_nvm_reg_h__ */ diff --git a/drivers/net/wireless/intel/iwlwifi/fw/runtime.h b/drivers/net/wireless/intel/iwlwifi/fw/runtime.h index 4204e999bbf2..9122f9a1260a 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/runtime.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/runtime.h @@ -182,7 +182,7 @@ struct iwl_fw_runtime { u8 ppag_ver; struct iwl_sar_offset_mapping_cmd sgom_table; bool sgom_enabled; - struct iwl_uats_table_cmd uats_table; + struct iwl_mcc_allowed_ap_type_cmd uats_table; u8 uefi_tables_lock_status; bool uats_enabled; }; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c index 74b299139391..e7f5978ef2d7 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c @@ -494,7 +494,7 @@ static void iwl_mvm_uats_init(struct iwl_mvm *mvm) int ret; struct iwl_host_cmd cmd = { .id = WIDE_ID(REGULATORY_AND_NVM_GROUP, - UATS_TABLE_CMD), + MCC_ALLOWED_AP_TYPE_CMD), .flags = 0, .data[0] = &mvm->fwrt.uats_table, .len[0] = sizeof(mvm->fwrt.uats_table), @@ -516,7 +516,7 @@ static void iwl_mvm_uats_init(struct iwl_mvm *mvm) IWL_FW_CMD_VER_UNKNOWN); if (cmd_ver != 1) { IWL_DEBUG_RADIO(mvm, - "UATS_TABLE_CMD ver %d not supported\n", + "MCC_ALLOWED_AP_TYPE_CMD ver %d not supported\n", cmd_ver); return; } @@ -529,9 +529,10 @@ static void iwl_mvm_uats_init(struct iwl_mvm *mvm) ret = iwl_mvm_send_cmd(mvm, &cmd); if (ret < 0) - IWL_ERR(mvm, "failed to send UATS_TABLE_CMD (%d)\n", ret); + IWL_ERR(mvm, "failed to send MCC_ALLOWED_AP_TYPE_CMD (%d)\n", + ret); else - IWL_DEBUG_RADIO(mvm, "UATS_TABLE_CMD sent to FW\n"); + IWL_DEBUG_RADIO(mvm, "MCC_ALLOWED_AP_TYPE_CMD sent to FW\n"); } static int iwl_mvm_sgom_init(struct iwl_mvm *mvm) From patchwork Mon May 6 07:04:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13654995 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 796A913FD91 for ; Mon, 6 May 2024 07:05:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979105; cv=none; b=Wf8hqqxmd/WylLzo89IDwAp07r9EsacZH6Cp2h/bYkOgjqxufXSmcQAzbaohvJpRPX6I67Y7PBkJIkp5pzRDgwd760jY18g5jNPN3Pj0R8cM7dohP20zppnwMrizj/6XpG/22enrUmAQb077a+txY1lo/g6aXi2ra3YwCYt1/RQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979105; c=relaxed/simple; bh=AqQH/GmZLgWLn3OVToXxN/DbFag72mVpGqijOf7Fj74=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RPByD1+De+fbsEvAGZbZbwYuZKHSFxLp3Vx5l4+gVJhROzhqUVkZnYEmSJTWkjqHC9CDhFKaY/GjuIB4VcCUryQLLiFLB6cI/qSPqLFsOdCLzPUz6rhwYEnvwCvJtOtPSd3WIfWAqpcJmuHGQ+8ZkaWwvnbTZS/xiuz9DlRgvrE= 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=Y++LpdaB; arc=none smtp.client-ip=198.175.65.21 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Y++LpdaB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714979105; x=1746515105; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AqQH/GmZLgWLn3OVToXxN/DbFag72mVpGqijOf7Fj74=; b=Y++LpdaBN2bOKqtOuqA/Sbd2SHsVf+imtFNbRwVuyarpS4mUFEVv1uWG DO+tivGgDtJSUhhR9fCt1i/7fl2KTWV3HMZtNHq1EwPLWOjJB9mHX1dKf qPGXdkTwQMB4xJ25J24mfVruMx3M1RRLMzw8c9u/2mSJT5E1YB06qbfKt oUyf3cn1bGaY+ETPFiGUQO4GtuVJGL2I2BnTxEqdYg0n78fhUGQVUHTi3 jzeEKSK2EnatnRdMTTTpNhg0Gm74AcXIAiIeMxahKeLQQDd5wrmT1bNBP 6d4PWJRvksXk/QrulwPfjR0ykhu3OfOruPqanYCWfpQEu0QbOX8JQ5D3B Q==; X-CSE-ConnectionGUID: 6z4hE7tAT4qEEYK6atUz+A== X-CSE-MsgGUID: +ZGgDS1STPqwl31bzfZ8XA== X-IronPort-AV: E=McAfee;i="6600,9927,11064"; a="10638246" X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="10638246" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:50 -0700 X-CSE-ConnectionGUID: 0f6VkE8iS0ubl1y3gmygyQ== X-CSE-MsgGUID: ZWFJwRsmTqKYtVPJcnSB5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="59264978" Received: from weis0040.iil.intel.com ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:48 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, striebit Subject: [PATCH 12/15] wifi: iwlwifi: mvm: add beacon template version 14 Date: Mon, 6 May 2024 10:04:16 +0300 Message-Id: <20240506095953.76957de93810.I2c718b0d648f2559fe1337df39915c5e772856bc@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506070419.1821330-1-miriam.rachel.korenblit@intel.com> References: <20240506070419.1821330-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 From: striebit In version 14 tim_size became the offset of the broadcast TWT IE. Signed-off-by: striebit Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/fw/api/tx.h | 13 +++++++++---- drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 7 +++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/tx.h b/drivers/net/wireless/intel/iwlwifi/fw/api/tx.h index d9e4c75403b8..bbd176d88820 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/api/tx.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/api/tx.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* - * Copyright (C) 2012-2014, 2018-2023 Intel Corporation + * Copyright (C) 2012-2014, 2018-2024 Intel Corporation * Copyright (C) 2016-2017 Intel Deutschland GmbH */ #ifndef __iwl_fw_api_tx_h__ @@ -793,7 +793,8 @@ enum iwl_mac_beacon_flags { * @reserved: reserved * @link_id: the firmware id of the link that will use this beacon * @tim_idx: the offset of the tim IE in the beacon - * @tim_size: the length of the tim IE + * @tim_size: the length of the tim IE (version < 14) + * @btwt_offset: offset to the broadcast TWT IE if present (version >= 14) * @ecsa_offset: offset to the ECSA IE if present * @csa_offset: offset to the CSA IE if present * @frame: the template of the beacon frame @@ -805,14 +806,18 @@ struct iwl_mac_beacon_cmd { __le32 reserved; __le32 link_id; __le32 tim_idx; - __le32 tim_size; + union { + __le32 tim_size; + __le32 btwt_offset; + }; __le32 ecsa_offset; __le32 csa_offset; struct ieee80211_hdr frame[]; } __packed; /* BEACON_TEMPLATE_CMD_API_S_VER_10, * BEACON_TEMPLATE_CMD_API_S_VER_11, * BEACON_TEMPLATE_CMD_API_S_VER_12, - * BEACON_TEMPLATE_CMD_API_S_VER_13 + * BEACON_TEMPLATE_CMD_API_S_VER_13, + * BEACON_TEMPLATE_CMD_API_S_VER_14 */ struct iwl_beacon_notif { diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c index 2718db5aa3f5..5a06f887769a 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c @@ -1163,6 +1163,13 @@ static int iwl_mvm_mac_ctxt_send_beacon_v9(struct iwl_mvm *mvm, WLAN_EID_EXT_CHANSWITCH_ANN, beacon->len)); + if (vif->type == NL80211_IFTYPE_AP && + iwl_fw_lookup_cmd_ver(mvm->fw, BEACON_TEMPLATE_CMD, 0) >= 14) + beacon_cmd.btwt_offset = + cpu_to_le32(iwl_mvm_find_ie_offset(beacon->data, + WLAN_EID_S1G_TWT, + beacon->len)); + return iwl_mvm_mac_ctxt_send_beacon_cmd(mvm, beacon, &beacon_cmd, sizeof(beacon_cmd)); } From patchwork Mon May 6 07:04:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13654994 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 2FD847D06E for ; Mon, 6 May 2024 07:05:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979105; cv=none; b=BCt1JNS+UGS4mJfUD+iJZ6tpM9SgqE8bW6GsX94SR8NqBfERUZY2at+t50YmA2dXf0LmHAeS5ZNkQgonJvkg4ndYyfPWzRxjDbPoXvmmv9A4tniME5RzyzBPecZ4q+YbKshjncRxC8CyNtqR5a3ZEMMrVSzs9ZI8vDbrneQfQ0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979105; c=relaxed/simple; bh=ugG6CR6kXKPeohpjZd46oi+5QmHPp68lpjv2CKY87Os=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=av51ih9PbOXY6sm1go6r+d6GyHJ9xUTXv1OKvbwm2KzvE8l4VsrGmWE+SRNmOqxFGgDlPUe+Z/48uvP5ORwbw4Wj7xLtMOAF0s6Y9al/LM0QIyQnq80Sj933+faIL/NJgv1y0CO3IbGn83oO+ifHDfynLk4aERFy/69rU/q4jlo= 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=ZdbDsCHA; arc=none smtp.client-ip=198.175.65.21 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZdbDsCHA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714979105; x=1746515105; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ugG6CR6kXKPeohpjZd46oi+5QmHPp68lpjv2CKY87Os=; b=ZdbDsCHAusP42+EJ6FuHSGkcjKM+GklZ8GrQ1++c/1hwkkthK0SmdBZ3 NHZRda9ufCdtvBsnlPbQqJ6K4YtMvnsnJGaTBu/Y2hqQN9+Rfk20AmeRY gtlZIlT/4AodsNln89z0swB3jrHA1IkqMqXXdSK5TEzW8Ff9Iuyewtksc jloFy2enLUmDfdFApJfmoyXTzD9YRGuH1BQBypaFp/3BjW/wxxz/PnS1j T5h5jVyz3p0//vhQPTUpXdSP0cXroZxym1uCqSmSU57r2QhxzKy+NVCQo I/ph99DlCO4bVCWoY3gInNajZZQls9fUnbyHU8e+5fZ7vhc6zFUofNOzv Q==; X-CSE-ConnectionGUID: VWMGHNeJQOSaenQWkH6ZwQ== X-CSE-MsgGUID: jtI65bg4Q2uevUMcgfLN6Q== X-IronPort-AV: E=McAfee;i="6600,9927,11064"; a="10638255" X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="10638255" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:51 -0700 X-CSE-ConnectionGUID: ztRjRzwiQC2+Rdg8XPM2fA== X-CSE-MsgGUID: my3XMPq3SU2UTYhY1y9RHA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="59264998" Received: from weis0040.iil.intel.com ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:49 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 13/15] wifi: iwlwifi: mvm: exit EMLSR if secondary link is not used Date: Mon, 6 May 2024 10:04:17 +0300 Message-Id: <20240506095953.99ad1d71e9b9.Ide825433488ec809773efdc36937e3089d0012df@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506070419.1821330-1-miriam.rachel.korenblit@intel.com> References: <20240506070419.1821330-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 Exit EMLSR mode if the secondary link is not used enough for Rx/Tx Signed-off-by: Miri Korenblit Reviewed-by: Johannes Berg --- drivers/net/wireless/intel/iwlwifi/mvm/link.c | 3 +- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 + drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 37 ++++++++++++++++++- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/link.c b/drivers/net/wireless/intel/iwlwifi/mvm/link.c index b0568c74a15b..b4ba5f81f20c 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/link.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/link.c @@ -15,7 +15,8 @@ HOW(EXIT_LOW_RSSI) \ HOW(EXIT_COEX) \ HOW(EXIT_BANDWIDTH) \ - HOW(EXIT_CSA) + HOW(EXIT_CSA) \ + HOW(EXIT_LINK_USAGE) static const char *const iwl_mvm_esr_states_names[] = { #define NAME_ENTRY(x) [ilog2(IWL_MVM_ESR_##x)] = #x, diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index b96568f5640c..1f58c727fa63 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -369,6 +369,7 @@ struct iwl_mvm_vif_link_info { * @IWL_MVM_ESR_EXIT_BANDWIDTH: Bandwidths of primary and secondry links * preventing the enablement of EMLSR * @IWL_MVM_ESR_EXIT_CSA: CSA happened, so exit EMLSR + * @IWL_MVM_ESR_EXIT_LINK_USAGE: Exit EMLSR due to low tpt on secondary link */ enum iwl_mvm_esr_state { IWL_MVM_ESR_BLOCKED_PREVENTION = 0x1, @@ -381,6 +382,7 @@ enum iwl_mvm_esr_state { IWL_MVM_ESR_EXIT_COEX = 0x40000, IWL_MVM_ESR_EXIT_BANDWIDTH = 0x80000, IWL_MVM_ESR_EXIT_CSA = 0x100000, + IWL_MVM_ESR_EXIT_LINK_USAGE = 0x200000, }; #define IWL_MVM_BLOCK_ESR_REASONS 0xffff diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c index 36083905457b..4fa8066a89b6 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c @@ -951,12 +951,19 @@ iwl_mvm_stat_iterator_all_links(struct iwl_mvm *mvm, } } +#define SEC_LINK_MIN_PERC 10 +#define SEC_LINK_MIN_TX 3000 +#define SEC_LINK_MIN_RX 400 + static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm) { struct ieee80211_vif *bss_vif = iwl_mvm_get_bss_vif(mvm); struct iwl_mvm_vif *mvmvif; struct iwl_mvm_sta *mvmsta; unsigned long total_tx = 0, total_rx = 0; + unsigned long sec_link_tx = 0, sec_link_rx = 0; + u8 sec_link_tx_perc, sec_link_rx_perc; + u8 sec_link; lockdep_assert_held(&mvm->mutex); @@ -973,6 +980,13 @@ static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm) if (!mvmsta->mpdu_counters) return; + /* Get the FW ID of the secondary link */ + sec_link = iwl_mvm_get_other_link(bss_vif, + iwl_mvm_get_primary_link(bss_vif)); + if (WARN_ON(!mvmvif->link[sec_link])) + return; + sec_link = mvmvif->link[sec_link]->fw_link_id; + /* Sum up RX and TX MPDUs from the different queues/links */ for (int q = 0; q < mvm->trans->num_rx_queues; q++) { spin_lock_bh(&mvmsta->mpdu_counters[q].lock); @@ -982,6 +996,10 @@ static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm) total_tx += mvmsta->mpdu_counters[q].per_link[link].tx; total_rx += mvmsta->mpdu_counters[q].per_link[link].rx; } + + sec_link_tx += mvmsta->mpdu_counters[q].per_link[sec_link].tx; + sec_link_rx += mvmsta->mpdu_counters[q].per_link[sec_link].rx; + /* * In EMLSR we have statistics every 5 seconds, so we can reset * the counters upon every statistics notification. @@ -994,9 +1012,26 @@ static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm) /* If we don't have enough MPDUs - exit EMLSR */ if (total_tx < IWL_MVM_ENTER_ESR_TPT_THRESH && - total_rx < IWL_MVM_ENTER_ESR_TPT_THRESH) + total_rx < IWL_MVM_ENTER_ESR_TPT_THRESH) { iwl_mvm_block_esr(mvm, bss_vif, IWL_MVM_ESR_BLOCKED_TPT, iwl_mvm_get_primary_link(bss_vif)); + return; + } + + /* Calculate the percentage of the secondary link TX/RX */ + sec_link_tx_perc = total_tx ? sec_link_tx * 100 / total_tx : 0; + sec_link_rx_perc = total_rx ? sec_link_rx * 100 / total_rx : 0; + + /* + * The TX/RX percentage is checked only if it exceeds the required + * minimum. In addition, RX is checked only if the TX check failed. + */ + if ((total_tx > SEC_LINK_MIN_TX && + sec_link_tx_perc < SEC_LINK_MIN_PERC) || + (total_rx > SEC_LINK_MIN_RX && + sec_link_rx_perc < SEC_LINK_MIN_PERC)) + iwl_mvm_exit_esr(mvm, bss_vif, IWL_MVM_ESR_EXIT_LINK_USAGE, + iwl_mvm_get_primary_link(bss_vif)); } void iwl_mvm_handle_rx_system_oper_stats(struct iwl_mvm *mvm, From patchwork Mon May 6 07:04:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13654996 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 B2E2F140370 for ; Mon, 6 May 2024 07:05:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979106; cv=none; b=t6VsoPiPXnytnspusW6umUdehKvCKUl/ZQFA+IEDNW5O+2Qw+/iAR5EFvuXTNLCD2G93ZO7Z2lLOz7vKh6o2ctuIfnTigechr+30FsRkAvIA6FBqIuybbjWs4Ww8hGL3fdMCYd70LNGLU271ubudSORBYjZw01ClMXt2N4fwwI4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979106; c=relaxed/simple; bh=Wk9y+J+sqxjHcaiMv9mqpmeWgO4t83WZipC7Zie8W6s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FdB8zOUSZxDp4cgZMEpFeq2zJcrl84jYSRXU/Il3QKK8qAnJoQgjN0lreOGndnzRzb2uIGcGujQn7nMWK6tIV9QT6Tc2pfx1EkTVXRQ+C1TDooDekUZAkM1m3axdKL7dvGReTpUewHpHwX6Qh01PqW0E88lQLybQkhpvp7+Fjbk= 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=acA9Ygrd; arc=none smtp.client-ip=198.175.65.21 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="acA9Ygrd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714979105; x=1746515105; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Wk9y+J+sqxjHcaiMv9mqpmeWgO4t83WZipC7Zie8W6s=; b=acA9YgrdXhBWfKxCc1KMjuJq+BXRzNH5V0+IoP/w+rHolYGWfmMm/s66 zAnnXBhk9xT8iiH55RpevYVV6dt9Rrhvgnp7dJVaLCz2PRjN3s1jcjV7D 7ByYrhBu1fyjIQRaplMd3NRfvRorfL2++3KNvrYwmR5bOCnvRa/vHaD8C CCaMJZV2vnHJ+ZOumfdmhEzxRK68XUmmp1AmoIzINkbSLGN3EeqVyPsdq wg2PE7Cg7mRXSjbdfZDvNvYWR4PUQ80OtD1WmpPgsfgfWTExCtCP61QQ7 FAMTlUGqlpIGoPEj1X18lrDRM6kI8XYf6ZIJmLJDq+ZhV44RQisofdxJu g==; X-CSE-ConnectionGUID: YU1fe8F2TgmkLzWWWz8sXg== X-CSE-MsgGUID: lIvntxz9RrOwInJADrSggQ== X-IronPort-AV: E=McAfee;i="6600,9927,11064"; a="10638261" X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="10638261" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:52 -0700 X-CSE-ConnectionGUID: EebA4DnRQ+OaYmgGzjus4A== X-CSE-MsgGUID: nGBknR/PSTCJ/kjZikhlIw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="59265007" Received: from weis0040.iil.intel.com ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:51 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 14/15] wifi: iwlwifi: mvm: don't request statistics in restart Date: Mon, 6 May 2024 10:04:18 +0300 Message-Id: <20240506095953.16638dec9f7b.I093514312179bae566ad8d73ffb0355c6eee288a@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506070419.1821330-1-miriam.rachel.korenblit@intel.com> References: <20240506070419.1821330-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 During restart mac80211 notifies the driver about the association, (if we was associated before the restart) which causes the driver to request statistics from the FW. This causes to an immediate exit from EMLSR after the restart is done, when the statistics notif is handled. (too low TPT). There is no point in requesting statistics wnyway, since the FW just started and don't have any. Signed-off-by: Miri Korenblit Reviewed-by: Johannes Berg --- drivers/net/wireless/intel/iwlwifi/mvm/utils.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c index 74452b2112b0..47283a358ffd 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c @@ -435,6 +435,13 @@ int iwl_mvm_request_statistics(struct iwl_mvm *mvm, bool clear) IWL_FW_CMD_VER_UNKNOWN); int ret; + /* + * Don't request statistics during restart, they'll not have any useful + * information right after restart, nor is clearing needed + */ + if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) + return 0; + if (cmd_ver != IWL_FW_CMD_VER_UNKNOWN) return iwl_mvm_request_system_statistics(mvm, clear, cmd_ver); From patchwork Mon May 6 07:04:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13654997 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 1EF5D1411D2 for ; Mon, 6 May 2024 07:05:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979113; cv=none; b=iPdKQ+b/ytfMuIK5Kc2c3uQ0e8/NsHbMa/PIxf4CWsSk1ffHKIcbCRCRO3Zw89ZNs9wR1fDhJ8LY476v31QJaXgluHCdq5CR81oY1iK2y5QtGQNUljXgBu9rZg3hhg5aHMzH1Hj6zls8dBeQGiSVtz5O2yjFW7hASlwr2rLbNv0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714979113; c=relaxed/simple; bh=lDyyMbX2KSSAd9eXyMw8vJtuphu3BM/G1JlzRaTQe6w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oHmeD5mHbM0+pk/BxTt0xwHMUFXaC+/EdZJy5E70vgDXIXWHcIJmUNuB+IXtrvhF5kNdJvxo5VcK/EodZ1HO28RF8rDlwOo9dHeL9CjhlAdluG1oyPUeLJ+CTEgmtBnCaAjWqFvHF3d3SE0Y+X4Ca85k3pzWH3tHwjmynt+B/xE= 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=WgnZgFqa; arc=none smtp.client-ip=198.175.65.21 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WgnZgFqa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714979112; x=1746515112; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lDyyMbX2KSSAd9eXyMw8vJtuphu3BM/G1JlzRaTQe6w=; b=WgnZgFqaxY7nj6G0x9nhKeM6O1V8ZqpdCXng9c3mfaVFCfI2KgvZ3V7Y AXDi+UuHfCiIq8/BFmMV9fGa6ac2PJ2Kf/RVMTh+R/yQdJqmo3P5JemJb Cpa5/R/Fo4R5T9IJcGUQkkzqKzKpRjZrSZiAG3A95VCls2HVFDNNuh0R/ 6tDykVafNb4h+0eweOt31afBqp6OpiRX197WkIZSq6/CQdWL+BE6MoqaH 5pelgPJM9CDiure9eHidRFpPFJyj/vB5Ieh4WSN8v7jqc+VlTXZqc5iqm izGXwrRIt+nOXa/GXuQhu3j8+gyzD3p1sV1DDTFrm3WZdfM7oy8vAR+VR w==; X-CSE-ConnectionGUID: HdzEpT83RRaaUbA8+Xi2sQ== X-CSE-MsgGUID: jDkp5ZEJTxqZT88ehK1aXw== X-IronPort-AV: E=McAfee;i="6600,9927,11064"; a="10638272" X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="10638272" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:54 -0700 X-CSE-ConnectionGUID: E+tfNewQR2G+dxfDaLtjzQ== X-CSE-MsgGUID: Sfz5taGNT7iYfRuzao9pDQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208";a="59265016" Received: from weis0040.iil.intel.com ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2024 00:04:52 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Daniel Gabay , Eilon Rinat Subject: [PATCH 15/15] wifi: iwlwifi: Ensure prph_mac dump includes all addresses Date: Mon, 6 May 2024 10:04:19 +0300 Message-Id: <20240506095953.31fa9ce91a1c.Ia0c86f70c7a6874c15ffc6f8235aa88530208546@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240506070419.1821330-1-miriam.rachel.korenblit@intel.com> References: <20240506070419.1821330-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 From: Daniel Gabay In prph_mac_iter, ensure that all required addresses are dumped even if a read fails. Currently, if a read fails, the region dump is stopped, preventing the creation of prph_mac.lst. By dumping all addresses even if a read fails, we can accurately determine which addresses were successfully read and which were not. Signed-off-by: Daniel Gabay Reviewed-by: Eilon Rinat Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c index fe4e1bea30bb..945ffc083d25 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c @@ -1026,17 +1026,12 @@ static int iwl_dump_ini_prph_mac_iter_common(struct iwl_fw_runtime *fwrt, { struct iwl_fw_ini_error_dump_range *range = range_ptr; __le32 *val = range->data; - u32 prph_val; int i; range->internal_base_addr = cpu_to_le32(addr); range->range_data_size = size; - for (i = 0; i < le32_to_cpu(size); i += 4) { - prph_val = iwl_read_prph(fwrt->trans, addr + i); - if (iwl_trans_is_hw_error_value(prph_val)) - return -EBUSY; - *val++ = cpu_to_le32(prph_val); - } + for (i = 0; i < le32_to_cpu(size); i += 4) + *val++ = cpu_to_le32(iwl_read_prph(fwrt->trans, addr + i)); return sizeof(*range) + le32_to_cpu(range->range_data_size); }