msm: ipa3: Fix to use free offset list DDR header entries
When SRAM free header offset entries are not present it
was trying to allocate the new DDR header entry instead
of searching in DDR free header entry list, due to that
offset location in routing table was overflow and causing
invalid header offset location in the routing table
Change-Id: I5050050361e5fdf66da7f3ce9d8233f8ec892d3c
Signed-off-by: Ashok Vuyyuru <quic_avuyyuru@quicinc.com>
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c b/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c
index a57e36d..568bb20 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c
@@ -651,26 +651,35 @@
while (htbl->end + ipa_hdr_bin_sz[bin] > mem_size) {
if (entry->is_lcl) {
/* if header does not fit to SRAM table, place it in DDR */
+ IPADBG_LOW("SRAM header table was full allocting DDR header table! Requested: %d Left: %d name %s, end %d\n",
+ ipa_hdr_bin_sz[bin], mem_size - htbl->end, entry->name, htbl->end);
htbl = &ipa3_ctx->hdr_tbl[HDR_TBL_SYS];
mem_size = IPA_MEM_PART(apps_hdr_size_ddr);
entry->is_lcl = false;
- } else {
- /* check if DDR free list */
- if (list_empty(&htbl->head_free_offset_list[bin])) {
- IPAERR("No space in DDR header buffer! Requested: %d Left: %d name %s, end %d\n",
+ }
+
+ if (!entry->is_lcl && (htbl->end + ipa_hdr_bin_sz[bin] > mem_size)) {
+ IPAERR("No space in DDR header buffer! Requested: %d Left: %d name %s, end %d\n",
+ ipa_hdr_bin_sz[bin], mem_size - htbl->end, entry->name, htbl->end);
+ goto bad_hdr_len;
+ }
+
+ /* check if DDR free list */
+ if (list_empty(&htbl->head_free_offset_list[bin])) {
+ IPADBG_LOW("No free offset in DDR allocating new offset Requested: %d Left: %d name %s, end %d\n",
ipa_hdr_bin_sz[bin], mem_size - htbl->end, entry->name, htbl->end);
- goto bad_hdr_len;
- } else {
- /* get the first free slot */
- offset = list_first_entry(&htbl->head_free_offset_list[bin],
+ goto create_entry;
+ } else {
+ /* get the first free slot */
+ offset = list_first_entry(&htbl->head_free_offset_list[bin],
struct ipa_hdr_offset_entry, link);
- list_move(&offset->link, &htbl->head_offset_list[bin]);
- entry->offset_entry = offset;
- offset->ipacm_installed = user;
- goto free_list;
- }
+ list_move(&offset->link, &htbl->head_offset_list[bin]);
+ entry->offset_entry = offset;
+ offset->ipacm_installed = user;
+ goto free_list;
}
}
+create_entry:
offset = kmem_cache_zalloc(ipa3_ctx->hdr_offset_cache,
GFP_KERNEL);
if (!offset) {