rc80211_minstrel.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Copyright (C) 2008 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_H
  9. #define __RC_MINSTREL_H
  10. struct minstrel_rate {
  11. int bitrate;
  12. int rix;
  13. unsigned int perfect_tx_time;
  14. unsigned int ack_time;
  15. int sample_limit;
  16. unsigned int retry_count;
  17. unsigned int retry_count_cts;
  18. unsigned int retry_count_rtscts;
  19. unsigned int adjusted_retry_count;
  20. u32 success;
  21. u32 attempts;
  22. u32 last_attempts;
  23. u32 last_success;
  24. /* parts per thousand */
  25. u32 cur_prob;
  26. u32 probability;
  27. /* per-rate throughput */
  28. u32 cur_tp;
  29. u64 succ_hist;
  30. u64 att_hist;
  31. };
  32. struct minstrel_sta_info {
  33. unsigned long stats_update;
  34. unsigned int sp_ack_dur;
  35. unsigned int rate_avg;
  36. unsigned int lowest_rix;
  37. unsigned int max_tp_rate;
  38. unsigned int max_tp_rate2;
  39. unsigned int max_prob_rate;
  40. unsigned int packet_count;
  41. unsigned int sample_count;
  42. int sample_deferred;
  43. unsigned int sample_idx;
  44. unsigned int sample_column;
  45. int n_rates;
  46. struct minstrel_rate *r;
  47. bool prev_sample;
  48. /* sampling table */
  49. u8 *sample_table;
  50. #ifdef CONFIG_MAC80211_DEBUGFS
  51. struct dentry *dbg_stats;
  52. #endif
  53. };
  54. struct minstrel_priv {
  55. struct ieee80211_hw *hw;
  56. bool has_mrr;
  57. unsigned int cw_min;
  58. unsigned int cw_max;
  59. unsigned int max_retry;
  60. unsigned int ewma_level;
  61. unsigned int segment_size;
  62. unsigned int update_interval;
  63. unsigned int lookaround_rate;
  64. unsigned int lookaround_rate_mrr;
  65. #ifdef CONFIG_MAC80211_DEBUGFS
  66. /*
  67. * enable fixed rate processing per RC
  68. * - write static index to debugfs:ieee80211/phyX/rc/fixed_rate_idx
  69. * - write -1 to enable RC processing again
  70. * - setting will be applied on next update
  71. */
  72. u32 fixed_rate_idx;
  73. struct dentry *dbg_fixed_rate;
  74. #endif
  75. };
  76. struct minstrel_debugfs_info {
  77. size_t len;
  78. char buf[];
  79. };
  80. extern struct rate_control_ops mac80211_minstrel;
  81. void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
  82. void minstrel_remove_sta_debugfs(void *priv, void *priv_sta);
  83. /* debugfs */
  84. int minstrel_stats_open(struct inode *inode, struct file *file);
  85. ssize_t minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos);
  86. int minstrel_stats_release(struct inode *inode, struct file *file);
  87. #endif