/drivers/staging/ath6kl/wlan/include/ieee80211_node.h

https://bitbucket.org/cyanogenmod/android_kernel_asus_tf300t · C Header · 93 lines · 43 code · 8 blank · 42 comment · 2 complexity · f9e1286d8aec1ad7cfbf441dccc2e82f MD5 · raw file

  1. //------------------------------------------------------------------------------
  2. // <copyright file="ieee80211_node.h" company="Atheros">
  3. // Copyright (c) 2004-2010 Atheros Corporation. All rights reserved.
  4. //
  5. //
  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.
  9. //
  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.
  17. //
  18. //
  19. //------------------------------------------------------------------------------
  20. //==============================================================================
  21. // Author(s): ="Atheros"
  22. //==============================================================================
  23. #ifndef _IEEE80211_NODE_H_
  24. #define _IEEE80211_NODE_H_
  25. /*
  26. * Node locking definitions.
  27. */
  28. #define IEEE80211_NODE_LOCK_INIT(_nt) A_MUTEX_INIT(&(_nt)->nt_nodelock)
  29. #define IEEE80211_NODE_LOCK_DESTROY(_nt) if (A_IS_MUTEX_VALID(&(_nt)->nt_nodelock)) { \
  30. A_MUTEX_DELETE(&(_nt)->nt_nodelock); }
  31. #define IEEE80211_NODE_LOCK(_nt) A_MUTEX_LOCK(&(_nt)->nt_nodelock)
  32. #define IEEE80211_NODE_UNLOCK(_nt) A_MUTEX_UNLOCK(&(_nt)->nt_nodelock)
  33. #define IEEE80211_NODE_LOCK_BH(_nt) A_MUTEX_LOCK(&(_nt)->nt_nodelock)
  34. #define IEEE80211_NODE_UNLOCK_BH(_nt) A_MUTEX_UNLOCK(&(_nt)->nt_nodelock)
  35. #define IEEE80211_NODE_LOCK_ASSERT(_nt)
  36. /*
  37. * Node reference counting definitions.
  38. *
  39. * ieee80211_node_initref initialize the reference count to 1
  40. * ieee80211_node_incref add a reference
  41. * ieee80211_node_decref remove a reference
  42. * ieee80211_node_dectestref remove a reference and return 1 if this
  43. * is the last reference, otherwise 0
  44. * ieee80211_node_refcnt reference count for printing (only)
  45. */
  46. #define ieee80211_node_initref(_ni) ((_ni)->ni_refcnt = 1)
  47. #define ieee80211_node_incref(_ni) ((_ni)->ni_refcnt++)
  48. #define ieee80211_node_decref(_ni) ((_ni)->ni_refcnt--)
  49. #define ieee80211_node_dectestref(_ni) (((_ni)->ni_refcnt--) == 1)
  50. #define ieee80211_node_refcnt(_ni) ((_ni)->ni_refcnt)
  51. #define IEEE80211_NODE_HASHSIZE 32
  52. /* simple hash is enough for variation of macaddr */
  53. #define IEEE80211_NODE_HASH(addr) \
  54. (((const u8 *)(addr))[IEEE80211_ADDR_LEN - 1] % \
  55. IEEE80211_NODE_HASHSIZE)
  56. /*
  57. * Table of ieee80211_node instances. Each ieee80211com
  58. * has at least one for holding the scan candidates.
  59. * When operating as an access point or in ibss mode there
  60. * is a second table for associated stations or neighbors.
  61. */
  62. struct ieee80211_node_table {
  63. void *nt_wmip; /* back reference */
  64. A_MUTEX_T nt_nodelock; /* on node table */
  65. struct bss *nt_node_first; /* information of all nodes */
  66. struct bss *nt_node_last; /* information of all nodes */
  67. struct bss *nt_hash[IEEE80211_NODE_HASHSIZE];
  68. const char *nt_name; /* for debugging */
  69. u32 nt_scangen; /* gen# for timeout scan */
  70. #ifdef THREAD_X
  71. A_TIMER nt_inact_timer;
  72. u8 isTimerArmed; /* is the node timer armed */
  73. #endif
  74. u32 nt_nodeAge; /* node aging time */
  75. #ifdef OS_ROAM_MANAGEMENT
  76. u32 nt_si_gen; /* gen# for scan indication*/
  77. #endif
  78. };
  79. #ifdef THREAD_X
  80. #define WLAN_NODE_INACT_TIMEOUT_MSEC 20000
  81. #else
  82. #define WLAN_NODE_INACT_TIMEOUT_MSEC 120000
  83. #endif
  84. #define WLAN_NODE_INACT_CNT 4
  85. #endif /* _IEEE80211_NODE_H_ */