diff options
author | Felix Fietkau <nbd@openwrt.org> | 2010-05-13 10:48:03 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-06-02 16:12:59 -0400 |
commit | ec8aa669b8393b6789b1954d587c63264af7ff99 (patch) | |
tree | 1a4c43dc718262d1aa6256de2d50b9e03a76c604 /net/mac80211/rc80211_minstrel_ht.h | |
parent | b4df47081b67bce9dcb7b84b551588c7402a330a (diff) |
mac80211: add the minstrel_ht rate control algorithm
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/rc80211_minstrel_ht.h')
-rw-r--r-- | net/mac80211/rc80211_minstrel_ht.h | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/net/mac80211/rc80211_minstrel_ht.h b/net/mac80211/rc80211_minstrel_ht.h new file mode 100644 index 000000000000..696c0fc6e0b7 --- /dev/null +++ b/net/mac80211/rc80211_minstrel_ht.h | |||
@@ -0,0 +1,128 @@ | |||
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 | |||
9 | #ifndef __RC_MINSTREL_HT_H | ||
10 | #define __RC_MINSTREL_HT_H | ||
11 | |||
12 | /* | ||
13 | * The number of streams can be changed to 2 to reduce code | ||
14 | * size and memory footprint. | ||
15 | */ | ||
16 | #define MINSTREL_MAX_STREAMS 3 | ||
17 | #define MINSTREL_STREAM_GROUPS 4 | ||
18 | |||
19 | /* scaled fraction values */ | ||
20 | #define MINSTREL_SCALE 16 | ||
21 | #define MINSTREL_FRAC(val, div) (((val) << MINSTREL_SCALE) / div) | ||
22 | #define MINSTREL_TRUNC(val) ((val) >> MINSTREL_SCALE) | ||
23 | |||
24 | #define MCS_GROUP_RATES 8 | ||
25 | |||
26 | struct mcs_group { | ||
27 | u32 flags; | ||
28 | unsigned int streams; | ||
29 | unsigned int duration[MCS_GROUP_RATES]; | ||
30 | }; | ||
31 | |||
32 | struct minstrel_rate_stats { | ||
33 | /* current / last sampling period attempts/success counters */ | ||
34 | unsigned int attempts, last_attempts; | ||
35 | unsigned int success, last_success; | ||
36 | |||
37 | /* total attempts/success counters */ | ||
38 | u64 att_hist, succ_hist; | ||
39 | |||
40 | /* current throughput */ | ||
41 | unsigned int cur_tp; | ||
42 | |||
43 | /* packet delivery probabilities */ | ||
44 | unsigned int cur_prob, probability; | ||
45 | |||
46 | /* maximum retry counts */ | ||
47 | unsigned int retry_count; | ||
48 | unsigned int retry_count_rtscts; | ||
49 | |||
50 | bool retry_updated; | ||
51 | u8 sample_skipped; | ||
52 | }; | ||
53 | |||
54 | struct minstrel_mcs_group_data { | ||
55 | u8 index; | ||
56 | u8 column; | ||
57 | |||
58 | /* bitfield of supported MCS rates of this group */ | ||
59 | u8 supported; | ||
60 | |||
61 | /* selected primary rates */ | ||
62 | unsigned int max_tp_rate; | ||
63 | unsigned int max_tp_rate2; | ||
64 | unsigned int max_prob_rate; | ||
65 | |||
66 | /* MCS rate statistics */ | ||
67 | struct minstrel_rate_stats rates[MCS_GROUP_RATES]; | ||
68 | }; | ||
69 | |||
70 | struct minstrel_ht_sta { | ||
71 | /* ampdu length (average, per sampling interval) */ | ||
72 | unsigned int ampdu_len; | ||
73 | unsigned int ampdu_packets; | ||
74 | |||
75 | /* ampdu length (EWMA) */ | ||
76 | unsigned int avg_ampdu_len; | ||
77 | |||
78 | /* best throughput rate */ | ||
79 | unsigned int max_tp_rate; | ||
80 | |||
81 | /* second best throughput rate */ | ||
82 | unsigned int max_tp_rate2; | ||
83 | |||
84 | /* best probability rate */ | ||
85 | unsigned int max_prob_rate; | ||
86 | |||
87 | /* time of last status update */ | ||
88 | unsigned long stats_update; | ||
89 | |||
90 | /* overhead time in usec for each frame */ | ||
91 | unsigned int overhead; | ||
92 | unsigned int overhead_rtscts; | ||
93 | |||
94 | unsigned int total_packets; | ||
95 | unsigned int sample_packets; | ||
96 | |||
97 | /* tx flags to add for frames for this sta */ | ||
98 | u32 tx_flags; | ||
99 | |||
100 | u8 sample_wait; | ||
101 | u8 sample_tries; | ||
102 | u8 sample_count; | ||
103 | u8 sample_slow; | ||
104 | |||
105 | /* current MCS group to be sampled */ | ||
106 | u8 sample_group; | ||
107 | |||
108 | /* MCS rate group info and statistics */ | ||
109 | struct minstrel_mcs_group_data groups[MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS]; | ||
110 | }; | ||
111 | |||
112 | struct minstrel_ht_sta_priv { | ||
113 | union { | ||
114 | struct minstrel_ht_sta ht; | ||
115 | struct minstrel_sta_info legacy; | ||
116 | }; | ||
117 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
118 | struct dentry *dbg_stats; | ||
119 | #endif | ||
120 | void *ratelist; | ||
121 | void *sample_table; | ||
122 | bool is_ht; | ||
123 | }; | ||
124 | |||
125 | void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); | ||
126 | void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta); | ||
127 | |||
128 | #endif | ||