qcacmn: Compute pages required by SPT properly

Compute the required pages properly, when num_descs is not
multiple of DP_CC_SPT_PAGE_MAX_ENTRIES(512).
For example, if num_descs less than DP_CC_SPT_PAGE_MAX_ENTRIES,
then 1 page needed rather than 0.

Change-Id: I1c4b12cfebef6a9b315baf9044355caab1b112de
CRs-Fixed: 3571562
This commit is contained in:
Lin Bai
2023-07-26 16:41:09 +08:00
committed by Rahul Choudhary
parent db94a99add
commit 09432f7ace

View File

@@ -403,7 +403,9 @@ dp_hw_cookie_conversion_attach(struct dp_soc_be *be_soc,
uint8_t chip_id;
/* estimate how many SPT DDR pages needed */
num_spt_pages = num_descs / DP_CC_SPT_PAGE_MAX_ENTRIES;
num_spt_pages = qdf_do_div(
num_descs + (DP_CC_SPT_PAGE_MAX_ENTRIES - 1),
DP_CC_SPT_PAGE_MAX_ENTRIES);
num_spt_pages = num_spt_pages <= DP_CC_PPT_MAX_ENTRIES ?
num_spt_pages : DP_CC_PPT_MAX_ENTRIES;
dp_info("num_spt_pages needed %d", num_spt_pages);