net/qede/base: alter driver's force load behavior
- Add an option to override the default force load behavior. - PMD will set the override force load parameter to ECORE_OVERRIDE_FORCE_LOAD_ALWAYS. - Modify the printout when a force load is required to include the loaded value - No need for 'default' when switching over enums and covering all the values. Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
This commit is contained in:
parent
652ee28ab0
commit
c5e1108920
@ -1980,6 +1980,30 @@ static void ecore_pglueb_clear_err(struct ecore_hwfn *p_hwfn,
|
||||
1 << p_hwfn->abs_pf_id);
|
||||
}
|
||||
|
||||
static void
|
||||
ecore_fill_load_req_params(struct ecore_load_req_params *p_load_req,
|
||||
struct ecore_drv_load_params *p_drv_load)
|
||||
{
|
||||
/* Make sure that if ecore-client didn't provide inputs, all the
|
||||
* expected defaults are indeed zero.
|
||||
*/
|
||||
OSAL_BUILD_BUG_ON(ECORE_DRV_ROLE_OS != 0);
|
||||
OSAL_BUILD_BUG_ON(ECORE_LOAD_REQ_LOCK_TO_DEFAULT != 0);
|
||||
OSAL_BUILD_BUG_ON(ECORE_OVERRIDE_FORCE_LOAD_NONE != 0);
|
||||
|
||||
OSAL_MEM_ZERO(p_load_req, sizeof(*p_load_req));
|
||||
|
||||
if (p_drv_load != OSAL_NULL) {
|
||||
p_load_req->drv_role = p_drv_load->is_crash_kernel ?
|
||||
ECORE_DRV_ROLE_KDUMP :
|
||||
ECORE_DRV_ROLE_OS;
|
||||
p_load_req->timeout_val = p_drv_load->mfw_timeout_val;
|
||||
p_load_req->avoid_eng_reset = p_drv_load->avoid_eng_reset;
|
||||
p_load_req->override_force_load =
|
||||
p_drv_load->override_force_load;
|
||||
}
|
||||
}
|
||||
|
||||
enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev,
|
||||
struct ecore_hw_init_params *p_params)
|
||||
{
|
||||
@ -2021,12 +2045,8 @@ enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev,
|
||||
if (rc != ECORE_SUCCESS)
|
||||
return rc;
|
||||
|
||||
OSAL_MEM_ZERO(&load_req_params, sizeof(load_req_params));
|
||||
load_req_params.drv_role = p_params->is_crash_kernel ?
|
||||
ECORE_DRV_ROLE_KDUMP :
|
||||
ECORE_DRV_ROLE_OS;
|
||||
load_req_params.timeout_val = p_params->mfw_timeout_val;
|
||||
load_req_params.avoid_eng_reset = p_params->avoid_eng_reset;
|
||||
ecore_fill_load_req_params(&load_req_params,
|
||||
p_params->p_drv_load_params);
|
||||
rc = ecore_mcp_load_req(p_hwfn, p_hwfn->p_main_ptt,
|
||||
&load_req_params);
|
||||
if (rc != ECORE_SUCCESS) {
|
||||
|
@ -57,22 +57,13 @@ enum _ecore_status_t ecore_resc_alloc(struct ecore_dev *p_dev);
|
||||
*/
|
||||
void ecore_resc_setup(struct ecore_dev *p_dev);
|
||||
|
||||
struct ecore_hw_init_params {
|
||||
/* Tunnelling parameters */
|
||||
struct ecore_tunnel_info *p_tunn;
|
||||
|
||||
bool b_hw_start;
|
||||
|
||||
/* Interrupt mode [msix, inta, etc.] to use */
|
||||
enum ecore_int_mode int_mode;
|
||||
|
||||
/* NPAR tx switching to be used for vports configured for tx-switching
|
||||
*/
|
||||
bool allow_npar_tx_switch;
|
||||
|
||||
/* Binary fw data pointer in binary fw file */
|
||||
const u8 *bin_fw_data;
|
||||
enum ecore_override_force_load {
|
||||
ECORE_OVERRIDE_FORCE_LOAD_NONE,
|
||||
ECORE_OVERRIDE_FORCE_LOAD_ALWAYS,
|
||||
ECORE_OVERRIDE_FORCE_LOAD_NEVER,
|
||||
};
|
||||
|
||||
struct ecore_drv_load_params {
|
||||
/* Indicates whether the driver is running over a crash kernel.
|
||||
* As part of the load request, this will be used for providing the
|
||||
* driver role to the MFW.
|
||||
@ -90,6 +81,29 @@ struct ecore_hw_init_params {
|
||||
|
||||
/* Avoid engine reset when first PF loads on it */
|
||||
bool avoid_eng_reset;
|
||||
|
||||
/* Allow overriding the default force load behavior */
|
||||
enum ecore_override_force_load override_force_load;
|
||||
};
|
||||
|
||||
struct ecore_hw_init_params {
|
||||
/* Tunneling parameters */
|
||||
struct ecore_tunnel_info *p_tunn;
|
||||
|
||||
bool b_hw_start;
|
||||
|
||||
/* Interrupt mode [msix, inta, etc.] to use */
|
||||
enum ecore_int_mode int_mode;
|
||||
|
||||
/* NPAR tx switching to be used for vports configured for tx-switching
|
||||
*/
|
||||
bool allow_npar_tx_switch;
|
||||
|
||||
/* Binary fw data pointer in binary fw file */
|
||||
const u8 *bin_fw_data;
|
||||
|
||||
/* Driver load parameters */
|
||||
struct ecore_drv_load_params *p_drv_load_params;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -538,11 +538,28 @@ static void ecore_mcp_mf_workaround(struct ecore_hwfn *p_hwfn,
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool ecore_mcp_can_force_load(u8 drv_role, u8 exist_drv_role)
|
||||
static bool
|
||||
ecore_mcp_can_force_load(u8 drv_role, u8 exist_drv_role,
|
||||
enum ecore_override_force_load override_force_load)
|
||||
{
|
||||
return (drv_role == DRV_ROLE_OS &&
|
||||
exist_drv_role == DRV_ROLE_PREBOOT) ||
|
||||
(drv_role == DRV_ROLE_KDUMP && exist_drv_role == DRV_ROLE_OS);
|
||||
bool can_force_load = false;
|
||||
|
||||
switch (override_force_load) {
|
||||
case ECORE_OVERRIDE_FORCE_LOAD_ALWAYS:
|
||||
can_force_load = true;
|
||||
break;
|
||||
case ECORE_OVERRIDE_FORCE_LOAD_NEVER:
|
||||
can_force_load = false;
|
||||
break;
|
||||
default:
|
||||
can_force_load = (drv_role == DRV_ROLE_OS &&
|
||||
exist_drv_role == DRV_ROLE_PREBOOT) ||
|
||||
(drv_role == DRV_ROLE_KDUMP &&
|
||||
exist_drv_role == DRV_ROLE_OS);
|
||||
break;
|
||||
}
|
||||
|
||||
return can_force_load;
|
||||
}
|
||||
|
||||
static enum _ecore_status_t ecore_mcp_cancel_load_req(struct ecore_hwfn *p_hwfn,
|
||||
@ -713,9 +730,9 @@ __ecore_mcp_load_req(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
|
||||
return ECORE_SUCCESS;
|
||||
}
|
||||
|
||||
static enum _ecore_status_t eocre_get_mfw_drv_role(struct ecore_hwfn *p_hwfn,
|
||||
enum ecore_drv_role drv_role,
|
||||
u8 *p_mfw_drv_role)
|
||||
static void ecore_get_mfw_drv_role(struct ecore_hwfn *p_hwfn,
|
||||
enum ecore_drv_role drv_role,
|
||||
u8 *p_mfw_drv_role)
|
||||
{
|
||||
switch (drv_role) {
|
||||
case ECORE_DRV_ROLE_OS:
|
||||
@ -724,12 +741,7 @@ static enum _ecore_status_t eocre_get_mfw_drv_role(struct ecore_hwfn *p_hwfn,
|
||||
case ECORE_DRV_ROLE_KDUMP:
|
||||
*p_mfw_drv_role = DRV_ROLE_KDUMP;
|
||||
break;
|
||||
default:
|
||||
DP_ERR(p_hwfn, "Unexpected driver role %d\n", drv_role);
|
||||
return ECORE_INVAL;
|
||||
}
|
||||
|
||||
return ECORE_SUCCESS;
|
||||
}
|
||||
|
||||
enum ecore_load_req_force {
|
||||
@ -738,10 +750,9 @@ enum ecore_load_req_force {
|
||||
ECORE_LOAD_REQ_FORCE_ALL,
|
||||
};
|
||||
|
||||
static enum _ecore_status_t
|
||||
ecore_get_mfw_force_cmd(struct ecore_hwfn *p_hwfn,
|
||||
enum ecore_load_req_force force_cmd,
|
||||
u8 *p_mfw_force_cmd)
|
||||
static void ecore_get_mfw_force_cmd(struct ecore_hwfn *p_hwfn,
|
||||
enum ecore_load_req_force force_cmd,
|
||||
u8 *p_mfw_force_cmd)
|
||||
{
|
||||
switch (force_cmd) {
|
||||
case ECORE_LOAD_REQ_FORCE_NONE:
|
||||
@ -753,12 +764,7 @@ ecore_get_mfw_force_cmd(struct ecore_hwfn *p_hwfn,
|
||||
case ECORE_LOAD_REQ_FORCE_ALL:
|
||||
*p_mfw_force_cmd = LOAD_REQ_FORCE_ALL;
|
||||
break;
|
||||
default:
|
||||
DP_ERR(p_hwfn, "Unexpected force value %d\n", force_cmd);
|
||||
return ECORE_INVAL;
|
||||
}
|
||||
|
||||
return ECORE_SUCCESS;
|
||||
}
|
||||
|
||||
enum _ecore_status_t ecore_mcp_load_req(struct ecore_hwfn *p_hwfn,
|
||||
@ -767,7 +773,7 @@ enum _ecore_status_t ecore_mcp_load_req(struct ecore_hwfn *p_hwfn,
|
||||
{
|
||||
struct ecore_load_req_out_params out_params;
|
||||
struct ecore_load_req_in_params in_params;
|
||||
u8 mfw_drv_role, mfw_force_cmd;
|
||||
u8 mfw_drv_role = 0, mfw_force_cmd;
|
||||
enum _ecore_status_t rc;
|
||||
|
||||
#ifndef ASIC_ONLY
|
||||
@ -782,17 +788,11 @@ enum _ecore_status_t ecore_mcp_load_req(struct ecore_hwfn *p_hwfn,
|
||||
in_params.drv_ver_0 = ECORE_VERSION;
|
||||
in_params.drv_ver_1 = ecore_get_config_bitmap();
|
||||
in_params.fw_ver = STORM_FW_VERSION;
|
||||
rc = eocre_get_mfw_drv_role(p_hwfn, p_params->drv_role, &mfw_drv_role);
|
||||
if (rc != ECORE_SUCCESS)
|
||||
return rc;
|
||||
|
||||
ecore_get_mfw_drv_role(p_hwfn, p_params->drv_role, &mfw_drv_role);
|
||||
in_params.drv_role = mfw_drv_role;
|
||||
in_params.timeout_val = p_params->timeout_val;
|
||||
rc = ecore_get_mfw_force_cmd(p_hwfn, ECORE_LOAD_REQ_FORCE_NONE,
|
||||
&mfw_force_cmd);
|
||||
if (rc != ECORE_SUCCESS)
|
||||
return rc;
|
||||
|
||||
ecore_get_mfw_force_cmd(p_hwfn, ECORE_LOAD_REQ_FORCE_NONE,
|
||||
&mfw_force_cmd);
|
||||
in_params.force_cmd = mfw_force_cmd;
|
||||
in_params.avoid_eng_reset = p_params->avoid_eng_reset;
|
||||
|
||||
@ -824,19 +824,20 @@ enum _ecore_status_t ecore_mcp_load_req(struct ecore_hwfn *p_hwfn,
|
||||
p_hwfn->mcp_info->block_mb_sending = false;
|
||||
|
||||
if (ecore_mcp_can_force_load(in_params.drv_role,
|
||||
out_params.exist_drv_role)) {
|
||||
out_params.exist_drv_role,
|
||||
p_params->override_force_load)) {
|
||||
DP_INFO(p_hwfn,
|
||||
"A force load is required [existing: role %d, fw_ver 0x%08x, drv_ver 0x%08x_0x%08x]. Sending a force load request.\n",
|
||||
"A force load is required [{role, fw_ver, drv_ver}: loading={%d, 0x%08x, 0x%08x_%08x}, existing={%d, 0x%08x, 0x%08x_%08x}]\n",
|
||||
in_params.drv_role, in_params.fw_ver,
|
||||
in_params.drv_ver_0, in_params.drv_ver_1,
|
||||
out_params.exist_drv_role,
|
||||
out_params.exist_fw_ver,
|
||||
out_params.exist_drv_ver_0,
|
||||
out_params.exist_drv_ver_1);
|
||||
|
||||
rc = ecore_get_mfw_force_cmd(p_hwfn,
|
||||
ECORE_LOAD_REQ_FORCE_ALL,
|
||||
&mfw_force_cmd);
|
||||
if (rc != ECORE_SUCCESS)
|
||||
return rc;
|
||||
ecore_get_mfw_force_cmd(p_hwfn,
|
||||
ECORE_LOAD_REQ_FORCE_ALL,
|
||||
&mfw_force_cmd);
|
||||
|
||||
in_params.force_cmd = mfw_force_cmd;
|
||||
OSAL_MEM_ZERO(&out_params, sizeof(out_params));
|
||||
@ -846,7 +847,9 @@ enum _ecore_status_t ecore_mcp_load_req(struct ecore_hwfn *p_hwfn,
|
||||
return rc;
|
||||
} else {
|
||||
DP_NOTICE(p_hwfn, false,
|
||||
"A force load is required [existing: role %d, fw_ver 0x%08x, drv_ver 0x%08x_0x%08x]. Avoiding to prevent disruption of active PFs.\n",
|
||||
"A force load is required [{role, fw_ver, drv_ver}: loading={%d, 0x%08x, x%08x_0x%08x}, existing={%d, 0x%08x, 0x%08x_0x%08x}] - Avoid\n",
|
||||
in_params.drv_role, in_params.fw_ver,
|
||||
in_params.drv_ver_0, in_params.drv_ver_1,
|
||||
out_params.exist_drv_role,
|
||||
out_params.exist_fw_ver,
|
||||
out_params.exist_drv_ver_0,
|
||||
@ -877,19 +880,11 @@ enum _ecore_status_t ecore_mcp_load_req(struct ecore_hwfn *p_hwfn,
|
||||
return ECORE_INVAL;
|
||||
}
|
||||
break;
|
||||
case FW_MSG_CODE_DRV_LOAD_REFUSED_PDA:
|
||||
case FW_MSG_CODE_DRV_LOAD_REFUSED_DIAG:
|
||||
case FW_MSG_CODE_DRV_LOAD_REFUSED_HSI:
|
||||
case FW_MSG_CODE_DRV_LOAD_REFUSED_REJECT:
|
||||
DP_NOTICE(p_hwfn, false,
|
||||
"MFW refused a load request [resp 0x%08x]. Aborting.\n",
|
||||
out_params.load_code);
|
||||
return ECORE_BUSY;
|
||||
default:
|
||||
DP_NOTICE(p_hwfn, false,
|
||||
"Unexpected response to load request [resp 0x%08x]. Aborting.\n",
|
||||
"Unexpected refusal to load request [resp 0x%08x]. Aborting.\n",
|
||||
out_params.load_code);
|
||||
break;
|
||||
return ECORE_BUSY;
|
||||
}
|
||||
|
||||
p_params->load_code = out_params.load_code;
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "mcp_public.h"
|
||||
#include "ecore.h"
|
||||
#include "ecore_mcp_api.h"
|
||||
#include "ecore_dev_api.h"
|
||||
|
||||
/* Using hwfn number (and not pf_num) is required since in CMT mode,
|
||||
* same pf_num may be used by two different hwfn
|
||||
@ -153,9 +154,13 @@ enum ecore_drv_role {
|
||||
};
|
||||
|
||||
struct ecore_load_req_params {
|
||||
/* Input params */
|
||||
enum ecore_drv_role drv_role;
|
||||
u8 timeout_val; /* 1..254, '0' - default value, '255' - no timeout */
|
||||
bool avoid_eng_reset;
|
||||
enum ecore_override_force_load override_force_load;
|
||||
|
||||
/* Output params */
|
||||
u32 load_code;
|
||||
};
|
||||
|
||||
|
@ -221,10 +221,11 @@ static void qed_stop_iov_task(struct ecore_dev *edev)
|
||||
static int qed_slowpath_start(struct ecore_dev *edev,
|
||||
struct qed_slowpath_params *params)
|
||||
{
|
||||
struct ecore_drv_load_params drv_load_params;
|
||||
struct ecore_hw_init_params hw_init_params;
|
||||
struct ecore_mcp_drv_version drv_version;
|
||||
const uint8_t *data = NULL;
|
||||
struct ecore_hwfn *hwfn;
|
||||
struct ecore_mcp_drv_version drv_version;
|
||||
struct ecore_hw_init_params hw_init_params;
|
||||
struct ecore_ptt *p_ptt;
|
||||
int rc;
|
||||
|
||||
@ -280,8 +281,13 @@ static int qed_slowpath_start(struct ecore_dev *edev,
|
||||
hw_init_params.int_mode = ECORE_INT_MODE_MSIX;
|
||||
hw_init_params.allow_npar_tx_switch = true;
|
||||
hw_init_params.bin_fw_data = data;
|
||||
hw_init_params.mfw_timeout_val = ECORE_LOAD_REQ_LOCK_TO_DEFAULT;
|
||||
hw_init_params.avoid_eng_reset = false;
|
||||
|
||||
memset(&drv_load_params, 0, sizeof(drv_load_params));
|
||||
drv_load_params.mfw_timeout_val = ECORE_LOAD_REQ_LOCK_TO_DEFAULT;
|
||||
drv_load_params.avoid_eng_reset = false;
|
||||
drv_load_params.override_force_load = ECORE_OVERRIDE_FORCE_LOAD_ALWAYS;
|
||||
hw_init_params.p_drv_load_params = &drv_load_params;
|
||||
|
||||
rc = ecore_hw_init(edev, &hw_init_params);
|
||||
if (rc) {
|
||||
DP_ERR(edev, "ecore_hw_init failed\n");
|
||||
|
Loading…
Reference in New Issue
Block a user