|
@@ -24,6 +24,7 @@
|
|
|
#include "soft-interface.h"
|
|
|
#include "types.h"
|
|
|
#include "hash.h"
|
|
|
+#include "originator.h"
|
|
|
|
|
|
static void hna_local_purge(struct work_struct *work);
|
|
|
static void _hna_global_del_orig(struct bat_priv *bat_priv,
|
|
@@ -41,7 +42,7 @@ int hna_local_init(struct bat_priv *bat_priv)
|
|
|
if (bat_priv->hna_local_hash)
|
|
|
return 1;
|
|
|
|
|
|
- bat_priv->hna_local_hash = hash_new(128, compare_orig, choose_orig);
|
|
|
+ bat_priv->hna_local_hash = hash_new(128, choose_orig);
|
|
|
|
|
|
if (!bat_priv->hna_local_hash)
|
|
|
return 0;
|
|
@@ -64,7 +65,7 @@ void hna_local_add(struct net_device *soft_iface, uint8_t *addr)
|
|
|
spin_lock_irqsave(&bat_priv->hna_lhash_lock, flags);
|
|
|
hna_local_entry =
|
|
|
((struct hna_local_entry *)hash_find(bat_priv->hna_local_hash,
|
|
|
- addr));
|
|
|
+ compare_orig, addr));
|
|
|
spin_unlock_irqrestore(&bat_priv->hna_lhash_lock, flags);
|
|
|
|
|
|
if (hna_local_entry) {
|
|
@@ -107,13 +108,13 @@ void hna_local_add(struct net_device *soft_iface, uint8_t *addr)
|
|
|
|
|
|
spin_lock_irqsave(&bat_priv->hna_lhash_lock, flags);
|
|
|
|
|
|
- hash_add(bat_priv->hna_local_hash, hna_local_entry);
|
|
|
+ hash_add(bat_priv->hna_local_hash, compare_orig, hna_local_entry);
|
|
|
bat_priv->num_local_hna++;
|
|
|
atomic_set(&bat_priv->hna_local_changed, 1);
|
|
|
|
|
|
if (bat_priv->hna_local_hash->elements * 4 >
|
|
|
bat_priv->hna_local_hash->size) {
|
|
|
- swaphash = hash_resize(bat_priv->hna_local_hash,
|
|
|
+ swaphash = hash_resize(bat_priv->hna_local_hash, compare_orig,
|
|
|
bat_priv->hna_local_hash->size * 2);
|
|
|
|
|
|
if (!swaphash)
|
|
@@ -128,7 +129,8 @@ void hna_local_add(struct net_device *soft_iface, uint8_t *addr)
|
|
|
spin_lock_irqsave(&bat_priv->hna_ghash_lock, flags);
|
|
|
|
|
|
hna_global_entry = ((struct hna_global_entry *)
|
|
|
- hash_find(bat_priv->hna_global_hash, addr));
|
|
|
+ hash_find(bat_priv->hna_global_hash,
|
|
|
+ compare_orig, addr));
|
|
|
|
|
|
if (hna_global_entry)
|
|
|
_hna_global_del_orig(bat_priv, hna_global_entry,
|
|
@@ -232,7 +234,8 @@ static void hna_local_del(struct bat_priv *bat_priv,
|
|
|
bat_dbg(DBG_ROUTES, bat_priv, "Deleting local hna entry (%pM): %s\n",
|
|
|
hna_local_entry->addr, message);
|
|
|
|
|
|
- hash_remove(bat_priv->hna_local_hash, hna_local_entry->addr);
|
|
|
+ hash_remove(bat_priv->hna_local_hash, compare_orig,
|
|
|
+ hna_local_entry->addr);
|
|
|
_hna_local_del(hna_local_entry, bat_priv);
|
|
|
}
|
|
|
|
|
@@ -245,7 +248,7 @@ void hna_local_remove(struct bat_priv *bat_priv,
|
|
|
spin_lock_irqsave(&bat_priv->hna_lhash_lock, flags);
|
|
|
|
|
|
hna_local_entry = (struct hna_local_entry *)
|
|
|
- hash_find(bat_priv->hna_local_hash, addr);
|
|
|
+ hash_find(bat_priv->hna_local_hash, compare_orig, addr);
|
|
|
if (hna_local_entry)
|
|
|
hna_local_del(bat_priv, hna_local_entry, message);
|
|
|
|
|
@@ -295,7 +298,7 @@ int hna_global_init(struct bat_priv *bat_priv)
|
|
|
if (bat_priv->hna_global_hash)
|
|
|
return 1;
|
|
|
|
|
|
- bat_priv->hna_global_hash = hash_new(128, compare_orig, choose_orig);
|
|
|
+ bat_priv->hna_global_hash = hash_new(128, choose_orig);
|
|
|
|
|
|
if (!bat_priv->hna_global_hash)
|
|
|
return 0;
|
|
@@ -319,7 +322,8 @@ void hna_global_add_orig(struct bat_priv *bat_priv,
|
|
|
|
|
|
hna_ptr = hna_buff + (hna_buff_count * ETH_ALEN);
|
|
|
hna_global_entry = (struct hna_global_entry *)
|
|
|
- hash_find(bat_priv->hna_global_hash, hna_ptr);
|
|
|
+ hash_find(bat_priv->hna_global_hash, compare_orig,
|
|
|
+ hna_ptr);
|
|
|
|
|
|
if (!hna_global_entry) {
|
|
|
spin_unlock_irqrestore(&bat_priv->hna_ghash_lock,
|
|
@@ -340,7 +344,8 @@ void hna_global_add_orig(struct bat_priv *bat_priv,
|
|
|
hna_global_entry->addr, orig_node->orig);
|
|
|
|
|
|
spin_lock_irqsave(&bat_priv->hna_ghash_lock, flags);
|
|
|
- hash_add(bat_priv->hna_global_hash, hna_global_entry);
|
|
|
+ hash_add(bat_priv->hna_global_hash, compare_orig,
|
|
|
+ hna_global_entry);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -352,7 +357,8 @@ void hna_global_add_orig(struct bat_priv *bat_priv,
|
|
|
|
|
|
hna_ptr = hna_buff + (hna_buff_count * ETH_ALEN);
|
|
|
hna_local_entry = (struct hna_local_entry *)
|
|
|
- hash_find(bat_priv->hna_local_hash, hna_ptr);
|
|
|
+ hash_find(bat_priv->hna_local_hash, compare_orig,
|
|
|
+ hna_ptr);
|
|
|
|
|
|
if (hna_local_entry)
|
|
|
hna_local_del(bat_priv, hna_local_entry,
|
|
@@ -379,7 +385,7 @@ void hna_global_add_orig(struct bat_priv *bat_priv,
|
|
|
|
|
|
if (bat_priv->hna_global_hash->elements * 4 >
|
|
|
bat_priv->hna_global_hash->size) {
|
|
|
- swaphash = hash_resize(bat_priv->hna_global_hash,
|
|
|
+ swaphash = hash_resize(bat_priv->hna_global_hash, compare_orig,
|
|
|
bat_priv->hna_global_hash->size * 2);
|
|
|
|
|
|
if (!swaphash)
|
|
@@ -450,7 +456,8 @@ static void _hna_global_del_orig(struct bat_priv *bat_priv,
|
|
|
hna_global_entry->addr, hna_global_entry->orig_node->orig,
|
|
|
message);
|
|
|
|
|
|
- hash_remove(bat_priv->hna_global_hash, hna_global_entry->addr);
|
|
|
+ hash_remove(bat_priv->hna_global_hash, compare_orig,
|
|
|
+ hna_global_entry->addr);
|
|
|
kfree(hna_global_entry);
|
|
|
}
|
|
|
|
|
@@ -470,7 +477,8 @@ void hna_global_del_orig(struct bat_priv *bat_priv,
|
|
|
while ((hna_buff_count + 1) * ETH_ALEN <= orig_node->hna_buff_len) {
|
|
|
hna_ptr = orig_node->hna_buff + (hna_buff_count * ETH_ALEN);
|
|
|
hna_global_entry = (struct hna_global_entry *)
|
|
|
- hash_find(bat_priv->hna_global_hash, hna_ptr);
|
|
|
+ hash_find(bat_priv->hna_global_hash, compare_orig,
|
|
|
+ hna_ptr);
|
|
|
|
|
|
if ((hna_global_entry) &&
|
|
|
(hna_global_entry->orig_node == orig_node))
|
|
@@ -508,7 +516,8 @@ struct orig_node *transtable_search(struct bat_priv *bat_priv, uint8_t *addr)
|
|
|
|
|
|
spin_lock_irqsave(&bat_priv->hna_ghash_lock, flags);
|
|
|
hna_global_entry = (struct hna_global_entry *)
|
|
|
- hash_find(bat_priv->hna_global_hash, addr);
|
|
|
+ hash_find(bat_priv->hna_global_hash,
|
|
|
+ compare_orig, addr);
|
|
|
spin_unlock_irqrestore(&bat_priv->hna_ghash_lock, flags);
|
|
|
|
|
|
if (!hna_global_entry)
|