From 7db682d1c39b2198a9c9d0bee5812d9c4329123d Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Tue, 10 May 2016 22:31:59 +0800 Subject: 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 [a@unstable.cc: move initialization to batadv_v_hardif_init] Signed-off-by: Antonio Quartulli Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich --- net/batman-adv/bat_v.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'net/batman-adv/bat_v.c') 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) if (ret < 0) batadv_v_elp_iface_disable(hard_iface); - /* enable link throughput auto-detection by setting the throughput - * override to zero - */ - atomic_set(&hard_iface->bat_v.throughput_override, 0); - return ret; } @@ -338,6 +333,20 @@ static struct batadv_algo_ops batadv_batman_v __read_mostly = { .bat_neigh_print = batadv_v_neigh_print, }; +/** + * batadv_v_hardif_init - initialize the algorithm specific fields in the + * hard-interface object + * @hard_iface: the hard-interface to initialize + */ +void batadv_v_hardif_init(struct batadv_hard_iface *hard_iface) +{ + /* enable link throughput auto-detection by setting the throughput + * override to zero + */ + atomic_set(&hard_iface->bat_v.throughput_override, 0); + atomic_set(&hard_iface->bat_v.elp_interval, 500); +} + /** * batadv_v_mesh_init - initialize the B.A.T.M.A.N. V private resources for a * mesh -- cgit v1.2.3