public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@meshcoding.com>
To: "André Gaul" <gaul@web-yard.de>
Cc: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [PATCH] remove unnecessary logspam
Date: Mon, 09 Jun 2014 10:54:43 +0200	[thread overview]
Message-ID: <53957653.5000406@meshcoding.com> (raw)
In-Reply-To: <1401911616-18318-1-git-send-email-gaul@web-yard.de>

[-- Attachment #1: Type: text/plain, Size: 2893 bytes --]

Hi André,

On 04/06/14 21:53, André Gaul wrote:
> 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.

good catch!

> -#define batadv_dbg(type, bat_priv, fmt, arg...)			\
> +/* possibly ratelimited debug output */
> +#define _batadv_dbg(type, bat_priv, ratelimited, fmt, arg...)			\

can you please put the ending "\" at the same position of the ones below
? (This way the entire macro definition looks better).

>  	do {							\
> -		if (atomic_read(&bat_priv->log_level) & type)	\
> +		if (atomic_read(&bat_priv->log_level) & type && \
> +		    (!ratelimited || net_ratelimit()))	\

same here

>  			batadv_debug_log(bat_priv, fmt, ## arg);\
>  	}							\
>  	while (0)
>  #else /* !CONFIG_BATMAN_ADV_DEBUG */
> -__printf(3, 4)
> -static inline void batadv_dbg(int type __always_unused,
> +__printf(4, 5)
> +static inline void _batadv_dbg(int type __always_unused,
>  			      struct batadv_priv *bat_priv __always_unused,
> +			      int ratelimited __always_unused,
>  			      const char *fmt __always_unused, ...)
>  {
>  }
>  #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...)				\
>  	do {								\
>  		struct net_device *_netdev = (net_dev);                 \
> diff --git a/routing.c b/routing.c
> index 3514153..c679c6f 100644
> --- a/routing.c
> +++ b/routing.c
> @@ -706,7 +706,7 @@ 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_reroute_unicast_packet(bat_priv, unicast_packet,
>  						  ethhdr->h_dest, vid))
> -			net_ratelimited_function(batadv_dbg, BATADV_DBG_TT,
> +			batadv_dbg_ratelimited(BATADV_DBG_TT,
>  						 bat_priv,
>  						 "Rerouting unicast packet to %pM (dst=%pM): Local Roaming\n",
>  						 unicast_packet->dest,

The arguments on a new line must be lined up to the first column after
the opening parenthesis. (I think that checkpatch would have suggested
the same)

> @@ -752,7 +752,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
>  	 */
>  	if (batadv_reroute_unicast_packet(bat_priv, unicast_packet,
>  					  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",
>  					 unicast_packet->dest, ethhdr->h_dest,
>  					 old_ttvn, curr_ttvn);

same here.


The rest looks good!



-- 
Antonio Quartulli


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

  reply	other threads:[~2014-06-09  8:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-04 19:53 [B.A.T.M.A.N.] [PATCH] remove unnecessary logspam André Gaul
2014-06-09  8:54 ` Antonio Quartulli [this message]
2014-06-09 17:14   ` André Gaul
2014-06-09 21:05     ` Antonio Quartulli
2014-06-09 21:36       ` André Gaul
2014-06-10  6:01         ` Antonio Quartulli
2014-06-10 15:38           ` André Gaul
2014-06-10 15:40             ` Antonio Quartulli
2014-06-10 15:45               ` André Gaul
2014-06-11  6:04                 ` Antonio Quartulli
2014-06-14  1:44                 ` Marek Lindner
2014-06-15 12:32                   ` André Gaul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53957653.5000406@meshcoding.com \
    --to=antonio@meshcoding.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=gaul@web-yard.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox