rc80211_minstrel_ht.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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_HT_STREAM_GROUPS 4 /* BW(=2) * SGI(=2) */
  16. #ifdef CONFIG_MAC80211_RC_MINSTREL_VHT
  17. #define MINSTREL_VHT_STREAM_GROUPS 6 /* BW(=3) * SGI(=2) */
  18. #else
  19. #define MINSTREL_VHT_STREAM_GROUPS 0
  20. #endif
  21. #define MINSTREL_HT_GROUPS_NB (MINSTREL_MAX_STREAMS * \
  22. MINSTREL_HT_STREAM_GROUPS)
  23. #define MINSTREL_VHT_GROUPS_NB (MINSTREL_MAX_STREAMS * \
  24. MINSTREL_VHT_STREAM_GROUPS)
  25. #define MINSTREL_CCK_GROUPS_NB 1
  26. #define MINSTREL_GROUPS_NB (MINSTREL_HT_GROUPS_NB + \
  27. MINSTREL_VHT_GROUPS_NB + \
  28. MINSTREL_CCK_GROUPS_NB)
  29. #define MINSTREL_HT_GROUP_0 0
  30. #define MINSTREL_CCK_GROUP (MINSTREL_HT_GROUP_0 + MINSTREL_HT_GROUPS_NB)
  31. #define MINSTREL_VHT_GROUP_0 (MINSTREL_CCK_GROUP + 1)
  32. #ifdef CONFIG_MAC80211_RC_MINSTREL_VHT
  33. #define MCS_GROUP_RATES 10
  34. #else
  35. #define MCS_GROUP_RATES 8
  36. #endif
  37. struct mcs_group {
  38. u32 flags;
  39. unsigned int streams;
  40. unsigned int duration[MCS_GROUP_RATES];
  41. };
  42. extern const struct mcs_group minstrel_mcs_groups[];
  43. struct minstrel_mcs_group_data {
  44. u8 index;
  45. u8 column;
  46. /* bitfield of supported MCS rates of this group */
  47. u16 supported;
  48. /* sorted rate set within a MCS group*/
  49. u16 max_group_tp_rate[MAX_THR_RATES];
  50. u16 max_group_prob_rate;
  51. /* MCS rate statistics */
  52. struct minstrel_rate_stats rates[MCS_GROUP_RATES];
  53. };
  54. struct minstrel_ht_sta {
  55. struct ieee80211_sta *sta;
  56. /* ampdu length (average, per sampling interval) */
  57. unsigned int ampdu_len;
  58. unsigned int ampdu_packets;
  59. /* ampdu length (EWMA) */
  60. unsigned int avg_ampdu_len;
  61. /* overall sorted rate set */
  62. u16 max_tp_rate[MAX_THR_RATES];
  63. u16 max_prob_rate;
  64. /* time of last status update */
  65. unsigned long last_stats_update;
  66. /* overhead time in usec for each frame */
  67. unsigned int overhead;
  68. unsigned int overhead_rtscts;
  69. unsigned int total_packets;
  70. unsigned int sample_packets;
  71. /* tx flags to add for frames for this sta */
  72. u32 tx_flags;
  73. u8 sample_wait;
  74. u8 sample_tries;
  75. u8 sample_count;
  76. u8 sample_slow;
  77. /* current MCS group to be sampled */
  78. u8 sample_group;
  79. u8 cck_supported;
  80. u8 cck_supported_short;
  81. /* MCS rate group info and statistics */
  82. struct minstrel_mcs_group_data groups[MINSTREL_GROUPS_NB];
  83. };
  84. struct minstrel_ht_sta_priv {
  85. union {
  86. struct minstrel_ht_sta ht;
  87. struct minstrel_sta_info legacy;
  88. };
  89. #ifdef CONFIG_MAC80211_DEBUGFS
  90. struct dentry *dbg_stats;
  91. struct dentry *dbg_stats_csv;
  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. int minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate,
  100. int prob_ewma);
  101. #endif