Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b80667ee authored by Johannes Berg's avatar Johannes Berg Committed by Wey-Yi Guy
Browse files

iwlagn: add IRQ tracing



The legacy IRQs could be read from a trace by their
IO accesses, but reading the ICT doesn't leave any
trace (pun intended ;-) ) so in order to see what
input they get we need to add specific tracepoints.

While at it, fix whitespace in two related places.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent 27bf8882
Loading
Loading
Loading
Loading
+29 −0
Original line number Original line Diff line number Diff line
@@ -90,6 +90,35 @@ TRACE_EVENT(iwlwifi_dev_iowrite32,
	TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val)
	TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val)
);
);


TRACE_EVENT(iwlwifi_dev_irq,
	TP_PROTO(void *priv),
	TP_ARGS(priv),
	TP_STRUCT__entry(
		PRIV_ENTRY
	),
	TP_fast_assign(
		PRIV_ASSIGN;
	),
	/* TP_printk("") doesn't compile */
	TP_printk("%d", 0)
);

TRACE_EVENT(iwlwifi_dev_ict_read,
	TP_PROTO(void *priv, u32 index, u32 value),
	TP_ARGS(priv, index, value),
	TP_STRUCT__entry(
		PRIV_ENTRY
		__field(u32, index)
		__field(u32, value)
	),
	TP_fast_assign(
		PRIV_ASSIGN;
		__entry->index = index;
		__entry->value = value;
	),
	TP_printk("read ict[%d] = %#.8x", __entry->index, __entry->value)
);

#undef TRACE_SYSTEM
#undef TRACE_SYSTEM
#define TRACE_SYSTEM iwlwifi_ucode
#define TRACE_SYSTEM iwlwifi_ucode


+21 −11
Original line number Original line Diff line number Diff line
@@ -1281,6 +1281,8 @@ static irqreturn_t iwl_isr(int irq, void *data)
	if (!trans)
	if (!trans)
		return IRQ_NONE;
		return IRQ_NONE;


	trace_iwlwifi_dev_irq(priv(trans));

	trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
	trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);


	spin_lock_irqsave(&trans->shrd->lock, flags);
	spin_lock_irqsave(&trans->shrd->lock, flags);
@@ -1355,6 +1357,7 @@ irqreturn_t iwl_isr_ict(int irq, void *data)
	struct iwl_trans_pcie *trans_pcie;
	struct iwl_trans_pcie *trans_pcie;
	u32 inta, inta_mask;
	u32 inta, inta_mask;
	u32 val = 0;
	u32 val = 0;
	u32 read;
	unsigned long flags;
	unsigned long flags;


	if (!trans)
	if (!trans)
@@ -1368,6 +1371,8 @@ irqreturn_t iwl_isr_ict(int irq, void *data)
	if (!trans_pcie->use_ict)
	if (!trans_pcie->use_ict)
		return iwl_isr(irq, data);
		return iwl_isr(irq, data);


	trace_iwlwifi_dev_irq(priv(trans));

	spin_lock_irqsave(&trans->shrd->lock, flags);
	spin_lock_irqsave(&trans->shrd->lock, flags);


	/* Disable (but don't clear!) interrupts here to avoid
	/* Disable (but don't clear!) interrupts here to avoid
@@ -1382,24 +1387,29 @@ irqreturn_t iwl_isr_ict(int irq, void *data)
	/* Ignore interrupt if there's nothing in NIC to service.
	/* Ignore interrupt if there's nothing in NIC to service.
	 * This may be due to IRQ shared with another device,
	 * This may be due to IRQ shared with another device,
	 * or due to sporadic interrupts thrown from our NIC. */
	 * or due to sporadic interrupts thrown from our NIC. */
	if (!trans_pcie->ict_tbl[trans_pcie->ict_index]) {
	read = le32_to_cpu(trans_pcie->ict_tbl[trans_pcie->ict_index]);
	trace_iwlwifi_dev_ict_read(priv(trans), trans_pcie->ict_index, read);
	if (!read) {
		IWL_DEBUG_ISR(trans, "Ignore interrupt, inta == 0\n");
		IWL_DEBUG_ISR(trans, "Ignore interrupt, inta == 0\n");
		goto none;
		goto none;
	}
	}


	/* read all entries that not 0 start with ict_index */
	/*
	while (trans_pcie->ict_tbl[trans_pcie->ict_index]) {
	 * Collect all entries up to the first 0, starting from ict_index;

	 * note we already read at ict_index.
		val |= le32_to_cpu(trans_pcie->ict_tbl[trans_pcie->ict_index]);
	 */
	do {
		val |= read;
		IWL_DEBUG_ISR(trans, "ICT index %d value 0x%08X\n",
		IWL_DEBUG_ISR(trans, "ICT index %d value 0x%08X\n",
				trans_pcie->ict_index,
				trans_pcie->ict_index, read);
				le32_to_cpu(
				  trans_pcie->ict_tbl[trans_pcie->ict_index]));
		trans_pcie->ict_tbl[trans_pcie->ict_index] = 0;
		trans_pcie->ict_tbl[trans_pcie->ict_index] = 0;
		trans_pcie->ict_index =
		trans_pcie->ict_index =
			iwl_queue_inc_wrap(trans_pcie->ict_index, ICT_COUNT);
			iwl_queue_inc_wrap(trans_pcie->ict_index, ICT_COUNT);


	}
		read = le32_to_cpu(trans_pcie->ict_tbl[trans_pcie->ict_index]);
		trace_iwlwifi_dev_ict_read(priv(trans), trans_pcie->ict_index,
					   read);
	} while (read);


	/* We should not get this value, just ignore it. */
	/* We should not get this value, just ignore it. */
	if (val == 0xffffffff)
	if (val == 0xffffffff)