aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAndré Gaul <gaul@web-yard.de>2014-06-10 11:50:31 -0400
committerAntonio Quartulli <antonio@meshcoding.com>2014-08-05 03:41:54 -0400
commit23c4ec10f4ab926396b7925f13974eef58ef0cce (patch)
treeffc955e199a10fd788d0d0983602982c83ffb92b /net
parent0185dda640a704ce41ca1489c6775451c5ff3dcf (diff)
batman-adv: remove unnecessary logspam
This patch removes unnecessary logspam which resulted from superfluous calls to net_ratelimit(). With the supplied patch, net_ratelimit() is called after the loglevel has been checked. Signed-off-by: André Gaul <gaul@web-yard.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Diffstat (limited to 'net')
-rw-r--r--net/batman-adv/main.h20
-rw-r--r--net/batman-adv/routing.c18
2 files changed, 23 insertions, 15 deletions
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 118b990bae25..257840ef427c 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -238,21 +238,29 @@ enum batadv_dbg_level {
238int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...) 238int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...)
239__printf(2, 3); 239__printf(2, 3);
240 240
241#define batadv_dbg(type, bat_priv, fmt, arg...) \ 241/* possibly ratelimited debug output */
242#define _batadv_dbg(type, bat_priv, ratelimited, fmt, arg...) \
242 do { \ 243 do { \
243 if (atomic_read(&bat_priv->log_level) & type) \ 244 if (atomic_read(&bat_priv->log_level) & type && \
245 (!ratelimited || net_ratelimit())) \
244 batadv_debug_log(bat_priv, fmt, ## arg);\ 246 batadv_debug_log(bat_priv, fmt, ## arg);\
245 } \ 247 } \
246 while (0) 248 while (0)
247#else /* !CONFIG_BATMAN_ADV_DEBUG */ 249#else /* !CONFIG_BATMAN_ADV_DEBUG */
248__printf(3, 4) 250__printf(4, 5)
249static inline void batadv_dbg(int type __always_unused, 251static inline void _batadv_dbg(int type __always_unused,
250 struct batadv_priv *bat_priv __always_unused, 252 struct batadv_priv *bat_priv __always_unused,
251 const char *fmt __always_unused, ...) 253 int ratelimited __always_unused,
254 const char *fmt __always_unused, ...)
252{ 255{
253} 256}
254#endif 257#endif
255 258
259#define batadv_dbg(type, bat_priv, arg...) \
260 _batadv_dbg(type, bat_priv, 0, ## arg)
261#define batadv_dbg_ratelimited(type, bat_priv, arg...) \
262 _batadv_dbg(type, bat_priv, 1, ## arg)
263
256#define batadv_info(net_dev, fmt, arg...) \ 264#define batadv_info(net_dev, fmt, arg...) \
257 do { \ 265 do { \
258 struct net_device *_netdev = (net_dev); \ 266 struct net_device *_netdev = (net_dev); \
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 35141534938e..35f76f2f7824 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -706,11 +706,11 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
706 if (batadv_tt_local_client_is_roaming(bat_priv, ethhdr->h_dest, vid)) { 706 if (batadv_tt_local_client_is_roaming(bat_priv, ethhdr->h_dest, vid)) {
707 if (batadv_reroute_unicast_packet(bat_priv, unicast_packet, 707 if (batadv_reroute_unicast_packet(bat_priv, unicast_packet,
708 ethhdr->h_dest, vid)) 708 ethhdr->h_dest, vid))
709 net_ratelimited_function(batadv_dbg, BATADV_DBG_TT, 709 batadv_dbg_ratelimited(BATADV_DBG_TT,
710 bat_priv, 710 bat_priv,
711 "Rerouting unicast packet to %pM (dst=%pM): Local Roaming\n", 711 "Rerouting unicast packet to %pM (dst=%pM): Local Roaming\n",
712 unicast_packet->dest, 712 unicast_packet->dest,
713 ethhdr->h_dest); 713 ethhdr->h_dest);
714 /* at this point the mesh destination should have been 714 /* at this point the mesh destination should have been
715 * substituted with the originator address found in the global 715 * substituted with the originator address found in the global
716 * table. If not, let the packet go untouched anyway because 716 * table. If not, let the packet go untouched anyway because
@@ -752,10 +752,10 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
752 */ 752 */
753 if (batadv_reroute_unicast_packet(bat_priv, unicast_packet, 753 if (batadv_reroute_unicast_packet(bat_priv, unicast_packet,
754 ethhdr->h_dest, vid)) { 754 ethhdr->h_dest, vid)) {
755 net_ratelimited_function(batadv_dbg, BATADV_DBG_TT, bat_priv, 755 batadv_dbg_ratelimited(BATADV_DBG_TT, bat_priv,
756 "Rerouting unicast packet to %pM (dst=%pM): TTVN mismatch old_ttvn=%u new_ttvn=%u\n", 756 "Rerouting unicast packet to %pM (dst=%pM): TTVN mismatch old_ttvn=%u new_ttvn=%u\n",
757 unicast_packet->dest, ethhdr->h_dest, 757 unicast_packet->dest, ethhdr->h_dest,
758 old_ttvn, curr_ttvn); 758 old_ttvn, curr_ttvn);
759 return 1; 759 return 1;
760 } 760 }
761 761