batman-adv: Use common Jenkins Hash implementation
[cascardo/linux.git] / net / batman-adv / network-coding.c
index 127cc4d..fb54319 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2014 B.A.T.M.A.N. contributors:
+/* Copyright (C) 2012-2015 B.A.T.M.A.N. contributors:
  *
  * Martin Hundebøll, Jeppe Ledet-Pedersen
  *
@@ -155,7 +155,7 @@ err:
  */
 void batadv_nc_init_bat_priv(struct batadv_priv *bat_priv)
 {
-       atomic_set(&bat_priv->network_coding, 1);
+       atomic_set(&bat_priv->network_coding, 0);
        bat_priv->nc.min_tq = 200;
        bat_priv->nc.max_fwd_delay = 10;
        bat_priv->nc.max_buffer_time = 200;
@@ -275,7 +275,7 @@ static bool batadv_nc_to_purge_nc_path_decoding(struct batadv_priv *bat_priv,
         * max_buffer time
         */
        return batadv_has_timed_out(nc_path->last_valid,
-                                   bat_priv->nc.max_buffer_time*10);
+                                   bat_priv->nc.max_buffer_time * 10);
 }
 
 /**
@@ -453,14 +453,8 @@ static uint32_t batadv_nc_hash_choose(const void *data, uint32_t size)
        const struct batadv_nc_path *nc_path = data;
        uint32_t hash = 0;
 
-       hash = batadv_hash_bytes(hash, &nc_path->prev_hop,
-                                sizeof(nc_path->prev_hop));
-       hash = batadv_hash_bytes(hash, &nc_path->next_hop,
-                                sizeof(nc_path->next_hop));
-
-       hash += (hash << 3);
-       hash ^= (hash >> 11);
-       hash += (hash << 15);
+       hash = jhash(&nc_path->prev_hop, sizeof(nc_path->prev_hop), hash);
+       hash = jhash(&nc_path->next_hop, sizeof(nc_path->next_hop), hash);
 
        return hash % size;
 }