rc80211_minstrel_ht.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org>
  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 __RC_MINSTREL_HT_H
  9. #define __RC_MINSTREL_HT_H
  10. /*
  11. * The number of streams can be changed to 2 to reduce code
  12. * size and memory footprint.
  13. */
  14. #define MINSTREL_MAX_STREAMS 3
  15. #define MINSTREL_STREAM_GROUPS 4
  16. #define MCS_GROUP_RATES 8
  17. struct mcs_group {
  18. u32 flags;
  19. unsigned int streams;
  20. unsigned int duration[MCS_GROUP_RATES];
  21. };
  22. extern const struct mcs_group minstrel_mcs_groups[];
  23. struct minstrel_rate_stats {
  24. /* current / last sampling period attempts/success counters */
  25. unsigned int attempts, last_attempts;
  26. unsigned int success, last_success;
  27. /* total attempts/success counters */
  28. u64 att_hist, succ_hist;
  29. /* current throughput */
  30. unsigned int cur_tp;
  31. /* packet delivery probabilities */
  32. unsigned int cur_prob, probability;
  33. /* maximum retry counts */
  34. unsigned int retry_count;
  35. unsigned int retry_count_rtscts;
  36. bool retry_updated;
  37. u8 sample_skipped;
  38. };
  39. struct minstrel_mcs_group_data {
  40. u8 index;
  41. u8 column;
  42. /* bitfield of supported MCS rates of this group */
  43. u8 supported;
  44. /* selected primary rates */
  45. unsigned int max_tp_rate;
  46. unsigned int max_tp_rate2;
  47. unsigned int max_prob_rate;
  48. /* MCS rate statistics */
  49. struct minstrel_rate_stats rates[MCS_GROUP_RATES];
  50. };
  51. struct minstrel_ht_sta {
  52. struct ieee80211_sta *sta;
  53. /* ampdu length (average, per sampling interval) */
  54. unsigned int ampdu_len;
  55. unsigned int ampdu_packets;
  56. /* ampdu length (EWMA) */
  57. unsigned int avg_ampdu_len;
  58. /* best throughput rate */
  59. unsigned int max_tp_rate;
  60. /* second best throughput rate */
  61. unsigned int max_tp_rate2;
  62. /* best probability rate */
  63. unsigned int max_prob_rate;
  64. unsigned int max_prob_streams;
  65. /* time of last status update */
  66. unsigned long stats_update;
  67. /* overhead time in usec for each frame */
  68. unsigned int overhead;
  69. unsigned int overhead_rtscts;
  70. unsigned int total_packets;
  71. unsigned int sample_packets;
  72. /* tx flags to add for frames for this sta */
  73. u32 tx_flags;
  74. u8 sample_wait;
  75. u8 sample_tries;
  76. u8 sample_count;
  77. u8 sample_slow;
  78. /* current MCS group to be sampled */
  79. u8 sample_group;
  80. u8 cck_supported;
  81. u8 cck_supported_short;
  82. /* MCS rate group info and statistics */
  83. struct minstrel_mcs_group_data groups[MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS + 1];
  84. };
  85. struct minstrel_ht_sta_priv {
  86. union {
  87. struct minstrel_ht_sta ht;
  88. struct minstrel_sta_info legacy;
  89. };
  90. #ifdef CONFIG_MAC80211_DEBUGFS
  91. struct dentry *dbg_stats;
  92. #endif
  93. void *ratelist;
  94. void *sample_table;
  95. bool is_ht;
  96. };
  97. void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
  98. void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta);
  99. #endif