summaryrefslogtreecommitdiffstats
path: root/drivers/staging/batman-adv/originator.c
diff options
context:
space:
mode:
authorAndreas Langer <an.langer@gmx.de>2010-09-05 01:58:25 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-09-05 00:29:45 -0700
commite63760e59542ed872f7a5b1605a46e03b879d909 (patch)
treee93a45f0ad5224fa2213a6d04e9806422dac7e7a /drivers/staging/batman-adv/originator.c
parent24c76fc07b7680536fa372905f16b57a45c0d514 (diff)
downloadop-kernel-dev-e63760e59542ed872f7a5b1605a46e03b879d909.zip
op-kernel-dev-e63760e59542ed872f7a5b1605a46e03b879d909.tar.gz
Staging: batman-adv: layer2 unicast packet fragmentation
This patch implements a simple layer2 fragmentation to allow traffic exchange over network interfaces with a MTU smaller than 1500 bytes. The fragmentation splits the big packets into two parts and marks the frames accordingly. The receiving end buffers the packets to reassemble the orignal packet before passing it to the higher layers. This feature makes it necessary to modify the batman-adv encapsulation for unicast packets by adding a sequence number, flags and the originator address. This modifcation is part of a seperate packet type for fragemented packets to keep the original overhead as low as possible. This patch enables the feature by default to ensure the data traffic can travel through the network. But it also prints a warning to notify the user about the performance implications. Note: Fragmentation should be avoided at all costs since it has a dramatic impact on the performance, especially when it comes wifi networks. Instead of a single packet, 2 packets have to be sent! Not only valuable airtime is wasted but also packetloss decreases the throughput. A link with 50% packetloss and fragmentation enabled is pretty much unusable. Signed-off-by: Andreas Langer <an.langer@gmx.de> [sven.eckelmann@gmx.de: Rework on top of current version] Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/batman-adv/originator.c')
-rw-r--r--drivers/staging/batman-adv/originator.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/staging/batman-adv/originator.c b/drivers/staging/batman-adv/originator.c
index de5a8c1..b51a13e 100644
--- a/drivers/staging/batman-adv/originator.c
+++ b/drivers/staging/batman-adv/originator.c
@@ -27,6 +27,7 @@
#include "translation-table.h"
#include "routing.h"
#include "hard-interface.h"
+#include "unicast.h"
static DECLARE_DELAYED_WORK(purge_orig_wq, purge_orig);
@@ -95,6 +96,7 @@ static void free_orig_node(void *data)
kfree(neigh_node);
}
+ frag_list_free(&orig_node->frag_list);
hna_global_del_orig(orig_node, "originator timed out");
kfree(orig_node->bcast_own);
@@ -157,6 +159,10 @@ struct orig_node *get_orig_node(uint8_t *addr)
size = bat_priv->num_ifaces * sizeof(uint8_t);
orig_node->bcast_own_sum = kzalloc(size, GFP_ATOMIC);
+
+ INIT_LIST_HEAD(&orig_node->frag_list);
+ orig_node->last_frag_packet = 0;
+
if (!orig_node->bcast_own_sum)
goto free_bcast_own;
@@ -271,6 +277,10 @@ void purge_orig(struct work_struct *work)
hash_remove_bucket(orig_hash, &hashit);
free_orig_node(orig_node);
}
+
+ if (time_after(jiffies, (orig_node->last_frag_packet +
+ msecs_to_jiffies(FRAG_TIMEOUT))))
+ frag_list_free(&orig_node->frag_list);
}
spin_unlock_irqrestore(&orig_hash_lock, flags);
OpenPOWER on IntegriCloud