]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - net/batman-adv/main.c
Merge tag 'v2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / net / batman-adv / main.c
similarity index 84%
rename from drivers/staging/batman-adv/main.c
rename to net/batman-adv/main.c
index 0587940d27238146a67ed765482877557f445206..b827f6a158cb8df28c2f1dab8f97bff07a6f868c 100644 (file)
@@ -29,6 +29,7 @@
 #include "icmp_socket.h"
 #include "translation-table.h"
 #include "hard-interface.h"
+#include "gateway_client.h"
 #include "types.h"
 #include "vis.h"
 #include "hash.h"
@@ -84,11 +85,15 @@ int mesh_init(struct net_device *soft_iface)
        spin_lock_init(&bat_priv->forw_bcast_list_lock);
        spin_lock_init(&bat_priv->hna_lhash_lock);
        spin_lock_init(&bat_priv->hna_ghash_lock);
+       spin_lock_init(&bat_priv->gw_list_lock);
        spin_lock_init(&bat_priv->vis_hash_lock);
        spin_lock_init(&bat_priv->vis_list_lock);
+       spin_lock_init(&bat_priv->softif_neigh_lock);
 
        INIT_HLIST_HEAD(&bat_priv->forw_bat_list);
        INIT_HLIST_HEAD(&bat_priv->forw_bcast_list);
+       INIT_HLIST_HEAD(&bat_priv->gw_list);
+       INIT_HLIST_HEAD(&bat_priv->softif_neigh_list);
 
        if (originator_init(bat_priv) < 1)
                goto err;
@@ -127,11 +132,14 @@ void mesh_free(struct net_device *soft_iface)
 
        vis_quit(bat_priv);
 
+       gw_node_purge(bat_priv);
        originator_free(bat_priv);
 
        hna_local_free(bat_priv);
        hna_global_free(bat_priv);
 
+       softif_neigh_purge(bat_priv);
+
        atomic_set(&bat_priv->mesh_state, MESH_INACTIVE);
 }
 
@@ -145,34 +153,6 @@ void dec_module_count(void)
        module_put(THIS_MODULE);
 }
 
-/* returns 1 if they are the same originator */
-
-int compare_orig(void *data1, void *data2)
-{
-       return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0);
-}
-
-/* hashfunction to choose an entry in a hash table of given size */
-/* hash algorithm from http://en.wikipedia.org/wiki/Hash_table */
-int choose_orig(void *data, int32_t size)
-{
-       unsigned char *key = data;
-       uint32_t hash = 0;
-       size_t i;
-
-       for (i = 0; i < 6; i++) {
-               hash += key[i];
-               hash += (hash << 10);
-               hash ^= (hash >> 6);
-       }
-
-       hash += (hash << 3);
-       hash ^= (hash >> 11);
-       hash += (hash << 15);
-
-       return hash % size;
-}
-
 int is_my_mac(uint8_t *addr)
 {
        struct batman_if *batman_if;
@@ -192,16 +172,6 @@ int is_my_mac(uint8_t *addr)
 
 }
 
-int is_bcast(uint8_t *addr)
-{
-       return (addr[0] == (uint8_t)0xff) && (addr[1] == (uint8_t)0xff);
-}
-
-int is_mcast(uint8_t *addr)
-{
-       return *addr & 0x01;
-}
-
 module_init(batman_init);
 module_exit(batman_exit);