bnx2: Zero out status block before chip reset.
Subsystems (2)
PATCH 1/8 bnx2: Zero out status block before chip reset.
In case IRQs are shared, we will not mistakenly start processing the ring based on old status block indices.
--- drivers/net/bnx2.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/bnx2.c +1 -0
@@ -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 ;
Signature · 1 line
1.5.6.GIT
PATCH 2/8 bnx2: Check if_running() before touching chip registers.
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.
--- drivers/net/bnx2.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
drivers/net/bnx2.c +9 -1
@@ -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 );
Signature · 1 line
1.5.6.GIT
PATCH 3/8 bnx2: Close device if MTU change or ring size change fails.
In reply to Michael ChanWhen unable to allocate memory for new MTU or new ring size, we need to close the device to prevent it from crashing.
--- drivers/net/bnx2.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/bnx2.c +7 -2
@@ -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 ;
Signature · 1 line
1.5.6.GIT
PATCH 4/8 bnx2: Apply BROKEN_STATS workaround to 5706 and 5708.
In reply to Michael ChanAdd flag to expand the workaround to both chips.
--- drivers/net/bnx2.c | 7 ++++--- drivers/net/bnx2.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/net/bnx2.c +4 -3
@@ -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) {
drivers/net/bnx2.h +1 -0
@@ -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 0x00002000struct bnx2_napi bnx2_napi[BNX2_MAX_MSIX_VEC ];
Signature · 1 line
1.5.6.GIT
PATCH 5/8 bnx2: Report FTQ discard counter.
In reply to Michael ChanReport this counter to ethtool -S and include it in netstat.
--- drivers/net/bnx2.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-)
drivers/net/bnx2.c +12 -8
@@ -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
Signature · 1 line
1.5.6.GIT
PATCH 6/8 bnx2: Refine coalescing parameters.
In reply to Michael Chan- 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.
--- drivers/net/bnx2.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/bnx2.c +5 -5
@@ -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 ;
Signature · 1 line
1.5.6.GIT
PATCH 7/8 bnx2: Use const on flash_table structure.
In reply to Michael ChanThe structure, once initialized, never changes.
--- drivers/net/bnx2.c | 6 +++--- drivers/net/bnx2.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/bnx2.c +3 -3
@@ -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;
drivers/net/bnx2.h +1 -1
@@ -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;
Signature · 1 line
1.5.6.GIT
PATCH 8/8 bnx2: Update version to 2.0.2.
In reply to Michael Chan--- drivers/net/bnx2.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnx2.c +2 -2
@@ -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"
Signature · 1 line
1.5.6.GIT
David Miller
maintainerAll of these patches look good, applied to net-next-2.6
Thanks!