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

Commit 2b1d2274 authored by Sivan Reinstein's avatar Sivan Reinstein
Browse files

msm: ipa: remove QMAP headers per interface after SSR



This change adds a procedure to remove the QMAP headers for each
interface when SSR occurs. The procedure is being invoked as part
of the remove hook of the rmnet_ipa platform driver.

Change-Id: I35112db0122071302a45e31c4afe9d1ee2e51308
Acked-by: default avatarDavid Arinzon <darinzon@qti.qualcomm.com>
Signed-off-by: default avatarSivan Reinstein <sivanr@codeaurora.org>
parent ecd5c60e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -776,7 +776,7 @@ int __ipa_del_hdr(u32 hdr_hdl)
	IPADBG("del hdr of sz=%d hdr_cnt=%d ofst=%d\n", entry->hdr_len,
			htbl->hdr_cnt, entry->offset_entry->offset);

	if (entry->ref_cnt) {
	if (--entry->ref_cnt) {
		IPADBG("hdr_hdl %x ref_cnt %d\n", hdr_hdl, entry->ref_cnt);
		return 0;
	}
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ struct rmnet_mux_val {
	bool mux_channel_set;
	bool ul_flt_reg;
	bool mux_hdr_set;
	uint32_t  hdr_hdl;
};

int ipa_qmi_service_init(bool load_uc, uint32_t wan_platform_type);
+50 −2
Original line number Diff line number Diff line
@@ -178,7 +178,52 @@ static void ipa_del_a7_qmap_hdr(void)
	kfree(del_hdr);
}

static int ipa_add_qmap_hdr(uint32_t mux_id)
static void ipa_del_qmap_hdr(uint32_t hdr_hdl)
{
	struct ipa_ioc_del_hdr *del_hdr;
	struct ipa_hdr_del *hdl_entry;
	u32 pyld_sz;
	int ret;

	if (hdr_hdl == 0) {
		IPAWANERR("Invalid hdr_hdl provided\n");
		return;
	}

	pyld_sz = sizeof(struct ipa_ioc_del_hdr) + 1 *
		sizeof(struct ipa_hdr_del);
	del_hdr = kzalloc(pyld_sz, GFP_KERNEL);
	if (!del_hdr) {
		IPAWANERR("fail to alloc exception hdr_del\n");
		return;
	}

	del_hdr->commit = 1;
	del_hdr->num_hdls = 1;
	hdl_entry = &del_hdr->hdl[0];
	hdl_entry->hdl = hdr_hdl;

	ret = ipa_del_hdr(del_hdr);
	if (ret || hdl_entry->status)
		IPAWANERR("ipa_del_hdr failed\n");
	else
		IPAWANERR("header deletion done\n");

	qmap_hdr_hdl = 0;
	kfree(del_hdr);
}

static void ipa_del_mux_qmap_hdrs(void)
{
	int index;

	for (index = 0; index < rmnet_index; index++) {
		ipa_del_qmap_hdr(mux_channel[index].hdr_hdl);
		mux_channel[index].hdr_hdl = 0;
	}
}

static int ipa_add_qmap_hdr(uint32_t mux_id, uint32_t *hdr_hdl)
{
	struct ipa_ioc_add_hdr *hdr;
	struct ipa_hdr_add *hdr_entry;
@@ -221,6 +266,7 @@ static int ipa_add_qmap_hdr(uint32_t mux_id)
	}

	ret = 0;
	*hdr_hdl = hdr_entry->hdr_hdl;
bail:
	kfree(hdr);
	return ret;
@@ -627,7 +673,8 @@ static int wwan_register_to_ipa(int index)
	IPAWANDBG("index(%d) device[%s]:\n", index,
		mux_channel[index].vchannel_name);
	if (!mux_channel[index].mux_hdr_set) {
		ret = ipa_add_qmap_hdr(mux_channel[index].mux_id);
		ret = ipa_add_qmap_hdr(mux_channel[index].mux_id,
		      &mux_channel[index].hdr_hdl);
		if (ret) {
			IPAWANERR("ipa_add_mux_hdr failed (%d)\n", index);
			return ret;
@@ -1826,6 +1873,7 @@ static int ipa_wwan_remove(struct platform_device *pdev)
		wan_ioctl_deinit();
	ipa_del_dflt_wan_rt_tables();
	ipa_del_a7_qmap_hdr();
	ipa_del_mux_qmap_hdrs();
	ipa_qmi_service_exit();
	wwan_del_ul_flt_rule_to_ipa();
	ipa_cleanup_deregister_intf();