pull request: batman-adv 2014-08-05
Subsystems (3)
Hello David,
this is a pull request intended for net-next/linux-3.17 (yeah..it's really late).
Patches 1, 2 and 4 are really minor changes:
- kmalloc_array is substituted to kmalloc when possible (as suggested by checkpatch);
- net_ratelimited() is now used properly and the "suppressed" message is not printed anymore if not needed;
- the internal version number has been increased to reflect our current version.
Patch 3 instead is introducing a change in the metric computation function by changing the penalty applied at each mesh hop from 15/255 (~6%) to 30/255 (~11%). This change is introduced by Simon Wunderlich after having observed a performance improvement in several networks when using the new value.
Please pull or let me know of any problem!
Thanks a lot,
Antonio
The following changes since commit e6b92c25d20c64c271ef429bba8febeefb848b5b:
cxgb4i : remove spurious use of rcu (2014-08-02 20:34:33 -0700)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batman-adv-for-davem
for you to fetch changes up to 0028c72ec4300997f2d0b73594f391983090463b:
batman-adv: Start new development cycle (2014-08-04 16:03:13 +0200)
----------------------------------------------------------------
Included changes:
- kmalloc_array instead of kmalloc when possible
- avoid log spam due to useless net_ratelimit() invocations
- increase default metric hop penalty from 15 to 30
- update internal version number
----------------------------------------------------------------
André Gaul (1):
batman-adv: remove unnecessary logspam
Antonio Quartulli (1):
batman-adv: prefer kmalloc_array to kmalloc when possible
Simon Wunderlich (2):
batman-adv: increase default hop penalty
batman-adv: Start new development cycle
net/batman-adv/bat_iv_ogm.c | 13 +++++++------ net/batman-adv/distributed-arp-table.c | 3 ++- net/batman-adv/hash.c | 6 +++--- net/batman-adv/main.h | 22 +++++++++++++++------- net/batman-adv/routing.c | 18 +++++++++--------- net/batman-adv/soft-interface.c | 2 +- 6 files changed, 37 insertions(+), 27 deletions(-)
PATCH 1/4 batman-adv: prefer kmalloc_array to kmalloc when possible
Reported by checkpatch with the following warning:
WARNING: Prefer kmalloc_array over kmalloc with multiply
--- net/batman-adv/bat_iv_ogm.c | 13 +++++++------ net/batman-adv/distributed-arp-table.c | 3 ++- net/batman-adv/hash.c | 6 +++--- 3 files changed, 12 insertions(+), 10 deletions(-)
net/batman-adv/bat_iv_ogm.c +7 -6
@@ -108,14 +108,15 @@ static int batadv_iv_ogm_orig_add_if(struct batadv_orig_node *orig_node, int max_if_num) {void *data_ptr; -size_t data_size, old_size; +size_t old_size;int ret = -ENOMEM ;spin_lock_bh (&orig_node->bat_iv.ogm_cnt_lock); - data_size = max_if_num *sizeof (unsigned long ) *BATADV_NUM_WORDS ; old_size = (max_if_num -1 ) *sizeof (unsigned long ) *BATADV_NUM_WORDS ; - data_ptr =kmalloc (data_size,GFP_ATOMIC ); + data_ptr =kmalloc_array (max_if_num, +BATADV_NUM_WORDS *sizeof (unsigned long ), +GFP_ATOMIC );if (!data_ptr) goto unlock;
@@ -123,7 +124,7 @@ static int batadv_iv_ogm_orig_add_if(struct batadv_orig_node *orig_node,kfree (orig_node->bat_iv.bcast_own); orig_node->bat_iv.bcast_own = data_ptr; - data_ptr =kmalloc (max_if_num *sizeof (uint8_t ),GFP_ATOMIC ); + data_ptr =kmalloc_array (max_if_num,sizeof (uint8_t ),GFP_ATOMIC );if (!data_ptr) {kfree (orig_node->bat_iv.bcast_own); goto unlock;
@@ -164,7 +165,7 @@ static int batadv_iv_ogm_orig_del_if(struct batadv_orig_node *orig_node, goto free_bcast_own; chunk_size =sizeof (unsigned long ) *BATADV_NUM_WORDS ; - data_ptr =kmalloc (max_if_num * chunk_size,GFP_ATOMIC ); + data_ptr =kmalloc_array (max_if_num, chunk_size,GFP_ATOMIC );if (!data_ptr) goto unlock;
@@ -183,7 +184,7 @@ free_bcast_own:if (max_if_num ==0 ) goto free_own_sum; - data_ptr =kmalloc (max_if_num *sizeof (uint8_t ),GFP_ATOMIC ); + data_ptr =kmalloc_array (max_if_num,sizeof (uint8_t ),GFP_ATOMIC );if (!data_ptr) {kfree (orig_node->bat_iv.bcast_own); goto unlock;
net/batman-adv/distributed-arp-table.c +2 -1
@@ -537,7 +537,8 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)if (!bat_priv->orig_hash)return NULL ; - res =kmalloc (BATADV_DAT_CANDIDATES_NUM *sizeof (*res),GFP_ATOMIC ); + res =kmalloc_array (BATADV_DAT_CANDIDATES_NUM ,sizeof (*res), +GFP_ATOMIC );if (!res)return NULL ;
net/batman-adv/hash.c +3 -3
@@ -46,12 +46,12 @@ struct batadv_hashtable *batadv_hash_new(uint32_t size)if (!hash)return NULL ; - hash->table =kmalloc (sizeof (*hash->table) * size,GFP_ATOMIC ); + hash->table =kmalloc_array (size,sizeof (*hash->table),GFP_ATOMIC );if (!hash->table) goto free_hash; - hash->list_locks =kmalloc (sizeof (*hash->list_locks) * size, -GFP_ATOMIC ); + hash->list_locks =kmalloc_array (size,sizeof (*hash->list_locks), +GFP_ATOMIC );if (!hash->list_locks) goto free_table;
Signature · 1 line
1.8.5.5
PATCH 2/4 batman-adv: remove unnecessary logspam
In reply to Antonio QuartulliFrom: André Gaul <[email protected]>
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.
--- net/batman-adv/main.h | 20 ++++++++++++++------ net/batman-adv/routing.c | 18 +++++++++--------- 2 files changed, 23 insertions(+), 15 deletions(-)
net/batman-adv/main.h +14 -6
@@ -238,21 +238,29 @@ enum batadv_dbg_level { int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...) __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 { \ - 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);\ } \ while (0)#else /* !CONFIG_BATMAN_ADV_DEBUG */ -__printf(3, 4) -static inline void batadv_dbg (int type__always_unused , -struct batadv_priv *bat_priv__always_unused , -const char *fmt__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); \
net/batman-adv/routing.c +9 -9
@@ -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_reroute_unicast_packet (bat_priv, unicast_packet, ethhdr->h_dest, vid)) -net_ratelimited_function (batadv_dbg,BATADV_DBG_TT , - bat_priv, -"Rerouting unicast packet to %pM (dst=%pM): Local Roaming\n" , - unicast_packet->dest, - ethhdr->h_dest); +batadv_dbg_ratelimited (BATADV_DBG_TT , + bat_priv, +"Rerouting unicast packet to %pM (dst=%pM): Local Roaming\n" , + unicast_packet->dest, + ethhdr->h_dest);/* at this point the mesh destination should have been * substituted with the originator address found in the global * 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, ethhdr->h_dest, vid)) { -net_ratelimited_function (batadv_dbg,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); +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);return 1 ; }
Signature · 1 line
1.8.5.5
PATCH 3/4 batman-adv: increase default hop penalty
In reply to Antonio QuartulliFrom: Simon Wunderlich <[email protected]>
The default hop penalty is currently set to 15, which is applied like that for multi interface devices (e.g. dual band APs). Single band devices will still use an effective penalty of 30 (hop penalty + wifi penalty).
After receiving reports of too long paths in mesh networks with dual band APs which were fixed by increasing the hop penalty, we'd like to suggest to increase that default value in the default setting as well. We've evaluated that increase in a handful of medium sized mesh networks (5-20 nodes) with single and dual band devices, with changes for the better (shorter routes, higher throughput) or no change at all.
This patch changes the hop penalty to 30, which will give an effective penalty of 60 on single band devices (hop penalty + wifi penalty).
--- net/batman-adv/soft-interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/soft-interface.c +1 -1
@@ -751,7 +751,7 @@ static int batadv_softif_init_late(struct net_device *dev)atomic_set (&bat_priv->gw.bandwidth_down,100 );atomic_set (&bat_priv->gw.bandwidth_up,20 );atomic_set (&bat_priv->orig_interval,1000 ); -atomic_set (&bat_priv->hop_penalty,15 ); +atomic_set (&bat_priv->hop_penalty,30 );#ifdef CONFIG_BATMAN_ADV_DEBUG atomic_set (&bat_priv->log_level,0 );#endif
Signature · 1 line
1.8.5.5
PATCH 4/4 batman-adv: Start new development cycle
In reply to Antonio QuartulliFrom: Simon Wunderlich <[email protected]>
--- net/batman-adv/main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/main.h +1 -1
@@ -24,7 +24,7 @@#define BATADV_DRIVER_DEVICE "batman-adv"#ifndef BATADV_SOURCE_VERSION -#define BATADV_SOURCE_VERSION "2014.3.0" +#define BATADV_SOURCE_VERSION "2014.4.0"#endif /* B.A.T.M.A.N. parameters */
Signature · 1 line
1.8.5.5
David Miller
maintainerFrom: Antonio Quartulli <[email protected]>
Date: Tue, 5 Aug 2014 09:36:24 +0200
Quoted 10 lines
this is a pull request intended for net-next/linux-3.17 (yeah..it's really late).
Patches 1, 2 and 4 are really minor changes:
-kmalloc_arrayis substituted to kmalloc when possible (as suggested by checkpatch);
-net_ratelimited()is now used properly and the "suppressed" message is not printed anymore if not needed;
- the internal version number has been increased to reflect our current version.
Quoted 4 lines
Patch 3 instead is introducing a change in the metric computation function by changing the penalty applied at each mesh hop from 15/255 (~6%) to 30/255 (~11%). This change is introduced by Simon Wunderlich after having observed a performance improvement in several networks when using the new value.
Pulled, thanks Antonio.