netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Wunderlich <sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Cc: Marek Lindner
	<mareklindner-rVWd3aGhH2z5bpWLKbzFeg@public.gmane.org>,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org,
	Antonio Quartulli <a@unstable.cc>
Subject: [PATCH 11/17] batman-adv: init ELP tweaking options only once
Date: Fri,  1 Jul 2016 15:09:03 +0200	[thread overview]
Message-ID: <1467378549-9646-12-git-send-email-sw@simonwunderlich.de> (raw)
In-Reply-To: <1467378549-9646-1-git-send-email-sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>

From: Marek Lindner <mareklindner-rVWd3aGhH2z5bpWLKbzFeg@public.gmane.org>

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-rVWd3aGhH2z5bpWLKbzFeg@public.gmane.org>
[a@unstable.cc: move initialization to batadv_v_hardif_init]
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Signed-off-by: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
Signed-off-by: Simon Wunderlich <sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>
---
 net/batman-adv/bat_algo.h       |  7 ++++++-
 net/batman-adv/bat_v.c          | 19 ++++++++++++++-----
 net/batman-adv/bat_v_elp.c      |  1 -
 net/batman-adv/hard-interface.c |  3 +++
 4 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/net/batman-adv/bat_algo.h b/net/batman-adv/bat_algo.h
index 03dafd3..3654296 100644
--- a/net/batman-adv/bat_algo.h
+++ b/net/batman-adv/bat_algo.h
@@ -18,13 +18,14 @@
 #ifndef _NET_BATMAN_ADV_BAT_ALGO_H_
 #define _NET_BATMAN_ADV_BAT_ALGO_H_
 
-struct batadv_priv;
+#include "main.h"
 
 int batadv_iv_init(void);
 
 #ifdef CONFIG_BATMAN_ADV_BATMAN_V
 
 int batadv_v_init(void);
+void batadv_v_hardif_init(struct batadv_hard_iface *hardif);
 int batadv_v_mesh_init(struct batadv_priv *bat_priv);
 void batadv_v_mesh_free(struct batadv_priv *bat_priv);
 
@@ -35,6 +36,10 @@ static inline int batadv_v_init(void)
 	return 0;
 }
 
+static inline void batadv_v_hardif_init(struct batadv_hard_iface *hardif)
+{
+}
+
 static inline int batadv_v_mesh_init(struct batadv_priv *bat_priv)
 {
 	return 0;
diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
index c16cd44..c2fea81 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;
 }
 
@@ -339,6 +334,20 @@ static struct batadv_algo_ops batadv_batman_v __read_mostly = {
 };
 
 /**
+ * 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
  * @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 8909d1e..cf0262b 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)
 	/* randomize initial seqno to avoid collision */
 	get_random_bytes(&random_seqno, sizeof(random_seqno));
 	atomic_set(&hard_iface->bat_v.elp_seqno, random_seqno);
-	atomic_set(&hard_iface->bat_v.elp_interval, 500);
 
 	/* assume full-duplex by default */
 	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 db2009d..3696929 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -37,6 +37,7 @@
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
 
+#include "bat_algo.h"
 #include "bridge_loop_avoidance.h"
 #include "debugfs.h"
 #include "distributed-arp-table.h"
@@ -683,6 +684,8 @@ batadv_hardif_add_interface(struct net_device *net_dev)
 	if (batadv_is_wifi_netdev(net_dev))
 		hard_iface->num_bcasts = BATADV_NUM_BCASTS_WIRELESS;
 
+	batadv_v_hardif_init(hard_iface);
+
 	/* extra reference for return */
 	kref_init(&hard_iface->refcount);
 	kref_get(&hard_iface->refcount);
-- 
2.8.1

  parent reply	other threads:[~2016-07-01 13:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01 13:08 pull request for net-next: batman-adv 2016-07-01 Simon Wunderlich
     [not found] ` <1467378549-9646-1-git-send-email-sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>
2016-07-01 13:08   ` [PATCH 01/17] batman-adv: Start new development cycle Simon Wunderlich
2016-07-01 13:08   ` [PATCH 02/17] batman-adv: statically print gateway table header Simon Wunderlich
2016-07-01 17:19     ` Joe Perches
2016-07-01 13:08   ` [PATCH 03/17] batman-adv: remove unused vid local variable in tt seq print Simon Wunderlich
2016-07-01 13:08   ` [PATCH 04/17] batman-adv: document sysfs files in alphabetical order Simon Wunderlich
2016-07-01 13:08   ` [PATCH 05/17] batman-adv: update elp interval documentation Simon Wunderlich
2016-07-01 13:08   ` [PATCH 06/17] batman-adv: refactor batadv_neigh_node_* functions to follow common style Simon Wunderlich
2016-07-01 13:08   ` [PATCH 07/17] batman-adv: remove unused callback from batadv_algo_ops struct Simon Wunderlich
2016-07-01 13:09   ` [PATCH 08/17] batman-adv: remove ogm_emit and ogm_schedule API calls Simon Wunderlich
2016-07-01 13:09   ` [PATCH 09/17] batman-adv: remove useless inline attribute for sysfs helper function Simon Wunderlich
2016-07-01 13:09   ` [PATCH 10/17] batman-adv: move GW mode and selection class to private data structure Simon Wunderlich
2016-07-01 13:09   ` Simon Wunderlich [this message]
2016-07-01 13:09   ` [PATCH 12/17] batman-adv: Set skb priority in fragments Simon Wunderlich
2016-07-01 13:09   ` [PATCH 13/17] batman-adv: Include frame priority in fragment header Simon Wunderlich
2016-07-01 13:09   ` [PATCH 14/17] batman-adv: Always flood IGMP/MLD reports Simon Wunderlich
2016-07-01 13:09   ` [PATCH 15/17] batman-adv: Add multicast optimization support for bridged setups Simon Wunderlich
2016-07-01 13:09   ` [PATCH 16/17] batman-adv: Adding logging of mcast flag changes Simon Wunderlich
2016-07-01 13:09   ` [PATCH 17/17] batman-adv: Add debugfs table for mcast flags Simon Wunderlich
2016-07-01 21:05   ` pull request for net-next: batman-adv 2016-07-01 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1467378549-9646-12-git-send-email-sw@simonwunderlich.de \
    --to=sw-2yrnx6ruihyiy0qsoawiaoquadtiucjx@public.gmane.org \
    --cc=a@unstable.cc \
    --cc=b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=mareklindner-rVWd3aGhH2z5bpWLKbzFeg@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).