]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
batman-adv: send each broadcast only once on non-wireless interfaces
authorMatthias Schiffer <mschiffer@universe-factory.net>
Sat, 9 Mar 2013 22:14:23 +0000 (23:14 +0100)
committerAntonio Quartulli <ordex@autistici.org>
Wed, 29 May 2013 00:44:53 +0000 (02:44 +0200)
While it makes sense to send each broadcast thrice on 802.11 (WLAN) interfaces
as broadcasts are often unreliable on these, there is no reason to do so on
other interface types.

The increased the overhead can be harmful on low-bandwidth links like VPN
connections over slow internet lines, therefore it is better to reduce the
number of broadcast packets sent on non-wireless links to one.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
net/batman-adv/hard-interface.c
net/batman-adv/main.h
net/batman-adv/send.c
net/batman-adv/types.h

index d5ec67b632530f9e3a772f929b83768cdcd8a171..4a76ed654c924132e558598a03b9e0edb17a971d 100644 (file)
@@ -593,6 +593,10 @@ batadv_hardif_add_interface(struct net_device *net_dev)
        INIT_WORK(&hard_iface->cleanup_work,
                  batadv_hardif_remove_interface_finish);
 
+       hard_iface->num_bcasts = BATADV_NUM_BCASTS_DEFAULT;
+       if (batadv_is_wifi_netdev(net_dev))
+               hard_iface->num_bcasts = BATADV_NUM_BCASTS_WIRELESS;
+
        /* extra reference for return */
        atomic_set(&hard_iface->refcount, 2);
 
index 59a0d6af15c88aca2f05c0883fc2fdfeadea66f4..ea1a3bafe9c3ae21bac3acab8f15c341be1eb475 100644 (file)
 
 #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_WIRELESS 3
+#define BATADV_NUM_BCASTS_MAX 3
+
 /* msecs after which an ARP_REQUEST is sent in broadcast as fallback */
 #define ARP_REQ_DELAY 250
 /* numbers of originator to contact for any PUT/GET DHT operation */
index 263cfd1ccee78dfdf66c0f102d66301b8700a46d..eb16b04d4bee25f80229102a13ddb09350c05e3f 100644 (file)
@@ -260,6 +260,9 @@ 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)
+                       continue;
+
                /* send a copy of the saved skb */
                skb1 = skb_clone(forw_packet->skb, GFP_ATOMIC);
                if (skb1)
@@ -271,7 +274,7 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
        forw_packet->num_packets++;
 
        /* if we still have some more bcasts to send */
-       if (forw_packet->num_packets < 3) {
+       if (forw_packet->num_packets < BATADV_NUM_BCASTS_MAX) {
                _batadv_add_bcast_packet_to_list(bat_priv, forw_packet,
                                                 msecs_to_jiffies(5));
                return;
index aba8364c368991935ab5f9899266a6662f925618..5f542bdd9a4d01c1386ef4162fb627d5849ea41d 100644 (file)
@@ -61,6 +61,7 @@ struct batadv_hard_iface_bat_iv {
  * @if_status: status of the interface for batman-adv
  * @net_dev: pointer to the net_device
  * @frag_seqno: last fragment sequence number sent by this interface
+ * @num_bcasts: number of payload re-broadcasts on this interface (ARQ)
  * @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
@@ -76,6 +77,7 @@ struct batadv_hard_iface {
        char if_status;
        struct net_device *net_dev;
        atomic_t frag_seqno;
+       uint8_t num_bcasts;
        struct kobject *hardif_obj;
        atomic_t refcount;
        struct packet_type batman_adv_ptype;