]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - drivers/net/bnx2x_main.c
bnx2x: NAPI and interrupts enable/disable
[linux-2.6.git] / drivers / net / bnx2x_main.c
index b8cdce21c5d9030e4b90046ea01d7ed2bc5043a7..f0b04c98e45e5f19c95d353de9ac838bfce2f673 100644 (file)
@@ -44,7 +44,6 @@
 #include <net/ip.h>
 #include <net/tcp.h>
 #include <net/checksum.h>
-#include <linux/version.h>
 #include <net/ip6_checksum.h>
 #include <linux/workqueue.h>
 #include <linux/crc32.h>
@@ -60,8 +59,8 @@
 #include "bnx2x.h"
 #include "bnx2x_init.h"
 
-#define DRV_MODULE_VERSION      "1.45.6"
-#define DRV_MODULE_RELDATE      "2008/06/23"
+#define DRV_MODULE_VERSION      "1.45.17"
+#define DRV_MODULE_RELDATE      "2008/08/13"
 #define BNX2X_BC_VER           0x040200
 
 /* Time in jiffies before concluding the transmitter is hung */
@@ -235,17 +234,16 @@ void bnx2x_write_dmae(struct bnx2x *bp, dma_addr_t dma_addr, u32 dst_addr,
        while (*wb_comp != DMAE_COMP_VAL) {
                DP(BNX2X_MSG_OFF, "wb_comp 0x%08x\n", *wb_comp);
 
-               /* adjust delay for emulation/FPGA */
-               if (CHIP_REV_IS_SLOW(bp))
-                       msleep(100);
-               else
-                       udelay(5);
-
                if (!cnt) {
                        BNX2X_ERR("dmae timeout!\n");
                        break;
                }
                cnt--;
+               /* adjust delay for emulation/FPGA */
+               if (CHIP_REV_IS_SLOW(bp))
+                       msleep(100);
+               else
+                       udelay(5);
        }
 
        mutex_unlock(&bp->dmae_mutex);
@@ -308,17 +306,16 @@ void bnx2x_read_dmae(struct bnx2x *bp, u32 src_addr, u32 len32)
 
        while (*wb_comp != DMAE_COMP_VAL) {
 
-               /* adjust delay for emulation/FPGA */
-               if (CHIP_REV_IS_SLOW(bp))
-                       msleep(100);
-               else
-                       udelay(5);
-
                if (!cnt) {
                        BNX2X_ERR("dmae timeout!\n");
                        break;
                }
                cnt--;
+               /* adjust delay for emulation/FPGA */
+               if (CHIP_REV_IS_SLOW(bp))
+                       msleep(100);
+               else
+                       udelay(5);
        }
        DP(BNX2X_MSG_OFF, "data [0x%08x 0x%08x 0x%08x 0x%08x]\n",
           bp->slowpath->wb_data[0], bp->slowpath->wb_data[1],
@@ -557,8 +554,8 @@ static void bnx2x_panic_dump(struct bnx2x *bp)
                                  j, rx_bd[1], rx_bd[0], sw_bd->skb);
                }
 
-               start = 0;
-               end = RX_SGE_CNT*NUM_RX_SGE_PAGES;
+               start = RX_SGE(fp->rx_sge_prod);
+               end = RX_SGE(fp->last_max_sge);
                for (j = start; j < end; j++) {
                        u32 *rx_sge = (u32 *)&fp->rx_sge_ring[j];
                        struct sw_rx_page *sw_page = &fp->rx_page_ring[j];
@@ -685,7 +682,8 @@ static void bnx2x_int_disable_sync(struct bnx2x *bp)
 static inline void bnx2x_ack_sb(struct bnx2x *bp, u8 sb_id,
                                u8 storm, u16 index, u8 op, u8 update)
 {
-       u32 igu_addr = (IGU_ADDR_INT_ACK + IGU_FUNC_BASE * BP_FUNC(bp)) * 8;
+       u32 hc_addr = (HC_REG_COMMAND_REG + BP_PORT(bp)*32 +
+                      COMMAND_REG_INT_ACK);
        struct igu_ack_register igu_ack;
 
        igu_ack.status_block_index = index;
@@ -695,9 +693,9 @@ static inline void bnx2x_ack_sb(struct bnx2x *bp, u8 sb_id,
                         (update << IGU_ACK_REGISTER_UPDATE_INDEX_SHIFT) |
                         (op << IGU_ACK_REGISTER_INTERRUPT_MODE_SHIFT));
 
-       DP(BNX2X_MSG_OFF, "write 0x%08x to IGU addr 0x%x\n",
-          (*(u32 *)&igu_ack), BAR_IGU_INTMEM + igu_addr);
-       REG_WR(bp, BAR_IGU_INTMEM + igu_addr, (*(u32 *)&igu_ack));
+       DP(BNX2X_MSG_OFF, "write 0x%08x to HC addr 0x%x\n",
+          (*(u32 *)&igu_ack), hc_addr);
+       REG_WR(bp, hc_addr, (*(u32 *)&igu_ack));
 }
 
 static inline u16 bnx2x_update_fpsb_idx(struct bnx2x_fastpath *fp)
@@ -719,19 +717,13 @@ static inline u16 bnx2x_update_fpsb_idx(struct bnx2x_fastpath *fp)
 
 static u16 bnx2x_ack_int(struct bnx2x *bp)
 {
-       u32 igu_addr = (IGU_ADDR_SIMD_MASK + IGU_FUNC_BASE * BP_FUNC(bp)) * 8;
-       u32 result = REG_RD(bp, BAR_IGU_INTMEM + igu_addr);
+       u32 hc_addr = (HC_REG_COMMAND_REG + BP_PORT(bp)*32 +
+                      COMMAND_REG_SIMD_MASK);
+       u32 result = REG_RD(bp, hc_addr);
 
-       DP(BNX2X_MSG_OFF, "read 0x%08x from IGU addr 0x%x\n",
-          result, BAR_IGU_INTMEM + igu_addr);
+       DP(BNX2X_MSG_OFF, "read 0x%08x from HC addr 0x%x\n",
+          result, hc_addr);
 
-#ifdef IGU_DEBUG
-#warning IGU_DEBUG active
-       if (result == 0) {
-               BNX2X_ERR("read %x from IGU\n", result);
-               REG_WR(bp, TM_REG_TIMER_SOFT_RST, 0);
-       }
-#endif
        return result;
 }
 
@@ -892,6 +884,7 @@ static void bnx2x_tx_int(struct bnx2x_fastpath *fp, int work)
        }
 }
 
+
 static void bnx2x_sp_event(struct bnx2x_fastpath *fp,
                           union eth_rx_cqe *rr_cqe)
 {
@@ -947,6 +940,7 @@ static void bnx2x_sp_event(struct bnx2x_fastpath *fp,
                bnx2x_fp(bp, cid, state) = BNX2X_FP_STATE_CLOSED;
                break;
 
+
        case (RAMROD_CMD_ID_ETH_SET_MAC | BNX2X_STATE_OPEN):
        case (RAMROD_CMD_ID_ETH_SET_MAC | BNX2X_STATE_DIAG):
                DP(NETIF_MSG_IFUP, "got set mac ramrod\n");
@@ -1156,8 +1150,8 @@ static inline void bnx2x_init_sge_ring_bit_mask(struct bnx2x_fastpath *fp)
        memset(fp->sge_mask, 0xff,
               (NUM_RX_SGE >> RX_SGE_MASK_ELEM_SHIFT)*sizeof(u64));
 
-       /* Clear the two last indeces in the page to 1:
-          these are the indeces that correspond to the "next" element,
+       /* Clear the two last indices in the page to 1:
+          these are the indices that correspond to the "next" element,
           hence will never be indicated and should be removed from
           the calculations. */
        bnx2x_clear_sge_mask_next_elems(fp);
@@ -1377,7 +1371,6 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
        u16 bd_cons, bd_prod, bd_prod_fw, comp_ring_cons;
        u16 hw_comp_cons, sw_comp_cons, sw_comp_prod;
        int rx_pkt = 0;
-       u16 queue;
 
 #ifdef BNX2X_STOP_ON_ERROR
        if (unlikely(bp->panic))
@@ -1443,7 +1436,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
                        if ((!fp->disable_tpa) &&
                            (TPA_TYPE(cqe_fp_flags) !=
                                        (TPA_TYPE_START | TPA_TYPE_END))) {
-                               queue = cqe->fast_path_cqe.queue_index;
+                               u16 queue = cqe->fast_path_cqe.queue_index;
 
                                if (TPA_TYPE(cqe_fp_flags) == TPA_TYPE_START) {
                                        DP(NETIF_MSG_RX_STATUS,
@@ -1642,17 +1635,17 @@ static irqreturn_t bnx2x_interrupt(int irq, void *dev_instance)
        }
        DP(NETIF_MSG_INTR, "got an interrupt  status %u\n", status);
 
-#ifdef BNX2X_STOP_ON_ERROR
-       if (unlikely(bp->panic))
-               return IRQ_HANDLED;
-#endif
-
        /* Return here if interrupt is disabled */
        if (unlikely(atomic_read(&bp->intr_sem) != 0)) {
                DP(NETIF_MSG_INTR, "called but intr_sem not 0, returning\n");
                return IRQ_HANDLED;
        }
 
+#ifdef BNX2X_STOP_ON_ERROR
+       if (unlikely(bp->panic))
+               return IRQ_HANDLED;
+#endif
+
        mask = 0x2 << bp->fp[0].sb_id;
        if (status & mask) {
                struct bnx2x_fastpath *fp = &bp->fp[0];
@@ -1724,8 +1717,8 @@ static int bnx2x_acquire_hw_lock(struct bnx2x *bp, u32 resource)
                return -EEXIST;
        }
 
-       /* Try for 1 second every 5ms */
-       for (cnt = 0; cnt < 200; cnt++) {
+       /* Try for 5 second every 5ms */
+       for (cnt = 0; cnt < 1000; cnt++) {
                /* Try to acquire the lock */
                REG_WR(bp, hw_lock_control_reg + 4, resource_bit);
                lock_status = REG_RD(bp, hw_lock_control_reg);
@@ -1795,11 +1788,11 @@ static void bnx2x_release_phy_lock(struct bnx2x *bp)
        mutex_unlock(&bp->port.phy_mutex);
 }
 
-int bnx2x_set_gpio(struct bnx2x *bp, int gpio_num, u32 mode)
+int bnx2x_set_gpio(struct bnx2x *bp, int gpio_num, u32 mode, u8 port)
 {
        /* The GPIO should be swapped if swap register is set and active */
        int gpio_port = (REG_RD(bp, NIG_REG_PORT_SWAP) &&
-                        REG_RD(bp, NIG_REG_STRAP_OVERRIDE)) ^ BP_PORT(bp);
+                        REG_RD(bp, NIG_REG_STRAP_OVERRIDE)) ^ port;
        int gpio_shift = gpio_num +
                        (gpio_port ? MISC_REGISTERS_GPIO_PORT_SHIFT : 0);
        u32 gpio_mask = (1 << gpio_shift);
@@ -1831,7 +1824,7 @@ int bnx2x_set_gpio(struct bnx2x *bp, int gpio_num, u32 mode)
                gpio_reg |=  (gpio_mask << MISC_REGISTERS_GPIO_SET_POS);
                break;
 
-       case MISC_REGISTERS_GPIO_INPUT_HI_Z :
+       case MISC_REGISTERS_GPIO_INPUT_HI_Z:
                DP(NETIF_MSG_LINK, "Set GPIO %d (shift %d) -> input\n",
                   gpio_num, gpio_shift);
                /* set FLOAT */
@@ -1864,14 +1857,14 @@ static int bnx2x_set_spio(struct bnx2x *bp, int spio_num, u32 mode)
        spio_reg = (REG_RD(bp, MISC_REG_SPIO) & MISC_REGISTERS_SPIO_FLOAT);
 
        switch (mode) {
-       case MISC_REGISTERS_SPIO_OUTPUT_LOW :
+       case MISC_REGISTERS_SPIO_OUTPUT_LOW:
                DP(NETIF_MSG_LINK, "Set SPIO %d -> output low\n", spio_num);
                /* clear FLOAT and set CLR */
                spio_reg &= ~(spio_mask << MISC_REGISTERS_SPIO_FLOAT_POS);
                spio_reg |=  (spio_mask << MISC_REGISTERS_SPIO_CLR_POS);
                break;
 
-       case MISC_REGISTERS_SPIO_OUTPUT_HIGH :
+       case MISC_REGISTERS_SPIO_OUTPUT_HIGH:
                DP(NETIF_MSG_LINK, "Set SPIO %d -> output high\n", spio_num);
                /* clear FLOAT and set SET */
                spio_reg &= ~(spio_mask << MISC_REGISTERS_SPIO_FLOAT_POS);
@@ -1953,7 +1946,14 @@ static u8 bnx2x_initial_phy_init(struct bnx2x *bp)
                u8 rc;
 
                /* Initialize link parameters structure variables */
-               bp->link_params.mtu = bp->dev->mtu;
+               /* It is recommended to turn off RX FC for jumbo frames
+                  for better performance */
+               if (IS_E1HMF(bp))
+                       bp->link_params.req_fc_auto_adv = FLOW_CTRL_BOTH;
+               else if (bp->dev->mtu > 5000)
+                       bp->link_params.req_fc_auto_adv = FLOW_CTRL_TX;
+               else
+                       bp->link_params.req_fc_auto_adv = FLOW_CTRL_BOTH;
 
                bnx2x_acquire_phy_lock(bp);
                rc = bnx2x_phy_init(&bp->link_params, &bp->link_vars);
@@ -2010,7 +2010,7 @@ static u8 bnx2x_link_test(struct bnx2x *bp)
      sum of vn_min_rates
        or
      0 - if all the min_rates are 0.
-     In the later case fainess algorithm should be deactivated.
+     In the later case fairness algorithm should be deactivated.
      If not all min_rates are zero then those that are zeroes will
      be set to 1.
  */
@@ -2133,7 +2133,7 @@ static void bnx2x_init_vn_minmax(struct bnx2x *bp, int func,
                                FUNC_MF_CFG_MIN_BW_SHIFT) * 100;
                /* If FAIRNESS is enabled (not all min rates are zeroes) and
                   if current min rate is zero - set it to 1.
-                  This is a requirment of the algorithm. */
+                  This is a requirement of the algorithm. */
                if ((vn_min_rate == 0) && wsum)
                        vn_min_rate = DEF_MIN_RATE;
                vn_max_rate = ((vn_cfg & FUNC_MF_CFG_MAX_BW_MASK) >>
@@ -2444,8 +2444,8 @@ static inline u16 bnx2x_update_dsb_idx(struct bnx2x *bp)
 static void bnx2x_attn_int_asserted(struct bnx2x *bp, u32 asserted)
 {
        int port = BP_PORT(bp);
-       int func = BP_FUNC(bp);
-       u32 igu_addr = (IGU_ADDR_ATTN_BITS_SET + IGU_FUNC_BASE * func) * 8;
+       u32 hc_addr = (HC_REG_COMMAND_REG + port*32 +
+                      COMMAND_REG_ATTN_BITS_SET);
        u32 aeu_addr = port ? MISC_REG_AEU_MASK_ATTN_FUNC_1 :
                              MISC_REG_AEU_MASK_ATTN_FUNC_0;
        u32 nig_int_mask_addr = port ? NIG_REG_MASK_INTERRUPT_PORT1 :
@@ -2523,9 +2523,9 @@ static void bnx2x_attn_int_asserted(struct bnx2x *bp, u32 asserted)
 
        } /* if hardwired */
 
-       DP(NETIF_MSG_HW, "about to mask 0x%08x at IGU addr 0x%x\n",
-          asserted, BAR_IGU_INTMEM + igu_addr);
-       REG_WR(bp, BAR_IGU_INTMEM + igu_addr, asserted);
+       DP(NETIF_MSG_HW, "about to mask 0x%08x at HC addr 0x%x\n",
+          asserted, hc_addr);
+       REG_WR(bp, hc_addr, asserted);
 
        /* now set back the mask */
        if (asserted & ATTN_NIG_FOR_FUNC)
@@ -2550,15 +2550,16 @@ static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn)
                BNX2X_ERR("SPIO5 hw attention\n");
 
                switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) {
+               case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1021G:
                case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G:
                        /* Fan failure attention */
 
-                       /* The PHY reset is controled by GPIO 1 */
+                       /* The PHY reset is controlled by GPIO 1 */
                        bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1,
-                                      MISC_REGISTERS_GPIO_OUTPUT_LOW);
-                       /* Low power mode is controled by GPIO 2 */
+                                      MISC_REGISTERS_GPIO_OUTPUT_LOW, port);
+                       /* Low power mode is controlled by GPIO 2 */
                        bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2,
-                                      MISC_REGISTERS_GPIO_OUTPUT_LOW);
+                                      MISC_REGISTERS_GPIO_OUTPUT_LOW, port);
                        /* mark the failure */
                        bp->link_params.ext_phy_config &=
                                        ~PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK;
@@ -2758,18 +2759,18 @@ static void bnx2x_attn_int_deasserted(struct bnx2x *bp, u32 deasserted)
                                                HW_PRTY_ASSERT_SET_1) ||
                            (attn.sig[2] & group_mask.sig[2] &
                                                HW_PRTY_ASSERT_SET_2))
-                              BNX2X_ERR("FATAL HW block parity attention\n");
+                               BNX2X_ERR("FATAL HW block parity attention\n");
                }
        }
 
        bnx2x_release_alr(bp);
 
-       reg_addr = (IGU_ADDR_ATTN_BITS_CLR + IGU_FUNC_BASE * BP_FUNC(bp)) * 8;
+       reg_addr = (HC_REG_COMMAND_REG + port*32 + COMMAND_REG_ATTN_BITS_CLR);
 
        val = ~deasserted;
        DP(NETIF_MSG_HW, "about to mask 0x%08x at HC addr 0x%x\n",
           val, reg_addr);
-       REG_WR(bp, BAR_IGU_INTMEM + reg_addr, val);
+       REG_WR(bp, reg_addr, val);
 
        if (~bp->attn_state & deasserted)
                BNX2X_ERR("IGU ERROR\n");
@@ -2827,7 +2828,7 @@ static void bnx2x_sp_task(struct work_struct *work)
 
        /* Return here if interrupt is disabled */
        if (unlikely(atomic_read(&bp->intr_sem) != 0)) {
-               DP(BNX2X_MSG_SP, "called but intr_sem not 0, returning\n");
+               DP(NETIF_MSG_INTR, "called but intr_sem not 0, returning\n");
                return;
        }
 
@@ -2835,7 +2836,7 @@ static void bnx2x_sp_task(struct work_struct *work)
 /*     if (status == 0)                                     */
 /*             BNX2X_ERR("spurious slowpath interrupt!\n"); */
 
-       DP(BNX2X_MSG_SP, "got a slowpath interrupt (updated %x)\n", status);
+       DP(NETIF_MSG_INTR, "got a slowpath interrupt (updated %x)\n", status);
 
        /* HW attentions */
        if (status & 0x1)
@@ -2865,7 +2866,7 @@ static irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance)
 
        /* Return here if interrupt is disabled */
        if (unlikely(atomic_read(&bp->intr_sem) != 0)) {
-               DP(BNX2X_MSG_SP, "called but intr_sem not 0, returning\n");
+               DP(NETIF_MSG_INTR, "called but intr_sem not 0, returning\n");
                return IRQ_HANDLED;
        }
 
@@ -2903,11 +2904,11 @@ static irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance)
                        /* underflow */ \
                        d_hi = m_hi - s_hi; \
                        if (d_hi > 0) { \
-                       /* we can 'loan' 1 */ \
+                               /* we can 'loan' 1 */ \
                                d_hi--; \
                                d_lo = m_lo + (UINT_MAX - s_lo) + 1; \
                        } else { \
-                       /* m_hi <= s_hi */ \
+                               /* m_hi <= s_hi */ \
                                d_hi = 0; \
                                d_lo = 0; \
                        } \
@@ -2917,7 +2918,7 @@ static irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance)
                                d_hi = 0; \
                                d_lo = 0; \
                        } else { \
-                       /* m_hi >= s_hi */ \
+                               /* m_hi >= s_hi */ \
                                d_hi = m_hi - s_hi; \
                                d_lo = m_lo - s_lo; \
                        } \
@@ -3099,12 +3100,12 @@ static int bnx2x_stats_comp(struct bnx2x *bp)
 
        might_sleep();
        while (*stats_comp != DMAE_COMP_VAL) {
-               msleep(1);
                if (!cnt) {
                        BNX2X_ERR("timeout waiting for stats finished\n");
                        break;
                }
                cnt--;
+               msleep(1);
        }
        return 1;
 }
@@ -3781,7 +3782,7 @@ static void bnx2x_stats_update(struct bnx2x *bp)
                             bp->fp->rx_comp_cons),
                       le16_to_cpu(*bp->fp->rx_cons_sb), nstats->rx_packets);
                printk(KERN_DEBUG "  %s (Xoff events %u)  brb drops %u\n",
-                      netif_queue_stopped(bp->dev)? "Xoff" : "Xon",
+                      netif_queue_stopped(bp->dev) ? "Xoff" : "Xon",
                       estats->driver_xoff, estats->brb_drop_lo);
                printk(KERN_DEBUG "tstats: checksum_discard %u  "
                        "packets_too_big_discard %u  no_buff_discard %u  "
@@ -3992,14 +3993,14 @@ static void bnx2x_zero_sb(struct bnx2x *bp, int sb_id)
 
        bnx2x_init_fill(bp, BAR_USTRORM_INTMEM +
                        USTORM_SB_HOST_STATUS_BLOCK_OFFSET(port, sb_id), 0,
-                       sizeof(struct ustorm_def_status_block)/4);
+                       sizeof(struct ustorm_status_block)/4);
        bnx2x_init_fill(bp, BAR_CSTRORM_INTMEM +
                        CSTORM_SB_HOST_STATUS_BLOCK_OFFSET(port, sb_id), 0,
-                       sizeof(struct cstorm_def_status_block)/4);
+                       sizeof(struct cstorm_status_block)/4);
 }
 
-static void bnx2x_init_sb(struct bnx2x *bp, int sb_id,
-                         struct host_status_block *sb, dma_addr_t mapping)
+static void bnx2x_init_sb(struct bnx2x *bp, struct host_status_block *sb,
+                         dma_addr_t mapping, int sb_id)
 {
        int port = BP_PORT(bp);
        int func = BP_FUNC(bp);
@@ -4075,7 +4076,6 @@ static void bnx2x_init_def_sb(struct bnx2x *bp,
                                            atten_status_block);
        def_sb->atten_status_block.status_block_id = sb_id;
 
-       bp->def_att_idx = 0;
        bp->attn_state = 0;
 
        reg_offset = (port ? MISC_REG_AEU_ENABLE1_FUNC_1_OUT_0 :
@@ -4109,17 +4109,13 @@ static void bnx2x_init_def_sb(struct bnx2x *bp,
                                            u_def_status_block);
        def_sb->u_def_status_block.status_block_id = sb_id;
 
-       bp->def_u_idx = 0;
-
        REG_WR(bp, BAR_USTRORM_INTMEM +
               USTORM_DEF_SB_HOST_SB_ADDR_OFFSET(func), U64_LO(section));
        REG_WR(bp, BAR_USTRORM_INTMEM +
               ((USTORM_DEF_SB_HOST_SB_ADDR_OFFSET(func)) + 4),
               U64_HI(section));
-       REG_WR8(bp, BAR_USTRORM_INTMEM +  DEF_USB_FUNC_OFF +
+       REG_WR8(bp, BAR_USTRORM_INTMEM + DEF_USB_FUNC_OFF +
                USTORM_DEF_SB_HOST_STATUS_BLOCK_OFFSET(func), func);
-       REG_WR(bp, BAR_USTRORM_INTMEM + USTORM_HC_BTR_OFFSET(func),
-              BNX2X_BTR);
 
        for (index = 0; index < HC_USTORM_DEF_SB_NUM_INDICES; index++)
                REG_WR16(bp, BAR_USTRORM_INTMEM +
@@ -4130,17 +4126,13 @@ static void bnx2x_init_def_sb(struct bnx2x *bp,
                                            c_def_status_block);
        def_sb->c_def_status_block.status_block_id = sb_id;
 
-       bp->def_c_idx = 0;
-
        REG_WR(bp, BAR_CSTRORM_INTMEM +
               CSTORM_DEF_SB_HOST_SB_ADDR_OFFSET(func), U64_LO(section));
        REG_WR(bp, BAR_CSTRORM_INTMEM +
               ((CSTORM_DEF_SB_HOST_SB_ADDR_OFFSET(func)) + 4),
               U64_HI(section));
-       REG_WR8(bp, BAR_CSTRORM_INTMEM +  DEF_CSB_FUNC_OFF +
+       REG_WR8(bp, BAR_CSTRORM_INTMEM + DEF_CSB_FUNC_OFF +
                CSTORM_DEF_SB_HOST_STATUS_BLOCK_OFFSET(func), func);
-       REG_WR(bp, BAR_CSTRORM_INTMEM + CSTORM_HC_BTR_OFFSET(func),
-              BNX2X_BTR);
 
        for (index = 0; index < HC_CSTORM_DEF_SB_NUM_INDICES; index++)
                REG_WR16(bp, BAR_CSTRORM_INTMEM +
@@ -4151,17 +4143,13 @@ static void bnx2x_init_def_sb(struct bnx2x *bp,
                                            t_def_status_block);
        def_sb->t_def_status_block.status_block_id = sb_id;
 
-       bp->def_t_idx = 0;
-
        REG_WR(bp, BAR_TSTRORM_INTMEM +
               TSTORM_DEF_SB_HOST_SB_ADDR_OFFSET(func), U64_LO(section));
        REG_WR(bp, BAR_TSTRORM_INTMEM +
               ((TSTORM_DEF_SB_HOST_SB_ADDR_OFFSET(func)) + 4),
               U64_HI(section));
-       REG_WR8(bp, BAR_TSTRORM_INTMEM +  DEF_TSB_FUNC_OFF +
+       REG_WR8(bp, BAR_TSTRORM_INTMEM + DEF_TSB_FUNC_OFF +
                TSTORM_DEF_SB_HOST_STATUS_BLOCK_OFFSET(func), func);
-       REG_WR(bp, BAR_TSTRORM_INTMEM + TSTORM_HC_BTR_OFFSET(func),
-              BNX2X_BTR);
 
        for (index = 0; index < HC_TSTORM_DEF_SB_NUM_INDICES; index++)
                REG_WR16(bp, BAR_TSTRORM_INTMEM +
@@ -4172,17 +4160,13 @@ static void bnx2x_init_def_sb(struct bnx2x *bp,
                                            x_def_status_block);
        def_sb->x_def_status_block.status_block_id = sb_id;
 
-       bp->def_x_idx = 0;
-
        REG_WR(bp, BAR_XSTRORM_INTMEM +
               XSTORM_DEF_SB_HOST_SB_ADDR_OFFSET(func), U64_LO(section));
        REG_WR(bp, BAR_XSTRORM_INTMEM +
               ((XSTORM_DEF_SB_HOST_SB_ADDR_OFFSET(func)) + 4),
               U64_HI(section));
-       REG_WR8(bp, BAR_XSTRORM_INTMEM +  DEF_XSB_FUNC_OFF +
+       REG_WR8(bp, BAR_XSTRORM_INTMEM + DEF_XSB_FUNC_OFF +
                XSTORM_DEF_SB_HOST_STATUS_BLOCK_OFFSET(func), func);
-       REG_WR(bp, BAR_XSTRORM_INTMEM + XSTORM_HC_BTR_OFFSET(func),
-              BNX2X_BTR);
 
        for (index = 0; index < HC_XSTORM_DEF_SB_NUM_INDICES; index++)
                REG_WR16(bp, BAR_XSTRORM_INTMEM +
@@ -4205,21 +4189,25 @@ static void bnx2x_update_coalesce(struct bnx2x *bp)
                /* HC_INDEX_U_ETH_RX_CQ_CONS */
                REG_WR8(bp, BAR_USTRORM_INTMEM +
                        USTORM_SB_HC_TIMEOUT_OFFSET(port, sb_id,
-                                                  HC_INDEX_U_ETH_RX_CQ_CONS),
+                                                   U_SB_ETH_RX_CQ_INDEX),
                        bp->rx_ticks/12);
                REG_WR16(bp, BAR_USTRORM_INTMEM +
                         USTORM_SB_HC_DISABLE_OFFSET(port, sb_id,
-                                                  HC_INDEX_U_ETH_RX_CQ_CONS),
+                                                    U_SB_ETH_RX_CQ_INDEX),
+                        bp->rx_ticks ? 0 : 1);
+               REG_WR16(bp, BAR_USTRORM_INTMEM +
+                        USTORM_SB_HC_DISABLE_OFFSET(port, sb_id,
+                                                    U_SB_ETH_RX_BD_INDEX),
                         bp->rx_ticks ? 0 : 1);
 
                /* HC_INDEX_C_ETH_TX_CQ_CONS */
                REG_WR8(bp, BAR_CSTRORM_INTMEM +
                        CSTORM_SB_HC_TIMEOUT_OFFSET(port, sb_id,
-                                                  HC_INDEX_C_ETH_TX_CQ_CONS),
+                                                   C_SB_ETH_TX_CQ_INDEX),
                        bp->tx_ticks/12);
                REG_WR16(bp, BAR_CSTRORM_INTMEM +
                         CSTORM_SB_HC_DISABLE_OFFSET(port, sb_id,
-                                                  HC_INDEX_C_ETH_TX_CQ_CONS),
+                                                    C_SB_ETH_TX_CQ_INDEX),
                         bp->tx_ticks ? 0 : 1);
        }
 }
@@ -4494,7 +4482,7 @@ static void bnx2x_init_context(struct bnx2x *bp)
                }
 
                context->cstorm_st_context.sb_index_number =
-                                               HC_INDEX_C_ETH_TX_CQ_CONS;
+                                               C_SB_ETH_TX_CQ_INDEX;
                context->cstorm_st_context.status_block_id = sb_id;
 
                context->xstorm_ag_context.cdu_reserved =
@@ -4576,7 +4564,7 @@ static void bnx2x_set_storm_rx_mode(struct bnx2x *bp)
        int func = BP_FUNC(bp);
        int i;
 
-       DP(NETIF_MSG_RX_STATUS, "rx mode is %d\n", mode);
+       DP(NETIF_MSG_IFUP, "rx mode %d  mask 0x%x\n", mode, mask);
 
        switch (mode) {
        case BNX2X_RX_MODE_NONE: /* no Rx */
@@ -4618,6 +4606,17 @@ static void bnx2x_init_internal_common(struct bnx2x *bp)
 {
        int i;
 
+       if (bp->flags & TPA_ENABLE_FLAG) {
+               struct tstorm_eth_tpa_exist tpa = {0};
+
+               tpa.tpa_exist = 1;
+
+               REG_WR(bp, BAR_TSTRORM_INTMEM + TSTORM_TPA_EXIST_OFFSET,
+                      ((u32 *)&tpa)[0]);
+               REG_WR(bp, BAR_TSTRORM_INTMEM + TSTORM_TPA_EXIST_OFFSET + 4,
+                      ((u32 *)&tpa)[1]);
+       }
+
        /* Zero this manually as its initialization is
           currently missing in the initTool */
        for (i = 0; i < (USTORM_AGG_DATA_SIZE >> 2); i++)
@@ -4773,12 +4772,14 @@ static void bnx2x_nic_init(struct bnx2x *bp, u32 load_code)
                DP(NETIF_MSG_IFUP,
                   "bnx2x_init_sb(%p,%p) index %d  cl_id %d  sb %d\n",
                   bp, fp->status_blk, i, FP_CL_ID(fp), FP_SB_ID(fp));
-               bnx2x_init_sb(bp, FP_SB_ID(fp), fp->status_blk,
-                             fp->status_blk_mapping);
+               bnx2x_init_sb(bp, fp->status_blk, fp->status_blk_mapping,
+                             FP_SB_ID(fp));
+               bnx2x_update_fpsb_idx(fp);
        }
 
-       bnx2x_init_def_sb(bp, bp->def_status_blk,
-                         bp->def_status_blk_mapping, DEF_SB_ID);
+       bnx2x_init_def_sb(bp, bp->def_status_blk, bp->def_status_blk_mapping,
+                         DEF_SB_ID);
+       bnx2x_update_dsb_idx(bp);
        bnx2x_update_coalesce(bp);
        bnx2x_init_rx_rings(bp);
        bnx2x_init_tx_ring(bp);
@@ -4933,7 +4934,7 @@ static int bnx2x_int_mem_test(struct bnx2x *bp)
        REG_WR(bp, TSDM_REG_ENABLE_IN1, 0x0);
        REG_WR(bp, TCM_REG_PRS_IFEN, 0x0);
        REG_WR(bp, CFC_REG_DEBUG0, 0x1);
-       NIG_WR(NIG_REG_PRS_REQ_IN_EN, 0x0);
+       REG_WR(bp, NIG_REG_PRS_REQ_IN_EN, 0x0);
 
        /*  Write 0 to parser credits for CFC search request */
        REG_WR(bp, PRS_REG_CFC_SEARCH_INITIAL_CREDIT, 0x0);
@@ -4988,7 +4989,7 @@ static int bnx2x_int_mem_test(struct bnx2x *bp)
        REG_WR(bp, TSDM_REG_ENABLE_IN1, 0x0);
        REG_WR(bp, TCM_REG_PRS_IFEN, 0x0);
        REG_WR(bp, CFC_REG_DEBUG0, 0x1);
-       NIG_WR(NIG_REG_PRS_REQ_IN_EN, 0x0);
+       REG_WR(bp, NIG_REG_PRS_REQ_IN_EN, 0x0);
 
        /* Write 0 to parser credits for CFC search request */
        REG_WR(bp, PRS_REG_CFC_SEARCH_INITIAL_CREDIT, 0x0);
@@ -5055,7 +5056,7 @@ static int bnx2x_int_mem_test(struct bnx2x *bp)
        REG_WR(bp, TSDM_REG_ENABLE_IN1, 0x7fffffff);
        REG_WR(bp, TCM_REG_PRS_IFEN, 0x1);
        REG_WR(bp, CFC_REG_DEBUG0, 0x0);
-       NIG_WR(NIG_REG_PRS_REQ_IN_EN, 0x1);
+       REG_WR(bp, NIG_REG_PRS_REQ_IN_EN, 0x1);
 
        DP(NETIF_MSG_HW, "done\n");
 
@@ -5144,11 +5145,6 @@ static int bnx2x_init_common(struct bnx2x *bp)
        REG_WR(bp, PXP2_REG_RD_CDURD_SWAP_MODE, 1);
 #endif
 
-#ifndef BCM_ISCSI
-               /* set NIC mode */
-               REG_WR(bp, PRS_REG_NIC_MODE, 1);
-#endif
-
        REG_WR(bp, PXP2_REG_RQ_CDU_P_SIZE, 2);
 #ifdef BCM_ISCSI
        REG_WR(bp, PXP2_REG_RQ_TM_P_SIZE, 5);
@@ -5218,6 +5214,8 @@ static int bnx2x_init_common(struct bnx2x *bp)
        }
 
        bnx2x_init_block(bp, PRS_COMMON_START, PRS_COMMON_END);
+       /* set NIC mode */
+       REG_WR(bp, PRS_REG_NIC_MODE, 1);
        if (CHIP_IS_E1H(bp))
                REG_WR(bp, PRS_REG_E1HOV_MODE, IS_E1HMF(bp));
 
@@ -5351,6 +5349,7 @@ static int bnx2x_init_common(struct bnx2x *bp)
        }
 
        switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) {
+       case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1021G:
        case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G:
                /* Fan failure is indicated by SPIO 5 */
                bnx2x_set_spio(bp, MISC_REGISTERS_SPIO_5,
@@ -5377,16 +5376,12 @@ static int bnx2x_init_common(struct bnx2x *bp)
 
        enable_blocks_attention(bp);
 
-       if (bp->flags & TPA_ENABLE_FLAG) {
-               struct tstorm_eth_tpa_exist tmp = {0};
-
-               tmp.tpa_exist = 1;
-
-               REG_WR(bp, BAR_TSTRORM_INTMEM + TSTORM_TPA_EXIST_OFFSET,
-                      ((u32 *)&tmp)[0]);
-               REG_WR(bp, BAR_TSTRORM_INTMEM + TSTORM_TPA_EXIST_OFFSET + 4,
-                      ((u32 *)&tmp)[1]);
-       }
+       if (!BP_NOMCP(bp)) {
+               bnx2x_acquire_phy_lock(bp);
+               bnx2x_common_init_phy(bp, bp->common.shmem_base);
+               bnx2x_release_phy_lock(bp);
+       } else
+               BNX2X_ERR("Bootcode is missing - can not initialize link\n");
 
        return 0;
 }
@@ -5538,6 +5533,7 @@ static int bnx2x_init_port(struct bnx2x *bp)
        /* Port DMAE comes here */
 
        switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) {
+       case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1021G:
        case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G:
                /* add SPIO 5 to group 0 */
                val = REG_RD(bp, MISC_REG_AEU_ENABLE1_FUNC_0_OUT_0);
@@ -6038,8 +6034,8 @@ static int bnx2x_req_msix_irqs(struct bnx2x *bp)
                                 bnx2x_msix_fp_int, 0,
                                 bp->dev->name, &bp->fp[i]);
                if (rc) {
-                       BNX2X_ERR("request fp #%d irq failed  rc %d\n",
-                                 i + offset, rc);
+                       BNX2X_ERR("request fp #%d irq failed  rc -%d\n",
+                                 i + offset, -rc);
                        bnx2x_free_msix_irqs(bp);
                        return -EBUSY;
                }
@@ -6062,11 +6058,49 @@ static int bnx2x_req_irq(struct bnx2x *bp)
        return rc;
 }
 
+static void bnx2x_napi_enable(struct bnx2x *bp)
+{
+       int i;
+
+       for_each_queue(bp, i)
+               napi_enable(&bnx2x_fp(bp, i, napi));
+}
+
+static void bnx2x_napi_disable(struct bnx2x *bp)
+{
+       int i;
+
+       for_each_queue(bp, i)
+               napi_disable(&bnx2x_fp(bp, i, napi));
+}
+
+static void bnx2x_netif_start(struct bnx2x *bp)
+{
+       if (atomic_dec_and_test(&bp->intr_sem)) {
+               if (netif_running(bp->dev)) {
+                       if (bp->state == BNX2X_STATE_OPEN)
+                               netif_wake_queue(bp->dev);
+                       bnx2x_napi_enable(bp);
+                       bnx2x_int_enable(bp);
+               }
+       }
+}
+
+static void bnx2x_netif_stop(struct bnx2x *bp)
+{
+       bnx2x_int_disable_sync(bp);
+       if (netif_running(bp->dev)) {
+               bnx2x_napi_disable(bp);
+               netif_tx_disable(bp->dev);
+               bp->dev->trans_start = jiffies; /* prevent tx timeout */
+       }
+}
+
 /*
  * Init service functions
  */
 
-static void bnx2x_set_mac_addr_e1(struct bnx2x *bp)
+static void bnx2x_set_mac_addr_e1(struct bnx2x *bp, int set)
 {
        struct mac_configuration_cmd *config = bnx2x_sp(bp, mac_config);
        int port = BP_PORT(bp);
@@ -6088,11 +6122,15 @@ static void bnx2x_set_mac_addr_e1(struct bnx2x *bp)
        config->config_table[0].cam_entry.lsb_mac_addr =
                                        swab16(*(u16 *)&bp->dev->dev_addr[4]);
        config->config_table[0].cam_entry.flags = cpu_to_le16(port);
-       config->config_table[0].target_table_entry.flags = 0;
+       if (set)
+               config->config_table[0].target_table_entry.flags = 0;
+       else
+               CAM_INVALIDATE(config->config_table[0]);
        config->config_table[0].target_table_entry.client_id = 0;
        config->config_table[0].target_table_entry.vlan_id = 0;
 
-       DP(NETIF_MSG_IFUP, "setting MAC (%04x:%04x:%04x)\n",
+       DP(NETIF_MSG_IFUP, "%s MAC (%04x:%04x:%04x)\n",
+          (set ? "setting" : "clearing"),
           config->config_table[0].cam_entry.msb_mac_addr,
           config->config_table[0].cam_entry.middle_mac_addr,
           config->config_table[0].cam_entry.lsb_mac_addr);
@@ -6102,8 +6140,11 @@ static void bnx2x_set_mac_addr_e1(struct bnx2x *bp)
        config->config_table[1].cam_entry.middle_mac_addr = 0xffff;
        config->config_table[1].cam_entry.lsb_mac_addr = 0xffff;
        config->config_table[1].cam_entry.flags = cpu_to_le16(port);
-       config->config_table[1].target_table_entry.flags =
+       if (set)
+               config->config_table[1].target_table_entry.flags =
                                TSTORM_CAM_TARGET_TABLE_ENTRY_BROADCAST;
+       else
+               CAM_INVALIDATE(config->config_table[1]);
        config->config_table[1].target_table_entry.client_id = 0;
        config->config_table[1].target_table_entry.vlan_id = 0;
 
@@ -6112,12 +6153,12 @@ static void bnx2x_set_mac_addr_e1(struct bnx2x *bp)
                      U64_LO(bnx2x_sp_mapping(bp, mac_config)), 0);
 }
 
-static void bnx2x_set_mac_addr_e1h(struct bnx2x *bp)
+static void bnx2x_set_mac_addr_e1h(struct bnx2x *bp, int set)
 {
        struct mac_configuration_cmd_e1h *config =
                (struct mac_configuration_cmd_e1h *)bnx2x_sp(bp, mac_config);
 
-       if (bp->state != BNX2X_STATE_OPEN) {
+       if (set && (bp->state != BNX2X_STATE_OPEN)) {
                DP(NETIF_MSG_IFUP, "state is %x, returning\n", bp->state);
                return;
        }
@@ -6141,9 +6182,14 @@ static void bnx2x_set_mac_addr_e1h(struct bnx2x *bp)
        config->config_table[0].client_id = BP_L_ID(bp);
        config->config_table[0].vlan_id = 0;
        config->config_table[0].e1hov_id = cpu_to_le16(bp->e1hov);
-       config->config_table[0].flags = BP_PORT(bp);
+       if (set)
+               config->config_table[0].flags = BP_PORT(bp);
+       else
+               config->config_table[0].flags =
+                               MAC_CONFIGURATION_ENTRY_E1H_ACTION_TYPE;
 
-       DP(NETIF_MSG_IFUP, "setting MAC (%04x:%04x:%04x)  E1HOV %d  CLID %d\n",
+       DP(NETIF_MSG_IFUP, "%s MAC (%04x:%04x:%04x)  E1HOV %d  CLID %d\n",
+          (set ? "setting" : "clearing"),
           config->config_table[0].msb_mac_addr,
           config->config_table[0].middle_mac_addr,
           config->config_table[0].lsb_mac_addr, bp->e1hov, BP_L_ID(bp));
@@ -6168,13 +6214,13 @@ static int bnx2x_wait_ramrod(struct bnx2x *bp, int state, int idx,
                        bnx2x_rx_int(bp->fp, 10);
                        /* if index is different from 0
                         * the reply for some commands will
-                        * be on the none default queue
+                        * be on the non default queue
                         */
                        if (idx)
                                bnx2x_rx_int(&bp->fp[idx], 10);
                }
-               mb(); /* state is changed by bnx2x_sp_event() */
 
+               mb(); /* state is changed by bnx2x_sp_event() */
                if (*state_p == state)
                        return 0;
 
@@ -6229,7 +6275,6 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
 {
        u32 load_code;
        int i, rc;
-
 #ifdef BNX2X_STOP_ON_ERROR
        if (unlikely(bp->panic))
                return -EPERM;
@@ -6334,7 +6379,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
        rc = bnx2x_init_hw(bp, load_code);
        if (rc) {
                BNX2X_ERR("HW init failed, aborting\n");
-               goto load_error;
+               goto load_int_disable;
        }
 
        /* Setup NIC internals and enable interrupts */
@@ -6346,7 +6391,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
                if (!load_code) {
                        BNX2X_ERR("MCP response failure, aborting\n");
                        rc = -EBUSY;
-                       goto load_int_disable;
+                       goto load_rings_free;
                }
        }
 
@@ -6356,8 +6401,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
 
        /* Enable Rx interrupt handling before sending the ramrod
           as it's completed on Rx FP queue */
-       for_each_queue(bp, i)
-               napi_enable(&bnx2x_fp(bp, i, napi));
+       bnx2x_napi_enable(bp);
 
        /* Enable interrupt handling */
        atomic_set(&bp->intr_sem, 0);
@@ -6365,7 +6409,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
        rc = bnx2x_setup_leading(bp);
        if (rc) {
                BNX2X_ERR("Setup leading failed!\n");
-               goto load_stop_netif;
+               goto load_netif_stop;
        }
 
        if (CHIP_IS_E1H(bp))
@@ -6378,13 +6422,13 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
                for_each_nondefault_queue(bp, i) {
                        rc = bnx2x_setup_multi(bp, i);
                        if (rc)
-                               goto load_stop_netif;
+                               goto load_netif_stop;
                }
 
        if (CHIP_IS_E1(bp))
-               bnx2x_set_mac_addr_e1(bp);
+               bnx2x_set_mac_addr_e1(bp, 1);
        else
-               bnx2x_set_mac_addr_e1h(bp);
+               bnx2x_set_mac_addr_e1h(bp, 1);
 
        if (bp->port.pmf)
                bnx2x_initial_phy_init(bp);
@@ -6423,21 +6467,17 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
 
        return 0;
 
-load_stop_netif:
+load_netif_stop:
+       bnx2x_napi_disable(bp);
+load_rings_free:
+       /* Free SKBs, SGEs, TPA pool and driver internals */
+       bnx2x_free_skbs(bp);
        for_each_queue(bp, i)
-               napi_disable(&bnx2x_fp(bp, i, napi));
-
+               bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE);
 load_int_disable:
        bnx2x_int_disable_sync(bp);
-
        /* Release IRQs */
        bnx2x_free_irq(bp);
-
-       /* Free SKBs, SGEs, TPA pool and driver internals */
-       bnx2x_free_skbs(bp);
-       for_each_queue(bp, i)
-               bnx2x_free_rx_sge_range(bp, bp->fp + i,
-                                       RX_SGE_CNT*NUM_RX_SGE_PAGES);
 load_error:
        bnx2x_free_mem(bp);
 
@@ -6499,7 +6539,6 @@ static int bnx2x_stop_leading(struct bnx2x *bp)
           so there is not much to do if this times out
         */
        while (dsb_sp_prod_idx == *bp->dsb_sp_prod) {
-               msleep(1);
                if (!cnt) {
                        DP(NETIF_MSG_IFDOWN, "timeout waiting for port del "
                           "dsb_sp_prod 0x%x != dsb_sp_prod_idx 0x%x\n",
@@ -6559,7 +6598,7 @@ static void bnx2x_reset_port(struct bnx2x *bp)
        val = REG_RD(bp, BRB1_REG_PORT_NUM_OCC_BLOCKS_0 + port*4);
        if (val)
                DP(NETIF_MSG_IFDOWN,
-                  "BRB1 is not empty  %d blooks are occupied\n", val);
+                  "BRB1 is not empty  %d blocks are occupied\n", val);
 
        /* TODO: Close Doorbell port? */
 }
@@ -6599,7 +6638,7 @@ static void bnx2x_reset_chip(struct bnx2x *bp, u32 reset_code)
        }
 }
 
-/* msut be called with rtnl_lock */
+/* must be called with rtnl_lock */
 static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
 {
        int port = BP_PORT(bp);
@@ -6611,11 +6650,9 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
        bp->rx_mode = BNX2X_RX_MODE_NONE;
        bnx2x_set_storm_rx_mode(bp);
 
-       if (netif_running(bp->dev)) {
-               netif_tx_disable(bp->dev);
-               bp->dev->trans_start = jiffies; /* prevent tx timeout */
-       }
-
+       bnx2x_netif_stop(bp);
+       if (!netif_running(bp->dev))
+               bnx2x_napi_disable(bp);
        del_timer_sync(&bp->timer);
        SHMEM_WR(bp, func_mb[BP_FUNC(bp)].drv_pulse_mb,
                 (DRV_PULSE_ALWAYS_ALIVE | bp->fw_drv_pulse_wr_seq));
@@ -6629,9 +6666,7 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
                smp_rmb();
                while (BNX2X_HAS_TX_WORK(fp)) {
 
-                       if (!netif_running(bp->dev))
-                               bnx2x_tx_int(fp, 1000);
-
+                       bnx2x_tx_int(fp, 1000);
                        if (!cnt) {
                                BNX2X_ERR("timeout waiting for queue[%d]\n",
                                          i);
@@ -6647,18 +6682,42 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
                        smp_rmb();
                }
        }
-
        /* Give HW time to discard old tx messages */
        msleep(1);
 
-       for_each_queue(bp, i)
-               napi_disable(&bnx2x_fp(bp, i, napi));
-       /* Disable interrupts after Tx and Rx are disabled on stack level */
-       bnx2x_int_disable_sync(bp);
-
        /* Release IRQs */
        bnx2x_free_irq(bp);
 
+       if (CHIP_IS_E1(bp)) {
+               struct mac_configuration_cmd *config =
+                                               bnx2x_sp(bp, mcast_config);
+
+               bnx2x_set_mac_addr_e1(bp, 0);
+
+               for (i = 0; i < config->hdr.length_6b; i++)
+                       CAM_INVALIDATE(config->config_table[i]);
+
+               config->hdr.length_6b = i;
+               if (CHIP_REV_IS_SLOW(bp))
+                       config->hdr.offset = BNX2X_MAX_EMUL_MULTI*(1 + port);
+               else
+                       config->hdr.offset = BNX2X_MAX_MULTICAST*(1 + port);
+               config->hdr.client_id = BP_CL_ID(bp);
+               config->hdr.reserved1 = 0;
+
+               bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_SET_MAC, 0,
+                             U64_HI(bnx2x_sp_mapping(bp, mcast_config)),
+                             U64_LO(bnx2x_sp_mapping(bp, mcast_config)), 0);
+
+       } else { /* E1H */
+               REG_WR(bp, NIG_REG_LLH0_FUNC_EN + port*8, 0);
+
+               bnx2x_set_mac_addr_e1h(bp, 0);
+
+               for (i = 0; i < MC_HASH_SIZE; i++)
+                       REG_WR(bp, MC_HASH_OFFSET(bp, i), 0);
+       }
+
        if (unload_mode == UNLOAD_NORMAL)
                reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
 
@@ -6676,20 +6735,17 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
                u8 entry = (BP_E1HVN(bp) + 1)*8;
 
                val = (mac_addr[0] << 8) | mac_addr[1];
-               EMAC_WR(EMAC_REG_EMAC_MAC_MATCH + entry, val);
+               EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry, val);
 
                val = (mac_addr[2] << 24) | (mac_addr[3] << 16) |
                      (mac_addr[4] << 8) | mac_addr[5];
-               EMAC_WR(EMAC_REG_EMAC_MAC_MATCH + entry + 4, val);
+               EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry + 4, val);
 
                reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_EN;
 
        } else
                reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
 
-       if (CHIP_IS_E1H(bp))
-               REG_WR(bp, NIG_REG_LLH0_FUNC_EN + port*8, 0);
-
        /* Close multi and leading connections
           Completions for ramrods are collected in a synchronous way */
        for_each_nondefault_queue(bp, i)
@@ -6738,8 +6794,7 @@ unload_error:
        /* Free SKBs, SGEs, TPA pool and driver internals */
        bnx2x_free_skbs(bp);
        for_each_queue(bp, i)
-               bnx2x_free_rx_sge_range(bp, bp->fp + i,
-                                       RX_SGE_CNT*NUM_RX_SGE_PAGES);
+               bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE);
        bnx2x_free_mem(bp);
 
        bp->state = BNX2X_STATE_CLOSED;
@@ -6792,6 +6847,10 @@ static void __devinit bnx2x_undi_unload(struct bnx2x *bp)
                 */
                bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_UNDI);
                val = REG_RD(bp, DORQ_REG_NORM_CID_OFST);
+               if (val == 0x7)
+                       REG_WR(bp, DORQ_REG_NORM_CID_OFST, 0);
+               bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI);
+
                if (val == 0x7) {
                        u32 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
                        /* save our func */
@@ -6869,13 +6928,13 @@ static void __devinit bnx2x_undi_unload(struct bnx2x *bp)
                               (SHMEM_RD(bp, func_mb[bp->func].drv_mb_header) &
                                DRV_MSG_SEQ_NUMBER_MASK);
                }
-               bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI);
        }
 }
 
 static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
 {
        u32 val, val2, val3, val4, id;
+       u16 pmc;
 
        /* Get the chip revision id and number. */
        /* chip num:16-31, rev:12-15, metal:4-11, bond_id:0-3 */
@@ -6933,8 +6992,16 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
                BNX2X_ERR("This driver needs bc_ver %X but found %X,"
                          " please upgrade BC\n", BNX2X_BC_VER, val);
        }
-       BNX2X_DEV_INFO("%sWoL Capable\n",
-                      (bp->flags & NO_WOL_FLAG)? "Not " : "");
+
+       if (BP_E1HVN(bp) == 0) {
+               pci_read_config_word(bp->pdev, bp->pm_cap + PCI_PM_PMC, &pmc);
+               bp->flags |= (pmc & PCI_PM_CAP_PME_D3cold) ? 0 : NO_WOL_FLAG;
+       } else {
+               /* no WOL capability for E1HVN != 0 */
+               bp->flags |= NO_WOL_FLAG;
+       }
+       BNX2X_DEV_INFO("%sWoL capable\n",
+                      (bp->flags & NO_WOL_FLAG) ? "Not " : "");
 
        val = SHMEM_RD(bp, dev_info.shared_hw_config.part_num);
        val2 = SHMEM_RD(bp, dev_info.shared_hw_config.part_num[4]);
@@ -7367,9 +7434,8 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp)
                bp->mf_config =
                        SHMEM_RD(bp, mf_cfg.func_mf_config[func].config);
 
-               val =
-                  (SHMEM_RD(bp, mf_cfg.func_mf_config[func].e1hov_tag) &
-                   FUNC_MF_CFG_E1HOV_TAG_MASK);
+               val = (SHMEM_RD(bp, mf_cfg.func_mf_config[func].e1hov_tag) &
+                      FUNC_MF_CFG_E1HOV_TAG_MASK);
                if (val != FUNC_MF_CFG_E1HOV_TAG_DEFAULT) {
 
                        bp->e1hov = val;
@@ -7417,7 +7483,7 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp)
 
        if (BP_NOMCP(bp)) {
                /* only supposed to happen on emulation/FPGA */
-               BNX2X_ERR("warning rendom MAC workaround active\n");
+               BNX2X_ERR("warning random MAC workaround active\n");
                random_ether_addr(bp->dev->dev_addr);
                memcpy(bp->dev->perm_addr, bp->dev->dev_addr, ETH_ALEN);
        }
@@ -7719,7 +7785,7 @@ static void bnx2x_get_drvinfo(struct net_device *dev,
                              struct ethtool_drvinfo *info)
 {
        struct bnx2x *bp = netdev_priv(dev);
-       char phy_fw_ver[PHY_FW_VER_LEN];
+       u8 phy_fw_ver[PHY_FW_VER_LEN];
 
        strcpy(info->driver, DRV_MODULE_NAME);
        strcpy(info->version, DRV_MODULE_VERSION);
@@ -7733,11 +7799,11 @@ static void bnx2x_get_drvinfo(struct net_device *dev,
                bnx2x_release_phy_lock(bp);
        }
 
-       snprintf(info->fw_version, 32, "%d.%d.%d:%d BC:%x%s%s",
-                BCM_5710_FW_MAJOR_VERSION, BCM_5710_FW_MINOR_VERSION,
-                BCM_5710_FW_REVISION_VERSION,
-                BCM_5710_FW_COMPILE_FLAGS, bp->common.bc_ver,
-                ((phy_fw_ver[0] != '\0')? " PHY:":""), phy_fw_ver);
+       snprintf(info->fw_version, 32, "BC:%d.%d.%d%s%s",
+                (bp->common.bc_ver & 0xff0000) >> 16,
+                (bp->common.bc_ver & 0xff00) >> 8,
+                (bp->common.bc_ver & 0xff),
+                ((phy_fw_ver[0] != '\0') ? " PHY:" : ""), phy_fw_ver);
        strcpy(info->bus_info, pci_name(bp->pdev));
        info->n_stats = BNX2X_NUM_STATS;
        info->testinfo_len = BNX2X_NUM_TESTS;
@@ -8242,33 +8308,6 @@ static int bnx2x_set_coalesce(struct net_device *dev,
        return 0;
 }
 
-static int bnx2x_set_flags(struct net_device *dev, u32 data)
-{
-       struct bnx2x *bp = netdev_priv(dev);
-       int changed = 0;
-       int rc = 0;
-
-       if (data & ETH_FLAG_LRO) {
-               if (!(dev->features & NETIF_F_LRO)) {
-                       dev->features |= NETIF_F_LRO;
-                       bp->flags |= TPA_ENABLE_FLAG;
-                       changed = 1;
-               }
-
-       } else if (dev->features & NETIF_F_LRO) {
-               dev->features &= ~NETIF_F_LRO;
-               bp->flags &= ~TPA_ENABLE_FLAG;
-               changed = 1;
-       }
-
-       if (changed && netif_running(dev)) {
-               bnx2x_nic_unload(bp, UNLOAD_NORMAL);
-               rc = bnx2x_nic_load(bp, LOAD_NORMAL);
-       }
-
-       return rc;
-}
-
 static void bnx2x_get_ringparam(struct net_device *dev,
                                struct ethtool_ringparam *ering)
 {
@@ -8351,7 +8390,7 @@ static int bnx2x_set_pauseparam(struct net_device *dev,
 
        if (epause->autoneg) {
                if (!(bp->port.supported & SUPPORTED_Autoneg)) {
-                       DP(NETIF_MSG_LINK, "Autoneg not supported\n");
+                       DP(NETIF_MSG_LINK, "autoneg not supported\n");
                        return -EINVAL;
                }
 
@@ -8370,6 +8409,34 @@ static int bnx2x_set_pauseparam(struct net_device *dev,
        return 0;
 }
 
+static int bnx2x_set_flags(struct net_device *dev, u32 data)
+{
+       struct bnx2x *bp = netdev_priv(dev);
+       int changed = 0;
+       int rc = 0;
+
+       /* TPA requires Rx CSUM offloading */
+       if ((data & ETH_FLAG_LRO) && bp->rx_csum) {
+               if (!(dev->features & NETIF_F_LRO)) {
+                       dev->features |= NETIF_F_LRO;
+                       bp->flags |= TPA_ENABLE_FLAG;
+                       changed = 1;
+               }
+
+       } else if (dev->features & NETIF_F_LRO) {
+               dev->features &= ~NETIF_F_LRO;
+               bp->flags &= ~TPA_ENABLE_FLAG;
+               changed = 1;
+       }
+
+       if (changed && netif_running(dev)) {
+               bnx2x_nic_unload(bp, UNLOAD_NORMAL);
+               rc = bnx2x_nic_load(bp, LOAD_NORMAL);
+       }
+
+       return rc;
+}
+
 static u32 bnx2x_get_rx_csum(struct net_device *dev)
 {
        struct bnx2x *bp = netdev_priv(dev);
@@ -8380,9 +8447,19 @@ static u32 bnx2x_get_rx_csum(struct net_device *dev)
 static int bnx2x_set_rx_csum(struct net_device *dev, u32 data)
 {
        struct bnx2x *bp = netdev_priv(dev);
+       int rc = 0;
 
        bp->rx_csum = data;
-       return 0;
+
+       /* Disable TPA, when Rx CSUM is disabled. Otherwise all
+          TPA'ed packets will be discarded due to wrong TCP CSUM */
+       if (!data) {
+               u32 flags = ethtool_op_get_flags(dev);
+
+               rc = bnx2x_set_flags(dev, (flags & ~ETH_FLAG_LRO));
+       }
+
+       return rc;
 }
 
 static int bnx2x_set_tso(struct net_device *dev, u32 data)
@@ -8420,6 +8497,7 @@ static int bnx2x_test_registers(struct bnx2x *bp)
 {
        int idx, i, rc = -ENODEV;
        u32 wr_val = 0;
+       int port = BP_PORT(bp);
        static const struct {
                u32  offset0;
                u32  offset1;
@@ -8485,7 +8563,6 @@ static int bnx2x_test_registers(struct bnx2x *bp)
 
                for (i = 0; reg_tbl[i].offset0 != 0xffffffff; i++) {
                        u32 offset, mask, save_val, val;
-                       int port = BP_PORT(bp);
 
                        offset = reg_tbl[i].offset0 + port*reg_tbl[i].offset1;
                        mask = reg_tbl[i].mask;
@@ -8531,16 +8608,17 @@ static int bnx2x_test_memory(struct bnx2x *bp)
        static const struct {
                char *name;
                u32 offset;
-               u32 mask;
+               u32 e1_mask;
+               u32 e1h_mask;
        } prty_tbl[] = {
-               { "CCM_REG_CCM_PRTY_STS",     CCM_REG_CCM_PRTY_STS,     0 },
-               { "CFC_REG_CFC_PRTY_STS",     CFC_REG_CFC_PRTY_STS,     0 },
-               { "DMAE_REG_DMAE_PRTY_STS",   DMAE_REG_DMAE_PRTY_STS,   0 },
-               { "TCM_REG_TCM_PRTY_STS",     TCM_REG_TCM_PRTY_STS,     0 },
-               { "UCM_REG_UCM_PRTY_STS",     UCM_REG_UCM_PRTY_STS,     0 },
-               { "XCM_REG_XCM_PRTY_STS",     XCM_REG_XCM_PRTY_STS,     0x1 },
-
-               { NULL, 0xffffffff, 0 }
+               { "CCM_PRTY_STS",  CCM_REG_CCM_PRTY_STS,   0x3ffc0, 0 },
+               { "CFC_PRTY_STS",  CFC_REG_CFC_PRTY_STS,   0x2,     0x2 },
+               { "DMAE_PRTY_STS", DMAE_REG_DMAE_PRTY_STS, 0,       0 },
+               { "TCM_PRTY_STS",  TCM_REG_TCM_PRTY_STS,   0x3ffc0, 0 },
+               { "UCM_PRTY_STS",  UCM_REG_UCM_PRTY_STS,   0x3ffc0, 0 },
+               { "XCM_PRTY_STS",  XCM_REG_XCM_PRTY_STS,   0x3ffc1, 0 },
+
+               { NULL, 0xffffffff, 0, 0 }
        };
 
        if (!netif_running(bp->dev))
@@ -8554,7 +8632,8 @@ static int bnx2x_test_memory(struct bnx2x *bp)
        /* Check the parity status */
        for (i = 0; prty_tbl[i].offset != 0xffffffff; i++) {
                val = REG_RD(bp, prty_tbl[i].offset);
-               if (val & ~(prty_tbl[i].mask)) {
+               if ((CHIP_IS_E1(bp) && (val & ~(prty_tbl[i].e1_mask))) ||
+                   (CHIP_IS_E1H(bp) && (val & ~(prty_tbl[i].e1h_mask)))) {
                        DP(NETIF_MSG_HW,
                           "%s is 0x%x\n", prty_tbl[i].name, val);
                        goto test_mem_exit;
@@ -8567,34 +8646,6 @@ test_mem_exit:
        return rc;
 }
 
-static void bnx2x_netif_start(struct bnx2x *bp)
-{
-       int i;
-
-       if (atomic_dec_and_test(&bp->intr_sem)) {
-               if (netif_running(bp->dev)) {
-                       bnx2x_int_enable(bp);
-                       for_each_queue(bp, i)
-                               napi_enable(&bnx2x_fp(bp, i, napi));
-                       if (bp->state == BNX2X_STATE_OPEN)
-                               netif_wake_queue(bp->dev);
-               }
-       }
-}
-
-static void bnx2x_netif_stop(struct bnx2x *bp)
-{
-       int i;
-
-       if (netif_running(bp->dev)) {
-               netif_tx_disable(bp->dev);
-               bp->dev->trans_start = jiffies; /* prevent tx timeout */
-               for_each_queue(bp, i)
-                       napi_disable(&bnx2x_fp(bp, i, napi));
-       }
-       bnx2x_int_disable_sync(bp);
-}
-
 static void bnx2x_wait_for_link(struct bnx2x *bp, u8 link_up)
 {
        int cnt = 1000;
@@ -8856,7 +8907,7 @@ static void bnx2x_self_test(struct net_device *dev,
        if (!netif_running(dev))
                return;
 
-       /* offline tests are not suppoerted in MF mode */
+       /* offline tests are not supported in MF mode */
        if (IS_E1HMF(bp))
                etest->flags &= ~ETH_TEST_FL_OFFLINE;
 
@@ -9165,7 +9216,7 @@ static int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state)
                                       PCI_PM_CTRL_PME_STATUS));
 
                if (pmcsr & PCI_PM_CTRL_STATE_MASK)
-               /* delay required during transition out of D3hot */
+                       /* delay required during transition out of D3hot */
                        msleep(20);
                break;
 
@@ -9200,6 +9251,7 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)
                                                 napi);
        struct bnx2x *bp = fp->bp;
        int work_done = 0;
+       u16 rx_cons_sb;
 
 #ifdef BNX2X_STOP_ON_ERROR
        if (unlikely(bp->panic))
@@ -9215,10 +9267,16 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)
        if (BNX2X_HAS_TX_WORK(fp))
                bnx2x_tx_int(fp, budget);
 
+       rx_cons_sb = le16_to_cpu(*fp->rx_cons_sb);
+       if ((rx_cons_sb & MAX_RCQ_DESC_CNT) == MAX_RCQ_DESC_CNT)
+               rx_cons_sb++;
        if (BNX2X_HAS_RX_WORK(fp))
                work_done = bnx2x_rx_int(fp, budget);
 
        rmb(); /* BNX2X_HAS_WORK() reads the status block */
+       rx_cons_sb = le16_to_cpu(*fp->rx_cons_sb);
+       if ((rx_cons_sb & MAX_RCQ_DESC_CNT) == MAX_RCQ_DESC_CNT)
+               rx_cons_sb++;
 
        /* must not complete if we consumed full budget */
        if ((work_done < budget) && !BNX2X_HAS_WORK(fp)) {
@@ -9238,7 +9296,7 @@ poll_panic:
 
 
 /* we split the first BD into headers and data BDs
- * to ease the pain of our fellow micocode engineers
+ * to ease the pain of our fellow microcode engineers
  * we use one mapping for both BDs
  * So far this has only been observed to happen
  * in Other Operating Systems(TM)
@@ -9345,7 +9403,7 @@ static int bnx2x_pkt_req_lin(struct bnx2x *bp, struct sk_buff *skb,
                        /* Check if LSO packet needs to be copied:
                           3 = 1 (for headers BD) + 2 (for PBD and last BD) */
                        int wnd_size = MAX_FETCH_BD - 3;
-                       /* Number of widnows to check */
+                       /* Number of windows to check */
                        int num_wnds = skb_shinfo(skb)->nr_frags - wnd_size;
                        int wnd_idx = 0;
                        int frag_idx = 0;
@@ -9447,7 +9505,7 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
           skb->ip_summed, skb->protocol, ipv6_hdr(skb)->nexthdr,
           ip_hdr(skb)->protocol, skb_shinfo(skb)->gso_type, xmit_type);
 
-       /* First, check if we need to linearaize the skb
+       /* First, check if we need to linearize the skb
           (due to FW restrictions) */
        if (bnx2x_pkt_req_lin(bp, skb, xmit_type)) {
                /* Statistics of linearization */
@@ -9479,7 +9537,8 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
        tx_bd->bd_flags.as_bitfield = ETH_TX_BD_FLAGS_START_BD;
        tx_bd->general_data = (UNICAST_ADDRESS <<
                               ETH_TX_BD_ETH_ADDR_TYPE_SHIFT);
-       tx_bd->general_data |= 1; /* header nbd */
+       /* header nbd */
+       tx_bd->general_data |= (1 << ETH_TX_BD_HDR_NBDS_SHIFT);
 
        /* remember the first BD of the packet */
        tx_buf->first_bd = fp->tx_bd_prod;
@@ -9558,7 +9617,7 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        tx_bd->addr_hi = cpu_to_le32(U64_HI(mapping));
        tx_bd->addr_lo = cpu_to_le32(U64_LO(mapping));
-       nbd = skb_shinfo(skb)->nr_frags + ((pbd == NULL)? 1 : 2);
+       nbd = skb_shinfo(skb)->nr_frags + ((pbd == NULL) ? 1 : 2);
        tx_bd->nbd = cpu_to_le16(nbd);
        tx_bd->nbytes = cpu_to_le16(skb_headlen(skb));
 
@@ -9828,9 +9887,9 @@ static int bnx2x_change_mac_addr(struct net_device *dev, void *p)
        memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
        if (netif_running(dev)) {
                if (CHIP_IS_E1(bp))
-                       bnx2x_set_mac_addr_e1(bp);
+                       bnx2x_set_mac_addr_e1(bp, 1);
                else
-                       bnx2x_set_mac_addr_e1h(bp);
+                       bnx2x_set_mac_addr_e1h(bp, 1);
        }
 
        return 0;
@@ -9841,6 +9900,7 @@ static int bnx2x_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
        struct mii_ioctl_data *data = if_mii(ifr);
        struct bnx2x *bp = netdev_priv(dev);
+       int port = BP_PORT(bp);
        int err;
 
        switch (cmd) {
@@ -9856,7 +9916,7 @@ static int bnx2x_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
                        return -EAGAIN;
 
                mutex_lock(&bp->port.phy_mutex);
-               err = bnx2x_cl45_read(bp, BP_PORT(bp), 0, bp->port.phy_addr,
+               err = bnx2x_cl45_read(bp, port, 0, bp->port.phy_addr,
                                      DEFAULT_PHY_DEV_ADDR,
                                      (data->reg_num & 0x1f), &mii_regval);
                data->val_out = mii_regval;
@@ -9872,7 +9932,7 @@ static int bnx2x_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
                        return -EAGAIN;
 
                mutex_lock(&bp->port.phy_mutex);
-               err = bnx2x_cl45_write(bp, BP_PORT(bp), 0, bp->port.phy_addr,
+               err = bnx2x_cl45_write(bp, port, 0, bp->port.phy_addr,
                                       DEFAULT_PHY_DEV_ADDR,
                                       (data->reg_num & 0x1f), data->val_in);
                mutex_unlock(&bp->port.phy_mutex);