From patchwork Fri Dec 27 08:00:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13921610 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 A600CA920 for ; Fri, 27 Dec 2024 08:01:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286489; cv=none; b=pF0hcX/XIFXN0HXYCY2uo329LRMac6+ip9qXBQCuRma+/F9I/BBQz0omTVErb6YMf4vwJdgJljR52AhOQu6Y0HQDOIQOssc5Zk9B+KzxHCWeWsnvD3bvJmSAuwk3pE965sg2cuaeMm+mG7D1hALOytv8OvSfYwhwrawUQ95EW6E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286489; c=relaxed/simple; bh=mNCGBE/wm0QxYM001luwkd7Ldje+R/xTRtBY0J2dnqE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NaKRfB1ytd5scgc27MJ1/aeQRbcl8Iqtih1m02yZTAtG2GeO8sOED6Dccql/0iaR2CoGvXN2FEGg8URq5NXQy/tUKDkwUvH8V/QJPiiE1L4E8bij5FFFQNDVWTGcSe5U/+hKcS1oJ8eGJIv64v6ZVdDwqqVqcwqJin1iWJFANQ4= 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=O0qu7H8J; arc=none smtp.client-ip=198.175.65.13 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="O0qu7H8J" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286487; x=1766822487; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mNCGBE/wm0QxYM001luwkd7Ldje+R/xTRtBY0J2dnqE=; b=O0qu7H8Jb0ymrollpgLaDx3HaHcVbX2Qg1Fb6f+J983tfjzGtiOPoOl+ Je/YNffwHLaObUhOiC206iz+9/n53RXwpJSuWVyaMGds0cIT+C9vQl4Sh tpz8cw+/zth7bQskcEfnzwY10ECyocIKrG5lD/EGANK6r8HrsVkKy4bLk OEGy5L/r1WrA03/Kf0ovAM2/nd9Stx9MATkUTk6tP6sNLlFef43yNcE5y /CCcaNBofyreQ0LiMwosj8maQNOAhUGVUNzf1vLWFfncl9oa6dzn2TEAm Ro3ddIdP2HaaZJ3n2Ac0m1ytJC2V6mwMqiv/NIvzEd+Kry780hksufPdp w==; X-CSE-ConnectionGUID: LHDwrjWVRxOIpF2vw6OlPQ== X-CSE-MsgGUID: w7E+R+BJSkOkUYl+2+Gfbw== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46690907" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46690907" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:27 -0800 X-CSE-ConnectionGUID: YCpmvJpiR+6S7h3gz+W/KA== X-CSE-MsgGUID: RGDXrwxqQ96YBUJ58O8qcw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858199" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:25 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 01/17] wifi: iwlwifi: differentiate NIC error types Date: Fri, 27 Dec 2024 10:00:56 +0200 Message-Id: <20241227095718.aed9c9e4fac0.I2288042bec4728a75b61cb7f6ded5214bfa3ce85@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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 Instead of differentiating only sync/async, differentiate the type of error, and document that only reset handshake timeout (IWL_ERR_TYPE_RESET_HS_TIMEOUT) needs sync handling. The special sync handling is somewhat temporary, the idea is to later split the nic_error() method into error dump, synchronizing the dump, and SW reset methods, and the type is mostly in order to unify command queue full handling into that new architecture as well. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/dvm/main.c | 3 ++- drivers/net/wireless/intel/iwlwifi/iwl-io.c | 2 +- .../net/wireless/intel/iwlwifi/iwl-op-mode.h | 24 +++++++++++++++---- .../net/wireless/intel/iwlwifi/iwl-trans.h | 5 ++-- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 11 ++++----- drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 2 +- .../wireless/intel/iwlwifi/pcie/trans-gen2.c | 2 +- 7 files changed, 32 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/main.c b/drivers/net/wireless/intel/iwlwifi/dvm/main.c index 769b75c3fa5b..2c4363662efd 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/main.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/main.c @@ -1942,7 +1942,8 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand) } } -static void iwl_nic_error(struct iwl_op_mode *op_mode, bool sync) +static void iwl_nic_error(struct iwl_op_mode *op_mode, + enum iwl_fw_error_type type) { struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-io.c b/drivers/net/wireless/intel/iwlwifi/iwl-io.c index 060becfd64f3..0653ca8b974a 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-io.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-io.c @@ -526,5 +526,5 @@ void iwl_trans_sync_nmi_with_addr(struct iwl_trans *trans, u32 inta_addr, if (interrupts_enabled) iwl_trans_interrupts(trans, true); - iwl_trans_fw_error(trans, false); + iwl_trans_fw_error(trans, IWL_ERR_TYPE_NMI_FORCED); } diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h b/drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h index 8ef5ed2db051..8febc949b610 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h @@ -44,6 +44,20 @@ struct iwl_cfg; * 5) The driver layer stops the op_mode */ +/** + * enum iwl_fw_error_type - FW error types/sources + * @IWL_ERR_TYPE_IRQ: "normal" FW error through an IRQ + * @IWL_ERR_TYPE_NMI_FORCED: NMI was forced by driver + * @IWL_ERR_TYPE_RESET_HS_TIMEOUT: reset handshake timed out, + * any debug collection must happen synchronously as + * the device will be shut down + */ +enum iwl_fw_error_type { + IWL_ERR_TYPE_IRQ, + IWL_ERR_TYPE_NMI_FORCED, + IWL_ERR_TYPE_RESET_HS_TIMEOUT, +}; + /** * struct iwl_op_mode_ops - op_mode specific operations * @@ -78,7 +92,7 @@ struct iwl_cfg; * there are Tx packets pending in the transport layer. * Must be atomic * @nic_error: error notification. Must be atomic and must be called with BH - * disabled, unless the sync parameter is true. + * disabled, unless the type is IWL_ERR_TYPE_RESET_HS_TIMEOUT * @cmd_queue_full: Called when the command queue gets full. Must be atomic and * called with BH disabled. * @nic_config: configure NIC, called before firmware is started. @@ -104,7 +118,8 @@ struct iwl_op_mode_ops { void (*queue_not_full)(struct iwl_op_mode *op_mode, int queue); bool (*hw_rf_kill)(struct iwl_op_mode *op_mode, bool state); void (*free_skb)(struct iwl_op_mode *op_mode, struct sk_buff *skb); - void (*nic_error)(struct iwl_op_mode *op_mode, bool sync); + void (*nic_error)(struct iwl_op_mode *op_mode, + enum iwl_fw_error_type type); void (*cmd_queue_full)(struct iwl_op_mode *op_mode); void (*nic_config)(struct iwl_op_mode *op_mode); void (*wimax_active)(struct iwl_op_mode *op_mode); @@ -177,9 +192,10 @@ static inline void iwl_op_mode_free_skb(struct iwl_op_mode *op_mode, op_mode->ops->free_skb(op_mode, skb); } -static inline void iwl_op_mode_nic_error(struct iwl_op_mode *op_mode, bool sync) +static inline void iwl_op_mode_nic_error(struct iwl_op_mode *op_mode, + enum iwl_fw_error_type type) { - op_mode->ops->nic_error(op_mode, sync); + op_mode->ops->nic_error(op_mode, type); } static inline void iwl_op_mode_cmd_queue_full(struct iwl_op_mode *op_mode) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h index c70da7281551..56b551fd2156 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h @@ -1120,7 +1120,8 @@ bool _iwl_trans_grab_nic_access(struct iwl_trans *trans); void __releases(nic_access) iwl_trans_release_nic_access(struct iwl_trans *trans); -static inline void iwl_trans_fw_error(struct iwl_trans *trans, bool sync) +static inline void iwl_trans_fw_error(struct iwl_trans *trans, + enum iwl_fw_error_type type) { if (WARN_ON_ONCE(!trans->op_mode)) return; @@ -1128,7 +1129,7 @@ static inline void iwl_trans_fw_error(struct iwl_trans *trans, bool sync) /* prevent double restarts due to the same erroneous FW */ if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status)) { trans->state = IWL_TRANS_NO_FW; - iwl_op_mode_nic_error(trans->op_mode, sync); + iwl_op_mode_nic_error(trans->op_mode, type); } } diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index 0deaf6ed8994..e21199313278 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -2108,7 +2108,8 @@ void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error) } } -static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode, bool sync) +static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode, + enum iwl_fw_error_type type) { struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); @@ -2117,13 +2118,9 @@ static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode, bool sync) &mvm->status)) iwl_mvm_dump_nic_error_log(mvm); - if (sync) { + /* reset HS timeout is during shutdown, so collect right now */ + if (type == IWL_ERR_TYPE_RESET_HS_TIMEOUT) { iwl_fw_error_collect(&mvm->fwrt, true); - /* - * Currently, the only case for sync=true is during - * shutdown, so just stop in this case. If/when that - * changes, we need to be a bit smarter here. - */ return; } diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c index afb88eab8174..02fef6baf2e3 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c @@ -1702,7 +1702,7 @@ static void iwl_pcie_irq_handle_error(struct iwl_trans *trans) /* The STATUS_FW_ERROR bit is set in this function. This must happen * before we wake up the command caller, to ensure a proper cleanup. */ - iwl_trans_fw_error(trans, false); + iwl_trans_fw_error(trans, IWL_ERR_TYPE_IRQ); clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status); wake_up(&trans->wait_command_queue); diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c index 8903a5692dfb..469ef32a3e26 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c @@ -124,7 +124,7 @@ static void iwl_trans_pcie_fw_reset_handshake(struct iwl_trans *trans) inta_hw); if (!(inta_hw & MSIX_HW_INT_CAUSES_REG_RESET_DONE)) - iwl_trans_fw_error(trans, true); + iwl_trans_fw_error(trans, IWL_ERR_TYPE_RESET_HS_TIMEOUT); } trans_pcie->fw_reset_state = FW_RESET_IDLE; From patchwork Fri Dec 27 08:00:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13921612 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 0ACDE5D8F0 for ; Fri, 27 Dec 2024 08:01:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286491; cv=none; b=I0g3NfFmASdTekUwvUWDkyqB/RQFDhWCSM3NCoTM0znQPNcfSy9xQOORE1Q/rKbJwUB7Wef2azx8evNMBtyKp555U0zdko+EiBDX8gAj3oEQCAcrKaQdwnNEne03ii+htO/tema8r1gUf+cGoclCLrOVtM8gJYkcGn6voVYBEyY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286491; c=relaxed/simple; bh=XOm55/LIVqi5UJE6fq00fM3Qj22Ye0PVPJwJrxMIx1A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BLDzLm07lUQLn4k3yU9rYkMyavqDxbwGS8e8Q3qCEUrdVhDOdRso3jf0RC731k4vhN73Z9M0nMH7oaaXqaMTJV16QHmeBef6XL3tmR7YpZ4YpFtetUyBdvphppJNCJckkEcLvQ5fkUrc1JDLIiUoxujqs5rlURmd8DJSKbHFhNk= 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=aVeeTAs1; arc=none smtp.client-ip=198.175.65.13 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="aVeeTAs1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286489; x=1766822489; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XOm55/LIVqi5UJE6fq00fM3Qj22Ye0PVPJwJrxMIx1A=; b=aVeeTAs1vdBabfmggeaW6LvYCmp5tWEwkg7kWOXA8xjxyj/nKiPyX5Hh /+A7BTUa0k6q6DaZ/PiSkht2mlhsimumFwZTc5+Tt6SBoeTKqZ1SUfa4A 2acQPy8p3q7ZD09oHbcewKwSBFtO2PnsHYGV+mwHvwAcuopsOJQwIGsxQ OylrMrHfHu856mcglPbHrjQ8q7kgwK5nccQWH9MDm43sVOzDYBOkYAL5C gvnPZvNwWDCmjfz2kCl3y7NH/+goQwnQZ/ZNb3Gq2JKZdydC2o27ce3qX WpP+gTbtqlFdfNlTUjw+VsNzPbVphCWRPIswCPeML/DodNeYvwulIFZmr Q==; X-CSE-ConnectionGUID: TzUdnaMbQvGDG/v0CsZTag== X-CSE-MsgGUID: Cqj3K7YkSSiwPiZt61kpyw== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46690913" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46690913" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:28 -0800 X-CSE-ConnectionGUID: JzIxjwYkQdeFcLc9gm55ew== X-CSE-MsgGUID: iM4YjirxRr2zXof4ESSwwQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858208" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:27 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 02/17] wifi: iwlwifi: mvm: remove warning on unallocated BAID Date: Fri, 27 Dec 2024 10:00:57 +0200 Message-Id: <20241227095718.4360f2b9e185.I447f9a5fc6dfdc78ec238200338e2da040ee7e61@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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 Due to the firmware allocating the BAID, we can only install the data structure after the BAID is valid from the firmware's point of view. As a result, the firmware can start sending frame release notifications to the driver immediately. This isn't supposed to happen by protocol, since the peer STA is not expected to use the blockack session until the AddBA has a response. However, firmware doesn't know that, our RX path can't know when it was, so simply don't WARN in this case but only have a debug message. Since the BAID comes from firmware, also use IWL_FW_CHECK() instead of a warning for the validity check. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c index c03cb7cc2f1c..09fd8752046e 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c @@ -636,15 +636,21 @@ static void iwl_mvm_release_frames_from_notif(struct iwl_mvm *mvm, IWL_DEBUG_HT(mvm, "Frame release notification for BAID %u, NSSN %d\n", baid, nssn); - if (WARN_ON_ONCE(baid == IWL_RX_REORDER_DATA_INVALID_BAID || - baid >= ARRAY_SIZE(mvm->baid_map))) + if (IWL_FW_CHECK(mvm, + baid == IWL_RX_REORDER_DATA_INVALID_BAID || + baid >= ARRAY_SIZE(mvm->baid_map), + "invalid BAID from FW: %d\n", baid)) return; rcu_read_lock(); ba_data = rcu_dereference(mvm->baid_map[baid]); - if (WARN(!ba_data, "BAID %d not found in map\n", baid)) + if (!ba_data) { + IWL_DEBUG_RX(mvm, + "Got valid BAID %d but not allocated, invalid frame release!\n", + baid); goto out; + } /* pick any STA ID to find the pointer */ sta_id = ffs(ba_data->sta_mask) - 1; From patchwork Fri Dec 27 08:00:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13921614 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 014E514B956 for ; Fri, 27 Dec 2024 08:01:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286493; cv=none; b=YoRzYWUAI5XxXXnY75cTOmfs5gjD/89/FLHPtdM5atr5w29bd4grKdAVbqNTChK9u3mcFpA2UXjehanN6siBfUKY71nc8zlK0cpZOXX6lVISRWm7cTS9V6Lx33Etine/dt1BApIPQLW4KITtzib/q08BST/IQOIfowrJCgtOuyQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286493; c=relaxed/simple; bh=7cHb/vz9JCm9Q6O4LQgx0TAsCuvumqX8+NUZI1GPxrE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iT2oSy6g4lNJDMv6+Qn7wRxY4K/+K7bbekb4OfXWCRmRRXSeHG1vPAZGmZy0VTu7FnRONqvFQZrRlFisAiJktabriVFn+kdIcPYXKdRcXZCPOyEKX8TxtDziqLFSjKSQA+dpIlmDFnWVxttgOZBHe46sqpqewOggTDWNEbqCVAU= 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=doWyhczb; arc=none smtp.client-ip=198.175.65.13 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="doWyhczb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286490; x=1766822490; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7cHb/vz9JCm9Q6O4LQgx0TAsCuvumqX8+NUZI1GPxrE=; b=doWyhczb4SNdDkbeGtHkgZqoFaESGC28XDnlnQv3z1ZttbZu8Gw9IyKr mTg7gk0v9FJAVoIpLReF6tfvPeXzdWfFxNvxCIm0nWxIsaAcUDIujkKvy c8gBeXN4uiOHdqrCzUyiSL+4PiugxvjYhNLx2x3B0h5gHdwb3q63HyYEv WtJlsYAHhiDsVz8D9GwFCrXZFWWGMdD7FYTDSwE+paOBH7ZuIYWZK/Yty h+d1SND1Rz4IXMXyrAsHShtoRQzIYANjxChnnWK+8sVOdv2ZBK4E7DR4I k7Y08xKjVQ7XzngjxnCGxoF0bF8oQA84okqYnYObnRWVNFwViH6DUkTcn Q==; X-CSE-ConnectionGUID: VHKuJ57cSW2VjeOUwfrESg== X-CSE-MsgGUID: eGnYl8iYRkOGjx1p4hd+wQ== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46690916" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46690916" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:29 -0800 X-CSE-ConnectionGUID: emiLkYZxTN6ev7QID/TWgw== X-CSE-MsgGUID: 6cF+6AHrQhWv3SvjhcgeBA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858218" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:28 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Benjamin Berg Subject: [PATCH 03/17] wifi: iwlwifi: mvm: skip short statistics window when updating EMLSR Date: Fri, 27 Dec 2024 10:00:58 +0200 Message-Id: <20241227095718.0eb0f2044535.Ic2af92737ccfc873f3b6c228704238ebb9f983ca@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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 The statistics are not synchronized with the time that we enter EMLSR. This means that we can receive the statistic notification just after having cleared the counters, causing us to immediately exit EMLSR again. Fix this by checking that most of the time for the window has passed. If that is not the case, ignore this window and wait for the next notification. Signed-off-by: Benjamin Berg Signed-off-by: Miri Korenblit --- .../wireless/intel/iwlwifi/mvm/mld-mac80211.c | 36 ------------------- drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 16 +++++++++ 2 files changed, 16 insertions(+), 36 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c index cc54c33dcb02..6bc881f14fd4 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c @@ -208,32 +208,6 @@ static unsigned int iwl_mvm_mld_count_active_links(struct iwl_mvm_vif *mvmvif) return n_active; } -static void iwl_mvm_restart_mpdu_count(struct iwl_mvm *mvm, - struct iwl_mvm_vif *mvmvif) -{ - struct ieee80211_sta *ap_sta = mvmvif->ap_sta; - struct iwl_mvm_sta *mvmsta; - - lockdep_assert_held(&mvm->mutex); - - if (!ap_sta) - return; - - mvmsta = iwl_mvm_sta_from_mac80211(ap_sta); - if (!mvmsta->mpdu_counters) - return; - - for (int q = 0; q < mvm->trans->num_rx_queues; q++) { - spin_lock_bh(&mvmsta->mpdu_counters[q].lock); - memset(mvmsta->mpdu_counters[q].per_link, 0, - sizeof(mvmsta->mpdu_counters[q].per_link)); - mvmsta->mpdu_counters[q].window_start = jiffies; - spin_unlock_bh(&mvmsta->mpdu_counters[q].lock); - } - - IWL_DEBUG_INFO(mvm, "MPDU counters are cleared\n"); -} - static int iwl_mvm_esr_mode_active(struct iwl_mvm *mvm, struct ieee80211_vif *vif) { @@ -267,13 +241,6 @@ static int iwl_mvm_esr_mode_active(struct iwl_mvm *mvm, else mvmvif->primary_link = __ffs(vif->active_links); - /* - * Restart the MPDU counters and the counting window, so when the - * statistics arrive (which is where we look at the counters) we - * will be at the end of the window. - */ - iwl_mvm_restart_mpdu_count(mvm, mvmvif); - iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_ESR_LINK_UP, NULL); @@ -445,9 +412,6 @@ static int iwl_mvm_esr_mode_inactive(struct iwl_mvm *mvm, break; } - /* Start a new counting window */ - iwl_mvm_restart_mpdu_count(mvm, mvmvif); - iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_ESR_LINK_DOWN, NULL); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c index 9e72db9bab40..00aac76e8509 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c @@ -962,6 +962,9 @@ iwl_mvm_stat_iterator_all_links(struct iwl_mvm *mvm, #define SEC_LINK_MIN_TX 3000 #define SEC_LINK_MIN_RX 400 +/* Accept a ~20% short window to avoid issues due to jitter */ +#define IWL_MVM_TPT_MIN_COUNT_WINDOW (IWL_MVM_TPT_COUNT_WINDOW_SEC * HZ * 4 / 5) + static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm) { struct ieee80211_vif *bss_vif = iwl_mvm_get_bss_vif(mvm); @@ -971,6 +974,7 @@ static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm) unsigned long sec_link_tx = 0, sec_link_rx = 0; u8 sec_link_tx_perc, sec_link_rx_perc; u8 sec_link; + bool skip = false; lockdep_assert_held(&mvm->mutex); @@ -1010,13 +1014,25 @@ static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm) /* * In EMLSR we have statistics every 5 seconds, so we can reset * the counters upon every statistics notification. + * The FW sends the notification regularly, but it will be + * misaligned at the start. Skipping the measurement if it is + * short will synchronize us. */ + if (jiffies - mvmsta->mpdu_counters[q].window_start < + IWL_MVM_TPT_MIN_COUNT_WINDOW) + skip = true; + mvmsta->mpdu_counters[q].window_start = jiffies; memset(mvmsta->mpdu_counters[q].per_link, 0, sizeof(mvmsta->mpdu_counters[q].per_link)); spin_unlock_bh(&mvmsta->mpdu_counters[q].lock); } + if (skip) { + IWL_DEBUG_INFO(mvm, "MPDU statistics window was short\n"); + return; + } + IWL_DEBUG_INFO(mvm, "total Tx MPDUs: %ld. total Rx MPDUs: %ld\n", total_tx, total_rx); From patchwork Fri Dec 27 08:00:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13921613 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 9470014F9EB for ; Fri, 27 Dec 2024 08:01:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286493; cv=none; b=iZ9k9YRsvP6zlXFtX0T3/w/CRNesTZrZ55zI9/cmbUC6LXhp/n8OZ1vt6/rNSZ0IWiWTH67yMiI9SaUBN1mEIBPGh5089PY+hvFVcJi15r5scdjvVSss8YYYEWG/E75gjd/ch9Yeau+ok9DFPjKORsucsP6gFL1fhCIl+OJdess= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286493; c=relaxed/simple; bh=Dml2nOSEo+WWxUod3I2RIFdbNmxclSaciKapqZlToLQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=k9ZTNQEKR/+5wqYp7tOm7qYpwlYt/7baEPHSp2vDsI7XUd913y/TpUYdG9k1gUEMk4btgcQswBjXFpRRTrNTBuMAwe/krFN4WfPfaQ3v4NL3oBAp8LEelgLycqa+lfsqgGBt2Dxb7KPuZSAHqtY9u0Wf8U7XNa7lXbKMYtyn9Zo= 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=k6hPy3k7; arc=none smtp.client-ip=198.175.65.13 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="k6hPy3k7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286491; x=1766822491; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Dml2nOSEo+WWxUod3I2RIFdbNmxclSaciKapqZlToLQ=; b=k6hPy3k72HyQ3teegoMOR6C/p4safogfdXWhC7bbwzwU3Lg2Q/HtCi/f 2GmYCh1vl80myysuF9FYP17HkzLh2sbVbUN5IA1WcjORjYIA+VcMFl6aK vMjZs6YMqLvryQUoxfIOTu4/jfr5RyycUzGtGIGktD8YqjTww2HluXsxq xJ7AksXaolV9utSgh8pJhXP8nU6GoS61dr1TdISBoj8i46XadsvdhhAhm MmVjpZ1ChDKjNhSMUUbAhHf0flaXEMC+OKzCmPZWyfd6pzcK915H9sfVK j7i3LVfJHaGvguCxNGnI8XhXMq0TU7Pma+9rY+0tRRi2V6B1LPNvBmd+f Q==; X-CSE-ConnectionGUID: 0p2FL+OZQweqkYpuBZ8dVQ== X-CSE-MsgGUID: LOSZNKjnTw2lJwHlc9Njyw== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46690922" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46690922" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:31 -0800 X-CSE-ConnectionGUID: nBjmL4JmR6OCsrLj81dbMA== X-CSE-MsgGUID: W3sC47MGRSerMxHwRL7rPA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858233" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:29 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Emmanuel Grumbach Subject: [PATCH 04/17] wifi: iwlwifi: mvm: rename iwl_dev_tx_power_common::mac_context_id Date: Fri, 27 Dec 2024 10:00:59 +0200 Message-Id: <20241227095718.f1155e713201.I753900d10e82f339cf9679ed403027d38dc1fd58@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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: Emmanuel Grumbach This is becoming the link_id. Since this makes no difference on non-MLD devices, just rename to link_id for all the APIs that use the common structure. Starting from command 9, feed the link_id to the firmware instead of the mac id. Signed-off-by: Emmanuel Grumbach Signed-off-by: Miri Korenblit --- .../net/wireless/intel/iwlwifi/fw/api/power.h | 8 +++++--- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/power.h b/drivers/net/wireless/intel/iwlwifi/fw/api/power.h index df0680eae30c..37ec26596ee7 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/api/power.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/api/power.h @@ -266,7 +266,7 @@ struct iwl_reduce_tx_power_cmd { } __packed; /* TX_REDUCED_POWER_API_S_VER_1 */ enum iwl_dev_tx_power_cmd_mode { - IWL_TX_POWER_MODE_SET_MAC = 0, + IWL_TX_POWER_MODE_SET_LINK = 0, IWL_TX_POWER_MODE_SET_DEVICE = 1, IWL_TX_POWER_MODE_SET_CHAINS = 2, IWL_TX_POWER_MODE_SET_ACK = 3, @@ -283,12 +283,14 @@ enum iwl_dev_tx_power_cmd_mode { /** * struct iwl_dev_tx_power_common - Common part of the TX power reduction cmd * @set_mode: see &enum iwl_dev_tx_power_cmd_mode - * @mac_context_id: id of the mac ctx for which we are reducing TX power. + * @link_id: id of the link ctx for which we are reducing TX power. + * For version 9 / 10, this is the link id. For earlier versions, it is + * the mac id. * @pwr_restriction: TX power restriction in 1/8 dBms. */ struct iwl_dev_tx_power_common { __le32 set_mode; - __le32 mac_context_id; + __le32 link_id; __le16 pwr_restriction; } __packed; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index cd93fbf40eb6..ca6c40954e9d 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -1485,11 +1485,12 @@ int iwl_mvm_set_tx_power(struct iwl_mvm *mvm, s16 tx_power) { u32 cmd_id = REDUCE_TX_POWER_CMD; - u32 mac_id = iwl_mvm_vif_from_mac80211(link_conf->vif)->id; + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(link_conf->vif); + u32 mac_id = mvmvif->id; int len; struct iwl_dev_tx_power_cmd_v3_v8 cmd = { - .common.set_mode = cpu_to_le32(IWL_TX_POWER_MODE_SET_MAC), - .common.mac_context_id = cpu_to_le32(mac_id), + .common.set_mode = cpu_to_le32(IWL_TX_POWER_MODE_SET_LINK), + .common.link_id = cpu_to_le32(mac_id), }; struct iwl_dev_tx_power_cmd cmd_v9_v10; u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 3); @@ -1500,9 +1501,16 @@ int iwl_mvm_set_tx_power(struct iwl_mvm *mvm, cmd.common.pwr_restriction = cpu_to_le16(u_tx_power); if (cmd_ver > 8) { + u32 link_id; + + if (WARN_ON(!mvmvif->link[link_conf->link_id])) + return -ENODEV; + + link_id = mvmvif->link[link_conf->link_id]->fw_link_id; + /* Those fields sit on the same place for v9 and v10 */ - cmd_v9_v10.common.set_mode = cpu_to_le32(IWL_TX_POWER_MODE_SET_MAC); - cmd_v9_v10.common.mac_context_id = cpu_to_le32(mac_id); + cmd_v9_v10.common.set_mode = cpu_to_le32(IWL_TX_POWER_MODE_SET_LINK); + cmd_v9_v10.common.link_id = cpu_to_le32(link_id); cmd_v9_v10.common.pwr_restriction = cpu_to_le16(u_tx_power); cmd_data = &cmd_v9_v10; } From patchwork Fri Dec 27 08:01:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13921615 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 875755D8F0 for ; Fri, 27 Dec 2024 08:01:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286494; cv=none; b=RSGZwYLK4i0PRJEcqrbrzR3pW/+BmNmFhlTf7t0F/T2YEH9oyqWHFKIWUdT3AgdIESTdUljcgsz0FX8NyvuJ3hF5A5LtOE5qTtmTwgDgqwGK1xNqG+1i3LyflUHBAqKMkX3/qHIvAyazmrvD8OIkYopD7y03zuq1d2a2p6aljls= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286494; c=relaxed/simple; bh=FDHyEfWbJ0uu8n+b6CacxQZLXu6oyyyLM2DSWEwpRwA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Du951pUiSyRgIr2/HyUfVyrRprgU2jcmXi0f2e+PYlzxR3e4Yt6txSL/FiKynr2g3n1qEjOUUtDec9aRoZd9H4ST3JNzkkxA+mHKcUjotbeEs7QPaBjtZ7eDNTT3zrvrtspDlt3W5NBOweMg3CyU/v+IOitoRNz1KjWrrVs+cL8= 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=Yf8Q7mFA; arc=none smtp.client-ip=198.175.65.13 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="Yf8Q7mFA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286492; x=1766822492; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FDHyEfWbJ0uu8n+b6CacxQZLXu6oyyyLM2DSWEwpRwA=; b=Yf8Q7mFAP5WjCZDL6eAEcyxE7wrVzsZn/5qnlD9e2GnchyhqcWrL23jr 9+EGq14vJk8CrutUYMirYQFvhhFX1SGKdVglicqzevevw4PxoK5I1/Ptl fyGL5e01fmnPEdvBzJvBtqRaANJo7sSeV80LI3N9koNYlGRytRNcN0H53 W5EtXtHC+yjY3Fa6uA8zddppq7c+Gsc7p7n5OOW8LZq/SgDCj+lvjbL62 av1gXwE3zL+thOx3c8wvGUhAg/9Ei/IwDxd44GigRtG78FMg0CihmCItX D1LgtFJF8Vva5vkulT/Fo/VnNPvH0ITHDfgFK4EDfDcq+Oa78c8WnwY5k w==; X-CSE-ConnectionGUID: +NCh4c9iTBqFWeLPlXxMkA== X-CSE-MsgGUID: g7KzNbF5SEqvrFpMrh16Uw== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46690929" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46690929" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:32 -0800 X-CSE-ConnectionGUID: tPYFZY2HQ1qKGPQaftAfGA== X-CSE-MsgGUID: vALuTFYES+u4pbADJLNwHw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858243" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:31 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Emmanuel Grumbach Subject: [PATCH 05/17] wifi: iwlwifi: s/iwl_mvm_ctdp_cmd/iwl_ctdp_cmd/ Date: Fri, 27 Dec 2024 10:01:00 +0200 Message-Id: <20241227095718.2d2cc9910535.Ic2b6f265d0b4aea25ccc7114d6f48afa621871be@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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: Emmanuel Grumbach This command is not related to iwlmvm. Signed-off-by: Emmanuel Grumbach Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/fw/api/phy.h | 12 ++++++------ drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/phy.h b/drivers/net/wireless/intel/iwlwifi/fw/api/phy.h index c73d4d597857..1dce28f3afa0 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/api/phy.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/api/phy.h @@ -19,7 +19,7 @@ enum iwl_phy_ops_subcmd_ids { CMD_DTS_MEASUREMENT_TRIGGER_WIDE = 0x0, /** - * @CTDP_CONFIG_CMD: &struct iwl_mvm_ctdp_cmd + * @CTDP_CONFIG_CMD: &struct iwl_ctdp_cmd */ CTDP_CONFIG_CMD = 0x03, @@ -195,25 +195,25 @@ struct ct_kill_notif { } __packed; /* CT_KILL_NOTIFICATION_API_S_VER_1, CT_KILL_NOTIFICATION_API_S_VER_2 */ /** -* enum iwl_mvm_ctdp_cmd_operation - CTDP command operations +* enum iwl_ctdp_cmd_operation - CTDP command operations * @CTDP_CMD_OPERATION_START: update the current budget * @CTDP_CMD_OPERATION_STOP: stop ctdp * @CTDP_CMD_OPERATION_REPORT: get the average budget */ -enum iwl_mvm_ctdp_cmd_operation { +enum iwl_ctdp_cmd_operation { CTDP_CMD_OPERATION_START = 0x1, CTDP_CMD_OPERATION_STOP = 0x2, CTDP_CMD_OPERATION_REPORT = 0x4, };/* CTDP_CMD_OPERATION_TYPE_E */ /** - * struct iwl_mvm_ctdp_cmd - track and manage the FW power consumption budget + * struct iwl_ctdp_cmd - track and manage the FW power consumption budget * - * @operation: see &enum iwl_mvm_ctdp_cmd_operation + * @operation: see &enum iwl_ctdp_cmd_operation * @budget: the budget in milliwatt * @window_size: defined in API but not used */ -struct iwl_mvm_ctdp_cmd { +struct iwl_ctdp_cmd { __le32 operation; __le32 budget; __le32 window_size; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c index d92470960b38..256f8f558b15 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c @@ -506,7 +506,7 @@ static const u32 iwl_mvm_cdev_budgets[] = { int iwl_mvm_ctdp_command(struct iwl_mvm *mvm, u32 op, u32 state) { - struct iwl_mvm_ctdp_cmd cmd = { + struct iwl_ctdp_cmd cmd = { .operation = cpu_to_le32(op), .budget = cpu_to_le32(iwl_mvm_cdev_budgets[state]), .window_size = 0, From patchwork Fri Dec 27 08:01:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13921616 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 5F86E15382E for ; Fri, 27 Dec 2024 08:01:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286496; cv=none; b=fAyLm5m6ZKhO4osY4D/IshFbniJI3NTahmqAPSW+6AJSfgBmLHFOU+IW/omXEhOsQD35bAVWgPed+g+Dz9pgy93MW0KvGhO+kra/qIvNhx8A0/RHiW11d5Ju1JCFoD77UojM2EjzvKFs8Zu+iB56eiG4B11MeBncx8hTVHL4sKg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286496; c=relaxed/simple; bh=kRJeSXbhmr+YWLFcm8QnV0f05WYwVNrtA8FXxqAPkDI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cXSIMkd5ueYDysnkmgJEzCeW+1AucWz67+bWplXel4go2p3wjFbU1uQAWF15hM5eQwcxpFe9+9cZ4E4LtIW/CXsNj+zxt1lBgotrljetOIRQ5uHJlr8Mq8q3ULYQQ2hyIispuDGOQmo6IhlCa7X5l9GlgpjEaD2UMJKBG38uNl8= 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=DWmPsG2B; arc=none smtp.client-ip=198.175.65.13 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="DWmPsG2B" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286494; x=1766822494; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kRJeSXbhmr+YWLFcm8QnV0f05WYwVNrtA8FXxqAPkDI=; b=DWmPsG2BR2APUzuTlVahE2qUhzw77bRWd1fHyWMXQVey29ZYBFjJmWfw V54szove+qtD1Fj5pLNBFaBI6J/cVrU+D7vdj4ZdygO75r9Rpy3wEoqG4 RxxsqGkit2wOmwHsLAqqBDoILyQXepMdv9MJvheUtEbKeqkywkun1t6UE K8dvgZXTt+OEQbk8jQbUBl8H1JQ+OXK8VNoeZcinM1kLcK+zQBd2ONNhP YugjyDWOrhSf6+ZyV+Spcawhdosvay24sJr5vN8kqYnxW79ejx0+J3py6 1rslm0yBMI3eoz/Zv8PT8ZvpbDO9sXPxuiC176qJxWjDjr7O7PYWcS5Hi w==; X-CSE-ConnectionGUID: GvLTOBP0RYCO+4E9w8qkJQ== X-CSE-MsgGUID: aV4Z7sIlTcS1v6DYywlEhg== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46690934" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46690934" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:34 -0800 X-CSE-ConnectionGUID: xAg8iKXKQN+6/BsOWUPzow== X-CSE-MsgGUID: q7Oszw2yRX2Rts7mhaftcw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858254" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:32 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg , Daniel Gabay Subject: [PATCH 06/17] wifi: iwlwifi: fw: read STEP table from correct UEFI var Date: Fri, 27 Dec 2024 10:01:01 +0200 Message-Id: <20241227095718.89a5ad921b6d.Idae95a70ff69d2ba1b610e8eced826961ce7de98@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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 This variable exists for the "common" (WiFi/BT) GUID, not the WiFi-only GUID. Fix that by passing the GUID to the function. A short-cut for the wifi-only version remains so not all code must be updated. However, rename the GUID defines to be clearer. Fixes: 09b4c35d73a5 ("wifi: iwlwifi: mvm: Support STEP equalizer settings from BIOS.") Signed-off-by: Johannes Berg Reviewed-by: Daniel Gabay Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/fw/uefi.c | 44 +++++++++++++------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/uefi.c b/drivers/net/wireless/intel/iwlwifi/fw/uefi.c index dcbb3c387c10..02df96c3aa51 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/uefi.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/uefi.c @@ -13,9 +13,12 @@ #include #include "fw/runtime.h" -#define IWL_EFI_VAR_GUID EFI_GUID(0x92daaf2f, 0xc02b, 0x455b, \ - 0xb2, 0xec, 0xf5, 0xa3, \ - 0x59, 0x4f, 0x4a, 0xea) +#define IWL_EFI_WIFI_GUID EFI_GUID(0x92daaf2f, 0xc02b, 0x455b, \ + 0xb2, 0xec, 0xf5, 0xa3, \ + 0x59, 0x4f, 0x4a, 0xea) +#define IWL_EFI_WIFI_BT_GUID EFI_GUID(0xe65d8884, 0xd4af, 0x4b20, \ + 0x8d, 0x03, 0x77, 0x2e, \ + 0xcc, 0x3d, 0xa5, 0x31) struct iwl_uefi_pnvm_mem_desc { __le32 addr; @@ -61,7 +64,7 @@ void *iwl_uefi_get_pnvm(struct iwl_trans *trans, size_t *len) *len = 0; - data = iwl_uefi_get_variable(IWL_UEFI_OEM_PNVM_NAME, &IWL_EFI_VAR_GUID, + data = iwl_uefi_get_variable(IWL_UEFI_OEM_PNVM_NAME, &IWL_EFI_WIFI_GUID, &package_size); if (IS_ERR(data)) { IWL_DEBUG_FW(trans, @@ -76,18 +79,18 @@ void *iwl_uefi_get_pnvm(struct iwl_trans *trans, size_t *len) return data; } -static -void *iwl_uefi_get_verified_variable(struct iwl_trans *trans, - efi_char16_t *uefi_var_name, - char *var_name, - unsigned int expected_size, - unsigned long *size) +static void * +iwl_uefi_get_verified_variable_guid(struct iwl_trans *trans, + efi_guid_t *guid, + efi_char16_t *uefi_var_name, + char *var_name, + unsigned int expected_size, + unsigned long *size) { void *var; unsigned long var_size; - var = iwl_uefi_get_variable(uefi_var_name, &IWL_EFI_VAR_GUID, - &var_size); + var = iwl_uefi_get_variable(uefi_var_name, guid, &var_size); if (IS_ERR(var)) { IWL_DEBUG_RADIO(trans, @@ -112,6 +115,18 @@ void *iwl_uefi_get_verified_variable(struct iwl_trans *trans, return var; } +static void * +iwl_uefi_get_verified_variable(struct iwl_trans *trans, + efi_char16_t *uefi_var_name, + char *var_name, + unsigned int expected_size, + unsigned long *size) +{ + return iwl_uefi_get_verified_variable_guid(trans, &IWL_EFI_WIFI_GUID, + uefi_var_name, var_name, + expected_size, size); +} + int iwl_uefi_handle_tlv_mem_desc(struct iwl_trans *trans, const u8 *data, u32 tlv_len, struct iwl_pnvm_image *pnvm_data) { @@ -311,8 +326,9 @@ void iwl_uefi_get_step_table(struct iwl_trans *trans) if (trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_AX210) return; - data = iwl_uefi_get_verified_variable(trans, IWL_UEFI_STEP_NAME, - "STEP", sizeof(*data), NULL); + data = iwl_uefi_get_verified_variable_guid(trans, &IWL_EFI_WIFI_BT_GUID, + IWL_UEFI_STEP_NAME, + "STEP", sizeof(*data), NULL); if (IS_ERR(data)) return; From patchwork Fri Dec 27 08:01:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13921617 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 44FE37083A for ; Fri, 27 Dec 2024 08:01:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286498; cv=none; b=qsPN0cXz92GtanIzsoTah4AhfodduZBMULwAYxgXzg9FIWl4J0HLmmKlr+qGLZW3M9NkY0AMK2Urfzr58HsFOrKF6F7WoQqfI00f4TOr57jV4fhPwZDF6qLnRLVngDpjmg3oyUnk0m/alyn93XSyvVjLG36VO6/sX5wbhhoCO3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286498; c=relaxed/simple; bh=gXhghrPHpzls464pMfH9gV9xkH88ZNue8tFYormTK/I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HlP964cDM2AYp3wvrzDeT7rNvag/GSz4+HZQQkbHMhpyzC4Cb915PjAYrz5VnFJNzusIDtMU3D6mNl978kAx4sHYwh/83Sbtk1iErO4WVlpN35MiKPFZGqfkjacA6OrvcnSvwQZMkq8yQAWVQOtHG0e5OQdzx5dOX6rEN6jVNQo= 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=FyO2xBoz; arc=none smtp.client-ip=198.175.65.13 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="FyO2xBoz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286496; x=1766822496; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gXhghrPHpzls464pMfH9gV9xkH88ZNue8tFYormTK/I=; b=FyO2xBozMXfqGTATcwmi/zxLrIRnWiQXfs7T2DFFmsfMYFE/CyMshqw/ Ta5W1iw+3ux3duegjCGjnDGAC7bGOnGVIKqi3pRZqdJW630rXQphXRzHX 2eJOAg1euZ9ryRdWEy6PR+7XWpu99Tg0wkFM8/byDnl3/UYdx4C9/KuAU 0U3Lzo0gvPMKyIF0FsSDnr9ZC0uTtgGP4S92cjDMCtendTukEinCfgE5h 8tlXSRO7QqV/G3wfeWfximml3vlQSrd4bSHCgmtg49qUDYmIuelj5oTy7 u6Jj32h0lYAOLznqnDRVdls36QMXvEfM5SoHRDLz3rcb13KQkq7cYqbuA g==; X-CSE-ConnectionGUID: uIDjvaaHSxSuQIzb2aTCFA== X-CSE-MsgGUID: PqOTQafmQHO0HTzwAa2QCQ== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46690941" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46690941" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:36 -0800 X-CSE-ConnectionGUID: +a9IyBeOSzSd1i99EmpIkg== X-CSE-MsgGUID: jzkwgTWoRjW7jdn+sfRXgA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858287" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:34 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, "Somashekhar(Som)" , Johannes Berg , Daniel Gabay Subject: [PATCH 07/17] wifi: iwlwifi: interpret STEP URM BIOS configuration Date: Fri, 27 Dec 2024 10:01:02 +0200 Message-Id: <20241227095718.b30024905de3.If3c578af2c15f8005bbe71499bc4091348ed7bb0@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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: "Somashekhar(Som)" For certain platforms, it may necessary to use the STEP in URM (ultra reliable mode.) Read the necessary flags from the BIOS (ACPI or UEFI) and indicate the chosen mode to the firmware in the context info. Whether or not URM really was configured is already read back later, to adjust capabilities accordingly. Signed-off-by: Somashekhar(Som) Signed-off-by: Johannes Berg Reviewed-by: Daniel Gabay Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 34 +++++++++++++++++++ drivers/net/wireless/intel/iwlwifi/fw/acpi.h | 16 +++++++++ .../wireless/intel/iwlwifi/fw/regulatory.c | 1 + .../wireless/intel/iwlwifi/fw/regulatory.h | 23 +++++++++++++ drivers/net/wireless/intel/iwlwifi/fw/uefi.c | 26 ++++++++++++++ drivers/net/wireless/intel/iwlwifi/fw/uefi.h | 23 +++++++++++++ .../intel/iwlwifi/iwl-context-info-gen3.h | 15 ++++++-- .../net/wireless/intel/iwlwifi/iwl-trans.h | 5 +++ drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 1 + .../intel/iwlwifi/pcie/ctxt-info-gen3.c | 8 +++++ 10 files changed, 150 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c index 7d6e6c80b892..d3ab40fc8ab0 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c @@ -1023,3 +1023,37 @@ int iwl_acpi_get_wbem(struct iwl_fw_runtime *fwrt, u32 *value) kfree(data); return ret; } + +int iwl_acpi_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value) +{ + union acpi_object *wifi_pkg, *data; + int ret = -ENOENT; + int tbl_rev; + + data = iwl_acpi_get_object(fwrt->dev, ACPI_DSBR_METHOD); + if (IS_ERR(data)) + return ret; + + wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, + ACPI_DSBR_WIFI_DATA_SIZE, + &tbl_rev); + if (IS_ERR(wifi_pkg)) + goto out_free; + + if (tbl_rev != ACPI_DSBR_WIFI_DATA_REV) { + IWL_DEBUG_RADIO(fwrt, "Unsupported ACPI DSBR revision:%d\n", + tbl_rev); + goto out_free; + } + + if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) + goto out_free; + + *value = wifi_pkg->package.elements[1].integer.value; + IWL_DEBUG_RADIO(fwrt, "Loaded DSBR config from ACPI value: 0x%x\n", + *value); + ret = 0; +out_free: + kfree(data); + return ret; +} diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h index bb88398a6987..e153c44d5c1d 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h @@ -28,6 +28,7 @@ #define ACPI_WPFC_METHOD "WPFC" #define ACPI_GLAI_METHOD "GLAI" #define ACPI_WBEM_METHOD "WBEM" +#define ACPI_DSBR_METHOD "DSBR" #define ACPI_WIFI_DOMAIN (0x07) @@ -74,6 +75,13 @@ * and one for enablement of Wi-Fi 320MHz per MCC */ #define ACPI_WBEM_WIFI_DATA_SIZE 2 +/* + * One element for domain type, + * and one for DSBR response data + */ +#define ACPI_DSBR_WIFI_DATA_SIZE 2 +#define ACPI_DSBR_WIFI_DATA_REV 1 + /* * One element for domain type, * and one for the status @@ -153,6 +161,9 @@ int iwl_acpi_get_dsm(struct iwl_fw_runtime *fwrt, enum iwl_dsm_funcs func, u32 *value); int iwl_acpi_get_wbem(struct iwl_fw_runtime *fwrt, u32 *value); + +int iwl_acpi_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value); + #else /* CONFIG_ACPI */ static inline void *iwl_acpi_get_dsm_object(struct device *dev, int rev, @@ -221,6 +232,11 @@ static inline int iwl_acpi_get_wbem(struct iwl_fw_runtime *fwrt, u32 *value) { return -ENOENT; } + +static inline int iwl_acpi_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value) +{ + return -ENOENT; +} #endif /* CONFIG_ACPI */ #endif /* __iwl_fw_acpi__ */ diff --git a/drivers/net/wireless/intel/iwlwifi/fw/regulatory.c b/drivers/net/wireless/intel/iwlwifi/fw/regulatory.c index c89ff380b86d..bc359a336fd6 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/regulatory.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/regulatory.c @@ -39,6 +39,7 @@ IWL_BIOS_TABLE_LOADER_DATA(pwr_limit, u64); IWL_BIOS_TABLE_LOADER_DATA(mcc, char); IWL_BIOS_TABLE_LOADER_DATA(eckv, u32); IWL_BIOS_TABLE_LOADER_DATA(wbem, u32); +IWL_BIOS_TABLE_LOADER_DATA(dsbr, u32); static const struct dmi_system_id dmi_ppag_approved_list[] = { diff --git a/drivers/net/wireless/intel/iwlwifi/fw/regulatory.h b/drivers/net/wireless/intel/iwlwifi/fw/regulatory.h index f247d31ebdd6..afdc0ec75ba5 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/regulatory.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/regulatory.h @@ -222,4 +222,27 @@ static inline u32 iwl_bios_get_ppag_flags(const u32 ppag_modes, } bool iwl_puncturing_is_allowed_in_bios(u32 puncturing, u16 mcc); + +#define IWL_DSBR_FW_MODIFIED_URM_MASK BIT(8) +#define IWL_DSBR_PERMANENT_URM_MASK BIT(9) + +int iwl_bios_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value); + +static inline void iwl_bios_setup_step(struct iwl_trans *trans, + struct iwl_fw_runtime *fwrt) +{ + u32 dsbr; + + if (!trans->trans_cfg->integrated) + return; + + if (trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_BZ) + return; + + if (iwl_bios_get_dsbr(fwrt, &dsbr)) + dsbr = 0; + + trans->dsbr_urm_fw_dependent = !!(dsbr & IWL_DSBR_FW_MODIFIED_URM_MASK); + trans->dsbr_urm_permanent = !!(dsbr & IWL_DSBR_PERMANENT_URM_MASK); +} #endif /* __fw_regulatory_h__ */ diff --git a/drivers/net/wireless/intel/iwlwifi/fw/uefi.c b/drivers/net/wireless/intel/iwlwifi/fw/uefi.c index 02df96c3aa51..cc7659d59cf0 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/uefi.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/uefi.c @@ -777,3 +777,29 @@ int iwl_uefi_get_puncturing(struct iwl_fw_runtime *fwrt) return puncturing; } IWL_EXPORT_SYMBOL(iwl_uefi_get_puncturing); + +int iwl_uefi_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value) +{ + struct uefi_cnv_wlan_dsbr_data *data; + int ret = 0; + + data = iwl_uefi_get_verified_variable_guid(fwrt->trans, + &IWL_EFI_WIFI_BT_GUID, + IWL_UEFI_DSBR_NAME, "DSBR", + sizeof(*data), NULL); + if (IS_ERR(data)) + return -EINVAL; + + if (data->revision != IWL_UEFI_DSBR_REVISION) { + ret = -EINVAL; + IWL_DEBUG_RADIO(fwrt, "Unsupported UEFI DSBR revision:%d\n", + data->revision); + goto out; + } + *value = data->config; + IWL_DEBUG_RADIO(fwrt, "Loaded DSBR config from UEFI value: 0x%x\n", + *value); +out: + kfree(data); + return ret; +} diff --git a/drivers/net/wireless/intel/iwlwifi/fw/uefi.h b/drivers/net/wireless/intel/iwlwifi/fw/uefi.h index 4e98f752b3d2..0c8943a8bd01 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/uefi.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/uefi.h @@ -23,6 +23,7 @@ #define IWL_UEFI_DSM_NAME L"UefiCnvWlanGeneralCfg" #define IWL_UEFI_WBEM_NAME L"UefiCnvWlanWBEM" #define IWL_UEFI_PUNCTURING_NAME L"UefiCnvWlanPuncturing" +#define IWL_UEFI_DSBR_NAME L"UefiCnvCommonDSBR" #define IWL_SGOM_MAP_SIZE 339 @@ -41,6 +42,7 @@ #define IWL_UEFI_WBEM_REVISION 0 #define IWL_UEFI_DSM_REVISION 4 #define IWL_UEFI_PUNCTURING_REVISION 0 +#define IWL_UEFI_DSBR_REVISION 1 struct pnvm_sku_package { u8 rev; @@ -214,6 +216,20 @@ struct uefi_cnv_var_puncturing_data { u32 puncturing; } __packed; +/** + * struct uefi_cnv_wlan_dsbr_data - BIOS STEP configuration information + * @revision: the revision of the table + * @config: STEP configuration flags: + * bit 8, switch to URM depending on FW setting + * bit 9, switch to URM + * + * Platform information for STEP configuration/workarounds. + */ +struct uefi_cnv_wlan_dsbr_data { + u8 revision; + u32 config; +} __packed; + /* * This is known to be broken on v4.19 and to work on v5.4. Until we * figure out why this is the case and how to make it work, simply @@ -245,6 +261,7 @@ void iwl_uefi_get_sgom_table(struct iwl_trans *trans, struct iwl_fw_runtime *fwr int iwl_uefi_get_uats_table(struct iwl_trans *trans, struct iwl_fw_runtime *fwrt); int iwl_uefi_get_puncturing(struct iwl_fw_runtime *fwrt); +int iwl_uefi_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value); #else /* CONFIG_EFI */ static inline void *iwl_uefi_get_pnvm(struct iwl_trans *trans, size_t *len) { @@ -347,5 +364,11 @@ int iwl_uefi_get_puncturing(struct iwl_fw_runtime *fwrt) { return 0; } + +static inline +int iwl_uefi_get_dsbr(struct iwl_fw_runtime *fwrt, u32 *value) +{ + return -ENOENT; +} #endif /* CONFIG_EFI */ #endif /* __iwl_fw_uefi__ */ 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 5b62933134cf..6b246ec3ff03 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-context-info-gen3.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-context-info-gen3.h @@ -76,6 +76,16 @@ enum iwl_prph_scratch_flags { IWL_PRPH_SCRATCH_SCU_FORCE_ACTIVE = BIT(29), }; +/** + * enum iwl_prph_scratch_ext_flags - PRPH scratch control ext flags + * @IWL_PRPH_SCRATCH_EXT_URM_FW: switch to URM mode based on fw setting + * @IWL_PRPH_SCRATCH_EXT_URM_PERM: switch to permanent URM mode + */ +enum iwl_prph_scratch_ext_flags { + IWL_PRPH_SCRATCH_EXT_URM_FW = BIT(4), + IWL_PRPH_SCRATCH_EXT_URM_PERM = BIT(5), +}; + /* * struct iwl_prph_scratch_version - version structure * @mac_id: SKU and revision id @@ -93,11 +103,12 @@ struct iwl_prph_scratch_version { /* * struct iwl_prph_scratch_control - control structure * @control_flags: context information flags see &enum iwl_prph_scratch_flags - * @reserved: reserved + * @control_flags_ext: context information for extended flags, + * see &enum iwl_prph_scratch_ext_flags */ struct iwl_prph_scratch_control { __le32 control_flags; - __le32 reserved; + __le32 control_flags_ext; } __packed; /* PERIPH_SCRATCH_CONTROL_S */ /* diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h index 56b551fd2156..22c0864b5704 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h @@ -878,6 +878,8 @@ struct iwl_txq { * @no_160: device not supporting 160 MHz * @step_urm: STEP is in URM, no support for MCS>9 in 320 MHz * @trans_specific: data for the specific transport this is allocated for/with + * @dsbr_urm_fw_dependent: switch to URM based on fw settings + * @dsbr_urm_permanent: switch to URM permanently */ struct iwl_trans { bool csme_own; @@ -902,6 +904,9 @@ struct iwl_trans { bool reduced_cap_sku; u8 no_160:1, step_urm:1; + u8 dsbr_urm_fw_dependent:1, + dsbr_urm_permanent:1; + u8 rx_mpdu_cmd, rx_mpdu_cmd_hdr_size; bool pm_support; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index e21199313278..06b05e076cd2 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -1331,6 +1331,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, iwl_mvm_get_bios_tables(mvm); iwl_uefi_get_sgom_table(trans, &mvm->fwrt); iwl_uefi_get_step_table(trans); + iwl_bios_setup_step(trans, &mvm->fwrt); mvm->init_status = 0; 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 ae93a72542b2..838c426db7f0 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c @@ -106,6 +106,7 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, struct iwl_prph_scratch_ctrl_cfg *prph_sc_ctrl; struct iwl_prph_info *prph_info; u32 control_flags = 0; + u32 control_flags_ext = 0; int ret; int cmdq_size = max_t(u32, IWL_CMD_QUEUE_SIZE, trans->cfg->min_txq_size); @@ -130,6 +131,12 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, break; } + if (trans->dsbr_urm_fw_dependent) + control_flags_ext |= IWL_PRPH_SCRATCH_EXT_URM_FW; + + if (trans->dsbr_urm_permanent) + control_flags_ext |= IWL_PRPH_SCRATCH_EXT_URM_PERM; + /* Allocate prph scratch */ prph_scratch = dma_alloc_coherent(trans->dev, sizeof(*prph_scratch), &trans_pcie->prph_scratch_dma_addr, @@ -165,6 +172,7 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, iwl_pcie_ctxt_info_dbg_enable(trans, &prph_sc_ctrl->hwm_cfg, &control_flags); prph_sc_ctrl->control.control_flags = cpu_to_le32(control_flags); + prph_sc_ctrl->control.control_flags_ext = cpu_to_le32(control_flags_ext); /* initialize the Step equalizer data */ prph_sc_ctrl->step_cfg.mbx_addr_0 = cpu_to_le32(trans->mbx_addr_0_step); From patchwork Fri Dec 27 08:01:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13921618 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 10CC614AD3D for ; Fri, 27 Dec 2024 08:01:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286499; cv=none; b=OcB2vNKHu3VAazmNIA/FAdrKcnIT58BYgnAm9qUVknfasqkntIPfzdF/c9+jdkIsqW25tl8YrE/6sqotSAo60WU7w5Rde+fWLRWDkrOsaCCfUKx32pksMCHudZJCNJkwZh54X1c+R166o4AQ4nAMcc1sR1B2pKfGQD1eCZMJiaU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286499; c=relaxed/simple; bh=5Aob6PSefLellkmKLr0+OnWET7v5npiSOTkOyydEpZs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=swGNlvmULlubX3riEBuZL1174ktSktX0nLKLwxjMmJ7JRpbbqWLCZRY/rPEUajiRb61JJSJJrlQXWAm9l8h9N29t6UGdHMCvpMyHXNBaCWmxB6Ou14OvVh5OIQy9LIUJYf2aqhO/xej9Ktgb7IyO+7OOKKx454XkHqG6uKxf+W4= 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=H3OwkdG/; arc=none smtp.client-ip=198.175.65.13 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="H3OwkdG/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286498; x=1766822498; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5Aob6PSefLellkmKLr0+OnWET7v5npiSOTkOyydEpZs=; b=H3OwkdG/7Ne11Lhy9hLUS/8NPWEZmH7snBEOXsDlKDzWTwh6Lfv8AcjK e0v6AF2SDZ0o8B/pmsr+kvwV4XKaHKGM37t1xsqfsMf+q3WOvSTvf1Bhw CYZSustgR6oijqv3gs2Q8wGQkA01fKBlg4dY4W+88Sp4SsiGb2SwaDpwC y1Y6OCdkMQyLapn9w9f8p0LyN8YSgR6DKTcH1nO6nYIhWLValcPuNk/kT fS3GZzAP1cSPbmM1b2gs2Mwhbmcd/zCjDTeuTeuNCqb9eLBJrcLVHNHZK 0S1u5lXw+O9ZJhRoyI8bCfUuZ4DCEqYPmh6bLQA1j5InS2c3RG9qSUzOZ g==; X-CSE-ConnectionGUID: VYgnWFtpS6ixWfApX9XTtQ== X-CSE-MsgGUID: tjc5o3k4SkKeVje0NDUBLg== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46690948" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46690948" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:37 -0800 X-CSE-ConnectionGUID: m0dKtUkYSt2uuHusuL+spQ== X-CSE-MsgGUID: GQYBxsLbSyGmpj5Y1/0Z0w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858313" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:36 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 08/17] wifi: iwlwifi: context-info: add kernel-doc markers Date: Fri, 27 Dec 2024 10:01:03 +0200 Message-Id: <20241227095718.c5c04b641479.I702b8122d307a0d9d09df038cda10be063f7f2d7@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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 These comments have kernel-doc markup and were meant to be handled as such, add the right /** marker to them. Add missing entries where needed. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- .../intel/iwlwifi/iwl-context-info-gen3.h | 25 +++++++++------- .../wireless/intel/iwlwifi/iwl-context-info.h | 30 ++++++++++++------- 2 files changed, 34 insertions(+), 21 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 6b246ec3ff03..cd25a1b9f2ff 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-context-info-gen3.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-context-info-gen3.h @@ -86,7 +86,7 @@ enum iwl_prph_scratch_ext_flags { IWL_PRPH_SCRATCH_EXT_URM_PERM = BIT(5), }; -/* +/** * struct iwl_prph_scratch_version - version structure * @mac_id: SKU and revision id * @version: prph scratch information version id @@ -100,7 +100,7 @@ struct iwl_prph_scratch_version { __le16 reserved; } __packed; /* PERIPH_SCRATCH_VERSION_S */ -/* +/** * struct iwl_prph_scratch_control - control structure * @control_flags: context information flags see &enum iwl_prph_scratch_flags * @control_flags_ext: context information for extended flags, @@ -111,7 +111,7 @@ struct iwl_prph_scratch_control { __le32 control_flags_ext; } __packed; /* PERIPH_SCRATCH_CONTROL_S */ -/* +/** * struct iwl_prph_scratch_pnvm_cfg - PNVM scratch * @pnvm_base_addr: PNVM start address * @pnvm_size: the size of the PNVM image in bytes @@ -131,7 +131,8 @@ struct iwl_prph_scratch_pnvm_cfg { struct iwl_prph_scrath_mem_desc_addr_array { __le64 mem_descs[IPC_DRAM_MAP_ENTRY_NUM_MAX]; } __packed; /* PERIPH_SCRATCH_MEM_DESC_ADDR_ARRAY_S_VER_1 */ -/* + +/** * struct iwl_prph_scratch_hwm_cfg - hwm config * @hwm_base_addr: hwm start address * @hwm_size: hwm size in DWs @@ -143,7 +144,7 @@ struct iwl_prph_scratch_hwm_cfg { __le32 debug_token_config; } __packed; /* PERIPH_SCRATCH_HWM_CFG_S */ -/* +/** * struct iwl_prph_scratch_rbd_cfg - RBDs configuration * @free_rbd_addr: default queue free RB CB base address * @reserved: reserved @@ -153,10 +154,11 @@ struct iwl_prph_scratch_rbd_cfg { __le32 reserved; } __packed; /* PERIPH_SCRATCH_RBD_CFG_S */ -/* +/** * struct iwl_prph_scratch_uefi_cfg - prph scratch reduce power table * @base_addr: reduce power table address * @size: the size of the entire power table image + * @reserved: (reserved) */ struct iwl_prph_scratch_uefi_cfg { __le64 base_addr; @@ -164,7 +166,7 @@ struct iwl_prph_scratch_uefi_cfg { __le32 reserved; } __packed; /* PERIPH_SCRATCH_UEFI_CFG_S */ -/* +/** * struct iwl_prph_scratch_step_cfg - prph scratch step configuration * @mbx_addr_0: [0:7] revision, * [8:15] cnvi_to_cnvr length, @@ -178,13 +180,14 @@ struct iwl_prph_scratch_step_cfg { __le32 mbx_addr_1; } __packed; -/* +/** * struct iwl_prph_scratch_ctrl_cfg - prph scratch ctrl and config * @version: version information of context info and HW * @control: control flags of FH configurations * @pnvm_cfg: ror configuration * @hwm_cfg: hwm configuration * @rbd_cfg: default RX queue configuration + * @reduce_power_cfg: UEFI power reduction table * @step_cfg: step configuration */ struct iwl_prph_scratch_ctrl_cfg { @@ -197,7 +200,7 @@ struct iwl_prph_scratch_ctrl_cfg { struct iwl_prph_scratch_step_cfg step_cfg; } __packed; /* PERIPH_SCRATCH_CTRL_CFG_S */ -/* +/** * struct iwl_prph_scratch - peripheral scratch mapping * @ctrl_cfg: control and configuration of prph scratch * @dram: firmware images addresses in DRAM @@ -213,7 +216,7 @@ struct iwl_prph_scratch { struct iwl_context_info_dram dram; } __packed; /* PERIPH_SCRATCH_S */ -/* +/** * struct iwl_prph_info - peripheral information * @boot_stage_mirror: reflects the value in the Boot Stage CSR register * @ipc_status_mirror: reflects the value in the IPC Status CSR register @@ -227,7 +230,7 @@ struct iwl_prph_info { __le32 reserved; } __packed; /* PERIPH_INFO_S */ -/* +/** * struct iwl_context_info_gen3 - device INIT configuration * @version: version of the context information * @size: size of context information in DWs diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-context-info.h b/drivers/net/wireless/intel/iwlwifi/iwl-context-info.h index 1a1321db137c..7abd153d56f9 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-context-info.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-context-info.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* * Copyright (C) 2017 Intel Deutschland GmbH - * Copyright (C) 2018-2020, 2022 Intel Corporation + * Copyright (C) 2018-2020, 2022, 2024 Intel Corporation */ #ifndef __iwl_context_info_file_h__ #define __iwl_context_info_file_h__ @@ -53,11 +53,12 @@ enum iwl_context_info_flags { IWL_CTXT_INFO_RB_SIZE_32K = 0xe, }; -/* +/** * struct iwl_context_info_version - version structure * @mac_id: SKU and revision id * @version: context information version id * @size: the size of the context information in DWs + * @reserved: (reserved) */ struct iwl_context_info_version { __le16 mac_id; @@ -66,16 +67,17 @@ struct iwl_context_info_version { __le16 reserved; } __packed; -/* +/** * struct iwl_context_info_control - version structure * @control_flags: context information flags see &enum iwl_context_info_flags + * @reserved: (reserved) */ struct iwl_context_info_control { __le32 control_flags; __le32 reserved; } __packed; -/* +/** * struct iwl_context_info_dram - images DRAM map * each entry in the map represents a DRAM chunk of up to 32 KB * @umac_img: UMAC image DRAM map @@ -88,7 +90,7 @@ struct iwl_context_info_dram { __le64 virtual_img[IWL_MAX_DRAM_ENTRY]; } __packed; -/* +/** * struct iwl_context_info_rbd_cfg - RBDs configuration * @free_rbd_addr: default queue free RB CB base address * @used_rbd_addr: default queue used RB CB base address @@ -100,10 +102,11 @@ struct iwl_context_info_rbd_cfg { __le64 status_wr_ptr; } __packed; -/* +/** * struct iwl_context_info_hcmd_cfg - command queue configuration * @cmd_queue_addr: address of command queue * @cmd_queue_size: number of entries + * @reserved: (reserved) */ struct iwl_context_info_hcmd_cfg { __le64 cmd_queue_addr; @@ -111,10 +114,11 @@ struct iwl_context_info_hcmd_cfg { u8 reserved[7]; } __packed; -/* +/** * struct iwl_context_info_dump_cfg - Core Dump configuration * @core_dump_addr: core dump (debug DRAM address) start address * @core_dump_size: size, in DWs + * @reserved: (reserved) */ struct iwl_context_info_dump_cfg { __le64 core_dump_addr; @@ -122,10 +126,11 @@ struct iwl_context_info_dump_cfg { __le32 reserved; } __packed; -/* +/** * struct iwl_context_info_pnvm_cfg - platform NVM data configuration * @platform_nvm_addr: Platform NVM data start address * @platform_nvm_size: size in DWs + * @reserved: (reserved) */ struct iwl_context_info_pnvm_cfg { __le64 platform_nvm_addr; @@ -133,11 +138,12 @@ struct iwl_context_info_pnvm_cfg { __le32 reserved; } __packed; -/* +/** * struct iwl_context_info_early_dbg_cfg - early debug configuration for * dumping DRAM addresses * @early_debug_addr: early debug start address * @early_debug_size: size in DWs + * @reserved: (reserved) */ struct iwl_context_info_early_dbg_cfg { __le64 early_debug_addr; @@ -145,16 +151,20 @@ struct iwl_context_info_early_dbg_cfg { __le32 reserved; } __packed; -/* +/** * struct iwl_context_info - device INIT configuration * @version: version information of context info and HW * @control: control flags of FH configurations + * @reserved0: (reserved) * @rbd_cfg: default RX queue configuration * @hcmd_cfg: command queue configuration + * @reserved1: (reserved) * @dump_cfg: core dump data * @edbg_cfg: early debug configuration * @pnvm_cfg: platform nvm configuration + * @reserved2: (reserved) * @dram: firmware image addresses in DRAM + * @reserved3: (reserved) */ struct iwl_context_info { struct iwl_context_info_version version; From patchwork Fri Dec 27 08:01:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 13921619 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 7301B7083A for ; Fri, 27 Dec 2024 08:01:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286501; cv=none; b=reIgKNt8b4nRPLDPRY7YevF2BFfcAf3GKjBYzzcSz1U1kHfShdU8XbTPGvgueXFjg6zZVIRLLcTBPyLAKdgHV72KQYs5bQQ0Sm+uK1gPF2Re+GkdZ3zt2ikcgNONmZvAxiZjCLoKHkxbdnTEoikrwo5MXfKArFpEGnnT564XmKM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286501; c=relaxed/simple; bh=ODRkovnb1kujw9VH74R/cFKQdM8A6Y+ABp8F0/B2j9k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CB/UjRUJ/slkHaX2vW8TpPfoxHTAs3iaTeXQ+q86OchVmRUhtP0x8pFDx0iZnspPLxOFhsSkgXkYzfPzwyPt8gq1BLhbbA3lTfUCEKOpYPXKHWh4RTohdQY20qnOT7xZwAluniWHY5aoGWrC6xbx0tq7Z+kPbDJyyZqYLp6l8SU= 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=ghHxJMoK; arc=none smtp.client-ip=198.175.65.13 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="ghHxJMoK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286499; x=1766822499; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ODRkovnb1kujw9VH74R/cFKQdM8A6Y+ABp8F0/B2j9k=; b=ghHxJMoKtZJ6Bv1PaYGTv8fYS/iFh8B/HIeyUYPc0AKH9x8glXJarvPt Na2HvtvvVgbVYgItKpokTV0FgS62Jjw4fKIM2YR9z94iCY5Ml38kVARnt qhrwVMWP7aWyPdJR0VhXHEeREiHEwT3TKRXJqcp4y4QOG0WxpMHKt2nbf Lymaq6p3x31wFlWuW7kVebneb9/9ROF4Gs3SNk3SpIQZ9ANygJCQxA8x2 J3GOUnL4ytClSz51n/G+eD+kxr3XBX2VGmmw8PuTM6m8e0zhG4bym1nYR ySshlqDv8r+hAT0Nc7wlEuj6C2drdmBdJQDQahTMK8+L3E+4oLfUCD2PB g==; X-CSE-ConnectionGUID: ewUIEiFlRbiAOiS+6kiLYg== X-CSE-MsgGUID: 0wP9eoh1TjKnIu3AIVSwow== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46690952" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46690952" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:39 -0800 X-CSE-ConnectionGUID: FiWPU2/AS/2yP5dwfssvNg== X-CSE-MsgGUID: c5XKbPh2QwGhMKxSu89MJQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858341" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:37 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 09/17] wifi: iwlwifi: return ERR_PTR from opmode start() Date: Fri, 27 Dec 2024 10:01:04 +0200 Message-Id: <20241227095718.3fe5031d5784.I7307996c91dac69619ff9c616b8a077423fac19f@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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 order to restrict the retry loops for timeouts, first pass the error code up using ERR_PTR(). This of course requires all existing functions to be updated accordingly. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/dvm/main.c | 34 ++++++++++++------- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 24 +++++++++---- 3 files changed, 40 insertions(+), 20 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/main.c b/drivers/net/wireless/intel/iwlwifi/dvm/main.c index 2c4363662efd..4f5846953fa3 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/main.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/main.c @@ -1241,7 +1241,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, STATISTICS_NOTIFICATION, REPLY_TX, }; - int i; + int i, err; /************************ * 1. Allocating HW data @@ -1249,6 +1249,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, hw = iwl_alloc_all(); if (!hw) { pr_err("%s: Cannot allocate network device\n", trans->name); + err = -ENOMEM; goto out; } @@ -1299,8 +1300,10 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, break; } - if (WARN_ON(!priv->lib)) + if (WARN_ON(!priv->lib)) { + err = -ENODEV; goto out_free_hw; + } /* * Populate the state variables that the transport layer needs @@ -1377,12 +1380,14 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, IWL_INFO(priv, "Detected %s, REV=0x%X\n", priv->trans->name, priv->trans->hw_rev); - if (iwl_trans_start_hw(priv->trans)) + err = iwl_trans_start_hw(priv->trans); + if (err) goto out_free_hw; /* Read the EEPROM */ - if (iwl_read_eeprom(priv->trans, &priv->eeprom_blob, - &priv->eeprom_blob_size)) { + err = iwl_read_eeprom(priv->trans, &priv->eeprom_blob, + &priv->eeprom_blob_size); + if (err) { IWL_ERR(priv, "Unable to init EEPROM\n"); goto out_free_hw; } @@ -1393,13 +1398,17 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, priv->nvm_data = iwl_parse_eeprom_data(priv->trans, priv->cfg, priv->eeprom_blob, priv->eeprom_blob_size); - if (!priv->nvm_data) + if (!priv->nvm_data) { + err = -ENOMEM; goto out_free_eeprom_blob; + } - if (iwl_nvm_check_version(priv->nvm_data, priv->trans)) + err = iwl_nvm_check_version(priv->nvm_data, priv->trans); + if (err) goto out_free_eeprom; - if (iwl_eeprom_init_hw_params(priv)) + err = iwl_eeprom_init_hw_params(priv); + if (err) goto out_free_eeprom; /* extract MAC Address */ @@ -1446,7 +1455,8 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, atomic_set(&priv->queue_stop_count[i], 0); } - if (iwl_init_drv(priv)) + err = iwl_init_drv(priv); + if (err) goto out_free_eeprom; /* At this point both hw and priv are initialized. */ @@ -1480,7 +1490,8 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, * * 7. Setup and register with mac80211 and debugfs **************************************************/ - if (iwlagn_mac_setup_register(priv, &fw->ucode_capa)) + err = iwlagn_mac_setup_register(priv, &fw->ucode_capa); + if (err) goto out_destroy_workqueue; iwl_dbgfs_register(priv, dbgfs_dir); @@ -1500,8 +1511,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, out_free_hw: ieee80211_free_hw(priv->hw); out: - op_mode = NULL; - return op_mode; + return ERR_PTR(err); } static void iwl_op_mode_dvm_stop(struct iwl_op_mode *op_mode) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c index c620911a1193..d7bf996d3a82 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c @@ -1429,7 +1429,7 @@ _iwl_op_mode_start(struct iwl_drv *drv, struct iwlwifi_opmode_table *op) op_mode = ops->start(drv->trans, drv->trans->cfg, &drv->fw, dbgfs_dir); - if (op_mode) + if (!IS_ERR(op_mode)) return op_mode; if (test_bit(STATUS_TRANS_DEAD, &drv->trans->status)) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index 06b05e076cd2..623122cadd32 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -1285,6 +1285,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, size_t scan_size; u32 min_backoff; struct iwl_mvm_csme_conn_info *csme_conn_info __maybe_unused; + int err; /* * We use IWL_STATION_COUNT_MAX to check the validity of the station @@ -1302,7 +1303,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, iwl_mvm_has_mld_api(fw) ? &iwl_mvm_mld_hw_ops : &iwl_mvm_hw_ops); if (!hw) - return NULL; + return ERR_PTR(-ENOMEM); if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) max_agg = 512; @@ -1347,8 +1348,10 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, trans->rx_mpdu_cmd_hdr_size = sizeof(struct iwl_rx_mpdu_res_start); - if (WARN_ON(trans->num_rx_queues > 1)) + if (WARN_ON(trans->num_rx_queues > 1)) { + err = -EINVAL; goto out_free; + } } mvm->fw_restart = iwlwifi_mod_params.fw_restart ? -1 : 0; @@ -1425,8 +1428,10 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, iwl_fw_lookup_notif_ver(mvm->fw, LOCATION_GROUP, TOF_RANGE_RESPONSE_NOTIF, 5); /* we only support up to version 9 */ - if (WARN_ON_ONCE(mvm->cmd_ver.range_resp > 9)) + if (WARN_ON_ONCE(mvm->cmd_ver.range_resp > 9)) { + err = -EINVAL; goto out_free; + } /* * Populate the state variables that the transport layer needs @@ -1489,6 +1494,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, mvm->phy_db = iwl_phy_db_init(trans); if (!mvm->phy_db) { IWL_ERR(mvm, "Cannot init phy_db\n"); + err = -ENOMEM; goto out_free; } @@ -1501,8 +1507,10 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, scan_size = iwl_mvm_scan_size(mvm); mvm->scan_cmd = kmalloc(scan_size, GFP_KERNEL); - if (!mvm->scan_cmd) + if (!mvm->scan_cmd) { + err = -ENOMEM; goto out_free; + } mvm->scan_cmd_size = scan_size; /* invalidate ids to prevent accidental removal of sta_id 0 */ @@ -1531,7 +1539,8 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, iwl_mvm_mei_scan_filter_init(&mvm->mei_scan_filter); - if (iwl_mvm_start_get_nvm(mvm)) { + err = iwl_mvm_start_get_nvm(mvm); + if (err) { /* * Getting NVM failed while CSME is the owner, but we are * registered to MEI, we'll get the NVM later when it'll be @@ -1544,7 +1553,8 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, } - if (iwl_mvm_start_post_nvm(mvm)) + err = iwl_mvm_start_post_nvm(mvm); + if (err) goto out_thermal_exit; return op_mode; @@ -1564,7 +1574,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, iwl_trans_op_mode_leave(trans); ieee80211_free_hw(mvm->hw); - return NULL; + return ERR_PTR(err); } void iwl_mvm_stop_device(struct iwl_mvm *mvm) From patchwork Fri Dec 27 08:01: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: 13921620 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 B24AB7083A for ; Fri, 27 Dec 2024 08:01:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286505; cv=none; b=mz74MPBShrdman0BgOHXQaLlfpqg63H6pdceCw2G7vAI749zfT+wXgr01isvr95T1ELB79AmyKuTaEVcaw6tRzFlz8O6Ahs2hdhBJznan4qNDzwBHzFJ7IiSjlxJ0cGOSEBJauBS22CvX0bpUHcerPx6nL5gltY5ER7GhyWQ9Us= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286505; c=relaxed/simple; bh=mPVW1jPPJt3asM8GdHbJYaT3oPg3xBAXP+tmsQFl45w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EfHjOxdgyNBUySiyX24saRNG3wa5H9Lc6Um9GsMtawzJHaFq88HDNtV4tkHl5mz067cQq6M6yv6jtx5d4mz3f+y7UBSZvl3pexcIIcCS0h32qOPLG/27nPDwdRKXL2A1zBZEzc4TDi1g6+yFSrjpub+BZizCh0gBEjznOR7BQX4= 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=iFQ3IU9I; arc=none smtp.client-ip=198.175.65.13 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="iFQ3IU9I" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286503; x=1766822503; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mPVW1jPPJt3asM8GdHbJYaT3oPg3xBAXP+tmsQFl45w=; b=iFQ3IU9I3r3w6IY49NWyTmA/TeLpHS/5u8pcEFmmNEBrmEn9QhhkUG5n 5tOgIqH7HWzGnzQWw3koM3z9exBXjVcsofi/S7/Y/E4NACiztP12DHsyj 7krk1kW9IigpetRJSE2ii36Mf7CXHiEGR7VbJYo+SPiLPMybqXHfQW6xp QoaRrd+KtK452j2Z4172LFw4wsgaj2Sk0HUKd3oNYL+Ip+PUP75Fc1Q+O RzIilaKqCfZVqncdX39JSxnFcksks9MJIhlhruc2Z0VmrXxq85NHYQVxs op7h6g02t+C/FXJ4fnt+IN7MZ3LLeP4llFBqEon5plfXFN99czQ2SDmgJ Q==; X-CSE-ConnectionGUID: kdE4QAmhT6iLuNr1oZmByg== X-CSE-MsgGUID: fgKotgEBQKyAM4BflgUU2Q== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46690970" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46690970" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:43 -0800 X-CSE-ConnectionGUID: eaNpZvHjQfeMzemc5WhjPQ== X-CSE-MsgGUID: W3yjH4loTfSDE7SHz5MYgw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858352" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:38 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 10/17] wifi: iwlwifi: restrict driver retry loops to timeouts Date: Fri, 27 Dec 2024 10:01:05 +0200 Message-Id: <20241227095718.a21bf40b0fd3.I70166e460906d6d183359889d7543b9c587b7182@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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 We had reverted the retry loop removal because of an issue with PNVM loading, but that issue manifests as timeouts. Since the retry loops aren't needed in other cases, only do them when there were timeouts while loading, not other errors. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c index d7bf996d3a82..61ac62591161 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c @@ -1435,12 +1435,15 @@ _iwl_op_mode_start(struct iwl_drv *drv, struct iwlwifi_opmode_table *op) if (test_bit(STATUS_TRANS_DEAD, &drv->trans->status)) break; - IWL_ERR(drv, "retry init count %d\n", retry); - #ifdef CONFIG_IWLWIFI_DEBUGFS debugfs_remove_recursive(drv->dbgfs_op_mode); drv->dbgfs_op_mode = NULL; #endif + + if (PTR_ERR(op_mode) != -ETIMEDOUT) + break; + + IWL_ERR(drv, "retry init count %d\n", retry); } return NULL; From patchwork Fri Dec 27 08:01: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: 13921621 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 4EB5614F11E for ; Fri, 27 Dec 2024 08:01:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286506; cv=none; b=gbDgUvZatEzBDaWlRJBM8MKjcL2345+6Ju9A4hywC7KfbRLXKvOEEoh09b6ccptQGLhsWaCIut9rTHDQX6QE8fcPtqZqquLcFVZ4f0ZLzP9teUkuegle6a0OCxMZTbHMqf1rDlK//5gVbOxU+xT1h756Z2j5x2jI1rRxA6OnR5g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286506; c=relaxed/simple; bh=WeQtkk8fN05/PxXFrx2aocUNCdsOQYnwBEzjPE9tlQ8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uBZIetYruT20lQK5XGWwD5hr2dwt6VPHdvEUZu6/HDOrNBC6BcJgacSvXbjPYZBT2d3lGLUEmzmxBccLKfcxXFMrPZlV/+XCNIR5iVgEboLqhrGiAxHz7VIPQmuZqf30pNvj3Rr2PooAejAopil+OkT6kOdvKPSJvjMHaeqPxDQ= 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=EfQKzXkr; arc=none smtp.client-ip=198.175.65.13 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="EfQKzXkr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286505; x=1766822505; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WeQtkk8fN05/PxXFrx2aocUNCdsOQYnwBEzjPE9tlQ8=; b=EfQKzXkrkPEXnBMpeDDViP0+HfooGj7dpdI567QUJUu4aAndK/wC/Sni hY5AraNO5zLCMgLTFnGBDeKjGyYiQhHpj72BS07ekey7DMMtCNG9n36fT 2ZwVWAM34LXvkc9ETpUiwP232tZTOSDXf2EwdevSaUhFv1B+oy9f2b+81 jRl3LZnGWTb/CSlF1/b2Vp1eLixf6jR+rRVs/ZcJDMWUAgXDWm01UDSBq 3Na30aUHC4yoakhJsCv/7PNsf7pstGG5JS/sdsWeqvF6Q1SAKtqSOxzkz bBa8lUnDRQCa/P224t/BtEmkV0lYvvtv8G79gkUpDx2vur1yvHXFSg6kA Q==; X-CSE-ConnectionGUID: Lcj2W6U1TIiNhOa6TB2MXg== X-CSE-MsgGUID: NDZlWCzYQVqR/pStv+X7KQ== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46690972" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46690972" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:43 -0800 X-CSE-ConnectionGUID: bUPD5mbuQmi+rSH3P4t1+g== X-CSE-MsgGUID: 7mq9m8LRQVGRYYK23zxlCg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858391" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:40 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 11/17] wifi: iwlwifi: mvm: restrict MAC start retry to timeouts Date: Fri, 27 Dec 2024 10:01:06 +0200 Message-Id: <20241227095718.98201c79f66d.I5d7e12b219d533c6a77741ec5863984d35711f48@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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 We had reverted the retry loop removal because of an issue with PNVM loading, but that issue manifests as timeouts. Since the retries aren't needed in other cases, only do them when there were timeouts while starting, not other errors. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index ca6c40954e9d..b3c75484dafd 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -1311,7 +1311,7 @@ int iwl_mvm_mac_start(struct ieee80211_hw *hw) for (retry = 0; retry <= max_retry; retry++) { ret = __iwl_mvm_mac_start(mvm); - if (!ret) + if (ret != -ETIMEDOUT) break; IWL_ERR(mvm, "mac start retry %d\n", retry); From patchwork Fri Dec 27 08:01: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: 13921622 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 76DE214F132 for ; Fri, 27 Dec 2024 08:01:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286507; cv=none; b=l/cNDx7NTjIrKUmQKCHYG12j81IZTc0SGVVdB32i3plP0cEcFpvSGcilPX1Wt5PHJyE+29uN0+lQ2LkbgGp0whtxW2hr+9O8tDfHWL8MCHYfWJEK/GMtLf50i/EyfUfRVWsuB0qN/2jGkewqJ7oueJyD17B5/KGb+GZ1PkHdMxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286507; c=relaxed/simple; bh=GY/n8NDGc23Xcik/UnVapgxz1Bn97hOjtLqU82PBYKU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=g5YJAUH5Y8mcqxdFOGWjfTd3DweLooXIvlpNNrZnbQYuIbV9+1XSgroq6iqlLFxxDoqHVQf8tNiUv6pBICZadhBWYrsIenl9KB2epWwFtRNWvJDszSzdEy/muZydMjP1IkmvO9L/z//UASCRbkbu76EbgWUFxNHQyEDHTa7z6Lg= 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=CiDkOdp0; arc=none smtp.client-ip=198.175.65.13 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="CiDkOdp0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286505; x=1766822505; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GY/n8NDGc23Xcik/UnVapgxz1Bn97hOjtLqU82PBYKU=; b=CiDkOdp0vonttu+dXSS4I9CZwPGCMeZOfiHY9YrK4yZ0+7sMOJ54MSgt PsBHhmb1CgLe4YXR7rneL4IxG5s9BhnTIUVXfYM6KVMjNtU9oLToj5JoS Tz+uVaFXSSl4fDdZkf2G6hem227WMfldUa1aN492z1aMAiqNGuaWZ4AAf cSXOviQx9NyRrl+YlmKdDpXNtGHsjRIL4gi0gCRFo9/D+OmBsyemLlzdL yRqaFZ944LjBV+6kTSJ+FS54NcFNglO+iD76hL6KVMfdq3wwr0qHSAvVS R5KZQnMABPFxn88YipHKnmx7H1cfuADmiMoegjoUlTgR6zej1WrKM1dO4 Q==; X-CSE-ConnectionGUID: iW8eq5NeS3yUwKY/YuGCSA== X-CSE-MsgGUID: IyIq5b9ORNq6o0U9Nb8Ptw== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46690974" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46690974" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:43 -0800 X-CSE-ConnectionGUID: VRlWtuhBSQuaejXMlHvFOQ== X-CSE-MsgGUID: 9t5Z23jPTZquBsAig0guhQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858414" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:41 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 12/17] wifi: iwlwifi: mvm: remove STARTING state Date: Fri, 27 Dec 2024 10:01:07 +0200 Message-Id: <20241227095718.c55d73436521.I08e9f6a71d56f86872bca4d4e3048faa113a7120@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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 Now that the retry loop only happens when timeouts occur and firmware errors are different, we no longer need the STARTING state with all the infrastructure for it. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 9 +-------- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 3 --- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 3 --- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index b3c75484dafd..6b58231add55 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -1300,14 +1300,8 @@ int iwl_mvm_mac_start(struct ieee80211_hw *hw) /* we are starting the mac not in error flow, and restart is enabled */ if (!test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status) && - iwlwifi_mod_params.fw_restart) { + iwlwifi_mod_params.fw_restart) max_retry = IWL_MAX_INIT_RETRY; - /* - * This will prevent mac80211 recovery flows to trigger during - * init failures - */ - set_bit(IWL_MVM_STATUS_STARTING, &mvm->status); - } for (retry = 0; retry <= max_retry; retry++) { ret = __iwl_mvm_mac_start(mvm); @@ -1316,7 +1310,6 @@ int iwl_mvm_mac_start(struct ieee80211_hw *hw) IWL_ERR(mvm, "mac start retry %d\n", retry); } - clear_bit(IWL_MVM_STATUS_STARTING, &mvm->status); mutex_unlock(&mvm->mutex); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index 2ad615293c75..d0ba9e0f15b7 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -1401,8 +1401,6 @@ DEFINE_GUARD(mvm, struct iwl_mvm *, mutex_lock(&_T->mutex), mutex_unlock(&_T->mu * @IWL_MVM_STATUS_IN_D3: in D3 (or at least about to go into it) * @IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE: suppress one error log * if this is set, when intentionally triggered - * @IWL_MVM_STATUS_STARTING: starting mac, - * used to disable restart flow while in STARTING state */ enum iwl_mvm_status { IWL_MVM_STATUS_HW_RFKILL, @@ -1414,7 +1412,6 @@ enum iwl_mvm_status { IWL_MVM_STATUS_FIRMWARE_RUNNING, IWL_MVM_STATUS_IN_D3, IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE, - IWL_MVM_STATUS_STARTING, }; struct iwl_mvm_csme_conn_info { diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index 623122cadd32..de815504183c 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -2051,9 +2051,6 @@ void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error) */ if (!mvm->fw_restart && fw_error) { iwl_fw_error_collect(&mvm->fwrt, false); - } else if (test_bit(IWL_MVM_STATUS_STARTING, - &mvm->status)) { - IWL_ERR(mvm, "Starting mac, retry will be triggered anyway\n"); } else if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { struct iwl_mvm_reprobe *reprobe; From patchwork Fri Dec 27 08:01: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: 13921625 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 E834114F9F8 for ; Fri, 27 Dec 2024 08:01:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286509; cv=none; b=E088d5qbFLis6RbXMWl7GyRA7Au/y4fC+VAnNcgVN05SAXWTpDiCDYZGm+e1DG7Jviivd7EynaiObiaRDwLE1EAs1kOB90M1ujZULgj3NYMDWptFMWg4/IQrv1ivW2qtdeZoEz1xC8VltBrVuiZ1Jf/mWKIdKmkgKayqG0At49Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286509; c=relaxed/simple; bh=uRAge5VYHwR/kBkItatx+99dv/n7cLCM+ZBO9eJgXIk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ob3hmOzVeimzWcCF1ddF6HI5w5e7i815RZNi80/bEaqfGwLHtoVCDN+MdILd25ZmlftoZlTOUygMJqQJ/NYzJxy7wezdRbfuqj+wfh3agRKjzL4WlWC5bRA31GXGhJUmu+TWPQZeiGi7zFwdi5aLVXE9ZsRd1XxPKAPXs9r8+4Y= 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=g0pVwjPg; arc=none smtp.client-ip=198.175.65.13 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="g0pVwjPg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286507; x=1766822507; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uRAge5VYHwR/kBkItatx+99dv/n7cLCM+ZBO9eJgXIk=; b=g0pVwjPgrzwbiVJ4fdJVVn7ICp1AE8WQfDwn6qr/i4vM7G/W9bq/S1SL f83G8xKUYfcfTAjjBvXTHloDRdf9JhuQzz4kKwbyA/Puj2zUxXBWC4d60 J8cjEOilEDm1QTxZBFapEeY96tiP8gBdkHjm+zzMKtZpsUrbug2KM4VTj 0BMcCpBeatdmeJwfm2F9fYUTG+ZIi0OxxXrlOvZC3Bc0o6NbFY56T+Cmf 61i4LNTEG1V0WO3WWbYpYjdDT+Weh0z4E8bhH8VsKnTWI/OyLbEQBnKsB fZU2rvKXNHHhr21bwk3pCI94tC1QrE8z9klsmL36oGG9vFbQfAmlsyUbE w==; X-CSE-ConnectionGUID: sc0KfpAATK2d1NnBpxa3WQ== X-CSE-MsgGUID: ETK1nDeIQEKPhuf33nxJVQ== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46690982" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46690982" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:44 -0800 X-CSE-ConnectionGUID: CB8x+MsgSPys+8QfIDpVrg== X-CSE-MsgGUID: V6j3b6lUQpiMeQaVxrhoug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858431" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:43 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 13/17] wifi: iwlwifi: mvm: clean up FW restart a bit Date: Fri, 27 Dec 2024 10:01:08 +0200 Message-Id: <20241227095718.b0489daf323c.I0cd3233b2214c5f06e059f746041b19d08647e40@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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 Approximately three years ago, in commit ddb6b76b6f96 ("iwlwifi: yoyo: support TLV-based firmware reset"), the code was (likely erroneously) changed to no longer treat error interrupts as firmware errors. As a result, this meant that the fw_restart counter was only applied in case of command queue being stuck, which never seems to happen. Also, there's no longer any way to set the mvm->fw_restart to a value that doesn't match exactly the module parameter behaviour. Instead of trying to fix this, simply remove the logic that limits the number of restarts, it's clearly unused. However, restore the logic that restart isn't unconditional, by checking the module parameter. Since the "fw_error" argument to iwl_mvm_nic_restart() is now always true (except in the "never happens" case of CMD queue stuck), just remove it too and treat command queue stuck the same way as everything else. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 7 ------- .../net/wireless/intel/iwlwifi/mvm/debugfs.c | 4 ---- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 4 ++-- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 4 +--- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 19 ++++++++----------- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 4 ++-- 6 files changed, 13 insertions(+), 29 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c index cab11229bd7b..cbb09389f3bf 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c @@ -1395,13 +1395,6 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, if (ret < 0) { iwl_mvm_free_nd(mvm); - if (!unified_image) { - if (mvm->fw_restart > 0) { - mvm->fw_restart--; - ieee80211_restart_hw(mvm->hw); - } - } - clear_bit(IWL_MVM_STATUS_IN_D3, &mvm->status); } out_noreset: diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c index ccf377a6d73d..7fbfec6750c1 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c @@ -1167,10 +1167,6 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct iwl_mvm *mvm, char *buf, mutex_lock(&mvm->mutex); - /* allow one more restart that we're provoking here */ - if (mvm->fw_restart >= 0) - mvm->fw_restart++; - if (count == 6 && !strcmp(buf, "nolog\n")) { set_bit(IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE, &mvm->status); set_bit(STATUS_SUPPRESS_CMD_ERROR_ONCE, &mvm->trans->status); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 6b58231add55..9a6dd59fbc6c 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -5412,7 +5412,7 @@ iwl_mvm_switch_vif_chanctx_swap(struct iwl_mvm *mvm, out_restart: /* things keep failing, better restart the hw */ - iwl_mvm_nic_restart(mvm, false); + iwl_mvm_nic_restart(mvm); return ret; } @@ -5448,7 +5448,7 @@ iwl_mvm_switch_vif_chanctx_reassign(struct iwl_mvm *mvm, out_restart: /* things keep failing, better restart the hw */ - iwl_mvm_nic_restart(mvm, false); + iwl_mvm_nic_restart(mvm); return ret; } diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index d0ba9e0f15b7..40a609533eb2 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -1174,8 +1174,6 @@ struct iwl_mvm { struct ieee80211_bss_conf __rcu *link_id_to_link_conf[IWL_FW_MAX_LINK_ID + 1]; - /* -1 for always, 0 for never, >0 for that many times */ - s8 fw_restart; u8 *error_recovery_buf; #ifdef CONFIG_IWLWIFI_LEDS @@ -2588,7 +2586,7 @@ void iwl_mvm_tcm_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); void iwl_mvm_tcm_rm_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); u8 iwl_mvm_tcm_load_percentage(u32 airtime, u32 elapsed); -void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error); +void iwl_mvm_nic_restart(struct iwl_mvm *mvm); unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm, struct ieee80211_vif *vif); void iwl_mvm_connection_loss(struct iwl_mvm *mvm, struct ieee80211_vif *vif, diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index de815504183c..aad0449fab36 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -1354,7 +1354,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, } } - mvm->fw_restart = iwlwifi_mod_params.fw_restart ? -1 : 0; mvm->bios_enable_puncturing = iwl_uefi_get_puncturing(&mvm->fwrt); if (iwl_mvm_has_new_tx_api(mvm)) { @@ -2026,7 +2025,7 @@ static void iwl_mvm_reprobe_wk(struct work_struct *wk) module_put(THIS_MODULE); } -void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error) +void iwl_mvm_nic_restart(struct iwl_mvm *mvm) { iwl_abort_notification_waits(&mvm->notif_wait); iwl_dbg_tlv_del_timers(mvm->trans); @@ -2049,9 +2048,7 @@ void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error) * If WoWLAN fw asserted, don't restart either, mac80211 * can't recover this since we're already half suspended. */ - if (!mvm->fw_restart && fw_error) { - iwl_fw_error_collect(&mvm->fwrt, false); - } else if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { + if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { struct iwl_mvm_reprobe *reprobe; IWL_ERR(mvm, @@ -2103,10 +2100,10 @@ void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error) iwl_fw_error_collect(&mvm->fwrt, false); - if (fw_error && mvm->fw_restart > 0) { - mvm->fw_restart--; - ieee80211_restart_hw(mvm->hw); - } else if (mvm->fwrt.trans->dbg.restart_required) { + if (!iwlwifi_mod_params.fw_restart) + return; + + if (mvm->fwrt.trans->dbg.restart_required) { IWL_DEBUG_INFO(mvm, "FW restart requested after debug collection\n"); mvm->fwrt.trans->dbg.restart_required = false; ieee80211_restart_hw(mvm->hw); @@ -2140,7 +2137,7 @@ static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode, if (!test_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status)) return; - iwl_mvm_nic_restart(mvm, false); + iwl_mvm_nic_restart(mvm); } static void iwl_mvm_cmd_queue_full(struct iwl_op_mode *op_mode) @@ -2148,7 +2145,7 @@ static void iwl_mvm_cmd_queue_full(struct iwl_op_mode *op_mode) struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); WARN_ON(1); - iwl_mvm_nic_restart(mvm, true); + iwl_mvm_nic_restart(mvm); } static void iwl_op_mode_mvm_time_point(struct iwl_op_mode *op_mode, diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c index 376b9b12fa62..0bcd1fca31bc 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c @@ -3477,7 +3477,7 @@ void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm) * restart_hw, so do not report if FW is about to be * restarted. */ - if (!mvm->fw_restart) + if (!iwlwifi_mod_params.fw_restart) ieee80211_sched_scan_stopped(mvm->hw); mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; mvm->scan_uid_status[uid] = 0; @@ -3528,7 +3528,7 @@ void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm) * restarted. */ if ((mvm->scan_status & IWL_MVM_SCAN_SCHED) && - !mvm->fw_restart) { + !iwlwifi_mod_params.fw_restart) { ieee80211_sched_scan_stopped(mvm->hw); mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; } From patchwork Fri Dec 27 08:01: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: 13921624 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 47E5B1552ED for ; Fri, 27 Dec 2024 08:01:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286509; cv=none; b=dqzXX4o1aMl1Hfvp9HYHUC9T2/G/TEwEv6mTBHv5IwrsXCMUzol+WoVDwqkzCMvkdrremXfOIAguu0vL+ECPzykRmAKb76xsMbpXe/AwWdeGKKq/ve26kKP0IvbxV0d4aAhGA4QHapDasIL0yxuws0OwEkhafzM9o87stQYw6Zg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286509; c=relaxed/simple; bh=+Fg5sgi9mJBmI9U5Q7GI91F6PsG+9vhDeT+Tp8ayiAE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WJ5uoyoR8W9kU0XcMixhuF1lztmfcDYegkZXYIAMJqBtkqOlLhYwB29fJp5gCHAVEWG4DNMVjT0CyXn83EHnnXP+UWWO0fFM/E30VysiOIP4pxwgNEAzq4Ul+bxY5Z4jyVu9FM+PQrl7qhOtAMr00Fc3K0YJ4riYEV0uVVzsvcQ= 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=FtBtUPtd; arc=none smtp.client-ip=198.175.65.13 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="FtBtUPtd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286507; x=1766822507; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+Fg5sgi9mJBmI9U5Q7GI91F6PsG+9vhDeT+Tp8ayiAE=; b=FtBtUPtdaEJruYhL25nU1NxJfN2Nuyyxcd4wE3hY0YvVW4f3rDYs62fU YDwVMLpS3/aPjFeiV0Q0MTxBAkms0YvZ5figOTDlx0WGFuJ77v9aMhQX/ 3p0GwwZSFAQ2QnFdwuoXc3LkxtLu3rFz9U5fzYl1+RhTD74ZxgRPlrD0k ZT9uw7zOZf2YwSn19f8Ewxr3GI8Yl+TLaw0cKgmsmjtUjIcE3Db3GDLFb A96FnJZNbJD85ZE4VQS2LfnfRhezGsRrt/wyRm66Fomx/4xPORA6qnz4B QUNVSo+fd2fva+SP5hpyLM6KpNXzK+fwcbtj/ILDgWohi+GogOp/QV0Ob Q==; X-CSE-ConnectionGUID: DetV7dzEQGq/9yTQ3ksWTA== X-CSE-MsgGUID: 02jLNHnnS9mN2sQJN0taFw== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46690995" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46690995" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:45 -0800 X-CSE-ConnectionGUID: ZtOvNhoPR3SvpdgTNdgQXg== X-CSE-MsgGUID: R+XqimpUQpSTdaYONwPJQw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858444" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:44 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 14/17] wifi: iwlwifi: unify cmd_queue_full() into nic_error() Date: Fri, 27 Dec 2024 10:01:09 +0200 Message-Id: <20241227095718.0222183504aa.Ie29cef75fbd91b64a43619bc36bd5b29c5b9f957@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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 Except for some special handling in DVM, error dump and some message behaviour, cmd_queue_full and nic_error are equivalent now. Unify by giving a special error type, so DVM can continue to differentiate. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/dvm/main.c | 22 ++++++++----------- .../net/wireless/intel/iwlwifi/iwl-op-mode.h | 10 ++------- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 17 +++++--------- .../net/wireless/intel/iwlwifi/pcie/tx-gen2.c | 3 ++- drivers/net/wireless/intel/iwlwifi/pcie/tx.c | 3 ++- 5 files changed, 20 insertions(+), 35 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/main.c b/drivers/net/wireless/intel/iwlwifi/dvm/main.c index 4f5846953fa3..797b7c360acf 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/main.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/main.c @@ -1957,25 +1957,22 @@ static void iwl_nic_error(struct iwl_op_mode *op_mode, { struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); + if (type == IWL_ERR_TYPE_CMD_QUEUE_FULL && iwl_check_for_ct_kill(priv)) + return; + IWL_ERR(priv, "Loaded firmware version: %s\n", priv->fw->fw_version); - iwl_dump_nic_error_log(priv); - iwl_dump_nic_event_log(priv, false, NULL); + if (type == IWL_ERR_TYPE_CMD_QUEUE_FULL) { + IWL_ERR(priv, "Command queue full!\n"); + } else { + iwl_dump_nic_error_log(priv); + iwl_dump_nic_event_log(priv, false, NULL); + } iwlagn_fw_error(priv, false); } -static void iwl_cmd_queue_full(struct iwl_op_mode *op_mode) -{ - struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); - - if (!iwl_check_for_ct_kill(priv)) { - IWL_ERR(priv, "Restarting adapter queue is full\n"); - iwlagn_fw_error(priv, false); - } -} - #define EEPROM_RF_CONFIG_TYPE_MAX 0x3 static void iwl_nic_config(struct iwl_op_mode *op_mode) @@ -2128,7 +2125,6 @@ static const struct iwl_op_mode_ops iwl_dvm_ops = { .hw_rf_kill = iwl_set_hw_rfkill_state, .free_skb = iwl_free_skb, .nic_error = iwl_nic_error, - .cmd_queue_full = iwl_cmd_queue_full, .nic_config = iwl_nic_config, .wimax_active = iwl_wimax_active, }; diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h b/drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h index 8febc949b610..3b4085d3aad2 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h @@ -51,11 +51,13 @@ struct iwl_cfg; * @IWL_ERR_TYPE_RESET_HS_TIMEOUT: reset handshake timed out, * any debug collection must happen synchronously as * the device will be shut down + * @IWL_ERR_TYPE_CMD_QUEUE_FULL: command queue was full */ enum iwl_fw_error_type { IWL_ERR_TYPE_IRQ, IWL_ERR_TYPE_NMI_FORCED, IWL_ERR_TYPE_RESET_HS_TIMEOUT, + IWL_ERR_TYPE_CMD_QUEUE_FULL, }; /** @@ -93,8 +95,6 @@ enum iwl_fw_error_type { * Must be atomic * @nic_error: error notification. Must be atomic and must be called with BH * disabled, unless the type is IWL_ERR_TYPE_RESET_HS_TIMEOUT - * @cmd_queue_full: Called when the command queue gets full. Must be atomic and - * called with BH disabled. * @nic_config: configure NIC, called before firmware is started. * May sleep * @wimax_active: invoked when WiMax becomes active. May sleep @@ -120,7 +120,6 @@ struct iwl_op_mode_ops { void (*free_skb)(struct iwl_op_mode *op_mode, struct sk_buff *skb); void (*nic_error)(struct iwl_op_mode *op_mode, enum iwl_fw_error_type type); - void (*cmd_queue_full)(struct iwl_op_mode *op_mode); void (*nic_config)(struct iwl_op_mode *op_mode); void (*wimax_active)(struct iwl_op_mode *op_mode); void (*time_point)(struct iwl_op_mode *op_mode, @@ -198,11 +197,6 @@ static inline void iwl_op_mode_nic_error(struct iwl_op_mode *op_mode, op_mode->ops->nic_error(op_mode, type); } -static inline void iwl_op_mode_cmd_queue_full(struct iwl_op_mode *op_mode) -{ - op_mode->ops->cmd_queue_full(op_mode); -} - static inline void iwl_op_mode_nic_config(struct iwl_op_mode *op_mode) { might_sleep(); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index aad0449fab36..13a24030acdb 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -2118,9 +2118,11 @@ static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode, { struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); - if (!test_bit(STATUS_TRANS_DEAD, &mvm->trans->status) && - !test_and_clear_bit(IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE, - &mvm->status)) + if (type == IWL_ERR_TYPE_CMD_QUEUE_FULL) + IWL_ERR(mvm, "Command queue full!\n"); + else if (!test_bit(STATUS_TRANS_DEAD, &mvm->trans->status) && + !test_and_clear_bit(IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE, + &mvm->status)) iwl_mvm_dump_nic_error_log(mvm); /* reset HS timeout is during shutdown, so collect right now */ @@ -2140,14 +2142,6 @@ static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode, iwl_mvm_nic_restart(mvm); } -static void iwl_mvm_cmd_queue_full(struct iwl_op_mode *op_mode) -{ - struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); - - WARN_ON(1); - iwl_mvm_nic_restart(mvm); -} - static void iwl_op_mode_mvm_time_point(struct iwl_op_mode *op_mode, enum iwl_fw_ini_time_point tp_id, union iwl_dbg_tlv_tp_data *tp_data) @@ -2181,7 +2175,6 @@ static void iwl_op_mode_mvm_device_powered_off(struct iwl_op_mode *op_mode) .hw_rf_kill = iwl_mvm_set_hw_rfkill_state, \ .free_skb = iwl_mvm_free_skb, \ .nic_error = iwl_mvm_nic_error, \ - .cmd_queue_full = iwl_mvm_cmd_queue_full, \ .nic_config = iwl_mvm_nic_config, \ /* as we only register one, these MUST be common! */ \ .start = iwl_op_mode_mvm_start, \ diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c index b1846abb99b7..4c92588d15cb 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c @@ -1298,7 +1298,8 @@ int iwl_pcie_gen2_enqueue_hcmd(struct iwl_trans *trans, spin_unlock_irqrestore(&txq->lock, flags); IWL_ERR(trans, "No space in command queue\n"); - iwl_op_mode_cmd_queue_full(trans->op_mode); + iwl_op_mode_nic_error(trans->op_mode, + IWL_ERR_TYPE_CMD_QUEUE_FULL); idx = -ENOSPC; goto free_dup_buf; } diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c index 1ef14340953c..aaa1b87ee265 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c @@ -1449,7 +1449,8 @@ int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, spin_unlock_irqrestore(&txq->lock, flags); IWL_ERR(trans, "No space in command queue\n"); - iwl_op_mode_cmd_queue_full(trans->op_mode); + iwl_op_mode_nic_error(trans->op_mode, + IWL_ERR_TYPE_CMD_QUEUE_FULL); idx = -ENOSPC; goto free_dup_buf; } From patchwork Fri Dec 27 08:01: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: 13921623 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 253C01552E0 for ; Fri, 27 Dec 2024 08:01:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286508; cv=none; b=Dh1680AiLeDCug3EhfpTx6ACGAlpgB32VIu9jchb1jdxwG5s768G5rfwygR61zXYQ/PTPz8uCWnITlwSMGarsSICUQD+XbCevEIWMlZ1NRlObVE2gk+vegDRjE3Gi9L+IBfeWR0Os7IXubTt+QQIcwCRoT9DOrDdkQvZm6BWEWU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286508; c=relaxed/simple; bh=1M0hPQBjZutLl/U++CNoIvpelQwiHgBMwQrcC6PG/Gw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CjgChX4ubYGw27wi/T5TMr9TQYry3P4RpZbkTUZ2drSpTQeCv5hRcdFmbx1vP9UqGRdZKCV52J8q22u1o7zB/BvQ1vdw5FgZ0Cnqkgq37TMaZV2n+U7rKc1d7KGHp97QjbEvWHLYgngyGk2O9naMbdf0qYKrUGORvSbYVdzOLlA= 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=bRJFbzpn; arc=none smtp.client-ip=198.175.65.13 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="bRJFbzpn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286507; x=1766822507; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1M0hPQBjZutLl/U++CNoIvpelQwiHgBMwQrcC6PG/Gw=; b=bRJFbzpn5YMEy0eFsw0jN5W5heC0wKZcSMOfu4moolvmZLegmtk6IsEl gDKSN4iD6+mOjzY6PM9Oh/Hi2Pk8iL4xAoO7tTNKVqEXVsSrOO2bVBbds LVFLO+gDJ0mGukA32O/BEHU5z0ivFs3dh124Px3wdPscOW3iBYcShfdXs 7lG7ewC64ElIn3kRQrigZILlBUO+ush+WywKfswYq9Y1hHBazZpFxSwh4 BeGDvkcdtu3imFzSERC0umlRRI5nUmRI8c8JlFrmgJ4ylxzSDBzwMegdG KcqQ/GbKz06c+GCOqJh6E/87NjQOH6F2/WPDoL1TuQR0Q/vA17le1m4Mt Q==; X-CSE-ConnectionGUID: AHzaBGJDSCyzuDoLGl3GWA== X-CSE-MsgGUID: n7u7h6XPSnGx7Lqxqy8ERw== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46691001" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46691001" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:47 -0800 X-CSE-ConnectionGUID: 8NrTtivYT6KhDPNer8XYaQ== X-CSE-MsgGUID: bi+E0SuuQPytrcFul0WGYA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858456" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:45 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 15/17] wifi: iwlwifi: mvm: restart device through NMI Date: Fri, 27 Dec 2024 10:01:10 +0200 Message-Id: <20241227095718.96b732029d20.I2e729f402db58a76cea620b6f62a02da49a10b48@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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 When some channel context manipulations fail, the device is going to be restarted to try to recover. Make this go through a real FW restart via an NMI so the transport is aware of it and can later handle escalation, and to make it easier to restructure the code later. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 4 ++-- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 1 - drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 9a6dd59fbc6c..039d0d6ed61d 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -5412,7 +5412,7 @@ iwl_mvm_switch_vif_chanctx_swap(struct iwl_mvm *mvm, out_restart: /* things keep failing, better restart the hw */ - iwl_mvm_nic_restart(mvm); + iwl_force_nmi(mvm->trans); return ret; } @@ -5448,7 +5448,7 @@ iwl_mvm_switch_vif_chanctx_reassign(struct iwl_mvm *mvm, out_restart: /* things keep failing, better restart the hw */ - iwl_mvm_nic_restart(mvm); + iwl_force_nmi(mvm->trans); return ret; } diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index 40a609533eb2..dbf32bf5760b 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -2586,7 +2586,6 @@ void iwl_mvm_tcm_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); void iwl_mvm_tcm_rm_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); u8 iwl_mvm_tcm_load_percentage(u32 airtime, u32 elapsed); -void iwl_mvm_nic_restart(struct iwl_mvm *mvm); unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm, struct ieee80211_vif *vif); void iwl_mvm_connection_loss(struct iwl_mvm *mvm, struct ieee80211_vif *vif, diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index 13a24030acdb..ef54ba818d1f 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -2025,7 +2025,7 @@ static void iwl_mvm_reprobe_wk(struct work_struct *wk) module_put(THIS_MODULE); } -void iwl_mvm_nic_restart(struct iwl_mvm *mvm) +static void iwl_mvm_nic_restart(struct iwl_mvm *mvm) { iwl_abort_notification_waits(&mvm->notif_wait); iwl_dbg_tlv_del_timers(mvm->trans); From patchwork Fri Dec 27 08:01: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: 13921626 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 081FA155336 for ; Fri, 27 Dec 2024 08:01:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286511; cv=none; b=IiVHNVU63QpQgu6QdmVG4YqaHTwdudXZRb3E1CcO3fo1fm+vQGbnWCb+/eyhV8kr911zJLXeRQ4GuyYirATxUCs2fWqmOYBaMhcv/Lacw7ZdSqn01PwCtEF/vxvy//dWVNPfyoYHpHcyA62bcWge4cN+5YHdoozH8rVSVh9CVTs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286511; c=relaxed/simple; bh=wUb4mkMNDiy6bj79JVRzq+ll7dj20TK4WvhTBG+NL3o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Y8GwoVLdLJuahEYoVHiqGCRiBAu3Um0hd5sZw0xjSl008QjCIj/mIlr2XaZt7fmhBzZinrIbk5qGdIAb9XURHhgT3qDujc2V4D69ckCFWjmvM0fiXUL5TUvkdOZa0cnbkieTnTjjxSsPpva/JyZgh7Z+Uze7SuTlhj/QpQ8WYb8= 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=cPNL+KML; arc=none smtp.client-ip=198.175.65.13 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="cPNL+KML" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286509; x=1766822509; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wUb4mkMNDiy6bj79JVRzq+ll7dj20TK4WvhTBG+NL3o=; b=cPNL+KML6y8WeNnD21JCMK0Y+zGqFCiRI1RIiL/wZFmAN/43QP3pw0+j xqVoOqm2MhgkBzbbmRIM2p1aQGne+iAwAHxm5a3+k14rEvlN9SCqLeFPT QbdN15aC6dqNKqgHxrYN5/wkJ8As2ZwyHv/0v+U0LXdMcOP5Ou5YCG8bj dHlLRlWc9Vc01Y4oxX7IEEOCjJqQY+JOtWQ6d5uP5EIAnfy0HBZTinRqC OyfLv9KIwYmchLoiS9boUL2WxUCjCwnlJveTh9V89wzs/aY/FkySlYfuI HzZIETt44ylqmDlbBsAHqKicer+J1Wt4fq5sWV2wB1KhDOjN7WqyQdwMQ g==; X-CSE-ConnectionGUID: xDHum4t7TReWPc8W1YSLVw== X-CSE-MsgGUID: 2D38nF7PQ4qLhoXmyvHEbA== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46691007" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46691007" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:48 -0800 X-CSE-ConnectionGUID: 9J0dllAXRxSlDJSIZ5RNLw== X-CSE-MsgGUID: yTWq8gEZRyiHeWF+/lfgyw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858475" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:47 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 16/17] wifi: iwlwifi: rework firmware error handling Date: Fri, 27 Dec 2024 10:01:11 +0200 Message-Id: <20241227095718.6d4f741ae907.I96a9243e7877808ed6d1bff6967c15d6c24882f0@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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 order to later add the ability to do deeper resets of the device when it crashes, first restructure the firmware error handling. Instead of having just a single nic_error() method that handles all, split it: - nic_error() just handles and prints the error itself, - dump_error() synchronously creates an error dump, and - sw_reset() will be called to request doing a SW reset. This changes the architecture so that the transport is now responsible for deciding how to do the reset, and therefore the handling of reprobe if error occurs during reconfig moves there, which necessitates adding a method there that notifies the transport that the recovery was completed. Actually introducing the model under which deeper resets can be done will be in future patches. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- .../net/wireless/intel/iwlwifi/dvm/mac80211.c | 11 ++ drivers/net/wireless/intel/iwlwifi/dvm/main.c | 27 +++- .../net/wireless/intel/iwlwifi/iwl-op-mode.h | 53 ++++++- .../net/wireless/intel/iwlwifi/iwl-trans.c | 109 ++++++++++++- .../net/wireless/intel/iwlwifi/iwl-trans.h | 56 ++++++- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 1 + drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 143 +++++++----------- .../wireless/intel/iwlwifi/pcie/trans-gen2.c | 11 +- .../net/wireless/intel/iwlwifi/pcie/tx-gen2.c | 1 + drivers/net/wireless/intel/iwlwifi/pcie/tx.c | 1 + 10 files changed, 312 insertions(+), 101 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c index 74d163e56511..56d19a034c24 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c @@ -1565,6 +1565,16 @@ static void iwlagn_mac_sta_notify(struct ieee80211_hw *hw, IWL_DEBUG_MAC80211(priv, "leave\n"); } +static void +iwlagn_mac_reconfig_complete(struct ieee80211_hw *hw, + enum ieee80211_reconfig_type reconfig_type) +{ + struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); + + if (reconfig_type == IEEE80211_RECONFIG_TYPE_RESTART) + iwl_trans_finish_sw_reset(priv->trans); +} + const struct ieee80211_ops iwlagn_hw_ops = { .add_chanctx = ieee80211_emulate_add_chanctx, .remove_chanctx = ieee80211_emulate_remove_chanctx, @@ -1598,6 +1608,7 @@ const struct ieee80211_ops iwlagn_hw_ops = { .tx_last_beacon = iwlagn_mac_tx_last_beacon, .event_callback = iwlagn_mac_event_callback, .set_tim = iwlagn_mac_set_tim, + .reconfig_complete = iwlagn_mac_reconfig_complete, }; /* This function both allocates and initializes hw and priv. */ diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/main.c b/drivers/net/wireless/intel/iwlwifi/dvm/main.c index 797b7c360acf..30789ba06d9d 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/main.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/main.c @@ -1905,17 +1905,9 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand) unsigned int reload_msec; unsigned long reload_jiffies; - if (iwl_have_debug_level(IWL_DL_FW)) - iwl_print_rx_config_cmd(priv, IWL_RXON_CTX_BSS); - /* uCode is no longer loaded. */ priv->ucode_loaded = false; - /* Set the FW error flag -- cleared on iwl_down */ - set_bit(STATUS_FW_ERROR, &priv->status); - - iwl_abort_notification_waits(&priv->notif_wait); - /* Keep the restart process from trying to send host * commands by clearing the ready bit */ clear_bit(STATUS_READY, &priv->status); @@ -1957,6 +1949,11 @@ static void iwl_nic_error(struct iwl_op_mode *op_mode, { struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); + /* Set the FW error flag -- cleared on iwl_down */ + set_bit(STATUS_FW_ERROR, &priv->status); + + iwl_abort_notification_waits(&priv->notif_wait); + if (type == IWL_ERR_TYPE_CMD_QUEUE_FULL && iwl_check_for_ct_kill(priv)) return; @@ -1970,7 +1967,20 @@ static void iwl_nic_error(struct iwl_op_mode *op_mode, iwl_dump_nic_event_log(priv, false, NULL); } + if (iwl_have_debug_level(IWL_DL_FW)) + iwl_print_rx_config_cmd(priv, IWL_RXON_CTX_BSS); +} + +static bool iwlagn_sw_reset(struct iwl_op_mode *op_mode, + enum iwl_fw_error_type type) +{ + struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); + + if (type == IWL_ERR_TYPE_CMD_QUEUE_FULL && iwl_check_for_ct_kill(priv)) + return false; + iwlagn_fw_error(priv, false); + return true; } #define EEPROM_RF_CONFIG_TYPE_MAX 0x3 @@ -2125,6 +2135,7 @@ static const struct iwl_op_mode_ops iwl_dvm_ops = { .hw_rf_kill = iwl_set_hw_rfkill_state, .free_skb = iwl_free_skb, .nic_error = iwl_nic_error, + .sw_reset = iwlagn_sw_reset, .nic_config = iwl_nic_config, .wimax_active = iwl_wimax_active, }; diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h b/drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h index 3b4085d3aad2..34eca1a568ea 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h @@ -60,6 +60,39 @@ enum iwl_fw_error_type { IWL_ERR_TYPE_CMD_QUEUE_FULL, }; +/** + * enum iwl_fw_error_context - error dump context + * @IWL_ERR_CONTEXT_WORKER: regular from worker context, + * opmode must acquire locks and must also check + * for @IWL_ERR_CONTEXT_ABORT after acquiring locks + * @IWL_ERR_CONTEXT_FROM_OPMODE: context is in a call + * originating from the opmode, e.g. while resetting + * or stopping the device, so opmode must not acquire + * any locks + * @IWL_ERR_CONTEXT_ABORT: after lock acquisition, indicates + * that the dump already happened via another callback + * (currently only while stopping the device) via the + * @IWL_ERR_CONTEXT_FROM_OPMODE context, and this call + * must be aborted + */ +enum iwl_fw_error_context { + IWL_ERR_CONTEXT_WORKER, + IWL_ERR_CONTEXT_FROM_OPMODE, + IWL_ERR_CONTEXT_ABORT, +}; + +/** + * struct iwl_fw_error_dump_mode - error dump mode for callback + * @type: The reason for the dump, per &enum iwl_fw_error_type. + * @context: The context for the dump, may also indicate this + * call needs to be skipped. This MUST be checked before + * and after acquiring any locks in the op-mode! + */ +struct iwl_fw_error_dump_mode { + enum iwl_fw_error_type type; + enum iwl_fw_error_context context; +}; + /** * struct iwl_op_mode_ops - op_mode specific operations * @@ -93,8 +126,11 @@ enum iwl_fw_error_type { * reclaimed by the op_mode. This can happen when the driver is freed and * there are Tx packets pending in the transport layer. * Must be atomic - * @nic_error: error notification. Must be atomic and must be called with BH - * disabled, unless the type is IWL_ERR_TYPE_RESET_HS_TIMEOUT + * @nic_error: error notification. Must be atomic, the op mode should handle + * the error (e.g. abort notification waiters) and print the error if + * applicable + * @dump_error: NIC error dump collection (can sleep, synchronous) + * @sw_reset: (maybe) initiate a software reset, return %true if started * @nic_config: configure NIC, called before firmware is started. * May sleep * @wimax_active: invoked when WiMax becomes active. May sleep @@ -120,6 +156,10 @@ struct iwl_op_mode_ops { void (*free_skb)(struct iwl_op_mode *op_mode, struct sk_buff *skb); void (*nic_error)(struct iwl_op_mode *op_mode, enum iwl_fw_error_type type); + void (*dump_error)(struct iwl_op_mode *op_mode, + struct iwl_fw_error_dump_mode *mode); + bool (*sw_reset)(struct iwl_op_mode *op_mode, + enum iwl_fw_error_type type); void (*nic_config)(struct iwl_op_mode *op_mode); void (*wimax_active)(struct iwl_op_mode *op_mode); void (*time_point)(struct iwl_op_mode *op_mode, @@ -197,6 +237,15 @@ static inline void iwl_op_mode_nic_error(struct iwl_op_mode *op_mode, op_mode->ops->nic_error(op_mode, type); } +static inline void iwl_op_mode_dump_error(struct iwl_op_mode *op_mode, + struct iwl_fw_error_dump_mode *mode) +{ + might_sleep(); + + if (op_mode->ops->dump_error) + op_mode->ops->dump_error(op_mode, mode); +} + static inline void iwl_op_mode_nic_config(struct iwl_op_mode *op_mode) { might_sleep(); diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.c b/drivers/net/wireless/intel/iwlwifi/iwl-trans.c index 3c9d91496c82..a941a525dd7d 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.c @@ -16,13 +16,87 @@ #include "pcie/internal.h" #include "iwl-context-info-gen3.h" +struct iwl_trans_reprobe { + struct device *dev; + struct work_struct work; +}; + +static void iwl_trans_reprobe_wk(struct work_struct *wk) +{ + struct iwl_trans_reprobe *reprobe; + + reprobe = container_of(wk, typeof(*reprobe), work); + + if (device_reprobe(reprobe->dev)) + dev_err(reprobe->dev, "reprobe failed!\n"); + put_device(reprobe->dev); + kfree(reprobe); + module_put(THIS_MODULE); +} + +static void iwl_trans_restart_wk(struct work_struct *wk) +{ + struct iwl_trans *trans = container_of(wk, typeof(*trans), restart.wk); + struct iwl_trans_reprobe *reprobe; + + if (!trans->op_mode) + return; + + /* might have been scheduled before marked as dead, re-check */ + if (test_bit(STATUS_TRANS_DEAD, &trans->status)) + return; + + iwl_op_mode_dump_error(trans->op_mode, &trans->restart.mode); + + /* + * If the opmode stopped the device while we were trying to dump and + * reset, then we'll have done the dump already (synchronized by the + * opmode lock that it will acquire in iwl_op_mode_dump_error()) and + * managed that via trans->restart.mode. + * Additionally, make sure that in such a case we won't attempt to do + * any resets now, since it's no longer requested. + */ + if (!test_and_clear_bit(STATUS_RESET_PENDING, &trans->status)) + return; + + if (!iwlwifi_mod_params.fw_restart) + return; + + if (!trans->restart.during_reset) { + iwl_trans_opmode_sw_reset(trans, trans->restart.mode.type); + return; + } + + IWL_ERR(trans, + "Device error during reconfiguration - reprobe!\n"); + + /* + * get a module reference to avoid doing this while unloading + * anyway and to avoid scheduling a work with code that's + * being removed. + */ + if (!try_module_get(THIS_MODULE)) { + IWL_ERR(trans, "Module is being unloaded - abort\n"); + return; + } + + reprobe = kzalloc(sizeof(*reprobe), GFP_KERNEL); + if (!reprobe) { + module_put(THIS_MODULE); + return; + } + reprobe->dev = get_device(trans->dev); + INIT_WORK(&reprobe->work, iwl_trans_reprobe_wk); + schedule_work(&reprobe->work); +} + struct iwl_trans *iwl_trans_alloc(unsigned int priv_size, struct device *dev, const struct iwl_cfg_trans_params *cfg_trans) { struct iwl_trans *trans; #ifdef CONFIG_LOCKDEP - static struct lock_class_key __key; + static struct lock_class_key __sync_cmd_key; #endif trans = devm_kzalloc(dev, sizeof(*trans) + priv_size, GFP_KERNEL); @@ -33,12 +107,14 @@ struct iwl_trans *iwl_trans_alloc(unsigned int priv_size, #ifdef CONFIG_LOCKDEP lockdep_init_map(&trans->sync_cmd_lockdep_map, "sync_cmd_lockdep_map", - &__key, 0); + &__sync_cmd_key, 0); #endif trans->dev = dev; trans->num_rx_queues = 1; + INIT_WORK(&trans->restart.wk, iwl_trans_restart_wk); + return trans; } @@ -81,6 +157,7 @@ int iwl_trans_init(struct iwl_trans *trans) void iwl_trans_free(struct iwl_trans *trans) { + cancel_work_sync(&trans->restart.wk); kmem_cache_destroy(trans->dev_cmd_pool); } @@ -391,6 +468,34 @@ void iwl_trans_stop_device(struct iwl_trans *trans) { might_sleep(); + /* + * See also the comment in iwl_trans_restart_wk(). + * + * When the opmode stops the device while a reset is pending, the + * worker (iwl_trans_restart_wk) might not have run yet or, more + * likely, will be blocked on the opmode lock. Due to the locking, + * we can't just flush the worker. + * + * If this is the case, then the test_and_clear_bit() ensures that + * the worker won't attempt to do anything after the stop. + * + * The trans->restart.mode is a handshake with the opmode, we set + * the context there to ABORT so that when the worker can finally + * acquire the lock in the opmode, the code there won't attempt to + * do any dumps. Since we'd really like to have the dump though, + * also do it inline here (with the opmode locks already held), + * but use a separate mode struct to avoid races. + */ + if (test_and_clear_bit(STATUS_RESET_PENDING, &trans->status)) { + struct iwl_fw_error_dump_mode mode; + + mode = trans->restart.mode; + mode.context = IWL_ERR_CONTEXT_FROM_OPMODE; + trans->restart.mode.context = IWL_ERR_CONTEXT_ABORT; + + iwl_op_mode_dump_error(trans->op_mode, &mode); + } + if (trans->trans_cfg->gen2) iwl_trans_pcie_gen2_stop_device(trans); else diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h index 22c0864b5704..0a9881c3291e 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h @@ -300,6 +300,10 @@ enum iwl_d3_status { * @STATUS_TRANS_DEAD: trans is dead - avoid any read/write operation * @STATUS_SUPPRESS_CMD_ERROR_ONCE: suppress "FW error in SYNC CMD" once, * e.g. for testing + * @STATUS_IN_SW_RESET: device is undergoing reset, cleared by opmode + * via iwl_trans_finish_sw_reset() + * @STATUS_RESET_PENDING: reset worker was scheduled, but didn't dump + * the firmware state yet */ enum iwl_trans_status { STATUS_SYNC_HCMD_ACTIVE, @@ -311,6 +315,8 @@ enum iwl_trans_status { STATUS_FW_ERROR, STATUS_TRANS_DEAD, STATUS_SUPPRESS_CMD_ERROR_ONCE, + STATUS_IN_SW_RESET, + STATUS_RESET_PENDING, }; static inline int @@ -322,7 +328,6 @@ iwl_trans_get_rb_size_order(enum iwl_amsdu_size rb_size) case IWL_AMSDU_4K: return get_order(4 * 1024); case IWL_AMSDU_8K: - return get_order(8 * 1024); case IWL_AMSDU_12K: return get_order(16 * 1024); default: @@ -877,6 +882,10 @@ struct iwl_txq { * @reduced_cap_sku: reduced capability supported SKU * @no_160: device not supporting 160 MHz * @step_urm: STEP is in URM, no support for MCS>9 in 320 MHz + * @restart: restart worker data + * @restart.wk: restart worker + * @restart.mode: reset/restart error mode information + * @restart.during_reset: error occurred during previous software reset * @trans_specific: data for the specific transport this is allocated for/with * @dsbr_urm_fw_dependent: switch to URM based on fw settings * @dsbr_urm_permanent: switch to URM permanently @@ -949,6 +958,12 @@ struct iwl_trans { struct iwl_dma_ptr invalid_tx_cmd; + struct { + struct work_struct wk; + struct iwl_fw_error_dump_mode mode; + bool during_reset; + } restart; + /* pointer to trans specific struct */ /*Ensure that this pointer will always be aligned to sizeof pointer */ char trans_specific[] __aligned(sizeof(void *)); @@ -1125,6 +1140,26 @@ bool _iwl_trans_grab_nic_access(struct iwl_trans *trans); void __releases(nic_access) iwl_trans_release_nic_access(struct iwl_trans *trans); +static inline void iwl_trans_schedule_reset(struct iwl_trans *trans, + enum iwl_fw_error_type type) +{ + if (test_bit(STATUS_TRANS_DEAD, &trans->status)) + return; + + trans->restart.mode.type = type; + trans->restart.mode.context = IWL_ERR_CONTEXT_WORKER; + + set_bit(STATUS_RESET_PENDING, &trans->status); + + /* + * keep track of whether or not this happened while resetting, + * by the timer the worker runs it might have finished + */ + trans->restart.during_reset = test_bit(STATUS_IN_SW_RESET, + &trans->status); + queue_work(system_unbound_wq, &trans->restart.wk); +} + static inline void iwl_trans_fw_error(struct iwl_trans *trans, enum iwl_fw_error_type type) { @@ -1135,9 +1170,23 @@ static inline void iwl_trans_fw_error(struct iwl_trans *trans, if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status)) { trans->state = IWL_TRANS_NO_FW; iwl_op_mode_nic_error(trans->op_mode, type); + iwl_trans_schedule_reset(trans, type); } } +static inline void iwl_trans_opmode_sw_reset(struct iwl_trans *trans, + enum iwl_fw_error_type type) +{ + if (WARN_ON_ONCE(!trans->op_mode)) + return; + + set_bit(STATUS_IN_SW_RESET, &trans->status); + + if (!trans->op_mode->ops->sw_reset || + !trans->op_mode->ops->sw_reset(trans->op_mode, type)) + clear_bit(STATUS_IN_SW_RESET, &trans->status); +} + static inline bool iwl_trans_fw_running(struct iwl_trans *trans) { return trans->state == IWL_TRANS_FW_ALIVE; @@ -1170,6 +1219,11 @@ static inline bool iwl_trans_dbg_ini_valid(struct iwl_trans *trans) void iwl_trans_interrupts(struct iwl_trans *trans, bool enable); +static inline void iwl_trans_finish_sw_reset(struct iwl_trans *trans) +{ + clear_bit(STATUS_IN_SW_RESET, &trans->status); +} + /***************************************************** * transport helper functions *****************************************************/ diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 039d0d6ed61d..a88ca5b48eca 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -1340,6 +1340,7 @@ static void iwl_mvm_restart_complete(struct iwl_mvm *mvm) iwl_mvm_teardown_tdls_peers(mvm); IWL_INFO(mvm, "restart completed\n"); + iwl_trans_finish_sw_reset(mvm->trans); } void iwl_mvm_mac_reconfig_complete(struct ieee80211_hw *hw, diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index ef54ba818d1f..08c59df593b2 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -2008,27 +2008,62 @@ static void iwl_mvm_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb) ieee80211_free_txskb(mvm->hw, skb); } -struct iwl_mvm_reprobe { - struct device *dev; - struct work_struct work; -}; +static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode, + enum iwl_fw_error_type type) +{ + struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); + + iwl_abort_notification_waits(&mvm->notif_wait); + iwl_dbg_tlv_del_timers(mvm->trans); + + if (type == IWL_ERR_TYPE_CMD_QUEUE_FULL) + IWL_ERR(mvm, "Command queue full!\n"); + else if (!test_bit(STATUS_TRANS_DEAD, &mvm->trans->status) && + !test_and_clear_bit(IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE, + &mvm->status)) + iwl_mvm_dump_nic_error_log(mvm); + + /* + * This should be first thing before trying to collect any + * data to avoid endless loops if any HW error happens while + * collecting debug data. + * It might not actually be true that we'll restart, but the + * setting of the bit doesn't matter if we're going to be + * unbound either. + */ + if (type != IWL_ERR_TYPE_RESET_HS_TIMEOUT) + set_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status); +} -static void iwl_mvm_reprobe_wk(struct work_struct *wk) +static void iwl_mvm_dump_error(struct iwl_op_mode *op_mode, + struct iwl_fw_error_dump_mode *mode) { - struct iwl_mvm_reprobe *reprobe; - - reprobe = container_of(wk, struct iwl_mvm_reprobe, work); - if (device_reprobe(reprobe->dev)) - dev_err(reprobe->dev, "reprobe failed!\n"); - put_device(reprobe->dev); - kfree(reprobe); - module_put(THIS_MODULE); + struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); + + /* if we come in from opmode we have the mutex held */ + if (mode->context == IWL_ERR_CONTEXT_FROM_OPMODE) { + lockdep_assert_held(&mvm->mutex); + iwl_fw_error_collect(&mvm->fwrt, true); + } else { + mutex_lock(&mvm->mutex); + if (mode->context != IWL_ERR_CONTEXT_ABORT) + iwl_fw_error_collect(&mvm->fwrt, true); + mutex_unlock(&mvm->mutex); + } } -static void iwl_mvm_nic_restart(struct iwl_mvm *mvm) +static bool iwl_mvm_sw_reset(struct iwl_op_mode *op_mode, + enum iwl_fw_error_type type) { - iwl_abort_notification_waits(&mvm->notif_wait); - iwl_dbg_tlv_del_timers(mvm->trans); + struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); + + /* + * If the firmware crashes while we're already considering it + * to be dead then don't ask for a restart, that cannot do + * anything useful anyway. + */ + if (!test_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status)) + return false; /* * This is a bit racy, but worst case we tell mac80211 about @@ -2043,47 +2078,11 @@ static void iwl_mvm_nic_restart(struct iwl_mvm *mvm) iwl_mvm_report_scan_aborted(mvm); /* - * If we're restarting already, don't cycle restarts. * If INIT fw asserted, it will likely fail again. * If WoWLAN fw asserted, don't restart either, mac80211 * can't recover this since we're already half suspended. */ - if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { - struct iwl_mvm_reprobe *reprobe; - - IWL_ERR(mvm, - "Firmware error during reconfiguration - reprobe!\n"); - - /* - * get a module reference to avoid doing this while unloading - * anyway and to avoid scheduling a work with code that's - * being removed. - */ - if (!try_module_get(THIS_MODULE)) { - IWL_ERR(mvm, "Module is being unloaded - abort\n"); - return; - } - - reprobe = kzalloc(sizeof(*reprobe), GFP_ATOMIC); - if (!reprobe) { - module_put(THIS_MODULE); - return; - } - reprobe->dev = get_device(mvm->trans->dev); - INIT_WORK(&reprobe->work, iwl_mvm_reprobe_wk); - schedule_work(&reprobe->work); - } else if (test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, - &mvm->status)) { - IWL_ERR(mvm, "HW restart already requested, but not started\n"); - } else if (mvm->fwrt.cur_fw_img == IWL_UCODE_REGULAR && - mvm->hw_registered && - !test_bit(STATUS_TRANS_DEAD, &mvm->trans->status)) { - /* This should be first thing before trying to collect any - * data to avoid endless loops if any HW error happens while - * collecting debug data. - */ - set_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status); - + if (mvm->fwrt.cur_fw_img == IWL_UCODE_REGULAR && mvm->hw_registered) { if (mvm->fw->ucode_capa.error_log_size) { u32 src_size = mvm->fw->ucode_capa.error_log_size; u32 src_addr = mvm->fw->ucode_capa.error_log_addr; @@ -2098,48 +2097,18 @@ static void iwl_mvm_nic_restart(struct iwl_mvm *mvm) } } - iwl_fw_error_collect(&mvm->fwrt, false); - - if (!iwlwifi_mod_params.fw_restart) - return; - if (mvm->fwrt.trans->dbg.restart_required) { IWL_DEBUG_INFO(mvm, "FW restart requested after debug collection\n"); mvm->fwrt.trans->dbg.restart_required = false; ieee80211_restart_hw(mvm->hw); + return true; } else if (mvm->trans->trans_cfg->device_family <= IWL_DEVICE_FAMILY_8000) { ieee80211_restart_hw(mvm->hw); + return true; } } -} - -static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode, - enum iwl_fw_error_type type) -{ - struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); - - if (type == IWL_ERR_TYPE_CMD_QUEUE_FULL) - IWL_ERR(mvm, "Command queue full!\n"); - else if (!test_bit(STATUS_TRANS_DEAD, &mvm->trans->status) && - !test_and_clear_bit(IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE, - &mvm->status)) - iwl_mvm_dump_nic_error_log(mvm); - - /* reset HS timeout is during shutdown, so collect right now */ - if (type == IWL_ERR_TYPE_RESET_HS_TIMEOUT) { - iwl_fw_error_collect(&mvm->fwrt, true); - return; - } - - /* - * If the firmware crashes while we're already considering it - * to be dead then don't ask for a restart, that cannot do - * anything useful anyway. - */ - if (!test_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status)) - return; - iwl_mvm_nic_restart(mvm); + return false; } static void iwl_op_mode_mvm_time_point(struct iwl_op_mode *op_mode, @@ -2175,6 +2144,8 @@ static void iwl_op_mode_mvm_device_powered_off(struct iwl_op_mode *op_mode) .hw_rf_kill = iwl_mvm_set_hw_rfkill_state, \ .free_skb = iwl_mvm_free_skb, \ .nic_error = iwl_mvm_nic_error, \ + .dump_error = iwl_mvm_dump_error, \ + .sw_reset = iwl_mvm_sw_reset, \ .nic_config = iwl_mvm_nic_config, \ /* as we only register one, these MUST be common! */ \ .start = iwl_op_mode_mvm_start, \ diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c index 469ef32a3e26..5f6cd60b50b9 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c @@ -123,8 +123,15 @@ static void iwl_trans_pcie_fw_reset_handshake(struct iwl_trans *trans) "timeout waiting for FW reset ACK (inta_hw=0x%x)\n", inta_hw); - if (!(inta_hw & MSIX_HW_INT_CAUSES_REG_RESET_DONE)) - iwl_trans_fw_error(trans, IWL_ERR_TYPE_RESET_HS_TIMEOUT); + if (!(inta_hw & MSIX_HW_INT_CAUSES_REG_RESET_DONE)) { + struct iwl_fw_error_dump_mode mode = { + .type = IWL_ERR_TYPE_RESET_HS_TIMEOUT, + .context = IWL_ERR_CONTEXT_FROM_OPMODE, + }; + iwl_op_mode_nic_error(trans->op_mode, + IWL_ERR_TYPE_RESET_HS_TIMEOUT); + iwl_op_mode_dump_error(trans->op_mode, &mode); + } } trans_pcie->fw_reset_state = FW_RESET_IDLE; diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c index 4c92588d15cb..1f483f15c238 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c @@ -1300,6 +1300,7 @@ int iwl_pcie_gen2_enqueue_hcmd(struct iwl_trans *trans, IWL_ERR(trans, "No space in command queue\n"); iwl_op_mode_nic_error(trans->op_mode, IWL_ERR_TYPE_CMD_QUEUE_FULL); + iwl_trans_schedule_reset(trans, IWL_ERR_TYPE_CMD_QUEUE_FULL); idx = -ENOSPC; goto free_dup_buf; } diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c index aaa1b87ee265..334ebd4c12fa 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c @@ -1451,6 +1451,7 @@ int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, IWL_ERR(trans, "No space in command queue\n"); iwl_op_mode_nic_error(trans->op_mode, IWL_ERR_TYPE_CMD_QUEUE_FULL); + iwl_trans_schedule_reset(trans, IWL_ERR_TYPE_CMD_QUEUE_FULL); idx = -ENOSPC; goto free_dup_buf; } From patchwork Fri Dec 27 08:01: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: 13921627 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 4DC31155725 for ; Fri, 27 Dec 2024 08:01:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286511; cv=none; b=XLnYecLvEbgZ6YDA0FvrvJQSRvOR11VBarCMQqW+ExBA91g6XIMXxXtripy8XAkDGk3Wm5hgeYUXw6VRx4u5O7VGcS20WN/nWkpxrgAohJbpi1sEvwkVc2ymUmzHj0oApJ9uwJ1XXLk/Xvf8zcJOLMpGeT9Hvgc4BTlkVprnyz4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735286511; c=relaxed/simple; bh=Bm6wGP3hYpm9WChvuBYK0N6CJ4H7XQFeemKHbnOnop4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=n1XyISs/DsV3Du1SLYPwDzWd5msve4hupcf6VwWIZWEYjD46wjkTZkEDJbdkP1L7ILYqsG4cT1KdANji3Wzsp7oLaYxA67fpq2K1CZVOAG3jvNNc/dC/mKcGsNKoHx0OeuZK15in+74EPzTd76Rq/3YY/j7tU21WfEITEaH/m9s= 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=Z4fr0ddX; arc=none smtp.client-ip=198.175.65.13 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="Z4fr0ddX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1735286510; x=1766822510; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Bm6wGP3hYpm9WChvuBYK0N6CJ4H7XQFeemKHbnOnop4=; b=Z4fr0ddXmVwBPKQAM+eGVyxtRPIXUtQ6t4USxWb4CqVC7Tu44AXyIbr6 whgdoSGJy8PQ9yXv8mwHel50qdxsW+qxfcLMPUUIwfc4Rq1GRI0YznNbL AHqar6A2D/x0ruNIj6LyVwcCnsNgA9m0v1gx2yYGHqxIwAd9cFGdBloJu EwGnCX7qlRJfJHJr2DiTTnRZFlCX0CaMy5r01xiBkgz5Len2/mSLs6Oxa KGgnhzSlhughOJgxC/Ty9gWflN1lljzJF5wEwQVn54gfu1iHsPU5bRvwl 9vKRcWgQNhog3Ly5g/fblqlikSSWoVMFTaFfvzT97mWOw1RRbxM8Vmwbm A==; X-CSE-ConnectionGUID: SyxOxvyJQPqrHQygDYcbHA== X-CSE-MsgGUID: uws2EHpNQeelV4r2DcxWgA== X-IronPort-AV: E=McAfee;i="6700,10204,11297"; a="46691010" X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="46691010" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:49 -0800 X-CSE-ConnectionGUID: b5rudYTdRMOEEOAU3qKXsg== X-CSE-MsgGUID: ullKYErsQlCjF5OiQSaBkg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,268,1728975600"; d="scan'208";a="99858500" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2024 00:01:48 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 17/17] wifi: iwlwifi: iwl_fw_error_collect() is always called sync Date: Fri, 27 Dec 2024 10:01:12 +0200 Message-Id: <20241227095718.08f515513e88.I780a557743ca7f029f46a1cc75d0799542e39d83@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241227080112.1098419-1-miriam.rachel.korenblit@intel.com> References: <20241227080112.1098419-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 Since iwl_fw_error_collect() is now always called with the sync argument set to true, to collect data synchronously, remove the argument from it entirely. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/fw/dbg.h | 4 ++-- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.h b/drivers/net/wireless/intel/iwlwifi/fw/dbg.h index f4803b55adb9..87998374f459 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.h @@ -287,7 +287,7 @@ static inline void iwl_fw_umac_set_alive_err_table(struct iwl_trans *trans, trans->dbg.umac_error_event_table = umac_error_event_table; } -static inline void iwl_fw_error_collect(struct iwl_fw_runtime *fwrt, bool sync) +static inline void iwl_fw_error_collect(struct iwl_fw_runtime *fwrt) { enum iwl_fw_ini_time_point tp_id; @@ -303,7 +303,7 @@ static inline void iwl_fw_error_collect(struct iwl_fw_runtime *fwrt, bool sync) tp_id = IWL_FW_INI_TIME_POINT_FW_ASSERT; } - _iwl_dbg_tlv_time_point(fwrt, tp_id, NULL, sync); + iwl_dbg_tlv_time_point_sync(fwrt, tp_id, NULL); } static inline void iwl_fwrt_update_fw_versions(struct iwl_fw_runtime *fwrt, diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index 08c59df593b2..7250c85fb6e6 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -2043,11 +2043,11 @@ static void iwl_mvm_dump_error(struct iwl_op_mode *op_mode, /* if we come in from opmode we have the mutex held */ if (mode->context == IWL_ERR_CONTEXT_FROM_OPMODE) { lockdep_assert_held(&mvm->mutex); - iwl_fw_error_collect(&mvm->fwrt, true); + iwl_fw_error_collect(&mvm->fwrt); } else { mutex_lock(&mvm->mutex); if (mode->context != IWL_ERR_CONTEXT_ABORT) - iwl_fw_error_collect(&mvm->fwrt, true); + iwl_fw_error_collect(&mvm->fwrt); mutex_unlock(&mvm->mutex); } }