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