summaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-03-09 17:14:23 -0500
committerAntonio Quartulli <ordex@autistici.org>2013-05-28 20:44:53 -0400
commitcaf65bfcc5dbabd7222fa45fdcd42ce0783d7a42 (patch)
treebb338fcf3987a38680336278c43bb6c1ccdb7b39 /net/batman-adv
parentde68d1003d9eb0a5f7d4714315614e4bc956f68e (diff)
batman-adv: send each broadcast only once on non-wireless interfaces
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>
Diffstat (limited to 'net/batman-adv')
-rw-r--r--net/batman-adv/hard-interface.c4
-rw-r--r--net/batman-adv/main.h5
-rw-r--r--net/batman-adv/send.c5
-rw-r--r--net/batman-adv/types.h2
4 files changed, 15 insertions, 1 deletions
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index d5ec67b63253..4a76ed654c92 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -593,6 +593,10 @@ batadv_hardif_add_interface(struct net_device *net_dev)
593 INIT_WORK(&hard_iface->cleanup_work, 593 INIT_WORK(&hard_iface->cleanup_work,
594 batadv_hardif_remove_interface_finish); 594 batadv_hardif_remove_interface_finish);
595 595
596 hard_iface->num_bcasts = BATADV_NUM_BCASTS_DEFAULT;
597 if (batadv_is_wifi_netdev(net_dev))
598 hard_iface->num_bcasts = BATADV_NUM_BCASTS_WIRELESS;
599
596 /* extra reference for return */ 600 /* extra reference for return */
597 atomic_set(&hard_iface->refcount, 2); 601 atomic_set(&hard_iface->refcount, 2);
598 602
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 59a0d6af15c8..ea1a3bafe9c3 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -76,6 +76,11 @@
76 76
77#define BATADV_LOG_BUF_LEN 8192 /* has to be a power of 2 */ 77#define BATADV_LOG_BUF_LEN 8192 /* has to be a power of 2 */
78 78
79/* number of packets to send for broadcasts on different interface types */
80#define BATADV_NUM_BCASTS_DEFAULT 1
81#define BATADV_NUM_BCASTS_WIRELESS 3
82#define BATADV_NUM_BCASTS_MAX 3
83
79/* msecs after which an ARP_REQUEST is sent in broadcast as fallback */ 84/* msecs after which an ARP_REQUEST is sent in broadcast as fallback */
80#define ARP_REQ_DELAY 250 85#define ARP_REQ_DELAY 250
81/* numbers of originator to contact for any PUT/GET DHT operation */ 86/* numbers of originator to contact for any PUT/GET DHT operation */
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 263cfd1ccee7..eb16b04d4bee 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -260,6 +260,9 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
260 if (hard_iface->soft_iface != soft_iface) 260 if (hard_iface->soft_iface != soft_iface)
261 continue; 261 continue;
262 262
263 if (forw_packet->num_packets >= hard_iface->num_bcasts)
264 continue;
265
263 /* send a copy of the saved skb */ 266 /* send a copy of the saved skb */
264 skb1 = skb_clone(forw_packet->skb, GFP_ATOMIC); 267 skb1 = skb_clone(forw_packet->skb, GFP_ATOMIC);
265 if (skb1) 268 if (skb1)
@@ -271,7 +274,7 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
271 forw_packet->num_packets++; 274 forw_packet->num_packets++;
272 275
273 /* if we still have some more bcasts to send */ 276 /* if we still have some more bcasts to send */
274 if (forw_packet->num_packets < 3) { 277 if (forw_packet->num_packets < BATADV_NUM_BCASTS_MAX) {
275 _batadv_add_bcast_packet_to_list(bat_priv, forw_packet, 278 _batadv_add_bcast_packet_to_list(bat_priv, forw_packet,
276 msecs_to_jiffies(5)); 279 msecs_to_jiffies(5));
277 return; 280 return;
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index aba8364c3689..5f542bdd9a4d 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -61,6 +61,7 @@ struct batadv_hard_iface_bat_iv {
61 * @if_status: status of the interface for batman-adv 61 * @if_status: status of the interface for batman-adv
62 * @net_dev: pointer to the net_device 62 * @net_dev: pointer to the net_device
63 * @frag_seqno: last fragment sequence number sent by this interface 63 * @frag_seqno: last fragment sequence number sent by this interface
64 * @num_bcasts: number of payload re-broadcasts on this interface (ARQ)
64 * @hardif_obj: kobject of the per interface sysfs "mesh" directory 65 * @hardif_obj: kobject of the per interface sysfs "mesh" directory
65 * @refcount: number of contexts the object is used 66 * @refcount: number of contexts the object is used
66 * @batman_adv_ptype: packet type describing packets that should be processed by 67 * @batman_adv_ptype: packet type describing packets that should be processed by
@@ -76,6 +77,7 @@ struct batadv_hard_iface {
76 char if_status; 77 char if_status;
77 struct net_device *net_dev; 78 struct net_device *net_dev;
78 atomic_t frag_seqno; 79 atomic_t frag_seqno;
80 uint8_t num_bcasts;
79 struct kobject *hardif_obj; 81 struct kobject *hardif_obj;
80 atomic_t refcount; 82 atomic_t refcount;
81 struct packet_type batman_adv_ptype; 83 struct packet_type batman_adv_ptype;