diff options
Diffstat (limited to 'net/batman-adv/network-coding.c')
-rw-r--r-- | net/batman-adv/network-coding.c | 53 |
1 files changed, 38 insertions, 15 deletions
diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c index 127cc4d7380a..f0a50f31d822 100644 --- a/net/batman-adv/network-coding.c +++ b/net/batman-adv/network-coding.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright (C) 2012-2014 B.A.T.M.A.N. contributors: | 1 | /* Copyright (C) 2012-2015 B.A.T.M.A.N. contributors: |
2 | * | 2 | * |
3 | * Martin Hundebøll, Jeppe Ledet-Pedersen | 3 | * Martin Hundebøll, Jeppe Ledet-Pedersen |
4 | * | 4 | * |
@@ -15,15 +15,44 @@ | |||
15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "network-coding.h" | ||
19 | #include "main.h" | ||
20 | |||
21 | #include <linux/atomic.h> | ||
22 | #include <linux/byteorder/generic.h> | ||
23 | #include <linux/compiler.h> | ||
18 | #include <linux/debugfs.h> | 24 | #include <linux/debugfs.h> |
25 | #include <linux/errno.h> | ||
26 | #include <linux/etherdevice.h> | ||
27 | #include <linux/fs.h> | ||
28 | #include <linux/if_ether.h> | ||
29 | #include <linux/if_packet.h> | ||
30 | #include <linux/init.h> | ||
31 | #include <linux/jhash.h> | ||
32 | #include <linux/jiffies.h> | ||
33 | #include <linux/kernel.h> | ||
34 | #include <linux/list.h> | ||
35 | #include <linux/lockdep.h> | ||
36 | #include <linux/netdevice.h> | ||
37 | #include <linux/printk.h> | ||
38 | #include <linux/random.h> | ||
39 | #include <linux/rculist.h> | ||
40 | #include <linux/rcupdate.h> | ||
41 | #include <linux/seq_file.h> | ||
42 | #include <linux/skbuff.h> | ||
43 | #include <linux/slab.h> | ||
44 | #include <linux/spinlock.h> | ||
45 | #include <linux/stat.h> | ||
46 | #include <linux/stddef.h> | ||
47 | #include <linux/string.h> | ||
48 | #include <linux/workqueue.h> | ||
19 | 49 | ||
20 | #include "main.h" | 50 | #include "hard-interface.h" |
21 | #include "hash.h" | 51 | #include "hash.h" |
22 | #include "network-coding.h" | ||
23 | #include "send.h" | ||
24 | #include "originator.h" | 52 | #include "originator.h" |
25 | #include "hard-interface.h" | 53 | #include "packet.h" |
26 | #include "routing.h" | 54 | #include "routing.h" |
55 | #include "send.h" | ||
27 | 56 | ||
28 | static struct lock_class_key batadv_nc_coding_hash_lock_class_key; | 57 | static struct lock_class_key batadv_nc_coding_hash_lock_class_key; |
29 | static struct lock_class_key batadv_nc_decoding_hash_lock_class_key; | 58 | static struct lock_class_key batadv_nc_decoding_hash_lock_class_key; |
@@ -155,7 +184,7 @@ err: | |||
155 | */ | 184 | */ |
156 | void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv) | 185 | void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv) |
157 | { | 186 | { |
158 | atomic_set(&bat_priv->network_coding, 1); | 187 | atomic_set(&bat_priv->network_coding, 0); |
159 | bat_priv->nc.min_tq = 200; | 188 | bat_priv->nc.min_tq = 200; |
160 | bat_priv->nc.max_fwd_delay = 10; | 189 | bat_priv->nc.max_fwd_delay = 10; |
161 | bat_priv->nc.max_buffer_time = 200; | 190 | bat_priv->nc.max_buffer_time = 200; |
@@ -275,7 +304,7 @@ static bool batadv_nc_to_purge_nc_path_decoding(struct batadv_priv *bat_priv, | |||
275 | * max_buffer time | 304 | * max_buffer time |
276 | */ | 305 | */ |
277 | return batadv_has_timed_out(nc_path->last_valid, | 306 | return batadv_has_timed_out(nc_path->last_valid, |
278 | bat_priv->nc.max_buffer_time*10); | 307 | bat_priv->nc.max_buffer_time * 10); |
279 | } | 308 | } |
280 | 309 | ||
281 | /** | 310 | /** |
@@ -453,14 +482,8 @@ static uint32_t batadv_nc_hash_choose(const void *data, uint32_t size) | |||
453 | const struct batadv_nc_path *nc_path = data; | 482 | const struct batadv_nc_path *nc_path = data; |
454 | uint32_t hash = 0; | 483 | uint32_t hash = 0; |
455 | 484 | ||
456 | hash = batadv_hash_bytes(hash, &nc_path->prev_hop, | 485 | hash = jhash(&nc_path->prev_hop, sizeof(nc_path->prev_hop), hash); |
457 | sizeof(nc_path->prev_hop)); | 486 | hash = jhash(&nc_path->next_hop, sizeof(nc_path->next_hop), hash); |
458 | hash = batadv_hash_bytes(hash, &nc_path->next_hop, | ||
459 | sizeof(nc_path->next_hop)); | ||
460 | |||
461 | hash += (hash << 3); | ||
462 | hash ^= (hash >> 11); | ||
463 | hash += (hash << 15); | ||
464 | 487 | ||
465 | return hash % size; | 488 | return hash % size; |
466 | } | 489 | } |