aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/batman-adv/main.h
diff options
context:
space:
mode:
authorSimon Wunderlich <siwu@hrz.tu-chemnitz.de>2010-05-07 21:47:24 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-11 13:42:39 -0700
commitf94cee241099b31732460c255c6af24979ec778e (patch)
treeeb1ec752a24ef310b7db71ede0ee9bf9dcbe9c2a /drivers/staging/batman-adv/main.h
parentb7bce588b3a6a058e00d9629c25cf170dede63fc (diff)
downloadkernel_samsung_crespo-f94cee241099b31732460c255c6af24979ec778e.zip
kernel_samsung_crespo-f94cee241099b31732460c255c6af24979ec778e.tar.gz
kernel_samsung_crespo-f94cee241099b31732460c255c6af24979ec778e.tar.bz2
Staging: batman-adv: Reorganize sequence number handling
BATMAN and broadcast packets are tracked with a sequence number window of currently 64 entries to measure and avoid duplicates. Packets which have a sequence number smaller than the newest received packet minus 64 are not within this sequence number window anymore and are called "old packets" from now on. When old packets are received, the routing code assumes that the host of the originator has been restarted. This assumption however might be wrong as packets can also be delayed by NIC drivers, e.g. because of long queues or collision detection in dense WiFi? environments. This behaviour can be reproduced by doing a broadcast ping flood in a dense node environment. The effect is that the sequence number window is jumping forth and back, accepting and forwarding any packet (because packets are assumed to be "new") and causing loops. To overcome this problem, the sequence number handling has been reorganized. When an old packet is received, the window is reset back only once. Other old packets are dropped for (currently) 30 seconds to "protect" the new sequence number and avoid the hopping as described above. The reorganization brings some code cleanups (at least i hope you feel the same) and also fixes a bug in count_real_packets() which falsely updated the last_real_seqno for slightly older packets within the seqno window if they are no duplicates. This second version of the patch also fixes a problem where for seq_diff==64 bit_shift() reads from outside of the seqno window, and removes the loop for seq_diff == -64 which was present in the first patch. The third iteration also adds a window for the next expected sequence numbers. This minimizes sequence number flapping for packets with very big differences (e.g. 3 packets with seqno 0, 25000 and 50000 might still cause problems without this window). Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/batman-adv/main.h')
-rw-r--r--drivers/staging/batman-adv/main.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/batman-adv/main.h b/drivers/staging/batman-adv/main.h
index 247196c..58c1ec1 100644
--- a/drivers/staging/batman-adv/main.h
+++ b/drivers/staging/batman-adv/main.h
@@ -61,6 +61,10 @@
* forw_packet->direct_link_flags */
#define MAX_AGGREGATION_MS 100
+#define RESET_PROTECTION_MS 30000
+#define EXPECTED_SEQNO_RANGE 4096
+/* don't reset again within 30 seconds */
+
#define MODULE_INACTIVE 0
#define MODULE_ACTIVE 1
#define MODULE_DEACTIVATING 2