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