Use Linux 3.17 4-argument alloc_netdev(), provide compatibility code
[madwifi/.git] / net80211 / ieee80211_node.h
index 926773e787bc98e10b03623be4e62530026ee957..8b4913f24e4260641260975bb8f3b6ee69fa3899 100644 (file)
@@ -114,7 +114,7 @@ struct ieee80211_node {
        u_int8_t ni_ath_flags;                  /* Atheros feature flags */
        /* NB: These must have the same values as IEEE80211_ATHC_* */
 #define IEEE80211_NODE_TURBOP  0x0001          /* Turbo prime enable */
-#define IEEE80211_NODE_COMP    0x0002          /* Compresssion enable */
+#define IEEE80211_NODE_COMP    0x0002          /* Compression enable */
 #define IEEE80211_NODE_FF      0x0004          /* Fast Frame capable */
 #define IEEE80211_NODE_XR      0x0008          /* Atheros WME enable */
 #define IEEE80211_NODE_AR      0x0010          /* AR capable */
@@ -129,9 +129,13 @@ struct ieee80211_node {
        u_int8_t *ni_rsn_ie;                    /* captured RSN ie */
        u_int8_t *ni_wme_ie;                    /* captured WME ie */
        u_int8_t *ni_ath_ie;                    /* captured Atheros ie */
+       u_int8_t *ni_suppchans;                 /* supported channels */
+       u_int8_t *ni_suppchans_new;             /* supported channels of ongoing association */
+       u_int8_t *ni_needed_chans;              /* nodes which don't support these will be removed */
+       u_int8_t ni_n_needed_chans;             /* size of ni_needed_chans list */
        u_int16_t ni_txseqs[17];                /* tx seq per-tid */
-       u_int16_t ni_rxseqs[17];                /* rx seq previous per-tid*/
-       u_int32_t ni_rxfragstamp;               /* time stamp of last rx frag */
+       u_int16_t ni_rxseqs[17];                /* rx seq previous per-tid */
+       unsigned long ni_rxfragstamp;           /* time stamp of last rx frag */
        struct sk_buff *ni_rxfrag;              /* rx frag reassembly */
        struct ieee80211_rsnparms ni_rsn;       /* RSN/WPA parameters */
        struct ieee80211_key ni_ucastkey;       /* unicast key */
@@ -139,7 +143,7 @@ struct ieee80211_node {
 
        /* hardware */
        u_int64_t ni_rtsf;                      /* recv timestamp */
-       u_int32_t ni_last_rx;                   /* recv jiffies */
+       unsigned long ni_last_rx;               /* recv jiffies */
        u_int8_t ni_rssi;                       /* recv ssi */
 
        /* header */
@@ -187,12 +191,15 @@ MALLOC_DECLARE(M_80211_NODE);
 #define        IEEE80211_NODE_STAT_ADD(ni,stat,v)      (ni->ni_stats.ns_##stat += v)
 #define        IEEE80211_NODE_STAT_SET(ni,stat,v)      (ni->ni_stats.ns_##stat = v)
 
-#define WME_UAPSD_AC_CAN_TRIGGER(_ac, _ni) ( \
-               ((_ni)->ni_flags & IEEE80211_NODE_UAPSD_TRIG) && WME_UAPSD_AC_ENABLED((_ac), (_ni)->ni_uapsd) )
+#define WME_UAPSD_AC_CAN_TRIGGER(_ac, _ni) (                           \
+               ((_ni)->ni_flags & IEEE80211_NODE_UAPSD_TRIG) &&        \
+               WME_UAPSD_AC_ENABLED((_ac), (_ni)->ni_uapsd))
 #define WME_UAPSD_NODE_MAXQDEPTH       8
-#define IEEE80211_NODE_UAPSD_USETIM(_ni) (((_ni)->ni_uapsd & 0xF) == 0xF )
+#define IEEE80211_NODE_UAPSD_USETIM(_ni) (((_ni)->ni_uapsd & 0xF) == 0xF)
 #define WME_UAPSD_NODE_INVALIDSEQ      0xffff
-#define WME_UAPSD_NODE_TRIGSEQINIT(_ni)        (memset(&(_ni)->ni_uapsd_trigseq[0], 0xff, sizeof((_ni)->ni_uapsd_trigseq)))
+#define WME_UAPSD_NODE_TRIGSEQINIT(_ni)                                        \
+               (memset(&(_ni)->ni_uapsd_trigseq[0],                    \
+                0xff, sizeof((_ni)->ni_uapsd_trigseq)))
 
 void ieee80211_node_attach(struct ieee80211com *);
 void ieee80211_node_detach(struct ieee80211com *);
@@ -248,89 +255,34 @@ struct ieee80211_node_table {
        struct timer_list nt_wds_aging_timer;   /* timer to age out wds entries */
 };
 
-/* Allocates a new ieee80211_node* that has a reference count of one, and adds it to the node table. */
-#ifdef IEEE80211_DEBUG_REFCNT
-#define ieee80211_alloc_node_table(_vap, _mac) \
-       ieee80211_alloc_node_table_debug(_vap, _mac, __func__, __LINE__)
-struct ieee80211_node *ieee80211_alloc_node_table_debug(struct ieee80211vap *,
-       const u_int8_t *, const char* name, int line);
-#else
+/* Allocates a new ieee80211_node * that has a reference count of one, and 
+ * adds it to the node table. */
 struct ieee80211_node *ieee80211_alloc_node_table(struct ieee80211vap *,
        const u_int8_t *);
-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
 
-/* Allocates a new ieee80211_node* that has a reference count.  
+/* Allocates a new ieee80211_node * that has a reference count.  
  * If tmp is 0, it is added to the node table and the reference is used.
  * If tmp is 1, then the caller gets to use the reference. */
-#ifdef IEEE80211_DEBUG_REFCNT
-#define ieee80211_dup_bss(_vap, _mac, _tmp) \
-       ieee80211_dup_bss_debug(_vap, _mac, _tmp, __func__, __LINE__)
-struct ieee80211_node *ieee80211_dup_bss_debug(struct ieee80211vap *,
-       const u_int8_t *, unsigned char tmp, const char*, int);
-#else
 struct ieee80211_node *ieee80211_dup_bss(struct ieee80211vap *,
        const u_int8_t *, unsigned char tmp);
-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
 
 void ieee80211_node_reset(struct ieee80211_node *, struct ieee80211vap *);
 
-/* Returns a ieee80211_node* with refcount incremented, if found */
-#ifdef IEEE80211_DEBUG_REFCNT
-#define        ieee80211_find_node(_nt, _mac) \
-       ieee80211_find_node_debug(_nt, _mac, __func__, __LINE__)
-struct ieee80211_node *ieee80211_find_node_debug(struct ieee80211_node_table *,
-       const u_int8_t *, const char *, int);
-#else
+/* The following return node reference that the caller must manage. */
 struct ieee80211_node *ieee80211_find_node(struct ieee80211_node_table *,
        const u_int8_t *);
-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
-
-/* Returns a ieee80211_node* with refcount incremented, if found */
-#ifdef IEEE80211_DEBUG_REFCNT
-#define        ieee80211_find_rxnode(_nt, _wh) \
-       ieee80211_find_rxnode_debug(_nt, _wh, __func__, __LINE__)
-struct ieee80211_node *ieee80211_find_rxnode_debug(struct ieee80211com *,
-       const struct ieee80211_frame_min *, const char *, int);
-#else
 struct ieee80211_node *ieee80211_find_rxnode(struct ieee80211com *,
        const struct ieee80211_frame_min *);
-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
-
-/* Returns a ieee80211_node* with refcount incremented, if found */
-#ifdef IEEE80211_DEBUG_REFCNT
-#define        ieee80211_find_txnode(_nt, _mac) \
-       ieee80211_find_txnode_debug(_nt, _mac, __func__, __LINE__)
-struct ieee80211_node *ieee80211_find_txnode_debug(struct ieee80211vap *,
-       const u_int8_t *, const char *, int);
-#else
 struct ieee80211_node *ieee80211_find_txnode(struct ieee80211vap *,
        const u_int8_t *);
-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
-
-#ifdef IEEE80211_DEBUG_REFCNT
-#define ieee80211_free_node(_ni) \
-       ieee80211_free_node_debug(_ni, __func__, __LINE__)
-void ieee80211_free_node_debug(struct ieee80211_node *ni, const char *func, int line);
-#else
-void ieee80211_free_node(struct ieee80211_node *ni);
-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
 
 /* Reference counting only needs to be locked out against the transitions,
  * 0->1 and 1->0 (i.e., when we do not own the reference we are getting).
  * This only happens when finding the a node reference from the node table,
- * which is locked seperately. Thus, we do not need to lock the follwoing 
+ * which is locked separately. Thus, we do not need to lock the following
  * functions. 
- * Increment the reference counter for ieee80211_node*
- */
-#ifdef IEEE80211_DEBUG_REFCNT
-#define ieee80211_ref_node(_ni) \
-       ieee80211_ref_node_debug(_ni, __func__, __LINE__)
-struct ieee80211_node *
-ieee80211_ref_node_debug(struct ieee80211_node *ni, const char *func, int line);
-#else
-struct ieee80211_node *
-ieee80211_ref_node(struct ieee80211_node *ni);
-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
+ * Increment the reference counter for ieee80211_node *. */
+struct ieee80211_node *ieee80211_ref_node(struct ieee80211_node *ni);
 
 #define PASS_NODE(_ni) \
        ieee80211_pass_node(&_ni)
@@ -342,58 +294,21 @@ ieee80211_pass_node(struct ieee80211_node **pni) {
        return (tmp);
 }
 
-/* Decrement ieee80211_node* refcunt, and relinquish the pointer. */
-#ifdef IEEE80211_DEBUG_REFCNT
-#define ieee80211_unref_node(_pni) \
-       ieee80211_unref_node_debug(_pni, __func__, __LINE__)
-void
-ieee80211_unref_node_debug(struct ieee80211_node **pni, const char *func, int line);
-#else
-void
-ieee80211_unref_node(struct ieee80211_node **pni);
-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
+void ieee80211_unref_node(struct ieee80211_node **pni);
 
 /* Increments reference count of ieee80211_node *ni */
-#ifdef IEEE80211_DEBUG_REFCNT
-#define ieee80211_add_wds_addr(_table, _node, _mac, _static) \
-       ieee80211_add_wds_addr_debug(_table, _node, _mac, _static, __func__, __LINE__)
-int ieee80211_add_wds_addr_debug(struct ieee80211_node_table *, struct ieee80211_node *,
-       const u_int8_t *, u_int8_t, const char* func, int line);
-#else
 int ieee80211_add_wds_addr(struct ieee80211_node_table *, struct ieee80211_node *,
        const u_int8_t *, u_int8_t);
-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
 
 /* Decrements reference count of ieee80211_node *ni */
-#ifdef IEEE80211_DEBUG_REFCNT
-#define ieee80211_remove_wds_addr(_table, _mac) \
-       ieee80211_remove_wds_addr_debug(_table, _mac, __func__, __LINE__)
-void ieee80211_remove_wds_addr_debug(struct ieee80211_node_table *, const u_int8_t *,
-                              const char* func, int line);
-#else
 void ieee80211_remove_wds_addr(struct ieee80211_node_table *, const u_int8_t *);
-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
 
 /* Decrements reference count of node, if found */
-#ifdef IEEE80211_DEBUG_REFCNT
-#define ieee80211_del_wds_node(_table, _node) \
-       ieee80211_del_wds_node_debug(_table, _node, __func__, __LINE__)
-void ieee80211_del_wds_node_debug(struct ieee80211_node_table *, struct ieee80211_node *,
-                           const char* func, int line);
-#else
 void ieee80211_del_wds_node(struct ieee80211_node_table *, struct ieee80211_node *);
-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
 
 /* Increments reference count of node, if found */
-#ifdef IEEE80211_DEBUG_REFCNT
-#define ieee80211_find_wds_node(_table, _mac) \
-       ieee80211_find_wds_node_debug(_table, _mac, __func__, __LINE__)
-struct ieee80211_node *ieee80211_find_wds_node_debug(struct ieee80211_node_table *,
-       const u_int8_t *, const char* func, int line);
-#else
 struct ieee80211_node *ieee80211_find_wds_node(struct ieee80211_node_table *,
        const u_int8_t *);
-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
 typedef void ieee80211_iter_func(void *, struct ieee80211_node *);
 void ieee80211_iterate_nodes(struct ieee80211_node_table *,
        ieee80211_iter_func *, void *);
@@ -403,15 +318,8 @@ void       ieee80211_dump_node(struct ieee80211_node_table *,
        struct ieee80211_node *);
 void   ieee80211_dump_nodes(struct ieee80211_node_table *);
 /* Returns a node with refcount of one.  Caller must release that reference */
-#ifdef IEEE80211_DEBUG_REFCNT
-#define ieee80211_fakeup_adhoc_node(_vap, _mac) \
-       ieee80211_fakeup_adhoc_node_debug(_vap, _mac, __func__, __LINE__)
-struct ieee80211_node *ieee80211_fakeup_adhoc_node_debug(struct ieee80211vap *,
-       const u_int8_t macaddr[], const char*, int);
-#else
 struct ieee80211_node *ieee80211_fakeup_adhoc_node(struct ieee80211vap *,
        const u_int8_t macaddr[]);
-#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
 struct ieee80211_scanparams;
 /* Returns a node with refcount of one.  Caller must release that reference */
 struct ieee80211_node *ieee80211_add_neighbor(struct ieee80211vap *,