Skip to contentSkip to conversation

pull request for net-next: batman-adv 2020-04-27

PATCH In review Simon Wunderlich 2 participants 7 messages Apr 27, 2020

Subsystems (3)
lore
Share & tools
lore

Simon Wunderlich

author maintainer
#0 lore raw

cover pull request for net-next: batman-adv 2020-04-27

Hi David,

here is a small cleanup pull request of batman-adv to go into net-next.

Please pull or let me know of any problem!

Thank you,
Simon

The following changes since commit 8f3d9f354286745c751374f5f1fcafee6b3f3136:

Linux 5.7-rc1 (2020-04-12 12:35:55 -0700)

are available in the Git repository at:

git://git.open-mesh.org/linux-merge.git tags/batadv-next-for-davem-20200427

for you to fetch changes up to e73f94d1b6f05f6f22434c63de255a9dec6fd23d:

batman-adv: remove unused inline function batadv_arp_change_timeout (2020-04-24 15:22:41 +0200)

----------------------------------------------------------------
This cleanup patchset includes the following patches:

- bump version strings, by Simon Wunderlich

- fix spelling error, by Sven Eckelmann

- drop unneeded types.h include, by Sven Eckelmann

- change random number generation to prandom_u32_max(), by Sven Eckelmann

- remove unused function batadv_arp_change_timeout(), by Yue Haibing

----------------------------------------------------------------
Simon Wunderlich (1):
batman-adv: Start new development cycle

Sven Eckelmann (3):
batman-adv: Fix spelling error in term buffer
batman-adv: trace: Drop unneeded types.h include
batman-adv: Utilize prandom_u32_max for random [0, max) values

YueHaibing (1):
batman-adv: remove unused inline function batadv_arp_change_timeout

 net/batman-adv/bat_iv_ogm.c            | 4 ++--
 net/batman-adv/bat_v_elp.c             | 2 +-
 net/batman-adv/bat_v_ogm.c             | 4 ++--
 net/batman-adv/distributed-arp-table.h | 5 -----
 net/batman-adv/main.h                  | 2 +-
 net/batman-adv/trace.h                 | 1 -
 net/batman-adv/types.h                 | 2 +-
 7 files changed, 7 insertions(+), 13 deletions(-)
author maintainer
#1 lore raw

PATCH 1/5 batman-adv: Start new development cycle

---
 net/batman-adv/main.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/main.h +1 -1
index 2a234d0ad445..61d8dbe8c954 100644
@@ -13,7 +13,7 @@
 #define BATADV_DRIVER_DEVICE "batman-adv"
 
 #ifndef BATADV_SOURCE_VERSION
-#define BATADV_SOURCE_VERSION "2020.1"
+#define BATADV_SOURCE_VERSION "2020.2"
 #endif
 
 /* B.A.T.M.A.N. parameters */
Signature · 1 line
2.20.1
author maintainer
#2 lore raw

PATCH 2/5 batman-adv: Fix spelling error in term buffer

In reply to Simon Wunderlich

From: Sven Eckelmann <[email protected]>

checkpatch warns about a typo in the word bufFer which was introduced in commit 2191c1bcbc64 ("batman-adv: kernel doc for types.h").

---
 net/batman-adv/types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/types.h +1 -1
index 4a17a66cc572..d152b8e81f61 100644
@@ -1086,7 +1086,7 @@ struct batadv_priv_bla {
  * struct batadv_priv_debug_log - debug logging data
  */
 struct batadv_priv_debug_log {
-	/** @log_buff: buffer holding the logs (ring bufer) */
+	/** @log_buff: buffer holding the logs (ring buffer) */
 	char log_buff[BATADV_LOG_BUF_LEN];
 
 	/** @log_start: index of next character to read */
Signature · 1 line
2.20.1
author maintainer
#3 lore raw

PATCH 3/5 batman-adv: trace: Drop unneeded types.h include

In reply to Simon Wunderlich

From: Sven Eckelmann <[email protected]>

The commit 04ae87a52074 ("ftrace: Rework event_create_dir()") restructured various macros in the ftrace framework. These changes also had the nice side effect that the linux/types.h include is no longer necessary to define some of the types used by these macros.

---
 net/batman-adv/trace.h | 1 -
 1 file changed, 1 deletion(-)
net/batman-adv/trace.h +0 -1
index f631b1e01b89..a87547570b4e 100644
@@ -15,7 +15,6 @@
 #include <linux/percpu.h>
 #include <linux/printk.h>
 #include <linux/tracepoint.h>
-#include <linux/types.h>
 
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM batadv
Signature · 1 line
2.20.1
author maintainer
#4 lore raw

PATCH 4/5 batman-adv: Utilize prandom_u32_max for random [0, max) values

In reply to Simon Wunderlich

From: Sven Eckelmann <[email protected]>

The kernel provides a function to create random values from 0 - (max-1) since commit f337db64af05 ("random32: add prandom_u32_max and convert open coded users"). Simply use this function to replace code sections which use prandom_u32 and a handcrafted method to map it to the correct range.

---
 net/batman-adv/bat_iv_ogm.c | 4 ++--
 net/batman-adv/bat_v_elp.c  | 2 +-
 net/batman-adv/bat_v_ogm.c  | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
net/batman-adv/bat_iv_ogm.c +2 -2
index a7c8dd7ae513..e87f19c82e8d 100644
@@ -280,7 +280,7 @@ batadv_iv_ogm_emit_send_time(const struct batadv_priv *bat_priv)
 	unsigned int msecs;
 
 	msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER;
-	msecs += prandom_u32() % (2 * BATADV_JITTER);
+	msecs += prandom_u32_max(2 * BATADV_JITTER);
 
 	return jiffies + msecs_to_jiffies(msecs);
 }
@@ -288,7 +288,7 @@ batadv_iv_ogm_emit_send_time(const struct batadv_priv *bat_priv)
 /* when do we schedule a ogm packet to be sent */
 static unsigned long batadv_iv_ogm_fwd_send_time(void)
 {
-	return jiffies + msecs_to_jiffies(prandom_u32() % (BATADV_JITTER / 2));
+	return jiffies + msecs_to_jiffies(prandom_u32_max(BATADV_JITTER / 2));
 }
 
 /* apply hop penalty for a normal link */
net/batman-adv/bat_v_elp.c +1 -1
index 1e3172db7492..353e49c40e7f 100644
@@ -49,7 +49,7 @@ static void batadv_v_elp_start_timer(struct batadv_hard_iface *hard_iface)
 	unsigned int msecs;
 
 	msecs = atomic_read(&hard_iface->bat_v.elp_interval) - BATADV_JITTER;
-	msecs += prandom_u32() % (2 * BATADV_JITTER);
+	msecs += prandom_u32_max(2 * BATADV_JITTER);
 
 	queue_delayed_work(batadv_event_workqueue, &hard_iface->bat_v.elp_wq,
 			   msecs_to_jiffies(msecs));
net/batman-adv/bat_v_ogm.c +2 -2
index 969466218999..0959d32be65c 100644
@@ -88,7 +88,7 @@ static void batadv_v_ogm_start_queue_timer(struct batadv_hard_iface *hard_iface)
 	unsigned int msecs = BATADV_MAX_AGGREGATION_MS * 1000;
 
 	/* msecs * [0.9, 1.1] */
-	msecs += prandom_u32() % (msecs / 5) - (msecs / 10);
+	msecs += prandom_u32_max(msecs / 5) - (msecs / 10);
 	queue_delayed_work(batadv_event_workqueue, &hard_iface->bat_v.aggr_wq,
 			   msecs_to_jiffies(msecs / 1000));
 }
@@ -107,7 +107,7 @@ static void batadv_v_ogm_start_timer(struct batadv_priv *bat_priv)
 		return;
 
 	msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER;
-	msecs += prandom_u32() % (2 * BATADV_JITTER);
+	msecs += prandom_u32_max(2 * BATADV_JITTER);
 	queue_delayed_work(batadv_event_workqueue, &bat_priv->bat_v.ogm_wq,
 			   msecs_to_jiffies(msecs));
 }
Signature · 1 line
2.20.1
author maintainer
#5 lore raw

PATCH 5/5 batman-adv: remove unused inline function batadv_arp_change_timeout

In reply to Simon Wunderlich

From: YueHaibing <[email protected]>

There's no callers in-tree.

---
 net/batman-adv/distributed-arp-table.h | 5 -----
 1 file changed, 5 deletions(-)
net/batman-adv/distributed-arp-table.h +0 -5
index 2bff2f4a325c..4e031661682a 100644
@@ -163,11 +163,6 @@ static inline void batadv_dat_init_own_addr(struct batadv_priv *bat_priv,
 {
 }
 
-static inline void batadv_arp_change_timeout(struct net_device *soft_iface,
-					     const char *name)
-{
-}
-
 static inline int batadv_dat_init(struct batadv_priv *bat_priv)
 {
 	return 0;
Signature · 1 line
2.20.1