Linux 5.1.15
[linux/fpc-iii.git] / net / mac80211 / rc80211_minstrel_ht.h
blob26b7a3244b478ec329dafe198454b66c9dcbdd2f
1 /*
2 * Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org>
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 */
9 #ifndef __RC_MINSTREL_HT_H
10 #define __RC_MINSTREL_HT_H
13 * The number of streams can be changed to 2 to reduce code
14 * size and memory footprint.
16 #define MINSTREL_MAX_STREAMS 3
17 #define MINSTREL_HT_STREAM_GROUPS 4 /* BW(=2) * SGI(=2) */
18 #define MINSTREL_VHT_STREAM_GROUPS 6 /* BW(=3) * SGI(=2) */
20 #define MINSTREL_HT_GROUPS_NB (MINSTREL_MAX_STREAMS * \
21 MINSTREL_HT_STREAM_GROUPS)
22 #define MINSTREL_VHT_GROUPS_NB (MINSTREL_MAX_STREAMS * \
23 MINSTREL_VHT_STREAM_GROUPS)
24 #define MINSTREL_CCK_GROUPS_NB 1
25 #define MINSTREL_GROUPS_NB (MINSTREL_HT_GROUPS_NB + \
26 MINSTREL_VHT_GROUPS_NB + \
27 MINSTREL_CCK_GROUPS_NB)
29 #define MINSTREL_HT_GROUP_0 0
30 #define MINSTREL_CCK_GROUP (MINSTREL_HT_GROUP_0 + MINSTREL_HT_GROUPS_NB)
31 #define MINSTREL_VHT_GROUP_0 (MINSTREL_CCK_GROUP + 1)
33 #define MCS_GROUP_RATES 10
35 struct mcs_group {
36 u16 flags;
37 u8 streams;
38 u8 shift;
39 u16 duration[MCS_GROUP_RATES];
42 extern const struct mcs_group minstrel_mcs_groups[];
44 struct minstrel_mcs_group_data {
45 u8 index;
46 u8 column;
48 /* sorted rate set within a MCS group*/
49 u16 max_group_tp_rate[MAX_THR_RATES];
50 u16 max_group_prob_rate;
52 /* MCS rate statistics */
53 struct minstrel_rate_stats rates[MCS_GROUP_RATES];
56 struct minstrel_ht_sta {
57 struct ieee80211_sta *sta;
59 /* ampdu length (average, per sampling interval) */
60 unsigned int ampdu_len;
61 unsigned int ampdu_packets;
63 /* ampdu length (EWMA) */
64 unsigned int avg_ampdu_len;
66 /* overall sorted rate set */
67 u16 max_tp_rate[MAX_THR_RATES];
68 u16 max_prob_rate;
70 /* time of last status update */
71 unsigned long last_stats_update;
73 /* overhead time in usec for each frame */
74 unsigned int overhead;
75 unsigned int overhead_rtscts;
77 unsigned int total_packets;
78 unsigned int sample_packets;
80 /* tx flags to add for frames for this sta */
81 u32 tx_flags;
83 u8 sample_wait;
84 u8 sample_tries;
85 u8 sample_count;
86 u8 sample_slow;
88 /* current MCS group to be sampled */
89 u8 sample_group;
91 u8 cck_supported;
92 u8 cck_supported_short;
94 /* Bitfield of supported MCS rates of all groups */
95 u16 supported[MINSTREL_GROUPS_NB];
97 /* MCS rate group info and statistics */
98 struct minstrel_mcs_group_data groups[MINSTREL_GROUPS_NB];
101 struct minstrel_ht_sta_priv {
102 union {
103 struct minstrel_ht_sta ht;
104 struct minstrel_sta_info legacy;
106 void *ratelist;
107 void *sample_table;
108 bool is_ht;
111 void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
112 int minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate,
113 int prob_ewma);
115 #endif