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

Commit 826e825e authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa3: IPA SW counter support for FnR stats"

parents a0ffc6ae 3a0820ab
Loading
Loading
Loading
Loading
+116 −0
Original line number Diff line number Diff line
@@ -933,6 +933,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
@@ -953,6 +972,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
@@ -1085,6 +1124,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
@@ -1104,6 +1161,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
@@ -1124,6 +1200,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
@@ -1160,6 +1258,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
@@ -82,9 +82,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);
@@ -99,15 +104,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);
+864 −0

File changed.

Preview size limit exceeded, changes collapsed.

+21 −10
Original line number Diff line number Diff line
@@ -707,6 +707,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\n",
					entry->rule.enable_stats,
					entry->rule.cnt_idx);
				pr_err("hashable:%u retain_hdr:%u ",
					entry->rule.hashable,
					entry->rule.retain_hdr);
@@ -729,6 +732,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\n",
					entry->rule.enable_stats,
					entry->rule.cnt_idx);
				pr_err("hashable:%u retain_hdr:%u ",
					entry->rule.hashable,
					entry->rule.retain_hdr);
@@ -803,9 +809,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\n",
				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");
@@ -838,9 +844,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\n",
				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");
@@ -952,6 +958,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\n",
					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,
@@ -1019,8 +1028,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\n",
				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,
@@ -1050,8 +1060,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\n",
				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,
+94 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 */

#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