diff options
author | Joe Perches <joe@perches.com> | 2013-04-15 11:17:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-16 16:34:08 -0400 |
commit | d5d427cdaeae33752fbd5c674cc52a8f8e65a550 (patch) | |
tree | 6de1eea4376eb223e3482caa82e83e8c16cf1a02 /net/core/neighbour.c | |
parent | 057dad6fcb89aa829bdf1f66b282a75defbf6761 (diff) |
neighbour: Convert NEIGH_PRINTK to neigh_dbg
Update debugging messages to a more current style.
Emit these debugging messages at KERN_DEBUG instead
of KERN_DEFAULT.
Add and use neigh_dbg(level, fmt, ...) macro
Add dynamic_debug capability via pr_debug
Convert embedded function names to "%s: ", __func__
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/neighbour.c')
-rw-r--r-- | net/core/neighbour.c | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index c72a646d9f44..89a3a07d85fb 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -39,21 +39,13 @@ | |||
39 | #include <linux/string.h> | 39 | #include <linux/string.h> |
40 | #include <linux/log2.h> | 40 | #include <linux/log2.h> |
41 | 41 | ||
42 | #define DEBUG | ||
42 | #define NEIGH_DEBUG 1 | 43 | #define NEIGH_DEBUG 1 |
43 | 44 | #define neigh_dbg(level, fmt, ...) \ | |
44 | #define NEIGH_PRINTK(x...) printk(x) | 45 | do { \ |
45 | #define NEIGH_NOPRINTK(x...) do { ; } while(0) | 46 | if (level <= NEIGH_DEBUG) \ |
46 | #define NEIGH_PRINTK1 NEIGH_NOPRINTK | 47 | pr_debug(fmt, ##__VA_ARGS__); \ |
47 | #define NEIGH_PRINTK2 NEIGH_NOPRINTK | 48 | } while (0) |
48 | |||
49 | #if NEIGH_DEBUG >= 1 | ||
50 | #undef NEIGH_PRINTK1 | ||
51 | #define NEIGH_PRINTK1 NEIGH_PRINTK | ||
52 | #endif | ||
53 | #if NEIGH_DEBUG >= 2 | ||
54 | #undef NEIGH_PRINTK2 | ||
55 | #define NEIGH_PRINTK2 NEIGH_PRINTK | ||
56 | #endif | ||
57 | 49 | ||
58 | #define PNEIGH_HASHMASK 0xF | 50 | #define PNEIGH_HASHMASK 0xF |
59 | 51 | ||
@@ -246,7 +238,7 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev) | |||
246 | n->nud_state = NUD_NOARP; | 238 | n->nud_state = NUD_NOARP; |
247 | else | 239 | else |
248 | n->nud_state = NUD_NONE; | 240 | n->nud_state = NUD_NONE; |
249 | NEIGH_PRINTK2("neigh %p is stray.\n", n); | 241 | neigh_dbg(2, "neigh %p is stray\n", n); |
250 | } | 242 | } |
251 | write_unlock(&n->lock); | 243 | write_unlock(&n->lock); |
252 | neigh_cleanup_and_release(n); | 244 | neigh_cleanup_and_release(n); |
@@ -542,7 +534,7 @@ struct neighbour *__neigh_create(struct neigh_table *tbl, const void *pkey, | |||
542 | lockdep_is_held(&tbl->lock))); | 534 | lockdep_is_held(&tbl->lock))); |
543 | rcu_assign_pointer(nht->hash_buckets[hash_val], n); | 535 | rcu_assign_pointer(nht->hash_buckets[hash_val], n); |
544 | write_unlock_bh(&tbl->lock); | 536 | write_unlock_bh(&tbl->lock); |
545 | NEIGH_PRINTK2("neigh %p is created.\n", n); | 537 | neigh_dbg(2, "neigh %p is created\n", n); |
546 | rc = n; | 538 | rc = n; |
547 | out: | 539 | out: |
548 | return rc; | 540 | return rc; |
@@ -725,7 +717,7 @@ void neigh_destroy(struct neighbour *neigh) | |||
725 | dev_put(dev); | 717 | dev_put(dev); |
726 | neigh_parms_put(neigh->parms); | 718 | neigh_parms_put(neigh->parms); |
727 | 719 | ||
728 | NEIGH_PRINTK2("neigh %p is destroyed.\n", neigh); | 720 | neigh_dbg(2, "neigh %p is destroyed\n", neigh); |
729 | 721 | ||
730 | atomic_dec(&neigh->tbl->entries); | 722 | atomic_dec(&neigh->tbl->entries); |
731 | kfree_rcu(neigh, rcu); | 723 | kfree_rcu(neigh, rcu); |
@@ -739,7 +731,7 @@ EXPORT_SYMBOL(neigh_destroy); | |||
739 | */ | 731 | */ |
740 | static void neigh_suspect(struct neighbour *neigh) | 732 | static void neigh_suspect(struct neighbour *neigh) |
741 | { | 733 | { |
742 | NEIGH_PRINTK2("neigh %p is suspected.\n", neigh); | 734 | neigh_dbg(2, "neigh %p is suspected\n", neigh); |
743 | 735 | ||
744 | neigh->output = neigh->ops->output; | 736 | neigh->output = neigh->ops->output; |
745 | } | 737 | } |
@@ -751,7 +743,7 @@ static void neigh_suspect(struct neighbour *neigh) | |||
751 | */ | 743 | */ |
752 | static void neigh_connect(struct neighbour *neigh) | 744 | static void neigh_connect(struct neighbour *neigh) |
753 | { | 745 | { |
754 | NEIGH_PRINTK2("neigh %p is connected.\n", neigh); | 746 | neigh_dbg(2, "neigh %p is connected\n", neigh); |
755 | 747 | ||
756 | neigh->output = neigh->ops->connected_output; | 748 | neigh->output = neigh->ops->connected_output; |
757 | } | 749 | } |
@@ -852,7 +844,7 @@ static void neigh_invalidate(struct neighbour *neigh) | |||
852 | struct sk_buff *skb; | 844 | struct sk_buff *skb; |
853 | 845 | ||
854 | NEIGH_CACHE_STAT_INC(neigh->tbl, res_failed); | 846 | NEIGH_CACHE_STAT_INC(neigh->tbl, res_failed); |
855 | NEIGH_PRINTK2("neigh %p is failed.\n", neigh); | 847 | neigh_dbg(2, "neigh %p is failed\n", neigh); |
856 | neigh->updated = jiffies; | 848 | neigh->updated = jiffies; |
857 | 849 | ||
858 | /* It is very thin place. report_unreachable is very complicated | 850 | /* It is very thin place. report_unreachable is very complicated |
@@ -904,17 +896,17 @@ static void neigh_timer_handler(unsigned long arg) | |||
904 | if (state & NUD_REACHABLE) { | 896 | if (state & NUD_REACHABLE) { |
905 | if (time_before_eq(now, | 897 | if (time_before_eq(now, |
906 | neigh->confirmed + neigh->parms->reachable_time)) { | 898 | neigh->confirmed + neigh->parms->reachable_time)) { |
907 | NEIGH_PRINTK2("neigh %p is still alive.\n", neigh); | 899 | neigh_dbg(2, "neigh %p is still alive\n", neigh); |
908 | next = neigh->confirmed + neigh->parms->reachable_time; | 900 | next = neigh->confirmed + neigh->parms->reachable_time; |
909 | } else if (time_before_eq(now, | 901 | } else if (time_before_eq(now, |
910 | neigh->used + neigh->parms->delay_probe_time)) { | 902 | neigh->used + neigh->parms->delay_probe_time)) { |
911 | NEIGH_PRINTK2("neigh %p is delayed.\n", neigh); | 903 | neigh_dbg(2, "neigh %p is delayed\n", neigh); |
912 | neigh->nud_state = NUD_DELAY; | 904 | neigh->nud_state = NUD_DELAY; |
913 | neigh->updated = jiffies; | 905 | neigh->updated = jiffies; |
914 | neigh_suspect(neigh); | 906 | neigh_suspect(neigh); |
915 | next = now + neigh->parms->delay_probe_time; | 907 | next = now + neigh->parms->delay_probe_time; |
916 | } else { | 908 | } else { |
917 | NEIGH_PRINTK2("neigh %p is suspected.\n", neigh); | 909 | neigh_dbg(2, "neigh %p is suspected\n", neigh); |
918 | neigh->nud_state = NUD_STALE; | 910 | neigh->nud_state = NUD_STALE; |
919 | neigh->updated = jiffies; | 911 | neigh->updated = jiffies; |
920 | neigh_suspect(neigh); | 912 | neigh_suspect(neigh); |
@@ -923,14 +915,14 @@ static void neigh_timer_handler(unsigned long arg) | |||
923 | } else if (state & NUD_DELAY) { | 915 | } else if (state & NUD_DELAY) { |
924 | if (time_before_eq(now, | 916 | if (time_before_eq(now, |
925 | neigh->confirmed + neigh->parms->delay_probe_time)) { | 917 | neigh->confirmed + neigh->parms->delay_probe_time)) { |
926 | NEIGH_PRINTK2("neigh %p is now reachable.\n", neigh); | 918 | neigh_dbg(2, "neigh %p is now reachable\n", neigh); |
927 | neigh->nud_state = NUD_REACHABLE; | 919 | neigh->nud_state = NUD_REACHABLE; |
928 | neigh->updated = jiffies; | 920 | neigh->updated = jiffies; |
929 | neigh_connect(neigh); | 921 | neigh_connect(neigh); |
930 | notify = 1; | 922 | notify = 1; |
931 | next = neigh->confirmed + neigh->parms->reachable_time; | 923 | next = neigh->confirmed + neigh->parms->reachable_time; |
932 | } else { | 924 | } else { |
933 | NEIGH_PRINTK2("neigh %p is probed.\n", neigh); | 925 | neigh_dbg(2, "neigh %p is probed\n", neigh); |
934 | neigh->nud_state = NUD_PROBE; | 926 | neigh->nud_state = NUD_PROBE; |
935 | neigh->updated = jiffies; | 927 | neigh->updated = jiffies; |
936 | atomic_set(&neigh->probes, 0); | 928 | atomic_set(&neigh->probes, 0); |
@@ -997,7 +989,7 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) | |||
997 | return 1; | 989 | return 1; |
998 | } | 990 | } |
999 | } else if (neigh->nud_state & NUD_STALE) { | 991 | } else if (neigh->nud_state & NUD_STALE) { |
1000 | NEIGH_PRINTK2("neigh %p is delayed.\n", neigh); | 992 | neigh_dbg(2, "neigh %p is delayed\n", neigh); |
1001 | neigh->nud_state = NUD_DELAY; | 993 | neigh->nud_state = NUD_DELAY; |
1002 | neigh->updated = jiffies; | 994 | neigh->updated = jiffies; |
1003 | neigh_add_timer(neigh, | 995 | neigh_add_timer(neigh, |
@@ -1320,8 +1312,7 @@ int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb) | |||
1320 | out: | 1312 | out: |
1321 | return rc; | 1313 | return rc; |
1322 | discard: | 1314 | discard: |
1323 | NEIGH_PRINTK1("neigh_resolve_output: dst=%p neigh=%p\n", | 1315 | neigh_dbg(1, "%s: dst=%p neigh=%p\n", __func__, dst, neigh); |
1324 | dst, neigh); | ||
1325 | out_kfree_skb: | 1316 | out_kfree_skb: |
1326 | rc = -EINVAL; | 1317 | rc = -EINVAL; |
1327 | kfree_skb(skb); | 1318 | kfree_skb(skb); |
@@ -1498,7 +1489,7 @@ void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms) | |||
1498 | } | 1489 | } |
1499 | } | 1490 | } |
1500 | write_unlock_bh(&tbl->lock); | 1491 | write_unlock_bh(&tbl->lock); |
1501 | NEIGH_PRINTK1("neigh_parms_release: not found\n"); | 1492 | neigh_dbg(1, "%s: not found\n", __func__); |
1502 | } | 1493 | } |
1503 | EXPORT_SYMBOL(neigh_parms_release); | 1494 | EXPORT_SYMBOL(neigh_parms_release); |
1504 | 1495 | ||