]>
Commit | Line | Data |
---|---|---|
ec8aa669 FF |
1 | /* |
2 | * Copyright (C) 2010 Felix Fietkau <[email protected]> | |
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 | */ | |
8a0ee4fe KB |
16 | #define MINSTREL_MAX_STREAMS 3 |
17 | #define MINSTREL_HT_STREAM_GROUPS 4 /* BW(=2) * SGI(=2) */ | |
9208247d KB |
18 | #ifdef CONFIG_MAC80211_RC_MINSTREL_VHT |
19 | #define MINSTREL_VHT_STREAM_GROUPS 6 /* BW(=3) * SGI(=2) */ | |
20 | #else | |
21 | #define MINSTREL_VHT_STREAM_GROUPS 0 | |
22 | #endif | |
8a0ee4fe KB |
23 | |
24 | #define MINSTREL_HT_GROUPS_NB (MINSTREL_MAX_STREAMS * \ | |
25 | MINSTREL_HT_STREAM_GROUPS) | |
9208247d KB |
26 | #define MINSTREL_VHT_GROUPS_NB (MINSTREL_MAX_STREAMS * \ |
27 | MINSTREL_VHT_STREAM_GROUPS) | |
8a0ee4fe KB |
28 | #define MINSTREL_CCK_GROUPS_NB 1 |
29 | #define MINSTREL_GROUPS_NB (MINSTREL_HT_GROUPS_NB + \ | |
9208247d | 30 | MINSTREL_VHT_GROUPS_NB + \ |
8a0ee4fe KB |
31 | MINSTREL_CCK_GROUPS_NB) |
32 | ||
33 | #define MINSTREL_HT_GROUP_0 0 | |
34 | #define MINSTREL_CCK_GROUP (MINSTREL_HT_GROUP_0 + MINSTREL_HT_GROUPS_NB) | |
9208247d | 35 | #define MINSTREL_VHT_GROUP_0 (MINSTREL_CCK_GROUP + 1) |
ec8aa669 | 36 | |
9208247d KB |
37 | #ifdef CONFIG_MAC80211_RC_MINSTREL_VHT |
38 | #define MCS_GROUP_RATES 10 | |
39 | #else | |
40 | #define MCS_GROUP_RATES 8 | |
41 | #endif | |
ec8aa669 FF |
42 | |
43 | struct mcs_group { | |
44 | u32 flags; | |
45 | unsigned int streams; | |
46 | unsigned int duration[MCS_GROUP_RATES]; | |
47 | }; | |
48 | ||
de66bfd8 JL |
49 | extern const struct mcs_group minstrel_mcs_groups[]; |
50 | ||
ec8aa669 FF |
51 | struct minstrel_mcs_group_data { |
52 | u8 index; | |
53 | u8 column; | |
54 | ||
5935839a | 55 | /* sorted rate set within a MCS group*/ |
d4d141ca KB |
56 | u16 max_group_tp_rate[MAX_THR_RATES]; |
57 | u16 max_group_prob_rate; | |
ec8aa669 FF |
58 | |
59 | /* MCS rate statistics */ | |
60 | struct minstrel_rate_stats rates[MCS_GROUP_RATES]; | |
61 | }; | |
62 | ||
63 | struct minstrel_ht_sta { | |
a8566662 FF |
64 | struct ieee80211_sta *sta; |
65 | ||
ec8aa669 FF |
66 | /* ampdu length (average, per sampling interval) */ |
67 | unsigned int ampdu_len; | |
68 | unsigned int ampdu_packets; | |
69 | ||
70 | /* ampdu length (EWMA) */ | |
71 | unsigned int avg_ampdu_len; | |
72 | ||
5935839a | 73 | /* overall sorted rate set */ |
d4d141ca KB |
74 | u16 max_tp_rate[MAX_THR_RATES]; |
75 | u16 max_prob_rate; | |
ec8aa669 FF |
76 | |
77 | /* time of last status update */ | |
9134073b | 78 | unsigned long last_stats_update; |
ec8aa669 FF |
79 | |
80 | /* overhead time in usec for each frame */ | |
81 | unsigned int overhead; | |
82 | unsigned int overhead_rtscts; | |
83 | ||
84 | unsigned int total_packets; | |
85 | unsigned int sample_packets; | |
86 | ||
87 | /* tx flags to add for frames for this sta */ | |
88 | u32 tx_flags; | |
89 | ||
90 | u8 sample_wait; | |
91 | u8 sample_tries; | |
92 | u8 sample_count; | |
93 | u8 sample_slow; | |
94 | ||
95 | /* current MCS group to be sampled */ | |
96 | u8 sample_group; | |
97 | ||
a0497f9f FF |
98 | u8 cck_supported; |
99 | u8 cck_supported_short; | |
100 | ||
41d08583 FF |
101 | /* Bitfield of supported MCS rates of all groups */ |
102 | u16 supported[MINSTREL_GROUPS_NB]; | |
103 | ||
ec8aa669 | 104 | /* MCS rate group info and statistics */ |
8a0ee4fe | 105 | struct minstrel_mcs_group_data groups[MINSTREL_GROUPS_NB]; |
ec8aa669 FF |
106 | }; |
107 | ||
108 | struct minstrel_ht_sta_priv { | |
109 | union { | |
110 | struct minstrel_ht_sta ht; | |
111 | struct minstrel_sta_info legacy; | |
112 | }; | |
113 | #ifdef CONFIG_MAC80211_DEBUGFS | |
114 | struct dentry *dbg_stats; | |
2cae0b6a | 115 | struct dentry *dbg_stats_csv; |
ec8aa669 FF |
116 | #endif |
117 | void *ratelist; | |
118 | void *sample_table; | |
119 | bool is_ht; | |
120 | }; | |
121 | ||
122 | void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); | |
123 | void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta); | |
50e55a8e TH |
124 | int minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate, |
125 | int prob_ewma); | |
ec8aa669 FF |
126 | |
127 | #endif |