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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJT4Ir0AAoJEJgn97Bh2u9eYG8P/2Bx9uCbajNQSCBvQ20OXW4o YzubqMETLel6GLoVjL2XFsmJATaQGGWYWGSytDF2sRa1C7/dXXfUrwgfFNzw2L9Z nZSd8WbhiBW0LK/ECzTQ12M3VnTdjgj3IP9A58N9zqQf5uM1onQR6gR7IQGARn9S D5onFdoRz5bWcVffyf4YN9irMkvAFjOB7OzNtBaHRbH5oObITS10LcQ7rVLAic/0 lyMCX1ioBnFpbH1YfII0dcSFjY22m9QTjJDj4dx6LbjDXaxv9BMiJ7bfjCt5wn1o 0ju5X898fhTX0L4Z67pGGHzawByyXtrf1r9INot8K8oqftq5vkHpIJdn9n0GrYGa 9FVoQ0hzDVSp7mxnBKnbXyaf47HX8RYRBZegHEDW8zrpO0zj7cyruRKifDL3q9R9 cqGIRYSFPaXEGF6HfmxWXCjst1VpddcTBgD7OWlKuTi/Juk2ZoWI4O+h3WlotOv8 niTiG0DiNoGlrLXjFlya6TdfL43zg3sE8O4oukcVO4uejo+wdL+Rc7ZGuO7CbO9k V+ORQ/8Efg3XD8xRSmzi0pgyBfU/C6HTTWCIv8DIMfl0B5zoeIx75quDP9/CKIfz UTF0R1+mA0o6UmSiIngqRTFEEB9cWrMvCjM1drMb1V99NzI+/fg1skO7pcnJRddC rbPgeTHDAYgMsPj74rhs =EIGl -----END PGP SIGNATURE----- Merge tag 'batman-adv-for-davem' of git://git.open-mesh.org/linux-merge Antonio Quartulli says: ==================== pull request: batman-adv 2014-08-05 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. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
6ff4e36f8b
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 */
|
||||
@ -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); \
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user