msm: ipa: add support for packet length update
Add support for IPA uC to update packet length field
in client header.
Change-Id: I11021aa3e81bd75acd71797de53d57262de0c3ea
Acked-by: Shihuan Liu <shihuanl@qti.qualcomm.com>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c b/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c
index da7bcd0..1b4a3e3 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c
@@ -66,12 +66,29 @@ static int ipa3_hdr_proc_ctx_to_hw_format(struct ipa_mem_buffer *mem,
{
struct ipa3_hdr_proc_ctx_entry *entry;
int ret;
+ int ep;
list_for_each_entry(entry,
&ipa3_ctx->hdr_proc_ctx_tbl.head_proc_ctx_entry_list,
link) {
IPADBG_LOW("processing type %d ofst=%d\n",
entry->type, entry->offset_entry->offset);
+
+ if (entry->l2tp_params.is_dst_pipe_valid) {
+ ep = ipa3_get_ep_mapping(entry->l2tp_params.dst_pipe);
+ if (ep >= 0) {
+ entry->l2tp_params.hdr_remove_param.
+ hdr_ofst_pkt_size_valid = ipa3_ctx->
+ ep[ep].cfg.hdr.hdr_ofst_pkt_size_valid;
+ entry->l2tp_params.hdr_remove_param.
+ hdr_ofst_pkt_size = ipa3_ctx->ep[ep].
+ cfg.hdr.hdr_ofst_pkt_size;
+ entry->l2tp_params.hdr_remove_param.
+ hdr_endianness = ipa3_ctx->ep[ep].
+ cfg.hdr_ext.hdr_little_endian ? 0 : 1;
+ }
+ }
+
ret = ipahal_cp_proc_ctx_to_hw_buff(entry->type, mem->base,
entry->offset_entry->offset,
entry->hdr->hdr_len,
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h
index 58702e9..7af05ed 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h
@@ -354,7 +354,7 @@ struct ipa3_hdr_proc_ctx_entry {
struct list_head link;
u32 cookie;
enum ipa_hdr_proc_type type;
- union ipa_l2tp_hdr_proc_ctx_params l2tp_params;
+ struct ipa_l2tp_hdr_proc_ctx_params l2tp_params;
struct ipa3_hdr_proc_ctx_offset_entry *offset_entry;
struct ipa3_hdr_entry *hdr;
u32 ref_cnt;
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal.c b/drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal.c
index 57d44e3..a48fd01 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal.c
@@ -1167,7 +1167,7 @@ static int ipahal_cp_proc_ctx_to_hw_buff_v3(enum ipa_hdr_proc_type type,
u32 hdr_len, bool is_hdr_proc_ctx,
dma_addr_t phys_base, u32 hdr_base_addr,
struct ipa_hdr_offset_entry *offset_entry,
- union ipa_l2tp_hdr_proc_ctx_params l2tp_params){
+ struct ipa_l2tp_hdr_proc_ctx_params l2tp_params){
if (type == IPA_HDR_PROC_NONE) {
struct ipa_hw_hdr_proc_ctx_add_hdr_seq *ctx;
@@ -1230,6 +1230,17 @@ static int ipahal_cp_proc_ctx_to_hw_buff_v3(enum ipa_hdr_proc_type type,
l2tp_params.hdr_remove_param.hdr_len_remove;
ctx->l2tp_params.l2tp_params.eth_hdr_retained =
l2tp_params.hdr_remove_param.eth_hdr_retained;
+ ctx->l2tp_params.l2tp_params.hdr_ofst_pkt_size_valid =
+ l2tp_params.hdr_remove_param.hdr_ofst_pkt_size_valid;
+ ctx->l2tp_params.l2tp_params.hdr_ofst_pkt_size =
+ l2tp_params.hdr_remove_param.hdr_ofst_pkt_size;
+ ctx->l2tp_params.l2tp_params.hdr_endianness =
+ l2tp_params.hdr_remove_param.hdr_endianness;
+ IPAHAL_DBG("hdr ofst valid: %d, hdr ofst pkt size: %d\n",
+ ctx->l2tp_params.l2tp_params.hdr_ofst_pkt_size_valid,
+ ctx->l2tp_params.l2tp_params.hdr_ofst_pkt_size);
+ IPAHAL_DBG("endianness: %d\n",
+ ctx->l2tp_params.l2tp_params.hdr_endianness);
IPAHAL_DBG("command id %d\n", ctx->l2tp_params.tlv.value);
ctx->end.type = IPA_PROC_CTX_TLV_TYPE_END;
@@ -1304,7 +1315,7 @@ struct ipahal_hdr_funcs {
bool is_hdr_proc_ctx, dma_addr_t phys_base,
u32 hdr_base_addr,
struct ipa_hdr_offset_entry *offset_entry,
- union ipa_l2tp_hdr_proc_ctx_params l2tp_params);
+ struct ipa_l2tp_hdr_proc_ctx_params l2tp_params);
int (*ipahal_get_proc_ctx_needed_len)(enum ipa_hdr_proc_type type);
};
@@ -1375,7 +1386,7 @@ int ipahal_cp_proc_ctx_to_hw_buff(enum ipa_hdr_proc_type type,
void *const base, u32 offset, u32 hdr_len,
bool is_hdr_proc_ctx, dma_addr_t phys_base,
u32 hdr_base_addr, struct ipa_hdr_offset_entry *offset_entry,
- union ipa_l2tp_hdr_proc_ctx_params l2tp_params)
+ struct ipa_l2tp_hdr_proc_ctx_params l2tp_params)
{
IPAHAL_DBG(
"type %d, base %p, offset %d, hdr_len %d, is_hdr_proc_ctx %d, hdr_base_addr %d, offset_entry %p\n"
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal.h b/drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal.h
index 0f322b5..56b884b 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal.h
+++ b/drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal.h
@@ -637,7 +637,7 @@ int ipahal_cp_proc_ctx_to_hw_buff(enum ipa_hdr_proc_type type,
bool is_hdr_proc_ctx, dma_addr_t phys_base,
u32 hdr_base_addr,
struct ipa_hdr_offset_entry *offset_entry,
- union ipa_l2tp_hdr_proc_ctx_params l2tp_params);
+ struct ipa_l2tp_hdr_proc_ctx_params l2tp_params);
/*
* ipahal_get_proc_ctx_needed_len() - calculates the needed length for addition
diff --git a/include/uapi/linux/msm_ipa.h b/include/uapi/linux/msm_ipa.h
index 939ad08..5fdbdd8 100644
--- a/include/uapi/linux/msm_ipa.h
+++ b/include/uapi/linux/msm_ipa.h
@@ -892,22 +892,37 @@ struct ipa_l2tp_header_add_procparams {
* @hdr_len_remove: Specifies how much of the header needs to
be removed in bytes
* @eth_hdr_retained: Specifies if Ethernet header is retained or not
+ * @hdr_ofst_pkt_size_valid: Specifies if the Header offset is valid
+ * @hdr_ofst_pkt_size: If hdr_ofst_pkt_size_valid =1, this indicates where the
+ packet size field (2bytes) resides
+ * @hdr_endianness: 0:little endian, 1:big endian
*/
struct ipa_l2tp_header_remove_procparams {
uint32_t hdr_len_remove:8;
uint32_t eth_hdr_retained:1;
- uint32_t reserved:23;
+ /* Following fields are valid if eth_hdr_retained =1 ( bridge mode) */
+ uint32_t hdr_ofst_pkt_size_valid:1;
+ uint32_t hdr_ofst_pkt_size:6;
+ uint32_t hdr_endianness:1;
+ uint32_t reserved:15;
};
/**
- * union ipa_l2tp_hdr_proc_ctx_params -
+ * struct ipa_l2tp_hdr_proc_ctx_params -
* @hdr_add_param: parameters for header add
* @hdr_remove_param: parameters for header remove
+ * @is_dst_pipe_valid: if dst pipe is valid
+ * @dst_pipe: destination pipe
*/
-union ipa_l2tp_hdr_proc_ctx_params {
+struct ipa_l2tp_hdr_proc_ctx_params {
struct ipa_l2tp_header_add_procparams hdr_add_param;
struct ipa_l2tp_header_remove_procparams hdr_remove_param;
+ uint8_t is_dst_pipe_valid;
+ enum ipa_client_type dst_pipe;
};
+
+#define L2TP_USER_SPACE_SPECIFY_DST_PIPE
+
/**
* struct ipa_hdr_proc_ctx_add - processing context descriptor includes
* in and out parameters
@@ -924,7 +939,7 @@ struct ipa_hdr_proc_ctx_add {
uint32_t hdr_hdl;
uint32_t proc_ctx_hdl;
int status;
- union ipa_l2tp_hdr_proc_ctx_params l2tp_params;
+ struct ipa_l2tp_hdr_proc_ctx_params l2tp_params;
};
#define IPA_L2TP_HDR_PROC_SUPPORT