sta_info.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. #define WLAN_STA_WME BIT(9)
  27. #define WLAN_STA_WDS BIT(27)
  28. struct sta_info {
  29. struct kref kref;
  30. struct list_head list;
  31. struct sta_info *hnext; /* next entry in hash table list */
  32. struct ieee80211_local *local;
  33. u8 addr[ETH_ALEN];
  34. u16 aid; /* STA's unique AID (1..2007), 0 = not yet assigned */
  35. u32 flags; /* WLAN_STA_ */
  36. struct sk_buff_head ps_tx_buf; /* buffer of TX frames for station in
  37. * power saving state */
  38. int pspoll; /* whether STA has send a PS Poll frame */
  39. struct sk_buff_head tx_filtered; /* buffer of TX frames that were
  40. * already given to low-level driver,
  41. * but were filtered */
  42. int clear_dst_mask;
  43. unsigned long rx_packets, tx_packets; /* number of RX/TX MSDUs */
  44. unsigned long rx_bytes, tx_bytes;
  45. unsigned long tx_retry_failed, tx_retry_count;
  46. unsigned long tx_filtered_count;
  47. unsigned int wep_weak_iv_count; /* number of RX frames with weak IV */
  48. unsigned long last_rx;
  49. u32 supp_rates; /* bitmap of supported rates in local->curr_rates */
  50. int txrate; /* index in local->curr_rates */
  51. int last_txrate; /* last rate used to send a frame to this STA */
  52. int last_nonerp_idx;
  53. struct net_device *dev; /* which net device is this station associated
  54. * to */
  55. struct ieee80211_key *key;
  56. u32 tx_num_consecutive_failures;
  57. u32 tx_num_mpdu_ok;
  58. u32 tx_num_mpdu_fail;
  59. struct rate_control_ref *rate_ctrl;
  60. void *rate_ctrl_priv;
  61. /* last received seq/frag number from this STA (per RX queue) */
  62. __le16 last_seq_ctrl[NUM_RX_DATA_QUEUES];
  63. unsigned long num_duplicates; /* number of duplicate frames received
  64. * from this STA */
  65. unsigned long tx_fragments; /* number of transmitted MPDUs */
  66. unsigned long rx_fragments; /* number of received MPDUs */
  67. unsigned long rx_dropped; /* number of dropped MPDUs from this STA */
  68. int last_rssi; /* RSSI of last received frame from this STA */
  69. int last_signal; /* signal of last received frame from this STA */
  70. int last_noise; /* noise of last received frame from this STA */
  71. int last_ack_rssi[3]; /* RSSI of last received ACKs from this STA */
  72. unsigned long last_ack;
  73. int channel_use;
  74. int channel_use_raw;
  75. u8 antenna_sel_tx;
  76. u8 antenna_sel_rx;
  77. int key_idx_compression; /* key table index for compression and TX
  78. * filtering; used only if sta->key is not
  79. * set */
  80. #ifdef CONFIG_MAC80211_DEBUGFS
  81. int debugfs_registered;
  82. #endif
  83. int assoc_ap; /* whether this is an AP that we are
  84. * associated with as a client */
  85. #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
  86. unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES];
  87. unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
  88. #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
  89. int vlan_id;
  90. u16 listen_interval;
  91. #ifdef CONFIG_MAC80211_DEBUGFS
  92. struct sta_info_debugfsdentries {
  93. struct dentry *dir;
  94. struct dentry *flags;
  95. struct dentry *num_ps_buf_frames;
  96. struct dentry *last_ack_rssi;
  97. struct dentry *last_ack_ms;
  98. struct dentry *inactive_ms;
  99. struct dentry *last_seq_ctrl;
  100. #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
  101. struct dentry *wme_rx_queue;
  102. struct dentry *wme_tx_queue;
  103. #endif
  104. } debugfs;
  105. #endif
  106. };
  107. /* Maximum number of concurrently registered stations */
  108. #define MAX_STA_COUNT 2007
  109. #define STA_HASH_SIZE 256
  110. #define STA_HASH(sta) (sta[5])
  111. /* Maximum number of frames to buffer per power saving station */
  112. #define STA_MAX_TX_BUFFER 128
  113. /* Minimum buffered frame expiry time. If STA uses listen interval that is
  114. * smaller than this value, the minimum value here is used instead. */
  115. #define STA_TX_BUFFER_EXPIRE (10 * HZ)
  116. /* How often station data is cleaned up (e.g., expiration of buffered frames)
  117. */
  118. #define STA_INFO_CLEANUP_INTERVAL (10 * HZ)
  119. struct sta_info * sta_info_get(struct ieee80211_local *local, u8 *addr);
  120. int sta_info_min_txrate_get(struct ieee80211_local *local);
  121. void sta_info_put(struct sta_info *sta);
  122. struct sta_info * sta_info_add(struct ieee80211_local *local,
  123. struct net_device *dev, u8 *addr, gfp_t gfp);
  124. void sta_info_free(struct sta_info *sta, int locked);
  125. void sta_info_init(struct ieee80211_local *local);
  126. int sta_info_start(struct ieee80211_local *local);
  127. void sta_info_stop(struct ieee80211_local *local);
  128. void sta_info_remove_aid_ptr(struct sta_info *sta);
  129. void sta_info_flush(struct ieee80211_local *local, struct net_device *dev);
  130. #endif /* STA_INFO_H */