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

Commit f197f18b authored by Amir Levy's avatar Amir Levy Committed by Gerrit - the friendly Code Review server
Browse files

msm: ipa3: Enable and adapt the routing IOCTLs to IPAv3



Routing IOCTLs were disabled previously due to lack of IPAv3
routing support. Now having this support, enable these IOCTLs
and adapt them to IPAv3 design.

Change-Id: Icc9310bef56046de6a3f373db064e311678de792
Signed-off-by: default avatarGhanim Fodi <gfodi@codeaurora.org>
Signed-off-by: default avatarAmir Levy <alevy@codeaurora.org>
parent 88d3e00d
Loading
Loading
Loading
Loading
+37 −17
Original line number Diff line number Diff line
@@ -840,8 +840,6 @@ int ipa3_query_rt_index(struct ipa_ioc_get_rt_tbl_indx *in)
{
	struct ipa3_rt_tbl *entry;

	return 0;

	if (in->ip >= IPA_IP_MAX) {
		IPAERR("bad parm\n");
		return -EINVAL;
@@ -863,9 +861,23 @@ static struct ipa3_rt_tbl *__ipa_add_rt_tbl(enum ipa_ip_type ip,
	struct ipa3_rt_tbl_set *set;
	int i;
	int id;
	int max_tbl_indx;

	if (ip >= IPA_IP_MAX || name == NULL) {
		IPAERR("bad parm\n");
	if (name == NULL) {
		IPAERR("no tbl name\n");
		goto error;
	}

	if (ip == IPA_IP_v4) {
		max_tbl_indx =
			max(IPA_MEM_PART(v4_modem_rt_index_hi),
			IPA_MEM_PART(v4_apps_rt_index_hi));
	} else if (ip == IPA_IP_v6) {
		max_tbl_indx =
			max(IPA_MEM_PART(v6_modem_rt_index_hi),
			IPA_MEM_PART(v6_apps_rt_index_hi));
	} else {
		IPAERR("bad ip family type\n");
		goto error;
	}

@@ -890,6 +902,10 @@ static struct ipa3_rt_tbl *__ipa_add_rt_tbl(enum ipa_ip_type ip,
			IPAERR("not free RT tbl indices left\n");
			goto fail_rt_idx_alloc;
		}
		if (i > max_tbl_indx) {
			IPAERR("rt tbl index is above max\n");
			goto fail_rt_idx_alloc;
		}

		INIT_LIST_HEAD(&entry->head_rt_rule_list);
		INIT_LIST_HEAD(&entry->link);
@@ -1004,7 +1020,7 @@ static int __ipa_add_rt_rule(enum ipa_ip_type ip, const char *name,

	tbl = __ipa_add_rt_tbl(ip, name);
	if (tbl == NULL || (tbl->cookie != IPA_COOKIE)) {
		IPAERR("bad params\n");
		IPAERR("failed adding rt tbl name=%s\n", name ? name : "");
		goto error;
	}
	/*
@@ -1059,6 +1075,7 @@ static int __ipa_add_rt_rule(enum ipa_ip_type ip, const char *name,
	return 0;

ipa_insert_failed:
	idr_remove(&tbl->rule_ids, entry->rule_id);
	list_del(&entry->link);
alloc_rule_id_fail:
	kmem_cache_free(ipa3_ctx->rt_rule_cache, entry);
@@ -1080,8 +1097,6 @@ int ipa3_add_rt_rule(struct ipa_ioc_add_rt_rule *rules)
	int i;
	int ret;

	return 0;

	if (rules == NULL || rules->num_rules == 0 || rules->ip >= IPA_IP_MAX) {
		IPAERR("bad parm\n");
		return -EINVAL;
@@ -1166,8 +1181,6 @@ int ipa3_del_rt_rule(struct ipa_ioc_del_rt_rule *hdls)
	int i;
	int ret;

	return 0;

	if (hdls == NULL || hdls->num_hdls == 0 || hdls->ip >= IPA_IP_MAX) {
		IPAERR("bad parm\n");
		return -EINVAL;
@@ -1252,8 +1265,6 @@ int ipa3_reset_rt(enum ipa_ip_type ip)
	u32 apps_start_idx;
	int id;

	return 0;

	if (ip >= IPA_IP_MAX) {
		IPAERR("bad parm\n");
		return -EINVAL;
@@ -1359,8 +1370,6 @@ int ipa3_get_rt_tbl(struct ipa_ioc_get_rt_tbl *lookup)
	struct ipa3_rt_tbl *entry;
	int result = -EFAULT;

	return 0;

	if (lookup == NULL || lookup->ip >= IPA_IP_MAX) {
		IPAERR("bad parm\n");
		return -EINVAL;
@@ -1396,8 +1405,6 @@ int ipa3_put_rt_tbl(u32 rt_tbl_hdl)
	enum ipa_ip_type ip = IPA_IP_MAX;
	int result;

	return 0;

	mutex_lock(&ipa3_ctx->lock);
	entry = ipa3_id_find(rt_tbl_hdl);
	if (entry == NULL) {
@@ -1441,6 +1448,7 @@ static int __ipa_mdfy_rt_rule(struct ipa_rt_rule_mdfy *rtrule)
{
	struct ipa3_rt_entry *entry;
	struct ipa3_hdr_entry *hdr = NULL;
	struct ipa3_hdr_proc_ctx_entry *proc_ctx = NULL;

	if (rtrule->rule.hdr_hdl) {
		hdr = ipa3_id_find(rtrule->rule.hdr_hdl);
@@ -1448,6 +1456,12 @@ static int __ipa_mdfy_rt_rule(struct ipa_rt_rule_mdfy *rtrule)
			IPAERR("rt rule does not point to valid hdr\n");
			goto error;
		}
	} else if (rtrule->rule.hdr_proc_ctx_hdl) {
		proc_ctx = ipa3_id_find(rtrule->rule.hdr_proc_ctx_hdl);
		if ((proc_ctx == NULL) || (proc_ctx->cookie != IPA_COOKIE)) {
			IPAERR("rt rule does not point to valid proc ctx\n");
			goto error;
		}
	}

	entry = ipa3_id_find(rtrule->rt_rule_hdl);
@@ -1463,12 +1477,20 @@ static int __ipa_mdfy_rt_rule(struct ipa_rt_rule_mdfy *rtrule)

	if (entry->hdr)
		entry->hdr->ref_cnt--;
	if (entry->proc_ctx)
		entry->proc_ctx->ref_cnt--;

	entry->rule = rtrule->rule;
	entry->hdr = hdr;
	entry->proc_ctx = proc_ctx;

	if (entry->hdr)
		entry->hdr->ref_cnt++;
	if (entry->proc_ctx)
		entry->proc_ctx->ref_cnt++;

	entry->hw_len = 0;
	entry->prio = 0;

	return 0;

@@ -1489,8 +1511,6 @@ int ipa3_mdfy_rt_rule(struct ipa_ioc_mdfy_rt_rule *hdls)
	int i;
	int result;

	return 0;

	if (hdls == NULL || hdls->num_rules == 0 || hdls->ip >= IPA_IP_MAX) {
		IPAERR("bad parm\n");
		return -EINVAL;