--- drivers/net/niu.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 51 insertions(+), 1 deletions(-) diff --git a/drivers/net/niu.c b/drivers/net/niu.c index 2b17453..cd47fad 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c @@ -24,8 +24,11 @@ #include #include +#include +#include + #ifdef CONFIG_SPARC64 #include #endif @@ -4214,8 +4217,54 @@ static void __niu_fastpath_interrupt(struct niu *np, int ldg, u64 v0) niu_txchan_intr(np, rp, ldn); } } +// HHP +static void niu_dump_ldg_irq(struct niu *np, int ldg, u64 v0) +{ + static DEFINE_PER_CPU(unsigned long, spurious_count) = { 4 }; + + struct niu_parent *parent = np->parent; + char buf[KSYM_SYMBOL_LEN]; + u64 ld_im0_val, ldg_imgmt_val; + u32 rx_vec, tx_vec; + int ldn, i; + + if (!__get_cpu_var(spurious_count)) + return; + + __get_cpu_var(spurious_count)--; + + tx_vec = (v0 >> 32); + rx_vec = (v0 & 0xffffffff); + sprint_symbol(buf, get_irq_regs()->tpc); + + printk(KERN_DEBUG "NIU: %s CPU=%i LDG=%i rx_vec=0x%04x: spurious interrupt\n", + np->dev->name, smp_processor_id(), ldg, rx_vec); + printk(KERN_DEBUG " tpc = <%s>\n", buf); + + for (i = 0; i < np->num_rx_rings; i++) { + struct rx_ring_info *rp = &np->rx_rings[i]; + + ldn = LDN_RXDMA(rp->rx_channel); + if (parent->ldg_map[ldn] != ldg) + continue; + + ld_im0_val = nr64(LD_IM0(ldn)); + ldg_imgmt_val = nr64(LDG_IMGMT(ldn)); + printk(KERN_DEBUG " LD_IM0 = 0x%016lx [ldf_mask=0x%02lx]\n", + (unsigned long)ld_im0_val, + (unsigned long)(ld_im0_val & LD_IM0_MASK)), + printk(KERN_DEBUG " LDG_IMGMT= 0x%016lx [arm=0x%02lx timer=0x%02lx]\n", + (unsigned long)ldg_imgmt_val, + (unsigned long)((ldg_imgmt_val & LDG_IMGMT_ARM) >> 31), + (unsigned long)(ldg_imgmt_val & LDG_IMGMT_TIMER)); + } + + if (tx_vec) + printk(KERN_DEBUG "NIU: spurious TX interrupt. WTF?\n"); +} + static void niu_schedule_napi(struct niu *np, struct niu_ldg *lp, u64 v0, u64 v1, u64 v2) { if (likely(napi_schedule_prep(&lp->napi))) { @@ -4223,9 +4272,10 @@ static void niu_schedule_napi(struct niu *np, struct niu_ldg *lp, lp->v1 = v1; lp->v2 = v2; __niu_fastpath_interrupt(np, lp->ldg_num, v0); __napi_schedule(&lp->napi); - } + } else + niu_dump_ldg_irq(np, lp->ldg_num, v0); } static irqreturn_t niu_interrupt(int irq, void *dev_id) {