rc80211_minstrel.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. };
  66. struct minstrel_debugfs_info {
  67. size_t len;
  68. char buf[];
  69. };
  70. extern struct rate_control_ops mac80211_minstrel;
  71. void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
  72. void minstrel_remove_sta_debugfs(void *priv, void *priv_sta);
  73. /* debugfs */
  74. int minstrel_stats_open(struct inode *inode, struct file *file);
  75. ssize_t minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos);
  76. int minstrel_stats_release(struct inode *inode, struct file *file);
  77. #endif