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

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

msm: ipa3: add support for hashable routing tables commit



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

Change-Id: I56b96c5ef9c6b4ee7f4c4255b55bff223a1d08e0
Signed-off-by: default avatarGhanim Fodi <gfodi@codeaurora.org>
Signed-off-by: default avatarAmir Levy <alevy@codeaurora.org>
Signed-off-by: default avatarGidon Studinski <gidons@codeaurora.org>
parent 654b35ec
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -3142,7 +3142,7 @@ static int ipa3_init(const struct ipa3_plat_drv_res *resource_p,
	INIT_LIST_HEAD(&ipa3_ctx->rt_tbl_set[IPA_IP_v4].head_rt_tbl_list);
	INIT_LIST_HEAD(&ipa3_ctx->rt_tbl_set[IPA_IP_v6].head_rt_tbl_list);
	for (i = 0; i < ipa3_ctx->ipa_num_pipes; i++) {
		if (ipa_is_ep_support_flt(i))
		if (!ipa_is_ep_support_flt(i))
			continue;

		flt_tbl = &ipa3_ctx->flt_tbl[i][IPA_IP_v4];
@@ -3204,7 +3204,7 @@ static int ipa3_init(const struct ipa3_plat_drv_res *resource_p,
			ipa3_ctx->empty_rt_tbl_mem.size);
	IPADBG("empty routing table was allocated in system memory");

	/* setup the A5-IPA pipes */
	/* setup the AP-IPA pipes */
	if (ipa3_setup_apps_pipes()) {
		IPAERR(":failed to setup IPA-Apps pipes.\n");
		result = -ENODEV;
@@ -3827,4 +3827,3 @@ struct ipa3_context *ipa3_get_ctx(void)

MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("IPA HW device driver");
+21 −7
Original line number Diff line number Diff line
@@ -73,23 +73,37 @@ struct ipa3_flt_rule_hw_hdr {

/**
 * struct ipa3_rt_rule_hw_hdr - HW header of IPA routing rule
 * @word: filtering rule properties
 * @word: routing rule properties
 * @en_rule: enable rule
 * @pipe_dest_idx: destination pipe index
 * @system: changed from local to system due to HW change
 * @hdr_offset: header offset
 * @proc_ctx: whether hdr_offset points to header table or to
 *	header processing context table
 * @priority: Rule priority. Added to distinguish rules order
 *  at the integrated table consisting from hashable and
 *  non-hashable parts
 * @rsvd1: reserved bits
 * @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.
 * @rule_id: rule ID that will be returned in the packet status
 * @rsvd2: reserved bits
 */
struct ipa3_rt_rule_hw_hdr {
	union {
		u32 word;
		u64 word;
		struct {
			u32 en_rule:16;
			u32 pipe_dest_idx:5;
			u32 system:1;
			u32 hdr_offset:9;
			u32 proc_ctx:1;
			u64 en_rule:16;
			u64 pipe_dest_idx:5;
			u64 system:1;
			u64 hdr_offset:9;
			u64 proc_ctx:1;
			u64 priority:10;
			u64 rsvd1:5;
			u64 retain_hdr:1;
			u64 rule_id:10;
			u64 rsvd2:6;
		} hdr;
	} u;
};
+37 −6
Original line number Diff line number Diff line
@@ -131,12 +131,33 @@

#define IPA_HW_TABLE_ALIGNMENT(start_ofst) \
	(((start_ofst) + 127) & ~127)
#define IPA_RT_FLT_HW_RULE_BUF_SIZE	(128)
#define IPA_RT_FLT_HW_RULE_BUF_SIZE	(256)

#define IPA_HW_TBL_WIDTH (8)
#define IPA_HW_TBL_SYSADDR_ALIGNMENT (0x7)
#define IPA_HW_TBL_SYSADDR_ALIGNMENT (127)
#define IPA_HW_TBL_LCLADDR_ALIGNMENT (7)
#define IPA_HW_TBL_ADDR_MASK (127)
#define IPA_HW_TBL_BLK_SIZE_ALIGNMENT (127)
#define IPA_HW_TBL_HDR_WIDTH (8)

/*
 * for local tables (at sram) offsets is used as tables addresses
 * offset need to be in 8B units (local address aligned) and
 * left shifted to its place. Local bit need to be enabled.
 */
#define IPA_HW_TBL_OFSET_TO_LCLADDR(__ofst) \
	( \
	(((__ofst)/(IPA_HW_TBL_LCLADDR_ALIGNMENT+1)) * \
	(IPA_HW_TBL_ADDR_MASK + 1)) + 1 \
	)

#define IPA_RULE_MAX_PRIORITY (0)
#define IPA_RULE_MIN_PRIORITY (1023)

#define IPA_RULE_ID_MIN_VAL (0)
#define IPA_RULE_ID_MAX_VAL (1022)
#define IPA_RULE_ID_RULE_MISS (0x3FF)

#define IPA_HDR_PROC_CTX_TABLE_ALIGNMENT_BYTE 8
#define IPA_HDR_PROC_CTX_TABLE_ALIGNMENT(start_ofst) \
	(((start_ofst) + IPA_HDR_PROC_CTX_TABLE_ALIGNMENT_BYTE - 1) & \
@@ -212,6 +233,7 @@ struct ipa3_flt_entry {
 * @curr_mem: current routing tables block in sys memory
 * @prev_mem: previous routing table block in sys memory
 * @id: routing table id
 * @rule_ids: idr structure that holds the rule_id for each rule
 */
struct ipa3_rt_tbl {
	struct list_head link;
@@ -222,11 +244,12 @@ struct ipa3_rt_tbl {
	u32 ref_cnt;
	struct ipa3_rt_tbl_set *set;
	u32 cookie;
	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];
	int id;
	struct idr rule_ids;
};

/**
@@ -398,6 +421,10 @@ struct ipa3_flt_tbl {
 * @hdr: header table
 * @proc_ctx: processing context table
 * @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
 * @rule_id: rule 10bit ID to be returned in packet status
 */
struct ipa3_rt_entry {
	struct list_head link;
@@ -408,6 +435,8 @@ struct ipa3_rt_entry {
	struct ipa3_hdr_proc_ctx_entry *proc_ctx;
	u32 hw_len;
	int id;
	u16 prio;
	u16 rule_id;
};

/**
@@ -1767,6 +1796,7 @@ int ipa3_generate_hw_rule(enum ipa_ip_type ip,
			 const struct ipa_rule_attrib *attrib,
			 u8 **buf,
			 u16 *en_rule);
u8 *ipa3_write_64(u64 w, u8 *dest);
u8 *ipa3_write_32(u32 w, u8 *dest);
u8 *ipa3_write_16(u16 hw, u8 *dest);
u8 *ipa3_write_8(u8 b, u8 *dest);
@@ -1867,6 +1897,7 @@ void ipa3_delete_dflt_flt_rules(u32 ipa_ep_idx);

int ipa3_enable_data_path(u32 clnt_hdl);
int ipa3_disable_data_path(u32 clnt_hdl);
int ipa3_alloc_rule_id(struct idr *rule_ids);
int ipa3_id_alloc(void *ptr);
void *ipa3_id_find(u32 id);
void ipa3_id_remove(u32 id);
+6 −0
Original line number Diff line number Diff line
@@ -232,4 +232,10 @@
#define IPA_SYS_PKT_PROC_CNTXT_BASE_OFST (0x000001e0)
#define IPA_LOCAL_PKT_PROC_CNTXT_BASE_OFST (0x000001e8)

#define IPA_FILT_ROUT_HASH_FLUSH_OFST (0x00000090)
#define IPA_FILT_ROUT_HASH_FLUSH_IPv4_FILT_SHFT (12)
#define IPA_FILT_ROUT_HASH_FLUSH_IPv4_ROUT_SHFT (8)
#define IPA_FILT_ROUT_HASH_FLUSH_IPv6_FILT_SHFT (4)
#define IPA_FILT_ROUT_HASH_FLUSH_IPv6_ROUT_SHFT (0)

#endif
+601 −401

File changed.

Preview size limit exceeded, changes collapsed.

Loading