net/qede/base: use default MTU from shared memory
authorRasesh Mody <rasesh.mody@cavium.com>
Wed, 29 Mar 2017 20:36:12 +0000 (13:36 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 4 Apr 2017 17:02:50 +0000 (19:02 +0200)
Read and use the default MTU value from shared-memory.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
drivers/net/qede/base/ecore.h
drivers/net/qede/base/ecore_dev.c
drivers/net/qede/base/ecore_mcp.c
drivers/net/qede/base/ecore_mcp_api.h
drivers/net/qede/qede_if.h
drivers/net/qede/qede_main.c

index a6cf52e..25c96f8 100644 (file)
@@ -377,6 +377,8 @@ struct ecore_hw_info {
 
        /* Default DCBX mode */
        u8 dcbx_mode;
+
+       u16 mtu;
 };
 
 struct ecore_hw_cid_data {
index ee50090..87c1c23 100644 (file)
@@ -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
index df6ebd2..8720ae7 100644 (file)
@@ -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]"
index 72a58e4..1be22dd 100644 (file)
@@ -84,6 +84,8 @@ struct ecore_mcp_function_info {
 
 #define ECORE_MCP_VLAN_UNSET           (0xffff)
        u16 ovlan;
+
+       u16 mtu;
 };
 
 struct ecore_mcp_nvm_common {
index 4b23bb9..18404fb 100644 (file)
@@ -34,6 +34,7 @@ struct qed_dev_info {
        uint32_t flash_size;
        uint8_t mf_mode;
        bool tx_switching;
+       u16 mtu;
        /* To be added... */
 };
 
index 332b1f8..e76346e 100644 (file)
@@ -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;
 }