Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b073b96 authored by Skylar Chang's avatar Skylar Chang Committed by Gerrit - the friendly Code Review server
Browse files

msm: ipa: exit when hdr proc ctx table is full



Return error when header processing table is full so that ipa
driver does not add infinite number of headers in SW cache.

Change-Id: I97360dec3ec892aab688d332122c75283c3e6cf6
Acked-by: default avatarShihuan Liu <shihuanl@qti.qualcomm.com>
Signed-off-by: default avatarSkylar Chang <chiaweic@codeaurora.org>
parent ad8cf1bb
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -549,6 +549,7 @@ static int __ipa_add_hdr_proc_ctx(struct ipa_hdr_proc_ctx_add *proc_ctx,
	struct ipa_hdr_proc_ctx_tbl *htbl = &ipa_ctx->hdr_proc_ctx_tbl;
	int id;
	int needed_len;
	int mem_size;

	IPADBG("processing type %d hdr_hdl %d\n",
		proc_ctx->type, proc_ctx->hdr_hdl);
@@ -593,6 +594,14 @@ static int __ipa_add_hdr_proc_ctx(struct ipa_hdr_proc_ctx_add *proc_ctx,
		goto bad_len;
	}

	mem_size = (ipa_ctx->hdr_proc_ctx_tbl_lcl) ?
		IPA_MEM_PART(apps_hdr_proc_ctx_size) :
		IPA_MEM_PART(apps_hdr_proc_ctx_size_ddr);
	if (htbl->end + ipa_hdr_proc_ctx_bin_sz[bin] > mem_size) {
		IPAERR("hdr proc ctx table overflow\n");
		goto bad_len;
	}

	if (list_empty(&htbl->head_free_offset_list[bin])) {
		offset = kmem_cache_zalloc(ipa_ctx->hdr_proc_ctx_offset_cache,
					   GFP_KERNEL);
+9 −0
Original line number Diff line number Diff line
@@ -321,6 +321,7 @@ static int __ipa_add_hdr_proc_ctx(struct ipa_hdr_proc_ctx_add *proc_ctx,
	struct ipa3_hdr_proc_ctx_tbl *htbl = &ipa3_ctx->hdr_proc_ctx_tbl;
	int id;
	int needed_len;
	int mem_size;

	IPADBG_LOW("processing type %d hdr_hdl %d\n",
		proc_ctx->type, proc_ctx->hdr_hdl);
@@ -363,6 +364,14 @@ static int __ipa_add_hdr_proc_ctx(struct ipa_hdr_proc_ctx_add *proc_ctx,
		goto bad_len;
	}

	mem_size = (ipa3_ctx->hdr_proc_ctx_tbl_lcl) ?
		IPA_MEM_PART(apps_hdr_proc_ctx_size) :
		IPA_MEM_PART(apps_hdr_proc_ctx_size_ddr);
	if (htbl->end + ipa_hdr_proc_ctx_bin_sz[bin] > mem_size) {
		IPAERR("hdr proc ctx table overflow\n");
		goto bad_len;
	}

	if (list_empty(&htbl->head_free_offset_list[bin])) {
		offset = kmem_cache_zalloc(ipa3_ctx->hdr_proc_ctx_offset_cache,
					   GFP_KERNEL);