Loading drivers/platform/msm/ipa/ipa_common_i.h +37 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,10 @@ #include <linux/ipa.h> #include <linux/ipa_uc_offload.h> #include <linux/ipa_wdi3.h> #include <linux/ratelimit.h> #define WARNON_RATELIMIT_BURST 1 #define IPA_RATELIMIT_BURST 1 #define __FILENAME__ \ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) Loading Loading @@ -104,6 +108,39 @@ ipa_dec_client_disable_clks(&log_info); \ } while (0) /* * Printing one warning message in 5 seconds if multiple warning messages * are coming back to back. */ #define WARN_ON_RATELIMIT_IPA(condition) \ ({ \ static DEFINE_RATELIMIT_STATE(_rs, \ DEFAULT_RATELIMIT_INTERVAL, \ WARNON_RATELIMIT_BURST); \ int rtn = !!(condition); \ \ if (unlikely(rtn && __ratelimit(&_rs))) \ WARN_ON(rtn); \ }) /* * Printing one error message in 5 seconds if multiple error messages * are coming back to back. */ #define pr_err_ratelimited_ipa(fmt, ...) \ printk_ratelimited_ipa(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) #define printk_ratelimited_ipa(fmt, ...) \ ({ \ static DEFINE_RATELIMIT_STATE(_rs, \ DEFAULT_RATELIMIT_INTERVAL, \ IPA_RATELIMIT_BURST); \ \ if (__ratelimit(&_rs)) \ printk(fmt, ##__VA_ARGS__); \ }) #define ipa_assert_on(condition)\ do {\ if (unlikely(condition))\ Loading drivers/platform/msm/ipa/ipa_v3/ipa_flt.c +17 −17 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ static int ipa3_generate_flt_hw_rule(enum ipa_ip_type ip, res = ipahal_flt_generate_hw_rule(&gen_params, &entry->hw_len, buf); if (res) IPAERR("failed to generate flt h/w rule\n"); IPAERR_RL("failed to generate flt h/w rule\n"); return 0; } Loading Loading @@ -311,7 +311,7 @@ static int ipa_generate_flt_hw_tbl_img(enum ipa_ip_type ip, } if (ipahal_fltrt_allocate_hw_tbl_imgs(alloc_params)) { IPAERR("fail to allocate FLT HW TBL images. IP %d\n", ip); IPAERR_RL("fail to allocate FLT HW TBL images. IP %d\n", ip); rc = -ENOMEM; goto allocate_failed; } Loading @@ -319,14 +319,14 @@ static int ipa_generate_flt_hw_tbl_img(enum ipa_ip_type ip, if (ipa_translate_flt_tbl_to_hw_fmt(ip, IPA_RULE_HASHABLE, alloc_params->hash_bdy.base, alloc_params->hash_hdr.base, hash_bdy_start_ofst)) { IPAERR("fail to translate hashable flt tbls to hw format\n"); IPAERR_RL("fail to translate hashable flt tbls to hw format\n"); rc = -EPERM; goto translate_fail; } if (ipa_translate_flt_tbl_to_hw_fmt(ip, IPA_RULE_NON_HASHABLE, alloc_params->nhash_bdy.base, alloc_params->nhash_hdr.base, nhash_bdy_start_ofst)) { IPAERR("fail to translate non-hash flt tbls to hw format\n"); IPAERR_RL("fail to translate non-hash flt tbls to hw format\n"); rc = -EPERM; goto translate_fail; } Loading Loading @@ -530,7 +530,7 @@ int __ipa_commit_flt_v3(enum ipa_ip_type ip) } if (ipa_generate_flt_hw_tbl_img(ip, &alloc_params)) { IPAERR("fail to generate FLT HW TBL image. IP %d\n", ip); IPAERR_RL("fail to generate FLT HW TBL image. IP %d\n", ip); rc = -EFAULT; goto prep_failed; } Loading Loading @@ -745,25 +745,25 @@ static int __ipa_validate_flt_rule(const struct ipa_flt_rule *rule, if (rule->action != IPA_PASS_TO_EXCEPTION) { if (!rule->eq_attrib_type) { if (!rule->rt_tbl_hdl) { IPAERR("invalid RT tbl\n"); IPAERR_RL("invalid RT tbl\n"); goto error; } *rt_tbl = ipa3_id_find(rule->rt_tbl_hdl); if (*rt_tbl == NULL) { IPAERR("RT tbl not found\n"); IPAERR_RL("RT tbl not found\n"); goto error; } if ((*rt_tbl)->cookie != IPA_RT_TBL_COOKIE) { IPAERR("RT table cookie is invalid\n"); IPAERR_RL("RT table cookie is invalid\n"); goto error; } } else { if (rule->rt_tbl_idx > ((ip == IPA_IP_v4) ? IPA_MEM_PART(v4_modem_rt_index_hi) : IPA_MEM_PART(v6_modem_rt_index_hi))) { IPAERR("invalid RT tbl\n"); IPAERR_RL("invalid RT tbl\n"); goto error; } } Loading @@ -778,12 +778,12 @@ static int __ipa_validate_flt_rule(const struct ipa_flt_rule *rule, if (rule->pdn_idx) { if (rule->action == IPA_PASS_TO_EXCEPTION || rule->action == IPA_PASS_TO_ROUTING) { IPAERR( IPAERR_RL( "PDN index should be 0 when action is not pass to NAT\n"); goto error; } else { if (rule->pdn_idx >= IPA_MAX_PDN_NUM) { IPAERR("PDN index %d is too large\n", IPAERR_RL("PDN index %d is too large\n", rule->pdn_idx); goto error; } Loading @@ -794,7 +794,7 @@ static int __ipa_validate_flt_rule(const struct ipa_flt_rule *rule, if (rule->rule_id) { if ((rule->rule_id < ipahal_get_rule_id_hi_bit()) || (rule->rule_id >= ((ipahal_get_rule_id_hi_bit()<<1)-1))) { IPAERR("invalid rule_id provided 0x%x\n" IPAERR_RL("invalid rule_id provided 0x%x\n" "rule_id with bit 0x%x are auto generated\n", rule->rule_id, ipahal_get_rule_id_hi_bit()); goto error; Loading Loading @@ -828,8 +828,8 @@ static int __ipa_create_flt_entry(struct ipa3_flt_entry **entry, } else { id = ipa3_alloc_rule_id(tbl->rule_ids); if (id < 0) { IPAERR("failed to allocate rule id\n"); WARN_ON(1); IPAERR_RL("failed to allocate rule id\n"); WARN_ON_RATELIMIT_IPA(1); goto rule_id_fail; } } Loading @@ -853,8 +853,8 @@ static int __ipa_finish_flt_rule_add(struct ipa3_flt_tbl *tbl, entry->rt_tbl->ref_cnt++; id = ipa3_id_alloc(entry); if (id < 0) { IPAERR("failed to add to tree\n"); WARN_ON(1); IPAERR_RL("failed to add to tree\n"); WARN_ON_RATELIMIT_IPA(1); goto ipa_insert_failed; } *rule_hdl = id; Loading Loading @@ -1399,7 +1399,7 @@ int ipa3_reset_flt(enum ipa_ip_type ip) list_for_each_entry_safe(entry, next, &tbl->head_flt_rule_list, link) { if (ipa3_id_find(entry->id) == NULL) { WARN_ON(1); WARN_ON_RATELIMIT_IPA(1); mutex_unlock(&ipa3_ctx->lock); return -EFAULT; } Loading drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c +9 −9 Original line number Diff line number Diff line Loading @@ -343,7 +343,7 @@ static int __ipa_add_hdr_proc_ctx(struct ipa_hdr_proc_ctx_add *proc_ctx, } if (hdr_entry->cookie != IPA_HDR_COOKIE) { IPAERR_RL("Invalid header cookie %u\n", hdr_entry->cookie); WARN_ON(1); WARN_ON_RATELIMIT_IPA(1); return -EINVAL; } IPADBG("Associated header is name=%s is_hdr_proc_ctx=%d\n", Loading Loading @@ -373,7 +373,7 @@ static int __ipa_add_hdr_proc_ctx(struct ipa_hdr_proc_ctx_add *proc_ctx, bin = IPA_HDR_PROC_CTX_BIN1; } else { IPAERR_RL("unexpected needed len %d\n", needed_len); WARN_ON(1); WARN_ON_RATELIMIT_IPA(1); goto bad_len; } Loading Loading @@ -418,8 +418,8 @@ static int __ipa_add_hdr_proc_ctx(struct ipa_hdr_proc_ctx_add *proc_ctx, id = ipa3_id_alloc(entry); if (id < 0) { IPAERR("failed to alloc id\n"); WARN_ON(1); IPAERR_RL("failed to alloc id\n"); WARN_ON_RATELIMIT_IPA(1); goto ipa_insert_failed; } entry->id = id; Loading Loading @@ -555,8 +555,8 @@ static int __ipa_add_hdr(struct ipa_hdr_add *hdr) id = ipa3_id_alloc(entry); if (id < 0) { IPAERR("failed to alloc id\n"); WARN_ON(1); IPAERR_RL("failed to alloc id\n"); WARN_ON_RATELIMIT_IPA(1); goto ipa_insert_failed; } entry->id = id; Loading Loading @@ -984,7 +984,7 @@ int ipa3_reset_hdr(void) if (entry->is_hdr_proc_ctx) { IPAERR("default header is proc ctx\n"); mutex_unlock(&ipa3_ctx->lock); WARN_ON(1); WARN_ON_RATELIMIT_IPA(1); return -EFAULT; } continue; Loading @@ -992,7 +992,7 @@ int ipa3_reset_hdr(void) if (ipa3_id_find(entry->id) == NULL) { mutex_unlock(&ipa3_ctx->lock); WARN_ON(1); WARN_ON_RATELIMIT_IPA(1); return -EFAULT; } if (entry->is_hdr_proc_ctx) { Loading Loading @@ -1046,7 +1046,7 @@ int ipa3_reset_hdr(void) if (ipa3_id_find(ctx_entry->id) == NULL) { mutex_unlock(&ipa3_ctx->lock); WARN_ON(1); WARN_ON_RATELIMIT_IPA(1); return -EFAULT; } list_del(&ctx_entry->link); Loading drivers/platform/msm/ipa/ipa_v3/ipa_i.h +1 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ #define IPAERR_RL(fmt, args...) \ do { \ pr_err_ratelimited(DRV_NAME " %s:%d " fmt, __func__,\ pr_err_ratelimited_ipa(DRV_NAME " %s:%d " fmt, __func__,\ __LINE__, ## args);\ if (ipa3_ctx) { \ IPA_IPC_LOGGING(ipa3_ctx->logbuf, \ Loading drivers/platform/msm/ipa/ipa_v3/ipa_intf.c +1 −1 Original line number Diff line number Diff line Loading @@ -221,7 +221,7 @@ int ipa3_query_intf(struct ipa_ioc_query_intf *lookup) int result = -EINVAL; if (lookup == NULL) { IPAERR("invalid param lookup=%p\n", lookup); IPAERR_RL("invalid param lookup=%p\n", lookup); return result; } Loading Loading
drivers/platform/msm/ipa/ipa_common_i.h +37 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,10 @@ #include <linux/ipa.h> #include <linux/ipa_uc_offload.h> #include <linux/ipa_wdi3.h> #include <linux/ratelimit.h> #define WARNON_RATELIMIT_BURST 1 #define IPA_RATELIMIT_BURST 1 #define __FILENAME__ \ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) Loading Loading @@ -104,6 +108,39 @@ ipa_dec_client_disable_clks(&log_info); \ } while (0) /* * Printing one warning message in 5 seconds if multiple warning messages * are coming back to back. */ #define WARN_ON_RATELIMIT_IPA(condition) \ ({ \ static DEFINE_RATELIMIT_STATE(_rs, \ DEFAULT_RATELIMIT_INTERVAL, \ WARNON_RATELIMIT_BURST); \ int rtn = !!(condition); \ \ if (unlikely(rtn && __ratelimit(&_rs))) \ WARN_ON(rtn); \ }) /* * Printing one error message in 5 seconds if multiple error messages * are coming back to back. */ #define pr_err_ratelimited_ipa(fmt, ...) \ printk_ratelimited_ipa(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) #define printk_ratelimited_ipa(fmt, ...) \ ({ \ static DEFINE_RATELIMIT_STATE(_rs, \ DEFAULT_RATELIMIT_INTERVAL, \ IPA_RATELIMIT_BURST); \ \ if (__ratelimit(&_rs)) \ printk(fmt, ##__VA_ARGS__); \ }) #define ipa_assert_on(condition)\ do {\ if (unlikely(condition))\ Loading
drivers/platform/msm/ipa/ipa_v3/ipa_flt.c +17 −17 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ static int ipa3_generate_flt_hw_rule(enum ipa_ip_type ip, res = ipahal_flt_generate_hw_rule(&gen_params, &entry->hw_len, buf); if (res) IPAERR("failed to generate flt h/w rule\n"); IPAERR_RL("failed to generate flt h/w rule\n"); return 0; } Loading Loading @@ -311,7 +311,7 @@ static int ipa_generate_flt_hw_tbl_img(enum ipa_ip_type ip, } if (ipahal_fltrt_allocate_hw_tbl_imgs(alloc_params)) { IPAERR("fail to allocate FLT HW TBL images. IP %d\n", ip); IPAERR_RL("fail to allocate FLT HW TBL images. IP %d\n", ip); rc = -ENOMEM; goto allocate_failed; } Loading @@ -319,14 +319,14 @@ static int ipa_generate_flt_hw_tbl_img(enum ipa_ip_type ip, if (ipa_translate_flt_tbl_to_hw_fmt(ip, IPA_RULE_HASHABLE, alloc_params->hash_bdy.base, alloc_params->hash_hdr.base, hash_bdy_start_ofst)) { IPAERR("fail to translate hashable flt tbls to hw format\n"); IPAERR_RL("fail to translate hashable flt tbls to hw format\n"); rc = -EPERM; goto translate_fail; } if (ipa_translate_flt_tbl_to_hw_fmt(ip, IPA_RULE_NON_HASHABLE, alloc_params->nhash_bdy.base, alloc_params->nhash_hdr.base, nhash_bdy_start_ofst)) { IPAERR("fail to translate non-hash flt tbls to hw format\n"); IPAERR_RL("fail to translate non-hash flt tbls to hw format\n"); rc = -EPERM; goto translate_fail; } Loading Loading @@ -530,7 +530,7 @@ int __ipa_commit_flt_v3(enum ipa_ip_type ip) } if (ipa_generate_flt_hw_tbl_img(ip, &alloc_params)) { IPAERR("fail to generate FLT HW TBL image. IP %d\n", ip); IPAERR_RL("fail to generate FLT HW TBL image. IP %d\n", ip); rc = -EFAULT; goto prep_failed; } Loading Loading @@ -745,25 +745,25 @@ static int __ipa_validate_flt_rule(const struct ipa_flt_rule *rule, if (rule->action != IPA_PASS_TO_EXCEPTION) { if (!rule->eq_attrib_type) { if (!rule->rt_tbl_hdl) { IPAERR("invalid RT tbl\n"); IPAERR_RL("invalid RT tbl\n"); goto error; } *rt_tbl = ipa3_id_find(rule->rt_tbl_hdl); if (*rt_tbl == NULL) { IPAERR("RT tbl not found\n"); IPAERR_RL("RT tbl not found\n"); goto error; } if ((*rt_tbl)->cookie != IPA_RT_TBL_COOKIE) { IPAERR("RT table cookie is invalid\n"); IPAERR_RL("RT table cookie is invalid\n"); goto error; } } else { if (rule->rt_tbl_idx > ((ip == IPA_IP_v4) ? IPA_MEM_PART(v4_modem_rt_index_hi) : IPA_MEM_PART(v6_modem_rt_index_hi))) { IPAERR("invalid RT tbl\n"); IPAERR_RL("invalid RT tbl\n"); goto error; } } Loading @@ -778,12 +778,12 @@ static int __ipa_validate_flt_rule(const struct ipa_flt_rule *rule, if (rule->pdn_idx) { if (rule->action == IPA_PASS_TO_EXCEPTION || rule->action == IPA_PASS_TO_ROUTING) { IPAERR( IPAERR_RL( "PDN index should be 0 when action is not pass to NAT\n"); goto error; } else { if (rule->pdn_idx >= IPA_MAX_PDN_NUM) { IPAERR("PDN index %d is too large\n", IPAERR_RL("PDN index %d is too large\n", rule->pdn_idx); goto error; } Loading @@ -794,7 +794,7 @@ static int __ipa_validate_flt_rule(const struct ipa_flt_rule *rule, if (rule->rule_id) { if ((rule->rule_id < ipahal_get_rule_id_hi_bit()) || (rule->rule_id >= ((ipahal_get_rule_id_hi_bit()<<1)-1))) { IPAERR("invalid rule_id provided 0x%x\n" IPAERR_RL("invalid rule_id provided 0x%x\n" "rule_id with bit 0x%x are auto generated\n", rule->rule_id, ipahal_get_rule_id_hi_bit()); goto error; Loading Loading @@ -828,8 +828,8 @@ static int __ipa_create_flt_entry(struct ipa3_flt_entry **entry, } else { id = ipa3_alloc_rule_id(tbl->rule_ids); if (id < 0) { IPAERR("failed to allocate rule id\n"); WARN_ON(1); IPAERR_RL("failed to allocate rule id\n"); WARN_ON_RATELIMIT_IPA(1); goto rule_id_fail; } } Loading @@ -853,8 +853,8 @@ static int __ipa_finish_flt_rule_add(struct ipa3_flt_tbl *tbl, entry->rt_tbl->ref_cnt++; id = ipa3_id_alloc(entry); if (id < 0) { IPAERR("failed to add to tree\n"); WARN_ON(1); IPAERR_RL("failed to add to tree\n"); WARN_ON_RATELIMIT_IPA(1); goto ipa_insert_failed; } *rule_hdl = id; Loading Loading @@ -1399,7 +1399,7 @@ int ipa3_reset_flt(enum ipa_ip_type ip) list_for_each_entry_safe(entry, next, &tbl->head_flt_rule_list, link) { if (ipa3_id_find(entry->id) == NULL) { WARN_ON(1); WARN_ON_RATELIMIT_IPA(1); mutex_unlock(&ipa3_ctx->lock); return -EFAULT; } Loading
drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c +9 −9 Original line number Diff line number Diff line Loading @@ -343,7 +343,7 @@ static int __ipa_add_hdr_proc_ctx(struct ipa_hdr_proc_ctx_add *proc_ctx, } if (hdr_entry->cookie != IPA_HDR_COOKIE) { IPAERR_RL("Invalid header cookie %u\n", hdr_entry->cookie); WARN_ON(1); WARN_ON_RATELIMIT_IPA(1); return -EINVAL; } IPADBG("Associated header is name=%s is_hdr_proc_ctx=%d\n", Loading Loading @@ -373,7 +373,7 @@ static int __ipa_add_hdr_proc_ctx(struct ipa_hdr_proc_ctx_add *proc_ctx, bin = IPA_HDR_PROC_CTX_BIN1; } else { IPAERR_RL("unexpected needed len %d\n", needed_len); WARN_ON(1); WARN_ON_RATELIMIT_IPA(1); goto bad_len; } Loading Loading @@ -418,8 +418,8 @@ static int __ipa_add_hdr_proc_ctx(struct ipa_hdr_proc_ctx_add *proc_ctx, id = ipa3_id_alloc(entry); if (id < 0) { IPAERR("failed to alloc id\n"); WARN_ON(1); IPAERR_RL("failed to alloc id\n"); WARN_ON_RATELIMIT_IPA(1); goto ipa_insert_failed; } entry->id = id; Loading Loading @@ -555,8 +555,8 @@ static int __ipa_add_hdr(struct ipa_hdr_add *hdr) id = ipa3_id_alloc(entry); if (id < 0) { IPAERR("failed to alloc id\n"); WARN_ON(1); IPAERR_RL("failed to alloc id\n"); WARN_ON_RATELIMIT_IPA(1); goto ipa_insert_failed; } entry->id = id; Loading Loading @@ -984,7 +984,7 @@ int ipa3_reset_hdr(void) if (entry->is_hdr_proc_ctx) { IPAERR("default header is proc ctx\n"); mutex_unlock(&ipa3_ctx->lock); WARN_ON(1); WARN_ON_RATELIMIT_IPA(1); return -EFAULT; } continue; Loading @@ -992,7 +992,7 @@ int ipa3_reset_hdr(void) if (ipa3_id_find(entry->id) == NULL) { mutex_unlock(&ipa3_ctx->lock); WARN_ON(1); WARN_ON_RATELIMIT_IPA(1); return -EFAULT; } if (entry->is_hdr_proc_ctx) { Loading Loading @@ -1046,7 +1046,7 @@ int ipa3_reset_hdr(void) if (ipa3_id_find(ctx_entry->id) == NULL) { mutex_unlock(&ipa3_ctx->lock); WARN_ON(1); WARN_ON_RATELIMIT_IPA(1); return -EFAULT; } list_del(&ctx_entry->link); Loading
drivers/platform/msm/ipa/ipa_v3/ipa_i.h +1 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ #define IPAERR_RL(fmt, args...) \ do { \ pr_err_ratelimited(DRV_NAME " %s:%d " fmt, __func__,\ pr_err_ratelimited_ipa(DRV_NAME " %s:%d " fmt, __func__,\ __LINE__, ## args);\ if (ipa3_ctx) { \ IPA_IPC_LOGGING(ipa3_ctx->logbuf, \ Loading
drivers/platform/msm/ipa/ipa_v3/ipa_intf.c +1 −1 Original line number Diff line number Diff line Loading @@ -221,7 +221,7 @@ int ipa3_query_intf(struct ipa_ioc_query_intf *lookup) int result = -EINVAL; if (lookup == NULL) { IPAERR("invalid param lookup=%p\n", lookup); IPAERR_RL("invalid param lookup=%p\n", lookup); return result; } Loading