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>
This commit is contained in:
parent
0185dda640
commit
23c4ec10f4
@ -238,21 +238,29 @@ enum batadv_dbg_level {
|
|||||||
int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...)
|
int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...)
|
||||||
__printf(2, 3);
|
__printf(2, 3);
|
||||||
|
|
||||||
#define batadv_dbg(type, bat_priv, fmt, arg...) \
|
/* possibly ratelimited debug output */
|
||||||
|
#define _batadv_dbg(type, bat_priv, ratelimited, fmt, arg...) \
|
||||||
do { \
|
do { \
|
||||||
if (atomic_read(&bat_priv->log_level) & type) \
|
if (atomic_read(&bat_priv->log_level) & type && \
|
||||||
|
(!ratelimited || net_ratelimit())) \
|
||||||
batadv_debug_log(bat_priv, fmt, ## arg);\
|
batadv_debug_log(bat_priv, fmt, ## arg);\
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
#else /* !CONFIG_BATMAN_ADV_DEBUG */
|
#else /* !CONFIG_BATMAN_ADV_DEBUG */
|
||||||
__printf(3, 4)
|
__printf(4, 5)
|
||||||
static inline void batadv_dbg(int type __always_unused,
|
static inline void _batadv_dbg(int type __always_unused,
|
||||||
struct batadv_priv *bat_priv __always_unused,
|
struct batadv_priv *bat_priv __always_unused,
|
||||||
const char *fmt __always_unused, ...)
|
int ratelimited __always_unused,
|
||||||
|
const char *fmt __always_unused, ...)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define batadv_dbg(type, bat_priv, arg...) \
|
||||||
|
_batadv_dbg(type, bat_priv, 0, ## arg)
|
||||||
|
#define batadv_dbg_ratelimited(type, bat_priv, arg...) \
|
||||||
|
_batadv_dbg(type, bat_priv, 1, ## arg)
|
||||||
|
|
||||||
#define batadv_info(net_dev, fmt, arg...) \
|
#define batadv_info(net_dev, fmt, arg...) \
|
||||||
do { \
|
do { \
|
||||||
struct net_device *_netdev = (net_dev); \
|
struct net_device *_netdev = (net_dev); \
|
||||||
|
@ -706,11 +706,11 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
|
|||||||
if (batadv_tt_local_client_is_roaming(bat_priv, ethhdr->h_dest, vid)) {
|
if (batadv_tt_local_client_is_roaming(bat_priv, ethhdr->h_dest, vid)) {
|
||||||
if (batadv_reroute_unicast_packet(bat_priv, unicast_packet,
|
if (batadv_reroute_unicast_packet(bat_priv, unicast_packet,
|
||||||
ethhdr->h_dest, vid))
|
ethhdr->h_dest, vid))
|
||||||
net_ratelimited_function(batadv_dbg, BATADV_DBG_TT,
|
batadv_dbg_ratelimited(BATADV_DBG_TT,
|
||||||
bat_priv,
|
bat_priv,
|
||||||
"Rerouting unicast packet to %pM (dst=%pM): Local Roaming\n",
|
"Rerouting unicast packet to %pM (dst=%pM): Local Roaming\n",
|
||||||
unicast_packet->dest,
|
unicast_packet->dest,
|
||||||
ethhdr->h_dest);
|
ethhdr->h_dest);
|
||||||
/* at this point the mesh destination should have been
|
/* at this point the mesh destination should have been
|
||||||
* substituted with the originator address found in the global
|
* substituted with the originator address found in the global
|
||||||
* table. If not, let the packet go untouched anyway because
|
* 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,
|
|||||||
*/
|
*/
|
||||||
if (batadv_reroute_unicast_packet(bat_priv, unicast_packet,
|
if (batadv_reroute_unicast_packet(bat_priv, unicast_packet,
|
||||||
ethhdr->h_dest, vid)) {
|
ethhdr->h_dest, vid)) {
|
||||||
net_ratelimited_function(batadv_dbg, BATADV_DBG_TT, bat_priv,
|
batadv_dbg_ratelimited(BATADV_DBG_TT, bat_priv,
|
||||||
"Rerouting unicast packet to %pM (dst=%pM): TTVN mismatch old_ttvn=%u new_ttvn=%u\n",
|
"Rerouting unicast packet to %pM (dst=%pM): TTVN mismatch old_ttvn=%u new_ttvn=%u\n",
|
||||||
unicast_packet->dest, ethhdr->h_dest,
|
unicast_packet->dest, ethhdr->h_dest,
|
||||||
old_ttvn, curr_ttvn);
|
old_ttvn, curr_ttvn);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user