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 20150828
@ 2015-08-28  9:12 Antonio Quartulli
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 01/10] batman-adv: move hardif refcount inc to batadv_neigh_node_new() Antonio Quartulli
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Antonio Quartulli @ 2015-08-28  9:12 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n

Hello David,

this is our very last batch of patches intended for net-next/linux-4.3

It includes again 2 non-critical fixes which we couldn't send to net
and then the rest is just code restyling and beautification. No
major behavioural change was introduced.

Please pull or let me know of any problem!

Thanks a lot,
	Antonio


The following changes since commit 1dd34b5ad8aebaff17b625fc0126e18243008a3f:

  bpf: fix bpf_skb_set_tunnel_key() helper (2015-08-26 17:38:13 -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 ed29266347025a19ee689807b07d121f0a7441f1:

  batman-adv: turn batadv_neigh_node_get() into local function (2015-08-27 20:15:34 +0200)

----------------------------------------------------------------
Included changes:
- code beautification
- remove obsolete 'deleted' attribute for bat-gw node
- increase internal version number
- prevent potential access to netdev object after deregistration
- set needed_head/tail_room for batman virtual interface

----------------------------------------------------------------
Antonio Quartulli (1):
      batman-adv: don't access unregistered net_device object

Marek Lindner (5):
      batman-adv: move hardif refcount inc to batadv_neigh_node_new()
      batman-adv: remove redundant hard_iface assignment
      batman-adv: move neigh_node list add into batadv_neigh_node_new()
      batman-adv: rearrange batadv_neigh_node_new() arguments to follow convention
      batman-adv: turn batadv_neigh_node_get() into local function

Simon Wunderlich (3):
      batman-adv: remove obsolete deleted attribute for gateway node
      batman-adv: fix gateway client style issues
      batman-adv: Start new development cycle

Sven Eckelmann (1):
      batman-adv: Add lower layer needed_(head|tail)room to own ones

 net/batman-adv/bat_iv_ogm.c     | 30 +-------------
 net/batman-adv/gateway_client.c | 50 ++++++-----------------
 net/batman-adv/gateway_client.h |  2 +-
 net/batman-adv/hard-interface.c | 44 +++++++++++++++++++-
 net/batman-adv/main.c           |  2 +-
 net/batman-adv/main.h           |  2 +-
 net/batman-adv/originator.c     | 90 ++++++++++++++++++++++++-----------------
 net/batman-adv/originator.h     |  9 ++---
 net/batman-adv/soft-interface.c |  2 -
 net/batman-adv/types.h          |  2 -
 10 files changed, 117 insertions(+), 116 deletions(-)

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

* [B.A.T.M.A.N.] [PATCH 01/10] batman-adv: move hardif refcount inc to batadv_neigh_node_new()
  2015-08-28  9:12 [B.A.T.M.A.N.] pull request: batman-adv 20150828 Antonio Quartulli
@ 2015-08-28  9:12 ` Antonio Quartulli
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 02/10] batman-adv: remove redundant hard_iface assignment Antonio Quartulli
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Antonio Quartulli @ 2015-08-28  9:12 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Antonio Quartulli

From: Marek Lindner <mareklindner@neomailbox.ch>

The batadv_neigh_node cleanup function 'batadv_neigh_node_free_rcu()'
takes care of reducing the hardif refcounter, hence it's only logical
to assume the creating function of that same object
'batadv_neigh_node_new()' takes care of increasing the same refcounter.

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
 net/batman-adv/bat_iv_ogm.c | 6 ------
 net/batman-adv/originator.c | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 5c12200..b9b8b33 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -303,12 +303,6 @@ batadv_iv_ogm_neigh_new(struct batadv_hard_iface *hard_iface,
 	if (!neigh_node)
 		goto out;
 
-	if (!atomic_inc_not_zero(&hard_iface->refcount)) {
-		kfree(neigh_node);
-		neigh_node = NULL;
-		goto out;
-	}
-
 	neigh_node->orig_node = orig_neigh;
 	neigh_node->if_incoming = hard_iface;
 
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 610620a..f8317c1 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -461,6 +461,12 @@ batadv_neigh_node_new(struct batadv_hard_iface *hard_iface,
 	if (!neigh_node)
 		goto out;
 
+	if (!atomic_inc_not_zero(&hard_iface->refcount)) {
+		kfree(neigh_node);
+		neigh_node = NULL;
+		goto out;
+	}
+
 	INIT_HLIST_NODE(&neigh_node->list);
 	INIT_HLIST_HEAD(&neigh_node->ifinfo_list);
 	spin_lock_init(&neigh_node->ifinfo_lock);
-- 
2.5.0


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

* [B.A.T.M.A.N.] [PATCH 02/10] batman-adv: remove redundant hard_iface assignment
  2015-08-28  9:12 [B.A.T.M.A.N.] pull request: batman-adv 20150828 Antonio Quartulli
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 01/10] batman-adv: move hardif refcount inc to batadv_neigh_node_new() Antonio Quartulli
@ 2015-08-28  9:12 ` Antonio Quartulli
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 03/10] batman-adv: move neigh_node list add into batadv_neigh_node_new() Antonio Quartulli
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Antonio Quartulli @ 2015-08-28  9:12 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Antonio Quartulli

From: Marek Lindner <mareklindner@neomailbox.ch>

The batadv_neigh_node_new() function already sets the hard_iface pointer.

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
 net/batman-adv/bat_iv_ogm.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index b9b8b33..b18184e 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -304,7 +304,6 @@ batadv_iv_ogm_neigh_new(struct batadv_hard_iface *hard_iface,
 		goto out;
 
 	neigh_node->orig_node = orig_neigh;
-	neigh_node->if_incoming = hard_iface;
 
 	spin_lock_bh(&orig_node->neigh_list_lock);
 	tmp_neigh_node = batadv_neigh_node_get(orig_node, hard_iface,
-- 
2.5.0


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

* [B.A.T.M.A.N.] [PATCH 03/10] batman-adv: move neigh_node list add into batadv_neigh_node_new()
  2015-08-28  9:12 [B.A.T.M.A.N.] pull request: batman-adv 20150828 Antonio Quartulli
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 01/10] batman-adv: move hardif refcount inc to batadv_neigh_node_new() Antonio Quartulli
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 02/10] batman-adv: remove redundant hard_iface assignment Antonio Quartulli
@ 2015-08-28  9:12 ` Antonio Quartulli
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 04/10] batman-adv: remove obsolete deleted attribute for gateway node Antonio Quartulli
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Antonio Quartulli @ 2015-08-28  9:12 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Antonio Quartulli

From: Marek Lindner <mareklindner@neomailbox.ch>

All batadv_neigh_node_* functions expect the neigh_node list item to be part
of the orig_node->neigh_list, therefore the constructor of said list item
should be adding the newly created neigh_node to the respective list.

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
 net/batman-adv/bat_iv_ogm.c | 21 +--------------------
 net/batman-adv/originator.c | 12 ++++++++++++
 2 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index b18184e..5e93af4 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -296,8 +296,7 @@ batadv_iv_ogm_neigh_new(struct batadv_hard_iface *hard_iface,
 			struct batadv_orig_node *orig_node,
 			struct batadv_orig_node *orig_neigh)
 {
-	struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
-	struct batadv_neigh_node *neigh_node, *tmp_neigh_node;
+	struct batadv_neigh_node *neigh_node;
 
 	neigh_node = batadv_neigh_node_new(hard_iface, neigh_addr, orig_node);
 	if (!neigh_node)
@@ -305,24 +304,6 @@ batadv_iv_ogm_neigh_new(struct batadv_hard_iface *hard_iface,
 
 	neigh_node->orig_node = orig_neigh;
 
-	spin_lock_bh(&orig_node->neigh_list_lock);
-	tmp_neigh_node = batadv_neigh_node_get(orig_node, hard_iface,
-					       neigh_addr);
-	if (!tmp_neigh_node) {
-		hlist_add_head_rcu(&neigh_node->list, &orig_node->neigh_list);
-	} else {
-		kfree(neigh_node);
-		batadv_hardif_free_ref(hard_iface);
-		neigh_node = tmp_neigh_node;
-	}
-	spin_unlock_bh(&orig_node->neigh_list_lock);
-
-	if (!tmp_neigh_node)
-		batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
-			   "Creating new neighbor %pM for orig_node %pM on interface %s\n",
-			   neigh_addr, orig_node->orig,
-			   hard_iface->net_dev->name);
-
 out:
 	return neigh_node;
 }
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index f8317c1..f751775 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -457,6 +457,10 @@ batadv_neigh_node_new(struct batadv_hard_iface *hard_iface,
 {
 	struct batadv_neigh_node *neigh_node;
 
+	neigh_node = batadv_neigh_node_get(orig_node, hard_iface, neigh_addr);
+	if (neigh_node)
+		goto out;
+
 	neigh_node = kzalloc(sizeof(*neigh_node), GFP_ATOMIC);
 	if (!neigh_node)
 		goto out;
@@ -478,6 +482,14 @@ batadv_neigh_node_new(struct batadv_hard_iface *hard_iface,
 	/* extra reference for return */
 	atomic_set(&neigh_node->refcount, 2);
 
+	spin_lock_bh(&orig_node->neigh_list_lock);
+	hlist_add_head_rcu(&neigh_node->list, &orig_node->neigh_list);
+	spin_unlock_bh(&orig_node->neigh_list_lock);
+
+	batadv_dbg(BATADV_DBG_BATMAN, orig_node->bat_priv,
+		   "Creating new neighbor %pM for orig_node %pM on interface %s\n",
+		   neigh_addr, orig_node->orig, hard_iface->net_dev->name);
+
 out:
 	return neigh_node;
 }
-- 
2.5.0


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

* [B.A.T.M.A.N.] [PATCH 04/10] batman-adv: remove obsolete deleted attribute for gateway node
  2015-08-28  9:12 [B.A.T.M.A.N.] pull request: batman-adv 20150828 Antonio Quartulli
                   ` (2 preceding siblings ...)
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 03/10] batman-adv: move neigh_node list add into batadv_neigh_node_new() Antonio Quartulli
@ 2015-08-28  9:12 ` Antonio Quartulli
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 05/10] batman-adv: rearrange batadv_neigh_node_new() arguments to follow convention Antonio Quartulli
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Antonio Quartulli @ 2015-08-28  9:12 UTC (permalink / raw)
  To: davem
  Cc: netdev, Simon Wunderlich, b.a.t.m.a.n, Marek Lindner, Antonio Quartulli

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

With rcu, the gateway node deleted attribute is not needed anymore. In
fact, it may delay the free of the gateway node and its referenced
structures. Therefore remove it altogether and simplify purging as well.

Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
 net/batman-adv/gateway_client.c | 48 +++++++++++------------------------------
 net/batman-adv/gateway_client.h |  2 +-
 net/batman-adv/main.c           |  2 +-
 net/batman-adv/originator.c     |  1 -
 net/batman-adv/types.h          |  2 --
 5 files changed, 14 insertions(+), 41 deletions(-)

diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index d7ca214..634c7e3 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -161,9 +161,6 @@ batadv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
 
 	rcu_read_lock();
 	hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
-		if (gw_node->deleted)
-			continue;
-
 		orig_node = gw_node->orig_node;
 		router = batadv_orig_router_get(orig_node, BATADV_IF_DEFAULT);
 		if (!router)
@@ -473,9 +470,6 @@ batadv_gw_node_get(struct batadv_priv *bat_priv,
 		if (gw_node_tmp->orig_node != orig_node)
 			continue;
 
-		if (gw_node_tmp->deleted)
-			continue;
-
 		if (!atomic_inc_not_zero(&gw_node_tmp->refcount))
 			continue;
 
@@ -525,9 +519,7 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv,
 	gw_node->bandwidth_down = ntohl(gateway->bandwidth_down);
 	gw_node->bandwidth_up = ntohl(gateway->bandwidth_up);
 
-	gw_node->deleted = 0;
 	if (ntohl(gateway->bandwidth_down) == 0) {
-		gw_node->deleted = jiffies;
 		batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
 			   "Gateway %pM removed from gateway list\n",
 			   orig_node->orig);
@@ -535,14 +527,21 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv,
 		/* Note: We don't need a NULL check here, since curr_gw never
 		 * gets dereferenced.
 		 */
+		spin_lock_bh(&bat_priv->gw.list_lock);
+		hlist_del_init_rcu(&gw_node->list);
+		spin_unlock_bh(&bat_priv->gw.list_lock);
+
+		batadv_gw_node_free_ref(gw_node);
+
 		curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
 		if (gw_node == curr_gw)
 			batadv_gw_reselect(bat_priv);
+
+		if (curr_gw)
+			batadv_gw_node_free_ref(curr_gw);
 	}
 
 out:
-	if (curr_gw)
-		batadv_gw_node_free_ref(curr_gw);
 	if (gw_node)
 		batadv_gw_node_free_ref(gw_node);
 }
@@ -558,39 +557,19 @@ void batadv_gw_node_delete(struct batadv_priv *bat_priv,
 	batadv_gw_node_update(bat_priv, orig_node, &gateway);
 }
 
-void batadv_gw_node_purge(struct batadv_priv *bat_priv)
+void batadv_gw_node_free(struct batadv_priv *bat_priv)
 {
-	struct batadv_gw_node *gw_node, *curr_gw;
+	struct batadv_gw_node *gw_node;
 	struct hlist_node *node_tmp;
-	unsigned long timeout = msecs_to_jiffies(2 * BATADV_PURGE_TIMEOUT);
-	int do_reselect = 0;
-
-	curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
 
 	spin_lock_bh(&bat_priv->gw.list_lock);
-
 	hlist_for_each_entry_safe(gw_node, node_tmp,
 				  &bat_priv->gw.list, list) {
-		if (((!gw_node->deleted) ||
-		     (time_before(jiffies, gw_node->deleted + timeout))) &&
-		    atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE)
-			continue;
 
-		if (curr_gw == gw_node)
-			do_reselect = 1;
-
-		hlist_del_rcu(&gw_node->list);
+		hlist_del_init_rcu(&gw_node->list);
 		batadv_gw_node_free_ref(gw_node);
 	}
-
 	spin_unlock_bh(&bat_priv->gw.list_lock);
-
-	/* gw_reselect() needs to acquire the gw_list_lock */
-	if (do_reselect)
-		batadv_gw_reselect(bat_priv);
-
-	if (curr_gw)
-		batadv_gw_node_free_ref(curr_gw);
 }
 
 /* fails if orig_node has no router */
@@ -654,9 +633,6 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
 
 	rcu_read_lock();
 	hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
-		if (gw_node->deleted)
-			continue;
-
 		/* fails if orig_node has no router */
 		if (batadv_write_buffer_text(bat_priv, seq, gw_node) < 0)
 			continue;
diff --git a/net/batman-adv/gateway_client.h b/net/batman-adv/gateway_client.h
index ef4d7e3..fa95277 100644
--- a/net/batman-adv/gateway_client.h
+++ b/net/batman-adv/gateway_client.h
@@ -38,7 +38,7 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv,
 			   struct batadv_tvlv_gateway_data *gateway);
 void batadv_gw_node_delete(struct batadv_priv *bat_priv,
 			   struct batadv_orig_node *orig_node);
-void batadv_gw_node_purge(struct batadv_priv *bat_priv);
+void batadv_gw_node_free(struct batadv_priv *bat_priv);
 int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset);
 bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, struct sk_buff *skb);
 enum batadv_dhcp_recipient
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index e61c5f3..d7f17c1 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -199,7 +199,7 @@ void batadv_mesh_free(struct net_device *soft_iface)
 
 	batadv_purge_outstanding_packets(bat_priv, NULL);
 
-	batadv_gw_node_purge(bat_priv);
+	batadv_gw_node_free(bat_priv);
 	batadv_nc_mesh_free(bat_priv);
 	batadv_dat_free(bat_priv);
 	batadv_bla_free(bat_priv);
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index f751775..d6d9809 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -1028,7 +1028,6 @@ static void _batadv_purge_orig(struct batadv_priv *bat_priv)
 		spin_unlock_bh(list_lock);
 	}
 
-	batadv_gw_node_purge(bat_priv);
 	batadv_gw_election(bat_priv);
 }
 
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 2f5e6c3..d260efd 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -328,7 +328,6 @@ enum batadv_orig_capabilities {
  * @orig_node: pointer to corresponding orig node
  * @bandwidth_down: advertised uplink download bandwidth
  * @bandwidth_up: advertised uplink upload bandwidth
- * @deleted: this struct is scheduled for deletion
  * @refcount: number of contexts the object is used
  * @rcu: struct used for freeing in an RCU-safe manner
  */
@@ -337,7 +336,6 @@ struct batadv_gw_node {
 	struct batadv_orig_node *orig_node;
 	u32 bandwidth_down;
 	u32 bandwidth_up;
-	unsigned long deleted;
 	atomic_t refcount;
 	struct rcu_head rcu;
 };
-- 
2.5.0


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

* [B.A.T.M.A.N.] [PATCH 05/10] batman-adv: rearrange batadv_neigh_node_new() arguments to follow convention
  2015-08-28  9:12 [B.A.T.M.A.N.] pull request: batman-adv 20150828 Antonio Quartulli
                   ` (3 preceding siblings ...)
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 04/10] batman-adv: remove obsolete deleted attribute for gateway node Antonio Quartulli
@ 2015-08-28  9:12 ` Antonio Quartulli
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 06/10] batman-adv: fix gateway client style issues Antonio Quartulli
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Antonio Quartulli @ 2015-08-28  9:12 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Antonio Quartulli

From: Marek Lindner <mareklindner@neomailbox.ch>

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
 net/batman-adv/bat_iv_ogm.c | 2 +-
 net/batman-adv/originator.c | 7 ++++---
 net/batman-adv/originator.h | 5 +++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 5e93af4..912d9c3 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -298,7 +298,7 @@ batadv_iv_ogm_neigh_new(struct batadv_hard_iface *hard_iface,
 {
 	struct batadv_neigh_node *neigh_node;
 
-	neigh_node = batadv_neigh_node_new(hard_iface, neigh_addr, orig_node);
+	neigh_node = batadv_neigh_node_new(orig_node, hard_iface, neigh_addr);
 	if (!neigh_node)
 		goto out;
 
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index d6d9809..099a84a 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -444,16 +444,17 @@ out:
 
 /**
  * batadv_neigh_node_new - create and init a new neigh_node object
+ * @orig_node: originator object representing the neighbour
  * @hard_iface: the interface where the neighbour is connected to
  * @neigh_addr: the mac address of the neighbour interface
- * @orig_node: originator object representing the neighbour
  *
  * Allocates a new neigh_node object and initialises all the generic fields.
  * Returns the new object or NULL on failure.
  */
 struct batadv_neigh_node *
-batadv_neigh_node_new(struct batadv_hard_iface *hard_iface,
-		      const u8 *neigh_addr, struct batadv_orig_node *orig_node)
+batadv_neigh_node_new(struct batadv_orig_node *orig_node,
+		      struct batadv_hard_iface *hard_iface,
+		      const u8 *neigh_addr)
 {
 	struct batadv_neigh_node *neigh_node;
 
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h
index 3fc76f6..fde3438 100644
--- a/net/batman-adv/originator.h
+++ b/net/batman-adv/originator.h
@@ -46,8 +46,9 @@ batadv_neigh_node_get(const struct batadv_orig_node *orig_node,
 		      const struct batadv_hard_iface *hard_iface,
 		      const u8 *addr);
 struct batadv_neigh_node *
-batadv_neigh_node_new(struct batadv_hard_iface *hard_iface,
-		      const u8 *neigh_addr, struct batadv_orig_node *orig_node);
+batadv_neigh_node_new(struct batadv_orig_node *orig_node,
+		      struct batadv_hard_iface *hard_iface,
+		      const u8 *neigh_addr);
 void batadv_neigh_node_free_ref(struct batadv_neigh_node *neigh_node);
 struct batadv_neigh_node *
 batadv_orig_router_get(struct batadv_orig_node *orig_node,
-- 
2.5.0


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

* [B.A.T.M.A.N.] [PATCH 06/10] batman-adv: fix gateway client style issues
  2015-08-28  9:12 [B.A.T.M.A.N.] pull request: batman-adv 20150828 Antonio Quartulli
                   ` (4 preceding siblings ...)
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 05/10] batman-adv: rearrange batadv_neigh_node_new() arguments to follow convention Antonio Quartulli
@ 2015-08-28  9:12 ` Antonio Quartulli
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 07/10] batman-adv: Start new development cycle Antonio Quartulli
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Antonio Quartulli @ 2015-08-28  9:12 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Antonio Quartulli

From: Simon Wunderlich <sw@simonwunderlich.de>

commit 0511575c4d03 ("batman-adv: remove obsolete deleted attribute for
gateway node") incorrectly added an empy line and forgot to remove an
include.

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
 net/batman-adv/gateway_client.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 634c7e3..e6c8382 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -27,7 +27,6 @@
 #include <linux/in.h>
 #include <linux/ip.h>
 #include <linux/ipv6.h>
-#include <linux/jiffies.h>
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/netdevice.h>
@@ -565,7 +564,6 @@ void batadv_gw_node_free(struct batadv_priv *bat_priv)
 	spin_lock_bh(&bat_priv->gw.list_lock);
 	hlist_for_each_entry_safe(gw_node, node_tmp,
 				  &bat_priv->gw.list, list) {
-
 		hlist_del_init_rcu(&gw_node->list);
 		batadv_gw_node_free_ref(gw_node);
 	}
-- 
2.5.0


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

* [B.A.T.M.A.N.] [PATCH 07/10] batman-adv: Start new development cycle
  2015-08-28  9:12 [B.A.T.M.A.N.] pull request: batman-adv 20150828 Antonio Quartulli
                   ` (5 preceding siblings ...)
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 06/10] batman-adv: fix gateway client style issues Antonio Quartulli
@ 2015-08-28  9:12 ` Antonio Quartulli
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 08/10] batman-adv: don't access unregistered net_device object Antonio Quartulli
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Antonio Quartulli @ 2015-08-28  9:12 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Antonio Quartulli

From: Simon Wunderlich <sw@simonwunderlich.de>

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
 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 78500ac..ebd8af0 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 "2015.1"
+#define BATADV_SOURCE_VERSION "2015.2"
 #endif
 
 /* B.A.T.M.A.N. parameters */
-- 
2.5.0


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

* [B.A.T.M.A.N.] [PATCH 08/10] batman-adv: don't access unregistered net_device object
  2015-08-28  9:12 [B.A.T.M.A.N.] pull request: batman-adv 20150828 Antonio Quartulli
                   ` (6 preceding siblings ...)
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 07/10] batman-adv: Start new development cycle Antonio Quartulli
@ 2015-08-28  9:12 ` Antonio Quartulli
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 09/10] batman-adv: Add lower layer needed_(head|tail)room to own ones Antonio Quartulli
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Antonio Quartulli @ 2015-08-28  9:12 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Antonio Quartulli

In batadv_hardif_disable_interface() there is a call to
batadv_softif_destroy_sysfs() which in turns invokes
unregister_netdevice() on the soft_iface.
After this point we cannot rely on the soft_iface object
anymore because it might get free'd by the netdev periodic
routine at any time.

For this reason the netdev_upper_dev_unlink(.., soft_iface) call
is moved before the invocation of batadv_softif_destroy_sysfs() so
that we can be sure that the soft_iface object is still valid.

Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
---
 net/batman-adv/hard-interface.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index f4a15d2..0565b20 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -528,6 +528,8 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
 	batadv_purge_outstanding_packets(bat_priv, hard_iface);
 	dev_put(hard_iface->soft_iface);
 
+	netdev_upper_dev_unlink(hard_iface->net_dev, hard_iface->soft_iface);
+
 	/* nobody uses this interface anymore */
 	if (!bat_priv->num_ifaces) {
 		batadv_gw_check_client_stop(bat_priv);
@@ -536,7 +538,6 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
 			batadv_softif_destroy_sysfs(hard_iface->soft_iface);
 	}
 
-	netdev_upper_dev_unlink(hard_iface->net_dev, hard_iface->soft_iface);
 	hard_iface->soft_iface = NULL;
 	batadv_hardif_free_ref(hard_iface);
 
-- 
2.5.0


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

* [B.A.T.M.A.N.] [PATCH 09/10] batman-adv: Add lower layer needed_(head|tail)room to own ones
  2015-08-28  9:12 [B.A.T.M.A.N.] pull request: batman-adv 20150828 Antonio Quartulli
                   ` (7 preceding siblings ...)
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 08/10] batman-adv: don't access unregistered net_device object Antonio Quartulli
@ 2015-08-28  9:12 ` Antonio Quartulli
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 10/10] batman-adv: turn batadv_neigh_node_get() into local function Antonio Quartulli
  2015-08-28 20:44 ` [B.A.T.M.A.N.] pull request: batman-adv 20150828 David Miller
  10 siblings, 0 replies; 12+ messages in thread
From: Antonio Quartulli @ 2015-08-28  9:12 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Antonio Quartulli, Marek Lindner

From: Sven Eckelmann <sven@narfation.org>

The maximum of hard_header_len and maximum of all needed_(head|tail)room of
all slave interfaces of a batman-adv device must be used to define the
batman-adv device needed_(head|tail)room. This is required to avoid too
small buffer problems when these slave devices try to send the encapsulated
packet in a tx path without the possibility to resize the skbuff.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
 net/batman-adv/hard-interface.c | 41 +++++++++++++++++++++++++++++++++++++++++
 net/batman-adv/soft-interface.c |  2 --
 2 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 0565b20..f11345e 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -252,6 +252,44 @@ static void batadv_check_known_mac_addr(const struct net_device *net_dev)
 	rcu_read_unlock();
 }
 
+/**
+ * batadv_hardif_recalc_extra_skbroom() - Recalculate skbuff extra head/tailroom
+ * @soft_iface: netdev struct of the mesh interface
+ */
+static void batadv_hardif_recalc_extra_skbroom(struct net_device *soft_iface)
+{
+	const struct batadv_hard_iface *hard_iface;
+	unsigned short lower_header_len = ETH_HLEN;
+	unsigned short lower_headroom = 0;
+	unsigned short lower_tailroom = 0;
+	unsigned short needed_headroom;
+
+	rcu_read_lock();
+	list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
+		if (hard_iface->if_status == BATADV_IF_NOT_IN_USE)
+			continue;
+
+		if (hard_iface->soft_iface != soft_iface)
+			continue;
+
+		lower_header_len = max_t(unsigned short, lower_header_len,
+					 hard_iface->net_dev->hard_header_len);
+
+		lower_headroom = max_t(unsigned short, lower_headroom,
+				       hard_iface->net_dev->needed_headroom);
+
+		lower_tailroom = max_t(unsigned short, lower_tailroom,
+				       hard_iface->net_dev->needed_tailroom);
+	}
+	rcu_read_unlock();
+
+	needed_headroom = lower_headroom + (lower_header_len - ETH_HLEN);
+	needed_headroom += batadv_max_header_len();
+
+	soft_iface->needed_headroom = needed_headroom;
+	soft_iface->needed_tailroom = lower_tailroom;
+}
+
 int batadv_hardif_min_mtu(struct net_device *soft_iface)
 {
 	struct batadv_priv *bat_priv = netdev_priv(soft_iface);
@@ -474,6 +512,8 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 			   "Not using interface %s (retrying later): interface not active\n",
 			   hard_iface->net_dev->name);
 
+	batadv_hardif_recalc_extra_skbroom(soft_iface);
+
 	/* begin scheduling originator messages on that interface */
 	batadv_schedule_bat_ogm(hard_iface);
 
@@ -529,6 +569,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
 	dev_put(hard_iface->soft_iface);
 
 	netdev_upper_dev_unlink(hard_iface->net_dev, hard_iface->soft_iface);
+	batadv_hardif_recalc_extra_skbroom(hard_iface->soft_iface);
 
 	/* nobody uses this interface anymore */
 	if (!bat_priv->num_ifaces) {
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index d5c5ad9..ac4d08d 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -947,8 +947,6 @@ static void batadv_softif_init_early(struct net_device *dev)
 	 * have not been initialized yet
 	 */
 	dev->mtu = ETH_DATA_LEN;
-	/* reserve more space in the skbuff for our header */
-	dev->hard_header_len = batadv_max_header_len();
 
 	/* generate random address */
 	eth_hw_addr_random(dev);
-- 
2.5.0


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

* [B.A.T.M.A.N.] [PATCH 10/10] batman-adv: turn batadv_neigh_node_get() into local function
  2015-08-28  9:12 [B.A.T.M.A.N.] pull request: batman-adv 20150828 Antonio Quartulli
                   ` (8 preceding siblings ...)
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 09/10] batman-adv: Add lower layer needed_(head|tail)room to own ones Antonio Quartulli
@ 2015-08-28  9:12 ` Antonio Quartulli
  2015-08-28 20:44 ` [B.A.T.M.A.N.] pull request: batman-adv 20150828 David Miller
  10 siblings, 0 replies; 12+ messages in thread
From: Antonio Quartulli @ 2015-08-28  9:12 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Antonio Quartulli

From: Marek Lindner <mareklindner@neomailbox.ch>

commit c214ebe1eb29 ("batman-adv: move neigh_node list add into
batadv_neigh_node_new()") removed external calls to
batadv_neigh_node_get().

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
 net/batman-adv/originator.c | 72 ++++++++++++++++++++++-----------------------
 net/batman-adv/originator.h |  4 ---
 2 files changed, 36 insertions(+), 40 deletions(-)

diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 099a84a..7486df9 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -443,6 +443,42 @@ out:
 }
 
 /**
+ * batadv_neigh_node_get - retrieve a neighbour from the list
+ * @orig_node: originator which the neighbour belongs to
+ * @hard_iface: the interface where this neighbour is connected to
+ * @addr: the address of the neighbour
+ *
+ * Looks for and possibly returns a neighbour belonging to this originator list
+ * which is connected through the provided hard interface.
+ * Returns NULL if the neighbour is not found.
+ */
+static struct batadv_neigh_node *
+batadv_neigh_node_get(const struct batadv_orig_node *orig_node,
+		      const struct batadv_hard_iface *hard_iface,
+		      const u8 *addr)
+{
+	struct batadv_neigh_node *tmp_neigh_node, *res = NULL;
+
+	rcu_read_lock();
+	hlist_for_each_entry_rcu(tmp_neigh_node, &orig_node->neigh_list, list) {
+		if (!batadv_compare_eth(tmp_neigh_node->addr, addr))
+			continue;
+
+		if (tmp_neigh_node->if_incoming != hard_iface)
+			continue;
+
+		if (!atomic_inc_not_zero(&tmp_neigh_node->refcount))
+			continue;
+
+		res = tmp_neigh_node;
+		break;
+	}
+	rcu_read_unlock();
+
+	return res;
+}
+
+/**
  * batadv_neigh_node_new - create and init a new neigh_node object
  * @orig_node: originator object representing the neighbour
  * @hard_iface: the interface where the neighbour is connected to
@@ -496,42 +532,6 @@ out:
 }
 
 /**
- * batadv_neigh_node_get - retrieve a neighbour from the list
- * @orig_node: originator which the neighbour belongs to
- * @hard_iface: the interface where this neighbour is connected to
- * @addr: the address of the neighbour
- *
- * Looks for and possibly returns a neighbour belonging to this originator list
- * which is connected through the provided hard interface.
- * Returns NULL if the neighbour is not found.
- */
-struct batadv_neigh_node *
-batadv_neigh_node_get(const struct batadv_orig_node *orig_node,
-		      const struct batadv_hard_iface *hard_iface,
-		      const u8 *addr)
-{
-	struct batadv_neigh_node *tmp_neigh_node, *res = NULL;
-
-	rcu_read_lock();
-	hlist_for_each_entry_rcu(tmp_neigh_node, &orig_node->neigh_list, list) {
-		if (!batadv_compare_eth(tmp_neigh_node->addr, addr))
-			continue;
-
-		if (tmp_neigh_node->if_incoming != hard_iface)
-			continue;
-
-		if (!atomic_inc_not_zero(&tmp_neigh_node->refcount))
-			continue;
-
-		res = tmp_neigh_node;
-		break;
-	}
-	rcu_read_unlock();
-
-	return res;
-}
-
-/**
  * batadv_orig_ifinfo_free_rcu - free the orig_ifinfo object
  * @rcu: rcu pointer of the orig_ifinfo object
  */
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h
index fde3438..fa18f9b 100644
--- a/net/batman-adv/originator.h
+++ b/net/batman-adv/originator.h
@@ -42,10 +42,6 @@ void batadv_orig_node_free_ref_now(struct batadv_orig_node *orig_node);
 struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv,
 					      const u8 *addr);
 struct batadv_neigh_node *
-batadv_neigh_node_get(const struct batadv_orig_node *orig_node,
-		      const struct batadv_hard_iface *hard_iface,
-		      const u8 *addr);
-struct batadv_neigh_node *
 batadv_neigh_node_new(struct batadv_orig_node *orig_node,
 		      struct batadv_hard_iface *hard_iface,
 		      const u8 *neigh_addr);
-- 
2.5.0


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

* Re: [B.A.T.M.A.N.] pull request: batman-adv 20150828
  2015-08-28  9:12 [B.A.T.M.A.N.] pull request: batman-adv 20150828 Antonio Quartulli
                   ` (9 preceding siblings ...)
  2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 10/10] batman-adv: turn batadv_neigh_node_get() into local function Antonio Quartulli
@ 2015-08-28 20:44 ` David Miller
  10 siblings, 0 replies; 12+ messages in thread
From: David Miller @ 2015-08-28 20:44 UTC (permalink / raw)
  To: antonio; +Cc: netdev, b.a.t.m.a.n

From: Antonio Quartulli <antonio@meshcoding.com>
Date: Fri, 28 Aug 2015 11:12:26 +0200

> this is our very last batch of patches intended for net-next/linux-4.3
> 
> It includes again 2 non-critical fixes which we couldn't send to net
> and then the rest is just code restyling and beautification. No
> major behavioural change was introduced.
> 
> Please pull or let me know of any problem!

Pulled, thanks Antonio.

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

end of thread, other threads:[~2015-08-28 20:44 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-28  9:12 [B.A.T.M.A.N.] pull request: batman-adv 20150828 Antonio Quartulli
2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 01/10] batman-adv: move hardif refcount inc to batadv_neigh_node_new() Antonio Quartulli
2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 02/10] batman-adv: remove redundant hard_iface assignment Antonio Quartulli
2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 03/10] batman-adv: move neigh_node list add into batadv_neigh_node_new() Antonio Quartulli
2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 04/10] batman-adv: remove obsolete deleted attribute for gateway node Antonio Quartulli
2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 05/10] batman-adv: rearrange batadv_neigh_node_new() arguments to follow convention Antonio Quartulli
2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 06/10] batman-adv: fix gateway client style issues Antonio Quartulli
2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 07/10] batman-adv: Start new development cycle Antonio Quartulli
2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 08/10] batman-adv: don't access unregistered net_device object Antonio Quartulli
2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 09/10] batman-adv: Add lower layer needed_(head|tail)room to own ones Antonio Quartulli
2015-08-28  9:12 ` [B.A.T.M.A.N.] [PATCH 10/10] batman-adv: turn batadv_neigh_node_get() into local function Antonio Quartulli
2015-08-28 20:44 ` [B.A.T.M.A.N.] pull request: batman-adv 20150828 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).