* [PATCH -next 1/8] bnx2: Zero out status block before chip reset.
@ 2009-08-22 2:20 Michael Chan
2009-08-22 2:20 ` [PATCH -next 2/8] bnx2: Check if_running() before touching chip registers Michael Chan
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Michael Chan @ 2009-08-22 2:20 UTC (permalink / raw)
To: davem; +Cc: netdev
In case IRQs are shared, we will not mistakenly start processing
the ring based on old status block indices.
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/bnx2.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 756d4b4..e75b6e9 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -4858,6 +4858,7 @@ bnx2_init_chip(struct bnx2 *bp)
bnx2_reg_wr_ind(bp, BNX2_RBUF_CONFIG2, BNX2_RBUF_CONFIG2_VAL(mtu));
bnx2_reg_wr_ind(bp, BNX2_RBUF_CONFIG3, BNX2_RBUF_CONFIG3_VAL(mtu));
+ memset(bp->bnx2_napi[0].status_blk.msi, 0, bp->status_stats_size);
for (i = 0; i < BNX2_MAX_MSIX_VEC; i++)
bp->bnx2_napi[i].last_status_idx = 0;
--
1.5.6.GIT
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH -next 2/8] bnx2: Check if_running() before touching chip registers. 2009-08-22 2:20 [PATCH -next 1/8] bnx2: Zero out status block before chip reset Michael Chan @ 2009-08-22 2:20 ` Michael Chan 2009-08-22 2:20 ` [PATCH -next 3/8] bnx2: Close device if MTU change or ring size change fails Michael Chan ` (6 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: Michael Chan @ 2009-08-22 2:20 UTC (permalink / raw) To: davem; +Cc: netdev Add this check to bnx2_netif_stop() and bnx2_vlan_rx_register() to prevent bus lockups on some systems when the chip is in low power state. Signed-off-by: Michael Chan <mchan@broadcom.com> --- drivers/net/bnx2.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index e75b6e9..9cfd460 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -619,6 +619,9 @@ bnx2_disable_int_sync(struct bnx2 *bp) int i; atomic_inc(&bp->intr_sem); + if (!netif_running(bp->dev)) + return; + bnx2_disable_int(bp); for (i = 0; i < bp->irq_nvecs; i++) synchronize_irq(bp->irq_tbl[i].vector); @@ -6254,9 +6257,14 @@ bnx2_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp) { struct bnx2 *bp = netdev_priv(dev); - bnx2_netif_stop(bp); + if (netif_running(dev)) + bnx2_netif_stop(bp); bp->vlgrp = vlgrp; + + if (!netif_running(dev)) + return; + bnx2_set_rx_mode(dev); if (bp->flags & BNX2_FLAG_CAN_KEEP_VLAN) bnx2_fw_sync(bp, BNX2_DRV_MSG_CODE_KEEP_VLAN_UPDATE, 0, 1); -- 1.5.6.GIT ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH -next 3/8] bnx2: Close device if MTU change or ring size change fails. 2009-08-22 2:20 [PATCH -next 1/8] bnx2: Zero out status block before chip reset Michael Chan 2009-08-22 2:20 ` [PATCH -next 2/8] bnx2: Check if_running() before touching chip registers Michael Chan @ 2009-08-22 2:20 ` Michael Chan 2009-08-22 2:20 ` [PATCH -next 4/8] bnx2: Apply BROKEN_STATS workaround to 5706 and 5708 Michael Chan ` (5 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: Michael Chan @ 2009-08-22 2:20 UTC (permalink / raw) To: davem; +Cc: netdev When unable to allocate memory for new MTU or new ring size, we need to close the device to prevent it from crashing. Signed-off-by: Michael Chan <mchan@broadcom.com> --- drivers/net/bnx2.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 9cfd460..1d502e6 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -6992,9 +6992,14 @@ bnx2_change_ring_size(struct bnx2 *bp, u32 rx, u32 tx) int rc; rc = bnx2_alloc_mem(bp); - if (rc) + if (!rc) + rc = bnx2_init_nic(bp, 0); + + if (rc) { + bnx2_napi_enable(bp); + dev_close(bp->dev); return rc; - bnx2_init_nic(bp, 0); + } bnx2_netif_start(bp); } return 0; -- 1.5.6.GIT ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH -next 4/8] bnx2: Apply BROKEN_STATS workaround to 5706 and 5708. 2009-08-22 2:20 [PATCH -next 1/8] bnx2: Zero out status block before chip reset Michael Chan 2009-08-22 2:20 ` [PATCH -next 2/8] bnx2: Check if_running() before touching chip registers Michael Chan 2009-08-22 2:20 ` [PATCH -next 3/8] bnx2: Close device if MTU change or ring size change fails Michael Chan @ 2009-08-22 2:20 ` Michael Chan 2009-08-22 2:20 ` [PATCH -next 5/8] bnx2: Report FTQ discard counter Michael Chan ` (4 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: Michael Chan @ 2009-08-22 2:20 UTC (permalink / raw) To: davem; +Cc: netdev Add flag to expand the workaround to both chips. Signed-off-by: Michael Chan <mchan@broadcom.com> --- drivers/net/bnx2.c | 7 ++++--- drivers/net/bnx2.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 1d502e6..085c2dd 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -4900,7 +4900,7 @@ bnx2_init_chip(struct bnx2 *bp) REG_WR(bp, BNX2_HC_CMD_TICKS, (bp->cmd_ticks_int << 16) | bp->cmd_ticks); - if (CHIP_NUM(bp) == CHIP_NUM_5708) + if (bp->flags & BNX2_FLAG_BROKEN_STATS) REG_WR(bp, BNX2_HC_STATS_TICKS, 0); else REG_WR(bp, BNX2_HC_STATS_TICKS, bp->stats_ticks); @@ -6025,7 +6025,7 @@ bnx2_timer(unsigned long data) bnx2_reg_rd_ind(bp, BNX2_FW_RX_DROP_COUNT); /* workaround occasional corrupted counters */ - if (CHIP_NUM(bp) == CHIP_NUM_5708 && bp->stats_ticks) + if ((bp->flags & BNX2_FLAG_BROKEN_STATS) && bp->stats_ticks) REG_WR(bp, BNX2_HC_COMMAND, bp->hc_cmd | BNX2_HC_COMMAND_STATS_NOW); @@ -6941,7 +6941,7 @@ bnx2_set_coalesce(struct net_device *dev, struct ethtool_coalesce *coal) 0xff; bp->stats_ticks = coal->stats_block_coalesce_usecs; - if (CHIP_NUM(bp) == CHIP_NUM_5708) { + if (bp->flags & BNX2_FLAG_BROKEN_STATS) { if (bp->stats_ticks != 0 && bp->stats_ticks != USEC_PER_SEC) bp->stats_ticks = USEC_PER_SEC; } @@ -7722,6 +7722,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) rc = -EIO; goto err_out_unmap; } + bp->flags |= BNX2_FLAG_BROKEN_STATS; } if (CHIP_NUM(bp) == CHIP_NUM_5709 && CHIP_REV(bp) != CHIP_REV_Ax) { diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index f1edfaa..3c004b4 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h @@ -6718,6 +6718,7 @@ struct bnx2 { BNX2_FLAG_USING_MSIX) #define BNX2_FLAG_JUMBO_BROKEN 0x00000800 #define BNX2_FLAG_CAN_KEEP_VLAN 0x00001000 +#define BNX2_FLAG_BROKEN_STATS 0x00002000 struct bnx2_napi bnx2_napi[BNX2_MAX_MSIX_VEC]; -- 1.5.6.GIT ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH -next 5/8] bnx2: Report FTQ discard counter. 2009-08-22 2:20 [PATCH -next 1/8] bnx2: Zero out status block before chip reset Michael Chan ` (2 preceding siblings ...) 2009-08-22 2:20 ` [PATCH -next 4/8] bnx2: Apply BROKEN_STATS workaround to 5706 and 5708 Michael Chan @ 2009-08-22 2:20 ` Michael Chan 2009-08-22 2:20 ` [PATCH -next 6/8] bnx2: Refine coalescing parameters Michael Chan ` (3 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: Michael Chan @ 2009-08-22 2:20 UTC (permalink / raw) To: davem; +Cc: netdev Report this counter to ethtool -S and include it in netstat. Signed-off-by: Michael Chan <mchan@broadcom.com> --- drivers/net/bnx2.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 085c2dd..e025833 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -6485,7 +6485,8 @@ bnx2_get_stats(struct net_device *dev) stats_blk->stat_EtherStatsOverrsizePkts); net_stats->rx_over_errors = - (unsigned long) stats_blk->stat_IfInMBUFDiscards; + (unsigned long) (stats_blk->stat_IfInFTQDiscards + + stats_blk->stat_IfInMBUFDiscards); net_stats->rx_frame_errors = (unsigned long) stats_blk->stat_Dot3StatsAlignmentErrors; @@ -6518,8 +6519,8 @@ bnx2_get_stats(struct net_device *dev) net_stats->tx_carrier_errors; net_stats->rx_missed_errors = - (unsigned long) (stats_blk->stat_IfInMBUFDiscards + - stats_blk->stat_FwRxDrop); + (unsigned long) (stats_blk->stat_IfInFTQDiscards + + stats_blk->stat_IfInMBUFDiscards + stats_blk->stat_FwRxDrop); return net_stats; } @@ -7090,11 +7091,9 @@ bnx2_set_tso(struct net_device *dev, u32 data) return 0; } -#define BNX2_NUM_STATS 46 - static struct { char string[ETH_GSTRING_LEN]; -} bnx2_stats_str_arr[BNX2_NUM_STATS] = { +} bnx2_stats_str_arr[] = { { "rx_bytes" }, { "rx_error_bytes" }, { "tx_bytes" }, @@ -7139,10 +7138,14 @@ static struct { { "tx_xoff_frames" }, { "rx_mac_ctrl_frames" }, { "rx_filtered_packets" }, + { "rx_ftq_discards" }, { "rx_discards" }, { "rx_fw_discards" }, }; +#define BNX2_NUM_STATS (sizeof(bnx2_stats_str_arr)/\ + sizeof(bnx2_stats_str_arr[0])) + #define STATS_OFFSET32(offset_name) (offsetof(struct statistics_block, offset_name) / 4) static const unsigned long bnx2_stats_offset_arr[BNX2_NUM_STATS] = { @@ -7190,6 +7193,7 @@ static const unsigned long bnx2_stats_offset_arr[BNX2_NUM_STATS] = { STATS_OFFSET32(stat_OutXoffSent), STATS_OFFSET32(stat_MacControlFramesReceived), STATS_OFFSET32(stat_IfInFramesL2FilterDiscards), + STATS_OFFSET32(stat_IfInFTQDiscards), STATS_OFFSET32(stat_IfInMBUFDiscards), STATS_OFFSET32(stat_FwRxDrop), }; @@ -7202,7 +7206,7 @@ static u8 bnx2_5706_stats_len_arr[BNX2_NUM_STATS] = { 4,0,4,4,4,4,4,4,4,4, 4,4,4,4,4,4,4,4,4,4, 4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4, + 4,4,4,4,4,4,4, }; static u8 bnx2_5708_stats_len_arr[BNX2_NUM_STATS] = { @@ -7210,7 +7214,7 @@ static u8 bnx2_5708_stats_len_arr[BNX2_NUM_STATS] = { 4,4,4,4,4,4,4,4,4,4, 4,4,4,4,4,4,4,4,4,4, 4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4, + 4,4,4,4,4,4,4, }; #define BNX2_NUM_TESTS 6 -- 1.5.6.GIT ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH -next 6/8] bnx2: Refine coalescing parameters. 2009-08-22 2:20 [PATCH -next 1/8] bnx2: Zero out status block before chip reset Michael Chan ` (3 preceding siblings ...) 2009-08-22 2:20 ` [PATCH -next 5/8] bnx2: Report FTQ discard counter Michael Chan @ 2009-08-22 2:20 ` Michael Chan 2009-08-22 2:20 ` [PATCH -next 7/8] bnx2: Use const on flash_table structure Michael Chan ` (2 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: Michael Chan @ 2009-08-22 2:20 UTC (permalink / raw) To: davem; +Cc: netdev - Set the USE_INT_PARAM bit so the rx-frames-irq and tx-frames-irq will take effect on 5709. - Increase the default rx-frames to reduce interrupt count. - Decrease the default rx-frames-irq and tx-frames-irq to catch more events during NAPI poll. All these will reduce interrupts without affecting latency. Signed-off-by: Michael Chan <mchan@broadcom.com> --- drivers/net/bnx2.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index e025833..ea6e6b7 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -4921,7 +4921,7 @@ bnx2_init_chip(struct bnx2 *bp) } if (bp->flags & BNX2_FLAG_ONE_SHOT_MSI) - val |= BNX2_HC_CONFIG_ONE_SHOT; + val |= BNX2_HC_CONFIG_ONE_SHOT | BNX2_HC_CONFIG_USE_INT_PARAM; REG_WR(bp, BNX2_HC_CONFIG, val); @@ -7858,13 +7858,13 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) bp->rx_csum = 1; - bp->tx_quick_cons_trip_int = 20; + bp->tx_quick_cons_trip_int = 2; bp->tx_quick_cons_trip = 20; - bp->tx_ticks_int = 80; + bp->tx_ticks_int = 18; bp->tx_ticks = 80; - bp->rx_quick_cons_trip_int = 6; - bp->rx_quick_cons_trip = 6; + bp->rx_quick_cons_trip_int = 2; + bp->rx_quick_cons_trip = 12; bp->rx_ticks_int = 18; bp->rx_ticks = 18; -- 1.5.6.GIT ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH -next 7/8] bnx2: Use const on flash_table structure. 2009-08-22 2:20 [PATCH -next 1/8] bnx2: Zero out status block before chip reset Michael Chan ` (4 preceding siblings ...) 2009-08-22 2:20 ` [PATCH -next 6/8] bnx2: Refine coalescing parameters Michael Chan @ 2009-08-22 2:20 ` Michael Chan 2009-08-22 2:20 ` [PATCH -next 8/8] bnx2: Update version to 2.0.2 Michael Chan 2009-08-23 0:50 ` [PATCH -next 1/8] bnx2: Zero out status block before chip reset David Miller 7 siblings, 0 replies; 9+ messages in thread From: Michael Chan @ 2009-08-22 2:20 UTC (permalink / raw) To: davem; +Cc: netdev The structure, once initialized, never changes. Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> --- drivers/net/bnx2.c | 6 +++--- drivers/net/bnx2.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index ea6e6b7..58ab3f4 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -145,7 +145,7 @@ static DEFINE_PCI_DEVICE_TABLE(bnx2_pci_tbl) = { { 0, } }; -static struct flash_spec flash_table[] = +static const struct flash_spec flash_table[] = { #define BUFFERED_FLAGS (BNX2_NV_BUFFERED | BNX2_NV_TRANSLATE) #define NONBUFFERED_FLAGS (BNX2_NV_WREN) @@ -234,7 +234,7 @@ static struct flash_spec flash_table[] = "Buffered flash (256kB)"}, }; -static struct flash_spec flash_5709 = { +static const struct flash_spec flash_5709 = { .flags = BNX2_NV_BUFFERED, .page_bits = BCM5709_FLASH_PAGE_BITS, .page_size = BCM5709_FLASH_PAGE_SIZE, @@ -4227,7 +4227,7 @@ bnx2_init_nvram(struct bnx2 *bp) { u32 val; int j, entry_count, rc = 0; - struct flash_spec *flash; + const struct flash_spec *flash; if (CHIP_NUM(bp) == CHIP_NUM_5709) { bp->flash_info = &flash_5709; diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index 3c004b4..7544188 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h @@ -6889,7 +6889,7 @@ struct bnx2 { int pm_cap; int pcix_cap; - struct flash_spec *flash_info; + const struct flash_spec *flash_info; u32 flash_size; int status_stats_size; -- 1.5.6.GIT ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH -next 8/8] bnx2: Update version to 2.0.2. 2009-08-22 2:20 [PATCH -next 1/8] bnx2: Zero out status block before chip reset Michael Chan ` (5 preceding siblings ...) 2009-08-22 2:20 ` [PATCH -next 7/8] bnx2: Use const on flash_table structure Michael Chan @ 2009-08-22 2:20 ` Michael Chan 2009-08-23 0:50 ` [PATCH -next 1/8] bnx2: Zero out status block before chip reset David Miller 7 siblings, 0 replies; 9+ messages in thread From: Michael Chan @ 2009-08-22 2:20 UTC (permalink / raw) To: davem; +Cc: netdev Signed-off-by: Michael Chan <mchan@broadcom.com> --- drivers/net/bnx2.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 58ab3f4..4450177 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -59,8 +59,8 @@ #define DRV_MODULE_NAME "bnx2" #define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "2.0.1" -#define DRV_MODULE_RELDATE "May 6, 2009" +#define DRV_MODULE_VERSION "2.0.2" +#define DRV_MODULE_RELDATE "Aug 21, 2009" #define FW_MIPS_FILE_06 "bnx2/bnx2-mips-06-4.6.16.fw" #define FW_RV2P_FILE_06 "bnx2/bnx2-rv2p-06-4.6.16.fw" #define FW_MIPS_FILE_09 "bnx2/bnx2-mips-09-4.6.17.fw" -- 1.5.6.GIT ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH -next 1/8] bnx2: Zero out status block before chip reset. 2009-08-22 2:20 [PATCH -next 1/8] bnx2: Zero out status block before chip reset Michael Chan ` (6 preceding siblings ...) 2009-08-22 2:20 ` [PATCH -next 8/8] bnx2: Update version to 2.0.2 Michael Chan @ 2009-08-23 0:50 ` David Miller 7 siblings, 0 replies; 9+ messages in thread From: David Miller @ 2009-08-23 0:50 UTC (permalink / raw) To: mchan; +Cc: netdev All of these patches look good, applied to net-next-2.6 Thanks! ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-08-23 0:50 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-08-22 2:20 [PATCH -next 1/8] bnx2: Zero out status block before chip reset Michael Chan 2009-08-22 2:20 ` [PATCH -next 2/8] bnx2: Check if_running() before touching chip registers Michael Chan 2009-08-22 2:20 ` [PATCH -next 3/8] bnx2: Close device if MTU change or ring size change fails Michael Chan 2009-08-22 2:20 ` [PATCH -next 4/8] bnx2: Apply BROKEN_STATS workaround to 5706 and 5708 Michael Chan 2009-08-22 2:20 ` [PATCH -next 5/8] bnx2: Report FTQ discard counter Michael Chan 2009-08-22 2:20 ` [PATCH -next 6/8] bnx2: Refine coalescing parameters Michael Chan 2009-08-22 2:20 ` [PATCH -next 7/8] bnx2: Use const on flash_table structure Michael Chan 2009-08-22 2:20 ` [PATCH -next 8/8] bnx2: Update version to 2.0.2 Michael Chan 2009-08-23 0:50 ` [PATCH -next 1/8] bnx2: Zero out status block before chip reset David Miller
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).