sta_info.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * Copyright 2002-2005, Devicescape Software, Inc.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef STA_INFO_H
  9. #define STA_INFO_H
  10. #include <linux/list.h>
  11. #include <linux/types.h>
  12. #include <linux/if_ether.h>
  13. #include <linux/kref.h>
  14. #include "ieee80211_key.h"
  15. /* Stations flags (struct sta_info::flags) */
  16. #define WLAN_STA_AUTH BIT(0)
  17. #define WLAN_STA_ASSOC BIT(1)
  18. #define WLAN_STA_PS BIT(2)
  19. #define WLAN_STA_TIM BIT(3) /* TIM bit is on for PS stations */
  20. #define WLAN_STA_PERM BIT(4) /* permanent; do not remove entry on expiration */
  21. #define WLAN_STA_AUTHORIZED BIT(5) /* If 802.1X is used, this flag is
  22. * controlling whether STA is authorized to
  23. * send and receive non-IEEE 802.1X frames
  24. */
  25. #define WLAN_STA_SHORT_PREAMBLE BIT(7)
  26. /* whether this is an AP that we are associated with as a client */
  27. #define WLAN_STA_ASSOC_AP BIT(8)
  28. #define WLAN_STA_WME BIT(9)
  29. #define WLAN_STA_WDS BIT(27)
  30. struct sta_info {
  31. struct kref kref;
  32. struct list_head list;
  33. struct sta_info *hnext; /* next entry in hash table list */
  34. struct ieee80211_local *local;
  35. u8 addr[ETH_ALEN];
  36. u16 aid; /* STA's unique AID (1..2007), 0 = not yet assigned */
  37. u32 flags; /* WLAN_STA_ */
  38. struct sk_buff_head ps_tx_buf; /* buffer of TX frames for station in
  39. * power saving state */
  40. int pspoll; /* whether STA has send a PS Poll frame */
  41. struct sk_buff_head tx_filtered; /* buffer of TX frames that were
  42. * already given to low-level driver,
  43. * but were filtered */
  44. int clear_dst_mask;
  45. unsigned long rx_packets, tx_packets; /* number of RX/TX MSDUs */
  46. unsigned long rx_bytes, tx_bytes;
  47. unsigned long tx_retry_failed, tx_retry_count;
  48. unsigned long tx_filtered_count;
  49. unsigned int wep_weak_iv_count; /* number of RX frames with weak IV */
  50. unsigned long last_rx;
  51. u32 supp_rates; /* bitmap of supported rates in local->curr_rates */
  52. int txrate; /* index in local->curr_rates */
  53. int last_txrate; /* last rate used to send a frame to this STA */
  54. int last_nonerp_idx;
  55. struct net_device *dev; /* which net device is this station associated
  56. * to */
  57. struct ieee80211_key *key;
  58. u32 tx_num_consecutive_failures;
  59. u32 tx_num_mpdu_ok;
  60. u32 tx_num_mpdu_fail;
  61. struct rate_control_ref *rate_ctrl;
  62. void *rate_ctrl_priv;
  63. /* last received seq/frag number from this STA (per RX queue) */
  64. __le16 last_seq_ctrl[NUM_RX_DATA_QUEUES];
  65. unsigned long num_duplicates; /* number of duplicate frames received
  66. * from this STA */
  67. unsigned long tx_fragments; /* number of transmitted MPDUs */
  68. unsigned long rx_fragments; /* number of received MPDUs */
  69. unsigned long rx_dropped; /* number of dropped MPDUs from this STA */
  70. int last_rssi; /* RSSI of last received frame from this STA */
  71. int last_signal; /* signal of last received frame from this STA */
  72. int last_noise; /* noise of last received frame from this STA */
  73. int last_ack_rssi[3]; /* RSSI of last received ACKs from this STA */
  74. unsigned long last_ack;
  75. int channel_use;
  76. int channel_use_raw;
  77. #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
  78. unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES];
  79. unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
  80. #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
  81. u16 listen_interval;
  82. #ifdef CONFIG_MAC80211_DEBUGFS
  83. struct sta_info_debugfsdentries {
  84. struct dentry *dir;
  85. struct dentry *flags;
  86. struct dentry *num_ps_buf_frames;
  87. struct dentry *last_ack_rssi;
  88. struct dentry *last_ack_ms;
  89. struct dentry *inactive_ms;
  90. struct dentry *last_seq_ctrl;
  91. #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
  92. struct dentry *wme_rx_queue;
  93. struct dentry *wme_tx_queue;
  94. #endif
  95. } debugfs;
  96. #endif
  97. };
  98. /* Maximum number of concurrently registered stations */
  99. #define MAX_STA_COUNT 2007
  100. #define STA_HASH_SIZE 256
  101. #define STA_HASH(sta) (sta[5])
  102. /* Maximum number of frames to buffer per power saving station */
  103. #define STA_MAX_TX_BUFFER 128
  104. /* Minimum buffered frame expiry time. If STA uses listen interval that is
  105. * smaller than this value, the minimum value here is used instead. */
  106. #define STA_TX_BUFFER_EXPIRE (10 * HZ)
  107. /* How often station data is cleaned up (e.g., expiration of buffered frames)
  108. */
  109. #define STA_INFO_CLEANUP_INTERVAL (10 * HZ)
  110. static inline void __sta_info_get(struct sta_info *sta)
  111. {
  112. kref_get(&sta->kref);
  113. }
  114. struct sta_info * sta_info_get(struct ieee80211_local *local, u8 *addr);
  115. int sta_info_min_txrate_get(struct ieee80211_local *local);
  116. void sta_info_put(struct sta_info *sta);
  117. struct sta_info * sta_info_add(struct ieee80211_local *local,
  118. struct net_device *dev, u8 *addr, gfp_t gfp);
  119. void sta_info_remove(struct sta_info *sta);
  120. void sta_info_free(struct sta_info *sta);
  121. void sta_info_init(struct ieee80211_local *local);
  122. int sta_info_start(struct ieee80211_local *local);
  123. void sta_info_stop(struct ieee80211_local *local);
  124. void sta_info_remove_aid_ptr(struct sta_info *sta);
  125. void sta_info_flush(struct ieee80211_local *local, struct net_device *dev);
  126. #endif /* STA_INFO_H */