Felix Fietkau | ec8aa66 | 2010-05-13 16:48:03 +0200 | [diff] [blame] | 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 | |
Felix Fietkau | ec8aa66 | 2010-05-13 16:48:03 +0200 | [diff] [blame] | 19 | #define MCS_GROUP_RATES 8 |
| 20 | |
| 21 | struct mcs_group { |
| 22 | u32 flags; |
| 23 | unsigned int streams; |
| 24 | unsigned int duration[MCS_GROUP_RATES]; |
| 25 | }; |
| 26 | |
John W. Linville | de66bfd | 2010-06-24 13:03:14 -0400 | [diff] [blame] | 27 | extern const struct mcs_group minstrel_mcs_groups[]; |
| 28 | |
Felix Fietkau | ec8aa66 | 2010-05-13 16:48:03 +0200 | [diff] [blame] | 29 | struct minstrel_mcs_group_data { |
| 30 | u8 index; |
| 31 | u8 column; |
| 32 | |
| 33 | /* bitfield of supported MCS rates of this group */ |
| 34 | u8 supported; |
| 35 | |
Thomas Huehn | 5935839 | 2014-09-09 23:22:14 +0200 | [diff] [blame] | 36 | /* sorted rate set within a MCS group*/ |
| 37 | u8 max_group_tp_rate[MAX_THR_RATES]; |
| 38 | u8 max_group_prob_rate; |
Felix Fietkau | ec8aa66 | 2010-05-13 16:48:03 +0200 | [diff] [blame] | 39 | |
| 40 | /* MCS rate statistics */ |
| 41 | struct minstrel_rate_stats rates[MCS_GROUP_RATES]; |
| 42 | }; |
| 43 | |
| 44 | struct minstrel_ht_sta { |
Felix Fietkau | a856666 | 2013-04-22 16:14:42 +0200 | [diff] [blame] | 45 | struct ieee80211_sta *sta; |
| 46 | |
Felix Fietkau | ec8aa66 | 2010-05-13 16:48:03 +0200 | [diff] [blame] | 47 | /* ampdu length (average, per sampling interval) */ |
| 48 | unsigned int ampdu_len; |
| 49 | unsigned int ampdu_packets; |
| 50 | |
| 51 | /* ampdu length (EWMA) */ |
| 52 | unsigned int avg_ampdu_len; |
| 53 | |
Thomas Huehn | 5935839 | 2014-09-09 23:22:14 +0200 | [diff] [blame] | 54 | /* overall sorted rate set */ |
| 55 | u8 max_tp_rate[MAX_THR_RATES]; |
| 56 | u8 max_prob_rate; |
Felix Fietkau | ec8aa66 | 2010-05-13 16:48:03 +0200 | [diff] [blame] | 57 | |
| 58 | /* time of last status update */ |
| 59 | unsigned long stats_update; |
| 60 | |
| 61 | /* overhead time in usec for each frame */ |
| 62 | unsigned int overhead; |
| 63 | unsigned int overhead_rtscts; |
| 64 | |
| 65 | unsigned int total_packets; |
| 66 | unsigned int sample_packets; |
| 67 | |
| 68 | /* tx flags to add for frames for this sta */ |
| 69 | u32 tx_flags; |
| 70 | |
| 71 | u8 sample_wait; |
| 72 | u8 sample_tries; |
| 73 | u8 sample_count; |
| 74 | u8 sample_slow; |
| 75 | |
| 76 | /* current MCS group to be sampled */ |
| 77 | u8 sample_group; |
| 78 | |
Felix Fietkau | a0497f9 | 2013-02-13 10:51:08 +0100 | [diff] [blame] | 79 | u8 cck_supported; |
| 80 | u8 cck_supported_short; |
| 81 | |
Felix Fietkau | ec8aa66 | 2010-05-13 16:48:03 +0200 | [diff] [blame] | 82 | /* MCS rate group info and statistics */ |
Felix Fietkau | a0497f9 | 2013-02-13 10:51:08 +0100 | [diff] [blame] | 83 | struct minstrel_mcs_group_data groups[MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS + 1]; |
Felix Fietkau | ec8aa66 | 2010-05-13 16:48:03 +0200 | [diff] [blame] | 84 | }; |
| 85 | |
| 86 | struct minstrel_ht_sta_priv { |
| 87 | union { |
| 88 | struct minstrel_ht_sta ht; |
| 89 | struct minstrel_sta_info legacy; |
| 90 | }; |
| 91 | #ifdef CONFIG_MAC80211_DEBUGFS |
| 92 | struct dentry *dbg_stats; |
| 93 | #endif |
| 94 | void *ratelist; |
| 95 | void *sample_table; |
| 96 | bool is_ht; |
| 97 | }; |
| 98 | |
| 99 | void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); |
| 100 | void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta); |
| 101 | |
| 102 | #endif |