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

Commit 1f626a61 authored by Bojun Pan's avatar Bojun Pan Committed by Gerrit - the friendly Code Review server
Browse files

msm: IPA: FnR stats for IPA4.5



Update the FnR stats related changes for IPA 4.5.

Change-Id: I3f34b5d58862636cba39cff3403102fb7884f769
Signed-off-by: default avatarBojun Pan <bojunp@codeaurora.org>
parent 4b042fdc
Loading
Loading
Loading
Loading
+116 −0
Original line number Diff line number Diff line
@@ -942,6 +942,25 @@ int ipa_add_rt_rule(struct ipa_ioc_add_rt_rule *rules)
}
EXPORT_SYMBOL(ipa_add_rt_rule);

/**
 * ipa_add_rt_rule_v2() - Add the specified routing rules to SW
 * and optionally commit to IPA HW
 * @rules:	[inout] set of routing rules to add
 *
 * Returns:	0 on success, negative on failure
 *
 * Note:	Should not be called from atomic context
 */
int ipa_add_rt_rule_v2(struct ipa_ioc_add_rt_rule_v2 *rules)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_add_rt_rule_v2, rules);

	return ret;
}
EXPORT_SYMBOL(ipa_add_rt_rule_v2);

/**
 * ipa_add_rt_rule_usr() - Add the specified routing rules to SW and optionally
 * commit to IPA HW
@@ -962,6 +981,26 @@ int ipa_add_rt_rule_usr(struct ipa_ioc_add_rt_rule *rules, bool user_only)
}
EXPORT_SYMBOL(ipa_add_rt_rule_usr);

/**
 * ipa_add_rt_rule_usr_v2() - Add the specified routing rules to
 * SW and optionally commit to IPA HW
 * @rules:	[inout] set of routing rules to add
 * @user_only:	[in] indicate rules installed by userspace
 *
 * Returns:	0 on success, negative on failure
 *
 * Note:	Should not be called from atomic context
 */
int ipa_add_rt_rule_usr_v2(struct ipa_ioc_add_rt_rule_v2 *rules, bool user_only)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_add_rt_rule_usr_v2, rules, user_only);

	return ret;
}
EXPORT_SYMBOL(ipa_add_rt_rule_usr_v2);

/**
 * ipa_del_rt_rule() - Remove the specified routing rules to SW and optionally
 * commit to IPA HW
@@ -1094,6 +1133,24 @@ int ipa_mdfy_rt_rule(struct ipa_ioc_mdfy_rt_rule *hdls)
}
EXPORT_SYMBOL(ipa_mdfy_rt_rule);

/**
 * ipa_mdfy_rt_rule_v2() - Modify the specified routing rules in
 * SW and optionally commit to IPA HW
 *
 * Returns:	0 on success, negative on failure
 *
 * Note:	Should not be called from atomic context
 */
int ipa_mdfy_rt_rule_v2(struct ipa_ioc_mdfy_rt_rule_v2 *hdls)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_mdfy_rt_rule_v2, hdls);

	return ret;
}
EXPORT_SYMBOL(ipa_mdfy_rt_rule_v2);

/**
 * ipa_add_flt_rule() - Add the specified filtering rules to SW and optionally
 * commit to IPA HW
@@ -1113,6 +1170,25 @@ int ipa_add_flt_rule(struct ipa_ioc_add_flt_rule *rules)
}
EXPORT_SYMBOL(ipa_add_flt_rule);

/**
 * ipa_add_flt_rule_v2() - Add the specified filtering rules to
 * SW and optionally commit to IPA HW
 * @rules:	[inout] set of filtering rules to add
 *
 * Returns:	0 on success, negative on failure
 *
 * Note:	Should not be called from atomic context
 */
int ipa_add_flt_rule_v2(struct ipa_ioc_add_flt_rule_v2 *rules)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_add_flt_rule_v2, rules);

	return ret;
}
EXPORT_SYMBOL(ipa_add_flt_rule_v2);

/**
 * ipa_add_flt_rule_usr() - Add the specified filtering rules to
 * SW and optionally commit to IPA HW
@@ -1133,6 +1209,28 @@ int ipa_add_flt_rule_usr(struct ipa_ioc_add_flt_rule *rules, bool user_only)
}
EXPORT_SYMBOL(ipa_add_flt_rule_usr);

/**
 * ipa_add_flt_rule_usr_v2() - Add the specified filtering rules
 * to SW and optionally commit to IPA HW
 * @rules:		[inout] set of filtering rules to add
 * @user_only:	[in] indicate rules installed by userspace
 *
 * Returns:	0 on success, negative on failure
 *
 * Note:	Should not be called from atomic context
 */
int ipa_add_flt_rule_usr_v2(struct ipa_ioc_add_flt_rule_v2 *rules,
	bool user_only)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_add_flt_rule_usr_v2,
		rules, user_only);

	return ret;
}
EXPORT_SYMBOL(ipa_add_flt_rule_usr_v2);

/**
 * ipa_del_flt_rule() - Remove the specified filtering rules from SW and
 * optionally commit to IPA HW
@@ -1169,6 +1267,24 @@ int ipa_mdfy_flt_rule(struct ipa_ioc_mdfy_flt_rule *hdls)
}
EXPORT_SYMBOL(ipa_mdfy_flt_rule);

/**
 * ipa_mdfy_flt_rule_v2() - Modify the specified filtering rules
 * in SW and optionally commit to IPA HW
 *
 * Returns:	0 on success, negative on failure
 *
 * Note:	Should not be called from atomic context
 */
int ipa_mdfy_flt_rule_v2(struct ipa_ioc_mdfy_flt_rule_v2 *hdls)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_mdfy_flt_rule_v2, hdls);

	return ret;
}
EXPORT_SYMBOL(ipa_mdfy_flt_rule_v2);

/**
 * ipa_commit_flt() - Commit the current SW filtering table of specified type to
 * IPA HW
+14 −0
Original line number Diff line number Diff line
@@ -89,9 +89,14 @@ struct ipa_api_controller {

	int (*ipa_add_rt_rule)(struct ipa_ioc_add_rt_rule *rules);

	int (*ipa_add_rt_rule_v2)(struct ipa_ioc_add_rt_rule_v2 *rules);

	int (*ipa_add_rt_rule_usr)(struct ipa_ioc_add_rt_rule *rules,
							bool user_only);

	int (*ipa_add_rt_rule_usr_v2)(struct ipa_ioc_add_rt_rule_v2 *rules,
							bool user_only);

	int (*ipa_del_rt_rule)(struct ipa_ioc_del_rt_rule *hdls);

	int (*ipa_commit_rt)(enum ipa_ip_type ip);
@@ -106,15 +111,24 @@ struct ipa_api_controller {

	int (*ipa_mdfy_rt_rule)(struct ipa_ioc_mdfy_rt_rule *rules);

	int (*ipa_mdfy_rt_rule_v2)(struct ipa_ioc_mdfy_rt_rule_v2 *rules);

	int (*ipa_add_flt_rule)(struct ipa_ioc_add_flt_rule *rules);

	int (*ipa_add_flt_rule_v2)(struct ipa_ioc_add_flt_rule_v2 *rules);

	int (*ipa_add_flt_rule_usr)(struct ipa_ioc_add_flt_rule *rules,
								bool user_only);

	int (*ipa_add_flt_rule_usr_v2)
		(struct ipa_ioc_add_flt_rule_v2 *rules, bool user_only);

	int (*ipa_del_flt_rule)(struct ipa_ioc_del_flt_rule *hdls);

	int (*ipa_mdfy_flt_rule)(struct ipa_ioc_mdfy_flt_rule *rules);

	int (*ipa_mdfy_flt_rule_v2)(struct ipa_ioc_mdfy_flt_rule_v2 *rules);

	int (*ipa_commit_flt)(enum ipa_ip_type ip);

	int (*ipa_reset_flt)(enum ipa_ip_type ip, bool user_only);
+728 −0

File changed.

Preview size limit exceeded, changes collapsed.

+21 −10
Original line number Diff line number Diff line
@@ -728,6 +728,9 @@ static ssize_t ipa3_read_rt(struct file *file, char __user *ubuf, size_t count,
				pr_err("rule_id:%u max_prio:%u prio:%u ",
					entry->rule_id, entry->rule.max_prio,
					entry->prio);
				pr_err("enable_stats:%u counter_id:%u ",
					entry->rule.enable_stats,
					entry->rule.cnt_idx);
				pr_err("hashable:%u retain_hdr:%u ",
					entry->rule.hashable,
					entry->rule.retain_hdr);
@@ -750,6 +753,9 @@ static ssize_t ipa3_read_rt(struct file *file, char __user *ubuf, size_t count,
				pr_err("rule_id:%u max_prio:%u prio:%u ",
					entry->rule_id, entry->rule.max_prio,
					entry->prio);
				pr_err("enable_stats:%u counter_id:%u ",
					entry->rule.enable_stats,
					entry->rule.cnt_idx);
				pr_err("hashable:%u retain_hdr:%u ",
					entry->rule.hashable,
					entry->rule.retain_hdr);
@@ -824,9 +830,9 @@ static ssize_t ipa3_read_rt_hw(struct file *file, char __user *ubuf,
					rules[rl].hdr_ofst,
					rules[rl].eq_attrib.rule_eq_bitmap);

			pr_err("rule_id:%u prio:%u retain_hdr:%u ",
				rules[rl].id, rules[rl].priority,
				rules[rl].retain_hdr);
			pr_err("rule_id:%u cnt_id:%hhu prio:%u retain_hdr:%u ",
				rules[rl].id, rules[rl].cnt_idx,
				rules[rl].priority, rules[rl].retain_hdr);
			res = ipa3_attrib_dump_eq(&rules[rl].eq_attrib);
			if (res) {
				IPAERR_RL("failed read attrib eq\n");
@@ -859,9 +865,9 @@ static ssize_t ipa3_read_rt_hw(struct file *file, char __user *ubuf,
					rules[rl].hdr_ofst,
					rules[rl].eq_attrib.rule_eq_bitmap);

			pr_err("rule_id:%u prio:%u retain_hdr:%u\n",
				rules[rl].id, rules[rl].priority,
				rules[rl].retain_hdr);
			pr_err("rule_id:%u cnt_id:%hhu prio:%u retain_hdr:%u ",
				rules[rl].id, rules[rl].cnt_idx,
				rules[rl].priority, rules[rl].retain_hdr);
			res = ipa3_attrib_dump_eq(&rules[rl].eq_attrib);
			if (res) {
				IPAERR_RL("failed read attrib eq\n");
@@ -973,6 +979,9 @@ static ssize_t ipa3_read_flt(struct file *file, char __user *ubuf, size_t count,
			pr_err("hashable:%u rule_id:%u max_prio:%u prio:%u ",
				entry->rule.hashable, entry->rule_id,
				entry->rule.max_prio, entry->prio);
			pr_err("enable_stats:%u counter_id:%u ",
					entry->rule.enable_stats,
					entry->rule.cnt_idx);
			if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0)
				pr_err("pdn index %d, set metadata %d ",
					entry->rule.pdn_idx,
@@ -1040,8 +1049,9 @@ static ssize_t ipa3_read_flt_hw(struct file *file, char __user *ubuf,
				pipe, rl, rules[rl].rule.action, rt_tbl_idx);
			pr_err("attrib_mask:%08x retain_hdr:%d ",
				bitmap, rules[rl].rule.retain_hdr);
			pr_err("rule_id:%u prio:%u ",
				rules[rl].id, rules[rl].priority);
			pr_err("rule_id:%u cnt_id:%hhu prio:%u ",
				rules[rl].id, rules[rl].cnt_idx,
				rules[rl].priority);
			if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0)
				pr_err("pdn: %u, set_metadata: %u ",
					rules[rl].rule.pdn_idx,
@@ -1071,8 +1081,9 @@ static ssize_t ipa3_read_flt_hw(struct file *file, char __user *ubuf,
				pipe, rl, rules[rl].rule.action, rt_tbl_idx);
			pr_err("attrib_mask:%08x retain_hdr:%d ",
				bitmap, rules[rl].rule.retain_hdr);
			pr_err("rule_id:%u  prio:%u ",
				rules[rl].id, rules[rl].priority);
			pr_err("rule_id:%u cnt_id:%hhu prio:%u ",
				rules[rl].id, rules[rl].cnt_idx,
				rules[rl].priority);
			if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0)
				pr_err("pdn: %u, set_metadata: %u ",
					rules[rl].rule.pdn_idx,
+101 −0
Original line number Diff line number Diff line
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef _IPA_DEFS_H_
#define _IPA_DEFS_H_
#include <linux/ipa.h>

/**
 * struct ipa_rt_rule_i - attributes of a routing rule
 * @dst: dst "client"
 * @hdr_hdl: handle to the dynamic header
	it is not an index or an offset
 * @hdr_proc_ctx_hdl: handle to header processing context. if it is provided
	hdr_hdl shall be 0
 * @attrib: attributes of the rule
 * @max_prio: bool switch. is this rule with Max priority? meaning on rule hit,
 *  IPA will use the rule and will not look for other rules that may have
 *  higher priority
 * @hashable: bool switch. is this rule hashable or not?
 *  ipa uses hashable rules to cache their hit results to be used in
 *  consecutive packets
 * @retain_hdr: bool switch to instruct IPA core to add back to the packet
 *  the header removed as part of header removal
 * @coalesce: bool to decide whether packets should be coalesced or not
 * @enable_stats: is true when we want to enable stats for this
 * rt rule.
 * @cnt_idx: if enable_stats is 1 and cnt_idx is 0, then cnt_idx
 * will be assigned by ipa driver.
 */
struct ipa_rt_rule_i {
	enum ipa_client_type dst;
	u32 hdr_hdl;
	u32 hdr_proc_ctx_hdl;
	struct ipa_rule_attrib attrib;
	u8 max_prio;
	u8 hashable;
	u8 retain_hdr;
	u8 coalesce;
	u8 enable_stats;
	u8 cnt_idx;
};

/**
 * struct ipa_flt_rule_i - attributes of a filtering rule
 * @retain_hdr: bool switch to instruct IPA core to add back to the packet
 *  the header removed as part of header removal
 * @to_uc: bool switch to pass packet to micro-controller
 * @action: action field
 * @rt_tbl_hdl: handle of table from "get"
 * @attrib: attributes of the rule
 * @eq_attrib: attributes of the rule in equation form (valid when
 * eq_attrib_type is true)
 * @rt_tbl_idx: index of RT table referred to by filter rule (valid when
 * eq_attrib_type is true and non-exception action)
 * @eq_attrib_type: true if equation level form used to specify attributes
 * @max_prio: bool switch. is this rule with Max priority? meaning on rule hit,
 *  IPA will use the rule and will not look for other rules that may have
 *  higher priority
 * @hashable: bool switch. is this rule hashable or not?
 *  ipa uses hashable rules to cache their hit results to be used in
 *  consecutive packets
 * @rule_id: rule_id to be assigned to the filter rule. In case client specifies
 *  rule_id as 0 the driver will assign a new rule_id
 * @set_metadata: bool switch. should metadata replacement at the NAT block
 *  take place?
 * @pdn_idx: if action is "pass to source\destination NAT" then a comparison
 * against the PDN index in the matching PDN entry will take place as an
 * additional condition for NAT hit.
 * @enable_stats: is true when we want to enable stats for this
 * flt rule.
 * @cnt_idx: if 0 means disable, otherwise use for index.
 * will be assigned by ipa driver.
 */
struct ipa_flt_rule_i {
	u8 retain_hdr;
	u8 to_uc;
	enum ipa_flt_action action;
	u32 rt_tbl_hdl;
	struct ipa_rule_attrib attrib;
	struct ipa_ipfltri_rule_eq eq_attrib;
	u32 rt_tbl_idx;
	u8 eq_attrib_type;
	u8 max_prio;
	u8 hashable;
	u16 rule_id;
	u8 set_metadata;
	u8 pdn_idx;
	u8 enable_stats;
	u8 cnt_idx;
};

#endif /* _IPA_DEFS_H_ */
Loading