Loading drivers/platform/msm/ipa/ipa_v2/ipa.c +7 −6 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2017, 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 Loading Loading @@ -733,7 +733,8 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) retval = -EFAULT; break; } if (ipa2_del_hdr((struct ipa_ioc_del_hdr *)param)) { if (ipa2_del_hdr_by_user((struct ipa_ioc_del_hdr *)param, true)) { retval = -EFAULT; break; } Loading Loading @@ -1417,8 +1418,8 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) retval = -EFAULT; break; } if (ipa2_del_hdr_proc_ctx( (struct ipa_ioc_del_hdr_proc_ctx *)param)) { if (ipa2_del_hdr_proc_ctx_by_user( (struct ipa_ioc_del_hdr_proc_ctx *)param, true)) { retval = -EFAULT; break; } Loading Loading @@ -2715,7 +2716,7 @@ static int ipa_setup_apps_pipes(void) if (ipa_ctx->dflt_v4_rt_rule_hdl) __ipa_del_rt_rule(ipa_ctx->dflt_v4_rt_rule_hdl); if (ipa_ctx->excp_hdr_hdl) __ipa_del_hdr(ipa_ctx->excp_hdr_hdl); __ipa_del_hdr(ipa_ctx->excp_hdr_hdl, false); ipa2_teardown_sys_pipe(ipa_ctx->clnt_hdl_cmd); fail_cmd: return result; Loading @@ -2727,7 +2728,7 @@ static void ipa_teardown_apps_pipes(void) ipa2_teardown_sys_pipe(ipa_ctx->clnt_hdl_data_in); __ipa_del_rt_rule(ipa_ctx->dflt_v6_rt_rule_hdl); __ipa_del_rt_rule(ipa_ctx->dflt_v4_rt_rule_hdl); __ipa_del_hdr(ipa_ctx->excp_hdr_hdl); __ipa_del_hdr(ipa_ctx->excp_hdr_hdl, false); ipa2_teardown_sys_pipe(ipa_ctx->clnt_hdl_cmd); } Loading drivers/platform/msm/ipa/ipa_v2/ipa_hdr.c +64 −15 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2017, 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 Loading Loading @@ -741,7 +741,8 @@ static int __ipa_add_hdr(struct ipa_hdr_add *hdr) return -EPERM; } static int __ipa_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr) static int __ipa_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr, bool by_user) { struct ipa_hdr_proc_ctx_entry *entry; struct ipa_hdr_proc_ctx_tbl *htbl = &ipa_ctx->hdr_proc_ctx_tbl; Loading @@ -755,6 +756,14 @@ static int __ipa_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr) IPADBG("del ctx proc cnt=%d ofst=%d\n", htbl->proc_ctx_cnt, entry->offset_entry->offset); if (by_user && entry->user_deleted) { IPAERR("proc_ctx already deleted by user\n"); return -EINVAL; } if (by_user) entry->user_deleted = true; if (--entry->ref_cnt) { IPADBG("proc_ctx_hdl %x ref_cnt %d\n", proc_ctx_hdl, entry->ref_cnt); Loading @@ -762,7 +771,7 @@ static int __ipa_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr) } if (release_hdr) __ipa_del_hdr(entry->hdr->id); __ipa_del_hdr(entry->hdr->id, false); /* move the offset entry to appropriate free list */ list_move(&entry->offset_entry->link, Loading @@ -779,7 +788,7 @@ static int __ipa_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr) } int __ipa_del_hdr(u32 hdr_hdl) int __ipa_del_hdr(u32 hdr_hdl, bool by_user) { struct ipa_hdr_entry *entry; struct ipa_hdr_tbl *htbl = &ipa_ctx->hdr_tbl; Loading @@ -790,7 +799,7 @@ int __ipa_del_hdr(u32 hdr_hdl) return -EINVAL; } if (!entry || (entry->cookie != IPA_COOKIE)) { if (entry->cookie != IPA_COOKIE) { IPAERR("bad parm\n"); return -EINVAL; } Loading @@ -802,6 +811,14 @@ int __ipa_del_hdr(u32 hdr_hdl) IPADBG("del hdr of sz=%d hdr_cnt=%d ofst=%d\n", entry->hdr_len, htbl->hdr_cnt, entry->offset_entry->offset); if (by_user && entry->user_deleted) { IPAERR("hdr already deleted by user\n"); return -EINVAL; } if (by_user) entry->user_deleted = true; if (--entry->ref_cnt) { IPADBG("hdr_hdl %x ref_cnt %d\n", hdr_hdl, entry->ref_cnt); return 0; Loading @@ -812,7 +829,7 @@ int __ipa_del_hdr(u32 hdr_hdl) entry->phys_base, entry->hdr_len, DMA_TO_DEVICE); __ipa_del_hdr_proc_ctx(entry->proc_ctx->id, false); __ipa_del_hdr_proc_ctx(entry->proc_ctx->id, false, false); } else { /* move the offset entry to appropriate free list */ list_move(&entry->offset_entry->link, Loading Loading @@ -879,15 +896,16 @@ int ipa2_add_hdr(struct ipa_ioc_add_hdr *hdrs) } /** * ipa2_del_hdr() - Remove the specified headers from SW and optionally commit * them to IPA HW * ipa2_del_hdr_by_user() - Remove the specified headers * from SW and optionally commit them to IPA HW * @hdls: [inout] set of headers to delete * @by_user: Operation requested by user? * * Returns: 0 on success, negative on failure * * Note: Should not be called from atomic context */ int ipa2_del_hdr(struct ipa_ioc_del_hdr *hdls) int ipa2_del_hdr_by_user(struct ipa_ioc_del_hdr *hdls, bool by_user) { int i; int result = -EFAULT; Loading @@ -904,7 +922,7 @@ int ipa2_del_hdr(struct ipa_ioc_del_hdr *hdls) mutex_lock(&ipa_ctx->lock); for (i = 0; i < hdls->num_hdls; i++) { if (__ipa_del_hdr(hdls->hdl[i].hdl)) { if (__ipa_del_hdr(hdls->hdl[i].hdl, by_user)) { IPAERR("failed to del hdr %i\n", i); hdls->hdl[i].status = -1; } else { Loading @@ -924,6 +942,20 @@ int ipa2_del_hdr(struct ipa_ioc_del_hdr *hdls) return result; } /** * ipa2_del_hdr() - Remove the specified headers from SW * and optionally commit them to IPA HW * @hdls: [inout] set of headers to delete * * Returns: 0 on success, negative on failure * * Note: Should not be called from atomic context */ int ipa2_del_hdr(struct ipa_ioc_del_hdr *hdls) { return ipa2_del_hdr_by_user(hdls, false); } /** * ipa2_add_hdr_proc_ctx() - add the specified headers to SW * and optionally commit them to IPA HW Loading Loading @@ -976,16 +1008,18 @@ int ipa2_add_hdr_proc_ctx(struct ipa_ioc_add_hdr_proc_ctx *proc_ctxs) } /** * ipa2_del_hdr_proc_ctx() - * ipa2_del_hdr_proc_ctx_by_user() - * Remove the specified processing context headers from SW and * optionally commit them to IPA HW. * @hdls: [inout] set of processing context headers to delete * @by_user: Operation requested by user? * * Returns: 0 on success, negative on failure * * Note: Should not be called from atomic context */ int ipa2_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) int ipa2_del_hdr_proc_ctx_by_user(struct ipa_ioc_del_hdr_proc_ctx *hdls, bool by_user) { int i; int result; Loading @@ -1004,7 +1038,7 @@ int ipa2_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) mutex_lock(&ipa_ctx->lock); for (i = 0; i < hdls->num_hdls; i++) { if (__ipa_del_hdr_proc_ctx(hdls->hdl[i].hdl, true)) { if (__ipa_del_hdr_proc_ctx(hdls->hdl[i].hdl, true, by_user)) { IPAERR("failed to del hdr %i\n", i); hdls->hdl[i].status = -1; } else { Loading @@ -1024,6 +1058,21 @@ int ipa2_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) return result; } /** * ipa2_del_hdr_proc_ctx() - * Remove the specified processing context headers from SW and * optionally commit them to IPA HW. * @hdls: [inout] set of processing context headers to delete * * Returns: 0 on success, negative on failure * * Note: Should not be called from atomic context */ int ipa2_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) { return ipa2_del_hdr_proc_ctx_by_user(hdls, false); } /** * ipa2_commit_hdr() - commit to IPA HW the current header table in SW * Loading Loading @@ -1252,7 +1301,7 @@ int __ipa_release_hdr(u32 hdr_hdl) { int result = 0; if (__ipa_del_hdr(hdr_hdl)) { if (__ipa_del_hdr(hdr_hdl, false)) { IPADBG("fail to del hdr %x\n", hdr_hdl); result = -EFAULT; goto bail; Loading Loading @@ -1280,7 +1329,7 @@ int __ipa_release_hdr_proc_ctx(u32 proc_ctx_hdl) { int result = 0; if (__ipa_del_hdr_proc_ctx(proc_ctx_hdl, true)) { if (__ipa_del_hdr_proc_ctx(proc_ctx_hdl, true, false)) { IPADBG("fail to del hdr %x\n", proc_ctx_hdl); result = -EFAULT; goto bail; Loading drivers/platform/msm/ipa/ipa_v2/ipa_i.h +11 −2 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2017, 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 Loading Loading @@ -256,6 +256,7 @@ struct ipa_rt_tbl { * @id: header entry id * @is_eth2_ofst_valid: is eth2_ofst field valid? * @eth2_ofst: offset to start of Ethernet-II/802.3 header * @user_deleted: is the header deleted by the user? */ struct ipa_hdr_entry { struct list_head link; Loading @@ -273,6 +274,7 @@ struct ipa_hdr_entry { int id; u8 is_eth2_ofst_valid; u16 eth2_ofst; bool user_deleted; }; /** Loading Loading @@ -336,6 +338,7 @@ struct ipa_hdr_proc_ctx_add_hdr_cmd_seq { * @cookie: cookie used for validity check * @ref_cnt: reference counter of routing table * @id: processing context header entry id * @user_deleted: is the hdr processing context deleted by the user? */ struct ipa_hdr_proc_ctx_entry { struct list_head link; Loading @@ -345,6 +348,7 @@ struct ipa_hdr_proc_ctx_entry { u32 cookie; u32 ref_cnt; int id; bool user_deleted; }; /** Loading Loading @@ -1367,6 +1371,8 @@ int ipa2_add_hdr(struct ipa_ioc_add_hdr *hdrs); int ipa2_del_hdr(struct ipa_ioc_del_hdr *hdls); int ipa2_del_hdr_by_user(struct ipa_ioc_del_hdr *hdls, bool by_user); int ipa2_commit_hdr(void); int ipa2_reset_hdr(void); Loading @@ -1384,6 +1390,9 @@ int ipa2_add_hdr_proc_ctx(struct ipa_ioc_add_hdr_proc_ctx *proc_ctxs); int ipa2_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls); int ipa2_del_hdr_proc_ctx_by_user(struct ipa_ioc_del_hdr_proc_ctx *hdls, bool by_user); /* * Routing */ Loading Loading @@ -1671,7 +1680,7 @@ int ipa2_active_clients_log_print_table(char *buf, int size); void ipa2_active_clients_log_clear(void); int ipa_interrupts_init(u32 ipa_irq, u32 ee, struct device *ipa_dev); int __ipa_del_rt_rule(u32 rule_hdl); int __ipa_del_hdr(u32 hdr_hdl); int __ipa_del_hdr(u32 hdr_hdl, bool by_user); int __ipa_release_hdr(u32 hdr_hdl); int __ipa_release_hdr_proc_ctx(u32 proc_ctx_hdl); int _ipa_read_gen_reg_v1_1(char *buff, int max_len); Loading drivers/platform/msm/ipa/ipa_v3/ipa.c +7 −6 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2017, 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 Loading Loading @@ -784,7 +784,8 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) retval = -EFAULT; break; } if (ipa3_del_hdr((struct ipa_ioc_del_hdr *)param)) { if (ipa3_del_hdr_by_user((struct ipa_ioc_del_hdr *)param, true)) { retval = -EFAULT; break; } Loading Loading @@ -1553,8 +1554,8 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) retval = -EFAULT; break; } if (ipa3_del_hdr_proc_ctx( (struct ipa_ioc_del_hdr_proc_ctx *)param)) { if (ipa3_del_hdr_proc_ctx_by_user( (struct ipa_ioc_del_hdr_proc_ctx *)param, true)) { retval = -EFAULT; break; } Loading Loading @@ -2917,7 +2918,7 @@ static int ipa3_setup_apps_pipes(void) if (ipa3_ctx->dflt_v4_rt_rule_hdl) __ipa3_del_rt_rule(ipa3_ctx->dflt_v4_rt_rule_hdl); if (ipa3_ctx->excp_hdr_hdl) __ipa3_del_hdr(ipa3_ctx->excp_hdr_hdl); __ipa3_del_hdr(ipa3_ctx->excp_hdr_hdl, false); ipa3_teardown_sys_pipe(ipa3_ctx->clnt_hdl_cmd); fail_cmd: return result; Loading @@ -2929,7 +2930,7 @@ static void ipa3_teardown_apps_pipes(void) ipa3_teardown_sys_pipe(ipa3_ctx->clnt_hdl_data_in); __ipa3_del_rt_rule(ipa3_ctx->dflt_v6_rt_rule_hdl); __ipa3_del_rt_rule(ipa3_ctx->dflt_v4_rt_rule_hdl); __ipa3_del_hdr(ipa3_ctx->excp_hdr_hdl); __ipa3_del_hdr(ipa3_ctx->excp_hdr_hdl, false); ipa3_teardown_sys_pipe(ipa3_ctx->clnt_hdl_cmd); } Loading drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c +64 −15 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2017, 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 Loading Loading @@ -576,7 +576,8 @@ static int __ipa_add_hdr(struct ipa_hdr_add *hdr) return -EPERM; } static int __ipa3_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr) static int __ipa3_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr, bool by_user) { struct ipa3_hdr_proc_ctx_entry *entry; struct ipa3_hdr_proc_ctx_tbl *htbl = &ipa3_ctx->hdr_proc_ctx_tbl; Loading @@ -590,6 +591,14 @@ static int __ipa3_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr) IPADBG("del proc ctx cnt=%d ofst=%d\n", htbl->proc_ctx_cnt, entry->offset_entry->offset); if (by_user && entry->user_deleted) { IPAERR("proc_ctx already deleted by user\n"); return -EINVAL; } if (by_user) entry->user_deleted = true; if (--entry->ref_cnt) { IPADBG("proc_ctx_hdl %x ref_cnt %d\n", proc_ctx_hdl, entry->ref_cnt); Loading @@ -597,7 +606,7 @@ static int __ipa3_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr) } if (release_hdr) __ipa3_del_hdr(entry->hdr->id); __ipa3_del_hdr(entry->hdr->id, false); /* move the offset entry to appropriate free list */ list_move(&entry->offset_entry->link, Loading @@ -614,7 +623,7 @@ static int __ipa3_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr) } int __ipa3_del_hdr(u32 hdr_hdl) int __ipa3_del_hdr(u32 hdr_hdl, bool by_user) { struct ipa3_hdr_entry *entry; struct ipa3_hdr_tbl *htbl = &ipa3_ctx->hdr_tbl; Loading @@ -625,7 +634,7 @@ int __ipa3_del_hdr(u32 hdr_hdl) return -EINVAL; } if (!entry || (entry->cookie != IPA_COOKIE)) { if (entry->cookie != IPA_COOKIE) { IPAERR("bad parm\n"); return -EINVAL; } Loading @@ -638,6 +647,14 @@ int __ipa3_del_hdr(u32 hdr_hdl) entry->hdr_len, htbl->hdr_cnt, entry->offset_entry->offset); if (by_user && entry->user_deleted) { IPAERR("proc_ctx already deleted by user\n"); return -EINVAL; } if (by_user) entry->user_deleted = true; if (--entry->ref_cnt) { IPADBG("hdr_hdl %x ref_cnt %d\n", hdr_hdl, entry->ref_cnt); return 0; Loading @@ -648,7 +665,7 @@ int __ipa3_del_hdr(u32 hdr_hdl) entry->phys_base, entry->hdr_len, DMA_TO_DEVICE); __ipa3_del_hdr_proc_ctx(entry->proc_ctx->id, false); __ipa3_del_hdr_proc_ctx(entry->proc_ctx->id, false, false); } else { /* move the offset entry to appropriate free list */ list_move(&entry->offset_entry->link, Loading Loading @@ -710,15 +727,16 @@ int ipa3_add_hdr(struct ipa_ioc_add_hdr *hdrs) } /** * ipa3_del_hdr() - Remove the specified headers from SW and optionally commit * them to IPA HW * ipa3_del_hdr_by_user() - Remove the specified headers * from SW and optionally commit them to IPA HW * @hdls: [inout] set of headers to delete * @by_user: Operation requested by user? * * Returns: 0 on success, negative on failure * * Note: Should not be called from atomic context */ int ipa3_del_hdr(struct ipa_ioc_del_hdr *hdls) int ipa3_del_hdr_by_user(struct ipa_ioc_del_hdr *hdls, bool by_user) { int i; int result = -EFAULT; Loading @@ -730,7 +748,7 @@ int ipa3_del_hdr(struct ipa_ioc_del_hdr *hdls) mutex_lock(&ipa3_ctx->lock); for (i = 0; i < hdls->num_hdls; i++) { if (__ipa3_del_hdr(hdls->hdl[i].hdl)) { if (__ipa3_del_hdr(hdls->hdl[i].hdl, by_user)) { IPAERR("failed to del hdr %i\n", i); hdls->hdl[i].status = -1; } else { Loading @@ -750,6 +768,20 @@ int ipa3_del_hdr(struct ipa_ioc_del_hdr *hdls) return result; } /** * ipa3_del_hdr() - Remove the specified headers from SW * and optionally commit them to IPA HW * @hdls: [inout] set of headers to delete * * Returns: 0 on success, negative on failure * * Note: Should not be called from atomic context */ int ipa3_del_hdr(struct ipa_ioc_del_hdr *hdls) { return ipa3_del_hdr_by_user(hdls, false); } /** * ipa3_add_hdr_proc_ctx() - add the specified headers to SW * and optionally commit them to IPA HW Loading Loading @@ -795,16 +827,18 @@ int ipa3_add_hdr_proc_ctx(struct ipa_ioc_add_hdr_proc_ctx *proc_ctxs) } /** * ipa3_del_hdr_proc_ctx() - * ipa3_del_hdr_proc_ctx_by_user() - * Remove the specified processing context headers from SW and * optionally commit them to IPA HW. * @hdls: [inout] set of processing context headers to delete * @by_user: Operation requested by user? * * Returns: 0 on success, negative on failure * * Note: Should not be called from atomic context */ int ipa3_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) int ipa3_del_hdr_proc_ctx_by_user(struct ipa_ioc_del_hdr_proc_ctx *hdls, bool by_user) { int i; int result; Loading @@ -816,7 +850,7 @@ int ipa3_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) mutex_lock(&ipa3_ctx->lock); for (i = 0; i < hdls->num_hdls; i++) { if (__ipa3_del_hdr_proc_ctx(hdls->hdl[i].hdl, true)) { if (__ipa3_del_hdr_proc_ctx(hdls->hdl[i].hdl, true, by_user)) { IPAERR("failed to del hdr %i\n", i); hdls->hdl[i].status = -1; } else { Loading @@ -836,6 +870,21 @@ int ipa3_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) return result; } /** * ipa3_del_hdr_proc_ctx() - * Remove the specified processing context headers from SW and * optionally commit them to IPA HW. * @hdls: [inout] set of processing context headers to delete * * Returns: 0 on success, negative on failure * * Note: Should not be called from atomic context */ int ipa3_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) { return ipa3_del_hdr_proc_ctx_by_user(hdls, false); } /** * ipa3_commit_hdr() - commit to IPA HW the current header table in SW * Loading Loading @@ -1064,7 +1113,7 @@ int __ipa3_release_hdr(u32 hdr_hdl) { int result = 0; if (__ipa3_del_hdr(hdr_hdl)) { if (__ipa3_del_hdr(hdr_hdl, false)) { IPADBG("fail to del hdr %x\n", hdr_hdl); result = -EFAULT; goto bail; Loading Loading @@ -1092,7 +1141,7 @@ int __ipa3_release_hdr_proc_ctx(u32 proc_ctx_hdl) { int result = 0; if (__ipa3_del_hdr_proc_ctx(proc_ctx_hdl, true)) { if (__ipa3_del_hdr_proc_ctx(proc_ctx_hdl, true, false)) { IPADBG("fail to del hdr %x\n", proc_ctx_hdl); result = -EFAULT; goto bail; Loading Loading
drivers/platform/msm/ipa/ipa_v2/ipa.c +7 −6 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2017, 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 Loading Loading @@ -733,7 +733,8 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) retval = -EFAULT; break; } if (ipa2_del_hdr((struct ipa_ioc_del_hdr *)param)) { if (ipa2_del_hdr_by_user((struct ipa_ioc_del_hdr *)param, true)) { retval = -EFAULT; break; } Loading Loading @@ -1417,8 +1418,8 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) retval = -EFAULT; break; } if (ipa2_del_hdr_proc_ctx( (struct ipa_ioc_del_hdr_proc_ctx *)param)) { if (ipa2_del_hdr_proc_ctx_by_user( (struct ipa_ioc_del_hdr_proc_ctx *)param, true)) { retval = -EFAULT; break; } Loading Loading @@ -2715,7 +2716,7 @@ static int ipa_setup_apps_pipes(void) if (ipa_ctx->dflt_v4_rt_rule_hdl) __ipa_del_rt_rule(ipa_ctx->dflt_v4_rt_rule_hdl); if (ipa_ctx->excp_hdr_hdl) __ipa_del_hdr(ipa_ctx->excp_hdr_hdl); __ipa_del_hdr(ipa_ctx->excp_hdr_hdl, false); ipa2_teardown_sys_pipe(ipa_ctx->clnt_hdl_cmd); fail_cmd: return result; Loading @@ -2727,7 +2728,7 @@ static void ipa_teardown_apps_pipes(void) ipa2_teardown_sys_pipe(ipa_ctx->clnt_hdl_data_in); __ipa_del_rt_rule(ipa_ctx->dflt_v6_rt_rule_hdl); __ipa_del_rt_rule(ipa_ctx->dflt_v4_rt_rule_hdl); __ipa_del_hdr(ipa_ctx->excp_hdr_hdl); __ipa_del_hdr(ipa_ctx->excp_hdr_hdl, false); ipa2_teardown_sys_pipe(ipa_ctx->clnt_hdl_cmd); } Loading
drivers/platform/msm/ipa/ipa_v2/ipa_hdr.c +64 −15 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2017, 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 Loading Loading @@ -741,7 +741,8 @@ static int __ipa_add_hdr(struct ipa_hdr_add *hdr) return -EPERM; } static int __ipa_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr) static int __ipa_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr, bool by_user) { struct ipa_hdr_proc_ctx_entry *entry; struct ipa_hdr_proc_ctx_tbl *htbl = &ipa_ctx->hdr_proc_ctx_tbl; Loading @@ -755,6 +756,14 @@ static int __ipa_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr) IPADBG("del ctx proc cnt=%d ofst=%d\n", htbl->proc_ctx_cnt, entry->offset_entry->offset); if (by_user && entry->user_deleted) { IPAERR("proc_ctx already deleted by user\n"); return -EINVAL; } if (by_user) entry->user_deleted = true; if (--entry->ref_cnt) { IPADBG("proc_ctx_hdl %x ref_cnt %d\n", proc_ctx_hdl, entry->ref_cnt); Loading @@ -762,7 +771,7 @@ static int __ipa_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr) } if (release_hdr) __ipa_del_hdr(entry->hdr->id); __ipa_del_hdr(entry->hdr->id, false); /* move the offset entry to appropriate free list */ list_move(&entry->offset_entry->link, Loading @@ -779,7 +788,7 @@ static int __ipa_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr) } int __ipa_del_hdr(u32 hdr_hdl) int __ipa_del_hdr(u32 hdr_hdl, bool by_user) { struct ipa_hdr_entry *entry; struct ipa_hdr_tbl *htbl = &ipa_ctx->hdr_tbl; Loading @@ -790,7 +799,7 @@ int __ipa_del_hdr(u32 hdr_hdl) return -EINVAL; } if (!entry || (entry->cookie != IPA_COOKIE)) { if (entry->cookie != IPA_COOKIE) { IPAERR("bad parm\n"); return -EINVAL; } Loading @@ -802,6 +811,14 @@ int __ipa_del_hdr(u32 hdr_hdl) IPADBG("del hdr of sz=%d hdr_cnt=%d ofst=%d\n", entry->hdr_len, htbl->hdr_cnt, entry->offset_entry->offset); if (by_user && entry->user_deleted) { IPAERR("hdr already deleted by user\n"); return -EINVAL; } if (by_user) entry->user_deleted = true; if (--entry->ref_cnt) { IPADBG("hdr_hdl %x ref_cnt %d\n", hdr_hdl, entry->ref_cnt); return 0; Loading @@ -812,7 +829,7 @@ int __ipa_del_hdr(u32 hdr_hdl) entry->phys_base, entry->hdr_len, DMA_TO_DEVICE); __ipa_del_hdr_proc_ctx(entry->proc_ctx->id, false); __ipa_del_hdr_proc_ctx(entry->proc_ctx->id, false, false); } else { /* move the offset entry to appropriate free list */ list_move(&entry->offset_entry->link, Loading Loading @@ -879,15 +896,16 @@ int ipa2_add_hdr(struct ipa_ioc_add_hdr *hdrs) } /** * ipa2_del_hdr() - Remove the specified headers from SW and optionally commit * them to IPA HW * ipa2_del_hdr_by_user() - Remove the specified headers * from SW and optionally commit them to IPA HW * @hdls: [inout] set of headers to delete * @by_user: Operation requested by user? * * Returns: 0 on success, negative on failure * * Note: Should not be called from atomic context */ int ipa2_del_hdr(struct ipa_ioc_del_hdr *hdls) int ipa2_del_hdr_by_user(struct ipa_ioc_del_hdr *hdls, bool by_user) { int i; int result = -EFAULT; Loading @@ -904,7 +922,7 @@ int ipa2_del_hdr(struct ipa_ioc_del_hdr *hdls) mutex_lock(&ipa_ctx->lock); for (i = 0; i < hdls->num_hdls; i++) { if (__ipa_del_hdr(hdls->hdl[i].hdl)) { if (__ipa_del_hdr(hdls->hdl[i].hdl, by_user)) { IPAERR("failed to del hdr %i\n", i); hdls->hdl[i].status = -1; } else { Loading @@ -924,6 +942,20 @@ int ipa2_del_hdr(struct ipa_ioc_del_hdr *hdls) return result; } /** * ipa2_del_hdr() - Remove the specified headers from SW * and optionally commit them to IPA HW * @hdls: [inout] set of headers to delete * * Returns: 0 on success, negative on failure * * Note: Should not be called from atomic context */ int ipa2_del_hdr(struct ipa_ioc_del_hdr *hdls) { return ipa2_del_hdr_by_user(hdls, false); } /** * ipa2_add_hdr_proc_ctx() - add the specified headers to SW * and optionally commit them to IPA HW Loading Loading @@ -976,16 +1008,18 @@ int ipa2_add_hdr_proc_ctx(struct ipa_ioc_add_hdr_proc_ctx *proc_ctxs) } /** * ipa2_del_hdr_proc_ctx() - * ipa2_del_hdr_proc_ctx_by_user() - * Remove the specified processing context headers from SW and * optionally commit them to IPA HW. * @hdls: [inout] set of processing context headers to delete * @by_user: Operation requested by user? * * Returns: 0 on success, negative on failure * * Note: Should not be called from atomic context */ int ipa2_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) int ipa2_del_hdr_proc_ctx_by_user(struct ipa_ioc_del_hdr_proc_ctx *hdls, bool by_user) { int i; int result; Loading @@ -1004,7 +1038,7 @@ int ipa2_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) mutex_lock(&ipa_ctx->lock); for (i = 0; i < hdls->num_hdls; i++) { if (__ipa_del_hdr_proc_ctx(hdls->hdl[i].hdl, true)) { if (__ipa_del_hdr_proc_ctx(hdls->hdl[i].hdl, true, by_user)) { IPAERR("failed to del hdr %i\n", i); hdls->hdl[i].status = -1; } else { Loading @@ -1024,6 +1058,21 @@ int ipa2_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) return result; } /** * ipa2_del_hdr_proc_ctx() - * Remove the specified processing context headers from SW and * optionally commit them to IPA HW. * @hdls: [inout] set of processing context headers to delete * * Returns: 0 on success, negative on failure * * Note: Should not be called from atomic context */ int ipa2_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) { return ipa2_del_hdr_proc_ctx_by_user(hdls, false); } /** * ipa2_commit_hdr() - commit to IPA HW the current header table in SW * Loading Loading @@ -1252,7 +1301,7 @@ int __ipa_release_hdr(u32 hdr_hdl) { int result = 0; if (__ipa_del_hdr(hdr_hdl)) { if (__ipa_del_hdr(hdr_hdl, false)) { IPADBG("fail to del hdr %x\n", hdr_hdl); result = -EFAULT; goto bail; Loading Loading @@ -1280,7 +1329,7 @@ int __ipa_release_hdr_proc_ctx(u32 proc_ctx_hdl) { int result = 0; if (__ipa_del_hdr_proc_ctx(proc_ctx_hdl, true)) { if (__ipa_del_hdr_proc_ctx(proc_ctx_hdl, true, false)) { IPADBG("fail to del hdr %x\n", proc_ctx_hdl); result = -EFAULT; goto bail; Loading
drivers/platform/msm/ipa/ipa_v2/ipa_i.h +11 −2 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2017, 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 Loading Loading @@ -256,6 +256,7 @@ struct ipa_rt_tbl { * @id: header entry id * @is_eth2_ofst_valid: is eth2_ofst field valid? * @eth2_ofst: offset to start of Ethernet-II/802.3 header * @user_deleted: is the header deleted by the user? */ struct ipa_hdr_entry { struct list_head link; Loading @@ -273,6 +274,7 @@ struct ipa_hdr_entry { int id; u8 is_eth2_ofst_valid; u16 eth2_ofst; bool user_deleted; }; /** Loading Loading @@ -336,6 +338,7 @@ struct ipa_hdr_proc_ctx_add_hdr_cmd_seq { * @cookie: cookie used for validity check * @ref_cnt: reference counter of routing table * @id: processing context header entry id * @user_deleted: is the hdr processing context deleted by the user? */ struct ipa_hdr_proc_ctx_entry { struct list_head link; Loading @@ -345,6 +348,7 @@ struct ipa_hdr_proc_ctx_entry { u32 cookie; u32 ref_cnt; int id; bool user_deleted; }; /** Loading Loading @@ -1367,6 +1371,8 @@ int ipa2_add_hdr(struct ipa_ioc_add_hdr *hdrs); int ipa2_del_hdr(struct ipa_ioc_del_hdr *hdls); int ipa2_del_hdr_by_user(struct ipa_ioc_del_hdr *hdls, bool by_user); int ipa2_commit_hdr(void); int ipa2_reset_hdr(void); Loading @@ -1384,6 +1390,9 @@ int ipa2_add_hdr_proc_ctx(struct ipa_ioc_add_hdr_proc_ctx *proc_ctxs); int ipa2_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls); int ipa2_del_hdr_proc_ctx_by_user(struct ipa_ioc_del_hdr_proc_ctx *hdls, bool by_user); /* * Routing */ Loading Loading @@ -1671,7 +1680,7 @@ int ipa2_active_clients_log_print_table(char *buf, int size); void ipa2_active_clients_log_clear(void); int ipa_interrupts_init(u32 ipa_irq, u32 ee, struct device *ipa_dev); int __ipa_del_rt_rule(u32 rule_hdl); int __ipa_del_hdr(u32 hdr_hdl); int __ipa_del_hdr(u32 hdr_hdl, bool by_user); int __ipa_release_hdr(u32 hdr_hdl); int __ipa_release_hdr_proc_ctx(u32 proc_ctx_hdl); int _ipa_read_gen_reg_v1_1(char *buff, int max_len); Loading
drivers/platform/msm/ipa/ipa_v3/ipa.c +7 −6 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2017, 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 Loading Loading @@ -784,7 +784,8 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) retval = -EFAULT; break; } if (ipa3_del_hdr((struct ipa_ioc_del_hdr *)param)) { if (ipa3_del_hdr_by_user((struct ipa_ioc_del_hdr *)param, true)) { retval = -EFAULT; break; } Loading Loading @@ -1553,8 +1554,8 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) retval = -EFAULT; break; } if (ipa3_del_hdr_proc_ctx( (struct ipa_ioc_del_hdr_proc_ctx *)param)) { if (ipa3_del_hdr_proc_ctx_by_user( (struct ipa_ioc_del_hdr_proc_ctx *)param, true)) { retval = -EFAULT; break; } Loading Loading @@ -2917,7 +2918,7 @@ static int ipa3_setup_apps_pipes(void) if (ipa3_ctx->dflt_v4_rt_rule_hdl) __ipa3_del_rt_rule(ipa3_ctx->dflt_v4_rt_rule_hdl); if (ipa3_ctx->excp_hdr_hdl) __ipa3_del_hdr(ipa3_ctx->excp_hdr_hdl); __ipa3_del_hdr(ipa3_ctx->excp_hdr_hdl, false); ipa3_teardown_sys_pipe(ipa3_ctx->clnt_hdl_cmd); fail_cmd: return result; Loading @@ -2929,7 +2930,7 @@ static void ipa3_teardown_apps_pipes(void) ipa3_teardown_sys_pipe(ipa3_ctx->clnt_hdl_data_in); __ipa3_del_rt_rule(ipa3_ctx->dflt_v6_rt_rule_hdl); __ipa3_del_rt_rule(ipa3_ctx->dflt_v4_rt_rule_hdl); __ipa3_del_hdr(ipa3_ctx->excp_hdr_hdl); __ipa3_del_hdr(ipa3_ctx->excp_hdr_hdl, false); ipa3_teardown_sys_pipe(ipa3_ctx->clnt_hdl_cmd); } Loading
drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c +64 −15 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2017, 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 Loading Loading @@ -576,7 +576,8 @@ static int __ipa_add_hdr(struct ipa_hdr_add *hdr) return -EPERM; } static int __ipa3_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr) static int __ipa3_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr, bool by_user) { struct ipa3_hdr_proc_ctx_entry *entry; struct ipa3_hdr_proc_ctx_tbl *htbl = &ipa3_ctx->hdr_proc_ctx_tbl; Loading @@ -590,6 +591,14 @@ static int __ipa3_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr) IPADBG("del proc ctx cnt=%d ofst=%d\n", htbl->proc_ctx_cnt, entry->offset_entry->offset); if (by_user && entry->user_deleted) { IPAERR("proc_ctx already deleted by user\n"); return -EINVAL; } if (by_user) entry->user_deleted = true; if (--entry->ref_cnt) { IPADBG("proc_ctx_hdl %x ref_cnt %d\n", proc_ctx_hdl, entry->ref_cnt); Loading @@ -597,7 +606,7 @@ static int __ipa3_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr) } if (release_hdr) __ipa3_del_hdr(entry->hdr->id); __ipa3_del_hdr(entry->hdr->id, false); /* move the offset entry to appropriate free list */ list_move(&entry->offset_entry->link, Loading @@ -614,7 +623,7 @@ static int __ipa3_del_hdr_proc_ctx(u32 proc_ctx_hdl, bool release_hdr) } int __ipa3_del_hdr(u32 hdr_hdl) int __ipa3_del_hdr(u32 hdr_hdl, bool by_user) { struct ipa3_hdr_entry *entry; struct ipa3_hdr_tbl *htbl = &ipa3_ctx->hdr_tbl; Loading @@ -625,7 +634,7 @@ int __ipa3_del_hdr(u32 hdr_hdl) return -EINVAL; } if (!entry || (entry->cookie != IPA_COOKIE)) { if (entry->cookie != IPA_COOKIE) { IPAERR("bad parm\n"); return -EINVAL; } Loading @@ -638,6 +647,14 @@ int __ipa3_del_hdr(u32 hdr_hdl) entry->hdr_len, htbl->hdr_cnt, entry->offset_entry->offset); if (by_user && entry->user_deleted) { IPAERR("proc_ctx already deleted by user\n"); return -EINVAL; } if (by_user) entry->user_deleted = true; if (--entry->ref_cnt) { IPADBG("hdr_hdl %x ref_cnt %d\n", hdr_hdl, entry->ref_cnt); return 0; Loading @@ -648,7 +665,7 @@ int __ipa3_del_hdr(u32 hdr_hdl) entry->phys_base, entry->hdr_len, DMA_TO_DEVICE); __ipa3_del_hdr_proc_ctx(entry->proc_ctx->id, false); __ipa3_del_hdr_proc_ctx(entry->proc_ctx->id, false, false); } else { /* move the offset entry to appropriate free list */ list_move(&entry->offset_entry->link, Loading Loading @@ -710,15 +727,16 @@ int ipa3_add_hdr(struct ipa_ioc_add_hdr *hdrs) } /** * ipa3_del_hdr() - Remove the specified headers from SW and optionally commit * them to IPA HW * ipa3_del_hdr_by_user() - Remove the specified headers * from SW and optionally commit them to IPA HW * @hdls: [inout] set of headers to delete * @by_user: Operation requested by user? * * Returns: 0 on success, negative on failure * * Note: Should not be called from atomic context */ int ipa3_del_hdr(struct ipa_ioc_del_hdr *hdls) int ipa3_del_hdr_by_user(struct ipa_ioc_del_hdr *hdls, bool by_user) { int i; int result = -EFAULT; Loading @@ -730,7 +748,7 @@ int ipa3_del_hdr(struct ipa_ioc_del_hdr *hdls) mutex_lock(&ipa3_ctx->lock); for (i = 0; i < hdls->num_hdls; i++) { if (__ipa3_del_hdr(hdls->hdl[i].hdl)) { if (__ipa3_del_hdr(hdls->hdl[i].hdl, by_user)) { IPAERR("failed to del hdr %i\n", i); hdls->hdl[i].status = -1; } else { Loading @@ -750,6 +768,20 @@ int ipa3_del_hdr(struct ipa_ioc_del_hdr *hdls) return result; } /** * ipa3_del_hdr() - Remove the specified headers from SW * and optionally commit them to IPA HW * @hdls: [inout] set of headers to delete * * Returns: 0 on success, negative on failure * * Note: Should not be called from atomic context */ int ipa3_del_hdr(struct ipa_ioc_del_hdr *hdls) { return ipa3_del_hdr_by_user(hdls, false); } /** * ipa3_add_hdr_proc_ctx() - add the specified headers to SW * and optionally commit them to IPA HW Loading Loading @@ -795,16 +827,18 @@ int ipa3_add_hdr_proc_ctx(struct ipa_ioc_add_hdr_proc_ctx *proc_ctxs) } /** * ipa3_del_hdr_proc_ctx() - * ipa3_del_hdr_proc_ctx_by_user() - * Remove the specified processing context headers from SW and * optionally commit them to IPA HW. * @hdls: [inout] set of processing context headers to delete * @by_user: Operation requested by user? * * Returns: 0 on success, negative on failure * * Note: Should not be called from atomic context */ int ipa3_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) int ipa3_del_hdr_proc_ctx_by_user(struct ipa_ioc_del_hdr_proc_ctx *hdls, bool by_user) { int i; int result; Loading @@ -816,7 +850,7 @@ int ipa3_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) mutex_lock(&ipa3_ctx->lock); for (i = 0; i < hdls->num_hdls; i++) { if (__ipa3_del_hdr_proc_ctx(hdls->hdl[i].hdl, true)) { if (__ipa3_del_hdr_proc_ctx(hdls->hdl[i].hdl, true, by_user)) { IPAERR("failed to del hdr %i\n", i); hdls->hdl[i].status = -1; } else { Loading @@ -836,6 +870,21 @@ int ipa3_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) return result; } /** * ipa3_del_hdr_proc_ctx() - * Remove the specified processing context headers from SW and * optionally commit them to IPA HW. * @hdls: [inout] set of processing context headers to delete * * Returns: 0 on success, negative on failure * * Note: Should not be called from atomic context */ int ipa3_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) { return ipa3_del_hdr_proc_ctx_by_user(hdls, false); } /** * ipa3_commit_hdr() - commit to IPA HW the current header table in SW * Loading Loading @@ -1064,7 +1113,7 @@ int __ipa3_release_hdr(u32 hdr_hdl) { int result = 0; if (__ipa3_del_hdr(hdr_hdl)) { if (__ipa3_del_hdr(hdr_hdl, false)) { IPADBG("fail to del hdr %x\n", hdr_hdl); result = -EFAULT; goto bail; Loading Loading @@ -1092,7 +1141,7 @@ int __ipa3_release_hdr_proc_ctx(u32 proc_ctx_hdl) { int result = 0; if (__ipa3_del_hdr_proc_ctx(proc_ctx_hdl, true)) { if (__ipa3_del_hdr_proc_ctx(proc_ctx_hdl, true, false)) { IPADBG("fail to del hdr %x\n", proc_ctx_hdl); result = -EFAULT; goto bail; Loading