]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/mac80211/mesh.h
Revert "ax25: Fix std timer socket destroy handling."
[linux-2.6-omap-h63xx.git] / net / mac80211 / mesh.h
index ac892379390813fda61dc7b3a368c9c09473efd8..7495fbb0d211b14e0d311e03f6647e31aefd372f 100644 (file)
 #ifndef IEEE80211S_H
 #define IEEE80211S_H
 
-#include "ieee80211_i.h"
+#include <linux/types.h>
 #include <linux/jhash.h>
+#include <asm/unaligned.h>
+#include "ieee80211_i.h"
 
-extern int mesh_allocated;
 
 /* Data structures */
 
@@ -30,7 +31,6 @@ extern int mesh_allocated;
  * @MESH_PATH_FIXED: the mesh path has been manually set and should not be
  *     modified
  * @MESH_PATH_RESOLVED: the mesh path can has been resolved
- * @MESH_PATH_DELETE: the mesh path is scheduled to be deleted
  *
  * MESH_PATH_RESOLVED and MESH_PATH_DELETE are used by the mesh path timer to
  * decide when to stop or cancel the mesh path discovery.
@@ -41,7 +41,6 @@ enum mesh_path_flags {
        MESH_PATH_DSN_VALID =   BIT(2),
        MESH_PATH_FIXED =       BIT(3),
        MESH_PATH_RESOLVED =    BIT(4),
-       MESH_PATH_DELETE =      BIT(5),
 };
 
 /**
@@ -65,9 +64,10 @@ enum mesh_path_flags {
  * @state_lock: mesh pat state lock
  *
  *
- * The combination of dst and dev is unique in the mesh path table. A reference
- * to the next_hop sta will be kept and in case this sta is removed, the
- * mesh_path structure must be also removed or substitued in a rcu safe way
+ * The combination of dst and dev is unique in the mesh path table. Since the
+ * next_hop STA is only protected by RCU as well, deleting the STA must also
+ * remove/substitute the mesh_path structure and wait until that is no longer
+ * reachable before destroying the STA completely.
  */
 struct mesh_path {
        u8 dst[ETH_ALEN];
@@ -109,7 +109,7 @@ struct mesh_table {
        __u32 hash_rnd;                 /* Used for hash generation */
        atomic_t entries;               /* Up to MAX_MESH_NEIGHBOURS */
        void (*free_node) (struct hlist_node *p, bool free_leafs);
-       void (*copy_node) (struct hlist_node *p, struct mesh_table *newtbl);
+       int (*copy_node) (struct hlist_node *p, struct mesh_table *newtbl);
        int size_order;
        int mean_chain_len;
 };
@@ -140,7 +140,7 @@ struct rmc_entry {
 
 struct mesh_rmc {
        struct rmc_entry bucket[RMC_BUCKETS];
-       u8 idx_mask;
+       u32 idx_mask;
 };
 
 
@@ -211,9 +211,10 @@ void mesh_rmc_free(struct net_device *dev);
 int mesh_rmc_init(struct net_device *dev);
 void ieee80211s_init(void);
 void ieee80211s_stop(void);
+void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata);
+
 /* Mesh paths */
-int mesh_nexthop_lookup(u8 *next_hop, struct sk_buff *skb,
-               struct net_device *dev);
+int mesh_nexthop_lookup(struct sk_buff *skb, struct net_device *dev);
 void mesh_path_start_discovery(struct net_device *dev);
 struct mesh_path *mesh_path_lookup(u8 *dst, struct net_device *dev);
 struct mesh_path *mesh_path_lookup_by_idx(int idx, struct net_device *dev);
@@ -228,8 +229,7 @@ void mesh_neighbour_update(u8 *hw_addr, u64 rates, struct net_device *dev,
                bool add);
 bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie,
                              struct net_device *dev);
-void mesh_accept_plinks_update(struct net_device *dev);
-struct sta_info *mesh_plink_add(u8 *hw_addr, u64 rates, struct net_device *dev);
+void mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata);
 void mesh_plink_broken(struct sta_info *sta);
 void mesh_plink_deactivate(struct sta_info *sta);
 int mesh_plink_open(struct sta_info *sta);
@@ -257,6 +257,9 @@ void mesh_path_timer(unsigned long data);
 void mesh_path_flush_by_nexthop(struct sta_info *sta);
 void mesh_path_discard_frame(struct sk_buff *skb, struct net_device *dev);
 
+#ifdef CONFIG_MAC80211_MESH
+extern int mesh_allocated;
+
 static inline int mesh_plink_free_count(struct ieee80211_sub_if_data *sdata)
 {
        return sdata->u.sta.mshcfg.dot11MeshMaxPeerLinks -
@@ -265,7 +268,7 @@ static inline int mesh_plink_free_count(struct ieee80211_sub_if_data *sdata)
 
 static inline bool mesh_plink_availables(struct ieee80211_sub_if_data *sdata)
 {
-       return (min(mesh_plink_free_count(sdata),
+       return (min_t(long, mesh_plink_free_count(sdata),
                   MESH_MAX_PLINKS - sdata->local->num_sta)) > 0;
 }
 
@@ -278,6 +281,8 @@ static inline void mesh_path_activate(struct mesh_path *mpath)
        for (i = 0; i <= x->hash_mask; i++) \
                hlist_for_each_entry_rcu(node, p, &x->hash_buckets[i], list)
 
-#define MESH_PREQ(skb) (skb->cb + 30)
+#else
+#define mesh_allocated 0
+#endif
 
 #endif /* IEEE80211S_H */