b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] pull request: batman-adv 2014-08-05
@ 2014-08-05  7:36 Antonio Quartulli
  2014-08-05  7:36 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: prefer kmalloc_array to kmalloc when possible Antonio Quartulli
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Antonio Quartulli @ 2014-08-05  7:36 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n

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(-)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: prefer kmalloc_array to kmalloc when possible
  2014-08-05  7:36 [B.A.T.M.A.N.] pull request: batman-adv 2014-08-05 Antonio Quartulli
@ 2014-08-05  7:36 ` Antonio Quartulli
  2014-08-05  7:36 ` [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: remove unnecessary logspam Antonio Quartulli
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Antonio Quartulli @ 2014-08-05  7:36 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Antonio Quartulli

Reported by checkpatch with the following warning:
WARNING: Prefer kmalloc_array over kmalloc with multiply

Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
---
 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(-)

diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index f04224c..1e80539 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -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;
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index f2c066b..b598111 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -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;
 
diff --git a/net/batman-adv/hash.c b/net/batman-adv/hash.c
index 63bdf7e..7c1c630 100644
--- a/net/batman-adv/hash.c
+++ b/net/batman-adv/hash.c
@@ -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;
 
-- 
1.8.5.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: remove unnecessary logspam
  2014-08-05  7:36 [B.A.T.M.A.N.] pull request: batman-adv 2014-08-05 Antonio Quartulli
  2014-08-05  7:36 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: prefer kmalloc_array to kmalloc when possible Antonio Quartulli
@ 2014-08-05  7:36 ` Antonio Quartulli
  2014-08-05  7:36 ` [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: increase default hop penalty Antonio Quartulli
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Antonio Quartulli @ 2014-08-05  7:36 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, André Gaul, Marek Lindner

From: André Gaul <gaul@web-yard.de>

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>
---
 net/batman-adv/main.h    | 20 ++++++++++++++------
 net/batman-adv/routing.c | 18 +++++++++---------
 2 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 118b990..257840e 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -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);                 \
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 3514153..35f76f2 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -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;
 	}
 
-- 
1.8.5.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: increase default hop penalty
  2014-08-05  7:36 [B.A.T.M.A.N.] pull request: batman-adv 2014-08-05 Antonio Quartulli
  2014-08-05  7:36 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: prefer kmalloc_array to kmalloc when possible Antonio Quartulli
  2014-08-05  7:36 ` [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: remove unnecessary logspam Antonio Quartulli
@ 2014-08-05  7:36 ` Antonio Quartulli
  2014-08-05  7:36 ` [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Start new development cycle Antonio Quartulli
  2014-08-05 23:40 ` [B.A.T.M.A.N.] pull request: batman-adv 2014-08-05 David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Antonio Quartulli @ 2014-08-05  7:36 UTC (permalink / raw)
  To: davem; +Cc: netdev, Simon Wunderlich, b.a.t.m.a.n, Marek Lindner

From: Simon Wunderlich <simon@open-mesh.com>

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).

Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
---
 net/batman-adv/soft-interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index e0a7239..5467955 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -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
-- 
1.8.5.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Start new development cycle
  2014-08-05  7:36 [B.A.T.M.A.N.] pull request: batman-adv 2014-08-05 Antonio Quartulli
                   ` (2 preceding siblings ...)
  2014-08-05  7:36 ` [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: increase default hop penalty Antonio Quartulli
@ 2014-08-05  7:36 ` Antonio Quartulli
  2014-08-05 23:40 ` [B.A.T.M.A.N.] pull request: batman-adv 2014-08-05 David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Antonio Quartulli @ 2014-08-05  7:36 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n

From: Simon Wunderlich <sw@simonwunderlich.de>

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/batman-adv/main.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 257840e..a1fcd88 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -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 */
-- 
1.8.5.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [B.A.T.M.A.N.] pull request: batman-adv 2014-08-05
  2014-08-05  7:36 [B.A.T.M.A.N.] pull request: batman-adv 2014-08-05 Antonio Quartulli
                   ` (3 preceding siblings ...)
  2014-08-05  7:36 ` [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Start new development cycle Antonio Quartulli
@ 2014-08-05 23:40 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2014-08-05 23:40 UTC (permalink / raw)
  To: antonio; +Cc: netdev, b.a.t.m.a.n

From: Antonio Quartulli <antonio@meshcoding.com>
Date: Tue,  5 Aug 2014 09:36:24 +0200

> 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.

Pulled, thanks Antonio.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-08-05 23:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-05  7:36 [B.A.T.M.A.N.] pull request: batman-adv 2014-08-05 Antonio Quartulli
2014-08-05  7:36 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: prefer kmalloc_array to kmalloc when possible Antonio Quartulli
2014-08-05  7:36 ` [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: remove unnecessary logspam Antonio Quartulli
2014-08-05  7:36 ` [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: increase default hop penalty Antonio Quartulli
2014-08-05  7:36 ` [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: Start new development cycle Antonio Quartulli
2014-08-05 23:40 ` [B.A.T.M.A.N.] pull request: batman-adv 2014-08-05 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).