sta_info.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. * Modifications for inclusion into the Linux staging tree are
  19. * Copyright(c) 2010 Larry Finger. All rights reserved.
  20. *
  21. * Contact information:
  22. * WLAN FAE <wlanfae@realtek.com>
  23. * Larry Finger <Larry.Finger@lwfinger.net>
  24. *
  25. ******************************************************************************/
  26. #ifndef __STA_INFO_H_
  27. #define __STA_INFO_H_
  28. #include "osdep_service.h"
  29. #include "drv_types.h"
  30. #include "wifi.h"
  31. #define NUM_STA 32
  32. #define NUM_ACL 64
  33. /* if mode ==0, then the sta is allowed once the addr is hit.
  34. * if mode ==1, then the sta is rejected once the addr is non-hit.
  35. */
  36. struct wlan_acl_node {
  37. struct list_head list;
  38. u8 addr[ETH_ALEN];
  39. u8 mode;
  40. };
  41. struct wlan_acl_pool {
  42. struct wlan_acl_node aclnode[NUM_ACL];
  43. };
  44. struct stainfo_stats {
  45. uint rx_pkts;
  46. uint rx_bytes;
  47. u64 tx_pkts;
  48. uint tx_bytes;
  49. };
  50. struct sta_info {
  51. spinlock_t lock;
  52. struct list_head list; /*free_sta_queue*/
  53. struct list_head hash_list; /*sta_hash*/
  54. struct sta_xmit_priv sta_xmitpriv;
  55. struct sta_recv_priv sta_recvpriv;
  56. uint state;
  57. uint aid;
  58. uint mac_id;
  59. uint qos_option;
  60. u8 hwaddr[ETH_ALEN];
  61. uint ieee8021x_blocked; /*0: allowed, 1:blocked */
  62. uint XPrivacy; /*aes, tkip...*/
  63. union Keytype tkiptxmickey;
  64. union Keytype tkiprxmickey;
  65. union Keytype x_UncstKey;
  66. union pn48 txpn; /* PN48 used for Unicast xmit.*/
  67. union pn48 rxpn; /* PN48 used for Unicast recv.*/
  68. u8 bssrateset[16];
  69. uint bssratelen;
  70. s32 rssi;
  71. s32 signal_quality;
  72. struct stainfo_stats sta_stats;
  73. /*for A-MPDU Rx reordering buffer control */
  74. struct recv_reorder_ctrl recvreorder_ctrl[16];
  75. struct ht_priv htpriv;
  76. /* Notes:
  77. * STA_Mode:
  78. * curr_network(mlme_priv/security_priv/qos/ht)
  79. * + sta_info: (STA & AP) CAP/INFO
  80. * scan_q: AP CAP/INFO
  81. * AP_Mode:
  82. * curr_network(mlme_priv/security_priv/qos/ht) : AP CAP/INFO
  83. * sta_info: (AP & STA) CAP/INFO
  84. */
  85. struct list_head asoc_list;
  86. struct list_head auth_list;
  87. unsigned int expire_to;
  88. unsigned int auth_seq;
  89. unsigned int authalg;
  90. unsigned char chg_txt[128];
  91. unsigned int tx_ra_bitmap;
  92. };
  93. struct sta_priv {
  94. u8 *pallocated_stainfo_buf;
  95. u8 *pstainfo_buf;
  96. struct __queue free_sta_queue;
  97. spinlock_t sta_hash_lock;
  98. struct list_head sta_hash[NUM_STA];
  99. int asoc_sta_count;
  100. struct __queue sleep_q;
  101. struct __queue wakeup_q;
  102. struct _adapter *padapter;
  103. struct list_head asoc_list;
  104. struct list_head auth_list;
  105. unsigned int auth_to; /* sec, time to expire in authenticating. */
  106. unsigned int assoc_to; /* sec, time to expire before associating. */
  107. unsigned int expire_to; /* sec , time to expire after associated. */
  108. };
  109. static inline u32 wifi_mac_hash(u8 *mac)
  110. {
  111. u32 x;
  112. x = mac[0];
  113. x = (x << 2) ^ mac[1];
  114. x = (x << 2) ^ mac[2];
  115. x = (x << 2) ^ mac[3];
  116. x = (x << 2) ^ mac[4];
  117. x = (x << 2) ^ mac[5];
  118. x ^= x >> 8;
  119. x = x & (NUM_STA - 1);
  120. return x;
  121. }
  122. u32 _r8712_init_sta_priv(struct sta_priv *pstapriv);
  123. u32 _r8712_free_sta_priv(struct sta_priv *pstapriv);
  124. struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv,
  125. u8 *hwaddr);
  126. void r8712_free_stainfo(struct _adapter *padapter, struct sta_info *psta);
  127. void r8712_free_all_stainfo(struct _adapter *padapter);
  128. struct sta_info *r8712_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr);
  129. void r8712_init_bcmc_stainfo(struct _adapter *padapter);
  130. struct sta_info *r8712_get_bcmc_stainfo(struct _adapter *padapter);
  131. u8 r8712_access_ctrl(struct wlan_acl_pool *pacl_list, u8 *mac_addr);
  132. #endif /* _STA_INFO_H_ */