]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/bnx2x/bnx2x_main.c
bnx2x: Do interrupt mode initialization and NAPIs adding before register_netdev()
[net-next-2.6.git] / drivers / net / bnx2x / bnx2x_main.c
index 2572eb40c0ed2a187112e1bf124d84e22755f1bc..f53edfd011bf09e05d51370f7ab70b1d2f58709d 100644 (file)
@@ -56,7 +56,6 @@
 #include "bnx2x_init_ops.h"
 #include "bnx2x_cmn.h"
 
-
 #include <linux/firmware.h>
 #include "bnx2x_fw_file_hdr.h"
 /* FW files */
@@ -404,7 +403,7 @@ static inline void storm_memset_hc_disable(struct bnx2x *bp, u8 port,
 /* used only at init
  * locking is done by mcp
  */
-void bnx2x_reg_wr_ind(struct bnx2x *bp, u32 addr, u32 val)
+static void bnx2x_reg_wr_ind(struct bnx2x *bp, u32 addr, u32 val)
 {
        pci_write_config_dword(bp->pdev, PCICFG_GRC_ADDRESS, addr);
        pci_write_config_dword(bp->pdev, PCICFG_GRC_DATA, val);
@@ -430,7 +429,8 @@ static u32 bnx2x_reg_rd_ind(struct bnx2x *bp, u32 addr)
 #define DMAE_DP_DST_PCI                "pci dst_addr [%x:%08x]"
 #define DMAE_DP_DST_NONE       "dst_addr [none]"
 
-void bnx2x_dp_dmae(struct bnx2x *bp, struct dmae_command *dmae, int msglvl)
+static void bnx2x_dp_dmae(struct bnx2x *bp, struct dmae_command *dmae,
+                         int msglvl)
 {
        u32 src_type = dmae->opcode & DMAE_COMMAND_SRC;
 
@@ -552,8 +552,9 @@ u32 bnx2x_dmae_opcode(struct bnx2x *bp, u8 src_type, u8 dst_type,
        return opcode;
 }
 
-void bnx2x_prep_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae,
-                              u8 src_type, u8 dst_type)
+static void bnx2x_prep_dmae_with_comp(struct bnx2x *bp,
+                                     struct dmae_command *dmae,
+                                     u8 src_type, u8 dst_type)
 {
        memset(dmae, 0, sizeof(struct dmae_command));
 
@@ -568,7 +569,8 @@ void bnx2x_prep_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae,
 }
 
 /* issue a dmae command over the init-channel and wailt for completion */
-int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae)
+static int bnx2x_issue_dmae_with_comp(struct bnx2x *bp,
+                                     struct dmae_command *dmae)
 {
        u32 *wb_comp = bnx2x_sp(bp, wb_comp);
        int cnt = CHIP_REV_IS_SLOW(bp) ? (400000) : 40;
@@ -675,8 +677,8 @@ void bnx2x_read_dmae(struct bnx2x *bp, u32 src_addr, u32 len32)
        bnx2x_issue_dmae_with_comp(bp, &dmae);
 }
 
-void bnx2x_write_dmae_phys_len(struct bnx2x *bp, dma_addr_t phys_addr,
-                              u32 addr, u32 len)
+static void bnx2x_write_dmae_phys_len(struct bnx2x *bp, dma_addr_t phys_addr,
+                                     u32 addr, u32 len)
 {
        int dmae_wr_max = DMAE_LEN32_WR_MAX(bp);
        int offset = 0;
@@ -1112,14 +1114,19 @@ static void bnx2x_hc_int_enable(struct bnx2x *bp)
                        HC_CONFIG_0_REG_INT_LINE_EN_0 |
                        HC_CONFIG_0_REG_ATTN_BIT_EN_0);
 
-               DP(NETIF_MSG_INTR, "write %x to HC %d (addr 0x%x)\n",
-                  val, port, addr);
+               if (!CHIP_IS_E1(bp)) {
+                       DP(NETIF_MSG_INTR, "write %x to HC %d (addr 0x%x)\n",
+                          val, port, addr);
 
-               REG_WR(bp, addr, val);
+                       REG_WR(bp, addr, val);
 
-               val &= ~HC_CONFIG_0_REG_MSI_MSIX_INT_EN_0;
+                       val &= ~HC_CONFIG_0_REG_MSI_MSIX_INT_EN_0;
+               }
        }
 
+       if (CHIP_IS_E1(bp))
+               REG_WR(bp, HC_REG_INT_MASK + port*4, 0x1FFFF);
+
        DP(NETIF_MSG_INTR, "write %x to HC %d (addr 0x%x)  mode %s\n",
           val, port, addr, (msix ? "MSI-X" : (msi ? "MSI" : "INTx")));
 
@@ -1213,10 +1220,26 @@ static void bnx2x_hc_int_disable(struct bnx2x *bp)
        u32 addr = port ? HC_REG_CONFIG_1 : HC_REG_CONFIG_0;
        u32 val = REG_RD(bp, addr);
 
-       val &= ~(HC_CONFIG_0_REG_SINGLE_ISR_EN_0 |
-                HC_CONFIG_0_REG_MSI_MSIX_INT_EN_0 |
-                HC_CONFIG_0_REG_INT_LINE_EN_0 |
-                HC_CONFIG_0_REG_ATTN_BIT_EN_0);
+       /*
+        * in E1 we must use only PCI configuration space to disable
+        * MSI/MSIX capablility
+        * It's forbitten to disable IGU_PF_CONF_MSI_MSIX_EN in HC block
+        */
+       if (CHIP_IS_E1(bp)) {
+               /*  Since IGU_PF_CONF_MSI_MSIX_EN still always on
+                *  Use mask register to prevent from HC sending interrupts
+                *  after we exit the function
+                */
+               REG_WR(bp, HC_REG_INT_MASK + port*4, 0);
+
+               val &= ~(HC_CONFIG_0_REG_SINGLE_ISR_EN_0 |
+                        HC_CONFIG_0_REG_INT_LINE_EN_0 |
+                        HC_CONFIG_0_REG_ATTN_BIT_EN_0);
+       } else
+               val &= ~(HC_CONFIG_0_REG_SINGLE_ISR_EN_0 |
+                        HC_CONFIG_0_REG_MSI_MSIX_INT_EN_0 |
+                        HC_CONFIG_0_REG_INT_LINE_EN_0 |
+                        HC_CONFIG_0_REG_ATTN_BIT_EN_0);
 
        DP(NETIF_MSG_INTR, "write %x to HC %d (addr 0x%x)\n",
           val, port, addr);
@@ -1247,7 +1270,7 @@ static void bnx2x_igu_int_disable(struct bnx2x *bp)
                BNX2X_ERR("BUG! proper val not read from IGU!\n");
 }
 
-void bnx2x_int_disable(struct bnx2x *bp)
+static void bnx2x_int_disable(struct bnx2x *bp)
 {
        if (bp->common.int_block == INT_BLOCK_HC)
                bnx2x_hc_int_disable(bp);
@@ -1325,7 +1348,6 @@ static bool bnx2x_trylock_hw_lock(struct bnx2x *bp, u32 resource)
        return false;
 }
 
-
 #ifdef BCM_CNIC
 static void bnx2x_cnic_cfc_comp(struct bnx2x *bp, int cid);
 #endif
@@ -1754,12 +1776,12 @@ void bnx2x_calc_fc_adv(struct bnx2x *bp)
                MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_MASK) {
        case MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_NONE:
                bp->port.advertising[cfg_idx] &= ~(ADVERTISED_Asym_Pause |
-                                         ADVERTISED_Pause);
+                                                  ADVERTISED_Pause);
                break;
 
        case MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH:
                bp->port.advertising[cfg_idx] |= (ADVERTISED_Asym_Pause |
-                                        ADVERTISED_Pause);
+                                                 ADVERTISED_Pause);
                break;
 
        case MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC:
@@ -1768,12 +1790,11 @@ void bnx2x_calc_fc_adv(struct bnx2x *bp)
 
        default:
                bp->port.advertising[cfg_idx] &= ~(ADVERTISED_Asym_Pause |
-                                         ADVERTISED_Pause);
+                                                  ADVERTISED_Pause);
                break;
        }
 }
 
-
 u8 bnx2x_initial_phy_init(struct bnx2x *bp, int load_mode)
 {
        if (!BP_NOMCP(bp)) {
@@ -1952,6 +1973,7 @@ static void bnx2x_init_vn_minmax(struct bnx2x *bp, int vn)
                vn_max_rate = ((vn_cfg & FUNC_MF_CFG_MAX_BW_MASK) >>
                                FUNC_MF_CFG_MAX_BW_SHIFT) * 100;
        }
+
        DP(NETIF_MSG_IFUP,
           "func %d: vn_min_rate %d  vn_max_rate %d  vn_weight_sum %d\n",
           func, vn_min_rate, vn_max_rate, bp->vn_weight_sum);
@@ -1991,6 +2013,7 @@ static void bnx2x_init_vn_minmax(struct bnx2x *bp, int vn)
                       XSTORM_FAIRNESS_PER_VN_VARS_OFFSET(func) + i * 4,
                       ((u32 *)(&m_fair_vn))[i]);
 }
+
 static int bnx2x_get_cmng_fns_mode(struct bnx2x *bp)
 {
        if (CHIP_REV_IS_SLOW(bp))
@@ -2216,7 +2239,7 @@ u32 bnx2x_fw_command(struct bnx2x *bp, u32 command, u32 param)
 }
 
 /* must be called under rtnl_lock */
-void bnx2x_rxq_set_mac_filters(struct bnx2x *bp, u16 cl_id, u32 filters)
+static void bnx2x_rxq_set_mac_filters(struct bnx2x *bp, u16 cl_id, u32 filters)
 {
        u32 mask = (1 << cl_id);
 
@@ -2283,37 +2306,33 @@ void bnx2x_rxq_set_mac_filters(struct bnx2x *bp, u16 cl_id, u32 filters)
                bp->mac_filters.unmatched_unicast & ~mask;
 }
 
-void bnx2x_func_init(struct bnx2x *bp, struct bnx2x_func_init_params *p)
+static void bnx2x_func_init(struct bnx2x *bp, struct bnx2x_func_init_params *p)
 {
-       if (FUNC_CONFIG(p->func_flgs)) {
-               struct tstorm_eth_function_common_config tcfg = {0};
+       struct tstorm_eth_function_common_config tcfg = {0};
+       u16 rss_flgs;
 
-               /* tpa */
-               if (p->func_flgs & FUNC_FLG_TPA)
-                       tcfg.config_flags |=
-                       TSTORM_ETH_FUNCTION_COMMON_CONFIG_ENABLE_TPA;
+       /* tpa */
+       if (p->func_flgs & FUNC_FLG_TPA)
+               tcfg.config_flags |=
+               TSTORM_ETH_FUNCTION_COMMON_CONFIG_ENABLE_TPA;
 
-               /* set rss flags */
-               if (p->func_flgs & FUNC_FLG_RSS) {
-                       u16 rss_flgs = (p->rss->mode <<
-                       TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT);
+       /* set rss flags */
+       rss_flgs = (p->rss->mode <<
+               TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT);
 
-                       if (p->rss->cap & RSS_IPV4_CAP)
-                               rss_flgs |= RSS_IPV4_CAP_MASK;
-                       if (p->rss->cap & RSS_IPV4_TCP_CAP)
-                               rss_flgs |= RSS_IPV4_TCP_CAP_MASK;
-                       if (p->rss->cap & RSS_IPV6_CAP)
-                               rss_flgs |= RSS_IPV6_CAP_MASK;
-                       if (p->rss->cap & RSS_IPV6_TCP_CAP)
-                               rss_flgs |= RSS_IPV6_TCP_CAP_MASK;
+       if (p->rss->cap & RSS_IPV4_CAP)
+               rss_flgs |= RSS_IPV4_CAP_MASK;
+       if (p->rss->cap & RSS_IPV4_TCP_CAP)
+               rss_flgs |= RSS_IPV4_TCP_CAP_MASK;
+       if (p->rss->cap & RSS_IPV6_CAP)
+               rss_flgs |= RSS_IPV6_CAP_MASK;
+       if (p->rss->cap & RSS_IPV6_TCP_CAP)
+               rss_flgs |= RSS_IPV6_TCP_CAP_MASK;
 
-                       tcfg.config_flags |= rss_flgs;
-                       tcfg.rss_result_mask = p->rss->result_mask;
+       tcfg.config_flags |= rss_flgs;
+       tcfg.rss_result_mask = p->rss->result_mask;
 
-               }
-
-               storm_memset_func_cfg(bp, &tcfg, p->func_id);
-       }
+       storm_memset_func_cfg(bp, &tcfg, p->func_id);
 
        /* Enable the function in the FW */
        storm_memset_vf_to_pf(bp, p->func_id, p->pf_id);
@@ -2355,10 +2374,8 @@ static inline u16 bnx2x_get_cl_flags(struct bnx2x *bp,
        flags |= QUEUE_FLG_HC;
        flags |= IS_MF(bp) ? QUEUE_FLG_OV : 0;
 
-#ifdef BCM_VLAN
        flags |= QUEUE_FLG_VLAN;
        DP(NETIF_MSG_IFUP, "vlan removal enabled\n");
-#endif
 
        if (!fp->disable_tpa)
                flags |= QUEUE_FLG_TPA;
@@ -2446,7 +2463,7 @@ static void bnx2x_pf_tx_cl_prep(struct bnx2x *bp,
        txq_init->hc_rate = bp->tx_ticks ? (1000000 / bp->tx_ticks) : 0;
 }
 
-void bnx2x_pf_init(struct bnx2x *bp)
+static void bnx2x_pf_init(struct bnx2x *bp)
 {
        struct bnx2x_func_init_params func_init = {0};
        struct bnx2x_rss_params rss = {0};
@@ -2480,22 +2497,17 @@ void bnx2x_pf_init(struct bnx2x *bp)
        else
                flags |= FUNC_FLG_TPA;
 
+       /* function setup */
+
        /**
         * Although RSS is meaningless when there is a single HW queue we
         * still need it enabled in order to have HW Rx hash generated.
-        *
-        * if (is_eth_multi(bp))
-        *      flags |= FUNC_FLG_RSS;
         */
-
-       /* function setup */
-       if (flags & FUNC_FLG_RSS) {
-               rss.cap = (RSS_IPV4_CAP | RSS_IPV4_TCP_CAP |
-                          RSS_IPV6_CAP | RSS_IPV6_TCP_CAP);
-               rss.mode = bp->multi_mode;
-               rss.result_mask = MULTI_MASK;
-               func_init.rss = &rss;
-       }
+       rss.cap = (RSS_IPV4_CAP | RSS_IPV4_TCP_CAP |
+                  RSS_IPV6_CAP | RSS_IPV6_TCP_CAP);
+       rss.mode = bp->multi_mode;
+       rss.result_mask = MULTI_MASK;
+       func_init.rss = &rss;
 
        func_init.func_flgs = flags;
        func_init.pf_id = BP_FUNC(bp);
@@ -2625,13 +2637,13 @@ static inline void bnx2x_sp_prod_update(struct bnx2x *bp)
        wmb();
 
        REG_WR16(bp, BAR_XSTRORM_INTMEM + XSTORM_SPQ_PROD_OFFSET(func),
-              bp->spq_prod_idx);
+                bp->spq_prod_idx);
        mmiowb();
 }
 
 /* the slow path queue is odd since completions arrive on the fastpath ring */
 int bnx2x_sp_post(struct bnx2x *bp, int command, int cid,
-                        u32 data_hi, u32 data_lo, int common)
+                 u32 data_hi, u32 data_lo, int common)
 {
        struct eth_spe *spe;
        u16 type;
@@ -3055,6 +3067,7 @@ static inline void bnx2x_attn_int_deasserted3(struct bnx2x *bp, u32 attn)
 #define RESET_DONE_FLAG_MASK   (~LOAD_COUNTER_MASK)
 #define RESET_DONE_FLAG_SHIFT  LOAD_COUNTER_BITS
 #define CHIP_PARITY_SUPPORTED(bp)   (CHIP_IS_E1(bp) || CHIP_IS_E1H(bp))
+
 /*
  * should be run under rtnl lock
  */
@@ -3918,7 +3931,7 @@ void bnx2x_setup_ndsb_state_machine(struct hc_status_block_sm *hc_sm,
        hc_sm->time_to_expire = 0xFFFFFFFF;
 }
 
-void bnx2x_init_sb(struct bnx2x *bp, dma_addr_t mapping, int vfid,
+static void bnx2x_init_sb(struct bnx2x *bp, dma_addr_t mapping, int vfid,
                          u8 vf_valid, int fw_sb_id, int igu_sb_id)
 {
        int igu_seg_id;
@@ -4376,7 +4389,6 @@ gunzip_nomem1:
 static void bnx2x_gunzip_end(struct bnx2x *bp)
 {
        kfree(bp->strm->workspace);
-
        kfree(bp->strm);
        bp->strm = NULL;
 
@@ -4641,6 +4653,7 @@ static void enable_blocks_attention(struct bnx2x *bp)
        REG_WR(bp, CCM_REG_CCM_INT_MASK, 0);
 /*     REG_WR(bp, CSEM_REG_CSEM_INT_MASK_0, 0); */
 /*     REG_WR(bp, CSEM_REG_CSEM_INT_MASK_1, 0); */
+
        if (CHIP_REV_IS_FPGA(bp))
                REG_WR(bp, PXP2_REG_PXP2_INT_MASK_0, 0x580000);
        else if (CHIP_IS_E2(bp))
@@ -4672,29 +4685,29 @@ static const struct {
        {PXP2_REG_PXP2_PRTY_MASK_1,     0x7f},
        {HC_REG_HC_PRTY_MASK,           0x7},
        {MISC_REG_MISC_PRTY_MASK,       0x1},
-       {QM_REG_QM_PRTY_MASK, 0x0},
-       {DORQ_REG_DORQ_PRTY_MASK, 0x0},
+       {QM_REG_QM_PRTY_MASK,           0x0},
+       {DORQ_REG_DORQ_PRTY_MASK,       0x0},
        {GRCBASE_UPB + PB_REG_PB_PRTY_MASK, 0x0},
        {GRCBASE_XPB + PB_REG_PB_PRTY_MASK, 0x0},
-       {SRC_REG_SRC_PRTY_MASK, 0x4}, /* bit 2 */
-       {CDU_REG_CDU_PRTY_MASK, 0x0},
-       {CFC_REG_CFC_PRTY_MASK, 0x0},
-       {DBG_REG_DBG_PRTY_MASK, 0x0},
-       {DMAE_REG_DMAE_PRTY_MASK, 0x0},
-       {BRB1_REG_BRB1_PRTY_MASK, 0x0},
-       {PRS_REG_PRS_PRTY_MASK, (1<<6)},/* bit 6 */
-       {TSDM_REG_TSDM_PRTY_MASK, 0x18},/* bit 3,4 */
-       {CSDM_REG_CSDM_PRTY_MASK, 0x8}, /* bit 3 */
-       {USDM_REG_USDM_PRTY_MASK, 0x38},/* bit 3,4,5 */
-       {XSDM_REG_XSDM_PRTY_MASK, 0x8}, /* bit 3 */
-       {TSEM_REG_TSEM_PRTY_MASK_0, 0x0},
-       {TSEM_REG_TSEM_PRTY_MASK_1, 0x0},
-       {USEM_REG_USEM_PRTY_MASK_0, 0x0},
-       {USEM_REG_USEM_PRTY_MASK_1, 0x0},
-       {CSEM_REG_CSEM_PRTY_MASK_0, 0x0},
-       {CSEM_REG_CSEM_PRTY_MASK_1, 0x0},
-       {XSEM_REG_XSEM_PRTY_MASK_0, 0x0},
-       {XSEM_REG_XSEM_PRTY_MASK_1, 0x0}
+       {SRC_REG_SRC_PRTY_MASK,         0x4}, /* bit 2 */
+       {CDU_REG_CDU_PRTY_MASK,         0x0},
+       {CFC_REG_CFC_PRTY_MASK,         0x0},
+       {DBG_REG_DBG_PRTY_MASK,         0x0},
+       {DMAE_REG_DMAE_PRTY_MASK,       0x0},
+       {BRB1_REG_BRB1_PRTY_MASK,       0x0},
+       {PRS_REG_PRS_PRTY_MASK,         (1<<6)},/* bit 6 */
+       {TSDM_REG_TSDM_PRTY_MASK,       0x18},  /* bit 3,4 */
+       {CSDM_REG_CSDM_PRTY_MASK,       0x8},   /* bit 3 */
+       {USDM_REG_USDM_PRTY_MASK,       0x38},  /* bit 3,4,5 */
+       {XSDM_REG_XSDM_PRTY_MASK,       0x8},   /* bit 3 */
+       {TSEM_REG_TSEM_PRTY_MASK_0,     0x0},
+       {TSEM_REG_TSEM_PRTY_MASK_1,     0x0},
+       {USEM_REG_USEM_PRTY_MASK_0,     0x0},
+       {USEM_REG_USEM_PRTY_MASK_1,     0x0},
+       {CSEM_REG_CSEM_PRTY_MASK_0,     0x0},
+       {CSEM_REG_CSEM_PRTY_MASK_1,     0x0},
+       {XSEM_REG_XSEM_PRTY_MASK_0,     0x0},
+       {XSEM_REG_XSEM_PRTY_MASK_1,     0x0}
 };
 
 static void enable_blocks_parity(struct bnx2x *bp)
@@ -4906,7 +4919,6 @@ static int bnx2x_init_hw_common(struct bnx2x *bp, u32 load_code)
 
        bnx2x_ilt_init_page_size(bp, INITOP_SET);
 
-
        if (CHIP_REV_IS_FPGA(bp) && CHIP_IS_E1H(bp))
                REG_WR(bp, PXP2_REG_PGL_TAGS_LIMIT, 0x1);
 
@@ -5003,6 +5015,7 @@ static int bnx2x_init_hw_common(struct bnx2x *bp, u32 load_code)
 
        if (CHIP_MODE_IS_4_PORT(bp))
                bnx2x_init_block(bp, QM_4PORT_BLOCK, COMMON_STAGE);
+
        /* QM queues pointers table */
        bnx2x_qm_init_ptr_table(bp, bp->qm_cid_count, INITOP_SET);
 
@@ -5036,6 +5049,7 @@ static int bnx2x_init_hw_common(struct bnx2x *bp, u32 load_code)
 #endif
        if (!CHIP_IS_E1(bp))
                REG_WR(bp, PRS_REG_E1HOV_MODE, IS_MF(bp));
+
        if (CHIP_IS_E2(bp)) {
                /* Bit-map indicating which L2 hdrs may appear after the
                   basic Ethernet header */
@@ -5081,6 +5095,7 @@ static int bnx2x_init_hw_common(struct bnx2x *bp, u32 load_code)
        REG_WR(bp, SRC_REG_SOFT_RST, 1);
        for (i = SRC_REG_KEYRSS0_0; i <= SRC_REG_KEYRSS1_9; i += 4)
                REG_WR(bp, i, random32());
+
        bnx2x_init_block(bp, SRCH_BLOCK, COMMON_STAGE);
 #ifdef BCM_CNIC
        REG_WR(bp, SRC_REG_KEYSEARCH_0, 0x63285672);
@@ -5443,7 +5458,8 @@ static int bnx2x_init_hw_func(struct bnx2x *bp)
        struct bnx2x_ilt *ilt = BP_ILT(bp);
        u16 cdu_ilt_start;
        u32 addr, val;
-       int i;
+       u32 main_mem_base, main_mem_size, main_mem_prty_clr;
+       int i, main_mem_width;
 
        DP(BNX2X_MSG_MCP, "starting func init  func %d\n", func);
 
@@ -5467,6 +5483,7 @@ static int bnx2x_init_hw_func(struct bnx2x *bp)
                set the size */
        }
        bnx2x_ilt_init_op(bp, INITOP_SET);
+
 #ifdef BCM_CNIC
        bnx2x_src_init_t2(bp, bp->t2, bp->t2_mapping, SRC_CONN_NUM);
 
@@ -5691,7 +5708,33 @@ static int bnx2x_init_hw_func(struct bnx2x *bp)
        bnx2x_init_block(bp, MCP_BLOCK, FUNC0_STAGE + func);
        bnx2x_init_block(bp, DMAE_BLOCK, FUNC0_STAGE + func);
 
+       if (CHIP_IS_E1x(bp)) {
+               main_mem_size = HC_REG_MAIN_MEMORY_SIZE / 2; /*dwords*/
+               main_mem_base = HC_REG_MAIN_MEMORY +
+                               BP_PORT(bp) * (main_mem_size * 4);
+               main_mem_prty_clr = HC_REG_HC_PRTY_STS_CLR;
+               main_mem_width = 8;
+
+               val = REG_RD(bp, main_mem_prty_clr);
+               if (val)
+                       DP(BNX2X_MSG_MCP, "Hmmm... Parity errors in HC "
+                                         "block during "
+                                         "function init (0x%x)!\n", val);
+
+               /* Clear "false" parity errors in MSI-X table */
+               for (i = main_mem_base;
+                    i < main_mem_base + main_mem_size * 4;
+                    i += main_mem_width) {
+                       bnx2x_read_dmae(bp, i, main_mem_width / 4);
+                       bnx2x_write_dmae(bp, bnx2x_sp_mapping(bp, wb_data),
+                                        i, main_mem_width / 4);
+               }
+               /* Clear HC parity attention */
+               REG_RD(bp, main_mem_prty_clr);
+       }
+
        bnx2x_phy_probe(&bp->link_params);
+
        return 0;
 }
 
@@ -5826,6 +5869,7 @@ void bnx2x_free_mem(struct bnx2x *bp)
        bnx2x_ilt_mem_op(bp, ILT_MEMOP_FREE);
 
        BNX2X_FREE(bp->ilt->lines);
+
 #ifdef BCM_CNIC
        if (CHIP_IS_E2(bp))
                BNX2X_PCI_FREE(bp->cnic_sb.e2_sb, bp->cnic_sb_mapping,
@@ -5833,8 +5877,10 @@ void bnx2x_free_mem(struct bnx2x *bp)
        else
                BNX2X_PCI_FREE(bp->cnic_sb.e1x_sb, bp->cnic_sb_mapping,
                               sizeof(struct host_hc_status_block_e1x));
+
        BNX2X_PCI_FREE(bp->t2, bp->t2_mapping, SRC_T2_SZ);
 #endif
+
        BNX2X_PCI_FREE(bp->spq, bp->spq_mapping, BCM_PAGE_SIZE);
 
        BNX2X_PCI_FREE(bp->eq_ring, bp->eq_mapping,
@@ -5862,7 +5908,6 @@ static inline void set_sb_shortcuts(struct bnx2x *bp, int index)
 
 int bnx2x_alloc_mem(struct bnx2x *bp)
 {
-
 #define BNX2X_PCI_ALLOC(x, y, size) \
        do { \
                x = dma_alloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \
@@ -5951,6 +5996,7 @@ int bnx2x_alloc_mem(struct bnx2x *bp)
                        sizeof(struct bnx2x_slowpath));
 
        bp->context.size = sizeof(union cdu_context) * bp->l2_cid_count;
+
        BNX2X_PCI_ALLOC(bp->context.vcxt, &bp->context.cxt_mapping,
                        bp->context.size);
 
@@ -5978,6 +6024,9 @@ alloc_mem_err:
 /*
  * Init service functions
  */
+static int bnx2x_wait_ramrod(struct bnx2x *bp, int state, int idx,
+                            int *state_p, int flags);
+
 int bnx2x_func_start(struct bnx2x *bp)
 {
        bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_FUNCTION_START, 0, 0, 0, 1);
@@ -5987,7 +6036,7 @@ int bnx2x_func_start(struct bnx2x *bp)
                                 WAIT_RAMROD_COMMON);
 }
 
-int bnx2x_func_stop(struct bnx2x *bp)
+static int bnx2x_func_stop(struct bnx2x *bp)
 {
        bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_FUNCTION_STOP, 0, 0, 0, 1);
 
@@ -5997,7 +6046,7 @@ int bnx2x_func_stop(struct bnx2x *bp)
 }
 
 /**
- * Sets a MAC in a CAM for a few L2 Clients for E1x chip
+ * Sets a MAC in a CAM for a few L2 Clients for E1x chips
  *
  * @param bp driver descriptor
  * @param set set or clear an entry (1 or 0)
@@ -6007,8 +6056,8 @@ int bnx2x_func_stop(struct bnx2x *bp)
  * @param is_bcast is the set MAC a broadcast address (for E1 only)
  */
 static void bnx2x_set_mac_addr_gen(struct bnx2x *bp, int set, u8 *mac,
-                                     u32 cl_bit_vec, u8 cam_offset,
-                                     u8 is_bcast)
+                                  u32 cl_bit_vec, u8 cam_offset,
+                                  u8 is_bcast)
 {
        struct mac_configuration_cmd *config =
                (struct mac_configuration_cmd *)bnx2x_sp(bp, mac_config);
@@ -6060,8 +6109,7 @@ static void bnx2x_set_mac_addr_gen(struct bnx2x *bp, int set, u8 *mac,
        bnx2x_wait_ramrod(bp, 0, 0, &bp->set_mac_pending, ramrod_flags);
 }
 
-
-int bnx2x_wait_ramrod(struct bnx2x *bp, int state, int idx,
+static int bnx2x_wait_ramrod(struct bnx2x *bp, int state, int idx,
                             int *state_p, int flags)
 {
        /* can take a while if any port is running */
@@ -6112,7 +6160,7 @@ int bnx2x_wait_ramrod(struct bnx2x *bp, int state, int idx,
        return -EBUSY;
 }
 
-u8 bnx2x_e1h_cam_offset(struct bnx2x *bp, u8 rel_offset)
+static u8 bnx2x_e1h_cam_offset(struct bnx2x *bp, u8 rel_offset)
 {
        if (CHIP_IS_E1H(bp))
                return E1H_FUNC_MAX * rel_offset + BP_FUNC(bp);
@@ -6220,7 +6268,6 @@ static void bnx2x_invlidate_e1_mc_list(struct bnx2x *bp)
 
 }
 
-
 #ifdef BCM_CNIC
 /**
  * Set iSCSI MAC(s) at the next enties in the CAM after the ETH
@@ -6232,7 +6279,7 @@ static void bnx2x_invlidate_e1_mc_list(struct bnx2x *bp)
  *
  * @return 0 if cussess, -ENODEV if ramrod doesn't return.
  */
-int bnx2x_set_iscsi_eth_mac_addr(struct bnx2x *bp, int set)
+static int bnx2x_set_iscsi_eth_mac_addr(struct bnx2x *bp, int set)
 {
        u8 cam_offset = (CHIP_IS_E1(bp) ? ((BP_PORT(bp) ? 32 : 0) + 2) :
                         bnx2x_e1h_cam_offset(bp, CAM_ISCSI_ETH_LINE));
@@ -6342,11 +6389,11 @@ static inline void bnx2x_set_ctx_validation(struct eth_context *cxt, u32 cid)
                                       ETH_CONNECTION_TYPE);
 }
 
-int bnx2x_setup_fw_client(struct bnx2x *bp,
-                         struct bnx2x_client_init_params *params,
-                         u8 activate,
-                         struct client_init_ramrod_data *data,
-                         dma_addr_t data_mapping)
+static int bnx2x_setup_fw_client(struct bnx2x *bp,
+                                struct bnx2x_client_init_params *params,
+                                u8 activate,
+                                struct client_init_ramrod_data *data,
+                                dma_addr_t data_mapping)
 {
        u16 hc_usec;
        int ramrod = RAMROD_CMD_ID_ETH_CLIENT_SETUP;
@@ -6462,6 +6509,12 @@ static int __devinit bnx2x_set_int_mode(struct bnx2x *bp)
        return rc;
 }
 
+/* must be called prioir to any HW initializations */
+static inline u16 bnx2x_cid_ilt_lines(struct bnx2x *bp)
+{
+       return L2_ILT_LINES(bp);
+}
+
 void bnx2x_ilt_set_info(struct bnx2x *bp)
 {
        struct ilt_client_info *ilt_client;
@@ -6558,6 +6611,7 @@ void bnx2x_ilt_set_info(struct bnx2x *bp)
        ilt_client->flags = (ILT_CLIENT_SKIP_INIT | ILT_CLIENT_SKIP_MEM);
 #endif
 }
+
 int bnx2x_setup_client(struct bnx2x *bp, struct bnx2x_fastpath *fp,
                       int is_leading)
 {
@@ -6585,7 +6639,8 @@ int bnx2x_setup_client(struct bnx2x *bp, struct bnx2x_fastpath *fp,
        return rc;
 }
 
-int bnx2x_stop_fw_client(struct bnx2x *bp, struct bnx2x_client_ramrod_params *p)
+static int bnx2x_stop_fw_client(struct bnx2x *bp,
+                               struct bnx2x_client_ramrod_params *p)
 {
        int rc;
 
@@ -6943,7 +6998,6 @@ void bnx2x_disable_close_the_gate(struct bnx2x *bp)
        }
 }
 
-
 /* Close gates #2, #3 and #4: */
 static void bnx2x_set_234_gates(struct bnx2x *bp, bool close)
 {
@@ -6989,15 +7043,13 @@ static void bnx2x_clp_reset_prep(struct bnx2x *bp, u32 *magic_val)
 static void bnx2x_clp_reset_done(struct bnx2x *bp, u32 magic_val)
 {
        /* Restore the `magic' bit value... */
-       /* u32 val = SHMEM_RD(bp, mf_cfg.shared_mf_config.clp_mb);
-       SHMEM_WR(bp, mf_cfg.shared_mf_config.clp_mb,
-               (val & (~SHARED_MF_CLP_MAGIC)) | magic_val); */
        u32 val = MF_CFG_RD(bp, shared_mf_config.clp_mb);
        MF_CFG_WR(bp, shared_mf_config.clp_mb,
                (val & (~SHARED_MF_CLP_MAGIC)) | magic_val);
 }
 
-/* Prepares for MCP reset: takes care of CLP configurations.
+/**
+ * Prepares for MCP reset: takes care of CLP configurations.
  *
  * @param bp
  * @param magic_val Old value of 'magic' bit.
@@ -7395,7 +7447,7 @@ reset_task_exit:
  * Init service functions
  */
 
-u32 bnx2x_get_pretend_reg(struct bnx2x *bp)
+static u32 bnx2x_get_pretend_reg(struct bnx2x *bp)
 {
        u32 base = PXP2_REG_PGL_PRETEND_FUNC_F0;
        u32 stride = PXP2_REG_PGL_PRETEND_FUNC_F1 - base;
@@ -7526,7 +7578,6 @@ static void __devinit bnx2x_undi_unload(struct bnx2x *bp)
                        bp->fw_seq =
                              (SHMEM_RD(bp, func_mb[bp->pf_num].drv_mb_header) &
                                DRV_MSG_SEQ_NUMBER_MASK);
-
                } else
                        bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI);
        }
@@ -7645,7 +7696,8 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
        }
        bp->link_params.feature_config_flags |=
                                (val >= REQ_BC_VER_4_VRFY_FIRST_PHY_OPT_MDL) ?
-               FEATURE_CONFIG_BC_SUPPORTS_OPT_MDL_VRFY : 0;
+                               FEATURE_CONFIG_BC_SUPPORTS_OPT_MDL_VRFY : 0;
+
        bp->link_params.feature_config_flags |=
                (val >= REQ_BC_VER_4_VRFY_SPECIFIC_PHY_OPT_MDL) ?
                FEATURE_CONFIG_BC_SUPPORTS_DUAL_PHY_OPT_MDL_VRFY : 0;
@@ -7762,7 +7814,7 @@ static void __devinit bnx2x_link_settings_supported(struct bnx2x *bp,
                           SHMEM_RD(bp,
                           dev_info.port_hw_config[port].external_phy_config2));
                        return;
-               }
+       }
 
        switch (switch_cfg) {
        case SWITCH_CFG_1G:
@@ -7775,7 +7827,6 @@ static void __devinit bnx2x_link_settings_supported(struct bnx2x *bp,
                bp->port.phy_addr = REG_RD(bp, NIG_REG_XGXS0_CTRL_PHY_ADDR +
                                           port*0x18);
                BNX2X_DEV_INFO("phy_addr 0x%x\n", bp->port.phy_addr);
-
                break;
 
        default:
@@ -7804,7 +7855,7 @@ static void __devinit bnx2x_link_settings_supported(struct bnx2x *bp,
                if (!(bp->link_params.speed_cap_mask[idx] &
                                        PORT_HW_CFG_SPEED_CAPABILITY_D0_1G))
                        bp->port.supported[idx] &= ~(SUPPORTED_1000baseT_Half |
-                                       SUPPORTED_1000baseT_Full);
+                                                    SUPPORTED_1000baseT_Full);
 
                if (!(bp->link_params.speed_cap_mask[idx] &
                                        PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G))
@@ -7838,41 +7889,41 @@ static void __devinit bnx2x_link_settings_requested(struct bnx2x *bp)
                bp->link_params.req_duplex[idx] = DUPLEX_FULL;
                link_config = bp->port.link_config[idx];
                switch (link_config & PORT_FEATURE_LINK_SPEED_MASK) {
-       case PORT_FEATURE_LINK_SPEED_AUTO:
+               case PORT_FEATURE_LINK_SPEED_AUTO:
                        if (bp->port.supported[idx] & SUPPORTED_Autoneg) {
                                bp->link_params.req_line_speed[idx] =
                                        SPEED_AUTO_NEG;
                                bp->port.advertising[idx] |=
                                        bp->port.supported[idx];
-               } else {
-                       /* force 10G, no AN */
+                       } else {
+                               /* force 10G, no AN */
                                bp->link_params.req_line_speed[idx] =
                                        SPEED_10000;
                                bp->port.advertising[idx] |=
                                        (ADVERTISED_10000baseT_Full |
-                                                ADVERTISED_FIBRE);
+                                        ADVERTISED_FIBRE);
                                continue;
-               }
-               break;
+                       }
+                       break;
 
-       case PORT_FEATURE_LINK_SPEED_10M_FULL:
+               case PORT_FEATURE_LINK_SPEED_10M_FULL:
                        if (bp->port.supported[idx] & SUPPORTED_10baseT_Full) {
                                bp->link_params.req_line_speed[idx] =
                                        SPEED_10;
                                bp->port.advertising[idx] |=
                                        (ADVERTISED_10baseT_Full |
-                                               ADVERTISED_TP);
-               } else {
-                       BNX2X_ERROR("NVRAM config error. "
-                                   "Invalid link_config 0x%x"
-                                   "  speed_cap_mask 0x%x\n",
-                                   link_config,
+                                        ADVERTISED_TP);
+                       } else {
+                               BNX2X_ERROR("NVRAM config error. "
+                                           "Invalid link_config 0x%x"
+                                           "  speed_cap_mask 0x%x\n",
+                                           link_config,
                                    bp->link_params.speed_cap_mask[idx]);
-                       return;
-               }
-               break;
+                               return;
+                       }
+                       break;
 
-       case PORT_FEATURE_LINK_SPEED_10M_HALF:
+               case PORT_FEATURE_LINK_SPEED_10M_HALF:
                        if (bp->port.supported[idx] & SUPPORTED_10baseT_Half) {
                                bp->link_params.req_line_speed[idx] =
                                        SPEED_10;
@@ -7880,70 +7931,74 @@ static void __devinit bnx2x_link_settings_requested(struct bnx2x *bp)
                                        DUPLEX_HALF;
                                bp->port.advertising[idx] |=
                                        (ADVERTISED_10baseT_Half |
-                                               ADVERTISED_TP);
-               } else {
-                       BNX2X_ERROR("NVRAM config error. "
-                                   "Invalid link_config 0x%x"
-                                   "  speed_cap_mask 0x%x\n",
-                                   link_config,
-                                   bp->link_params.speed_cap_mask[idx]);
-                       return;
-               }
-               break;
+                                        ADVERTISED_TP);
+                       } else {
+                               BNX2X_ERROR("NVRAM config error. "
+                                           "Invalid link_config 0x%x"
+                                           "  speed_cap_mask 0x%x\n",
+                                           link_config,
+                                         bp->link_params.speed_cap_mask[idx]);
+                               return;
+                       }
+                       break;
 
-       case PORT_FEATURE_LINK_SPEED_100M_FULL:
-                       if (bp->port.supported[idx] & SUPPORTED_100baseT_Full) {
+               case PORT_FEATURE_LINK_SPEED_100M_FULL:
+                       if (bp->port.supported[idx] &
+                           SUPPORTED_100baseT_Full) {
                                bp->link_params.req_line_speed[idx] =
                                        SPEED_100;
                                bp->port.advertising[idx] |=
                                        (ADVERTISED_100baseT_Full |
-                                               ADVERTISED_TP);
-               } else {
-                       BNX2X_ERROR("NVRAM config error. "
-                                   "Invalid link_config 0x%x"
-                                   "  speed_cap_mask 0x%x\n",
-                                   link_config,
-                                   bp->link_params.speed_cap_mask[idx]);
-                       return;
-               }
-               break;
+                                        ADVERTISED_TP);
+                       } else {
+                               BNX2X_ERROR("NVRAM config error. "
+                                           "Invalid link_config 0x%x"
+                                           "  speed_cap_mask 0x%x\n",
+                                           link_config,
+                                         bp->link_params.speed_cap_mask[idx]);
+                               return;
+                       }
+                       break;
 
-       case PORT_FEATURE_LINK_SPEED_100M_HALF:
-                       if (bp->port.supported[idx] & SUPPORTED_100baseT_Half) {
-                               bp->link_params.req_line_speed[idx] = SPEED_100;
-                               bp->link_params.req_duplex[idx] = DUPLEX_HALF;
+               case PORT_FEATURE_LINK_SPEED_100M_HALF:
+                       if (bp->port.supported[idx] &
+                           SUPPORTED_100baseT_Half) {
+                               bp->link_params.req_line_speed[idx] =
+                                                               SPEED_100;
+                               bp->link_params.req_duplex[idx] =
+                                                               DUPLEX_HALF;
                                bp->port.advertising[idx] |=
                                        (ADVERTISED_100baseT_Half |
-                                               ADVERTISED_TP);
-               } else {
-                       BNX2X_ERROR("NVRAM config error. "
+                                        ADVERTISED_TP);
+                       } else {
+                               BNX2X_ERROR("NVRAM config error. "
                                    "Invalid link_config 0x%x"
                                    "  speed_cap_mask 0x%x\n",
                                    link_config,
                                    bp->link_params.speed_cap_mask[idx]);
-                       return;
-               }
-               break;
+                               return;
+                       }
+                       break;
 
-       case PORT_FEATURE_LINK_SPEED_1G:
+               case PORT_FEATURE_LINK_SPEED_1G:
                        if (bp->port.supported[idx] &
                            SUPPORTED_1000baseT_Full) {
                                bp->link_params.req_line_speed[idx] =
                                        SPEED_1000;
                                bp->port.advertising[idx] |=
                                        (ADVERTISED_1000baseT_Full |
-                                               ADVERTISED_TP);
-               } else {
-                       BNX2X_ERROR("NVRAM config error. "
+                                        ADVERTISED_TP);
+                       } else {
+                               BNX2X_ERROR("NVRAM config error. "
                                    "Invalid link_config 0x%x"
                                    "  speed_cap_mask 0x%x\n",
                                    link_config,
                                    bp->link_params.speed_cap_mask[idx]);
-                       return;
-               }
-               break;
+                               return;
+                       }
+                       break;
 
-       case PORT_FEATURE_LINK_SPEED_2_5G:
+               case PORT_FEATURE_LINK_SPEED_2_5G:
                        if (bp->port.supported[idx] &
                            SUPPORTED_2500baseX_Full) {
                                bp->link_params.req_line_speed[idx] =
@@ -7951,19 +8006,19 @@ static void __devinit bnx2x_link_settings_requested(struct bnx2x *bp)
                                bp->port.advertising[idx] |=
                                        (ADVERTISED_2500baseX_Full |
                                                ADVERTISED_TP);
-               } else {
-                       BNX2X_ERROR("NVRAM config error. "
+                       } else {
+                               BNX2X_ERROR("NVRAM config error. "
                                    "Invalid link_config 0x%x"
                                    "  speed_cap_mask 0x%x\n",
                                    link_config,
-                                    bp->link_params.speed_cap_mask[idx]);
-                       return;
-               }
-               break;
+                                   bp->link_params.speed_cap_mask[idx]);
+                               return;
+                       }
+                       break;
 
-       case PORT_FEATURE_LINK_SPEED_10G_CX4:
-       case PORT_FEATURE_LINK_SPEED_10G_KX4:
-       case PORT_FEATURE_LINK_SPEED_10G_KR:
+               case PORT_FEATURE_LINK_SPEED_10G_CX4:
+               case PORT_FEATURE_LINK_SPEED_10G_KX4:
+               case PORT_FEATURE_LINK_SPEED_10G_KR:
                        if (bp->port.supported[idx] &
                            SUPPORTED_10000baseT_Full) {
                                bp->link_params.req_line_speed[idx] =
@@ -7971,24 +8026,26 @@ static void __devinit bnx2x_link_settings_requested(struct bnx2x *bp)
                                bp->port.advertising[idx] |=
                                        (ADVERTISED_10000baseT_Full |
                                                ADVERTISED_FIBRE);
-               } else {
-                       BNX2X_ERROR("NVRAM config error. "
+                       } else {
+                               BNX2X_ERROR("NVRAM config error. "
                                    "Invalid link_config 0x%x"
                                    "  speed_cap_mask 0x%x\n",
                                    link_config,
-                                    bp->link_params.speed_cap_mask[idx]);
-                       return;
-               }
-               break;
+                                   bp->link_params.speed_cap_mask[idx]);
+                               return;
+                       }
+                       break;
 
-       default:
-               BNX2X_ERROR("NVRAM config error. "
-                           "BAD link speed link_config 0x%x\n",
-                                 link_config);
-                       bp->link_params.req_line_speed[idx] = SPEED_AUTO_NEG;
-                       bp->port.advertising[idx] = bp->port.supported[idx];
-               break;
-       }
+               default:
+                       BNX2X_ERROR("NVRAM config error. "
+                                   "BAD link speed link_config 0x%x\n",
+                                         link_config);
+                               bp->link_params.req_line_speed[idx] =
+                                                       SPEED_AUTO_NEG;
+                               bp->port.advertising[idx] =
+                                               bp->port.supported[idx];
+                       break;
+               }
 
                bp->link_params.req_flow_ctrl[idx] = (link_config &
                                         PORT_FEATURE_FLOW_CONTROL_MASK);
@@ -8021,7 +8078,7 @@ static void __devinit bnx2x_get_port_hwinfo(struct bnx2x *bp)
        int port = BP_PORT(bp);
        u32 val, val2;
        u32 config;
-       u32 ext_phy_type, ext_phy_config;;
+       u32 ext_phy_type, ext_phy_config;
 
        bp->link_params.bp = bp;
        bp->link_params.port = port;
@@ -8050,14 +8107,14 @@ static void __devinit bnx2x_get_port_hwinfo(struct bnx2x *bp)
        bp->wol = (!(bp->flags & NO_WOL_FLAG) &&
                   (config & PORT_FEATURE_WOL_ENABLED));
 
-       BNX2X_DEV_INFO("lane_config 0x%08x"
+       BNX2X_DEV_INFO("lane_config 0x%08x  "
                       "speed_cap_mask0 0x%08x  link_config0 0x%08x\n",
                       bp->link_params.lane_config,
                       bp->link_params.speed_cap_mask[0],
                       bp->port.link_config[0]);
 
        bp->link_params.switch_cfg = (bp->port.link_config[0] &
-                                      PORT_FEATURE_CONNECTED_SWITCH_MASK);
+                                     PORT_FEATURE_CONNECTED_SWITCH_MASK);
        bnx2x_phy_probe(&bp->link_params);
        bnx2x_link_settings_supported(bp, bp->link_params.switch_cfg);
 
@@ -8452,12 +8509,10 @@ void bnx2x_set_rx_mode(struct net_device *dev)
 
        if (dev->flags & IFF_PROMISC)
                rx_mode = BNX2X_RX_MODE_PROMISC;
-
        else if ((dev->flags & IFF_ALLMULTI) ||
                 ((netdev_mc_count(dev) > BNX2X_MAX_MULTICAST) &&
                  CHIP_IS_E1(bp)))
                rx_mode = BNX2X_RX_MODE_ALLMULTI;
-
        else { /* some multicasts */
                if (CHIP_IS_E1(bp)) {
                        /*
@@ -8497,12 +8552,10 @@ void bnx2x_set_rx_mode(struct net_device *dev)
                }
        }
 
-
        bp->rx_mode = rx_mode;
        bnx2x_set_storm_rx_mode(bp);
 }
 
-
 /* called with rtnl_lock */
 static int bnx2x_mdio_read(struct net_device *netdev, int prtad,
                           int devad, u16 addr)
@@ -8582,9 +8635,6 @@ static const struct net_device_ops bnx2x_netdev_ops = {
        .ndo_do_ioctl           = bnx2x_ioctl,
        .ndo_change_mtu         = bnx2x_change_mtu,
        .ndo_tx_timeout         = bnx2x_tx_timeout,
-#ifdef BCM_VLAN
-       .ndo_vlan_rx_register   = bnx2x_vlan_rx_register,
-#endif
 #ifdef CONFIG_NET_POLL_CONTROLLER
        .ndo_poll_controller    = poll_bnx2x,
 #endif
@@ -8716,9 +8766,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
                dev->features |= NETIF_F_HIGHDMA;
        dev->features |= (NETIF_F_TSO | NETIF_F_TSO_ECN);
        dev->features |= NETIF_F_TSO6;
-#ifdef BCM_VLAN
        dev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
-       bp->flags |= (HW_VLAN_RX_FLAG | HW_VLAN_TX_FLAG);
 
        dev->vlan_features |= NETIF_F_SG;
        dev->vlan_features |= NETIF_F_HW_CSUM;
@@ -8726,7 +8774,6 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
                dev->vlan_features |= NETIF_F_HIGHDMA;
        dev->vlan_features |= (NETIF_F_TSO | NETIF_F_TSO_ECN);
        dev->vlan_features |= NETIF_F_TSO6;
-#endif
 
        /* get_port_hwinfo() will set prtad and mmds properly */
        bp->mdio.prtad = MDIO_PRTAD_NONE;
@@ -8993,6 +9040,7 @@ static inline int bnx2x_set_qm_cid_count(struct bnx2x *bp, int l2_cid_count)
 #endif
        return roundup(cid_count, QM_CID_ROUND);
 }
+
 static int __devinit bnx2x_init_one(struct pci_dev *pdev,
                                    const struct pci_device_id *ent)
 {
@@ -9016,10 +9064,11 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
        default:
                pr_err("Unknown board_type (%ld), aborting\n",
                           ent->driver_data);
-               return ENODEV;
+               return -ENODEV;
        }
 
        cid_count += CNIC_CONTEXT_USE;
+
        /* dev zeroed in init_etherdev */
        dev = alloc_etherdev_mq(sizeof(*bp), cid_count);
        if (!dev) {
@@ -9047,12 +9096,6 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
        /* calc qm_cid_count */
        bp->qm_cid_count = bnx2x_set_qm_cid_count(bp, cid_count);
 
-       rc = register_netdev(dev);
-       if (rc) {
-               dev_err(&pdev->dev, "Cannot register net device\n");
-               goto init_one_exit;
-       }
-
        /* Configure interupt mode: try to enable MSI-X/MSI if
         * needed, set bp->num_queues appropriately.
         */
@@ -9061,6 +9104,12 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
        /* Add all NAPI objects */
        bnx2x_add_all_napi(bp);
 
+       rc = register_netdev(dev);
+       if (rc) {
+               dev_err(&pdev->dev, "Cannot register net device\n");
+               goto init_one_exit;
+       }
+
        bnx2x_get_pcie_width_speed(bp, &pcie_width, &pcie_speed);
 
        netdev_info(dev, "%s (%c%d) PCI-E x%d %s found at mem %lx,"
@@ -9111,6 +9160,7 @@ static void __devexit bnx2x_remove_one(struct pci_dev *pdev)
 
        /* Disable MSI/MSI-X */
        bnx2x_disable_msi(bp);
+
        /* Make sure RESET task is not scheduled before continuing */
        cancel_delayed_work_sync(&bp->reset_task);
 
@@ -9347,19 +9397,53 @@ static void bnx2x_cnic_sp_post(struct bnx2x *bp, int count)
 #endif
 
        spin_lock_bh(&bp->spq_lock);
+       BUG_ON(bp->cnic_spq_pending < count);
        bp->cnic_spq_pending -= count;
 
-       for (; bp->cnic_spq_pending < bp->cnic_eth_dev.max_kwqe_pending;
-            bp->cnic_spq_pending++) {
 
-               if (!bp->cnic_kwq_pending)
+       for (; bp->cnic_kwq_pending; bp->cnic_kwq_pending--) {
+               u16 type =  (le16_to_cpu(bp->cnic_kwq_cons->hdr.type)
+                               & SPE_HDR_CONN_TYPE) >>
+                               SPE_HDR_CONN_TYPE_SHIFT;
+
+               /* Set validation for iSCSI L2 client before sending SETUP
+                *  ramrod
+                */
+               if (type == ETH_CONNECTION_TYPE) {
+                       u8 cmd = (le32_to_cpu(bp->cnic_kwq_cons->
+                                            hdr.conn_and_cmd_data) >>
+                               SPE_HDR_CMD_ID_SHIFT) & 0xff;
+
+                       if (cmd == RAMROD_CMD_ID_ETH_CLIENT_SETUP)
+                               bnx2x_set_ctx_validation(&bp->context.
+                                               vcxt[BNX2X_ISCSI_ETH_CID].eth,
+                                       HW_CID(bp, BNX2X_ISCSI_ETH_CID));
+               }
+
+               /* There may be not more than 8 L2 and COMMON SPEs and not more
+                * than 8 L5 SPEs in the air.
+                */
+               if ((type == NONE_CONNECTION_TYPE) ||
+                   (type == ETH_CONNECTION_TYPE)) {
+                       if (!atomic_read(&bp->spq_left))
+                               break;
+                       else
+                               atomic_dec(&bp->spq_left);
+               } else if (type == ISCSI_CONNECTION_TYPE) {
+                       if (bp->cnic_spq_pending >=
+                           bp->cnic_eth_dev.max_kwqe_pending)
+                               break;
+                       else
+                               bp->cnic_spq_pending++;
+               } else {
+                       BNX2X_ERR("Unknown SPE type: %d\n", type);
+                       bnx2x_panic();
                        break;
+               }
 
                spe = bnx2x_sp_get_next(bp);
                *spe = *bp->cnic_kwq_cons;
 
-               bp->cnic_kwq_pending--;
-
                DP(NETIF_MSG_TIMER, "pending on SPQ %d, on KWQ %d count %d\n",
                   bp->cnic_spq_pending, bp->cnic_kwq_pending, count);
 
@@ -9464,7 +9548,7 @@ static void bnx2x_cnic_cfc_comp(struct bnx2x *bp, int cid)
        ctl.data.comp.cid = cid;
 
        bnx2x_cnic_ctl_send_bh(bp, &ctl);
-       bnx2x_cnic_sp_post(bp, 1);
+       bnx2x_cnic_sp_post(bp, 0);
 }
 
 static int bnx2x_drv_ctl(struct net_device *dev, struct drv_ctl_info *ctl)
@@ -9481,8 +9565,8 @@ static int bnx2x_drv_ctl(struct net_device *dev, struct drv_ctl_info *ctl)
                break;
        }
 
-       case DRV_CTL_COMPLETION_CMD: {
-               int count = ctl->data.comp.comp_count;
+       case DRV_CTL_RET_L5_SPQ_CREDIT_CMD: {
+               int count = ctl->data.credit.credit_count;
 
                bnx2x_cnic_sp_post(bp, count);
                break;
@@ -9528,6 +9612,14 @@ static int bnx2x_drv_ctl(struct net_device *dev, struct drv_ctl_info *ctl)
                bnx2x_set_iscsi_eth_mac_addr(bp, 0);
                break;
        }
+       case DRV_CTL_RET_L2_SPQ_CREDIT_CMD: {
+               int count = ctl->data.credit.credit_count;
+
+               smp_mb__before_atomic_inc();
+               atomic_add(count, &bp->spq_left);
+               smp_mb__after_atomic_inc();
+               break;
+       }
 
        default:
                BNX2X_ERR("unknown command %x\n", ctl->cmd);
@@ -9592,13 +9684,8 @@ static int bnx2x_register_cnic(struct net_device *dev, struct cnic_ops *ops,
        cp->drv_state = CNIC_DRV_STATE_REGD;
        cp->iro_arr = bp->iro_arr;
 
-       bnx2x_init_sb(bp, bp->cnic_sb_mapping,
-                     BNX2X_VF_ID_INVALID, false,
-                     CNIC_SB_ID(bp), CNIC_IGU_SB_ID(bp));
-
        bnx2x_setup_cnic_irq_info(bp);
-       bnx2x_set_iscsi_eth_mac_addr(bp, 1);
-       bp->cnic_flags |= BNX2X_CNIC_FLAG_MAC_SET;
+
        rcu_assign_pointer(bp->cnic_ops, ops);
 
        return 0;
@@ -9636,14 +9723,23 @@ struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev)
        cp->io_base2 = bp->doorbells;
        cp->max_kwqe_pending = 8;
        cp->ctx_blk_size = CDU_ILT_PAGE_SZ;
-       cp->ctx_tbl_offset = FUNC_ILT_BASE(BP_FUNC(bp)) + 1;
+       cp->ctx_tbl_offset = FUNC_ILT_BASE(BP_FUNC(bp)) +
+                            bnx2x_cid_ilt_lines(bp);
        cp->ctx_tbl_len = CNIC_ILT_LINES;
-       cp->starting_cid = BCM_CNIC_CID_START;
+       cp->starting_cid = bnx2x_cid_ilt_lines(bp) * ILT_PAGE_CIDS;
        cp->drv_submit_kwqes_16 = bnx2x_cnic_sp_queue;
        cp->drv_ctl = bnx2x_drv_ctl;
        cp->drv_register_cnic = bnx2x_register_cnic;
        cp->drv_unregister_cnic = bnx2x_unregister_cnic;
-
+       cp->iscsi_l2_client_id = BNX2X_ISCSI_ETH_CL_ID;
+       cp->iscsi_l2_cid = BNX2X_ISCSI_ETH_CID;
+
+       DP(BNX2X_MSG_SP, "page_size %d, tbl_offset %d, tbl_lines %d, "
+                        "starting cid %d\n",
+          cp->ctx_blk_size,
+          cp->ctx_tbl_offset,
+          cp->ctx_tbl_len,
+          cp->starting_cid);
        return cp;
 }
 EXPORT_SYMBOL(bnx2x_cnic_probe);