osi: core: Restore FRP rules on resume

Issue:
FRP rules got lost during SC7
suspend and resume transition.

Fix:
Restore FRP rules after resume

Bug 3928364

Change-Id: If38ed1c54c19f6cfb9bb00f56c524712e24c1f59
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/2848286
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Mohan Thadikamalla
2023-01-24 18:26:40 +05:30
committed by mobile promotions
parent 84f5a14973
commit cdc06a45d3
5 changed files with 23 additions and 31 deletions

View File

@@ -59,6 +59,7 @@
#define DYNAMIC_CFG_PTP OSI_BIT(7)
#define DYNAMIC_CFG_EST OSI_BIT(8)
#define DYNAMIC_CFG_FPE OSI_BIT(9)
#define DYNAMIC_CFG_FRP OSI_BIT(10)
#ifndef OSI_STRIPPED_LIB
#define DYNAMIC_CFG_FC OSI_BIT(1)
@@ -76,6 +77,7 @@
#define DYNAMIC_CFG_PTP_IDX 7U
#define DYNAMIC_CFG_EST_IDX 8U
#define DYNAMIC_CFG_FPE_IDX 9U
#define DYNAMIC_CFG_FRP_IDX 10U
#define OSI_SUSPENDED OSI_BIT(0)

View File

@@ -379,8 +379,8 @@ done:
* @retval 0 on success.
* @retval -1 on failure.
*/
static nve32_t frp_hw_write(struct osi_core_priv_data *const osi_core,
struct core_ops *const ops_p)
nve32_t frp_hw_write(struct osi_core_priv_data *const osi_core,
struct core_ops *const ops_p)
{
nve32_t ret = 0;
nve32_t tmp = 0;
@@ -886,20 +886,3 @@ nve32_t setup_frp(struct osi_core_priv_data *const osi_core,
return ret;
}
/**
* @brief init_frp - Initialize FRP.
*
* Algorithm: Reset all the data in the FRP table Initialize FRP count to zero.
*
* @param[in] osi_core: OSI core private data structure.
*
*/
void init_frp(struct osi_core_priv_data *const osi_core)
{
/* Reset the NVE count to zero */
osi_core->frp_cnt = 0U;
/* Clear all instruction of FRP */
osi_memset(osi_core->frp_table, 0U,
(sizeof(struct osi_core_frp_entry) * OSI_FRP_MAX_ENTRY));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -69,16 +69,15 @@ nve32_t setup_frp(struct osi_core_priv_data *const osi_core,
struct osi_core_frp_cmd *const cmd);
/**
* @brief init_frp - Init the FRP Instruction Table.
* @brief frp_hw_write - Update HW FRP table.
*
* Algorithm: Update FRP table into HW.
*
* @param[in] osi_core: OSI core private data structure.
*
* @note
* 1) MAC and PHY should be init and started. see osi_start_mac()
*
* @retval 0 on success
* @retval 0 on success.
* @retval -1 on failure.
*/
void init_frp(struct osi_core_priv_data *const osi_core);
nve32_t frp_hw_write(struct osi_core_priv_data *const osi_core,
struct core_ops *const ops_p);
#endif /* FRP_H */

View File

@@ -127,6 +127,7 @@ struct osi_core_priv_data *osi_get_core(void)
g_core[i].pps_freq = OSI_DISABLE;
osi_core = &g_core[i].osi_core;
osi_memset(osi_core, 0, sizeof(struct osi_core_priv_data));
fail:
return osi_core;
}

View File

@@ -540,8 +540,6 @@ static nve32_t osi_hal_hw_core_init(struct osi_core_priv_data *const osi_core)
#ifndef OSI_STRIPPED_LIB
init_vlan_filters(osi_core);
/* Init FRP */
init_frp(osi_core);
#endif /* !OSI_STRIPPED_LIB */
ret = l_core->ops_p->core_init(osi_core);
@@ -2205,11 +2203,18 @@ static void cfg_ptp(struct core_local *l_core)
(void)osi_handle_ioctl(osi_core, &ioctl_data);
}
static void cfg_frp(struct core_local *l_core)
{
struct osi_core_priv_data *osi_core = (struct osi_core_priv_data *)(void *)l_core;
(void)frp_hw_write(osi_core, l_core->ops_p);
}
static void apply_dynamic_cfg(struct osi_core_priv_data *osi_core)
{
struct core_local *l_core = (struct core_local *)(void *)osi_core;
typedef void (*cfg_fn)(struct core_local *local_core);
const cfg_fn fn[10] = {
const cfg_fn fn[11] = {
[DYNAMIC_CFG_L3_L4_IDX] = cfg_l3_l4_filter,
[DYNAMIC_CFG_L2_IDX] = cfg_l2_filter,
[DYNAMIC_CFG_RXCSUM_IDX] = cfg_rxcsum,
@@ -2221,7 +2226,8 @@ static void apply_dynamic_cfg(struct osi_core_priv_data *osi_core)
[DYNAMIC_CFG_AVB_IDX] = cfg_avb,
[DYNAMIC_CFG_EST_IDX] = cfg_est,
[DYNAMIC_CFG_FPE_IDX] = cfg_fpe,
[DYNAMIC_CFG_PTP_IDX] = cfg_ptp
[DYNAMIC_CFG_PTP_IDX] = cfg_ptp,
[DYNAMIC_CFG_FRP_IDX] = cfg_frp
};
nveu32_t flags = l_core->cfg.flags;
nveu32_t i = 0U;
@@ -2783,6 +2789,7 @@ static nve32_t osi_hal_handle_ioctl(struct osi_core_priv_data *osi_core,
#endif /* !OSI_STRIPPED_LIB */
case OSI_CMD_CONFIG_FRP:
ret = configure_frp(osi_core, &data->frp_cmd);
l_core->cfg.flags |= DYNAMIC_CFG_FRP;
break;
case OSI_CMD_CONFIG_EST: