Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] tg3: fix ASF heartbeat

Change the ASF heart beat to 5 seconds for faster detection of system
crash. The driver sends the heartbeat every 2 seconds and the ASF
firmware will timeout and reset the device if no heartbeat is received
after 5 seconds. The old scheme of 2 minutes is ineffective.

tg3_write_mem_fast() is added to speed up the IO to send the heartbeat.
When no workaround is needed, it will use direct MMIO to memory space
to write to memory.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>

authored by

Michael Chan and committed by
Jeff Garzik
28fbef78 a4e2b347

+17 -5
+16 -5
drivers/net/tg3.c
··· 470 470 spin_unlock_irqrestore(&tp->indirect_lock, flags); 471 471 } 472 472 473 + static void tg3_write_mem_fast(struct tg3 *tp, u32 off, u32 val) 474 + { 475 + /* If no workaround is needed, write to mem space directly */ 476 + if (tp->write32 != tg3_write_indirect_reg32) 477 + tw32(NIC_SRAM_WIN_BASE + off, val); 478 + else 479 + tg3_write_mem(tp, off, val); 480 + } 481 + 473 482 static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val) 474 483 { 475 484 unsigned long flags; ··· 6204 6195 tp->timer_counter = tp->timer_multiplier; 6205 6196 } 6206 6197 6207 - /* Heartbeat is only sent once every 120 seconds. */ 6198 + /* Heartbeat is only sent once every 2 seconds. */ 6208 6199 if (!--tp->asf_counter) { 6209 6200 if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) { 6210 6201 u32 val; 6211 6202 6212 - tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, FWCMD_NICDRV_ALIVE); 6213 - tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4); 6214 - tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 3); 6203 + tg3_write_mem_fast(tp, NIC_SRAM_FW_CMD_MBOX, 6204 + FWCMD_NICDRV_ALIVE2); 6205 + tg3_write_mem_fast(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4); 6206 + /* 5 seconds timeout */ 6207 + tg3_write_mem_fast(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5); 6215 6208 val = tr32(GRC_RX_CPU_EVENT); 6216 6209 val |= (1 << 14); 6217 6210 tw32(GRC_RX_CPU_EVENT, val); ··· 6424 6413 tp->timer_counter = tp->timer_multiplier = 6425 6414 (HZ / tp->timer_offset); 6426 6415 tp->asf_counter = tp->asf_multiplier = 6427 - ((HZ / tp->timer_offset) * 120); 6416 + ((HZ / tp->timer_offset) * 2); 6428 6417 6429 6418 init_timer(&tp->timer); 6430 6419 tp->timer.expires = jiffies + tp->timer_offset;
+1
drivers/net/tg3.h
··· 1512 1512 #define FWCMD_NICDRV_IPV6ADDR_CHG 0x00000004 1513 1513 #define FWCMD_NICDRV_FIX_DMAR 0x00000005 1514 1514 #define FWCMD_NICDRV_FIX_DMAW 0x00000006 1515 + #define FWCMD_NICDRV_ALIVE2 0x0000000d 1515 1516 #define NIC_SRAM_FW_CMD_LEN_MBOX 0x00000b7c 1516 1517 #define NIC_SRAM_FW_CMD_DATA_MBOX 0x00000b80 1517 1518 #define NIC_SRAM_FW_ASF_STATUS_MBOX 0x00000c00