aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorMarek Lindner <mareklindner@neomailbox.ch>2016-05-10 10:31:59 -0400
committerSimon Wunderlich <sw@simonwunderlich.de>2016-06-30 04:29:43 -0400
commit7db682d1c39b2198a9c9d0bee5812d9c4329123d (patch)
tree14f9eef1514bf90cdfdc6f95c92ec5c7fd4afd8c /net/batman-adv
parent3a24a63e74af1bffc7aeb5d83adcd63b37e38425 (diff)
batman-adv: init ELP tweaking options only once
The ELP interval and throughput override interface settings are initialized with default settings on every time an interface is added to a mesh. This patch prevents this behavior by moving the configuration init to the interface detection routine which runs only once per interface. Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> [a@unstable.cc: move initialization to batadv_v_hardif_init] Signed-off-by: Antonio Quartulli <a@unstable.cc> Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Diffstat (limited to 'net/batman-adv')
-rw-r--r--net/batman-adv/bat_algo.h7
-rw-r--r--net/batman-adv/bat_v.c19
-rw-r--r--net/batman-adv/bat_v_elp.c1
-rw-r--r--net/batman-adv/hard-interface.c3
4 files changed, 23 insertions, 7 deletions
diff --git a/net/batman-adv/bat_algo.h b/net/batman-adv/bat_algo.h
index 03dafd33d23b..36542962de7d 100644
--- a/net/batman-adv/bat_algo.h
+++ b/net/batman-adv/bat_algo.h
@@ -18,13 +18,14 @@
18#ifndef _NET_BATMAN_ADV_BAT_ALGO_H_ 18#ifndef _NET_BATMAN_ADV_BAT_ALGO_H_
19#define _NET_BATMAN_ADV_BAT_ALGO_H_ 19#define _NET_BATMAN_ADV_BAT_ALGO_H_
20 20
21struct batadv_priv; 21#include "main.h"
22 22
23int batadv_iv_init(void); 23int batadv_iv_init(void);
24 24
25#ifdef CONFIG_BATMAN_ADV_BATMAN_V 25#ifdef CONFIG_BATMAN_ADV_BATMAN_V
26 26
27int batadv_v_init(void); 27int batadv_v_init(void);
28void batadv_v_hardif_init(struct batadv_hard_iface *hardif);
28int batadv_v_mesh_init(struct batadv_priv *bat_priv); 29int batadv_v_mesh_init(struct batadv_priv *bat_priv);
29void batadv_v_mesh_free(struct batadv_priv *bat_priv); 30void batadv_v_mesh_free(struct batadv_priv *bat_priv);
30 31
@@ -35,6 +36,10 @@ static inline int batadv_v_init(void)
35 return 0; 36 return 0;
36} 37}
37 38
39static inline void batadv_v_hardif_init(struct batadv_hard_iface *hardif)
40{
41}
42
38static inline int batadv_v_mesh_init(struct batadv_priv *bat_priv) 43static inline int batadv_v_mesh_init(struct batadv_priv *bat_priv)
39{ 44{
40 return 0; 45 return 0;
diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
index c16cd44a3b4c..c2fea812fb48 100644
--- a/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -70,11 +70,6 @@ static int batadv_v_iface_enable(struct batadv_hard_iface *hard_iface)
70 if (ret < 0) 70 if (ret < 0)
71 batadv_v_elp_iface_disable(hard_iface); 71 batadv_v_elp_iface_disable(hard_iface);
72 72
73 /* enable link throughput auto-detection by setting the throughput
74 * override to zero
75 */
76 atomic_set(&hard_iface->bat_v.throughput_override, 0);
77
78 return ret; 73 return ret;
79} 74}
80 75
@@ -339,6 +334,20 @@ static struct batadv_algo_ops batadv_batman_v __read_mostly = {
339}; 334};
340 335
341/** 336/**
337 * batadv_v_hardif_init - initialize the algorithm specific fields in the
338 * hard-interface object
339 * @hard_iface: the hard-interface to initialize
340 */
341void batadv_v_hardif_init(struct batadv_hard_iface *hard_iface)
342{
343 /* enable link throughput auto-detection by setting the throughput
344 * override to zero
345 */
346 atomic_set(&hard_iface->bat_v.throughput_override, 0);
347 atomic_set(&hard_iface->bat_v.elp_interval, 500);
348}
349
350/**
342 * batadv_v_mesh_init - initialize the B.A.T.M.A.N. V private resources for a 351 * batadv_v_mesh_init - initialize the B.A.T.M.A.N. V private resources for a
343 * mesh 352 * mesh
344 * @bat_priv: the object representing the mesh interface to initialise 353 * @bat_priv: the object representing the mesh interface to initialise
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index 8909d1eb9622..cf0262becd08 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -344,7 +344,6 @@ int batadv_v_elp_iface_enable(struct batadv_hard_iface *hard_iface)
344 /* randomize initial seqno to avoid collision */ 344 /* randomize initial seqno to avoid collision */
345 get_random_bytes(&random_seqno, sizeof(random_seqno)); 345 get_random_bytes(&random_seqno, sizeof(random_seqno));
346 atomic_set(&hard_iface->bat_v.elp_seqno, random_seqno); 346 atomic_set(&hard_iface->bat_v.elp_seqno, random_seqno);
347 atomic_set(&hard_iface->bat_v.elp_interval, 500);
348 347
349 /* assume full-duplex by default */ 348 /* assume full-duplex by default */
350 hard_iface->bat_v.flags |= BATADV_FULL_DUPLEX; 349 hard_iface->bat_v.flags |= BATADV_FULL_DUPLEX;
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index db2009d84a25..3696929e5692 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -37,6 +37,7 @@
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/workqueue.h> 38#include <linux/workqueue.h>
39 39
40#include "bat_algo.h"
40#include "bridge_loop_avoidance.h" 41#include "bridge_loop_avoidance.h"
41#include "debugfs.h" 42#include "debugfs.h"
42#include "distributed-arp-table.h" 43#include "distributed-arp-table.h"
@@ -683,6 +684,8 @@ batadv_hardif_add_interface(struct net_device *net_dev)
683 if (batadv_is_wifi_netdev(net_dev)) 684 if (batadv_is_wifi_netdev(net_dev))
684 hard_iface->num_bcasts = BATADV_NUM_BCASTS_WIRELESS; 685 hard_iface->num_bcasts = BATADV_NUM_BCASTS_WIRELESS;
685 686
687 batadv_v_hardif_init(hard_iface);
688
686 /* extra reference for return */ 689 /* extra reference for return */
687 kref_init(&hard_iface->refcount); 690 kref_init(&hard_iface->refcount);
688 kref_get(&hard_iface->refcount); 691 kref_get(&hard_iface->refcount);