net/qede/base: send FW version driver state to MFW
authorRasesh Mody <rasesh.mody@cavium.com>
Wed, 29 Mar 2017 20:36:02 +0000 (13:36 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 4 Apr 2017 17:02:49 +0000 (19:02 +0200)
Add support to send FW version and driver state to Management FW.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
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 da9cdc9..2d1e031 100644 (file)
@@ -1609,8 +1609,9 @@ static void ecore_reset_mb_shadow(struct ecore_hwfn *p_hwfn,
 enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev,
                                   struct ecore_hw_init_params *p_params)
 {
-       enum _ecore_status_t rc, mfw_rc;
-       u32 load_code, param;
+       enum _ecore_status_t rc = ECORE_SUCCESS, mfw_rc;
+       u32 load_code, param, drv_mb_param;
+       struct ecore_hwfn *p_hwfn;
        int i;
 
        if ((p_params->int_mode == ECORE_INT_MODE_MSI) &&
@@ -1743,7 +1744,26 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev,
                p_hwfn->hw_init_done = true;
        }
 
-       return ECORE_SUCCESS;
+       if (IS_PF(p_dev)) {
+               p_hwfn = ECORE_LEADING_HWFN(p_dev);
+               drv_mb_param = (FW_MAJOR_VERSION << 24) |
+                              (FW_MINOR_VERSION << 16) |
+                              (FW_REVISION_VERSION << 8) |
+                              (FW_ENGINEERING_VERSION);
+               rc = ecore_mcp_cmd(p_hwfn, p_hwfn->p_main_ptt,
+                                  DRV_MSG_CODE_OV_UPDATE_STORM_FW_VER,
+                                  drv_mb_param, &load_code, &param);
+               if (rc != ECORE_SUCCESS) {
+                       DP_ERR(p_hwfn, "Failed to send firmware version\n");
+                       return rc;
+               }
+
+               rc = ecore_mcp_ov_update_driver_state(p_hwfn,
+                                                     p_hwfn->p_main_ptt,
+                                               ECORE_OV_DRIVER_STATE_DISABLED);
+       }
+
+       return rc;
 }
 
 #define ECORE_HW_STOP_RETRY_LIMIT      (10)
@@ -3130,8 +3150,13 @@ enum _ecore_status_t ecore_hw_prepare(struct ecore_dev *p_dev,
 
 void ecore_hw_remove(struct ecore_dev *p_dev)
 {
+       struct ecore_hwfn *p_hwfn = ECORE_LEADING_HWFN(p_dev);
        int i;
 
+       if (IS_PF(p_dev))
+               ecore_mcp_ov_update_driver_state(p_hwfn, p_hwfn->p_main_ptt,
+                                       ECORE_OV_DRIVER_STATE_NOT_LOADED);
+
        for_each_hwfn(p_dev, i) {
                struct ecore_hwfn *p_hwfn = &p_dev->hwfns[i];
 
index cb3e0bd..e236f39 100644 (file)
@@ -1723,6 +1723,9 @@ ecore_mcp_ov_update_current_config(struct ecore_hwfn *p_hwfn,
        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);
                return ECORE_INVAL;
@@ -1761,9 +1764,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;
 }
index 4e954bd..614cf67 100644 (file)
@@ -181,7 +181,8 @@ enum ecore_ov_config_method {
 
 enum ecore_ov_client {
        ECORE_OV_CLIENT_DRV,
-       ECORE_OV_CLIENT_USER
+       ECORE_OV_CLIENT_USER,
+       ECORE_OV_CLIENT_VENDOR_SPEC
 };
 
 enum ecore_ov_driver_state {
index 4289d0b..4b23bb9 100644 (file)
@@ -150,8 +150,11 @@ struct qed_common_ops {
                            uint16_t sb_id, enum qed_sb_type type);
 
        bool (*can_link_change)(struct ecore_dev *edev);
+
        void (*update_msglvl)(struct ecore_dev *edev,
                              uint32_t dp_module, uint8_t dp_level);
+
+       int (*send_drv_state)(struct ecore_dev *edev, bool active);
 };
 
 #endif /* _QEDE_IF_H */
index 8a4d68a..f0033a1 100644 (file)
@@ -668,6 +668,25 @@ static void qed_remove(struct ecore_dev *edev)
        ecore_hw_remove(edev);
 }
 
+static int qed_send_drv_state(struct ecore_dev *edev, bool active)
+{
+       struct ecore_hwfn *hwfn = ECORE_LEADING_HWFN(edev);
+       struct ecore_ptt *ptt;
+       int status = 0;
+
+       ptt = ecore_ptt_acquire(hwfn);
+       if (!ptt)
+               return -EAGAIN;
+
+       status = ecore_mcp_ov_update_driver_state(hwfn, ptt, active ?
+                                                 ECORE_OV_DRIVER_STATE_ACTIVE :
+                                               ECORE_OV_DRIVER_STATE_DISABLED);
+
+       ecore_ptt_release(hwfn, ptt);
+
+       return status;
+}
+
 const struct qed_common_ops qed_common_ops_pass = {
        INIT_STRUCT_FIELD(probe, &qed_probe),
        INIT_STRUCT_FIELD(update_pf_params, &qed_update_pf_params),
@@ -681,4 +700,5 @@ const struct qed_common_ops qed_common_ops_pass = {
        INIT_STRUCT_FIELD(drain, &qed_drain),
        INIT_STRUCT_FIELD(slowpath_stop, &qed_slowpath_stop),
        INIT_STRUCT_FIELD(remove, &qed_remove),
+       INIT_STRUCT_FIELD(send_drv_state, &qed_send_drv_state),
 };