|
@@ -543,12 +543,13 @@ bad_len:
|
|
|
static int __ipa_add_hdr(struct ipa_hdr_add *hdr, bool user,
|
|
|
struct ipa3_hdr_entry **entry_out)
|
|
|
{
|
|
|
- struct ipa3_hdr_entry *entry;
|
|
|
+ struct ipa3_hdr_entry *entry, *entry_t, *next;
|
|
|
struct ipa_hdr_offset_entry *offset = NULL;
|
|
|
u32 bin;
|
|
|
struct ipa3_hdr_tbl *htbl;
|
|
|
int id;
|
|
|
int mem_size;
|
|
|
+ enum hdr_tbl_storage hdr_tbl_loc;
|
|
|
|
|
|
if (hdr->hdr_len > IPA_HDR_MAX_SIZE) {
|
|
|
IPAERR_RL("bad param\n");
|
|
@@ -579,6 +580,26 @@ static int __ipa_add_hdr(struct ipa_hdr_add *hdr, bool user,
|
|
|
(entry->is_partial || (hdr->status == IPA_HDR_TO_DDR_PATTERN))) ||
|
|
|
!IPA_MEM_PART(apps_hdr_size)) ? false : true;
|
|
|
|
|
|
+ /* check to see if adding header entry with duplicate name */
|
|
|
+ for (hdr_tbl_loc = HDR_TBL_LCL; hdr_tbl_loc < HDR_TBLS_TOTAL; hdr_tbl_loc++) {
|
|
|
+ list_for_each_entry_safe(entry_t, next,
|
|
|
+ &ipa3_ctx->hdr_tbl[hdr_tbl_loc].head_hdr_entry_list, link) {
|
|
|
+
|
|
|
+ /* return if adding the same name */
|
|
|
+ if (!strcmp(entry_t->name, entry->name) && (user == true)) {
|
|
|
+ IPAERR("IPACM Trying to add hdr %s len=%d, duplicate entry, return old one\n",
|
|
|
+ entry->name, entry->hdr_len);
|
|
|
+
|
|
|
+ /* return the original entry */
|
|
|
+ if (entry_out)
|
|
|
+ *entry_out = entry_t;
|
|
|
+
|
|
|
+ kmem_cache_free(ipa3_ctx->hdr_cache, entry);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (hdr->hdr_len <= ipa_hdr_bin_sz[IPA_HDR_BIN0])
|
|
|
bin = IPA_HDR_BIN0;
|
|
|
else if (hdr->hdr_len <= ipa_hdr_bin_sz[IPA_HDR_BIN1])
|