bump to 2.6.30-rc6
[openwrt/openwrt.git] / target / linux / s3c24xx / files-2.6.30 / drivers / ar6000 / include / ieee80211_node.h
1 /*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
4 * Copyright (c) 2006 Atheros Communications, Inc.
5 *
6 * Wireless Network driver for Atheros AR6001
7 * All rights reserved.
8 *
9 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
10 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
11 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
12 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
13 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
14 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
15 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
16 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
17 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
18 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19 *
20 */
21 #ifndef _IEEE80211_NODE_H_
22 #define _IEEE80211_NODE_H_
23
24 /*
25 * Node locking definitions.
26 */
27 #define IEEE80211_NODE_LOCK_INIT(_nt) A_MUTEX_INIT(&(_nt)->nt_nodelock)
28 #define IEEE80211_NODE_LOCK_DESTROY(_nt)
29 #define IEEE80211_NODE_LOCK(_nt) A_MUTEX_LOCK(&(_nt)->nt_nodelock)
30 #define IEEE80211_NODE_UNLOCK(_nt) A_MUTEX_UNLOCK(&(_nt)->nt_nodelock)
31 #define IEEE80211_NODE_LOCK_BH(_nt) A_MUTEX_LOCK(&(_nt)->nt_nodelock)
32 #define IEEE80211_NODE_UNLOCK_BH(_nt) A_MUTEX_UNLOCK(&(_nt)->nt_nodelock)
33 #define IEEE80211_NODE_LOCK_ASSERT(_nt)
34
35 /*
36 * Node reference counting definitions.
37 *
38 * ieee80211_node_initref initialize the reference count to 1
39 * ieee80211_node_incref add a reference
40 * ieee80211_node_decref remove a reference
41 * ieee80211_node_dectestref remove a reference and return 1 if this
42 * is the last reference, otherwise 0
43 * ieee80211_node_refcnt reference count for printing (only)
44 */
45 #define ieee80211_node_initref(_ni) ((_ni)->ni_refcnt = 1)
46 #define ieee80211_node_incref(_ni) ((_ni)->ni_refcnt++)
47 #define ieee80211_node_decref(_ni) ((_ni)->ni_refcnt--)
48 #define ieee80211_node_dectestref(_ni) (((_ni)->ni_refcnt--) == 0)
49 #define ieee80211_node_refcnt(_ni) ((_ni)->ni_refcnt)
50
51 #define IEEE80211_NODE_HASHSIZE 32
52 /* simple hash is enough for variation of macaddr */
53 #define IEEE80211_NODE_HASH(addr) \
54 (((const A_UINT8 *)(addr))[IEEE80211_ADDR_LEN - 1] % \
55 IEEE80211_NODE_HASHSIZE)
56
57 /*
58 * Table of ieee80211_node instances. Each ieee80211com
59 * has at least one for holding the scan candidates.
60 * When operating as an access point or in ibss mode there
61 * is a second table for associated stations or neighbors.
62 */
63 struct ieee80211_node_table {
64 void *nt_wmip; /* back reference */
65 A_MUTEX_T nt_nodelock; /* on node table */
66 struct bss *nt_node_first; /* information of all nodes */
67 struct bss *nt_node_last; /* information of all nodes */
68 struct bss *nt_hash[IEEE80211_NODE_HASHSIZE];
69 const char *nt_name; /* for debugging */
70 A_UINT32 nt_scangen; /* gen# for timeout scan */
71 A_TIMER nt_inact_timer;
72 A_UINT8 isTimerArmed; /* is the node timer armed */
73 };
74
75 #define WLAN_NODE_INACT_TIMEOUT_MSEC 10000
76
77 #endif /* _IEEE80211_NODE_H_ */