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

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

msm: ipa3: add support for hashable filter tables commit



IPAv3 introduces hashable and non-hashable filtering tables. On commit,
the driver needs to build two separate tables, commit both to IPA core
and flush the internal cache.

Change-Id: I8e5bcdea6ee526d7876e827729da194691177f42
Signed-off-by: default avatarGhanim Fodi <gfodi@codeaurora.org>
Signed-off-by: default avatarGidon Studinski <gidons@codeaurora.org>
Signed-off-by: default avatarAmir Levy <alevy@codeaurora.org>
parent 80002124
Loading
Loading
Loading
Loading
+33 −2
Original line number Diff line number Diff line
@@ -2817,6 +2817,28 @@ static void ipa3_sps_event_cb(enum sps_callback_case event, void *param)

	spin_unlock_irqrestore(&ipa3_ctx->sps_pm.lock, flags);
}

/**
 * ipa3_destroy_flt_tbl_idrs() - destroy the idr structure for flt tables
 *  The idr strcuture per filtering table is intended for rule id generation
 *  per filtering rule.
 */
static void ipa3_destroy_flt_tbl_idrs(void)
{
	int i;
	struct ipa3_flt_tbl *flt_tbl;

	for (i = 0; i < ipa3_ctx->ipa_num_pipes; i++) {
		if (!ipa_is_ep_support_flt(i))
			continue;

		flt_tbl = &ipa3_ctx->flt_tbl[i][IPA_IP_v4];
		idr_destroy(&flt_tbl->rule_ids);
		flt_tbl = &ipa3_ctx->flt_tbl[i][IPA_IP_v6];
		idr_destroy(&flt_tbl->rule_ids);
	}
}

/**
* ipa3_init() - Initialize the IPA Driver
* @resource_p:	contain platform specific values from DST file
@@ -3147,11 +3169,19 @@ static int ipa3_init(const struct ipa3_plat_drv_res *resource_p,

		flt_tbl = &ipa3_ctx->flt_tbl[i][IPA_IP_v4];
		INIT_LIST_HEAD(&flt_tbl->head_flt_rule_list);
		flt_tbl->in_sys = !ipa3_ctx->ip4_flt_tbl_nhash_lcl;
		flt_tbl->in_sys[IPA_RULE_HASHABLE] =
			!ipa3_ctx->ip4_flt_tbl_hash_lcl;
		flt_tbl->in_sys[IPA_RULE_NON_HASHABLE] =
			!ipa3_ctx->ip4_flt_tbl_nhash_lcl;
		idr_init(&flt_tbl->rule_ids);

		flt_tbl = &ipa3_ctx->flt_tbl[i][IPA_IP_v6];
		INIT_LIST_HEAD(&flt_tbl->head_flt_rule_list);
		flt_tbl->in_sys = !ipa3_ctx->ip6_flt_tbl_nhash_lcl;
		flt_tbl->in_sys[IPA_RULE_HASHABLE] =
			!ipa3_ctx->ip6_flt_tbl_hash_lcl;
		flt_tbl->in_sys[IPA_RULE_NON_HASHABLE] =
			!ipa3_ctx->ip6_flt_tbl_nhash_lcl;
		idr_init(&flt_tbl->rule_ids);
	}

	rset = &ipa3_ctx->reap_rt_tbl_set[IPA_IP_v4];
@@ -3353,6 +3383,7 @@ fail_empty_rt_tbl:
			  ipa3_ctx->empty_rt_tbl_mem.base,
			  ipa3_ctx->empty_rt_tbl_mem.phys_base);
fail_apps_pipes:
	ipa3_destroy_flt_tbl_idrs();
	idr_destroy(&ipa3_ctx->ipa_idr);
fail_dma_pool:
	kmem_cache_destroy(ipa3_ctx->rx_pkt_wrapper_cache);
+2 −0
Original line number Diff line number Diff line
@@ -751,6 +751,8 @@ static ssize_t ipa3_read_flt(struct file *file, char __user *ubuf, size_t count,
	mutex_lock(&ipa3_ctx->lock);

	for (j = 0; j < ipa3_ctx->ipa_num_pipes; j++) {
		if (!ipa_is_ep_support_flt(j))
			continue;
		tbl = &ipa3_ctx->flt_tbl[j][ip];
		i = 0;
		list_for_each_entry(entry, &tbl->head_flt_rule_list, link) {
+686 −402

File changed.

Preview size limit exceeded, changes collapsed.

+17 −13
Original line number Diff line number Diff line
@@ -50,23 +50,27 @@
 * @retain_hdr: added to add back to the packet the header removed
 *  as part of header removal. This will be done as part of
 *  header insertion block.
 * @to_uc: direct IPA to sent the packet to uc instead of
 *  the intended destination. This will be performed just after
 *  routing block processing, so routing will have determined
 *  destination end point and uc will receive this information
 *  together with the packet as part of the HW packet TX commands
 * @rsvd: reserved bits
 * @rsvd1: reserved bits
 * @priority: Rule priority. Added to distinguish rules order
 *  at the integrated table consisting from hashable and
 *  non-hashable parts
 * @rsvd2: reserved bits
 * @rule_id: rule ID that will be returned in the packet status
 * @rsvd3: reserved bits
 */
struct ipa3_flt_rule_hw_hdr {
	union {
		u32 word;
		u64 word;
		struct {
			u32 en_rule:16;
			u32 action:5;
			u32 rt_tbl_idx:5;
			u32 retain_hdr:1;
			u32 to_uc:1;
			u32 rsvd:4;
			u64 en_rule:16;
			u64 action:5;
			u64 rt_tbl_idx:5;
			u64 retain_hdr:1;
			u64 rsvd1:5;
			u64 priority:10;
			u64 rsvd2:6;
			u64 rule_id:10;
			u64 rsvd3:6;
		} hdr;
	} u;
};
+15 −6
Original line number Diff line number Diff line
@@ -139,6 +139,7 @@
#define IPA_HW_TBL_ADDR_MASK (127)
#define IPA_HW_TBL_BLK_SIZE_ALIGNMENT (127)
#define IPA_HW_TBL_HDR_WIDTH (8)
#define IPA_HW_RULE_START_ALIGNMENT (7)

/*
 * for local tables (at sram) offsets is used as tables addresses
@@ -207,6 +208,10 @@ struct ipa3_mem_buffer {
 * @tbl: filter table
 * @rt_tbl: routing table
 * @hw_len: entry's size
 * @id: rule handle - globaly unique
 * @prio: rule 10bit priority which defines the order of the rule
 *  among other rules at the same integrated table
 * @rule_id: rule 10bit ID to be returned in packet status
 */
struct ipa3_flt_entry {
	struct list_head link;
@@ -216,6 +221,8 @@ struct ipa3_flt_entry {
	struct ipa3_rt_tbl *rt_tbl;
	u32 hw_len;
	int id;
	u16 prio;
	u16 rule_id;
};

/**
@@ -397,19 +404,21 @@ struct ipa3_hdr_proc_ctx_tbl {
 * @head_flt_rule_list: filter rules list
 * @rule_cnt: number of filter rules
 * @in_sys: flag indicating if filter table is located in system memory
 * @sz: the size of the filter table
 * @sz: the size of the filter tables
 * @end: the last header index
 * @curr_mem: current filter tables block in sys memory
 * @prev_mem: previous filter table block in sys memory
 * @rule_ids: idr structure that holds the rule_id for each rule
 */
struct ipa3_flt_tbl {
	struct list_head head_flt_rule_list;
	u32 rule_cnt;
	bool in_sys;
	u32 sz;
	struct ipa3_mem_buffer curr_mem;
	struct ipa3_mem_buffer prev_mem;
	bool in_sys[IPA_RULE_TYPE_MAX];
	u32 sz[IPA_RULE_TYPE_MAX];
	struct ipa3_mem_buffer curr_mem[IPA_RULE_TYPE_MAX];
	struct ipa3_mem_buffer prev_mem[IPA_RULE_TYPE_MAX];
	bool sticky_rear;
	struct idr rule_ids;
};

/**
@@ -423,7 +432,7 @@ struct ipa3_flt_tbl {
 * @hw_len: the length of the table
 * @id: rule handle - globaly unique
 * @prio: rule 10bit priority which defines the order of the rule
 *  among other rules at the same table
 *  among other rules at the integrated same table
 * @rule_id: rule 10bit ID to be returned in packet status
 */
struct ipa3_rt_entry {
Loading