diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2006-11-20 15:26:03 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:24:35 -0500 |
commit | 84116716cc9404356f775443b460f76766f08f65 (patch) | |
tree | 627662e0ac97542de873ed2071561ba2c2f0ba8e /net/dccp | |
parent | f123bc5f800d528e59684c7faffda88b4dd2d38c (diff) |
[DCCP]: enable debug messages also for static builds
This patch
* makes debugging (when configured) work both for static / module build
* provides generic debugging macros for use in other DCCP / CCID modules
* adds missing information about debug parameters to Kconfig
* performs some code tidy-up
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/Kconfig | 3 | ||||
-rw-r--r-- | net/dccp/ackvec.c | 11 | ||||
-rw-r--r-- | net/dccp/ccids/Kconfig | 14 | ||||
-rw-r--r-- | net/dccp/ccids/ccid2.c | 16 | ||||
-rw-r--r-- | net/dccp/dccp.h | 19 |
5 files changed, 37 insertions, 26 deletions
diff --git a/net/dccp/Kconfig b/net/dccp/Kconfig index 2fc5e55d2a8d..b8a68dd41000 100644 --- a/net/dccp/Kconfig +++ b/net/dccp/Kconfig | |||
@@ -38,6 +38,9 @@ config IP_DCCP_DEBUG | |||
38 | ---help--- | 38 | ---help--- |
39 | Only use this if you're hacking DCCP. | 39 | Only use this if you're hacking DCCP. |
40 | 40 | ||
41 | When compiling DCCP as a module, this debugging output can be toggled | ||
42 | by setting the parameter dccp_debug of the `dccp' module to 0 or 1. | ||
43 | |||
41 | Just say N. | 44 | Just say N. |
42 | 45 | ||
43 | config NET_DCCPPROBE | 46 | config NET_DCCPPROBE |
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c index bd20a2c55e25..d34badcd012e 100644 --- a/net/dccp/ackvec.c +++ b/net/dccp/ackvec.c | |||
@@ -318,21 +318,18 @@ out_duplicate: | |||
318 | #ifdef CONFIG_IP_DCCP_DEBUG | 318 | #ifdef CONFIG_IP_DCCP_DEBUG |
319 | void dccp_ackvector_print(const u64 ackno, const unsigned char *vector, int len) | 319 | void dccp_ackvector_print(const u64 ackno, const unsigned char *vector, int len) |
320 | { | 320 | { |
321 | if (!dccp_debug) | 321 | dccp_pr_debug_cat("ACK vector len=%d, ackno=%llu |", len, |
322 | return; | 322 | (unsigned long long)ackno); |
323 | |||
324 | printk("ACK vector len=%d, ackno=%llu |", len, | ||
325 | (unsigned long long)ackno); | ||
326 | 323 | ||
327 | while (len--) { | 324 | while (len--) { |
328 | const u8 state = (*vector & DCCP_ACKVEC_STATE_MASK) >> 6; | 325 | const u8 state = (*vector & DCCP_ACKVEC_STATE_MASK) >> 6; |
329 | const u8 rl = *vector & DCCP_ACKVEC_LEN_MASK; | 326 | const u8 rl = *vector & DCCP_ACKVEC_LEN_MASK; |
330 | 327 | ||
331 | printk("%d,%d|", state, rl); | 328 | dccp_pr_debug_cat("%d,%d|", state, rl); |
332 | ++vector; | 329 | ++vector; |
333 | } | 330 | } |
334 | 331 | ||
335 | printk("\n"); | 332 | dccp_pr_debug_cat("\n"); |
336 | } | 333 | } |
337 | 334 | ||
338 | void dccp_ackvec_print(const struct dccp_ackvec *av) | 335 | void dccp_ackvec_print(const struct dccp_ackvec *av) |
diff --git a/net/dccp/ccids/Kconfig b/net/dccp/ccids/Kconfig index 8533dabfb9f8..ba826d99ed03 100644 --- a/net/dccp/ccids/Kconfig +++ b/net/dccp/ccids/Kconfig | |||
@@ -28,13 +28,20 @@ config IP_DCCP_CCID2 | |||
28 | This text was extracted from RFC 4340 (sec. 10.1), | 28 | This text was extracted from RFC 4340 (sec. 10.1), |
29 | http://www.ietf.org/rfc/rfc4340.txt | 29 | http://www.ietf.org/rfc/rfc4340.txt |
30 | 30 | ||
31 | To compile this CCID as a module, choose M here: the module will be | ||
32 | called dccp_ccid2. | ||
33 | |||
31 | If in doubt, say M. | 34 | If in doubt, say M. |
32 | 35 | ||
33 | config IP_DCCP_CCID2_DEBUG | 36 | config IP_DCCP_CCID2_DEBUG |
34 | bool "CCID2 debug" | 37 | bool "CCID2 debugging messages" |
35 | depends on IP_DCCP_CCID2 | 38 | depends on IP_DCCP_CCID2 |
36 | ---help--- | 39 | ---help--- |
37 | Enable CCID2 debug messages. | 40 | Enable CCID2-specific debugging messages. |
41 | |||
42 | When compiling CCID2 as a module, this debugging output can | ||
43 | additionally be toggled by setting the ccid2_debug module | ||
44 | parameter to 0 or 1. | ||
38 | 45 | ||
39 | If in doubt, say N. | 46 | If in doubt, say N. |
40 | 47 | ||
@@ -62,6 +69,9 @@ config IP_DCCP_CCID3 | |||
62 | This text was extracted from RFC 4340 (sec. 10.2), | 69 | This text was extracted from RFC 4340 (sec. 10.2), |
63 | http://www.ietf.org/rfc/rfc4340.txt | 70 | http://www.ietf.org/rfc/rfc4340.txt |
64 | 71 | ||
72 | To compile this CCID as a module, choose M here: the module will be | ||
73 | called dccp_ccid3. | ||
74 | |||
65 | If in doubt, say M. | 75 | If in doubt, say M. |
66 | 76 | ||
67 | config IP_DCCP_TFRC_LIB | 77 | config IP_DCCP_TFRC_LIB |
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c index 6533cb2f27bb..0fb0d66544a2 100644 --- a/net/dccp/ccids/ccid2.c +++ b/net/dccp/ccids/ccid2.c | |||
@@ -33,18 +33,11 @@ | |||
33 | #include "../dccp.h" | 33 | #include "../dccp.h" |
34 | #include "ccid2.h" | 34 | #include "ccid2.h" |
35 | 35 | ||
36 | static int ccid2_debug; | ||
37 | 36 | ||
38 | #ifdef CONFIG_IP_DCCP_CCID2_DEBUG | 37 | #ifdef CONFIG_IP_DCCP_CCID2_DEBUG |
39 | #define ccid2_pr_debug(format, a...) \ | 38 | static int ccid2_debug; |
40 | do { if (ccid2_debug) \ | 39 | #define ccid2_pr_debug(format, a...) DCCP_PR_DEBUG(ccid2_debug, format, ##a) |
41 | printk(KERN_DEBUG "%s: " format, __FUNCTION__, ##a); \ | ||
42 | } while (0) | ||
43 | #else | ||
44 | #define ccid2_pr_debug(format, a...) | ||
45 | #endif | ||
46 | 40 | ||
47 | #ifdef CONFIG_IP_DCCP_CCID2_DEBUG | ||
48 | static void ccid2_hc_tx_check_sanity(const struct ccid2_hc_tx_sock *hctx) | 41 | static void ccid2_hc_tx_check_sanity(const struct ccid2_hc_tx_sock *hctx) |
49 | { | 42 | { |
50 | int len = 0; | 43 | int len = 0; |
@@ -86,7 +79,8 @@ static void ccid2_hc_tx_check_sanity(const struct ccid2_hc_tx_sock *hctx) | |||
86 | BUG_ON(len != hctx->ccid2hctx_seqbufc * CCID2_SEQBUF_LEN); | 79 | BUG_ON(len != hctx->ccid2hctx_seqbufc * CCID2_SEQBUF_LEN); |
87 | } | 80 | } |
88 | #else | 81 | #else |
89 | #define ccid2_hc_tx_check_sanity(hctx) do {} while (0) | 82 | #define ccid2_pr_debug(format, a...) |
83 | #define ccid2_hc_tx_check_sanity(hctx) | ||
90 | #endif | 84 | #endif |
91 | 85 | ||
92 | static int ccid2_hc_tx_alloc_seq(struct ccid2_hc_tx_sock *hctx, int num, | 86 | static int ccid2_hc_tx_alloc_seq(struct ccid2_hc_tx_sock *hctx, int num, |
@@ -841,8 +835,10 @@ static struct ccid_operations ccid2 = { | |||
841 | .ccid_hc_rx_packet_recv = ccid2_hc_rx_packet_recv, | 835 | .ccid_hc_rx_packet_recv = ccid2_hc_rx_packet_recv, |
842 | }; | 836 | }; |
843 | 837 | ||
838 | #ifdef CONFIG_IP_DCCP_CCID2_DEBUG | ||
844 | module_param(ccid2_debug, int, 0444); | 839 | module_param(ccid2_debug, int, 0444); |
845 | MODULE_PARM_DESC(ccid2_debug, "Enable debug messages"); | 840 | MODULE_PARM_DESC(ccid2_debug, "Enable debug messages"); |
841 | #endif | ||
846 | 842 | ||
847 | static __init int ccid2_module_init(void) | 843 | static __init int ccid2_module_init(void) |
848 | { | 844 | { |
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index ecb4e7bd1a84..33d86f53138b 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -26,15 +26,20 @@ | |||
26 | __stringify((cond))); \ | 26 | __stringify((cond))); \ |
27 | } while (0) | 27 | } while (0) |
28 | 28 | ||
29 | #ifdef MODULE | ||
30 | #define DCCP_PRINTK(enable, fmt, args...) do { if (enable) \ | ||
31 | printk(fmt, ##args); \ | ||
32 | } while(0) | ||
33 | #else | ||
34 | #define DCCP_PRINTK(enable, fmt, args...) printk(fmt, ##args) | ||
35 | #endif | ||
36 | #define DCCP_PR_DEBUG(enable, fmt, a...) DCCP_PRINTK(enable, KERN_DEBUG \ | ||
37 | "%s: " fmt, __FUNCTION__, ##a) | ||
38 | |||
29 | #ifdef CONFIG_IP_DCCP_DEBUG | 39 | #ifdef CONFIG_IP_DCCP_DEBUG |
30 | extern int dccp_debug; | 40 | extern int dccp_debug; |
31 | 41 | #define dccp_pr_debug(format, a...) DCCP_PR_DEBUG(dccp_debug, format, ##a) | |
32 | #define dccp_pr_debug(format, a...) \ | 42 | #define dccp_pr_debug_cat(format, a...) DCCP_PRINTK(dccp_debug, format, ##a) |
33 | do { if (dccp_debug) \ | ||
34 | printk(KERN_DEBUG "%s: " format, __FUNCTION__ , ##a); \ | ||
35 | } while (0) | ||
36 | #define dccp_pr_debug_cat(format, a...) do { if (dccp_debug) \ | ||
37 | printk(format, ##a); } while (0) | ||
38 | #else | 43 | #else |
39 | #define dccp_pr_debug(format, a...) | 44 | #define dccp_pr_debug(format, a...) |
40 | #define dccp_pr_debug_cat(format, a...) | 45 | #define dccp_pr_debug_cat(format, a...) |