* [B.A.T.M.A.N.] [PATCHv3] batman-adv: print packets re-routing on DBG_TT and ratelimit it
@ 2012-08-25 23:05 Antonio Quartulli
2012-09-02 8:37 ` Marek Lindner
0 siblings, 1 reply; 2+ messages in thread
From: Antonio Quartulli @ 2012-08-25 23:05 UTC (permalink / raw)
To: b.a.t.m.a.n
To simplify TranslationTable debugging it is better to print the packet
rerouting message on the DBG_TT log level. In this way a developer interested in
packets rerouting doesn't need to filter it out of the whole ROUTES log.
Moreover, since this message will appear for each rerouted message, it is now
"ratelimited".
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
v3:
- added net_ratelimited_function() macro to compat.h
compat.h | 10 ++++++++++
routing.c | 8 ++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/compat.h b/compat.h
index 8ac22a8..14969e0 100644
--- a/compat.h
+++ b/compat.h
@@ -149,4 +149,14 @@ static inline void eth_hw_addr_random(struct net_device *dev)
#endif /* < KERNEL_VERSION(3, 4, 0) */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0)
+
+#define net_ratelimited_function(func, ...) \
+ do { \
+ if (net_ratelimit()) \
+ func(__VA_ARGS__); \
+ } while (0)
+
+#endif /* < KERNEL_VERSION(3, 5, 0) */
+
#endif /* _NET_BATMAN_ADV_COMPAT_H_ */
diff --git a/routing.c b/routing.c
index 1c545f6..784e9cc 100644
--- a/routing.c
+++ b/routing.c
@@ -965,10 +965,10 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
batadv_orig_node_free_ref(orig_node);
}
- batadv_dbg(BATADV_DBG_ROUTES, bat_priv,
- "TTVN mismatch (old_ttvn %u new_ttvn %u)! Rerouting unicast packet (for %pM) to %pM\n",
- unicast_packet->ttvn, curr_ttvn, ethhdr->h_dest,
- unicast_packet->dest);
+ net_ratelimited_function(batadv_dbg, BATADV_DBG_TT, bat_priv,
+ "TTVN mismatch (old_ttvn %u new_ttvn %u)! Rerouting unicast packet (for %pM) to %pM\n",
+ unicast_packet->ttvn, curr_ttvn,
+ ethhdr->h_dest, unicast_packet->dest);
unicast_packet->ttvn = curr_ttvn;
}
--
1.7.12
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCHv3] batman-adv: print packets re-routing on DBG_TT and ratelimit it
2012-08-25 23:05 [B.A.T.M.A.N.] [PATCHv3] batman-adv: print packets re-routing on DBG_TT and ratelimit it Antonio Quartulli
@ 2012-09-02 8:37 ` Marek Lindner
0 siblings, 0 replies; 2+ messages in thread
From: Marek Lindner @ 2012-09-02 8:37 UTC (permalink / raw)
To: b.a.t.m.a.n
On Sunday, August 26, 2012 07:05:56 Antonio Quartulli wrote:
> To simplify TranslationTable debugging it is better to print the packet
> rerouting message on the DBG_TT log level. In this way a developer
> interested in packets rerouting doesn't need to filter it out of the whole
> ROUTES log.
>
> Moreover, since this message will appear for each rerouted message, it is
> now "ratelimited".
>
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> ---
>
> v3:
> - added net_ratelimited_function() macro to compat.h
>
> compat.h | 10 ++++++++++
> routing.c | 8 ++++----
> 2 files changed, 14 insertions(+), 4 deletions(-)
Applied in revision 3632c33.
Thanks,
Marek
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-02 8:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-25 23:05 [B.A.T.M.A.N.] [PATCHv3] batman-adv: print packets re-routing on DBG_TT and ratelimit it Antonio Quartulli
2012-09-02 8:37 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox