public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [RFC 1/2] batman-adv: Split the setting for number re-broadcasts
@ 2016-03-30 12:19 Sven Eckelmann
  2016-03-30 12:19 ` [B.A.T.M.A.N.] [RFC 2/2] batman-adv: Don't re-broadcast packets on non-wifi devices Sven Eckelmann
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Eckelmann @ 2016-03-30 12:19 UTC (permalink / raw)
  To: b.a.t.m.a.n

The number of rebroadcasts are currently not differenciated between
re-broadcasts on the same interface and the re-broadcasts on a different
interface. This differenciation can be important when the link medium
already guarantees to some extend that a packet received by one participant
is also received by all other participants.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 net/batman-adv/hard-interface.c | 10 +++++++---
 net/batman-adv/main.h           |  3 ++-
 net/batman-adv/send.c           |  8 +++++++-
 net/batman-adv/types.h          |  8 ++++++--
 4 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index f41b472..a8385fa 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -678,9 +678,13 @@ batadv_hardif_add_interface(struct net_device *net_dev)
 
 	spin_lock_init(&hard_iface->neigh_list_lock);
 
-	hard_iface->num_bcasts = BATADV_NUM_BCASTS_DEFAULT;
-	if (batadv_is_wifi_netdev(net_dev))
-		hard_iface->num_bcasts = BATADV_NUM_BCASTS_WIRELESS;
+	if (batadv_is_wifi_netdev(net_dev)) {
+		hard_iface->num_bcasts_sameif = BATADV_NUM_BCASTS_WIRELESS;
+		hard_iface->num_bcasts_otherif = BATADV_NUM_BCASTS_WIRELESS;
+	} else {
+		hard_iface->num_bcasts_sameif = BATADV_NUM_BCASTS_SAMEIF;
+		hard_iface->num_bcasts_otherif = BATADV_NUM_BCASTS_OTHERIF;
+	}
 
 	/* extra reference for return */
 	kref_init(&hard_iface->refcount);
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 1565df0..aad4a3a 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -96,7 +96,8 @@
 #define BATADV_LOG_BUF_LEN 8192	  /* has to be a power of 2 */
 
 /* number of packets to send for broadcasts on different interface types */
-#define BATADV_NUM_BCASTS_DEFAULT 1
+#define BATADV_NUM_BCASTS_SAMEIF 1
+#define BATADV_NUM_BCASTS_OTHERIF 1
 #define BATADV_NUM_BCASTS_WIRELESS 3
 #define BATADV_NUM_BCASTS_MAX 3
 
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 2e8433b..724bd6e 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -552,6 +552,7 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
 	struct sk_buff *skb1;
 	struct net_device *soft_iface;
 	struct batadv_priv *bat_priv;
+	u8 num_bcasts;
 
 	delayed_work = to_delayed_work(work);
 	forw_packet = container_of(delayed_work, struct batadv_forw_packet,
@@ -575,7 +576,12 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
 		if (hard_iface->soft_iface != soft_iface)
 			continue;
 
-		if (forw_packet->num_packets >= hard_iface->num_bcasts)
+		if (forw_packet->skb->dev == hard_iface->net_dev)
+			num_bcasts = hard_iface->num_bcasts_sameif;
+		else
+			num_bcasts = hard_iface->num_bcasts_otherif;
+
+		if (forw_packet->num_packets >= num_bcasts)
 			continue;
 
 		if (!kref_get_unless_zero(&hard_iface->refcount))
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 9abfb3e..5e80113 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -122,7 +122,10 @@ struct batadv_hard_iface_bat_v {
  * @if_num: identificator of the interface
  * @if_status: status of the interface for batman-adv
  * @net_dev: pointer to the net_device
- * @num_bcasts: number of payload re-broadcasts on this interface (ARQ)
+ * @num_bcasts_sameif: number of payload re-broadcasts on this interface (ARQ)
+ *  when the packet was received on this interface
+ * @num_bcasts_otherif: number of payload re-broadcasts on this interface (ARQ)
+ *  when the packet was received on a different interface
  * @hardif_obj: kobject of the per interface sysfs "mesh" directory
  * @refcount: number of contexts the object is used
  * @batman_adv_ptype: packet type describing packets that should be processed by
@@ -141,7 +144,8 @@ struct batadv_hard_iface {
 	s16 if_num;
 	char if_status;
 	struct net_device *net_dev;
-	u8 num_bcasts;
+	u8 num_bcasts_sameif;
+	u8 num_bcasts_otherif;
 	struct kobject *hardif_obj;
 	struct kref refcount;
 	struct packet_type batman_adv_ptype;
-- 
2.8.0.rc3


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

* [B.A.T.M.A.N.] [RFC 2/2] batman-adv: Don't re-broadcast packets on non-wifi devices
  2016-03-30 12:19 [B.A.T.M.A.N.] [RFC 1/2] batman-adv: Split the setting for number re-broadcasts Sven Eckelmann
@ 2016-03-30 12:19 ` Sven Eckelmann
  2016-03-31  8:41   ` Matthias Schiffer
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Eckelmann @ 2016-03-30 12:19 UTC (permalink / raw)
  To: b.a.t.m.a.n

It is not necessary to re-broadcast a received broadcast packet on the
rx-device when it is a standard ethernet device. The link medium already
takes care of transporting it to all participants in the broadcast domain.

The re-broadcast on other devices is still necessary to allow the broadcast
packet to be received by devices which are using a different link medium.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 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 aad4a3a..ddad99d 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -96,7 +96,7 @@
 #define BATADV_LOG_BUF_LEN 8192	  /* has to be a power of 2 */
 
 /* number of packets to send for broadcasts on different interface types */
-#define BATADV_NUM_BCASTS_SAMEIF 1
+#define BATADV_NUM_BCASTS_SAMEIF 0
 #define BATADV_NUM_BCASTS_OTHERIF 1
 #define BATADV_NUM_BCASTS_WIRELESS 3
 #define BATADV_NUM_BCASTS_MAX 3
-- 
2.8.0.rc3


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

* Re: [B.A.T.M.A.N.] [RFC 2/2] batman-adv: Don't re-broadcast packets on non-wifi devices
  2016-03-30 12:19 ` [B.A.T.M.A.N.] [RFC 2/2] batman-adv: Don't re-broadcast packets on non-wifi devices Sven Eckelmann
@ 2016-03-31  8:41   ` Matthias Schiffer
  2016-03-31  9:07     ` Sven Eckelmann
  0 siblings, 1 reply; 4+ messages in thread
From: Matthias Schiffer @ 2016-03-31  8:41 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking


[-- Attachment #1.1: Type: text/plain, Size: 960 bytes --]

On 03/30/2016 02:19 PM, Sven Eckelmann wrote:
> It is not necessary to re-broadcast a received broadcast packet on the
> rx-device when it is a standard ethernet device. The link medium already
> takes care of transporting it to all participants in the broadcast domain.
> 
> The re-broadcast on other devices is still necessary to allow the broadcast
> packet to be received by devices which are using a different link medium.
> 
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---

I don't think completely disabling the rebroadcast here without a way to
enable it again is a viable option.

At least when using batman-adv over VPN tunnels, making batman-adv take
care of establishing transitive connectivity may make sense, as batman-adv
does this very well and without much configuration. This is actually the
recommended setup for non-full-mesh setups using the VPN tool fastd (which
is developed by me.)

Regards,
Matthias


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

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

* Re: [B.A.T.M.A.N.] [RFC 2/2] batman-adv: Don't re-broadcast packets on non-wifi devices
  2016-03-31  8:41   ` Matthias Schiffer
@ 2016-03-31  9:07     ` Sven Eckelmann
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Eckelmann @ 2016-03-31  9:07 UTC (permalink / raw)
  To: b.a.t.m.a.n

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

On Thursday 31 March 2016 10:41:04 Matthias Schiffer wrote:
[...]
> I don't think completely disabling the rebroadcast here without a way to
> enable it again is a viable option.
> 
> At least when using batman-adv over VPN tunnels, making batman-adv take
> care of establishing transitive connectivity may make sense, as batman-adv
> does this very well and without much configuration. This is actually the
> recommended setup for non-full-mesh setups using the VPN tool fastd (which
> is developed by me.)

Thanks for the feedback. There was also a small questionnaire answered by
Adrian Reyer about fastd:
https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2016-March/014803.html

Kind regards,
	Sven

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

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

end of thread, other threads:[~2016-03-31  9:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-30 12:19 [B.A.T.M.A.N.] [RFC 1/2] batman-adv: Split the setting for number re-broadcasts Sven Eckelmann
2016-03-30 12:19 ` [B.A.T.M.A.N.] [RFC 2/2] batman-adv: Don't re-broadcast packets on non-wifi devices Sven Eckelmann
2016-03-31  8:41   ` Matthias Schiffer
2016-03-31  9:07     ` Sven Eckelmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox