bnx2: Misc fixes
Subsystems (2)
cover bnx2: Misc fixes
These patches fix the following problems spotted by Jeff Garzik. Thanks Jeff.
Quoted 9 lines
8) excessive stack size in
bnx2_alloc_bad_rbuf():13) [additional review] why is
CHECKSUM_UNNECESSARYused when cksum==0xffff or cksum==0 ?15) the following loop is just silly. use mdelay or (preferably) msleep.
19) [additional review] need
flush_scheduled_work(), if using work
queues?
Quoted 1 line
21) need to call
bnx2_netif_stop()inbnx2_close()
PATCH 1/6 bnx2: Fix excessive stack usage
Fix excessive stack usage in bnx2_alloc_bad_rbuf() by replacing local variable array with kmalloc array. Also changed function to return error code, and changed some of the callers to check for the return code.
Spotted by Jeff Garzik.
drivers/net/bnx2.c +24 -7
@@ -1138,13 +1138,20 @@ } } -static void +static int bnx2_alloc_bad_rbuf (struct bnx2 *bp) { -u16 good_mbuf[512 ]; +u16 *good_mbuf;u32 good_mbuf_cnt;u32 val; + good_mbuf =kmalloc (512 *sizeof (u16),GFP_KERNEL ); +if (good_mbuf ==NULL ) { + printk(KERN_ERR PFX "Failed to allocate memory in " + "bnx2_alloc_bad_rbuf\n"); +return -ENOMEM ; + } +REG_WR (bp,BNX2_MISC_ENABLE_SET_BITS ,BNX2_MISC_ENABLE_SET_BITS_RX_MBUF_ENABLE );
@@ -1178,6 +1185,7 @@REG_WR_IND (bp,BNX2_RBUF_FW_BUF_FREE , val); } +return 0 ; } static void
@@ -2710,7 +2718,7 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code) {u32 val; -int i; +int i, rc =0 ;/* Wait for the current PCI transaction to complete before * issuing a reset. */
@@ -2785,10 +2793,10 @@REG_WR (bp,BNX2_MISC_VREG_CONTROL ,0x000000fa );/* Remove bad rbuf memory from the free pool. */ -bnx2_alloc_bad_rbuf (bp); + rc =bnx2_alloc_bad_rbuf (bp); } -return 0 ; +return rc; } static int
@@ -3097,8 +3105,13 @@static int bnx2_reset_nic (struct bnx2 *bp,u32 reset_code) { -bnx2_reset_chip (bp, reset_code); +int rc; + + rc =bnx2_reset_chip (bp, reset_code);bnx2_free_skbs (bp); +if (rc) +return rc; +bnx2_init_chip (bp);bnx2_init_tx_ring (bp);bnx2_init_rx_ring (bp);
@@ -3108,7 +3121,11 @@static int bnx2_init_nic (struct bnx2 *bp) { -bnx2_reset_nic (bp,BNX2_DRV_MSG_CODE_RESET ); +int rc; + +if ((rc =bnx2_reset_nic (bp,BNX2_DRV_MSG_CODE_RESET )) !=0 ) +return rc; +bnx2_init_phy (bp);bnx2_set_link (bp);return 0 ;
Re: [PATCH 1/6] bnx2: Fix excessive stack usage
Quoted 27 lines · Michael Chan
diff -Nru
10/drivers/net/bnx2.c11/drivers/net/bnx2.cdrivers/net/bnx2.c +9
-2@@ -1138,13 +1138,20 @@ } } -static void +static int bnx2_alloc_bad_rbuf (struct bnx2 *bp) { -u16 good_mbuf[512 ]; +u16 *good_mbuf;u32 good_mbuf_cnt;u32 val; + good_mbuf =kmalloc (512 *sizeof (u16),GFP_KERNEL ); +if (good_mbuf ==NULL ) { + printk(KERN_ERR PFX "Failed to allocate memory in " + "bnx2_alloc_bad_rbuf\n"); +return -ENOMEM ; + } +REG_WR (bp,BNX2_MISC_ENABLE_SET_BITS ,BNX2_MISC_ENABLE_SET_BITS_RX_MBUF_ENABLE );
drivers/net/bnx2.c line 1191
Quoted 7 lines
drivers/net/bnx2.c +1
-0@@ -1178,6 +1185,7 @@REG_WR_IND (bp,BNX2_RBUF_FW_BUF_FREE , val); } +return 0 ; } static void
memleak -- you need to free good_mbuf.
Jeff
Re: [PATCH 1/6] bnx2: Fix excessive stack usage
Quoted 3 lines · Jeff Garzik
memleak -- you need to free
good_mbuf.
Oops, here is the revised patch with kfree(). Thanks.
Fix excessive stack usage in bnx2_alloc_bad_rbuf() by replacing local variable array with kmalloc array. Also changed function to return error code, and changed some of the callers to check for the return code.
Spotted by Jeff Garzik.
drivers/net/bnx2.c +25 -7
@@ -1138,13 +1138,20 @@ } } -static void +static int bnx2_alloc_bad_rbuf (struct bnx2 *bp) { -u16 good_mbuf[512 ]; +u16 *good_mbuf;u32 good_mbuf_cnt;u32 val; + good_mbuf =kmalloc (512 *sizeof (u16),GFP_KERNEL ); +if (good_mbuf ==NULL ) { + printk(KERN_ERR PFX "Failed to allocate memory in " + "bnx2_alloc_bad_rbuf\n"); +return -ENOMEM ; + } +REG_WR (bp,BNX2_MISC_ENABLE_SET_BITS ,BNX2_MISC_ENABLE_SET_BITS_RX_MBUF_ENABLE );
@@ -1178,6 +1185,8 @@REG_WR_IND (bp,BNX2_RBUF_FW_BUF_FREE , val); } +kfree (good_mbuf); +return 0 ; } static void
@@ -2710,7 +2719,7 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code) {u32 val; -int i; +int i, rc =0 ;/* Wait for the current PCI transaction to complete before * issuing a reset. */
@@ -2785,10 +2794,10 @@REG_WR (bp,BNX2_MISC_VREG_CONTROL ,0x000000fa );/* Remove bad rbuf memory from the free pool. */ -bnx2_alloc_bad_rbuf (bp); + rc =bnx2_alloc_bad_rbuf (bp); } -return 0 ; +return rc; } static int
@@ -3097,8 +3106,13 @@static int bnx2_reset_nic (struct bnx2 *bp,u32 reset_code) { -bnx2_reset_chip (bp, reset_code); +int rc; + + rc =bnx2_reset_chip (bp, reset_code);bnx2_free_skbs (bp); +if (rc) +return rc; +bnx2_init_chip (bp);bnx2_init_tx_ring (bp);bnx2_init_rx_ring (bp);
@@ -3108,7 +3122,11 @@static int bnx2_init_nic (struct bnx2 *bp) { -bnx2_reset_nic (bp,BNX2_DRV_MSG_CODE_RESET ); +int rc; + +if ((rc =bnx2_reset_nic (bp,BNX2_DRV_MSG_CODE_RESET )) !=0 ) +return rc; +bnx2_init_phy (bp);bnx2_set_link (bp);return 0 ;
Re: [PATCH 1/6] bnx2: Fix excessive stack usage
Quoted 8 lines · Michael Chan
Quoted 2 lines · Jeff Garzik
memleak -- you need to free
good_mbuf.Oops, here is the revised patch with
kfree(). Thanks.
Quoted 7 lines
Fix excessive stack usage in
bnx2_alloc_bad_rbuf()by replacing local variable array with kmalloc array. Also changed function to return error code, and changed some of the callers to check for the return code.Spotted by Jeff Garzik.
Signed-off-by Michael Chan <[email protected]>
ACK
David S. Miller
maintainerRe: [PATCH 1/6] bnx2: Fix excessive stack usage
From: Jeff Garzik <[email protected]>
Date: Tue, 24 May 2005 01:43:18 -0400
Quoted 3 lines
Quoted 1 line
Signed-off-by Michael Chan <[email protected]>ACK
I've integrated the new bnx2 driver, with all updated bug fixes. I'll push this upstream shortly.
Thanks everyone.
PATCH 2/6 bnx2: Fix rx checksum
In reply to Michael ChanFix bug in rx checksum by indicating CHECKSUM_UNNECESSARY only when the hw calculated checksum is 0xffff.
Spotted by Jeff Garzik.
drivers/net/bnx2.c +1 -2
@@ -1470,9 +1470,8 @@u16 cksum = rx_hdr->l2_fhdr_tcp_udp_xsum; -if ((cksum ==0xffff ) || (cksum ==0 )) { +if (cksum ==0xffff ) skb->ip_summed =CHECKSUM_UNNECESSARY ; - } }#ifdef BCM_VLAN
PATCH 3/6 bnx2: Fix excessive udelay
In reply to Michael ChanReplaced one excessive udelay of 15msec with msleep since the calling context is always process. Also replaced some schedule_timeout calls with msleep/msleep_interruptible.
Spotted by Jeff Garzik.
drivers/net/bnx2.c +10 -24
@@ -2011,11 +2011,9 @@ (pmcsr & ~PCI_PM_CTRL_STATE_MASK ) | PCI_PM_CTRL_PME_STATUS); -if (pmcsr &PCI_PM_CTRL_STATE_MASK ) { +if (pmcsr &PCI_PM_CTRL_STATE_MASK )/* delay required during transition out of D3hot */ - current->state =TASK_UNINTERRUPTIBLE ; -schedule_timeout (HZ /50 ); - } +msleep (20 ); val =REG_RD (bp,BNX2_EMAC_MODE ); val |=BNX2_EMAC_MODE_MPKT_RCVD |BNX2_EMAC_MODE_ACPI_RCVD ;
@@ -2751,12 +2749,8 @@REG_WR (bp,BNX2_PCICFG_MISC_CONFIG , val);if ((CHIP_ID (bp) ==CHIP_ID_5706_A0 ) || - (CHIP_ID (bp) ==CHIP_ID_5706_A1 )) { - -for (i =0 ; i <500 ; i++) { -udelay (30 ); - } - } + (CHIP_ID (bp) ==CHIP_ID_5706_A1 )) +msleep (15 );/* Reset takes approximate 30 usec */ for (i =0 ; i <10 ; i++) {
@@ -3785,8 +3779,6 @@REG_WR (bp,BNX2_HC_COMMAND , val |BNX2_HC_COMMAND_COAL_NOW );REG_RD (bp,BNX2_HC_COMMAND ); -udelay (80 ); -for (i =0 ; i <10 ; i++) {if ((REG_RD (bp,BNX2_PCICFG_INT_ACK_CMD ) &0xffff ) != status_idx) {
@@ -3794,8 +3786,7 @@break ; } - current->state =TASK_INTERRUPTIBLE ; -schedule_timeout (1 ); +msleep_interruptible (10 ); }if (i <10 )return 0 ;
@@ -4478,8 +4469,7 @@bnx2_write_phy (bp,MII_BMCR ,BMCR_LOOPBACK );spin_unlock_irq (&bp->phy_lock); - current->state =TASK_UNINTERRUPTIBLE ; -schedule_timeout (HZ /50 ); +msleep (20 );spin_lock_irq (&bp->phy_lock);if (CHIP_NUM (bp) ==CHIP_NUM_5706 ) {
@@ -4869,12 +4859,9 @@ }/* wait for link up */ - current->state =TASK_INTERRUPTIBLE ; -schedule_timeout (3 *HZ ); -if ((!bp->link_up) && !(bp->phy_flags &PHY_SERDES_FLAG )) { - current->state =TASK_INTERRUPTIBLE ; -schedule_timeout (4 *HZ ); - } +msleep_interruptible (3000 ); +if ((!bp->link_up) && !(bp->phy_flags &PHY_SERDES_FLAG )) +msleep_interruptible (4000 ); }if (bnx2_test_nvram (bp) !=0 ) {
@@ -4975,8 +4962,7 @@BNX2_EMAC_LED_TRAFFIC_OVERRIDE | BNX2_EMAC_LED_TRAFFIC); } - current->state =TASK_INTERRUPTIBLE ; -schedule_timeout (HZ /2 ); +msleep_interruptible (500 );if (signal_pending (current))break ; }
PATCH 4/6 bnx2: Fix bug in bnx2_close
In reply to Michael ChanFix bug in bnx2_close() by calling flush_scheduled_work() since we are using a work queue in netdev watchdog. Also added bnx2_netif_stop() call in bnx2_close().
Spotted by Jeff Garzik.
drivers/net/bnx2.c +2 -1
@@ -4172,7 +4172,8 @@struct bnx2 *bp = dev->priv;u32 reset_code; -bnx2_disable_int_sync (bp); +flush_scheduled_work (); +bnx2_netif_stop (bp);del_timer_sync (&bp->timer);if (bp->wol) reset_code =BNX2_DRV_MSG_CODE_SUSPEND_WOL ;
PATCH 5/6 bnx2: Add bnx2 prefix and mark static
In reply to Michael ChanAdd bnx2_ prefix to some remaining names and mark some remaining names static.
Spotted by David Miller and Jeff Garzik.
drivers/net/bnx2.c +91 -91
@@ -264,7 +264,7 @@synchronize_irq (bp->pdev->irq); } -void +static void bnx2_netif_stop (struct bnx2 *bp) {bnx2_disable_int_sync (bp);
@@ -275,7 +275,7 @@ } } -void +static void bnx2_netif_start (struct bnx2 *bp) {if (atomic_dec_and_test (&bp->intr_sem)) {
@@ -1807,8 +1807,8 @@struct fw_info fw;/* Initialize the RV2P processor. */ -load_rv2p_fw (bp, rv2p_proc1,sizeof (rv2p_proc1),RV2P_PROC1 ); -load_rv2p_fw (bp, rv2p_proc2,sizeof (rv2p_proc2),RV2P_PROC2 ); +load_rv2p_fw (bp, bnx2_rv2p_proc1,sizeof (bnx2_rv2p_proc1),RV2P_PROC1 ); +load_rv2p_fw (bp, bnx2_rv2p_proc2,sizeof (bnx2_rv2p_proc2),RV2P_PROC2 );/* Initialize the RX Processor. */ cpu_reg.mode =BNX2_RXP_CPU_MODE ;
@@ -1824,35 +1824,35 @@ cpu_reg.spad_base =BNX2_RXP_SCRATCH ; cpu_reg.mips_view_base =0x8000000 ; - fw.ver_major = RXP_b06FwReleaseMajor; - fw.ver_minor = RXP_b06FwReleaseMinor; - fw.ver_fix = RXP_b06FwReleaseFix; - fw.start_addr = RXP_b06FwStartAddr; + fw.ver_major = bnx2_RXP_b06FwReleaseMajor; + fw.ver_minor = bnx2_RXP_b06FwReleaseMinor; + fw.ver_fix = bnx2_RXP_b06FwReleaseFix; + fw.start_addr = bnx2_RXP_b06FwStartAddr; - fw.text_addr = RXP_b06FwTextAddr; - fw.text_len = RXP_b06FwTextLen; + fw.text_addr = bnx2_RXP_b06FwTextAddr; + fw.text_len = bnx2_RXP_b06FwTextLen; fw.text_index =0 ; - fw.text = RXP_b06FwText; + fw.text = bnx2_RXP_b06FwText; - fw.data_addr = RXP_b06FwDataAddr; - fw.data_len = RXP_b06FwDataLen; + fw.data_addr = bnx2_RXP_b06FwDataAddr; + fw.data_len = bnx2_RXP_b06FwDataLen; fw.data_index =0 ; - fw.data = RXP_b06FwData; + fw.data = bnx2_RXP_b06FwData; - fw.sbss_addr = RXP_b06FwSbssAddr; - fw.sbss_len = RXP_b06FwSbssLen; + fw.sbss_addr = bnx2_RXP_b06FwSbssAddr; + fw.sbss_len = bnx2_RXP_b06FwSbssLen; fw.sbss_index =0 ; - fw.sbss = RXP_b06FwSbss; + fw.sbss = bnx2_RXP_b06FwSbss; - fw.bss_addr = RXP_b06FwBssAddr; - fw.bss_len = RXP_b06FwBssLen; + fw.bss_addr = bnx2_RXP_b06FwBssAddr; + fw.bss_len = bnx2_RXP_b06FwBssLen; fw.bss_index =0 ; - fw.bss = RXP_b06FwBss; + fw.bss = bnx2_RXP_b06FwBss; - fw.rodata_addr = RXP_b06FwRodataAddr; - fw.rodata_len = RXP_b06FwRodataLen; + fw.rodata_addr = bnx2_RXP_b06FwRodataAddr; + fw.rodata_len = bnx2_RXP_b06FwRodataLen; fw.rodata_index =0 ; - fw.rodata = RXP_b06FwRodata; + fw.rodata = bnx2_RXP_b06FwRodata;load_cpu_fw (bp, &cpu_reg, &fw);
@@ -1870,35 +1870,35 @@ cpu_reg.spad_base =BNX2_TXP_SCRATCH ; cpu_reg.mips_view_base =0x8000000 ; - fw.ver_major = TXP_b06FwReleaseMajor; - fw.ver_minor = TXP_b06FwReleaseMinor; - fw.ver_fix = TXP_b06FwReleaseFix; - fw.start_addr = TXP_b06FwStartAddr; + fw.ver_major = bnx2_TXP_b06FwReleaseMajor; + fw.ver_minor = bnx2_TXP_b06FwReleaseMinor; + fw.ver_fix = bnx2_TXP_b06FwReleaseFix; + fw.start_addr = bnx2_TXP_b06FwStartAddr; - fw.text_addr = TXP_b06FwTextAddr; - fw.text_len = TXP_b06FwTextLen; + fw.text_addr = bnx2_TXP_b06FwTextAddr; + fw.text_len = bnx2_TXP_b06FwTextLen; fw.text_index =0 ; - fw.text = TXP_b06FwText; + fw.text = bnx2_TXP_b06FwText; - fw.data_addr = TXP_b06FwDataAddr; - fw.data_len = TXP_b06FwDataLen; + fw.data_addr = bnx2_TXP_b06FwDataAddr; + fw.data_len = bnx2_TXP_b06FwDataLen; fw.data_index =0 ; - fw.data = TXP_b06FwData; + fw.data = bnx2_TXP_b06FwData; - fw.sbss_addr = TXP_b06FwSbssAddr; - fw.sbss_len = TXP_b06FwSbssLen; + fw.sbss_addr = bnx2_TXP_b06FwSbssAddr; + fw.sbss_len = bnx2_TXP_b06FwSbssLen; fw.sbss_index =0 ; - fw.sbss = TXP_b06FwSbss; + fw.sbss = bnx2_TXP_b06FwSbss; - fw.bss_addr = TXP_b06FwBssAddr; - fw.bss_len = TXP_b06FwBssLen; + fw.bss_addr = bnx2_TXP_b06FwBssAddr; + fw.bss_len = bnx2_TXP_b06FwBssLen; fw.bss_index =0 ; - fw.bss = TXP_b06FwBss; + fw.bss = bnx2_TXP_b06FwBss; - fw.rodata_addr = TXP_b06FwRodataAddr; - fw.rodata_len = TXP_b06FwRodataLen; + fw.rodata_addr = bnx2_TXP_b06FwRodataAddr; + fw.rodata_len = bnx2_TXP_b06FwRodataLen; fw.rodata_index =0 ; - fw.rodata = TXP_b06FwRodata; + fw.rodata = bnx2_TXP_b06FwRodata;load_cpu_fw (bp, &cpu_reg, &fw);
@@ -1916,35 +1916,35 @@ cpu_reg.spad_base =BNX2_TPAT_SCRATCH ; cpu_reg.mips_view_base =0x8000000 ; - fw.ver_major = TPAT_b06FwReleaseMajor; - fw.ver_minor = TPAT_b06FwReleaseMinor; - fw.ver_fix = TPAT_b06FwReleaseFix; - fw.start_addr = TPAT_b06FwStartAddr; + fw.ver_major = bnx2_TPAT_b06FwReleaseMajor; + fw.ver_minor = bnx2_TPAT_b06FwReleaseMinor; + fw.ver_fix = bnx2_TPAT_b06FwReleaseFix; + fw.start_addr = bnx2_TPAT_b06FwStartAddr; - fw.text_addr = TPAT_b06FwTextAddr; - fw.text_len = TPAT_b06FwTextLen; + fw.text_addr = bnx2_TPAT_b06FwTextAddr; + fw.text_len = bnx2_TPAT_b06FwTextLen; fw.text_index =0 ; - fw.text = TPAT_b06FwText; + fw.text = bnx2_TPAT_b06FwText; - fw.data_addr = TPAT_b06FwDataAddr; - fw.data_len = TPAT_b06FwDataLen; + fw.data_addr = bnx2_TPAT_b06FwDataAddr; + fw.data_len = bnx2_TPAT_b06FwDataLen; fw.data_index =0 ; - fw.data = TPAT_b06FwData; + fw.data = bnx2_TPAT_b06FwData; - fw.sbss_addr = TPAT_b06FwSbssAddr; - fw.sbss_len = TPAT_b06FwSbssLen; + fw.sbss_addr = bnx2_TPAT_b06FwSbssAddr; + fw.sbss_len = bnx2_TPAT_b06FwSbssLen; fw.sbss_index =0 ; - fw.sbss = TPAT_b06FwSbss; + fw.sbss = bnx2_TPAT_b06FwSbss; - fw.bss_addr = TPAT_b06FwBssAddr; - fw.bss_len = TPAT_b06FwBssLen; + fw.bss_addr = bnx2_TPAT_b06FwBssAddr; + fw.bss_len = bnx2_TPAT_b06FwBssLen; fw.bss_index =0 ; - fw.bss = TPAT_b06FwBss; + fw.bss = bnx2_TPAT_b06FwBss; - fw.rodata_addr = TPAT_b06FwRodataAddr; - fw.rodata_len = TPAT_b06FwRodataLen; + fw.rodata_addr = bnx2_TPAT_b06FwRodataAddr; + fw.rodata_len = bnx2_TPAT_b06FwRodataLen; fw.rodata_index =0 ; - fw.rodata = TPAT_b06FwRodata; + fw.rodata = bnx2_TPAT_b06FwRodata;load_cpu_fw (bp, &cpu_reg, &fw);
@@ -1962,35 +1962,35 @@ cpu_reg.spad_base =BNX2_COM_SCRATCH ; cpu_reg.mips_view_base =0x8000000 ; - fw.ver_major = COM_b06FwReleaseMajor; - fw.ver_minor = COM_b06FwReleaseMinor; - fw.ver_fix = COM_b06FwReleaseFix; - fw.start_addr = COM_b06FwStartAddr; + fw.ver_major = bnx2_COM_b06FwReleaseMajor; + fw.ver_minor = bnx2_COM_b06FwReleaseMinor; + fw.ver_fix = bnx2_COM_b06FwReleaseFix; + fw.start_addr = bnx2_COM_b06FwStartAddr; - fw.text_addr = COM_b06FwTextAddr; - fw.text_len = COM_b06FwTextLen; + fw.text_addr = bnx2_COM_b06FwTextAddr; + fw.text_len = bnx2_COM_b06FwTextLen; fw.text_index =0 ; - fw.text = COM_b06FwText; + fw.text = bnx2_COM_b06FwText; - fw.data_addr = COM_b06FwDataAddr; - fw.data_len = COM_b06FwDataLen; + fw.data_addr = bnx2_COM_b06FwDataAddr; + fw.data_len = bnx2_COM_b06FwDataLen; fw.data_index =0 ; - fw.data = COM_b06FwData; + fw.data = bnx2_COM_b06FwData; - fw.sbss_addr = COM_b06FwSbssAddr; - fw.sbss_len = COM_b06FwSbssLen; + fw.sbss_addr = bnx2_COM_b06FwSbssAddr; + fw.sbss_len = bnx2_COM_b06FwSbssLen; fw.sbss_index =0 ; - fw.sbss = COM_b06FwSbss; + fw.sbss = bnx2_COM_b06FwSbss; - fw.bss_addr = COM_b06FwBssAddr; - fw.bss_len = COM_b06FwBssLen; + fw.bss_addr = bnx2_COM_b06FwBssAddr; + fw.bss_len = bnx2_COM_b06FwBssLen; fw.bss_index =0 ; - fw.bss = COM_b06FwBss; + fw.bss = bnx2_COM_b06FwBss; - fw.rodata_addr = COM_b06FwRodataAddr; - fw.rodata_len = COM_b06FwRodataLen; + fw.rodata_addr = bnx2_COM_b06FwRodataAddr; + fw.rodata_len = bnx2_COM_b06FwRodataLen; fw.rodata_index =0 ; - fw.rodata = COM_b06FwRodata; + fw.rodata = bnx2_COM_b06FwRodata;load_cpu_fw (bp, &cpu_reg, &fw);
@@ -4695,11 +4695,11 @@return 0 ; } -#define ETH_NUM_STATS 45 +#define BNX2_NUM_STATS 45struct {char string[ETH_GSTRING_LEN ]; -} bnx2_stats_str_arr[ETH_NUM_STATS ] = { +} bnx2_stats_str_arr[BNX2_NUM_STATS ] = { {"rx_bytes" }, {"rx_error_bytes" }, {"tx_bytes" },
@@ -4749,7 +4749,7 @@#define STATS_OFFSET32 (offset_name) (offsetof(struct statistics_block, offset_name) / 4) -unsigned long bnx2_stats_offset_arr[ETH_NUM_STATS ] = { +unsigned long bnx2_stats_offset_arr[BNX2_NUM_STATS ] = {STATS_OFFSET32 (stat_IfHCInOctets_hi),STATS_OFFSET32 (stat_IfHCInBadOctets_hi),STATS_OFFSET32 (stat_IfHCOutOctets_hi),
@@ -4800,7 +4800,7 @@/* stat_IfHCInBadOctets and stat_Dot3StatsCarrierSenseErrors are * skipped because of errata. */ -u8 bnx2_5706_stats_len_arr[ETH_NUM_STATS ] = { +u8 bnx2_5706_stats_len_arr[BNX2_NUM_STATS ] = {8 ,0 ,8 ,8 ,8 ,8 ,8 ,8 ,8 ,8 ,4 ,0 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,
@@ -4808,11 +4808,11 @@ 4,4,4,4,4, }; -#define ETH_NUM_TESTS 6 +#define BNX2_NUM_TESTS 6struct {char string[ETH_GSTRING_LEN ]; -} bnx2_tests_str_arr[ETH_NUM_TESTS ] = { +} bnx2_tests_str_arr[BNX2_NUM_TESTS ] = { {"register_test (offline)" }, {"memory_test (offline)" }, {"loopback_test (offline)" },
@@ -4824,7 +4824,7 @@static int bnx2_self_test_count (struct net_device *dev) { -return ETH_NUM_TESTS ; +return BNX2_NUM_TESTS ; } static void
@@ -4832,7 +4832,7 @@ {struct bnx2 *bp = dev->priv; -memset (buf,0 ,sizeof (u64) *ETH_NUM_TESTS ); +memset (buf,0 ,sizeof (u64) *BNX2_NUM_TESTS );if (etest->flags Ð_TEST_FL_OFFLINE ) {bnx2_netif_stop (bp);bnx2_reset_chip (bp,BNX2_DRV_MSG_CODE_DIAG );
@@ -4899,7 +4899,7 @@static int bnx2_get_stats_count (struct net_device *dev) { -return ETH_NUM_STATS ; +return BNX2_NUM_STATS ; } static void
@@ -4912,14 +4912,14 @@u8 *stats_len_arr =0 ;if (hw_stats ==NULL ) { -memset (buf,0 ,sizeof (u64) *ETH_NUM_STATS ); +memset (buf,0 ,sizeof (u64) *BNX2_NUM_STATS );return ; }if (CHIP_NUM (bp) ==CHIP_NUM_5706 ) stats_len_arr = bnx2_5706_stats_len_arr; -for (i =0 ; i <ETH_NUM_STATS ; i++) { +for (i =0 ; i <BNX2_NUM_STATS ; i++) {if (stats_len_arr[i] ==0 ) {/* skip this counter */ buf[i] =0 ;
drivers/net/bnx2_fw.h +78 -78
204 lines not on this page · raw message
PATCH 6/6 bnx2: Update revision and reldate
In reply to Michael Chandrivers/net/bnx2.c +2 -2
@@ -14,8 +14,8 @@#define DRV_MODULE_NAME "bnx2"#define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "1.2.18" -#define DRV_MODULE_RELDATE "May 19, 2005" +#define DRV_MODULE_VERSION "1.2.19" +#define DRV_MODULE_RELDATE "May 23, 2005"#define RUN_AT (x) (jiffies + (x))
Quoted 2 lines · Michael Chan
These patches fix the following problems spotted by Jeff Garzik. Thanks Jeff.
Thanks for fixing them up.
I ACK patches #2 - #6. Sent a comment related to #1 in a separate email.
Jeff