All of lore.kernel.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: B.A.T.M.A.N V - make sure iface is reactivated upon NETDEV_UP event
@ 2016-04-13 19:34 Antonio Quartulli
  2016-04-13 20:32 ` Sven Eckelmann
  0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2016-04-13 19:34 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

At the moment there is no explicit reactivation of an hard-interface
upon NETDEV_UP event. In case of B.A.T.M.A.N. IV the interface is
reactivated as soon as the next OGM is scheduled for sending, but this
mechanism does not work with B.A.T.M.A.N. V. The latter does not rely
on the same scheduling mechanism as its predecessor and for this reason
the hard-interface remains deactivated forever after being brought down
once.

This patch fixes the reactivation mechanism by adding a new routing API
which explicitly allows each algorithm to perform any needed operation
upon interface re-activation.

Such API is optional and is implemented by B.A.T.M.A.N. V only and it
just takes care of setting the iface status to ACTIVE

Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 net/batman-adv/bat_v.c          | 12 ++++++++++++
 net/batman-adv/hard-interface.c |  3 +++
 net/batman-adv/types.h          |  1 +
 3 files changed, 16 insertions(+)

diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
index 3315b9a..4026f19 100644
--- a/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -32,10 +32,21 @@
 
 #include "bat_v_elp.h"
 #include "bat_v_ogm.h"
+#include "hard-interface.h"
 #include "hash.h"
 #include "originator.h"
 #include "packet.h"
 
+static void batadv_v_iface_activate(struct batadv_hard_iface *hard_iface)
+{
+	/* B.A.T.M.A.N. V does not use any queuing mechanism, therefore it can
+	 * set the interface as ACTIVE right away, without any risk of race
+	 * condition
+	 */
+	if (hard_iface->if_status == BATADV_IF_TO_BE_ACTIVATED)
+		hard_iface->if_status = BATADV_IF_ACTIVE;
+}
+
 static int batadv_v_iface_enable(struct batadv_hard_iface *hard_iface)
 {
 	int ret;
@@ -274,6 +285,7 @@ static bool batadv_v_neigh_is_sob(struct batadv_neigh_node *neigh1,
 
 static struct batadv_algo_ops batadv_batman_v __read_mostly = {
 	.name = "BATMAN_V",
+	.bat_iface_activate = batadv_v_iface_activate,
 	.bat_iface_enable = batadv_v_iface_enable,
 	.bat_iface_disable = batadv_v_iface_disable,
 	.bat_iface_update_mac = batadv_v_iface_update_mac,
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index c61d5b0..0a7deaf 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -407,6 +407,9 @@ batadv_hardif_activate_interface(struct batadv_hard_iface *hard_iface)
 
 	batadv_update_min_mtu(hard_iface->soft_iface);
 
+	if (bat_priv->bat_algo_ops->bat_iface_activate)
+		bat_priv->bat_algo_ops->bat_iface_activate(hard_iface);
+
 out:
 	if (primary_if)
 		batadv_hardif_put(primary_if);
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 9abfb3e..316af66 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -1277,6 +1277,7 @@ struct batadv_forw_packet {
 struct batadv_algo_ops {
 	struct hlist_node list;
 	char *name;
+	void (*bat_iface_activate)(struct batadv_hard_iface *hard_iface);
 	int (*bat_iface_enable)(struct batadv_hard_iface *hard_iface);
 	void (*bat_iface_disable)(struct batadv_hard_iface *hard_iface);
 	void (*bat_iface_update_mac)(struct batadv_hard_iface *hard_iface);
-- 
2.8.1


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

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: B.A.T.M.A.N V - make sure iface is reactivated upon NETDEV_UP event
  2016-04-13 19:34 [B.A.T.M.A.N.] [PATCH] batman-adv: B.A.T.M.A.N V - make sure iface is reactivated upon NETDEV_UP event Antonio Quartulli
@ 2016-04-13 20:32 ` Sven Eckelmann
  2016-04-14  1:39   ` Antonio Quartulli
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Eckelmann @ 2016-04-13 20:32 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

[-- Attachment #1: Type: text/plain, Size: 693 bytes --]

On Thursday 14 April 2016 03:34:47 Antonio Quartulli wrote:
[...]
> diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
> index 9abfb3e..316af66 100644
> --- a/net/batman-adv/types.h
> +++ b/net/batman-adv/types.h
> @@ -1277,6 +1277,7 @@ struct batadv_forw_packet {
>  struct batadv_algo_ops {
>  	struct hlist_node list;
>  	char *name;
> +	void (*bat_iface_activate)(struct batadv_hard_iface *hard_iface);
>  	int (*bat_iface_enable)(struct batadv_hard_iface *hard_iface);
>  	void (*bat_iface_disable)(struct batadv_hard_iface *hard_iface);
>  	void (*bat_iface_update_mac)(struct batadv_hard_iface *hard_iface);

kernel-doc is missing for @bat_iface_activate

Kind regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: B.A.T.M.A.N V - make sure iface is reactivated upon NETDEV_UP event
  2016-04-13 20:32 ` Sven Eckelmann
@ 2016-04-14  1:39   ` Antonio Quartulli
  0 siblings, 0 replies; 3+ messages in thread
From: Antonio Quartulli @ 2016-04-14  1:39 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 869 bytes --]

On Wed, Apr 13, 2016 at 10:32:43PM +0200, Sven Eckelmann wrote:
> On Thursday 14 April 2016 03:34:47 Antonio Quartulli wrote:
> [...]
> > diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
> > index 9abfb3e..316af66 100644
> > --- a/net/batman-adv/types.h
> > +++ b/net/batman-adv/types.h
> > @@ -1277,6 +1277,7 @@ struct batadv_forw_packet {
> >  struct batadv_algo_ops {
> >  	struct hlist_node list;
> >  	char *name;
> > +	void (*bat_iface_activate)(struct batadv_hard_iface *hard_iface);
> >  	int (*bat_iface_enable)(struct batadv_hard_iface *hard_iface);
> >  	void (*bat_iface_disable)(struct batadv_hard_iface *hard_iface);
> >  	void (*bat_iface_update_mac)(struct batadv_hard_iface *hard_iface);
> 
> kernel-doc is missing for @bat_iface_activate

Thanks Sven, I sent v2 with the kerneldoc

Cheers,


-- 
Antonio Quartulli

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2016-04-14  1:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-13 19:34 [B.A.T.M.A.N.] [PATCH] batman-adv: B.A.T.M.A.N V - make sure iface is reactivated upon NETDEV_UP event Antonio Quartulli
2016-04-13 20:32 ` Sven Eckelmann
2016-04-14  1:39   ` Antonio Quartulli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.