Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[safe/jmp/linux-2.6] / drivers / net / bnx2.c
index dbe487f..ac90a38 100644 (file)
@@ -1,6 +1,6 @@
 /* bnx2.c: Broadcom NX2 network driver.
  *
- * Copyright (c) 2004-2009 Broadcom Corporation
+ * Copyright (c) 2004-2010 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -9,6 +9,7 @@
  * Written by: Michael Chan  (mchan@broadcom.com)
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include "bnx2_fw.h"
 
 #define DRV_MODULE_NAME                "bnx2"
-#define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "2.0.3"
-#define DRV_MODULE_RELDATE     "Dec 03, 2009"
-#define FW_MIPS_FILE_06                "bnx2/bnx2-mips-06-5.0.0.j3.fw"
+#define DRV_MODULE_VERSION     "2.0.9"
+#define DRV_MODULE_RELDATE     "April 27, 2010"
+#define FW_MIPS_FILE_06                "bnx2/bnx2-mips-06-5.0.0.j6.fw"
 #define FW_RV2P_FILE_06                "bnx2/bnx2-rv2p-06-5.0.0.j3.fw"
-#define FW_MIPS_FILE_09                "bnx2/bnx2-mips-09-5.0.0.j3.fw"
-#define FW_RV2P_FILE_09_Ax     "bnx2/bnx2-rv2p-09ax-5.0.0.j3.fw"
-#define FW_RV2P_FILE_09                "bnx2/bnx2-rv2p-09-5.0.0.j3.fw"
+#define FW_MIPS_FILE_09                "bnx2/bnx2-mips-09-5.0.0.j9.fw"
+#define FW_RV2P_FILE_09_Ax     "bnx2/bnx2-rv2p-09ax-5.0.0.j10.fw"
+#define FW_RV2P_FILE_09                "bnx2/bnx2-rv2p-09-5.0.0.j10.fw"
 
 #define RUN_AT(x) (jiffies + (x))
 
@@ -246,6 +246,8 @@ static const struct flash_spec flash_5709 = {
 
 MODULE_DEVICE_TABLE(pci, bnx2_pci_tbl);
 
+static void bnx2_init_napi(struct bnx2 *bp);
+
 static inline u32 bnx2_tx_avail(struct bnx2 *bp, struct bnx2_tx_ring_info *txr)
 {
        u32 diff;
@@ -649,9 +651,10 @@ bnx2_napi_enable(struct bnx2 *bp)
 }
 
 static void
-bnx2_netif_stop(struct bnx2 *bp)
+bnx2_netif_stop(struct bnx2 *bp, bool stop_cnic)
 {
-       bnx2_cnic_stop(bp);
+       if (stop_cnic)
+               bnx2_cnic_stop(bp);
        if (netif_running(bp->dev)) {
                int i;
 
@@ -669,14 +672,15 @@ bnx2_netif_stop(struct bnx2 *bp)
 }
 
 static void
-bnx2_netif_start(struct bnx2 *bp)
+bnx2_netif_start(struct bnx2 *bp, bool start_cnic)
 {
        if (atomic_dec_and_test(&bp->intr_sem)) {
                if (netif_running(bp->dev)) {
                        netif_tx_wake_all_queues(bp->dev);
                        bnx2_napi_enable(bp);
                        bnx2_enable_int(bp);
-                       bnx2_cnic_start(bp);
+                       if (start_cnic)
+                               bnx2_cnic_start(bp);
                }
        }
 }
@@ -979,33 +983,27 @@ bnx2_report_link(struct bnx2 *bp)
 {
        if (bp->link_up) {
                netif_carrier_on(bp->dev);
-               printk(KERN_INFO PFX "%s NIC %s Link is Up, ", bp->dev->name,
-                      bnx2_xceiver_str(bp));
-
-               printk("%d Mbps ", bp->line_speed);
-
-               if (bp->duplex == DUPLEX_FULL)
-                       printk("full duplex");
-               else
-                       printk("half duplex");
+               netdev_info(bp->dev, "NIC %s Link is Up, %d Mbps %s duplex",
+                           bnx2_xceiver_str(bp),
+                           bp->line_speed,
+                           bp->duplex == DUPLEX_FULL ? "full" : "half");
 
                if (bp->flow_ctrl) {
                        if (bp->flow_ctrl & FLOW_CTRL_RX) {
-                               printk(", receive ");
+                               pr_cont(", receive ");
                                if (bp->flow_ctrl & FLOW_CTRL_TX)
-                                       printk("& transmit ");
+                                       pr_cont("& transmit ");
                        }
                        else {
-                               printk(", transmit ");
+                               pr_cont(", transmit ");
                        }
-                       printk("flow control ON");
+                       pr_cont("flow control ON");
                }
-               printk("\n");
-       }
-       else {
+               pr_cont("\n");
+       } else {
                netif_carrier_off(bp->dev);
-               printk(KERN_ERR PFX "%s NIC %s Link is Down\n", bp->dev->name,
-                      bnx2_xceiver_str(bp));
+               netdev_err(bp->dev, "NIC %s Link is Down\n",
+                          bnx2_xceiver_str(bp));
        }
 
        bnx2_report_fw_link(bp);
@@ -2482,8 +2480,7 @@ bnx2_fw_sync(struct bnx2 *bp, u32 msg_data, int ack, int silent)
        /* If we timed out, inform the firmware that this is the case. */
        if ((val & BNX2_FW_MSG_ACK) != (msg_data & BNX2_DRV_MSG_SEQ)) {
                if (!silent)
-                       printk(KERN_ERR PFX "fw sync timeout, reset code = "
-                                           "%x\n", msg_data);
+                       pr_err("fw sync timeout, reset code = %x\n", msg_data);
 
                msg_data &= ~BNX2_DRV_MSG_CODE;
                msg_data |= BNX2_DRV_MSG_CODE_FW_TIMEOUT;
@@ -2599,8 +2596,7 @@ bnx2_alloc_bad_rbuf(struct bnx2 *bp)
 
        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");
+               pr_err("Failed to allocate memory in %s\n", __func__);
                return -ENOMEM;
        }
 
@@ -3560,9 +3556,7 @@ bnx2_set_rx_mode(struct net_device *dev)
 
                memset(mc_filter, 0, 4 * NUM_MC_HASH_REGISTERS);
 
-               for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev);
-                    i++, mclist = mclist->next) {
-
+               netdev_for_each_mc_addr(mclist, dev) {
                        crc = ether_crc_le(ETH_ALEN, mclist->dmi_addr);
                        bit = crc & 0xff;
                        regidx = (bit & 0xe0) >> 5;
@@ -3656,15 +3650,13 @@ bnx2_request_firmware(struct bnx2 *bp)
 
        rc = request_firmware(&bp->mips_firmware, mips_fw_file, &bp->pdev->dev);
        if (rc) {
-               printk(KERN_ERR PFX "Can't load firmware file \"%s\"\n",
-                      mips_fw_file);
+               pr_err("Can't load firmware file \"%s\"\n", mips_fw_file);
                return rc;
        }
 
        rc = request_firmware(&bp->rv2p_firmware, rv2p_fw_file, &bp->pdev->dev);
        if (rc) {
-               printk(KERN_ERR PFX "Can't load firmware file \"%s\"\n",
-                      rv2p_fw_file);
+               pr_err("Can't load firmware file \"%s\"\n", rv2p_fw_file);
                return rc;
        }
        mips_fw = (const struct bnx2_mips_fw_file *) bp->mips_firmware->data;
@@ -3675,15 +3667,13 @@ bnx2_request_firmware(struct bnx2 *bp)
            check_mips_fw_entry(bp->mips_firmware, &mips_fw->rxp) ||
            check_mips_fw_entry(bp->mips_firmware, &mips_fw->tpat) ||
            check_mips_fw_entry(bp->mips_firmware, &mips_fw->txp)) {
-               printk(KERN_ERR PFX "Firmware file \"%s\" is invalid\n",
-                      mips_fw_file);
+               pr_err("Firmware file \"%s\" is invalid\n", mips_fw_file);
                return -EINVAL;
        }
        if (bp->rv2p_firmware->size < sizeof(*rv2p_fw) ||
            check_fw_section(bp->rv2p_firmware, &rv2p_fw->proc1.rv2p, 8, true) ||
            check_fw_section(bp->rv2p_firmware, &rv2p_fw->proc2.rv2p, 8, true)) {
-               printk(KERN_ERR PFX "Firmware file \"%s\" is invalid\n",
-                      rv2p_fw_file);
+               pr_err("Firmware file \"%s\" is invalid\n", rv2p_fw_file);
                return -EINVAL;
        }
 
@@ -4317,7 +4307,7 @@ bnx2_init_nvram(struct bnx2 *bp)
 
        if (j == entry_count) {
                bp->flash_info = NULL;
-               printk(KERN_ALERT PFX "Unknown flash/EEPROM type.\n");
+               pr_alert("Unknown flash/EEPROM type\n");
                return -ENODEV;
        }
 
@@ -4737,7 +4727,7 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code)
 
                if (val & (BNX2_PCICFG_MISC_CONFIG_CORE_RST_REQ |
                           BNX2_PCICFG_MISC_CONFIG_CORE_RST_BSY)) {
-                       printk(KERN_ERR PFX "Chip reset did not complete\n");
+                       pr_err("Chip reset did not complete\n");
                        return -EBUSY;
                }
        }
@@ -4745,7 +4735,7 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code)
        /* Make sure byte swapping is properly configured. */
        val = REG_RD(bp, BNX2_PCI_SWAP_DIAG0);
        if (val != 0x01020304) {
-               printk(KERN_ERR PFX "Chip not in correct endian mode\n");
+               pr_err("Chip not in correct endian mode\n");
                return -ENODEV;
        }
 
@@ -4771,8 +4761,12 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code)
                rc = bnx2_alloc_bad_rbuf(bp);
        }
 
-       if (bp->flags & BNX2_FLAG_USING_MSIX)
+       if (bp->flags & BNX2_FLAG_USING_MSIX) {
                bnx2_setup_msix_tbl(bp);
+               /* Prevent MSIX table reads and write from timing out */
+               REG_WR(bp, BNX2_MISC_ECO_HW_CTL,
+                       BNX2_MISC_ECO_HW_CTL_LARGE_GRC_TMOUT_EN);
+       }
 
        return rc;
 }
@@ -5166,9 +5160,8 @@ bnx2_init_rx_ring(struct bnx2 *bp, int ring_num)
        ring_prod = prod = rxr->rx_pg_prod;
        for (i = 0; i < bp->rx_pg_ring_size; i++) {
                if (bnx2_alloc_rx_page(bp, rxr, ring_prod) < 0) {
-                       printk(KERN_WARNING PFX "%s: init'ed rx page ring %d "
-                                               "with %d/%d pages only\n",
-                              bp->dev->name, ring_num, i, bp->rx_pg_ring_size);
+                       netdev_warn(bp->dev, "init'ed rx page ring %d with %d/%d pages only\n",
+                                   ring_num, i, bp->rx_pg_ring_size);
                        break;
                }
                prod = NEXT_RX_BD(prod);
@@ -5179,9 +5172,8 @@ bnx2_init_rx_ring(struct bnx2 *bp, int ring_num)
        ring_prod = prod = rxr->rx_prod;
        for (i = 0; i < bp->rx_ring_size; i++) {
                if (bnx2_alloc_rx_skb(bp, rxr, ring_prod) < 0) {
-                       printk(KERN_WARNING PFX "%s: init'ed rx ring %d with "
-                                               "%d/%d skbs only\n",
-                              bp->dev->name, ring_num, i, bp->rx_ring_size);
+                       netdev_warn(bp->dev, "init'ed rx ring %d with %d/%d skbs only\n",
+                                   ring_num, i, bp->rx_ring_size);
                        break;
                }
                prod = NEXT_RX_BD(prod);
@@ -6213,6 +6205,7 @@ bnx2_open(struct net_device *dev)
        bnx2_disable_int(bp);
 
        bnx2_setup_int_mode(bp, disable_msi);
+       bnx2_init_napi(bp);
        bnx2_napi_enable(bp);
        rc = bnx2_alloc_mem(bp);
        if (rc)
@@ -6239,11 +6232,7 @@ bnx2_open(struct net_device *dev)
                 * If MSI test fails, go back to INTx mode
                 */
                if (bnx2_test_intr(bp) != 0) {
-                       printk(KERN_WARNING PFX "%s: No interrupt was generated"
-                              " using MSI, switching to INTx mode. Please"
-                              " report this failure to the PCI maintainer"
-                              " and include system chipset information.\n",
-                              bp->dev->name);
+                       netdev_warn(bp->dev, "No interrupt was generated using MSI, switching to INTx mode. Please report this failure to the PCI maintainer and include system chipset information.\n");
 
                        bnx2_disable_int(bp);
                        bnx2_free_irq(bp);
@@ -6263,9 +6252,9 @@ bnx2_open(struct net_device *dev)
                }
        }
        if (bp->flags & BNX2_FLAG_USING_MSI)
-               printk(KERN_INFO PFX "%s: using MSI\n", dev->name);
+               netdev_info(dev, "using MSI\n");
        else if (bp->flags & BNX2_FLAG_USING_MSIX)
-               printk(KERN_INFO PFX "%s: using MSIX\n", dev->name);
+               netdev_info(dev, "using MSIX\n");
 
        netif_tx_start_all_queues(dev);
 
@@ -6290,12 +6279,12 @@ bnx2_reset_task(struct work_struct *work)
                return;
        }
 
-       bnx2_netif_stop(bp);
+       bnx2_netif_stop(bp, true);
 
        bnx2_init_nic(bp, 1);
 
        atomic_set(&bp->intr_sem, 1);
-       bnx2_netif_start(bp);
+       bnx2_netif_start(bp, true);
        rtnl_unlock();
 }
 
@@ -6304,20 +6293,18 @@ bnx2_dump_state(struct bnx2 *bp)
 {
        struct net_device *dev = bp->dev;
 
-       printk(KERN_ERR PFX "%s DEBUG: intr_sem[%x]\n", dev->name,
-               atomic_read(&bp->intr_sem));
-       printk(KERN_ERR PFX "%s DEBUG: EMAC_TX_STATUS[%08x] "
-                           "RPM_MGMT_PKT_CTRL[%08x]\n", dev->name,
-               REG_RD(bp, BNX2_EMAC_TX_STATUS),
-               REG_RD(bp, BNX2_RPM_MGMT_PKT_CTRL));
-       printk(KERN_ERR PFX "%s DEBUG: MCP_STATE_P0[%08x] MCP_STATE_P1[%08x]\n",
-               dev->name, bnx2_reg_rd_ind(bp, BNX2_MCP_STATE_P0),
-               bnx2_reg_rd_ind(bp, BNX2_MCP_STATE_P1));
-       printk(KERN_ERR PFX "%s DEBUG: HC_STATS_INTERRUPT_STATUS[%08x]\n",
-               dev->name, REG_RD(bp, BNX2_HC_STATS_INTERRUPT_STATUS));
+       netdev_err(dev, "DEBUG: intr_sem[%x]\n", atomic_read(&bp->intr_sem));
+       netdev_err(dev, "DEBUG: EMAC_TX_STATUS[%08x] RPM_MGMT_PKT_CTRL[%08x]\n",
+                  REG_RD(bp, BNX2_EMAC_TX_STATUS),
+                  REG_RD(bp, BNX2_RPM_MGMT_PKT_CTRL));
+       netdev_err(dev, "DEBUG: MCP_STATE_P0[%08x] MCP_STATE_P1[%08x]\n",
+                  bnx2_reg_rd_ind(bp, BNX2_MCP_STATE_P0),
+                  bnx2_reg_rd_ind(bp, BNX2_MCP_STATE_P1));
+       netdev_err(dev, "DEBUG: HC_STATS_INTERRUPT_STATUS[%08x]\n",
+                  REG_RD(bp, BNX2_HC_STATS_INTERRUPT_STATUS));
        if (bp->flags & BNX2_FLAG_USING_MSIX)
-               printk(KERN_ERR PFX "%s DEBUG: PBA[%08x]\n", dev->name,
-                       REG_RD(bp, BNX2_PCI_GRC_WINDOW3_BASE));
+               netdev_err(dev, "DEBUG: PBA[%08x]\n",
+                          REG_RD(bp, BNX2_PCI_GRC_WINDOW3_BASE));
 }
 
 static void
@@ -6339,7 +6326,7 @@ bnx2_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp)
        struct bnx2 *bp = netdev_priv(dev);
 
        if (netif_running(dev))
-               bnx2_netif_stop(bp);
+               bnx2_netif_stop(bp, false);
 
        bp->vlgrp = vlgrp;
 
@@ -6350,7 +6337,7 @@ bnx2_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp)
        if (bp->flags & BNX2_FLAG_CAN_KEEP_VLAN)
                bnx2_fw_sync(bp, BNX2_DRV_MSG_CODE_KEEP_VLAN_UPDATE, 0, 1);
 
-       bnx2_netif_start(bp);
+       bnx2_netif_start(bp, false);
 }
 #endif
 
@@ -6381,8 +6368,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
        if (unlikely(bnx2_tx_avail(bp, txr) <
            (skb_shinfo(skb)->nr_frags + 1))) {
                netif_tx_stop_queue(txq);
-               printk(KERN_ERR PFX "%s: BUG! Tx ring full when queue awake!\n",
-                       dev->name);
+               netdev_err(dev, "BUG! Tx ring full when queue awake!\n");
 
                return NETDEV_TX_BUSY;
        }
@@ -6555,16 +6541,16 @@ bnx2_save_stats(struct bnx2 *bp)
                u32 hi;
                u64 lo;
 
-               hi = *(temp_stats + i) + *(hw_stats + i);
-               lo = *(temp_stats + i + 1) + *(hw_stats + i + 1);
+               hi = temp_stats[i] + hw_stats[i];
+               lo = (u64) temp_stats[i + 1] + (u64) hw_stats[i + 1];
                if (lo > 0xffffffff)
                        hi++;
-               *(temp_stats + i) = hi;
-               *(temp_stats + i + 1) = lo & 0xffffffff;
+               temp_stats[i] = hi;
+               temp_stats[i + 1] = lo & 0xffffffff;
        }
 
        for ( ; i < sizeof(struct statistics_block) / 4; i++)
-               *(temp_stats + i) = *(temp_stats + i) + *(hw_stats + i);
+               temp_stats[i] += hw_stats[i];
 }
 
 #define GET_64BIT_NET_STATS64(ctr)                             \
@@ -6751,32 +6737,15 @@ bnx2_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        if (cmd->autoneg == AUTONEG_ENABLE) {
                autoneg |= AUTONEG_SPEED;
 
-               cmd->advertising &= ETHTOOL_ALL_COPPER_SPEED;
-
-               /* allow advertising 1 speed */
-               if ((cmd->advertising == ADVERTISED_10baseT_Half) ||
-                       (cmd->advertising == ADVERTISED_10baseT_Full) ||
-                       (cmd->advertising == ADVERTISED_100baseT_Half) ||
-                       (cmd->advertising == ADVERTISED_100baseT_Full)) {
-
-                       if (cmd->port == PORT_FIBRE)
-                               goto err_out_unlock;
-
-                       advertising = cmd->advertising;
-
-               } else if (cmd->advertising == ADVERTISED_2500baseX_Full) {
-                       if (!(bp->phy_flags & BNX2_PHY_FLAG_2_5G_CAPABLE) ||
-                           (cmd->port == PORT_TP))
-                               goto err_out_unlock;
-               } else if (cmd->advertising == ADVERTISED_1000baseT_Full)
-                       advertising = cmd->advertising;
-               else if (cmd->advertising == ADVERTISED_1000baseT_Half)
-                       goto err_out_unlock;
-               else {
-                       if (cmd->port == PORT_FIBRE)
-                               advertising = ETHTOOL_ALL_FIBRE_SPEED;
-                       else
+               advertising = cmd->advertising;
+               if (cmd->port == PORT_TP) {
+                       advertising &= ETHTOOL_ALL_COPPER_SPEED;
+                       if (!advertising)
                                advertising = ETHTOOL_ALL_COPPER_SPEED;
+               } else {
+                       advertising &= ETHTOOL_ALL_FIBRE_SPEED;
+                       if (!advertising)
+                               advertising = ETHTOOL_ALL_FIBRE_SPEED;
                }
                advertising |= ADVERTISED_Autoneg;
        }
@@ -7088,9 +7057,9 @@ bnx2_set_coalesce(struct net_device *dev, struct ethtool_coalesce *coal)
        bp->stats_ticks &= BNX2_HC_STATS_TICKS_HC_STAT_TICKS;
 
        if (netif_running(bp->dev)) {
-               bnx2_netif_stop(bp);
+               bnx2_netif_stop(bp, true);
                bnx2_init_nic(bp, 0);
-               bnx2_netif_start(bp);
+               bnx2_netif_start(bp, true);
        }
 
        return 0;
@@ -7120,7 +7089,7 @@ bnx2_change_ring_size(struct bnx2 *bp, u32 rx, u32 tx)
                /* Reset will erase chipset stats; save them */
                bnx2_save_stats(bp);
 
-               bnx2_netif_stop(bp);
+               bnx2_netif_stop(bp, true);
                bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_RESET);
                bnx2_free_skbs(bp);
                bnx2_free_mem(bp);
@@ -7148,7 +7117,7 @@ bnx2_change_ring_size(struct bnx2 *bp, u32 rx, u32 tx)
                        bnx2_setup_cnic_irq_info(bp);
                mutex_unlock(&bp->cnic_lock);
 #endif
-               bnx2_netif_start(bp);
+               bnx2_netif_start(bp, true);
        }
        return 0;
 }
@@ -7401,7 +7370,7 @@ bnx2_self_test(struct net_device *dev, struct ethtool_test *etest, u64 *buf)
        if (etest->flags & ETH_TEST_FL_OFFLINE) {
                int i;
 
-               bnx2_netif_stop(bp);
+               bnx2_netif_stop(bp, true);
                bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_DIAG);
                bnx2_free_skbs(bp);
 
@@ -7420,7 +7389,7 @@ bnx2_self_test(struct net_device *dev, struct ethtool_test *etest, u64 *buf)
                        bnx2_shutdown_chip(bp);
                else {
                        bnx2_init_nic(bp, 1);
-                       bnx2_netif_start(bp);
+                       bnx2_netif_start(bp, true);
                }
 
                /* wait for link up */
@@ -7683,9 +7652,11 @@ poll_bnx2(struct net_device *dev)
        int i;
 
        for (i = 0; i < bp->irq_nvecs; i++) {
-               disable_irq(bp->irq_tbl[i].vector);
-               bnx2_interrupt(bp->irq_tbl[i].vector, &bp->bnx2_napi[i]);
-               enable_irq(bp->irq_tbl[i].vector);
+               struct bnx2_irq *irq = &bp->irq_tbl[i];
+
+               disable_irq(irq->vector);
+               irq->handler(irq->vector, &bp->bnx2_napi[i]);
+               enable_irq(irq->vector);
        }
 }
 #endif
@@ -7783,10 +7754,9 @@ bnx2_get_pci_speed(struct bnx2 *bp)
 static void __devinit
 bnx2_read_vpd_fw_ver(struct bnx2 *bp)
 {
-       int rc, i, v0_len = 0;
+       int rc, i, j;
        u8 *data;
-       u8 *v0_str = NULL;
-       bool mn_match = false;
+       unsigned int block_end, rosize, len;
 
 #define BNX2_VPD_NVRAM_OFFSET  0x300
 #define BNX2_VPD_LEN           128
@@ -7808,53 +7778,42 @@ bnx2_read_vpd_fw_ver(struct bnx2 *bp)
                data[i + 3] = data[i + BNX2_VPD_LEN];
        }
 
-       for (i = 0; i <= BNX2_VPD_LEN - 3; ) {
-               unsigned char val = data[i];
-               unsigned int block_end;
-
-               if (val == 0x82 || val == 0x91) {
-                       i = (i + 3 + (data[i + 1] + (data[i + 2] << 8)));
-                       continue;
-               }
-
-               if (val != 0x90)
-                       goto vpd_done;
+       i = pci_vpd_find_tag(data, 0, BNX2_VPD_LEN, PCI_VPD_LRDT_RO_DATA);
+       if (i < 0)
+               goto vpd_done;
 
-               block_end = (i + 3 + (data[i + 1] + (data[i + 2] << 8)));
-               i += 3;
+       rosize = pci_vpd_lrdt_size(&data[i]);
+       i += PCI_VPD_LRDT_TAG_SIZE;
+       block_end = i + rosize;
 
-               if (block_end > BNX2_VPD_LEN)
-                       goto vpd_done;
+       if (block_end > BNX2_VPD_LEN)
+               goto vpd_done;
 
-               while (i < (block_end - 2)) {
-                       int len = data[i + 2];
+       j = pci_vpd_find_info_keyword(data, i, rosize,
+                                     PCI_VPD_RO_KEYWORD_MFR_ID);
+       if (j < 0)
+               goto vpd_done;
 
-                       if (i + 3 + len > block_end)
-                               goto vpd_done;
+       len = pci_vpd_info_field_size(&data[j]);
 
-                       if (data[i] == 'M' && data[i + 1] == 'N') {
-                               if (len != 4 ||
-                                   memcmp(&data[i + 3], "1028", 4))
-                                       goto vpd_done;
-                               mn_match = true;
+       j += PCI_VPD_INFO_FLD_HDR_SIZE;
+       if (j + len > block_end || len != 4 ||
+           memcmp(&data[j], "1028", 4))
+               goto vpd_done;
 
-                       } else if (data[i] == 'V' && data[i + 1] == '0') {
-                               if (len > BNX2_MAX_VER_SLEN)
-                                       goto vpd_done;
+       j = pci_vpd_find_info_keyword(data, i, rosize,
+                                     PCI_VPD_RO_KEYWORD_VENDOR0);
+       if (j < 0)
+               goto vpd_done;
 
-                               v0_len = len;
-                               v0_str = &data[i + 3];
-                       }
-                       i += 3 + len;
+       len = pci_vpd_info_field_size(&data[j]);
 
-                       if (mn_match && v0_str) {
-                               memcpy(bp->fw_version, v0_str, v0_len);
-                               bp->fw_version[v0_len] = ' ';
-                               goto vpd_done;
-                       }
-               }
+       j += PCI_VPD_INFO_FLD_HDR_SIZE;
+       if (j + len > block_end || len > BNX2_MAX_VER_SLEN)
                goto vpd_done;
-       }
+
+       memcpy(bp->fw_version, &data[j], len);
+       bp->fw_version[len] = ' ';
 
 vpd_done:
        kfree(data);
@@ -7886,20 +7845,20 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
        /* enable device (incl. PCI PM wakeup), and bus-mastering */
        rc = pci_enable_device(pdev);
        if (rc) {
-               dev_err(&pdev->dev, "Cannot enable PCI device, aborting.\n");
+               dev_err(&pdev->dev, "Cannot enable PCI device, aborting\n");
                goto err_out;
        }
 
        if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
                dev_err(&pdev->dev,
-                       "Cannot find PCI device base address, aborting.\n");
+                       "Cannot find PCI device base address, aborting\n");
                rc = -ENODEV;
                goto err_out_disable;
        }
 
        rc = pci_request_regions(pdev, DRV_MODULE_NAME);
        if (rc) {
-               dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting.\n");
+               dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting\n");
                goto err_out_disable;
        }
 
@@ -7909,7 +7868,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
        bp->pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
        if (bp->pm_cap == 0) {
                dev_err(&pdev->dev,
-                       "Cannot find power management capability, aborting.\n");
+                       "Cannot find power management capability, aborting\n");
                rc = -EIO;
                goto err_out_release;
        }
@@ -7932,7 +7891,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
        bp->regview = ioremap_nocache(dev->base_addr, mem_len);
 
        if (!bp->regview) {
-               dev_err(&pdev->dev, "Cannot map register space, aborting.\n");
+               dev_err(&pdev->dev, "Cannot map register space, aborting\n");
                rc = -ENOMEM;
                goto err_out_release;
        }
@@ -7952,7 +7911,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
        if (CHIP_NUM(bp) == CHIP_NUM_5709) {
                if (pci_find_capability(pdev, PCI_CAP_ID_EXP) == 0) {
                        dev_err(&pdev->dev,
-                               "Cannot find PCIE capability, aborting.\n");
+                               "Cannot find PCIE capability, aborting\n");
                        rc = -EIO;
                        goto err_out_unmap;
                }
@@ -7963,7 +7922,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
                bp->pcix_cap = pci_find_capability(pdev, PCI_CAP_ID_PCIX);
                if (bp->pcix_cap == 0) {
                        dev_err(&pdev->dev,
-                               "Cannot find PCIX capability, aborting.\n");
+                               "Cannot find PCIX capability, aborting\n");
                        rc = -EIO;
                        goto err_out_unmap;
                }
@@ -7992,11 +7951,11 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
                rc = pci_set_consistent_dma_mask(pdev, persist_dma_mask);
                if (rc) {
                        dev_err(&pdev->dev,
-                               "pci_set_consistent_dma_mask failed, aborting.\n");
+                               "pci_set_consistent_dma_mask failed, aborting\n");
                        goto err_out_unmap;
                }
        } else if ((rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) != 0) {
-               dev_err(&pdev->dev, "System does not support DMA, aborting.\n");
+               dev_err(&pdev->dev, "System does not support DMA, aborting\n");
                goto err_out_unmap;
        }
 
@@ -8013,7 +7972,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
                !(bp->flags & BNX2_FLAG_PCIX)) {
 
                dev_err(&pdev->dev,
-                       "5706 A1 can only be used in a PCIX bus, aborting.\n");
+                       "5706 A1 can only be used in a PCIX bus, aborting\n");
                goto err_out_unmap;
        }
 
@@ -8036,7 +7995,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
 
        if ((reg & BNX2_DEV_INFO_SIGNATURE_MAGIC_MASK) !=
            BNX2_DEV_INFO_SIGNATURE_MAGIC) {
-               dev_err(&pdev->dev, "Firmware not running, aborting.\n");
+               dev_err(&pdev->dev, "Firmware not running, aborting\n");
                rc = -ENODEV;
                goto err_out_unmap;
        }
@@ -8259,7 +8218,7 @@ bnx2_init_napi(struct bnx2 *bp)
 {
        int i;
 
-       for (i = 0; i < BNX2_MAX_MSIX_VEC; i++) {
+       for (i = 0; i < bp->irq_nvecs; i++) {
                struct bnx2_napi *bnapi = &bp->bnx2_napi[i];
                int (*poll)(struct napi_struct *, int);
 
@@ -8309,7 +8268,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        char str[40];
 
        if (version_printed++ == 0)
-               printk(KERN_INFO "%s", version);
+               pr_info("%s", version);
 
        /* dev zeroed in init_etherdev */
        dev = alloc_etherdev_mq(sizeof(*bp), TX_MAX_RINGS);
@@ -8328,7 +8287,6 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        dev->ethtool_ops = &bnx2_ethtool_ops;
 
        bp = netdev_priv(dev);
-       bnx2_init_napi(bp);
 
        pci_set_drvdata(pdev, dev);
 
@@ -8359,15 +8317,13 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                goto error;
        }
 
-       printk(KERN_INFO "%s: %s (%c%d) %s found at mem %lx, "
-               "IRQ %d, node addr %pM\n",
-               dev->name,
-               board_info[ent->driver_data].name,
-               ((CHIP_ID(bp) & 0xf000) >> 12) + 'A',
-               ((CHIP_ID(bp) & 0x0ff0) >> 4),
-               bnx2_bus_string(bp, str),
-               dev->base_addr,
-               bp->pdev->irq, dev->dev_addr);
+       netdev_info(dev, "%s (%c%d) %s found at mem %lx, IRQ %d, node addr %pM\n",
+                   board_info[ent->driver_data].name,
+                   ((CHIP_ID(bp) & 0xf000) >> 12) + 'A',
+                   ((CHIP_ID(bp) & 0x0ff0) >> 4),
+                   bnx2_bus_string(bp, str),
+                   dev->base_addr,
+                   bp->pdev->irq, dev->dev_addr);
 
        return 0;
 
@@ -8427,7 +8383,7 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state)
                return 0;
 
        flush_scheduled_work();
-       bnx2_netif_stop(bp);
+       bnx2_netif_stop(bp, true);
        netif_device_detach(dev);
        del_timer_sync(&bp->timer);
        bnx2_shutdown_chip(bp);
@@ -8449,7 +8405,7 @@ bnx2_resume(struct pci_dev *pdev)
        bnx2_set_power_state(bp, PCI_D0);
        netif_device_attach(dev);
        bnx2_init_nic(bp, 1);
-       bnx2_netif_start(bp);
+       bnx2_netif_start(bp, true);
        return 0;
 }
 
@@ -8476,7 +8432,7 @@ static pci_ers_result_t bnx2_io_error_detected(struct pci_dev *pdev,
        }
 
        if (netif_running(dev)) {
-               bnx2_netif_stop(bp);
+               bnx2_netif_stop(bp, true);
                del_timer_sync(&bp->timer);
                bnx2_reset_nic(bp, BNX2_DRV_MSG_CODE_RESET);
        }
@@ -8502,7 +8458,7 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev)
        rtnl_lock();
        if (pci_enable_device(pdev)) {
                dev_err(&pdev->dev,
-                       "Cannot re-enable PCI device after reset.\n");
+                       "Cannot re-enable PCI device after reset\n");
                rtnl_unlock();
                return PCI_ERS_RESULT_DISCONNECT;
        }
@@ -8533,7 +8489,7 @@ static void bnx2_io_resume(struct pci_dev *pdev)
 
        rtnl_lock();
        if (netif_running(dev))
-               bnx2_netif_start(bp);
+               bnx2_netif_start(bp, true);
 
        netif_device_attach(dev);
        rtnl_unlock();