net/qede/base: use default MTU from shared memory
[dpdk.git] / drivers / net / qede / base / ecore_mcp.c
index adcb0f0..8720ae7 100644 (file)
@@ -104,7 +104,6 @@ enum _ecore_status_t ecore_mcp_free(struct ecore_hwfn *p_hwfn)
                OSAL_SPIN_LOCK_DEALLOC(&p_hwfn->mcp_info->lock);
        }
        OSAL_FREE(p_hwfn->p_dev, p_hwfn->mcp_info);
-       p_hwfn->mcp_info = OSAL_NULL;
 
        return ECORE_SUCCESS;
 }
@@ -801,9 +800,6 @@ 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);
 }
 
@@ -934,7 +930,7 @@ static void ecore_mcp_send_protocol_stats(struct ecore_hwfn *p_hwfn,
                hsi_param = DRV_MSG_CODE_STATS_TYPE_LAN;
                break;
        default:
-               DP_NOTICE(p_hwfn, false, "Invalid protocol type %d\n", type);
+               DP_INFO(p_hwfn, "Invalid protocol type %d\n", type);
                return;
        }
 
@@ -948,9 +944,8 @@ static void ecore_mcp_send_protocol_stats(struct ecore_hwfn *p_hwfn,
        ecore_mcp_cmd_and_union(p_hwfn, p_ptt, &mb_params);
 }
 
-static void
-ecore_read_pf_bandwidth(struct ecore_hwfn *p_hwfn,
-                       struct public_func *p_shmem_info)
+static void ecore_read_pf_bandwidth(struct ecore_hwfn *p_hwfn,
+                                   struct public_func *p_shmem_info)
 {
        struct ecore_mcp_function_info *p_info;
 
@@ -1272,9 +1267,7 @@ enum _ecore_status_t ecore_mcp_handle_events(struct ecore_hwfn *p_hwfn,
                        ecore_mcp_handle_critical_error(p_hwfn, p_ptt);
                        break;
                default:
-                       /* @DPDK */
-                       DP_NOTICE(p_hwfn, false,
-                                 "Unimplemented MFW message %d\n", i);
+                       DP_INFO(p_hwfn, "Unimplemented MFW message %d\n", i);
                        rc = ECORE_INVAL;
                }
        }
@@ -1438,6 +1431,16 @@ enum _ecore_status_t ecore_mcp_fill_shmem_func_info(struct ecore_hwfn *p_hwfn,
 
        info->ovlan = (u16)(shmem_info.ovlan_stag & FUNC_MF_CFG_OV_STAG_MASK);
 
+       info->mtu = (u16)shmem_info.mtu_size;
+
+       if (info->mtu == 0)
+               info->mtu = 1500;
+
+       info->mtu = (u16)shmem_info.mtu_size;
+
+       if (info->mtu == 0)
+               info->mtu = 1500;
+
        DP_VERBOSE(p_hwfn, (ECORE_MSG_SP | ECORE_MSG_IFUP),
                   "Read configuration from shmem: pause_on_host %02x"
                    " protocol %02x BW [%02x - %02x]"
@@ -1669,6 +1672,7 @@ ecore_mcp_send_drv_version(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
        p_drv_version->version = p_ver->version;
        num_words = (MCP_DRV_VER_STR_SIZE - 4) / 4;
        for (i = 0; i < num_words; i++) {
+               /* The driver name is expected to be in a big-endian format */
                p_name = &p_ver->name[i * sizeof(u32)];
                val = OSAL_CPU_TO_BE32(*(u32 *)p_name);
                *(u32 *)&p_drv_version->name[i * sizeof(u32)] = val;
@@ -1716,22 +1720,24 @@ enum _ecore_status_t ecore_mcp_resume(struct ecore_hwfn *p_hwfn,
 enum _ecore_status_t
 ecore_mcp_ov_update_current_config(struct ecore_hwfn *p_hwfn,
                                   struct ecore_ptt *p_ptt,
-                                  enum ecore_ov_config_method config,
                                   enum ecore_ov_client client)
 {
        enum _ecore_status_t rc;
        u32 resp = 0, param = 0;
        u32 drv_mb_param;
 
-       switch (config) {
+       switch (client) {
        case ECORE_OV_CLIENT_DRV:
                drv_mb_param = DRV_MB_PARAM_OV_CURR_CFG_OS;
                break;
        case ECORE_OV_CLIENT_USER:
                drv_mb_param = DRV_MB_PARAM_OV_CURR_CFG_OTHER;
                break;
+       case ECORE_OV_CLIENT_VENDOR_SPEC:
+               drv_mb_param = DRV_MB_PARAM_OV_CURR_CFG_VENDOR_SPEC;
+               break;
        default:
-               DP_NOTICE(p_hwfn, true, "Invalid client type %d\n", config);
+               DP_NOTICE(p_hwfn, true, "Invalid client type %d\n", client);
                return ECORE_INVAL;
        }
 
@@ -1768,9 +1774,9 @@ ecore_mcp_ov_update_driver_state(struct ecore_hwfn *p_hwfn,
        }
 
        rc = ecore_mcp_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_OV_UPDATE_DRIVER_STATE,
-                          drv_state, &resp, &param);
+                          drv_mb_param, &resp, &param);
        if (rc != ECORE_SUCCESS)
-               DP_ERR(p_hwfn, "MCP response failure, aborting\n");
+               DP_ERR(p_hwfn, "Failed to send driver state\n");
 
        return rc;
 }
@@ -2267,7 +2273,7 @@ enum _ecore_status_t ecore_mcp_bist_register_test(struct ecore_hwfn *p_hwfn,
 enum _ecore_status_t ecore_mcp_bist_clock_test(struct ecore_hwfn *p_hwfn,
                                               struct ecore_ptt *p_ptt)
 {
-       u32 drv_mb_param = 0, rsp, param;
+       u32 drv_mb_param, rsp, param;
        enum _ecore_status_t rc = ECORE_SUCCESS;
 
        drv_mb_param = (DRV_MB_PARAM_BIST_CLOCK_TEST <<
@@ -2433,15 +2439,15 @@ enum _ecore_status_t ecore_mcp_get_resc_info(struct ecore_hwfn *p_hwfn,
                                             u32 *p_mcp_resp, u32 *p_mcp_param)
 {
        struct ecore_mcp_mb_params mb_params;
-       union drv_union_data *p_union_data;
+       union drv_union_data union_data;
        enum _ecore_status_t rc;
 
        OSAL_MEM_ZERO(&mb_params, sizeof(mb_params));
        mb_params.cmd = DRV_MSG_GET_RESOURCE_ALLOC_MSG;
        mb_params.param = ECORE_RESC_ALLOC_VERSION;
-       p_union_data = (union drv_union_data *)p_resc_info;
-       mb_params.p_data_src = p_union_data;
-       mb_params.p_data_dst = p_union_data;
+       OSAL_MEMCPY(&union_data.resource, p_resc_info, sizeof(*p_resc_info));
+       mb_params.p_data_src = &union_data;
+       mb_params.p_data_dst = &union_data;
        rc = ecore_mcp_cmd_and_union(p_hwfn, p_ptt, &mb_params);
        if (rc != ECORE_SUCCESS)
                return rc;
@@ -2449,6 +2455,8 @@ enum _ecore_status_t ecore_mcp_get_resc_info(struct ecore_hwfn *p_hwfn,
        *p_mcp_resp = mb_params.mcp_resp;
        *p_mcp_param = mb_params.mcp_param;
 
+       OSAL_MEMCPY(p_resc_info, &union_data.resource, sizeof(*p_resc_info));
+
        DP_VERBOSE(p_hwfn, ECORE_MSG_SP,
                   "MFW resource_info: version 0x%x, res_id 0x%x, size 0x%x,"
                   " offset 0x%x, vf_size 0x%x, vf_offset 0x%x, flags 0x%x\n",