net/qede/base: serialize access to MFW mbox
[dpdk.git] / drivers / net / qede / base / ecore_mcp.c
index d287a36..12e1ec1 100644 (file)
 #include "reg_addr.h"
 #include "ecore_hw.h"
 #include "ecore_init_fw_funcs.h"
+#include "ecore_sriov.h"
+#include "ecore_iov_api.h"
 #include "ecore_gtt_reg_addr.h"
 #include "ecore_iro.h"
+#include "ecore_dcbx.h"
 
 #define CHIP_MCP_RESP_ITER_US 10
 #define EMUL_MCP_RESP_ITER_US (1000 * 1000)
@@ -132,7 +135,8 @@ static enum _ecore_status_t ecore_load_mcp_offsets(struct ecore_hwfn *p_hwfn,
                                                       PUBLIC_DRV_MB));
        p_info->drv_mb_addr = SECTION_ADDR(drv_mb_offsize, mcp_pf_id);
        DP_VERBOSE(p_hwfn, ECORE_MSG_SP,
-                  "drv_mb_offsiz = 0x%x, drv_mb_addr = 0x%x mcp_pf_id = 0x%x\n",
+                  "drv_mb_offsiz = 0x%x, drv_mb_addr = 0x%x"
+                  " mcp_pf_id = 0x%x\n",
                   drv_mb_offsize, p_info->drv_mb_addr, mcp_pf_id);
 
        /* Set the MFW MB address */
@@ -198,6 +202,51 @@ err:
        return ECORE_NOMEM;
 }
 
+/* Locks the MFW mailbox of a PF to ensure a single access.
+ * The lock is achieved in most cases by holding a spinlock, causing other
+ * threads to wait till a previous access is done.
+ * In some cases (currently when a [UN]LOAD_REQ commands are sent), the single
+ * access is achieved by setting a blocking flag, which will fail other
+ * competing contexts to send their mailboxes.
+ */
+static enum _ecore_status_t ecore_mcp_mb_lock(struct ecore_hwfn *p_hwfn,
+                                             u32 cmd)
+{
+       OSAL_SPIN_LOCK(&p_hwfn->mcp_info->lock);
+
+       /* The spinlock shouldn't be acquired when the mailbox command is
+        * [UN]LOAD_REQ, since the engine is locked by the MFW, and a parallel
+        * pending [UN]LOAD_REQ command of another PF together with a spinlock
+        * (i.e. interrupts are disabled) - can lead to a deadlock.
+        * It is assumed that for a single PF, no other mailbox commands can be
+        * sent from another context while sending LOAD_REQ, and that any
+        * parallel commands to UNLOAD_REQ can be cancelled.
+        */
+       if (cmd == DRV_MSG_CODE_LOAD_DONE || cmd == DRV_MSG_CODE_UNLOAD_DONE)
+               p_hwfn->mcp_info->block_mb_sending = false;
+
+       if (p_hwfn->mcp_info->block_mb_sending) {
+               DP_NOTICE(p_hwfn, false,
+                         "Trying to send a MFW mailbox command [0x%x] in parallel to [UN]LOAD_REQ. Aborting.\n",
+                         cmd);
+               OSAL_SPIN_UNLOCK(&p_hwfn->mcp_info->lock);
+               return ECORE_BUSY;
+       }
+
+       if (cmd == DRV_MSG_CODE_LOAD_REQ || cmd == DRV_MSG_CODE_UNLOAD_REQ) {
+               p_hwfn->mcp_info->block_mb_sending = true;
+               OSAL_SPIN_UNLOCK(&p_hwfn->mcp_info->lock);
+       }
+
+       return ECORE_SUCCESS;
+}
+
+static void ecore_mcp_mb_unlock(struct ecore_hwfn *p_hwfn, u32 cmd)
+{
+       if (cmd != DRV_MSG_CODE_LOAD_REQ && cmd != DRV_MSG_CODE_UNLOAD_REQ)
+               OSAL_SPIN_UNLOCK(&p_hwfn->mcp_info->lock);
+}
+
 enum _ecore_status_t ecore_mcp_reset(struct ecore_hwfn *p_hwfn,
                                     struct ecore_ptt *p_ptt)
 {
@@ -210,8 +259,12 @@ enum _ecore_status_t ecore_mcp_reset(struct ecore_hwfn *p_hwfn,
        if (CHIP_REV_IS_EMUL(p_hwfn->p_dev))
                delay = EMUL_MCP_RESP_ITER_US;
 #endif
-
-       OSAL_SPIN_LOCK(&p_hwfn->mcp_info->lock);
+       /* Ensure that only a single thread is accessing the mailbox at a
+        * certain time.
+        */
+       rc = ecore_mcp_mb_lock(p_hwfn, DRV_MSG_CODE_MCP_RESET);
+       if (rc != ECORE_SUCCESS)
+               return rc;
 
        /* Set drv command along with the updated sequence */
        org_mcp_reset_seq = ecore_rd(p_hwfn, p_ptt, MISCS_REG_GENERIC_POR_0);
@@ -234,7 +287,7 @@ enum _ecore_status_t ecore_mcp_reset(struct ecore_hwfn *p_hwfn,
                rc = ECORE_AGAIN;
        }
 
-       OSAL_SPIN_UNLOCK(&p_hwfn->mcp_info->lock);
+       ecore_mcp_mb_unlock(p_hwfn, DRV_MSG_CODE_MCP_RESET);
 
        return rc;
 }
@@ -309,32 +362,10 @@ static enum _ecore_status_t ecore_do_mcp_cmd(struct ecore_hwfn *p_hwfn,
        return rc;
 }
 
-enum _ecore_status_t ecore_mcp_cmd(struct ecore_hwfn *p_hwfn,
-                                  struct ecore_ptt *p_ptt, u32 cmd, u32 param,
-                                  u32 *o_mcp_resp, u32 *o_mcp_param)
-{
-#ifndef ASIC_ONLY
-       if (CHIP_REV_IS_EMUL(p_hwfn->p_dev)) {
-               if (cmd == DRV_MSG_CODE_UNLOAD_REQ) {
-                       loaded--;
-                       loaded_port[p_hwfn->port_id]--;
-                       DP_VERBOSE(p_hwfn, ECORE_MSG_SP, "Unload cnt: 0x%x\n",
-                                  loaded);
-               }
-               return ECORE_SUCCESS;
-       }
-#endif
-
-       return ecore_mcp_cmd_and_union(p_hwfn, p_ptt, cmd, param, OSAL_NULL,
-                                      o_mcp_resp, o_mcp_param);
-}
 
-enum _ecore_status_t ecore_mcp_cmd_and_union(struct ecore_hwfn *p_hwfn,
-                                            struct ecore_ptt *p_ptt,
-                                            u32 cmd, u32 param,
-                                            union drv_union_data *p_union_data,
-                                            u32 *o_mcp_resp,
-                                            u32 *o_mcp_param)
+static enum _ecore_status_t
+ecore_mcp_cmd_and_union(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
+                       struct ecore_mcp_mb_params *p_mb_params)
 {
        u32 union_data_addr;
        enum _ecore_status_t rc;
@@ -345,26 +376,66 @@ enum _ecore_status_t ecore_mcp_cmd_and_union(struct ecore_hwfn *p_hwfn,
                return ECORE_BUSY;
        }
 
-       /* Acquiring a spinlock is needed to ensure that only a single thread
-        * is accessing the mailbox at a certain time.
+       union_data_addr = p_hwfn->mcp_info->drv_mb_addr +
+                         OFFSETOF(struct public_drv_mb, union_data);
+
+       /* Ensure that only a single thread is accessing the mailbox at a
+        * certain time.
         */
-       OSAL_SPIN_LOCK(&p_hwfn->mcp_info->lock);
+       rc = ecore_mcp_mb_lock(p_hwfn, p_mb_params->cmd);
+       if (rc != ECORE_SUCCESS)
+               return rc;
 
-       if (p_union_data != OSAL_NULL) {
-               union_data_addr = p_hwfn->mcp_info->drv_mb_addr +
-                   OFFSETOF(struct public_drv_mb, union_data);
-               ecore_memcpy_to(p_hwfn, p_ptt, union_data_addr, p_union_data,
-                               sizeof(*p_union_data));
-       }
+       if (p_mb_params->p_data_src != OSAL_NULL)
+               ecore_memcpy_to(p_hwfn, p_ptt, union_data_addr,
+                               p_mb_params->p_data_src,
+                               sizeof(*p_mb_params->p_data_src));
 
-       rc = ecore_do_mcp_cmd(p_hwfn, p_ptt, cmd, param, o_mcp_resp,
-                             o_mcp_param);
+       rc = ecore_do_mcp_cmd(p_hwfn, p_ptt, p_mb_params->cmd,
+                             p_mb_params->param, &p_mb_params->mcp_resp,
+                             &p_mb_params->mcp_param);
 
-       OSAL_SPIN_UNLOCK(&p_hwfn->mcp_info->lock);
+       if (p_mb_params->p_data_dst != OSAL_NULL)
+               ecore_memcpy_from(p_hwfn, p_ptt, p_mb_params->p_data_dst,
+                                 union_data_addr,
+                                 sizeof(*p_mb_params->p_data_dst));
+
+       ecore_mcp_mb_unlock(p_hwfn, p_mb_params->cmd);
 
        return rc;
 }
 
+enum _ecore_status_t ecore_mcp_cmd(struct ecore_hwfn *p_hwfn,
+                                  struct ecore_ptt *p_ptt, u32 cmd, u32 param,
+                                  u32 *o_mcp_resp, u32 *o_mcp_param)
+{
+       struct ecore_mcp_mb_params mb_params;
+       enum _ecore_status_t rc;
+
+#ifndef ASIC_ONLY
+       if (CHIP_REV_IS_EMUL(p_hwfn->p_dev)) {
+               if (cmd == DRV_MSG_CODE_UNLOAD_REQ) {
+                       loaded--;
+                       loaded_port[p_hwfn->port_id]--;
+                       DP_VERBOSE(p_hwfn, ECORE_MSG_SP, "Unload cnt: 0x%x\n",
+                                  loaded);
+               }
+               return ECORE_SUCCESS;
+       }
+#endif
+       OSAL_MEM_ZERO(&mb_params, sizeof(mb_params));
+       mb_params.cmd = cmd;
+       mb_params.param = param;
+       rc = ecore_mcp_cmd_and_union(p_hwfn, p_ptt, &mb_params);
+       if (rc != ECORE_SUCCESS)
+               return rc;
+
+       *o_mcp_resp = mb_params.mcp_resp;
+       *o_mcp_param = mb_params.mcp_param;
+
+       return ECORE_SUCCESS;
+}
+
 enum _ecore_status_t ecore_mcp_nvm_wr_cmd(struct ecore_hwfn *p_hwfn,
                                          struct ecore_ptt *p_ptt,
                                          u32 cmd,
@@ -373,12 +444,23 @@ enum _ecore_status_t ecore_mcp_nvm_wr_cmd(struct ecore_hwfn *p_hwfn,
                                          u32 *o_mcp_param,
                                          u32 i_txn_size, u32 *i_buf)
 {
+       struct ecore_mcp_mb_params mb_params;
        union drv_union_data union_data;
+       enum _ecore_status_t rc;
 
-       OSAL_MEMCPY((u32 *)&union_data.raw_data, i_buf, i_txn_size);
+       OSAL_MEM_ZERO(&mb_params, sizeof(mb_params));
+       mb_params.cmd = cmd;
+       mb_params.param = param;
+       OSAL_MEMCPY(&union_data.raw_data, i_buf, i_txn_size);
+       mb_params.p_data_src = &union_data;
+       rc = ecore_mcp_cmd_and_union(p_hwfn, p_ptt, &mb_params);
+       if (rc != ECORE_SUCCESS)
+               return rc;
 
-       return ecore_mcp_cmd_and_union(p_hwfn, p_ptt, cmd, param, &union_data,
-                                      o_mcp_resp, o_mcp_param);
+       *o_mcp_resp = mb_params.mcp_resp;
+       *o_mcp_param = mb_params.mcp_param;
+
+       return ECORE_SUCCESS;
 }
 
 enum _ecore_status_t ecore_mcp_nvm_rd_cmd(struct ecore_hwfn *p_hwfn,
@@ -448,6 +530,7 @@ enum _ecore_status_t ecore_mcp_load_req(struct ecore_hwfn *p_hwfn,
                                        u32 *p_load_code)
 {
        struct ecore_dev *p_dev = p_hwfn->p_dev;
+       struct ecore_mcp_mb_params mb_params;
        union drv_union_data union_data;
        u32 param;
        enum _ecore_status_t rc;
@@ -459,12 +542,13 @@ enum _ecore_status_t ecore_mcp_load_req(struct ecore_hwfn *p_hwfn,
        }
 #endif
 
+       OSAL_MEM_ZERO(&mb_params, sizeof(mb_params));
+       mb_params.cmd = DRV_MSG_CODE_LOAD_REQ;
+       mb_params.param = PDA_COMP | DRV_ID_MCP_HSI_VER_CURRENT |
+                         p_dev->drv_type;
        OSAL_MEMCPY(&union_data.ver_str, p_dev->ver_str, MCP_DRV_VER_STR_SIZE);
-
-       rc = ecore_mcp_cmd_and_union(p_hwfn, p_ptt, DRV_MSG_CODE_LOAD_REQ,
-                                    (PDA_COMP | DRV_ID_MCP_HSI_VER_CURRENT |
-                                     p_dev->drv_type),
-                                    &union_data, p_load_code, &param);
+       mb_params.p_data_src = &union_data;
+       rc = ecore_mcp_cmd_and_union(p_hwfn, p_ptt, &mb_params);
 
        /* if mcp fails to respond we must abort */
        if (rc != ECORE_SUCCESS) {
@@ -517,6 +601,9 @@ static void ecore_mcp_handle_vf_flr(struct ecore_hwfn *p_hwfn,
                           "FLR-ed VFs [%08x,...,%08x] - %08x\n",
                           i * 32, (i + 1) * 32 - 1, disabled_vfs[i]);
        }
+
+       if (ecore_iov_mark_vf_flr(p_hwfn, disabled_vfs))
+               OSAL_VF_FLR_UPDATE(p_hwfn);
 }
 
 enum _ecore_status_t ecore_mcp_ack_vf_flr(struct ecore_hwfn *p_hwfn,
@@ -528,6 +615,7 @@ enum _ecore_status_t ecore_mcp_ack_vf_flr(struct ecore_hwfn *p_hwfn,
        u32 mfw_func_offsize = ecore_rd(p_hwfn, p_ptt, addr);
        u32 func_addr = SECTION_ADDR(mfw_func_offsize,
                                     MCP_PF_ID(p_hwfn));
+       struct ecore_mcp_mb_params mb_params;
        union drv_union_data union_data;
        u32 resp, param;
        enum _ecore_status_t rc;
@@ -538,11 +626,11 @@ enum _ecore_status_t ecore_mcp_ack_vf_flr(struct ecore_hwfn *p_hwfn,
                           "Acking VFs [%08x,...,%08x] - %08x\n",
                           i * 32, (i + 1) * 32 - 1, vfs_to_ack[i]);
 
+       OSAL_MEM_ZERO(&mb_params, sizeof(mb_params));
+       mb_params.cmd = DRV_MSG_CODE_VF_DISABLED_DONE;
        OSAL_MEMCPY(&union_data.ack_vf_disabled, vfs_to_ack, VF_MAX_STATIC / 8);
-
-       rc = ecore_mcp_cmd_and_union(p_hwfn, p_ptt,
-                                    DRV_MSG_CODE_VF_DISABLED_DONE, 0,
-                                    &union_data, &resp, &param);
+       mb_params.p_data_src = &union_data;
+       rc = ecore_mcp_cmd_and_union(p_hwfn, p_ptt, &mb_params);
        if (rc != ECORE_SUCCESS) {
                DP_NOTICE(p_hwfn, (ECORE_MSG_SP | ECORE_MSG_IOV),
                          "Failed to pass ACK for VF flr to MFW\n");
@@ -571,7 +659,7 @@ static void ecore_mcp_handle_transceiver_change(struct ecore_hwfn *p_hwfn,
 
        DP_VERBOSE(p_hwfn, (ECORE_MSG_HW | ECORE_MSG_SP),
                   "Received transceiver state update [0x%08x] from mfw"
-                  "[Addr 0x%x]\n",
+                  " [Addr 0x%x]\n",
                   transceiver_state, (u32)(p_hwfn->mcp_info->port_addr +
                                            OFFSETOF(struct public_port,
                                                     transceiver_data)));
@@ -655,18 +743,18 @@ static void ecore_mcp_handle_link_change(struct ecore_hwfn *p_hwfn,
        if (p_hwfn->mcp_info->func_info.bandwidth_max && p_link->speed) {
                u8 max_bw = p_hwfn->mcp_info->func_info.bandwidth_max;
 
-               __ecore_configure_pf_max_bandwidth(p_hwfn, p_ptt,
-                                                  p_link, max_bw);
+       __ecore_configure_pf_max_bandwidth(p_hwfn, p_ptt,
+                                          p_link, max_bw);
        }
 
        if (p_hwfn->mcp_info->func_info.bandwidth_min && p_link->speed) {
                u8 min_bw = p_hwfn->mcp_info->func_info.bandwidth_min;
 
-               __ecore_configure_pf_min_bandwidth(p_hwfn, p_ptt,
-                                                  p_link, min_bw);
+       __ecore_configure_pf_min_bandwidth(p_hwfn, p_ptt,
+                                          p_link, min_bw);
 
-               ecore_configure_vp_wfq_on_link_change(p_hwfn->p_dev,
-                                                     p_link->min_pf_rate);
+       ecore_configure_vp_wfq_on_link_change(p_hwfn->p_dev,
+                                             p_link->min_pf_rate);
        }
 
        p_link->an = !!(status & LINK_STATUS_AUTO_NEGOTIATE_ENABLED);
@@ -721,6 +809,9 @@ static void ecore_mcp_handle_link_change(struct ecore_hwfn *p_hwfn,
 
        p_link->sfp_tx_fault = !!(status & LINK_STATUS_SFP_TX_FAULT);
 
+       if (p_link->link_up)
+               ecore_dcbx_eagle_workaround(p_hwfn, p_ptt, p_link->pfc_enabled);
+
        OSAL_LINK_UPDATE(p_hwfn);
 }
 
@@ -728,6 +819,7 @@ enum _ecore_status_t ecore_mcp_set_link(struct ecore_hwfn *p_hwfn,
                                        struct ecore_ptt *p_ptt, bool b_up)
 {
        struct ecore_mcp_link_params *params = &p_hwfn->mcp_info->link_input;
+       struct ecore_mcp_mb_params mb_params;
        union drv_union_data union_data;
        struct pmm_phy_cfg *p_phy_cfg;
        u32 param = 0, reply = 0, cmd;
@@ -772,8 +864,10 @@ enum _ecore_status_t ecore_mcp_set_link(struct ecore_hwfn *p_hwfn,
        else
                DP_VERBOSE(p_hwfn, ECORE_MSG_LINK, "Resetting link\n");
 
-       rc = ecore_mcp_cmd_and_union(p_hwfn, p_ptt, cmd, 0, &union_data, &reply,
-                                    &param);
+       OSAL_MEM_ZERO(&mb_params, sizeof(mb_params));
+       mb_params.cmd = cmd;
+       mb_params.p_data_src = &union_data;
+       rc = ecore_mcp_cmd_and_union(p_hwfn, p_ptt, &mb_params);
 
        /* if mcp fails to respond we must abort */
        if (rc != ECORE_SUCCESS) {
@@ -793,6 +887,10 @@ u32 ecore_get_process_kill_counter(struct ecore_hwfn *p_hwfn,
 {
        u32 path_offsize_addr, path_offsize, path_addr, proc_kill_cnt;
 
+       /* TODO - Add support for VFs */
+       if (IS_VF(p_hwfn->p_dev))
+               return ECORE_INVAL;
+
        path_offsize_addr = SECTION_OFFSIZE_ADDR(p_hwfn->mcp_info->public_base,
                                                 PUBLIC_PATH);
        path_offsize = ecore_rd(p_hwfn, p_ptt, path_offsize_addr);
@@ -846,6 +944,7 @@ static void ecore_mcp_send_protocol_stats(struct ecore_hwfn *p_hwfn,
 {
        enum ecore_mcp_protocol_type stats_type;
        union ecore_mcp_protocol_stats stats;
+       struct ecore_mcp_mb_params mb_params;
        u32 hsi_param, param = 0, reply = 0;
        union drv_union_data union_data;
 
@@ -861,10 +960,12 @@ static void ecore_mcp_send_protocol_stats(struct ecore_hwfn *p_hwfn,
 
        OSAL_GET_PROTOCOL_STATS(p_hwfn->p_dev, stats_type, &stats);
 
+       OSAL_MEM_ZERO(&mb_params, sizeof(mb_params));
+       mb_params.cmd = DRV_MSG_CODE_GET_STATS;
+       mb_params.param = hsi_param;
        OSAL_MEMCPY(&union_data, &stats, sizeof(stats));
-
-       ecore_mcp_cmd_and_union(p_hwfn, p_ptt, DRV_MSG_CODE_GET_STATS,
-                               hsi_param, &union_data, &reply, &param);
+       mb_params.p_data_src = &union_data;
+       ecore_mcp_cmd_and_union(p_hwfn, p_ptt, &mb_params);
 }
 
 static u32 ecore_mcp_get_shmem_func(struct ecore_hwfn *p_hwfn,
@@ -989,6 +1090,18 @@ enum _ecore_status_t ecore_mcp_handle_events(struct ecore_hwfn *p_hwfn,
                case MFW_DRV_MSG_VF_DISABLED:
                        ecore_mcp_handle_vf_flr(p_hwfn, p_ptt);
                        break;
+               case MFW_DRV_MSG_LLDP_DATA_UPDATED:
+                       ecore_dcbx_mib_update_event(p_hwfn, p_ptt,
+                                                   ECORE_DCBX_REMOTE_LLDP_MIB);
+                       break;
+               case MFW_DRV_MSG_DCBX_REMOTE_MIB_UPDATED:
+                       ecore_dcbx_mib_update_event(p_hwfn, p_ptt,
+                                                   ECORE_DCBX_REMOTE_MIB);
+                       break;
+               case MFW_DRV_MSG_DCBX_OPERATIONAL_MIB_UPDATED:
+                       ecore_dcbx_mib_update_event(p_hwfn, p_ptt,
+                                                   ECORE_DCBX_OPERATIONAL_MIB);
+                       break;
                case MFW_DRV_MSG_ERROR_RECOVERY:
                        ecore_mcp_handle_process_kill(p_hwfn, p_ptt);
                        break;
@@ -1054,6 +1167,20 @@ enum _ecore_status_t ecore_mcp_get_mfw_ver(struct ecore_dev *p_dev,
        }
 #endif
 
+       if (IS_VF(p_dev)) {
+               if (p_hwfn->vf_iov_info) {
+                       struct pfvf_acquire_resp_tlv *p_resp;
+
+                       p_resp = &p_hwfn->vf_iov_info->acquire_resp;
+                       *p_mfw_ver = p_resp->pfdev_info.mfw_ver;
+                       return ECORE_SUCCESS;
+               }
+
+               DP_VERBOSE(p_dev, ECORE_MSG_IOV,
+                          "VF requested MFW vers prior to ACQUIRE\n");
+                       return ECORE_INVAL;
+               }
+
        global_offsize = ecore_rd(p_hwfn, p_ptt,
                                  SECTION_OFFSIZE_ADDR(p_hwfn->mcp_info->
                                                       public_base,
@@ -1080,6 +1207,10 @@ enum _ecore_status_t ecore_mcp_get_media_type(struct ecore_dev *p_dev,
        struct ecore_hwfn *p_hwfn = &p_dev->hwfns[0];
        struct ecore_ptt *p_ptt;
 
+       /* TODO - Add support for VFs */
+       if (IS_VF(p_dev))
+               return ECORE_INVAL;
+
        if (!ecore_mcp_is_init(p_hwfn)) {
                DP_NOTICE(p_hwfn, true, "MFW is not initialized !\n");
                return ECORE_BUSY;
@@ -1154,8 +1285,8 @@ enum _ecore_status_t ecore_mcp_fill_shmem_func_info(struct ecore_hwfn *p_hwfn,
        DP_VERBOSE(p_hwfn, (ECORE_MSG_SP | ECORE_MSG_IFUP),
                   "Read configuration from shmem: pause_on_host %02x"
                    " protocol %02x BW [%02x - %02x]"
-                   " MAC %02x:%02x:%02x:%02x:%02x:%02x wwn port %lx"
-                   " node %lx ovlan %04x\n",
+                   " MAC %02x:%02x:%02x:%02x:%02x:%02x wwn port %" PRIx64
+                   " node %" PRIx64 " ovlan %04x\n",
                   info->pause_on_host, info->protocol,
                   info->bandwidth_min, info->bandwidth_max,
                   info->mac[0], info->mac[1], info->mac[2],
@@ -1295,6 +1426,9 @@ enum _ecore_status_t ecore_mcp_get_flash_size(struct ecore_hwfn *p_hwfn,
        }
 #endif
 
+       if (IS_VF(p_hwfn->p_dev))
+               return ECORE_INVAL;
+
        flash_size = ecore_rd(p_hwfn, p_ptt, MCP_REG_NVM_CFG4);
        flash_size = (flash_size & MCP_REG_NVM_CFG4_FLASH_SIZE) >>
            MCP_REG_NVM_CFG4_FLASH_SIZE_SHIFT;
@@ -1353,6 +1487,7 @@ ecore_mcp_send_drv_version(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
 {
        u32 param = 0, reply = 0, num_words, i;
        struct drv_version_stc *p_drv_version;
+       struct ecore_mcp_mb_params mb_params;
        union drv_union_data union_data;
        void *p_name;
        OSAL_BE32 val;
@@ -1372,8 +1507,10 @@ ecore_mcp_send_drv_version(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
                *(u32 *)&p_drv_version->name[i * sizeof(u32)] = val;
        }
 
-       rc = ecore_mcp_cmd_and_union(p_hwfn, p_ptt, DRV_MSG_CODE_SET_VERSION, 0,
-                                    &union_data, &reply, &param);
+       OSAL_MEM_ZERO(&mb_params, sizeof(mb_params));
+       mb_params.cmd = DRV_MSG_CODE_SET_VERSION;
+       mb_params.p_data_src = &union_data;
+       rc = ecore_mcp_cmd_and_union(p_hwfn, p_ptt, &mb_params);
        if (rc != ECORE_SUCCESS)
                DP_ERR(p_hwfn, "MCP response failure, aborting\n");