From: Rasesh Mody Date: Wed, 29 Mar 2017 20:36:12 +0000 (-0700) Subject: net/qede/base: use default MTU from shared memory X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5c11b7066f9003386c906042dd0850d70e5991e0;p=dpdk.git net/qede/base: use default MTU from shared memory Read and use the default MTU value from shared-memory. Signed-off-by: Rasesh Mody --- diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h index a6cf52e4b1..25c96f83ef 100644 --- a/drivers/net/qede/base/ecore.h +++ b/drivers/net/qede/base/ecore.h @@ -377,6 +377,8 @@ struct ecore_hw_info { /* Default DCBX mode */ u8 dcbx_mode; + + u16 mtu; }; struct ecore_hw_cid_data { diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c index ee5009060f..87c1c23f9a 100644 --- a/drivers/net/qede/base/ecore_dev.c +++ b/drivers/net/qede/base/ecore_dev.c @@ -2879,6 +2879,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 diff --git a/drivers/net/qede/base/ecore_mcp.c b/drivers/net/qede/base/ecore_mcp.c index df6ebd2a81..8720ae7f8c 100644 --- a/drivers/net/qede/base/ecore_mcp.c +++ b/drivers/net/qede/base/ecore_mcp.c @@ -1431,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]" diff --git a/drivers/net/qede/base/ecore_mcp_api.h b/drivers/net/qede/base/ecore_mcp_api.h index 72a58e45e8..1be22dd2c0 100644 --- a/drivers/net/qede/base/ecore_mcp_api.h +++ b/drivers/net/qede/base/ecore_mcp_api.h @@ -84,6 +84,8 @@ struct ecore_mcp_function_info { #define ECORE_MCP_VLAN_UNSET (0xffff) u16 ovlan; + + u16 mtu; }; struct ecore_mcp_nvm_common { diff --git a/drivers/net/qede/qede_if.h b/drivers/net/qede/qede_if.h index 4b23bb95dd..18404fbdc9 100644 --- a/drivers/net/qede/qede_if.h +++ b/drivers/net/qede/qede_if.h @@ -34,6 +34,7 @@ struct qed_dev_info { uint32_t flash_size; uint8_t mf_mode; bool tx_switching; + u16 mtu; /* To be added... */ }; diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c index 332b1f8d02..e76346ecbe 100644 --- a/drivers/net/qede/qede_main.c +++ b/drivers/net/qede/qede_main.c @@ -365,6 +365,8 @@ qed_fill_dev_info(struct ecore_dev *edev, struct qed_dev_info *dev_info) &dev_info->mfw_rev, NULL); } + dev_info->mtu = ECORE_LEADING_HWFN(edev)->hw_info.mtu; + return 0; }