net/qede/base: update MFW when default MTU is changed
[dpdk.git] / drivers / net / qede / base / ecore_dev.c
index 58b9387..13e13ba 100644 (file)
@@ -70,28 +70,26 @@ static u32 ecore_hw_bar_size(struct ecore_hwfn *p_hwfn, enum BAR_ID bar_id)
        }
 
        val = ecore_rd(p_hwfn, p_hwfn->p_main_ptt, bar_reg);
+       if (val)
+               return 1 << (val + 15);
 
        /* The above registers were updated in the past only in CMT mode. Since
         * they were found to be useful MFW started updating them from 8.7.7.0.
         * In older MFW versions they are set to 0 which means disabled.
         */
-       if (!val) {
-               if (p_hwfn->p_dev->num_hwfns > 1) {
-                       DP_NOTICE(p_hwfn, false,
-                                 "BAR size not configured. Assuming BAR size");
-                       DP_NOTICE(p_hwfn, false,
-                                 "of 256kB for GRC and 512kB for DB\n");
-                       return BAR_ID_0 ? 256 * 1024 : 512 * 1024;
-               } else {
-                       DP_NOTICE(p_hwfn, false,
-                                 "BAR size not configured. Assuming BAR size");
-                       DP_NOTICE(p_hwfn, false,
-                                 "of 512kB for GRC and 512kB for DB\n");
-                       return 512 * 1024;
-               }
+       if (p_hwfn->p_dev->num_hwfns > 1) {
+               DP_NOTICE(p_hwfn, false,
+                         "BAR size not configured. Assuming BAR size of 256kB"
+                         " for GRC and 512kB for DB\n");
+               val = BAR_ID_0 ? 256 * 1024 : 512 * 1024;
+       } else {
+               DP_NOTICE(p_hwfn, false,
+                         "BAR size not configured. Assuming BAR size of 512kB"
+                         " for GRC and 512kB for DB\n");
+               val = 512 * 1024;
        }
 
-       return 1 << (val + 15);
+       return val;
 }
 
 void ecore_init_dp(struct ecore_dev *p_dev,
@@ -138,13 +136,9 @@ static void ecore_qm_info_free(struct ecore_hwfn *p_hwfn)
        struct ecore_qm_info *qm_info = &p_hwfn->qm_info;
 
        OSAL_FREE(p_hwfn->p_dev, qm_info->qm_pq_params);
-       qm_info->qm_pq_params = OSAL_NULL;
        OSAL_FREE(p_hwfn->p_dev, qm_info->qm_vport_params);
-       qm_info->qm_vport_params = OSAL_NULL;
        OSAL_FREE(p_hwfn->p_dev, qm_info->qm_port_params);
-       qm_info->qm_port_params = OSAL_NULL;
        OSAL_FREE(p_hwfn->p_dev, qm_info->wfq_data);
-       qm_info->wfq_data = OSAL_NULL;
 }
 
 void ecore_resc_free(struct ecore_dev *p_dev)
@@ -155,7 +149,6 @@ void ecore_resc_free(struct ecore_dev *p_dev)
                return;
 
        OSAL_FREE(p_dev, p_dev->fw_data);
-       p_dev->fw_data = OSAL_NULL;
 
        OSAL_FREE(p_dev, p_dev->reset_stats);
 
@@ -163,9 +156,7 @@ void ecore_resc_free(struct ecore_dev *p_dev)
                struct ecore_hwfn *p_hwfn = &p_dev->hwfns[i];
 
                OSAL_FREE(p_dev, p_hwfn->p_tx_cids);
-               p_hwfn->p_tx_cids = OSAL_NULL;
                OSAL_FREE(p_dev, p_hwfn->p_rx_cids);
-               p_hwfn->p_rx_cids = OSAL_NULL;
        }
 
        for_each_hwfn(p_dev, i) {
@@ -542,11 +533,14 @@ enum _ecore_status_t ecore_resc_alloc(struct ecore_dev *p_dev)
        /* Allocate Memory for the Queue->CID mapping */
        for_each_hwfn(p_dev, i) {
                struct ecore_hwfn *p_hwfn = &p_dev->hwfns[i];
+               u32 num_tx_conns = RESC_NUM(p_hwfn, ECORE_L2_QUEUE);
+               int tx_size, rx_size;
 
                /* @@@TMP - resc management, change to actual required size */
-               int tx_size = sizeof(struct ecore_hw_cid_data) *
-                   RESC_NUM(p_hwfn, ECORE_L2_QUEUE);
-               int rx_size = sizeof(struct ecore_hw_cid_data) *
+               if (p_hwfn->pf_params.eth_pf_params.num_cons > num_tx_conns)
+                       num_tx_conns = p_hwfn->pf_params.eth_pf_params.num_cons;
+               tx_size = sizeof(struct ecore_hw_cid_data) * num_tx_conns;
+               rx_size = sizeof(struct ecore_hw_cid_data) *
                    RESC_NUM(p_hwfn, ECORE_L2_QUEUE);
 
                p_hwfn->p_tx_cids = OSAL_ZALLOC(p_hwfn->p_dev, GFP_KERNEL,
@@ -647,19 +641,20 @@ enum _ecore_status_t ecore_resc_alloc(struct ecore_dev *p_dev)
                                    ecore_cxt_get_proto_cid_count(
                                                p_hwfn,
                                                PROTOCOLID_ROCE,
-                                               0);
+                                               OSAL_NULL);
                                num_cons *= 2;
                        } else {
                                num_cons = ecore_cxt_get_proto_cid_count(
                                                p_hwfn,
                                                PROTOCOLID_IWARP,
-                                               0);
+                                               OSAL_NULL);
                        }
                        n_eqes += num_cons + 2 * MAX_NUM_VFS_BB;
                } else if (p_hwfn->hw_info.personality == ECORE_PCI_ISCSI) {
                        num_cons =
                            ecore_cxt_get_proto_cid_count(p_hwfn,
-                                                         PROTOCOLID_ISCSI, 0);
+                                                         PROTOCOLID_ISCSI,
+                                                         OSAL_NULL);
                        n_eqes += 2 * num_cons;
                }
 
@@ -667,8 +662,7 @@ enum _ecore_status_t ecore_resc_alloc(struct ecore_dev *p_dev)
                        DP_ERR(p_hwfn, "Cannot allocate 0x%x EQ elements."
                                       "The maximum of a u16 chain is 0x%x\n",
                               n_eqes, 0xFFFF);
-                       rc = ECORE_INVAL;
-                       goto alloc_err;
+                       goto alloc_no_mem;
                }
 
                p_eq = ecore_eq_alloc(p_hwfn, (u16)n_eqes);
@@ -708,7 +702,7 @@ enum _ecore_status_t ecore_resc_alloc(struct ecore_dev *p_dev)
        }
 
        p_dev->reset_stats = OSAL_ZALLOC(p_dev, GFP_KERNEL,
-                                        sizeof(struct ecore_eth_stats));
+                                        sizeof(*p_dev->reset_stats));
        if (!p_dev->reset_stats) {
                DP_NOTICE(p_dev, true, "Failed to allocate reset statistics\n");
                goto alloc_no_mem;
@@ -795,10 +789,9 @@ enum _ecore_status_t ecore_final_cleanup(struct ecore_hwfn *p_hwfn,
 
        DP_VERBOSE(p_hwfn, ECORE_MSG_IOV,
                   "Sending final cleanup for PFVF[%d] [Command %08x\n]",
-                  id, OSAL_CPU_TO_LE32(command));
+                  id, command);
 
-       ecore_wr(p_hwfn, p_ptt, XSDM_REG_OPERATION_GEN,
-                OSAL_CPU_TO_LE32(command));
+       ecore_wr(p_hwfn, p_ptt, XSDM_REG_OPERATION_GEN, command);
 
        /* Poll until completion */
        while (!REG_RD(p_hwfn, addr) && count--)
@@ -820,10 +813,8 @@ static enum _ecore_status_t ecore_calc_hw_mode(struct ecore_hwfn *p_hwfn)
 {
        int hw_mode = 0;
 
-       if (ECORE_IS_BB_A0(p_hwfn->p_dev)) {
-               hw_mode |= 1 << MODE_BB_A0;
-       } else if (ECORE_IS_BB_B0(p_hwfn->p_dev)) {
-               hw_mode |= 1 << MODE_BB_B0;
+       if (ECORE_IS_BB_B0(p_hwfn->p_dev)) {
+               hw_mode |= 1 << MODE_BB;
        } else if (ECORE_IS_AH(p_hwfn->p_dev)) {
                hw_mode |= 1 << MODE_K2;
        } else {
@@ -878,11 +869,6 @@ static enum _ecore_status_t ecore_calc_hw_mode(struct ecore_hwfn *p_hwfn)
 #endif
                hw_mode |= 1 << MODE_ASIC;
 
-#ifndef REAL_ASIC_ONLY
-       if (ENABLE_EAGLE_ENG1_WORKAROUND(p_hwfn))
-               hw_mode |= 1 << MODE_EAGLE_ENG1_WORKAROUND;
-#endif
-
        if (p_hwfn->p_dev->num_hwfns > 1)
                hw_mode |= 1 << MODE_100G;
 
@@ -900,29 +886,36 @@ static enum _ecore_status_t ecore_calc_hw_mode(struct ecore_hwfn *p_hwfn)
 static enum _ecore_status_t ecore_hw_init_chip(struct ecore_hwfn *p_hwfn,
                                               struct ecore_ptt *p_ptt)
 {
+       struct ecore_dev *p_dev = p_hwfn->p_dev;
        u32 pl_hv = 1;
        int i;
 
-       if (CHIP_REV_IS_EMUL(p_hwfn->p_dev) && ECORE_IS_AH(p_hwfn->p_dev))
-               pl_hv |= 0x600;
+       if (CHIP_REV_IS_EMUL(p_dev)) {
+               if (ECORE_IS_AH(p_dev))
+                       pl_hv |= 0x600;
+       }
 
        ecore_wr(p_hwfn, p_ptt, MISCS_REG_RESET_PL_HV + 4, pl_hv);
 
-       if (CHIP_REV_IS_EMUL(p_hwfn->p_dev) && ECORE_IS_AH(p_hwfn->p_dev))
-               ecore_wr(p_hwfn, p_ptt, MISCS_REG_RESET_PL_HV_2, 0x3ffffff);
+       if (CHIP_REV_IS_EMUL(p_dev) &&
+           (ECORE_IS_AH(p_dev)))
+               ecore_wr(p_hwfn, p_ptt, MISCS_REG_RESET_PL_HV_2_K2_E5,
+                        0x3ffffff);
 
        /* initialize port mode to 4x10G_E (10G with 4x10 SERDES) */
        /* CNIG_REG_NW_PORT_MODE is same for A0 and B0 */
-       if (!CHIP_REV_IS_EMUL(p_hwfn->p_dev) || !ECORE_IS_AH(p_hwfn->p_dev))
-               ecore_wr(p_hwfn, p_ptt, CNIG_REG_NW_PORT_MODE_BB_B0, 4);
+       if (!CHIP_REV_IS_EMUL(p_dev) || ECORE_IS_BB(p_dev))
+               ecore_wr(p_hwfn, p_ptt, CNIG_REG_NW_PORT_MODE_BB, 4);
 
-       if (CHIP_REV_IS_EMUL(p_hwfn->p_dev) && ECORE_IS_AH(p_hwfn->p_dev)) {
-               /* 2 for 4-port, 1 for 2-port, 0 for 1-port */
-               ecore_wr(p_hwfn, p_ptt, MISC_REG_PORT_MODE,
-                        (p_hwfn->p_dev->num_ports_in_engines >> 1));
+       if (CHIP_REV_IS_EMUL(p_dev)) {
+               if (ECORE_IS_AH(p_dev)) {
+                       /* 2 for 4-port, 1 for 2-port, 0 for 1-port */
+                       ecore_wr(p_hwfn, p_ptt, MISC_REG_PORT_MODE,
+                                (p_dev->num_ports_in_engines >> 1));
 
-               ecore_wr(p_hwfn, p_ptt, MISC_REG_BLOCK_256B_EN,
-                        p_hwfn->p_dev->num_ports_in_engines == 4 ? 0 : 3);
+                       ecore_wr(p_hwfn, p_ptt, MISC_REG_BLOCK_256B_EN,
+                                p_dev->num_ports_in_engines == 4 ? 0 : 3);
+               }
        }
 
        /* Poll on RBC */
@@ -988,7 +981,7 @@ static enum _ecore_status_t ecore_hw_init_common(struct ecore_hwfn *p_hwfn,
        ecore_gtt_init(p_hwfn);
 
 #ifndef ASIC_ONLY
-       if (CHIP_REV_IS_EMUL(p_hwfn->p_dev)) {
+       if (CHIP_REV_IS_EMUL(p_dev)) {
                rc = ecore_hw_init_chip(p_hwfn, p_hwfn->p_main_ptt);
                if (rc != ECORE_SUCCESS)
                        return rc;
@@ -1003,7 +996,7 @@ static enum _ecore_status_t ecore_hw_init_common(struct ecore_hwfn *p_hwfn,
        }
 
        ecore_qm_common_rt_init(p_hwfn,
-                               p_hwfn->p_dev->num_ports_in_engines,
+                               p_dev->num_ports_in_engines,
                                qm_info->max_phys_tcs_per_port,
                                qm_info->pf_rl_en, qm_info->pf_wfq_en,
                                qm_info->vport_rl_en, qm_info->vport_wfq_en,
@@ -1033,11 +1026,11 @@ static enum _ecore_status_t ecore_hw_init_common(struct ecore_hwfn *p_hwfn,
        ecore_wr(p_hwfn, p_ptt, PSWRQ2_REG_L2P_VALIDATE_VFID, 0);
        ecore_wr(p_hwfn, p_ptt, PGLUE_B_REG_USE_CLIENTID_IN_TAG, 1);
 
-       if (ECORE_IS_BB(p_hwfn->p_dev)) {
+       if (ECORE_IS_BB(p_dev)) {
                /* Workaround clears ROCE search for all functions to prevent
                 * involving non initialized function in processing ROCE packet.
                 */
-               num_pfs = NUM_OF_ENG_PFS(p_hwfn->p_dev);
+               num_pfs = NUM_OF_ENG_PFS(p_dev);
                for (pf_id = 0; pf_id < num_pfs; pf_id++) {
                        ecore_fid_pretend(p_hwfn, p_ptt, pf_id);
                        ecore_wr(p_hwfn, p_ptt, PRS_REG_SEARCH_ROCE, 0x0);
@@ -1053,8 +1046,7 @@ static enum _ecore_status_t ecore_hw_init_common(struct ecore_hwfn *p_hwfn,
         * This is not done inside the init tool since it currently can't
         * perform a pretending to VFs.
         */
-       max_num_vfs = ECORE_IS_AH(p_hwfn->p_dev) ? MAX_NUM_VFS_K2
-           : MAX_NUM_VFS_BB;
+       max_num_vfs = ECORE_IS_AH(p_dev) ? MAX_NUM_VFS_K2 : MAX_NUM_VFS_BB;
        for (vf_id = 0; vf_id < max_num_vfs; vf_id++) {
                concrete_fid = ecore_vfid_to_concrete(p_hwfn, vf_id);
                ecore_fid_pretend(p_hwfn, p_ptt, (u16)concrete_fid);
@@ -1081,20 +1073,19 @@ static void ecore_wr_nw_port(struct ecore_hwfn *p_hwfn,
 {
        DP_VERBOSE(p_hwfn, ECORE_MSG_LINK,
                   "CMD: %08x, ADDR: 0x%08x, DATA: %08x:%08x\n",
-                  ecore_rd(p_hwfn, p_ptt, CNIG_REG_PMEG_IF_CMD_BB_B0) |
+                  ecore_rd(p_hwfn, p_ptt, CNIG_REG_PMEG_IF_CMD_BB) |
                   (8 << PMEG_IF_BYTE_COUNT),
                   (reg_type << 25) | (addr << 8) | port,
                   (u32)((data >> 32) & 0xffffffff),
                   (u32)(data & 0xffffffff));
 
-       ecore_wr(p_hwfn, p_ptt, CNIG_REG_PMEG_IF_CMD_BB_B0,
-                (ecore_rd(p_hwfn, p_ptt, CNIG_REG_PMEG_IF_CMD_BB_B0) &
+       ecore_wr(p_hwfn, p_ptt, CNIG_REG_PMEG_IF_CMD_BB,
+                (ecore_rd(p_hwfn, p_ptt, CNIG_REG_PMEG_IF_CMD_BB) &
                  0xffff00fe) | (8 << PMEG_IF_BYTE_COUNT));
-       ecore_wr(p_hwfn, p_ptt, CNIG_REG_PMEG_IF_ADDR_BB_B0,
+       ecore_wr(p_hwfn, p_ptt, CNIG_REG_PMEG_IF_ADDR_BB,
                 (reg_type << 25) | (addr << 8) | port);
-       ecore_wr(p_hwfn, p_ptt, CNIG_REG_PMEG_IF_WRDATA_BB_B0,
-                data & 0xffffffff);
-       ecore_wr(p_hwfn, p_ptt, CNIG_REG_PMEG_IF_WRDATA_BB_B0,
+       ecore_wr(p_hwfn, p_ptt, CNIG_REG_PMEG_IF_WRDATA_BB, data & 0xffffffff);
+       ecore_wr(p_hwfn, p_ptt, CNIG_REG_PMEG_IF_WRDATA_BB,
                 (data >> 32) & 0xffffffff);
 }
 
@@ -1110,48 +1101,13 @@ static void ecore_wr_nw_port(struct ecore_hwfn *p_hwfn,
 #define XLMAC_PAUSE_CTRL (0x60d)
 #define XLMAC_PFC_CTRL (0x60e)
 
-static void ecore_emul_link_init_ah(struct ecore_hwfn *p_hwfn,
+static void ecore_emul_link_init_bb(struct ecore_hwfn *p_hwfn,
                                    struct ecore_ptt *p_ptt)
-{
-       u8 port = p_hwfn->port_id;
-       u32 mac_base = NWM_REG_MAC0 + (port << 2) * NWM_REG_MAC0_SIZE;
-
-       ecore_wr(p_hwfn, p_ptt, CNIG_REG_NIG_PORT0_CONF_K2 + (port << 2),
-                (1 << CNIG_REG_NIG_PORT0_CONF_NIG_PORT_ENABLE_0_SHIFT) |
-                (port << CNIG_REG_NIG_PORT0_CONF_NIG_PORT_NWM_PORT_MAP_0_SHIFT)
-                | (0 << CNIG_REG_NIG_PORT0_CONF_NIG_PORT_RATE_0_SHIFT));
-
-       ecore_wr(p_hwfn, p_ptt, mac_base + ETH_MAC_REG_XIF_MODE,
-                1 << ETH_MAC_REG_XIF_MODE_XGMII_SHIFT);
-
-       ecore_wr(p_hwfn, p_ptt, mac_base + ETH_MAC_REG_FRM_LENGTH,
-                9018 << ETH_MAC_REG_FRM_LENGTH_FRM_LENGTH_SHIFT);
-
-       ecore_wr(p_hwfn, p_ptt, mac_base + ETH_MAC_REG_TX_IPG_LENGTH,
-                0xc << ETH_MAC_REG_TX_IPG_LENGTH_TXIPG_SHIFT);
-
-       ecore_wr(p_hwfn, p_ptt, mac_base + ETH_MAC_REG_RX_FIFO_SECTIONS,
-                8 << ETH_MAC_REG_RX_FIFO_SECTIONS_RX_SECTION_FULL_SHIFT);
-
-       ecore_wr(p_hwfn, p_ptt, mac_base + ETH_MAC_REG_TX_FIFO_SECTIONS,
-                (0xA << ETH_MAC_REG_TX_FIFO_SECTIONS_TX_SECTION_EMPTY_SHIFT) |
-                (8 << ETH_MAC_REG_TX_FIFO_SECTIONS_TX_SECTION_FULL_SHIFT));
-
-       ecore_wr(p_hwfn, p_ptt, mac_base + ETH_MAC_REG_COMMAND_CONFIG, 0xa853);
-}
-
-static void ecore_emul_link_init(struct ecore_hwfn *p_hwfn,
-                                struct ecore_ptt *p_ptt)
 {
        u8 loopback = 0, port = p_hwfn->port_id * 2;
 
        DP_INFO(p_hwfn->p_dev, "Configurating Emulation Link %02x\n", port);
 
-       if (ECORE_IS_AH(p_hwfn->p_dev)) {
-               ecore_emul_link_init_ah(p_hwfn, p_ptt);
-               return;
-       }
-
        /* XLPORT MAC MODE *//* 0 Quad, 4 Single... */
        ecore_wr_nw_port(p_hwfn, p_ptt, XLPORT_MODE_REG, (0x4 << 4) | 0x4, 1,
                         port);
@@ -1180,8 +1136,53 @@ static void ecore_emul_link_init(struct ecore_hwfn *p_hwfn,
        ecore_wr_nw_port(p_hwfn, p_ptt, XLPORT_ENABLE_REG, 0xf, 1, port);
 }
 
-static void ecore_link_init(struct ecore_hwfn *p_hwfn,
-                           struct ecore_ptt *p_ptt, u8 port)
+static void ecore_emul_link_init_ah_e5(struct ecore_hwfn *p_hwfn,
+                                      struct ecore_ptt *p_ptt)
+{
+       u8 port = p_hwfn->port_id;
+       u32 mac_base = NWM_REG_MAC0_K2_E5 + (port << 2) * NWM_REG_MAC0_SIZE;
+
+       DP_INFO(p_hwfn->p_dev, "Configurating Emulation Link %02x\n", port);
+
+       ecore_wr(p_hwfn, p_ptt, CNIG_REG_NIG_PORT0_CONF_K2_E5 + (port << 2),
+                (1 << CNIG_REG_NIG_PORT0_CONF_NIG_PORT_ENABLE_0_K2_E5_SHIFT) |
+                (port <<
+                 CNIG_REG_NIG_PORT0_CONF_NIG_PORT_NWM_PORT_MAP_0_K2_E5_SHIFT) |
+                (0 << CNIG_REG_NIG_PORT0_CONF_NIG_PORT_RATE_0_K2_E5_SHIFT));
+
+       ecore_wr(p_hwfn, p_ptt, mac_base + ETH_MAC_REG_XIF_MODE_K2_E5,
+                1 << ETH_MAC_REG_XIF_MODE_XGMII_K2_E5_SHIFT);
+
+       ecore_wr(p_hwfn, p_ptt, mac_base + ETH_MAC_REG_FRM_LENGTH_K2_E5,
+                9018 << ETH_MAC_REG_FRM_LENGTH_FRM_LENGTH_K2_E5_SHIFT);
+
+       ecore_wr(p_hwfn, p_ptt, mac_base + ETH_MAC_REG_TX_IPG_LENGTH_K2_E5,
+                0xc << ETH_MAC_REG_TX_IPG_LENGTH_TXIPG_K2_E5_SHIFT);
+
+       ecore_wr(p_hwfn, p_ptt, mac_base + ETH_MAC_REG_RX_FIFO_SECTIONS_K2_E5,
+                8 << ETH_MAC_REG_RX_FIFO_SECTIONS_RX_SECTION_FULL_K2_E5_SHIFT);
+
+       ecore_wr(p_hwfn, p_ptt, mac_base + ETH_MAC_REG_TX_FIFO_SECTIONS_K2_E5,
+                (0xA <<
+                 ETH_MAC_REG_TX_FIFO_SECTIONS_TX_SECTION_EMPTY_K2_E5_SHIFT) |
+                (8 <<
+                 ETH_MAC_REG_TX_FIFO_SECTIONS_TX_SECTION_FULL_K2_E5_SHIFT));
+
+       ecore_wr(p_hwfn, p_ptt, mac_base + ETH_MAC_REG_COMMAND_CONFIG_K2_E5,
+                0xa853);
+}
+
+static void ecore_emul_link_init(struct ecore_hwfn *p_hwfn,
+                                struct ecore_ptt *p_ptt)
+{
+       if (ECORE_IS_AH(p_hwfn->p_dev))
+               ecore_emul_link_init_ah_e5(p_hwfn, p_ptt);
+       else /* BB */
+               ecore_emul_link_init_bb(p_hwfn, p_ptt);
+}
+
+static void ecore_link_init_bb(struct ecore_hwfn *p_hwfn,
+                              struct ecore_ptt *p_ptt,  u8 port)
 {
        int port_offset = port ? 0x800 : 0;
        u32 xmac_rxctrl = 0;
@@ -1194,10 +1195,10 @@ static void ecore_link_init(struct ecore_hwfn *p_hwfn,
        ecore_wr(p_hwfn, p_ptt, MISC_REG_RESET_PL_PDA_VAUX + sizeof(u32),
                 MISC_REG_RESET_REG_2_XMAC_BIT);        /* Set */
 
-       ecore_wr(p_hwfn, p_ptt, MISC_REG_XMAC_CORE_PORT_MODE, 1);
+       ecore_wr(p_hwfn, p_ptt, MISC_REG_XMAC_CORE_PORT_MODE_BB, 1);
 
        /* Set the number of ports on the Warp Core to 10G */
-       ecore_wr(p_hwfn, p_ptt, MISC_REG_XMAC_PHY_PORT_MODE, 3);
+       ecore_wr(p_hwfn, p_ptt, MISC_REG_XMAC_PHY_PORT_MODE_BB, 3);
 
        /* Soft reset of XMAC */
        ecore_wr(p_hwfn, p_ptt, MISC_REG_RESET_PL_PDA_VAUX + 2 * sizeof(u32),
@@ -1208,20 +1209,21 @@ static void ecore_link_init(struct ecore_hwfn *p_hwfn,
 
        /* FIXME: move to common end */
        if (CHIP_REV_IS_FPGA(p_hwfn->p_dev))
-               ecore_wr(p_hwfn, p_ptt, XMAC_REG_MODE + port_offset, 0x20);
+               ecore_wr(p_hwfn, p_ptt, XMAC_REG_MODE_BB + port_offset, 0x20);
 
        /* Set Max packet size: initialize XMAC block register for port 0 */
-       ecore_wr(p_hwfn, p_ptt, XMAC_REG_RX_MAX_SIZE + port_offset, 0x2710);
+       ecore_wr(p_hwfn, p_ptt, XMAC_REG_RX_MAX_SIZE_BB + port_offset, 0x2710);
 
        /* CRC append for Tx packets: init XMAC block register for port 1 */
-       ecore_wr(p_hwfn, p_ptt, XMAC_REG_TX_CTRL_LO + port_offset, 0xC800);
+       ecore_wr(p_hwfn, p_ptt, XMAC_REG_TX_CTRL_LO_BB + port_offset, 0xC800);
 
        /* Enable TX and RX: initialize XMAC block register for port 1 */
-       ecore_wr(p_hwfn, p_ptt, XMAC_REG_CTRL + port_offset,
-                XMAC_REG_CTRL_TX_EN | XMAC_REG_CTRL_RX_EN);
-       xmac_rxctrl = ecore_rd(p_hwfn, p_ptt, XMAC_REG_RX_CTRL + port_offset);
-       xmac_rxctrl |= XMAC_REG_RX_CTRL_PROCESS_VARIABLE_PREAMBLE;
-       ecore_wr(p_hwfn, p_ptt, XMAC_REG_RX_CTRL + port_offset, xmac_rxctrl);
+       ecore_wr(p_hwfn, p_ptt, XMAC_REG_CTRL_BB + port_offset,
+                XMAC_REG_CTRL_TX_EN_BB | XMAC_REG_CTRL_RX_EN_BB);
+       xmac_rxctrl = ecore_rd(p_hwfn, p_ptt,
+                              XMAC_REG_RX_CTRL_BB + port_offset);
+       xmac_rxctrl |= XMAC_REG_RX_CTRL_PROCESS_VARIABLE_PREAMBLE_BB;
+       ecore_wr(p_hwfn, p_ptt, XMAC_REG_RX_CTRL_BB + port_offset, xmac_rxctrl);
 }
 #endif
 
@@ -1242,7 +1244,8 @@ static enum _ecore_status_t ecore_hw_init_port(struct ecore_hwfn *p_hwfn,
        if (CHIP_REV_IS_FPGA(p_hwfn->p_dev)) {
                if (ECORE_IS_AH(p_hwfn->p_dev))
                        return ECORE_SUCCESS;
-               ecore_link_init(p_hwfn, p_ptt, p_hwfn->port_id);
+               else if (ECORE_IS_BB(p_hwfn->p_dev))
+                       ecore_link_init_bb(p_hwfn, p_ptt, p_hwfn->port_id);
        } else if (CHIP_REV_IS_EMUL(p_hwfn->p_dev)) {
                if (p_hwfn->p_dev->num_hwfns > 1) {
                        /* Activate OPTE in CMT */
@@ -1533,7 +1536,9 @@ ecore_hw_init_pf(struct ecore_hwfn *p_hwfn,
                return rc;
        if (b_hw_start) {
                /* enable interrupts */
-               ecore_int_igu_enable(p_hwfn, p_ptt, int_mode);
+               rc = ecore_int_igu_enable(p_hwfn, p_ptt, int_mode);
+               if (rc != ECORE_SUCCESS)
+                       return rc;
 
                /* send function start command */
                rc = ecore_sp_pf_start(p_hwfn, p_tunn, p_hwfn->p_dev->mf_mode,
@@ -1622,11 +1627,14 @@ static void ecore_reset_mb_shadow(struct ecore_hwfn *p_hwfn,
 enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev,
                                   struct ecore_hw_init_params *p_params)
 {
-       enum _ecore_status_t rc, mfw_rc;
-       u32 load_code, param;
-       int i, j;
+       enum _ecore_status_t rc = ECORE_SUCCESS, mfw_rc;
+       u32 load_code, param, drv_mb_param;
+       bool b_default_mtu = true;
+       struct ecore_hwfn *p_hwfn;
+       int i;
 
-       if (p_params->int_mode == ECORE_INT_MODE_MSI && p_dev->num_hwfns > 1) {
+       if ((p_params->int_mode == ECORE_INT_MODE_MSI) &&
+           (p_dev->num_hwfns > 1)) {
                DP_NOTICE(p_dev, false,
                          "MSI mode is not supported for CMT devices\n");
                return ECORE_INVAL;
@@ -1641,6 +1649,12 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev,
        for_each_hwfn(p_dev, i) {
                struct ecore_hwfn *p_hwfn = &p_dev->hwfns[i];
 
+               /* If management didn't provide a default, set one of our own */
+               if (!p_hwfn->hw_info.mtu) {
+                       p_hwfn->hw_info.mtu = 1500;
+                       b_default_mtu = false;
+               }
+
                if (IS_VF(p_dev)) {
                        p_hwfn->b_int_enabled = 1;
                        continue;
@@ -1672,7 +1686,7 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev,
                 * out that these registers get initialized during the call to
                 * ecore_mcp_load_req request. So we need to reread them here
                 * to get the proper shadow register value.
-                * Note: This is a workaround for the missinginig MFW
+                * Note: This is a workaround for the missing MFW
                 * initialization. It may be removed once the implementation
                 * is done.
                 */
@@ -1708,25 +1722,6 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev,
                                                p_hwfn->hw_info.hw_mode);
                        if (rc)
                                break;
-
-#ifndef REAL_ASIC_ONLY
-                       if (ENABLE_EAGLE_ENG1_WORKAROUND(p_hwfn)) {
-                               struct init_nig_pri_tc_map_req tc_map;
-
-                               OSAL_MEM_ZERO(&tc_map, sizeof(tc_map));
-
-                               /* remove this once flow control is
-                                * implemented
-                                */
-                               for (j = 0; j < NUM_OF_VLAN_PRIORITIES; j++) {
-                                       tc_map.pri[j].tc_id = 0;
-                                       tc_map.pri[j].valid = 1;
-                               }
-                               ecore_init_nig_pri_tc_map(p_hwfn,
-                                                         p_hwfn->p_main_ptt,
-                                                         &tc_map);
-                       }
-#endif
                        /* Fall into */
                case FW_MSG_CODE_DRV_LOAD_FUNCTION:
                        rc = ecore_hw_init_pf(p_hwfn, p_hwfn->p_main_ptt,
@@ -1758,10 +1753,6 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev,
                        return mfw_rc;
                }
 
-               ecore_mcp_mdump_get_info(p_hwfn, p_hwfn->p_main_ptt);
-               ecore_mcp_mdump_set_values(p_hwfn, p_hwfn->p_main_ptt,
-                                          p_params->epoch);
-
                /* send DCBX attention request command */
                DP_VERBOSE(p_hwfn, ECORE_MSG_DCB,
                           "sending phony dcbx set command to trigger DCBx attention handling\n");
@@ -1778,7 +1769,30 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev,
                p_hwfn->hw_init_done = true;
        }
 
-       return ECORE_SUCCESS;
+       if (IS_PF(p_dev)) {
+               p_hwfn = ECORE_LEADING_HWFN(p_dev);
+               drv_mb_param = (FW_MAJOR_VERSION << 24) |
+                              (FW_MINOR_VERSION << 16) |
+                              (FW_REVISION_VERSION << 8) |
+                              (FW_ENGINEERING_VERSION);
+               rc = ecore_mcp_cmd(p_hwfn, p_hwfn->p_main_ptt,
+                                  DRV_MSG_CODE_OV_UPDATE_STORM_FW_VER,
+                                  drv_mb_param, &load_code, &param);
+               if (rc != ECORE_SUCCESS) {
+                       DP_ERR(p_hwfn, "Failed to send firmware version\n");
+                       return rc;
+               }
+
+               if (!b_default_mtu)
+                       ecore_mcp_ov_update_mtu(p_hwfn, p_hwfn->p_main_ptt,
+                                               p_hwfn->hw_info.mtu);
+
+               rc = ecore_mcp_ov_update_driver_state(p_hwfn,
+                                                     p_hwfn->p_main_ptt,
+                                               ECORE_OV_DRIVER_STATE_DISABLED);
+       }
+
+       return rc;
 }
 
 #define ECORE_HW_STOP_RETRY_LIMIT      (10)
@@ -1803,13 +1817,14 @@ static void ecore_hw_timers_stop(struct ecore_dev *p_dev,
                 */
                OSAL_MSLEEP(1);
        }
-       if (i == ECORE_HW_STOP_RETRY_LIMIT)
-               DP_NOTICE(p_hwfn, true,
-                         "Timers linear scans are not over [Connection %02x Tasks %02x]\n",
-                         (u8)ecore_rd(p_hwfn, p_ptt,
-                                       TM_REG_PF_SCAN_ACTIVE_CONN),
-                         (u8)ecore_rd(p_hwfn, p_ptt,
-                                       TM_REG_PF_SCAN_ACTIVE_TASK));
+
+       if (i < ECORE_HW_STOP_RETRY_LIMIT)
+               return;
+
+       DP_NOTICE(p_hwfn, true, "Timers linear scans are not over"
+                 " [Connection %02x Tasks %02x]\n",
+                 (u8)ecore_rd(p_hwfn, p_ptt, TM_REG_PF_SCAN_ACTIVE_CONN),
+                 (u8)ecore_rd(p_hwfn, p_ptt, TM_REG_PF_SCAN_ACTIVE_TASK));
 }
 
 void ecore_hw_timers_stop_all(struct ecore_dev *p_dev)
@@ -2041,22 +2056,22 @@ static void ecore_hw_hwfn_prepare(struct ecore_hwfn *p_hwfn)
        /* clear indirect access */
        if (ECORE_IS_AH(p_hwfn->p_dev)) {
                ecore_wr(p_hwfn, p_hwfn->p_main_ptt,
-                        PGLUE_B_REG_PGL_ADDR_E8_F0, 0);
+                        PGLUE_B_REG_PGL_ADDR_E8_F0_K2_E5, 0);
                ecore_wr(p_hwfn, p_hwfn->p_main_ptt,
-                        PGLUE_B_REG_PGL_ADDR_EC_F0, 0);
+                        PGLUE_B_REG_PGL_ADDR_EC_F0_K2_E5, 0);
                ecore_wr(p_hwfn, p_hwfn->p_main_ptt,
-                        PGLUE_B_REG_PGL_ADDR_F0_F0, 0);
+                        PGLUE_B_REG_PGL_ADDR_F0_F0_K2_E5, 0);
                ecore_wr(p_hwfn, p_hwfn->p_main_ptt,
-                        PGLUE_B_REG_PGL_ADDR_F4_F0, 0);
+                        PGLUE_B_REG_PGL_ADDR_F4_F0_K2_E5, 0);
        } else {
                ecore_wr(p_hwfn, p_hwfn->p_main_ptt,
-                        PGLUE_B_REG_PGL_ADDR_88_F0, 0);
+                        PGLUE_B_REG_PGL_ADDR_88_F0_BB, 0);
                ecore_wr(p_hwfn, p_hwfn->p_main_ptt,
-                        PGLUE_B_REG_PGL_ADDR_8C_F0, 0);
+                        PGLUE_B_REG_PGL_ADDR_8C_F0_BB, 0);
                ecore_wr(p_hwfn, p_hwfn->p_main_ptt,
-                        PGLUE_B_REG_PGL_ADDR_90_F0, 0);
+                        PGLUE_B_REG_PGL_ADDR_90_F0_BB, 0);
                ecore_wr(p_hwfn, p_hwfn->p_main_ptt,
-                        PGLUE_B_REG_PGL_ADDR_94_F0, 0);
+                        PGLUE_B_REG_PGL_ADDR_94_F0_BB, 0);
        }
 
        /* Clean Previous errors if such exist */
@@ -2091,6 +2106,7 @@ static void get_function_id(struct ecore_hwfn *p_hwfn)
 static void ecore_hw_set_feat(struct ecore_hwfn *p_hwfn)
 {
        u32 *feat_num = p_hwfn->hw_info.feat_num;
+       struct ecore_sb_cnt_info sb_cnt_info;
        int num_features = 1;
 
        /* L2 Queues require each: 1 status block. 1 L2 queue */
@@ -2099,11 +2115,21 @@ static void ecore_hw_set_feat(struct ecore_hwfn *p_hwfn)
                       RESC_NUM(p_hwfn, ECORE_SB) / num_features,
                       RESC_NUM(p_hwfn, ECORE_L2_QUEUE));
 
+       OSAL_MEM_ZERO(&sb_cnt_info, sizeof(sb_cnt_info));
+       ecore_int_get_num_sbs(p_hwfn, &sb_cnt_info);
+       feat_num[ECORE_VF_L2_QUE] =
+               OSAL_MIN_T(u32,
+                          RESC_NUM(p_hwfn, ECORE_L2_QUEUE) -
+                          FEAT_NUM(p_hwfn, ECORE_PF_L2_QUE),
+                          sb_cnt_info.sb_iov_cnt);
+
        DP_VERBOSE(p_hwfn, ECORE_MSG_PROBE,
-                  "#PF_L2_QUEUES=%d #ROCE_CNQ=%d #SBS=%d num_features=%d\n",
-                  feat_num[ECORE_PF_L2_QUE],
-                  feat_num[ECORE_RDMA_CNQ],
-                  RESC_NUM(p_hwfn, ECORE_SB), num_features);
+                  "#PF_L2_QUEUES=%d VF_L2_QUEUES=%d #ROCE_CNQ=%d #SBS=%d num_features=%d\n",
+                  (int)FEAT_NUM(p_hwfn, ECORE_PF_L2_QUE),
+                  (int)FEAT_NUM(p_hwfn, ECORE_VF_L2_QUE),
+                  (int)FEAT_NUM(p_hwfn, ECORE_RDMA_CNQ),
+                  RESC_NUM(p_hwfn, ECORE_SB),
+                  num_features);
 }
 
 static enum resource_id_enum
@@ -2219,6 +2245,40 @@ static u32 ecore_hw_get_dflt_resc_num(struct ecore_hwfn *p_hwfn,
        return dflt_resc_num;
 }
 
+static const char *ecore_hw_get_resc_name(enum ecore_resources res_id)
+{
+       switch (res_id) {
+       case ECORE_SB:
+               return "SB";
+       case ECORE_L2_QUEUE:
+               return "L2_QUEUE";
+       case ECORE_VPORT:
+               return "VPORT";
+       case ECORE_RSS_ENG:
+               return "RSS_ENG";
+       case ECORE_PQ:
+               return "PQ";
+       case ECORE_RL:
+               return "RL";
+       case ECORE_MAC:
+               return "MAC";
+       case ECORE_VLAN:
+               return "VLAN";
+       case ECORE_RDMA_CNQ_RAM:
+               return "RDMA_CNQ_RAM";
+       case ECORE_ILT:
+               return "ILT";
+       case ECORE_LL2_QUEUE:
+               return "LL2_QUEUE";
+       case ECORE_CMDQS_CQS:
+               return "CMDQS_CQS";
+       case ECORE_RDMA_STATS_QUEUE:
+               return "RDMA_STATS_QUEUE";
+       default:
+               return "UNKNOWN_RESOURCE";
+       }
+}
+
 static enum _ecore_status_t ecore_hw_set_resc_info(struct ecore_hwfn *p_hwfn,
                                                   enum ecore_resources res_id,
                                                   bool drv_resc_alloc)
@@ -2233,8 +2293,9 @@ static enum _ecore_status_t ecore_hw_set_resc_info(struct ecore_hwfn *p_hwfn,
 
        dflt_resc_num = ecore_hw_get_dflt_resc_num(p_hwfn, res_id);
        if (!dflt_resc_num) {
-               DP_ERR(p_hwfn, "Failed to get default amount for resource %d\n",
-                      res_id);
+               DP_ERR(p_hwfn,
+                      "Failed to get default amount for resource %d [%s]\n",
+                       res_id, ecore_hw_get_resc_name(res_id));
                return ECORE_INVAL;
        }
        dflt_resc_start = dflt_resc_num * p_hwfn->enabled_func_idx;
@@ -2260,8 +2321,9 @@ static enum _ecore_status_t ecore_hw_set_resc_info(struct ecore_hwfn *p_hwfn,
                                     &mcp_resp, &mcp_param);
        if (rc != ECORE_SUCCESS) {
                DP_NOTICE(p_hwfn, true,
-                         "MFW resp failure for a resc alloc req [res_id %d]\n",
-                         res_id);
+                         "MFW response failure for an allocation request for"
+                         " resource %d [%s]\n",
+                         res_id, ecore_hw_get_resc_name(res_id));
                return rc;
        }
 
@@ -2274,11 +2336,11 @@ static enum _ecore_status_t ecore_hw_set_resc_info(struct ecore_hwfn *p_hwfn,
            mcp_resp != FW_MSG_CODE_RESOURCE_ALLOC_DEPRECATED) {
                /* @DPDK */
                DP_INFO(p_hwfn,
-                         "No allocation info for resc %d [mcp_resp 0x%x].",
-                         res_id, mcp_resp);
-               DP_INFO(p_hwfn,
-                         "Applying default values [num %d, start %d].\n",
-                         dflt_resc_num, dflt_resc_start);
+                       "Resource %d [%s]: No allocation info was received"
+                       " [mcp_resp 0x%x]. Applying default values"
+                       " [num %d, start %d].\n",
+                       res_id, ecore_hw_get_resc_name(res_id), mcp_resp,
+                       dflt_resc_num, dflt_resc_start);
 
                *p_resc_num = dflt_resc_num;
                *p_resc_start = dflt_resc_start;
@@ -2296,14 +2358,11 @@ static enum _ecore_status_t ecore_hw_set_resc_info(struct ecore_hwfn *p_hwfn,
        *p_resc_start = resc_info.offset;
 
        if (*p_resc_num != dflt_resc_num || *p_resc_start != dflt_resc_start) {
-               DP_NOTICE(p_hwfn, false,
-                         "Resource %d: MFW allocation [num %d, start %d]",
-                         res_id, *p_resc_num, *p_resc_start);
-               DP_NOTICE(p_hwfn, false,
-                         "differs from default values [num %d, start %d]%s\n",
-                         dflt_resc_num,
-                         dflt_resc_start,
-                         drv_resc_alloc ? " - applying default values" : "");
+               DP_INFO(p_hwfn,
+                       "Resource %d [%s]: MFW allocation [num %d, start %d] differs from default values [num %d, start %d]%s\n",
+                       res_id, ecore_hw_get_resc_name(res_id), *p_resc_num,
+                       *p_resc_start, dflt_resc_num, dflt_resc_start,
+                       drv_resc_alloc ? " - Applying default values" : "");
                if (drv_resc_alloc) {
                        *p_resc_num = dflt_resc_num;
                        *p_resc_start = dflt_resc_start;
@@ -2313,40 +2372,6 @@ static enum _ecore_status_t ecore_hw_set_resc_info(struct ecore_hwfn *p_hwfn,
        return ECORE_SUCCESS;
 }
 
-static const char *ecore_hw_get_resc_name(enum ecore_resources res_id)
-{
-       switch (res_id) {
-       case ECORE_SB:
-               return "SB";
-       case ECORE_L2_QUEUE:
-               return "L2_QUEUE";
-       case ECORE_VPORT:
-               return "VPORT";
-       case ECORE_RSS_ENG:
-               return "RSS_ENG";
-       case ECORE_PQ:
-               return "PQ";
-       case ECORE_RL:
-               return "RL";
-       case ECORE_MAC:
-               return "MAC";
-       case ECORE_VLAN:
-               return "VLAN";
-       case ECORE_RDMA_CNQ_RAM:
-               return "RDMA_CNQ_RAM";
-       case ECORE_ILT:
-               return "ILT";
-       case ECORE_LL2_QUEUE:
-               return "LL2_QUEUE";
-       case ECORE_CMDQS_CQS:
-               return "CMDQS_CQS";
-       case ECORE_RDMA_STATS_QUEUE:
-               return "RDMA_STATS_QUEUE";
-       default:
-               return "UNKNOWN_RESOURCE";
-       }
-}
-
 static enum _ecore_status_t ecore_hw_get_resc(struct ecore_hwfn *p_hwfn,
                                              bool drv_resc_alloc)
 {
@@ -2426,7 +2451,7 @@ static enum _ecore_status_t ecore_hw_get_resc(struct ecore_hwfn *p_hwfn,
 static enum _ecore_status_t ecore_hw_get_nvm_info(struct ecore_hwfn *p_hwfn,
                                                  struct ecore_ptt *p_ptt)
 {
-       u32 nvm_cfg1_offset, mf_mode, addr, generic_cont0, core_cfg;
+       u32 nvm_cfg1_offset, mf_mode, addr, generic_cont0, core_cfg, dcbx_mode;
        u32 port_cfg_addr, link_temp, nvm_cfg_addr, device_capabilities;
        struct ecore_mcp_link_params *link;
 
@@ -2475,6 +2500,9 @@ static enum _ecore_status_t ecore_hw_get_nvm_info(struct ecore_hwfn *p_hwfn,
        case NVM_CFG1_GLOB_NETWORK_PORT_MODE_2X25G:
                p_hwfn->hw_info.port_mode = ECORE_PORT_MODE_DE_2X25G;
                break;
+       case NVM_CFG1_GLOB_NETWORK_PORT_MODE_2X10G:
+               p_hwfn->hw_info.port_mode = ECORE_PORT_MODE_DE_2X10G;
+               break;
        case NVM_CFG1_GLOB_NETWORK_PORT_MODE_1X25G:
                p_hwfn->hw_info.port_mode = ECORE_PORT_MODE_DE_1X25G;
                break;
@@ -2487,6 +2515,28 @@ static enum _ecore_status_t ecore_hw_get_nvm_info(struct ecore_hwfn *p_hwfn,
                break;
        }
 
+       /* Read DCBX configuration */
+       port_cfg_addr = MCP_REG_SCRATCH + nvm_cfg1_offset +
+                       OFFSETOF(struct nvm_cfg1, port[MFW_PORT(p_hwfn)]);
+       dcbx_mode = ecore_rd(p_hwfn, p_ptt,
+                            port_cfg_addr +
+                            OFFSETOF(struct nvm_cfg1_port, generic_cont0));
+       dcbx_mode = (dcbx_mode & NVM_CFG1_PORT_DCBX_MODE_MASK)
+               >> NVM_CFG1_PORT_DCBX_MODE_OFFSET;
+       switch (dcbx_mode) {
+       case NVM_CFG1_PORT_DCBX_MODE_DYNAMIC:
+               p_hwfn->hw_info.dcbx_mode = ECORE_DCBX_VERSION_DYNAMIC;
+               break;
+       case NVM_CFG1_PORT_DCBX_MODE_CEE:
+               p_hwfn->hw_info.dcbx_mode = ECORE_DCBX_VERSION_CEE;
+               break;
+       case NVM_CFG1_PORT_DCBX_MODE_IEEE:
+               p_hwfn->hw_info.dcbx_mode = ECORE_DCBX_VERSION_IEEE;
+               break;
+       default:
+               p_hwfn->hw_info.dcbx_mode = ECORE_DCBX_VERSION_DISABLED;
+       }
+
        /* Read default link configuration */
        link = &p_hwfn->mcp_info->link_input;
        port_cfg_addr = MCP_REG_SCRATCH + nvm_cfg1_offset +
@@ -2616,7 +2666,12 @@ static void ecore_get_num_funcs(struct ecore_hwfn *p_hwfn,
         * In case of CMT in BB, only the "even" functions are enabled, and thus
         * the number of functions for both hwfns is learnt from the same bits.
         */
-       reg_function_hide = ecore_rd(p_hwfn, p_ptt, MISCS_REG_FUNCTION_HIDE);
+       if (ECORE_IS_BB(p_dev) || ECORE_IS_AH(p_dev)) {
+               reg_function_hide = ecore_rd(p_hwfn, p_ptt,
+                                            MISCS_REG_FUNCTION_HIDE_BB_K2);
+       } else { /* E5 */
+               reg_function_hide = 0;
+       }
 
        if (reg_function_hide & 0x1) {
                if (ECORE_IS_BB(p_dev)) {
@@ -2682,8 +2737,7 @@ static void ecore_hw_info_port_num_bb(struct ecore_hwfn *p_hwfn,
                port_mode = 1;
        else
 #endif
-               port_mode = ecore_rd(p_hwfn, p_ptt,
-                                    CNIG_REG_NW_PORT_MODE_BB_B0);
+       port_mode = ecore_rd(p_hwfn, p_ptt, CNIG_REG_NW_PORT_MODE_BB);
 
        if (port_mode < 3) {
                p_hwfn->p_dev->num_ports_in_engines = 1;
@@ -2698,8 +2752,8 @@ static void ecore_hw_info_port_num_bb(struct ecore_hwfn *p_hwfn,
        }
 }
 
-static void ecore_hw_info_port_num_ah(struct ecore_hwfn *p_hwfn,
-                                     struct ecore_ptt *p_ptt)
+static void ecore_hw_info_port_num_ah_e5(struct ecore_hwfn *p_hwfn,
+                                        struct ecore_ptt *p_ptt)
 {
        u32 port;
        int i;
@@ -2728,7 +2782,8 @@ static void ecore_hw_info_port_num_ah(struct ecore_hwfn *p_hwfn,
 #endif
                for (i = 0; i < MAX_NUM_PORTS_K2; i++) {
                        port = ecore_rd(p_hwfn, p_ptt,
-                                       CNIG_REG_NIG_PORT0_CONF_K2 + (i * 4));
+                                       CNIG_REG_NIG_PORT0_CONF_K2_E5 +
+                                       (i * 4));
                        if (port & 1)
                                p_hwfn->p_dev->num_ports_in_engines++;
                }
@@ -2740,7 +2795,7 @@ static void ecore_hw_info_port_num(struct ecore_hwfn *p_hwfn,
        if (ECORE_IS_BB(p_hwfn->p_dev))
                ecore_hw_info_port_num_bb(p_hwfn, p_ptt);
        else
-               ecore_hw_info_port_num_ah(p_hwfn, p_ptt);
+               ecore_hw_info_port_num_ah_e5(p_hwfn, p_ptt);
 }
 
 static enum _ecore_status_t
@@ -2752,7 +2807,7 @@ ecore_get_hw_info(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
        /* Since all information is common, only first hwfns should do this */
        if (IS_LEAD_HWFN(p_hwfn)) {
                rc = ecore_iov_hw_info(p_hwfn);
-               if (rc)
+               if (rc != ECORE_SUCCESS)
                        return rc;
        }
 
@@ -2766,12 +2821,17 @@ ecore_get_hw_info(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
        ecore_hw_info_port_num(p_hwfn, p_ptt);
 
 #ifndef ASIC_ONLY
-       if (CHIP_REV_IS_ASIC(p_hwfn->p_dev))
+       if (CHIP_REV_IS_ASIC(p_hwfn->p_dev)) {
+#endif
+       rc = ecore_hw_get_nvm_info(p_hwfn, p_ptt);
+       if (rc != ECORE_SUCCESS)
+               return rc;
+#ifndef ASIC_ONLY
+       }
 #endif
-               ecore_hw_get_nvm_info(p_hwfn, p_ptt);
 
        rc = ecore_int_igu_read_cam(p_hwfn, p_ptt);
-       if (rc)
+       if (rc != ECORE_SUCCESS)
                return rc;
 
 #ifndef ASIC_ONLY
@@ -2796,11 +2856,14 @@ ecore_get_hw_info(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
                ecore_mcp_cmd_port_init(p_hwfn, p_ptt);
        }
 
-       if (personality != ECORE_PCI_DEFAULT)
+       if (personality != ECORE_PCI_DEFAULT) {
                p_hwfn->hw_info.personality = personality;
-       else if (ecore_mcp_is_init(p_hwfn))
-               p_hwfn->hw_info.personality =
-                   p_hwfn->mcp_info->func_info.protocol;
+       } else if (ecore_mcp_is_init(p_hwfn)) {
+               enum ecore_pci_personality protocol;
+
+               protocol = p_hwfn->mcp_info->func_info.protocol;
+               p_hwfn->hw_info.personality = protocol;
+       }
 
 #ifndef ASIC_ONLY
        /* To overcome ILT lack for emulation, until at least until we'll have
@@ -2827,6 +2890,9 @@ ecore_get_hw_info(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
 
        ecore_get_num_funcs(p_hwfn, p_ptt);
 
+       if (ecore_mcp_is_init(p_hwfn))
+               p_hwfn->hw_info.mtu = p_hwfn->mcp_info->func_info.mtu;
+
        /* In case of forcing the driver's default resource allocation, calling
         * ecore_hw_get_resc() should come after initializing the personality
         * and after getting the number of functions, since the calculation of
@@ -2836,10 +2902,6 @@ ecore_get_hw_info(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
        return ecore_hw_get_resc(p_hwfn, drv_resc_alloc);
 }
 
-#define ECORE_DEV_ID_MASK      0xff00
-#define ECORE_DEV_ID_MASK_BB   0x1600
-#define ECORE_DEV_ID_MASK_AH   0x8000
-
 static enum _ecore_status_t ecore_get_dev_info(struct ecore_dev *p_dev)
 {
        struct ecore_hwfn *p_hwfn = ECORE_LEADING_HWFN(p_dev);
@@ -2893,9 +2955,9 @@ static enum _ecore_status_t ecore_get_dev_info(struct ecore_dev *p_dev)
                                           MISCS_REG_CHIP_METAL);
        MASK_FIELD(CHIP_METAL, p_dev->chip_metal);
        DP_INFO(p_dev->hwfns,
-               "Chip details - %s%d, Num: %04x Rev: %04x Bond id: %04x Metal: %04x\n",
+               "Chip details - %s %c%d, Num: %04x Rev: %04x Bond id: %04x Metal: %04x\n",
                ECORE_IS_BB(p_dev) ? "BB" : "AH",
-               CHIP_REV_IS_A0(p_dev) ? 0 : 1,
+               'A' + p_dev->chip_rev, (int)p_dev->chip_metal,
                p_dev->chip_num, p_dev->chip_rev, p_dev->chip_bond_id,
                p_dev->chip_metal);
 
@@ -2949,11 +3011,13 @@ void ecore_prepare_hibernate(struct ecore_dev *p_dev)
 #endif
 
 static enum _ecore_status_t
-ecore_hw_prepare_single(struct ecore_hwfn *p_hwfn, void OSAL_IOMEM *p_regview,
-                       void OSAL_IOMEM *p_doorbells,
+ecore_hw_prepare_single(struct ecore_hwfn *p_hwfn,
+                       void OSAL_IOMEM * p_regview,
+                       void OSAL_IOMEM * p_doorbells,
                        struct ecore_hw_prepare_params *p_params)
 {
        struct ecore_dev *p_dev = p_hwfn->p_dev;
+       struct ecore_mdump_info mdump_info;
        enum _ecore_status_t rc = ECORE_SUCCESS;
 
        /* Split PCI bars evenly between hwfns */
@@ -2998,12 +3062,6 @@ ecore_hw_prepare_single(struct ecore_hwfn *p_hwfn, void OSAL_IOMEM *p_regview,
                goto err1;
        }
 
-       if (p_hwfn == ECORE_LEADING_HWFN(p_dev) && !p_dev->recov_in_prog) {
-               rc = ecore_mcp_initiate_pf_flr(p_hwfn, p_hwfn->p_main_ptt);
-               if (rc != ECORE_SUCCESS)
-                       DP_NOTICE(p_hwfn, false, "Failed to initiate PF FLR\n");
-       }
-
        /* Read the device configuration information from the HW and SHMEM */
        rc = ecore_get_hw_info(p_hwfn, p_hwfn->p_main_ptt,
                               p_params->personality, p_params->drv_resc_alloc);
@@ -3012,6 +3070,29 @@ ecore_hw_prepare_single(struct ecore_hwfn *p_hwfn, void OSAL_IOMEM *p_regview,
                goto err2;
        }
 
+       /* Sending a mailbox to the MFW should be after ecore_get_hw_info() is
+        * called, since among others it sets the ports number in an engine.
+        */
+       if (p_params->initiate_pf_flr && p_hwfn == ECORE_LEADING_HWFN(p_dev) &&
+           !p_dev->recov_in_prog) {
+               rc = ecore_mcp_initiate_pf_flr(p_hwfn, p_hwfn->p_main_ptt);
+               if (rc != ECORE_SUCCESS)
+                       DP_NOTICE(p_hwfn, false, "Failed to initiate PF FLR\n");
+       }
+
+       /* Check if mdump logs are present and update the epoch value */
+       if (p_hwfn == ECORE_LEADING_HWFN(p_hwfn->p_dev)) {
+               rc = ecore_mcp_mdump_get_info(p_hwfn, p_hwfn->p_main_ptt,
+                                             &mdump_info);
+               if (rc == ECORE_SUCCESS && mdump_info.num_of_logs > 0) {
+                       DP_NOTICE(p_hwfn, false,
+                                 "* * * IMPORTANT - HW ERROR register dump captured by device * * *\n");
+               }
+
+               ecore_mcp_mdump_set_values(p_hwfn, p_hwfn->p_main_ptt,
+                                          p_params->epoch);
+       }
+
        /* Allocate the init RT array and initialize the init-ops engine */
        rc = ecore_init_alloc(p_hwfn);
        if (rc) {
@@ -3022,12 +3103,13 @@ ecore_hw_prepare_single(struct ecore_hwfn *p_hwfn, void OSAL_IOMEM *p_regview,
        if (CHIP_REV_IS_FPGA(p_dev)) {
                DP_NOTICE(p_hwfn, false,
                          "FPGA: workaround; Prevent DMAE parities\n");
-               ecore_wr(p_hwfn, p_hwfn->p_main_ptt, PCIE_REG_PRTY_MASK, 7);
+               ecore_wr(p_hwfn, p_hwfn->p_main_ptt, PCIE_REG_PRTY_MASK_K2_E5,
+                        7);
 
                DP_NOTICE(p_hwfn, false,
                          "FPGA: workaround: Set VF bar0 size\n");
                ecore_wr(p_hwfn, p_hwfn->p_main_ptt,
-                        PGLUE_B_REG_VF_BAR0_SIZE, 4);
+                        PGLUE_B_REG_VF_BAR0_SIZE_K2_E5, 4);
        }
 #endif
 
@@ -3097,13 +3179,18 @@ enum _ecore_status_t ecore_hw_prepare(struct ecore_dev *p_dev,
                }
        }
 
-       return ECORE_SUCCESS;
+       return rc;
 }
 
 void ecore_hw_remove(struct ecore_dev *p_dev)
 {
+       struct ecore_hwfn *p_hwfn = ECORE_LEADING_HWFN(p_dev);
        int i;
 
+       if (IS_PF(p_dev))
+               ecore_mcp_ov_update_driver_state(p_hwfn, p_hwfn->p_main_ptt,
+                                       ECORE_OV_DRIVER_STATE_NOT_LOADED);
+
        for_each_hwfn(p_dev, i) {
                struct ecore_hwfn *p_hwfn = &p_dev->hwfns[i];
 
@@ -3186,8 +3273,10 @@ static void ecore_chain_free_pbl(struct ecore_dev *p_dev,
        }
 
        pbl_size = page_cnt * ECORE_CHAIN_PBL_ENTRY_SIZE;
-       OSAL_DMA_FREE_COHERENT(p_dev, p_chain->pbl.p_virt_table,
-                              p_chain->pbl.p_phys_table, pbl_size);
+
+       if (!p_chain->pbl.external)
+               OSAL_DMA_FREE_COHERENT(p_dev, p_chain->pbl.p_virt_table,
+                                      p_chain->pbl.p_phys_table, pbl_size);
  out:
        OSAL_VFREE(p_dev, p_chain->pbl.pp_virt_addr_tbl);
 }
@@ -3272,8 +3361,8 @@ ecore_chain_alloc_next_ptr(struct ecore_dev *p_dev, struct ecore_chain *p_chain)
 static enum _ecore_status_t
 ecore_chain_alloc_single(struct ecore_dev *p_dev, struct ecore_chain *p_chain)
 {
-       void *p_virt = OSAL_NULL;
        dma_addr_t p_phys = 0;
+       void *p_virt = OSAL_NULL;
 
        p_virt = OSAL_DMA_ALLOC_COHERENT(p_dev, &p_phys, ECORE_CHAIN_PAGE_SIZE);
        if (!p_virt) {
@@ -3287,8 +3376,10 @@ ecore_chain_alloc_single(struct ecore_dev *p_dev, struct ecore_chain *p_chain)
        return ECORE_SUCCESS;
 }
 
-static enum _ecore_status_t ecore_chain_alloc_pbl(struct ecore_dev *p_dev,
-                                                 struct ecore_chain *p_chain)
+static enum _ecore_status_t
+ecore_chain_alloc_pbl(struct ecore_dev *p_dev,
+                     struct ecore_chain *p_chain,
+                     struct ecore_chain_ext_pbl *ext_pbl)
 {
        void *p_virt = OSAL_NULL;
        u8 *p_pbl_virt = OSAL_NULL;
@@ -3312,7 +3403,15 @@ static enum _ecore_status_t ecore_chain_alloc_pbl(struct ecore_dev *p_dev,
         * should be saved to allow its freeing during the error flow.
         */
        size = page_cnt * ECORE_CHAIN_PBL_ENTRY_SIZE;
-       p_pbl_virt = OSAL_DMA_ALLOC_COHERENT(p_dev, &p_pbl_phys, size);
+
+       if (ext_pbl == OSAL_NULL) {
+               p_pbl_virt = OSAL_DMA_ALLOC_COHERENT(p_dev, &p_pbl_phys, size);
+       } else {
+               p_pbl_virt = ext_pbl->p_pbl_virt;
+               p_pbl_phys = ext_pbl->p_pbl_phys;
+               p_chain->pbl.external = true;
+       }
+
        ecore_chain_init_pbl_mem(p_chain, p_pbl_virt, p_pbl_phys,
                                 pp_virt_addr_tbl);
        if (!p_pbl_virt) {
@@ -3350,7 +3449,8 @@ enum _ecore_status_t ecore_chain_alloc(struct ecore_dev *p_dev,
                                       enum ecore_chain_mode mode,
                                       enum ecore_chain_cnt_type cnt_type,
                                       u32 num_elems, osal_size_t elem_size,
-                                      struct ecore_chain *p_chain)
+                                      struct ecore_chain *p_chain,
+                                      struct ecore_chain_ext_pbl *ext_pbl)
 {
        u32 page_cnt;
        enum _ecore_status_t rc = ECORE_SUCCESS;
@@ -3381,7 +3481,7 @@ enum _ecore_status_t ecore_chain_alloc(struct ecore_dev *p_dev,
                rc = ecore_chain_alloc_single(p_dev, p_chain);
                break;
        case ECORE_CHAIN_MODE_PBL:
-               rc = ecore_chain_alloc_pbl(p_dev, p_chain);
+               rc = ecore_chain_alloc_pbl(p_dev, p_chain, ext_pbl);
                break;
        }
        if (rc)
@@ -3776,8 +3876,8 @@ static enum _ecore_status_t ecore_set_coalesce(struct ecore_hwfn *p_hwfn,
                return ECORE_INVAL;
        }
 
-       OSAL_MEMSET(p_eth_qzone, 0, eth_qzone_size);
        p_coal_timeset = p_eth_qzone;
+       OSAL_MEMSET(p_eth_qzone, 0, eth_qzone_size);
        SET_FIELD(p_coal_timeset->value, COALESCING_TIMESET_TIMESET, timeset);
        SET_FIELD(p_coal_timeset->value, COALESCING_TIMESET_VALID, 1);
        ecore_memcpy_to(p_hwfn, p_ptt, hw_addr, p_eth_qzone, eth_qzone_size);
@@ -3787,13 +3887,13 @@ static enum _ecore_status_t ecore_set_coalesce(struct ecore_hwfn *p_hwfn,
 
 enum _ecore_status_t ecore_set_rxq_coalesce(struct ecore_hwfn *p_hwfn,
                                            struct ecore_ptt *p_ptt,
-                                           u16 coalesce, u8 qid, u16 sb_id)
+                                           u16 coalesce, u16 qid, u16 sb_id)
 {
        struct ustorm_eth_queue_zone eth_qzone;
+       u8 timeset, timer_res;
        u16 fw_qid = 0;
        u32 address;
        enum _ecore_status_t rc;
-       u8 timeset, timer_res;
 
        /* Coalesce = (timeset << timer-resolution), timeset is 7bit wide */
        if (coalesce <= 0x7F) {
@@ -3808,7 +3908,7 @@ enum _ecore_status_t ecore_set_rxq_coalesce(struct ecore_hwfn *p_hwfn,
        }
        timeset = (u8)(coalesce >> timer_res);
 
-       rc = ecore_fw_l2_queue(p_hwfn, (u16)qid, &fw_qid);
+       rc = ecore_fw_l2_queue(p_hwfn, qid, &fw_qid);
        if (rc != ECORE_SUCCESS)
                return rc;
 
@@ -3830,13 +3930,13 @@ enum _ecore_status_t ecore_set_rxq_coalesce(struct ecore_hwfn *p_hwfn,
 
 enum _ecore_status_t ecore_set_txq_coalesce(struct ecore_hwfn *p_hwfn,
                                            struct ecore_ptt *p_ptt,
-                                           u16 coalesce, u8 qid, u16 sb_id)
+                                           u16 coalesce, u16 qid, u16 sb_id)
 {
        struct xstorm_eth_queue_zone eth_qzone;
+       u8 timeset, timer_res;
        u16 fw_qid = 0;
        u32 address;
        enum _ecore_status_t rc;
-       u8 timeset, timer_res;
 
        /* Coalesce = (timeset << timer-resolution), timeset is 7bit wide */
        if (coalesce <= 0x7F) {
@@ -3852,7 +3952,7 @@ enum _ecore_status_t ecore_set_txq_coalesce(struct ecore_hwfn *p_hwfn,
 
        timeset = (u8)(coalesce >> timer_res);
 
-       rc = ecore_fw_l2_queue(p_hwfn, (u16)qid, &fw_qid);
+       rc = ecore_fw_l2_queue(p_hwfn, qid, &fw_qid);
        if (rc != ECORE_SUCCESS)
                return rc;
 
@@ -4293,3 +4393,16 @@ int ecore_device_num_ports(struct ecore_dev *p_dev)
 
        return p_dev->num_ports_in_engines * ecore_device_num_engines(p_dev);
 }
+
+void ecore_set_fw_mac_addr(__le16 *fw_msb,
+                         __le16 *fw_mid,
+                         __le16 *fw_lsb,
+                         u8 *mac)
+{
+       ((u8 *)fw_msb)[0] = mac[1];
+       ((u8 *)fw_msb)[1] = mac[0];
+       ((u8 *)fw_mid)[0] = mac[3];
+       ((u8 *)fw_mid)[1] = mac[2];
+       ((u8 *)fw_lsb)[0] = mac[5];
+       ((u8 *)fw_lsb)[1] = mac[4];
+}