summaryrefslogtreecommitdiffstats
path: root/drivers/staging/batman-adv/originator.c
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/originator.c
parentb7bce588b3a6a058e00d9629c25cf170dede63fc (diff)
downloadop-kernel-dev-f94cee241099b31732460c255c6af24979ec778e.zip
op-kernel-dev-f94cee241099b31732460c255c6af24979ec778e.tar.gz
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/originator.c')
-rw-r--r--drivers/staging/batman-adv/originator.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/batman-adv/originator.c b/drivers/staging/batman-adv/originator.c
index 44bbe89..01d71d7 100644
--- a/drivers/staging/batman-adv/originator.c
+++ b/drivers/staging/batman-adv/originator.c
@@ -140,6 +140,8 @@ struct orig_node *get_orig_node(uint8_t *addr)
memcpy(orig_node->orig, addr, ETH_ALEN);
orig_node->router = NULL;
orig_node->hna_buff = NULL;
+ orig_node->bcast_seqno_reset = jiffies - msecs_to_jiffies(RESET_PROTECTION_MS) - 1;
+ orig_node->batman_seqno_reset = jiffies - msecs_to_jiffies(RESET_PROTECTION_MS) - 1;
size = bat_priv->num_ifaces * sizeof(TYPE_OF_WORD) * NUM_WORDS;
OpenPOWER on IntegriCloud