rc80211_minstrel_ht.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. /* sorted rate set within a MCS group*/
  47. u16 max_group_tp_rate[MAX_THR_RATES];
  48. u16 max_group_prob_rate;
  49. /* MCS rate statistics */
  50. struct minstrel_rate_stats rates[MCS_GROUP_RATES];
  51. };
  52. struct minstrel_ht_sta {
  53. struct ieee80211_sta *sta;
  54. /* ampdu length (average, per sampling interval) */
  55. unsigned int ampdu_len;
  56. unsigned int ampdu_packets;
  57. /* ampdu length (EWMA) */
  58. unsigned int avg_ampdu_len;
  59. /* overall sorted rate set */
  60. u16 max_tp_rate[MAX_THR_RATES];
  61. u16 max_prob_rate;
  62. /* time of last status update */
  63. unsigned long last_stats_update;
  64. /* overhead time in usec for each frame */
  65. unsigned int overhead;
  66. unsigned int overhead_rtscts;
  67. unsigned int total_packets;
  68. unsigned int sample_packets;
  69. /* tx flags to add for frames for this sta */
  70. u32 tx_flags;
  71. u8 sample_wait;
  72. u8 sample_tries;
  73. u8 sample_count;
  74. u8 sample_slow;
  75. /* current MCS group to be sampled */
  76. u8 sample_group;
  77. u8 cck_supported;
  78. u8 cck_supported_short;
  79. /* Bitfield of supported MCS rates of all groups */
  80. u16 supported[MINSTREL_GROUPS_NB];
  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