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) */ |
| 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 Fietkau | ec8aa66 | 2010-05-13 16:48:03 +0200 | [diff] [blame] | 27 | |
Felix Fietkau | ec8aa66 | 2010-05-13 16:48:03 +0200 | [diff] [blame] | 28 | #define MCS_GROUP_RATES 8 |
| 29 | |
| 30 | struct mcs_group { |
| 31 | u32 flags; |
| 32 | unsigned int streams; |
| 33 | unsigned int duration[MCS_GROUP_RATES]; |
| 34 | }; |
| 35 | |
John W. Linville | de66bfd | 2010-06-24 13:03:14 -0400 | [diff] [blame] | 36 | extern const struct mcs_group minstrel_mcs_groups[]; |
| 37 | |
Felix Fietkau | ec8aa66 | 2010-05-13 16:48:03 +0200 | [diff] [blame] | 38 | struct 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 Huehn | 5935839 | 2014-09-09 23:22:14 +0200 | [diff] [blame] | 45 | /* sorted rate set within a MCS group*/ |
Karl Beldan | d4d141c | 2014-10-20 15:45:59 +0200 | [diff] [blame] | 46 | u16 max_group_tp_rate[MAX_THR_RATES]; |
| 47 | u16 max_group_prob_rate; |
Felix Fietkau | ec8aa66 | 2010-05-13 16:48:03 +0200 | [diff] [blame] | 48 | |
| 49 | /* MCS rate statistics */ |
| 50 | struct minstrel_rate_stats rates[MCS_GROUP_RATES]; |
| 51 | }; |
| 52 | |
| 53 | struct minstrel_ht_sta { |
Felix Fietkau | a856666 | 2013-04-22 16:14:42 +0200 | [diff] [blame] | 54 | struct ieee80211_sta *sta; |
| 55 | |
Felix Fietkau | ec8aa66 | 2010-05-13 16:48:03 +0200 | [diff] [blame] | 56 | /* 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 Huehn | 5935839 | 2014-09-09 23:22:14 +0200 | [diff] [blame] | 63 | /* overall sorted rate set */ |
Karl Beldan | d4d141c | 2014-10-20 15:45:59 +0200 | [diff] [blame] | 64 | u16 max_tp_rate[MAX_THR_RATES]; |
| 65 | u16 max_prob_rate; |
Felix Fietkau | ec8aa66 | 2010-05-13 16:48:03 +0200 | [diff] [blame] | 66 | |
| 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 Fietkau | a0497f9 | 2013-02-13 10:51:08 +0100 | [diff] [blame] | 88 | u8 cck_supported; |
| 89 | u8 cck_supported_short; |
| 90 | |
Felix Fietkau | ec8aa66 | 2010-05-13 16:48:03 +0200 | [diff] [blame] | 91 | /* MCS rate group info and statistics */ |
Karl Beldan | 8a0ee4f | 2014-10-20 15:46:00 +0200 | [diff] [blame^] | 92 | struct minstrel_mcs_group_data groups[MINSTREL_GROUPS_NB]; |
Felix Fietkau | ec8aa66 | 2010-05-13 16:48:03 +0200 | [diff] [blame] | 93 | }; |
| 94 | |
| 95 | struct 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 | |
| 108 | void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); |
| 109 | void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta); |
| 110 | |
| 111 | #endif |