qcacmn: split srng history into small trunks
ring history array size is large. Change is aimed to split the allocation into small trunks to avoid memory allocation failure. Change-Id: If977baab23718d0186ad2ce6d33319b52096f2f9 CRs-Fixed: 3479226
This commit is contained in:

committed by
Madan Koyyalamudi

parent
c3a34a4987
commit
4e16309dd1
@@ -875,7 +875,7 @@ struct hal_srng {
|
||||
uint8_t pointer_num_threshold;
|
||||
#ifdef HAL_SRNG_REG_HIS_DEBUG
|
||||
/* pointer register writing history for this srng */
|
||||
struct hal_srng_reg_his_ctx reg_his_ctx;
|
||||
struct hal_srng_reg_his_ctx *reg_his_ctx;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -890,7 +890,7 @@ struct hal_srng {
|
||||
static inline
|
||||
void hal_srng_reg_his_init(struct hal_srng *srng)
|
||||
{
|
||||
qdf_atomic_set(&srng->reg_his_ctx.current_idx, -1);
|
||||
qdf_atomic_set(&srng->reg_his_ctx->current_idx, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -907,10 +907,10 @@ void hal_srng_reg_his_add(struct hal_srng *srng, uint32_t reg_val)
|
||||
uint32_t write_idx;
|
||||
struct hal_srng_reg_his_entry *reg_his_entry;
|
||||
|
||||
write_idx = qdf_atomic_inc_return(&srng->reg_his_ctx.current_idx);
|
||||
write_idx = qdf_atomic_inc_return(&srng->reg_his_ctx->current_idx);
|
||||
write_idx = write_idx & (HAL_SRNG_REG_MAX_ENTRIES - 1);
|
||||
|
||||
reg_his_entry = &srng->reg_his_ctx.reg_his_arr[write_idx];
|
||||
reg_his_entry = &srng->reg_his_ctx->reg_his_arr[write_idx];
|
||||
|
||||
reg_his_entry->write_time = qdf_get_log_timestamp();
|
||||
reg_his_entry->write_value = reg_val;
|
||||
|
@@ -1117,6 +1117,42 @@ void hal_delayed_reg_write(struct hal_soc *hal_soc,
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAL_SRNG_REG_HIS_DEBUG
|
||||
inline void hal_free_srng_history(struct hal_soc *hal)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < HAL_SRNG_ID_MAX; i++)
|
||||
qdf_mem_free(hal->srng_list[i].reg_his_ctx);
|
||||
}
|
||||
|
||||
inline bool hal_alloc_srng_history(struct hal_soc *hal)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < HAL_SRNG_ID_MAX; i++) {
|
||||
hal->srng_list[i].reg_his_ctx =
|
||||
qdf_mem_malloc(sizeof(struct hal_srng_reg_his_ctx));
|
||||
if (!hal->srng_list[i].reg_his_ctx) {
|
||||
hal_err("srng_hist alloc failed");
|
||||
hal_free_srng_history(hal);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
inline void hal_free_srng_history(struct hal_soc *hal)
|
||||
{
|
||||
}
|
||||
|
||||
inline bool hal_alloc_srng_history(struct hal_soc *hal)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void *hal_attach(struct hif_opaque_softc *hif_handle, qdf_device_t qdf_dev)
|
||||
{
|
||||
struct hal_soc *hal;
|
||||
@@ -1160,6 +1196,9 @@ void *hal_attach(struct hif_opaque_softc *hif_handle, qdf_device_t qdf_dev)
|
||||
qdf_mem_zero(hal->shadow_wrptr_mem_vaddr,
|
||||
sizeof(*(hal->shadow_wrptr_mem_vaddr)) * HAL_MAX_LMAC_RINGS);
|
||||
|
||||
if (!hal_alloc_srng_history(hal))
|
||||
goto fail2;
|
||||
|
||||
for (i = 0; i < HAL_SRNG_ID_MAX; i++) {
|
||||
hal->srng_list[i].initialized = 0;
|
||||
hal->srng_list[i].ring_id = i;
|
||||
@@ -1240,6 +1279,7 @@ void hal_detach(void *hal_soc)
|
||||
qdf_minidump_remove(hal, sizeof(*hal), "hal_soc");
|
||||
qdf_mem_free(hal->ops);
|
||||
|
||||
hal_free_srng_history(hal);
|
||||
qdf_mem_free_consistent(hal->qdf_dev, hal->qdf_dev->dev,
|
||||
sizeof(*(hal->shadow_rdptr_mem_vaddr)) * HAL_SRNG_ID_MAX,
|
||||
hal->shadow_rdptr_mem_vaddr, hal->shadow_rdptr_mem_paddr, 0);
|
||||
|
Reference in New Issue
Block a user