Commit 14eef4e2 authored by Johannes Berg's avatar Johannes Berg
Browse files

wifi: iwlwifi: unify cmd_queue_full() into nic_error()



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: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241227095718.0222183504aa.Ie29cef75fbd91b64a43619bc36bd5b29c5b9f957@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 99baaf92
Loading
Loading
Loading
Loading
+9 −13
Original line number Diff line number Diff line
@@ -1957,24 +1957,21 @@ 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);

	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

@@ -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,
};
+2 −8
Original line number Diff line number Diff line
@@ -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();
+5 −12
Original line number Diff line number Diff line
@@ -2118,7 +2118,9 @@ 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) &&
	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);
@@ -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,				\
+2 −1
Original line number Diff line number Diff line
@@ -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;
	}
+2 −1
Original line number Diff line number Diff line
@@ -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;
	}