net/thunderx/base: add functions to store qsets
[dpdk.git] / drivers / net / qede / base / ecore_mcp.c
index d287a36..9dd2eed 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)
@@ -517,6 +520,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,
@@ -721,6 +727,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);
 }
 
@@ -793,6 +802,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);
@@ -989,6 +1002,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 +1079,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 +1119,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 +1197,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 +1338,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;