rc80211_minstrel_ht.h 2.7 KB

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