blob: e747ac668afeecd137264c1be63a057cf47e6384 [file] [log] [blame]
Felix Fietkauec8aa662010-05-13 16:48:03 +02001/*
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 */
Karl Beldan8a0ee4f2014-10-20 15:46:00 +020016#define MINSTREL_MAX_STREAMS 3
17#define MINSTREL_HT_STREAM_GROUPS 4 /* BW(=2) * SGI(=2) */
18
19#define MINSTREL_HT_GROUPS_NB (MINSTREL_MAX_STREAMS * \
20 MINSTREL_HT_STREAM_GROUPS)
21#define MINSTREL_CCK_GROUPS_NB 1
22#define MINSTREL_GROUPS_NB (MINSTREL_HT_GROUPS_NB + \
23 MINSTREL_CCK_GROUPS_NB)
24
25#define MINSTREL_HT_GROUP_0 0
26#define MINSTREL_CCK_GROUP (MINSTREL_HT_GROUP_0 + MINSTREL_HT_GROUPS_NB)
Felix Fietkauec8aa662010-05-13 16:48:03 +020027
Felix Fietkauec8aa662010-05-13 16:48:03 +020028#define MCS_GROUP_RATES 8
29
30struct mcs_group {
31 u32 flags;
32 unsigned int streams;
33 unsigned int duration[MCS_GROUP_RATES];
34};
35
John W. Linvillede66bfd2010-06-24 13:03:14 -040036extern const struct mcs_group minstrel_mcs_groups[];
37
Felix Fietkauec8aa662010-05-13 16:48:03 +020038struct minstrel_mcs_group_data {
39 u8 index;
40 u8 column;
41
42 /* bitfield of supported MCS rates of this group */
43 u8 supported;
44
Thomas Huehn59358392014-09-09 23:22:14 +020045 /* sorted rate set within a MCS group*/
Karl Beldand4d141c2014-10-20 15:45:59 +020046 u16 max_group_tp_rate[MAX_THR_RATES];
47 u16 max_group_prob_rate;
Felix Fietkauec8aa662010-05-13 16:48:03 +020048
49 /* MCS rate statistics */
50 struct minstrel_rate_stats rates[MCS_GROUP_RATES];
51};
52
53struct minstrel_ht_sta {
Felix Fietkaua8566662013-04-22 16:14:42 +020054 struct ieee80211_sta *sta;
55
Felix Fietkauec8aa662010-05-13 16:48:03 +020056 /* ampdu length (average, per sampling interval) */
57 unsigned int ampdu_len;
58 unsigned int ampdu_packets;
59
60 /* ampdu length (EWMA) */
61 unsigned int avg_ampdu_len;
62
Thomas Huehn59358392014-09-09 23:22:14 +020063 /* overall sorted rate set */
Karl Beldand4d141c2014-10-20 15:45:59 +020064 u16 max_tp_rate[MAX_THR_RATES];
65 u16 max_prob_rate;
Felix Fietkauec8aa662010-05-13 16:48:03 +020066
67 /* time of last status update */
68 unsigned long stats_update;
69
70 /* overhead time in usec for each frame */
71 unsigned int overhead;
72 unsigned int overhead_rtscts;
73
74 unsigned int total_packets;
75 unsigned int sample_packets;
76
77 /* tx flags to add for frames for this sta */
78 u32 tx_flags;
79
80 u8 sample_wait;
81 u8 sample_tries;
82 u8 sample_count;
83 u8 sample_slow;
84
85 /* current MCS group to be sampled */
86 u8 sample_group;
87
Felix Fietkaua0497f92013-02-13 10:51:08 +010088 u8 cck_supported;
89 u8 cck_supported_short;
90
Felix Fietkauec8aa662010-05-13 16:48:03 +020091 /* MCS rate group info and statistics */
Karl Beldan8a0ee4f2014-10-20 15:46:00 +020092 struct minstrel_mcs_group_data groups[MINSTREL_GROUPS_NB];
Felix Fietkauec8aa662010-05-13 16:48:03 +020093};
94
95struct minstrel_ht_sta_priv {
96 union {
97 struct minstrel_ht_sta ht;
98 struct minstrel_sta_info legacy;
99 };
100#ifdef CONFIG_MAC80211_DEBUGFS
101 struct dentry *dbg_stats;
102#endif
103 void *ratelist;
104 void *sample_table;
105 bool is_ht;
106};
107
108void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
109void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta);
110
111#endif