1 //------------------------------------------------------------------------------
2 // <copyright file="ieee80211_node.h" company="Atheros">
3 // Copyright (c) 2004-2010 Atheros Corporation. All rights reserved.
6 // Permission to use, copy, modify, and/or distribute this software for any
7 // purpose with or without fee is hereby granted, provided that the above
8 // copyright notice and this permission notice appear in all copies.
10 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 //------------------------------------------------------------------------------
20 //==============================================================================
21 // Author(s): ="Atheros"
22 //==============================================================================
23 #ifndef _IEEE80211_NODE_H_
24 #define _IEEE80211_NODE_H_
27 * Node locking definitions.
29 #define IEEE80211_NODE_LOCK_INIT(_nt) A_MUTEX_INIT(&(_nt)->nt_nodelock)
30 #define IEEE80211_NODE_LOCK_DESTROY(_nt) if (A_IS_MUTEX_VALID(&(_nt)->nt_nodelock)) { \
31 A_MUTEX_DELETE(&(_nt)->nt_nodelock); }
33 #define IEEE80211_NODE_LOCK(_nt) A_MUTEX_LOCK(&(_nt)->nt_nodelock)
34 #define IEEE80211_NODE_UNLOCK(_nt) A_MUTEX_UNLOCK(&(_nt)->nt_nodelock)
35 #define IEEE80211_NODE_LOCK_BH(_nt) A_MUTEX_LOCK(&(_nt)->nt_nodelock)
36 #define IEEE80211_NODE_UNLOCK_BH(_nt) A_MUTEX_UNLOCK(&(_nt)->nt_nodelock)
37 #define IEEE80211_NODE_LOCK_ASSERT(_nt)
40 * Node reference counting definitions.
42 * ieee80211_node_initref initialize the reference count to 1
43 * ieee80211_node_incref add a reference
44 * ieee80211_node_decref remove a reference
45 * ieee80211_node_dectestref remove a reference and return 1 if this
46 * is the last reference, otherwise 0
47 * ieee80211_node_refcnt reference count for printing (only)
49 #define ieee80211_node_initref(_ni) ((_ni)->ni_refcnt = 1)
50 #define ieee80211_node_incref(_ni) ((_ni)->ni_refcnt++)
51 #define ieee80211_node_decref(_ni) ((_ni)->ni_refcnt--)
52 #define ieee80211_node_dectestref(_ni) (((_ni)->ni_refcnt--) == 1)
53 #define ieee80211_node_refcnt(_ni) ((_ni)->ni_refcnt)
55 #define IEEE80211_NODE_HASHSIZE 32
56 /* simple hash is enough for variation of macaddr */
57 #define IEEE80211_NODE_HASH(addr) \
58 (((const A_UINT8 *)(addr))[IEEE80211_ADDR_LEN - 1] % \
59 IEEE80211_NODE_HASHSIZE)
62 * Table of ieee80211_node instances. Each ieee80211com
63 * has at least one for holding the scan candidates.
64 * When operating as an access point or in ibss mode there
65 * is a second table for associated stations or neighbors.
67 struct ieee80211_node_table {
68 void *nt_wmip; /* back reference */
69 A_MUTEX_T nt_nodelock; /* on node table */
70 struct bss *nt_node_first; /* information of all nodes */
71 struct bss *nt_node_last; /* information of all nodes */
72 struct bss *nt_hash[IEEE80211_NODE_HASHSIZE];
73 const char *nt_name; /* for debugging */
74 A_UINT32 nt_scangen; /* gen# for timeout scan */
76 A_TIMER nt_inact_timer;
77 A_UINT8 isTimerArmed; /* is the node timer armed */
79 A_UINT32 nt_nodeAge; /* node aging time */
80 #ifdef OS_ROAM_MANAGEMENT
81 A_UINT32 nt_si_gen; /* gen# for scan indication*/
86 #define WLAN_NODE_INACT_TIMEOUT_MSEC 20000
88 #define WLAN_NODE_INACT_TIMEOUT_MSEC 120000
91 #define WLAN_NODE_INACT_CNT 4
93 #endif /* _IEEE80211_NODE_H_ */