mirror of
git://nv-tegra.nvidia.com/kernel/nvethernetrm.git
synced 2025-12-22 09:12:10 +03:00
osi: hsi: Add return code for HSI Error injection
Issue: HSI error injection IOCTL does not return failure on invalid error codes. Fix: Handle invalid HSI error codes for HSI error injection IOCTL. Bug 3806923 Change-Id: I317b15e9a3ac98ab3d8d5c3ab37dd6782760bec3 Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/2823800 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Bhadram Varka
parent
4477838ca3
commit
b38ca1d2f6
@@ -1438,10 +1438,15 @@ void hw_tsn_init(struct osi_core_priv_data *osi_core,
|
||||
* @param[in] error_code: Ethernet HSI error code
|
||||
*
|
||||
* @note MAC should be init and started. see osi_start_mac()
|
||||
*
|
||||
* @retval 0 on success
|
||||
* @retval -1 on failure.
|
||||
*/
|
||||
void hsi_common_error_inject(struct osi_core_priv_data *osi_core,
|
||||
nve32_t hsi_common_error_inject(struct osi_core_priv_data *osi_core,
|
||||
nveu32_t error_code)
|
||||
{
|
||||
nve32_t ret = 0;
|
||||
|
||||
switch (error_code) {
|
||||
case OSI_INBOUND_BUS_CRC_ERR:
|
||||
osi_core->hsi.inject_crc_err_count =
|
||||
@@ -1491,8 +1496,11 @@ void hsi_common_error_inject(struct osi_core_priv_data *osi_core,
|
||||
default:
|
||||
OSI_CORE_ERR(osi_core->osd, OSI_LOG_ARG_HW_FAIL,
|
||||
"Invalid error code\n", (nveu32_t)error_code);
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ void prepare_l3l4_registers(const struct osi_core_priv_data *const osi_core,
|
||||
nveu32_t *l3_addr1_reg,
|
||||
nveu32_t *ctr_reg);
|
||||
#ifdef HSI_SUPPORT
|
||||
void hsi_common_error_inject(struct osi_core_priv_data *osi_core,
|
||||
nve32_t hsi_common_error_inject(struct osi_core_priv_data *osi_core,
|
||||
nveu32_t error_code);
|
||||
#endif
|
||||
#endif /* INCLUDED_CORE_COMMON_H */
|
||||
|
||||
@@ -228,7 +228,7 @@ struct core_ops {
|
||||
nve32_t (*core_hsi_configure)(struct osi_core_priv_data *const osi_core,
|
||||
const nveu32_t enable);
|
||||
/** Interface function called to inject error */
|
||||
void (*core_hsi_inject_err)(struct osi_core_priv_data *const osi_core,
|
||||
nve32_t (*core_hsi_inject_err)(struct osi_core_priv_data *const osi_core,
|
||||
const nveu32_t error_code);
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -957,10 +957,11 @@ static nve32_t eqos_hsi_configure(struct osi_core_priv_data *const osi_core,
|
||||
* @retval -1 on failure
|
||||
*/
|
||||
|
||||
static void eqos_hsi_inject_err(struct osi_core_priv_data *const osi_core,
|
||||
static nve32_t eqos_hsi_inject_err(struct osi_core_priv_data *const osi_core,
|
||||
const nveu32_t error_code)
|
||||
{
|
||||
nveu32_t value;
|
||||
nve32_t ret = 0;
|
||||
|
||||
switch (error_code) {
|
||||
case OSI_HSI_EQOS0_CE_CODE:
|
||||
@@ -978,9 +979,11 @@ static void eqos_hsi_inject_err(struct osi_core_priv_data *const osi_core,
|
||||
EQOS_MTL_DBG_CTL);
|
||||
break;
|
||||
default:
|
||||
hsi_common_error_inject(osi_core, error_code);
|
||||
ret = hsi_common_error_inject(osi_core, error_code);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1687,8 +1687,10 @@ fail:
|
||||
* @param[in] osi_core: OSI core private data structure.
|
||||
* @param[in] error_code: HSI Error code
|
||||
*
|
||||
* @retval 0 on success
|
||||
* @retval -1 on failure
|
||||
*/
|
||||
static void mgbe_hsi_inject_err(struct osi_core_priv_data *const osi_core,
|
||||
static nve32_t mgbe_hsi_inject_err(struct osi_core_priv_data *const osi_core,
|
||||
const nveu32_t error_code)
|
||||
{
|
||||
const nveu32_t val_ce = (MGBE_MTL_DEBUG_CONTROL_FDBGEN |
|
||||
@@ -1701,6 +1703,7 @@ static void mgbe_hsi_inject_err(struct osi_core_priv_data *const osi_core,
|
||||
MGBE_MTL_DEBUG_CONTROL_DBGMOD |
|
||||
MGBE_MTL_DEBUG_CONTROL_FIFORDEN |
|
||||
MGBE_MTL_DEBUG_CONTROL_EIEE);
|
||||
nve32_t ret = 0;
|
||||
|
||||
switch (error_code) {
|
||||
case OSI_HSI_MGBE0_CE_CODE:
|
||||
@@ -1718,9 +1721,11 @@ static void mgbe_hsi_inject_err(struct osi_core_priv_data *const osi_core,
|
||||
MGBE_MTL_DEBUG_CONTROL);
|
||||
break;
|
||||
default:
|
||||
hsi_common_error_inject(osi_core, error_code);
|
||||
ret = hsi_common_error_inject(osi_core, error_code);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2768,8 +2768,7 @@ static nve32_t osi_hal_handle_ioctl(struct osi_core_priv_data *osi_core,
|
||||
ret = ops_p->core_hsi_configure(osi_core, data->arg1_u32);
|
||||
break;
|
||||
case OSI_CMD_HSI_INJECT_ERR:
|
||||
ops_p->core_hsi_inject_err(osi_core, data->arg1_u32);
|
||||
ret = 0;
|
||||
ret = ops_p->core_hsi_inject_err(osi_core, data->arg1_u32);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user