diff options
-rw-r--r-- | drivers/isdn/gigaset/capi.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c index 343b5c80cb7b..292ca2fc852c 100644 --- a/drivers/isdn/gigaset/capi.c +++ b/drivers/isdn/gigaset/capi.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include "gigaset.h" | 14 | #include "gigaset.h" |
15 | #include <linux/proc_fs.h> | 15 | #include <linux/proc_fs.h> |
16 | #include <linux/seq_file.h> | 16 | #include <linux/seq_file.h> |
17 | #include <linux/ratelimit.h> | ||
17 | #include <linux/isdn/capilli.h> | 18 | #include <linux/isdn/capilli.h> |
18 | #include <linux/isdn/capicmd.h> | 19 | #include <linux/isdn/capicmd.h> |
19 | #include <linux/isdn/capiutil.h> | 20 | #include <linux/isdn/capiutil.h> |
@@ -223,10 +224,14 @@ get_appl(struct gigaset_capi_ctr *iif, u16 appl) | |||
223 | static inline void dump_cmsg(enum debuglevel level, const char *tag, _cmsg *p) | 224 | static inline void dump_cmsg(enum debuglevel level, const char *tag, _cmsg *p) |
224 | { | 225 | { |
225 | #ifdef CONFIG_GIGASET_DEBUG | 226 | #ifdef CONFIG_GIGASET_DEBUG |
227 | /* dump at most 20 messages in 20 secs */ | ||
228 | static DEFINE_RATELIMIT_STATE(msg_dump_ratelimit, 20 * HZ, 20); | ||
226 | _cdebbuf *cdb; | 229 | _cdebbuf *cdb; |
227 | 230 | ||
228 | if (!(gigaset_debuglevel & level)) | 231 | if (!(gigaset_debuglevel & level)) |
229 | return; | 232 | return; |
233 | if (!___ratelimit(&msg_dump_ratelimit, tag)) | ||
234 | return; | ||
230 | 235 | ||
231 | cdb = capi_cmsg2str(p); | 236 | cdb = capi_cmsg2str(p); |
232 | if (cdb) { | 237 | if (cdb) { |
@@ -2059,12 +2064,6 @@ static void do_reset_b3_req(struct gigaset_capi_ctr *iif, | |||
2059 | } | 2064 | } |
2060 | 2065 | ||
2061 | /* | 2066 | /* |
2062 | * dump unsupported/ignored messages at most twice per minute, | ||
2063 | * some apps send those very frequently | ||
2064 | */ | ||
2065 | static unsigned long ignored_msg_dump_time; | ||
2066 | |||
2067 | /* | ||
2068 | * unsupported CAPI message handler | 2067 | * unsupported CAPI message handler |
2069 | */ | 2068 | */ |
2070 | static void do_unsupported(struct gigaset_capi_ctr *iif, | 2069 | static void do_unsupported(struct gigaset_capi_ctr *iif, |
@@ -2073,8 +2072,7 @@ static void do_unsupported(struct gigaset_capi_ctr *iif, | |||
2073 | { | 2072 | { |
2074 | /* decode message */ | 2073 | /* decode message */ |
2075 | capi_message2cmsg(&iif->acmsg, skb->data); | 2074 | capi_message2cmsg(&iif->acmsg, skb->data); |
2076 | if (printk_timed_ratelimit(&ignored_msg_dump_time, 30 * 1000)) | 2075 | dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg); |
2077 | dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg); | ||
2078 | send_conf(iif, ap, skb, CapiMessageNotSupportedInCurrentState); | 2076 | send_conf(iif, ap, skb, CapiMessageNotSupportedInCurrentState); |
2079 | } | 2077 | } |
2080 | 2078 | ||
@@ -2085,11 +2083,9 @@ static void do_nothing(struct gigaset_capi_ctr *iif, | |||
2085 | struct gigaset_capi_appl *ap, | 2083 | struct gigaset_capi_appl *ap, |
2086 | struct sk_buff *skb) | 2084 | struct sk_buff *skb) |
2087 | { | 2085 | { |
2088 | if (printk_timed_ratelimit(&ignored_msg_dump_time, 30 * 1000)) { | 2086 | /* decode message */ |
2089 | /* decode message */ | 2087 | capi_message2cmsg(&iif->acmsg, skb->data); |
2090 | capi_message2cmsg(&iif->acmsg, skb->data); | 2088 | dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg); |
2091 | dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg); | ||
2092 | } | ||
2093 | dev_kfree_skb_any(skb); | 2089 | dev_kfree_skb_any(skb); |
2094 | } | 2090 | } |
2095 | 2091 | ||