netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] bnx2: Misc fixes
@ 2005-05-23 23:53 Michael Chan
  2005-05-24  0:25 ` [PATCH 1/6] bnx2: Fix excessive stack usage Michael Chan
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Michael Chan @ 2005-05-23 23:53 UTC (permalink / raw)
  To: davem; +Cc: jgarzik, netdev

These patches fix the following problems spotted by Jeff Garzik. Thanks
Jeff.

> 8) excessive stack size in bnx2_alloc_bad_rbuf():

> 13) [additional review] why is CHECKSUM_UNNECESSARY used 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?

> 21) need to call bnx2_netif_stop() in bnx2_close()

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/6] bnx2: Fix excessive stack usage
  2005-05-23 23:53 [PATCH 0/6] bnx2: Misc fixes Michael Chan
@ 2005-05-24  0:25 ` Michael Chan
  2005-05-24  1:42   ` Jeff Garzik
  2005-05-24  0:26 ` [PATCH 2/6] bnx2: Fix rx checksum Michael Chan
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Michael Chan @ 2005-05-24  0:25 UTC (permalink / raw)
  To: davem; +Cc: jgarzik, netdev

[-- Attachment #1: Type: text/plain, Size: 286 bytes --]

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 <mchan@broadcom.com>

[-- Attachment #2: bnx2-11.patch --]
[-- Type: text/x-patch, Size: 1818 bytes --]

diff -Nru 10/drivers/net/bnx2.c 11/drivers/net/bnx2.c
--- 10/drivers/net/bnx2.c	2005-05-23 10:20:02.000000000 -0700
+++ 11/drivers/net/bnx2.c	2005-05-23 10:20:20.000000000 -0700
@@ -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;

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/6] bnx2: Fix rx checksum
  2005-05-23 23:53 [PATCH 0/6] bnx2: Misc fixes Michael Chan
  2005-05-24  0:25 ` [PATCH 1/6] bnx2: Fix excessive stack usage Michael Chan
@ 2005-05-24  0:26 ` Michael Chan
  2005-05-24  0:27 ` [PATCH 3/6] bnx2: Fix excessive udelay Michael Chan
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Michael Chan @ 2005-05-24  0:26 UTC (permalink / raw)
  To: davem; +Cc: jgarzik, netdev

[-- Attachment #1: Type: text/plain, Size: 182 bytes --]

Fix bug in rx checksum by indicating CHECKSUM_UNNECESSARY only when the
hw calculated checksum is 0xffff.

Spotted by Jeff Garzik.

Signed-off-by: Michael Chan <mchan@broadcom.com>


[-- Attachment #2: bnx2-12.patch --]
[-- Type: text/x-patch, Size: 408 bytes --]

diff -Nru 11/drivers/net/bnx2.c 12/drivers/net/bnx2.c
--- 11/drivers/net/bnx2.c	2005-05-23 10:20:20.000000000 -0700
+++ 12/drivers/net/bnx2.c	2005-05-23 10:29:02.000000000 -0700
@@ -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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 3/6] bnx2: Fix excessive udelay
  2005-05-23 23:53 [PATCH 0/6] bnx2: Misc fixes Michael Chan
  2005-05-24  0:25 ` [PATCH 1/6] bnx2: Fix excessive stack usage Michael Chan
  2005-05-24  0:26 ` [PATCH 2/6] bnx2: Fix rx checksum Michael Chan
@ 2005-05-24  0:27 ` Michael Chan
  2005-05-24  0:29 ` [PATCH 4/6] bnx2: Fix bug in bnx2_close Michael Chan
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Michael Chan @ 2005-05-24  0:27 UTC (permalink / raw)
  To: davem; +Cc: jgarzik, netdev

[-- Attachment #1: Type: text/plain, Size: 248 bytes --]

Replaced 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.

Signed-off-by: Michael Chan <mchan@broadcom.com>

[-- Attachment #2: bnx2-13.patch --]
[-- Type: text/x-patch, Size: 2375 bytes --]

diff -Nru 12/drivers/net/bnx2.c 13/drivers/net/bnx2.c
--- 12/drivers/net/bnx2.c	2005-05-23 10:29:02.000000000 -0700
+++ 13/drivers/net/bnx2.c	2005-05-23 10:57:41.000000000 -0700
@@ -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;
 	}

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 4/6] bnx2: Fix bug in bnx2_close
  2005-05-23 23:53 [PATCH 0/6] bnx2: Misc fixes Michael Chan
                   ` (2 preceding siblings ...)
  2005-05-24  0:27 ` [PATCH 3/6] bnx2: Fix excessive udelay Michael Chan
@ 2005-05-24  0:29 ` Michael Chan
  2005-05-24  0:29 ` [PATCH 5/6] bnx2: Add bnx2 prefix and mark static Michael Chan
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Michael Chan @ 2005-05-24  0:29 UTC (permalink / raw)
  To: davem; +Cc: jgarzik, netdev

[-- Attachment #1: Type: text/plain, Size: 237 bytes --]

Fix 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.

Signed-off-by: Michael Chan <mchan@broadcom.com>


[-- Attachment #2: bnx2-14.patch --]
[-- Type: text/x-patch, Size: 434 bytes --]

diff -Nru 13/drivers/net/bnx2.c 14/drivers/net/bnx2.c
--- 13/drivers/net/bnx2.c	2005-05-23 10:57:41.000000000 -0700
+++ 14/drivers/net/bnx2.c	2005-05-23 13:01:45.000000000 -0700
@@ -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;

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 5/6] bnx2: Add bnx2 prefix and mark static
  2005-05-23 23:53 [PATCH 0/6] bnx2: Misc fixes Michael Chan
                   ` (3 preceding siblings ...)
  2005-05-24  0:29 ` [PATCH 4/6] bnx2: Fix bug in bnx2_close Michael Chan
@ 2005-05-24  0:29 ` Michael Chan
  2005-05-24  0:30 ` [PATCH 6/6] bnx2: Update revision and reldate Michael Chan
  2005-05-24  1:48 ` [PATCH 0/6] bnx2: Misc fixes Jeff Garzik
  6 siblings, 0 replies; 12+ messages in thread
From: Michael Chan @ 2005-05-24  0:29 UTC (permalink / raw)
  To: davem; +Cc: jgarzik, netdev

[-- Attachment #1: Type: text/plain, Size: 171 bytes --]

Add bnx2_ prefix to some remaining names and mark some remaining names
static.

Spotted by David Miller and Jeff Garzik.

Signed-off-by: Michael Chan <mchan@broadcom.com>

[-- Attachment #2: bnx2-15.patch --]
[-- Type: text/x-patch, Size: 19598 bytes --]

diff -Nru 14/drivers/net/bnx2.c 15/drivers/net/bnx2.c
--- 14/drivers/net/bnx2.c	2005-05-23 13:01:45.000000000 -0700
+++ 15/drivers/net/bnx2.c	2005-05-23 13:31:05.000000000 -0700
@@ -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 45
 
 struct {
 	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 6
 
 struct {
 	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 & ETH_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;
diff -Nru 14/drivers/net/bnx2_fw.h 15/drivers/net/bnx2_fw.h
--- 14/drivers/net/bnx2_fw.h	2005-05-23 13:33:28.000000000 -0700
+++ 15/drivers/net/bnx2_fw.h	2005-05-23 13:31:10.000000000 -0700
@@ -15,21 +15,21 @@
  */
 
 
-int COM_b06FwReleaseMajor = 0x0;
-int COM_b06FwReleaseMinor = 0x0;
-int COM_b06FwReleaseFix = 0x0;
-u32 COM_b06FwStartAddr = 0x080004a0;
-u32 COM_b06FwTextAddr = 0x08000000;
-int COM_b06FwTextLen = 0x4594;
-u32 COM_b06FwDataAddr = 0x080045e0;
-int COM_b06FwDataLen = 0x0;
-u32 COM_b06FwRodataAddr = 0x08004598;
-int COM_b06FwRodataLen = 0x18;
-u32 COM_b06FwBssAddr = 0x08004600;
-int COM_b06FwBssLen = 0x88;
-u32 COM_b06FwSbssAddr = 0x080045e0;
-int COM_b06FwSbssLen = 0x1c;
-u32 COM_b06FwText[(0x4594/4) + 1] = {
+static int bnx2_COM_b06FwReleaseMajor = 0x0;
+static int bnx2_COM_b06FwReleaseMinor = 0x0;
+static int bnx2_COM_b06FwReleaseFix = 0x0;
+static u32 bnx2_COM_b06FwStartAddr = 0x080004a0;
+static u32 bnx2_COM_b06FwTextAddr = 0x08000000;
+static int bnx2_COM_b06FwTextLen = 0x4594;
+static u32 bnx2_COM_b06FwDataAddr = 0x080045e0;
+static int bnx2_COM_b06FwDataLen = 0x0;
+static u32 bnx2_COM_b06FwRodataAddr = 0x08004598;
+static int bnx2_COM_b06FwRodataLen = 0x18;
+static u32 bnx2_COM_b06FwBssAddr = 0x08004600;
+static int bnx2_COM_b06FwBssLen = 0x88;
+static u32 bnx2_COM_b06FwSbssAddr = 0x080045e0;
+static int bnx2_COM_b06FwSbssLen = 0x1c;
+static u32 bnx2_COM_b06FwText[(0x4594/4) + 1] = {
 	0x0a000128, 0x00000000, 0x00000000, 0x0000000d, 0x636f6d20, 0x302e362e,
 	0x39000000, 0x00060902, 0x00000000, 0x00000003, 0x00000014, 0x00000032,
 	0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -774,30 +774,30 @@
 	0x8f420000, 0x30420020, 0x1040fffd, 0x3c020020, 0xaf420030, 0x03e00008,
 	0x00000000, 0x00000000 };
 
-u32 COM_b06FwData[(0x0/4) + 1] = { 0x00000000 };
-u32 COM_b06FwRodata[(0x18/4) + 1] = {
+static u32 bnx2_COM_b06FwData[(0x0/4) + 1] = { 0x00000000 };
+static u32 bnx2_COM_b06FwRodata[(0x18/4) + 1] = {
 	0x08002318, 0x08002348, 0x08002378, 0x080023a8, 0x080023d8, 0x00000000,
 	0x00000000 };
 
-u32 COM_b06FwBss[(0x88/4) + 1] = { 0x00000000 };
-u32 COM_b06FwSbss[(0x1c/4) + 1] = { 0x00000000 };
+static u32 bnx2_COM_b06FwBss[(0x88/4) + 1] = { 0x00000000 };
+static u32 bnx2_COM_b06FwSbss[(0x1c/4) + 1] = { 0x00000000 };
 
-int RXP_b06FwReleaseMajor = 0x0;
-int RXP_b06FwReleaseMinor = 0x0;
-int RXP_b06FwReleaseFix = 0x0;
-u32 RXP_b06FwStartAddr = 0x08000060;
-u32 RXP_b06FwTextAddr = 0x08000000;
-int RXP_b06FwTextLen = 0x20b8;
-u32 RXP_b06FwDataAddr = 0x080020e0;
-int RXP_b06FwDataLen = 0x0;
-u32 RXP_b06FwRodataAddr = 0x00000000;
-int RXP_b06FwRodataLen = 0x0;
-u32 RXP_b06FwBssAddr = 0x08002100;
-int RXP_b06FwBssLen = 0x239c;
-u32 RXP_b06FwSbssAddr = 0x080020e0;
-int RXP_b06FwSbssLen = 0x14;
+static int bnx2_RXP_b06FwReleaseMajor = 0x0;
+static int bnx2_RXP_b06FwReleaseMinor = 0x0;
+static int bnx2_RXP_b06FwReleaseFix = 0x0;
+static u32 bnx2_RXP_b06FwStartAddr = 0x08000060;
+static u32 bnx2_RXP_b06FwTextAddr = 0x08000000;
+static int bnx2_RXP_b06FwTextLen = 0x20b8;
+static u32 bnx2_RXP_b06FwDataAddr = 0x080020e0;
+static int bnx2_RXP_b06FwDataLen = 0x0;
+static u32 bnx2_RXP_b06FwRodataAddr = 0x00000000;
+static int bnx2_RXP_b06FwRodataLen = 0x0;
+static u32 bnx2_RXP_b06FwBssAddr = 0x08002100;
+static int bnx2_RXP_b06FwBssLen = 0x239c;
+static u32 bnx2_RXP_b06FwSbssAddr = 0x080020e0;
+static int bnx2_RXP_b06FwSbssLen = 0x14;
 
-u32 RXP_b06FwText[(0x20b8/4) + 1] = {
+static u32 bnx2_RXP_b06FwText[(0x20b8/4) + 1] = {
 	0x0a000018, 0x00000000, 0x00000000, 0x0000000d, 0x72787020, 0x302e362e,
 	0x39000000, 0x00060903, 0x00000000, 0x0000000d, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -1149,12 +1149,12 @@
 	0x24840004, 0x00a01021, 0x1440fffc, 0x24a5ffff, 0x03e00008, 0x00000000,
 	0x00000000 }; 
 
-u32 RXP_b06FwData[(0x0/4) + 1] = { 0x00000000 };
-u32 RXP_b06FwRodata[(0x0/4) + 1] = { 0x00000000 };
-u32 RXP_b06FwBss[(0x239c/4) + 1] = { 0x00000000 };
-u32 RXP_b06FwSbss[(0x14/4) + 1] = { 0x00000000 };
+static u32 bnx2_RXP_b06FwData[(0x0/4) + 1] = { 0x00000000 };
+static u32 bnx2_RXP_b06FwRodata[(0x0/4) + 1] = { 0x00000000 };
+static u32 bnx2_RXP_b06FwBss[(0x239c/4) + 1] = { 0x00000000 };
+static u32 bnx2_RXP_b06FwSbss[(0x14/4) + 1] = { 0x00000000 };
 
-u32 rv2p_proc1[] = {
+static u32 bnx2_rv2p_proc1[] = {
 	0x00000008, 0xac000001, 0x0000000c, 0x2f800001, 0x00000010, 0x213f0004,
 	0x00000010, 0x20bf002c, 0x00000010, 0x203f0143, 0x00000018, 0x8000fffd,
 	0x00000010, 0xb1b8b017, 0x0000000b, 0x2fdf0002, 0x00000000, 0x03d80000,
@@ -1279,7 +1279,7 @@
 	0x00000001, 0x860c0e00, 0x00000008, 0x02040004, 0x00000000, 0x02041800,
 	0x00000000, 0x83871800, 0x00000018, 0x00020000 };
 
-u32 rv2p_proc2[] = {
+static u32 bnx2_rv2p_proc2[] = {
 	0x00000000, 0x2a000000, 0x00000010, 0xb1d40000, 0x00000008, 0x02540003,
 	0x00000018, 0x00040000, 0x00000018, 0x8000000a, 0x00000018, 0x8000000a,
 	0x00000018, 0x8000000e, 0x00000018, 0x80000056, 0x00000018, 0x800001b9,
@@ -1536,22 +1536,22 @@
 	0x0000000c, 0x29520000, 0x00000018, 0x80000002, 0x0000000c, 0x29800000,
 	0x00000018, 0x00570000 };
 
-int TPAT_b06FwReleaseMajor = 0x0;
-int TPAT_b06FwReleaseMinor = 0x0;
-int TPAT_b06FwReleaseFix = 0x0;
-u32 TPAT_b06FwStartAddr = 0x08000858;
-u32 TPAT_b06FwTextAddr = 0x08000800;
-int TPAT_b06FwTextLen = 0x1314;
-u32 TPAT_b06FwDataAddr = 0x08001b40;
-int TPAT_b06FwDataLen = 0x0;
-u32 TPAT_b06FwRodataAddr = 0x00000000;
-int TPAT_b06FwRodataLen = 0x0;
-u32 TPAT_b06FwBssAddr = 0x08001b90;
-int TPAT_b06FwBssLen = 0x80;
-u32 TPAT_b06FwSbssAddr = 0x08001b40;
-int TPAT_b06FwSbssLen = 0x48;
+static int bnx2_TPAT_b06FwReleaseMajor = 0x0;
+static int bnx2_TPAT_b06FwReleaseMinor = 0x0;
+static int bnx2_TPAT_b06FwReleaseFix = 0x0;
+static u32 bnx2_TPAT_b06FwStartAddr = 0x08000858;
+static u32 bnx2_TPAT_b06FwTextAddr = 0x08000800;
+static int bnx2_TPAT_b06FwTextLen = 0x1314;
+static u32 bnx2_TPAT_b06FwDataAddr = 0x08001b40;
+static int bnx2_TPAT_b06FwDataLen = 0x0;
+static u32 bnx2_TPAT_b06FwRodataAddr = 0x00000000;
+static int bnx2_TPAT_b06FwRodataLen = 0x0;
+static u32 bnx2_TPAT_b06FwBssAddr = 0x08001b90;
+static int bnx2_TPAT_b06FwBssLen = 0x80;
+static u32 bnx2_TPAT_b06FwSbssAddr = 0x08001b40;
+static int bnx2_TPAT_b06FwSbssLen = 0x48;
 
-u32 TPAT_b06FwText[(0x1314/4) + 1] = {
+static u32 bnx2_TPAT_b06FwText[(0x1314/4) + 1] = {
 	0x0a000216, 0x00000000, 0x00000000, 0x0000000d, 0x74706174, 0x20302e36,
 	0x2e390000, 0x00060901, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -1757,26 +1757,26 @@
 	0x3c056000, 0x24030019, 0xaca223f8, 0xa743014a, 0x8ca44448, 0x3c020800,
 	0xac440854, 0x03e00008, 0x00000000, 0x00000000 };
 
-u32 TPAT_b06FwData[(0x0/4) + 1] = { 0x00000000 };
-u32 TPAT_b06FwRodata[(0x0/4) + 1] = { 0x00000000 };
-u32 TPAT_b06FwBss[(0x80/4) + 1] = { 0x00000000 };
-u32 TPAT_b06FwSbss[(0x48/4) + 1] = { 0x00000000 };
+static u32 bnx2_TPAT_b06FwData[(0x0/4) + 1] = { 0x00000000 };
+static u32 bnx2_TPAT_b06FwRodata[(0x0/4) + 1] = { 0x00000000 };
+static u32 bnx2_TPAT_b06FwBss[(0x80/4) + 1] = { 0x00000000 };
+static u32 bnx2_TPAT_b06FwSbss[(0x48/4) + 1] = { 0x00000000 };
 
-int TXP_b06FwReleaseMajor = 0x0;
-int TXP_b06FwReleaseMinor = 0x0;
-int TXP_b06FwReleaseFix = 0x0;
-u32 TXP_b06FwStartAddr = 0x08002090;
-u32 TXP_b06FwTextAddr = 0x08000000;
-int TXP_b06FwTextLen = 0x3ffc;
-u32 TXP_b06FwDataAddr = 0x08004020;
-int TXP_b06FwDataLen = 0x0;
-u32 TXP_b06FwRodataAddr = 0x00000000;
-int TXP_b06FwRodataLen = 0x0;
-u32 TXP_b06FwBssAddr = 0x08004060;
-int TXP_b06FwBssLen = 0x194;
-u32 TXP_b06FwSbssAddr = 0x08004020;
-int TXP_b06FwSbssLen = 0x34;
-u32 TXP_b06FwText[(0x3ffc/4) + 1] = {
+static int bnx2_TXP_b06FwReleaseMajor = 0x0;
+static int bnx2_TXP_b06FwReleaseMinor = 0x0;
+static int bnx2_TXP_b06FwReleaseFix = 0x0;
+static u32 bnx2_TXP_b06FwStartAddr = 0x08002090;
+static u32 bnx2_TXP_b06FwTextAddr = 0x08000000;
+static int bnx2_TXP_b06FwTextLen = 0x3ffc;
+static u32 bnx2_TXP_b06FwDataAddr = 0x08004020;
+static int bnx2_TXP_b06FwDataLen = 0x0;
+static u32 bnx2_TXP_b06FwRodataAddr = 0x00000000;
+static int bnx2_TXP_b06FwRodataLen = 0x0;
+static u32 bnx2_TXP_b06FwBssAddr = 0x08004060;
+static int bnx2_TXP_b06FwBssLen = 0x194;
+static u32 bnx2_TXP_b06FwSbssAddr = 0x08004020;
+static int bnx2_TXP_b06FwSbssLen = 0x34;
+static u32 bnx2_TXP_b06FwText[(0x3ffc/4) + 1] = {
 	0x0a000824, 0x00000000, 0x00000000, 0x0000000d, 0x74787020, 0x302e362e,
 	0x39000000, 0x00060900, 0x0000000a, 0x000003e8, 0x0000ea60, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -2461,8 +2461,8 @@
 	0x8c820064, 0x254a0001, 0x314a007f, 0x01094021, 0xad6a0060, 0x24420001,
 	0xac820064, 0x03e00008, 0xad05001c, 0x00000000 };
 
-u32 TXP_b06FwData[(0x0/4) + 1] = { 0x00000000 };
-u32 TXP_b06FwRodata[(0x0/4) + 1] = { 0x00000000 };
-u32 TXP_b06FwBss[(0x194/4) + 1] = { 0x00000000 };
-u32 TXP_b06FwSbss[(0x34/4) + 1] = { 0x00000000 };
+static u32 bnx2_TXP_b06FwData[(0x0/4) + 1] = { 0x00000000 };
+static u32 bnx2_TXP_b06FwRodata[(0x0/4) + 1] = { 0x00000000 };
+static u32 bnx2_TXP_b06FwBss[(0x194/4) + 1] = { 0x00000000 };
+static u32 bnx2_TXP_b06FwSbss[(0x34/4) + 1] = { 0x00000000 };
 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 6/6] bnx2: Update revision and reldate
  2005-05-23 23:53 [PATCH 0/6] bnx2: Misc fixes Michael Chan
                   ` (4 preceding siblings ...)
  2005-05-24  0:29 ` [PATCH 5/6] bnx2: Add bnx2 prefix and mark static Michael Chan
@ 2005-05-24  0:30 ` Michael Chan
  2005-05-24  1:48 ` [PATCH 0/6] bnx2: Misc fixes Jeff Garzik
  6 siblings, 0 replies; 12+ messages in thread
From: Michael Chan @ 2005-05-24  0:30 UTC (permalink / raw)
  To: davem; +Cc: jgarzik, netdev

[-- Attachment #1: Type: text/plain, Size: 49 bytes --]

Signed-off-by: Michael Chan <mchan@broadcom.com>

[-- Attachment #2: bnx2-16.patch --]
[-- Type: text/x-patch, Size: 478 bytes --]

diff -Nru 15/drivers/net/bnx2.c 16/drivers/net/bnx2.c
--- 15/drivers/net/bnx2.c	2005-05-23 13:31:05.000000000 -0700
+++ 16/drivers/net/bnx2.c	2005-05-23 13:36:40.000000000 -0700
@@ -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))
 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/6] bnx2: Fix excessive stack usage
  2005-05-24  0:25 ` [PATCH 1/6] bnx2: Fix excessive stack usage Michael Chan
@ 2005-05-24  1:42   ` Jeff Garzik
  2005-05-24  4:29     ` Michael Chan
  0 siblings, 1 reply; 12+ messages in thread
From: Jeff Garzik @ 2005-05-24  1:42 UTC (permalink / raw)
  To: Michael Chan; +Cc: davem, netdev

Michael Chan wrote:
> diff -Nru 10/drivers/net/bnx2.c 11/drivers/net/bnx2.c
> --- 10/drivers/net/bnx2.c	2005-05-23 10:20:02.000000000 -0700
> +++ 11/drivers/net/bnx2.c	2005-05-23 10:20:20.000000000 -0700
> @@ -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

memleak -- you need to free good_mbuf.

	Jeff

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/6] bnx2: Misc fixes
  2005-05-23 23:53 [PATCH 0/6] bnx2: Misc fixes Michael Chan
                   ` (5 preceding siblings ...)
  2005-05-24  0:30 ` [PATCH 6/6] bnx2: Update revision and reldate Michael Chan
@ 2005-05-24  1:48 ` Jeff Garzik
  6 siblings, 0 replies; 12+ messages in thread
From: Jeff Garzik @ 2005-05-24  1:48 UTC (permalink / raw)
  To: Michael Chan; +Cc: davem, netdev

Michael Chan wrote:
> 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/6] bnx2: Fix excessive stack usage
  2005-05-24  1:42   ` Jeff Garzik
@ 2005-05-24  4:29     ` Michael Chan
  2005-05-24  5:43       ` Jeff Garzik
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Chan @ 2005-05-24  4:29 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: davem, netdev

On Mon, 2005-05-23 at 21:42 -0400, Jeff Garzik wrote:
> 
> 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.

Signed-off-by: Michael Chan <mchan@broadcom.com>

diff -Nru 10/drivers/net/bnx2.c 11/drivers/net/bnx2.c
--- 10/drivers/net/bnx2.c	2005-05-23 10:20:02.000000000 -0700
+++ 11/drivers/net/bnx2.c	2005-05-23 21:13:46.000000000 -0700
@@ -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;

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/6] bnx2: Fix excessive stack usage
  2005-05-24  4:29     ` Michael Chan
@ 2005-05-24  5:43       ` Jeff Garzik
  2005-05-25 22:18         ` David S. Miller
  0 siblings, 1 reply; 12+ messages in thread
From: Jeff Garzik @ 2005-05-24  5:43 UTC (permalink / raw)
  To: Michael Chan; +Cc: davem, netdev

Michael Chan wrote:
> On Mon, 2005-05-23 at 21:42 -0400, Jeff Garzik wrote:
> 
>>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.
> 
> Signed-off-by: Michael Chan <mchan@broadcom.com>

ACK

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/6] bnx2: Fix excessive stack usage
  2005-05-24  5:43       ` Jeff Garzik
@ 2005-05-25 22:18         ` David S. Miller
  0 siblings, 0 replies; 12+ messages in thread
From: David S. Miller @ 2005-05-25 22:18 UTC (permalink / raw)
  To: jgarzik; +Cc: mchan, netdev

From: Jeff Garzik <jgarzik@pobox.com>
Date: Tue, 24 May 2005 01:43:18 -0400

> > Signed-off-by: Michael Chan <mchan@broadcom.com>
> 
> ACK

I've integrated the new bnx2 driver, with all updated
bug fixes.  I'll push this upstream shortly.

Thanks everyone.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-05-25 22:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-23 23:53 [PATCH 0/6] bnx2: Misc fixes Michael Chan
2005-05-24  0:25 ` [PATCH 1/6] bnx2: Fix excessive stack usage Michael Chan
2005-05-24  1:42   ` Jeff Garzik
2005-05-24  4:29     ` Michael Chan
2005-05-24  5:43       ` Jeff Garzik
2005-05-25 22:18         ` David S. Miller
2005-05-24  0:26 ` [PATCH 2/6] bnx2: Fix rx checksum Michael Chan
2005-05-24  0:27 ` [PATCH 3/6] bnx2: Fix excessive udelay Michael Chan
2005-05-24  0:29 ` [PATCH 4/6] bnx2: Fix bug in bnx2_close Michael Chan
2005-05-24  0:29 ` [PATCH 5/6] bnx2: Add bnx2 prefix and mark static Michael Chan
2005-05-24  0:30 ` [PATCH 6/6] bnx2: Update revision and reldate Michael Chan
2005-05-24  1:48 ` [PATCH 0/6] bnx2: Misc fixes Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).