Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /** |
| 23 | * DOC : wlan_hdd_stats.h |
| 24 | * |
| 25 | * WLAN Host Device Driver statistics related implementation |
| 26 | * |
| 27 | */ |
| 28 | |
| 29 | #if !defined(WLAN_HDD_STATS_H) |
| 30 | #define WLAN_HDD_STATS_H |
| 31 | |
| 32 | #include "wlan_hdd_main.h" |
| 33 | |
| 34 | #define INVALID_MCS_IDX 255 |
| 35 | #define MAX_HT_MCS_IDX 8 |
| 36 | #define MAX_VHT_MCS_IDX 10 |
| 37 | |
| 38 | #ifdef WLAN_FEATURE_11AC |
| 39 | #define DATA_RATE_11AC_MCS_MASK 0x03 |
| 40 | |
| 41 | /* LL stats get request time out value */ |
| 42 | #define WLAN_WAIT_TIME_LL_STATS 5000 |
| 43 | |
| 44 | /** |
| 45 | * struct index_vht_data_rate_type - vht data rate type |
| 46 | * @beacon_rate_index: Beacon rate index |
| 47 | * @supported_VHT80_rate: VHT80 rate |
| 48 | * @supported_VHT40_rate: VHT40 rate |
| 49 | * @supported_VHT20_rate: VHT20 rate |
| 50 | */ |
| 51 | struct index_vht_data_rate_type { |
| 52 | uint8_t beacon_rate_index; |
| 53 | uint16_t supported_VHT80_rate[2]; |
| 54 | uint16_t supported_VHT40_rate[2]; |
| 55 | uint16_t supported_VHT20_rate[2]; |
| 56 | }; |
| 57 | |
| 58 | /** |
| 59 | * enum - eDataRate11ACMaxMcs |
| 60 | * @DATA_RATE_11AC_MAX_MCS_7: MCS7 rate |
| 61 | * @DATA_RATE_11AC_MAX_MCS_8: MCS8 rate |
| 62 | * @DATA_RATE_11AC_MAX_MCS_9: MCS9 rate |
| 63 | * @DATA_RATE_11AC_MAX_MCS_NA:i Not applicable |
| 64 | */ |
| 65 | enum eDataRate11ACMaxMcs{ |
| 66 | DATA_RATE_11AC_MAX_MCS_7, |
| 67 | DATA_RATE_11AC_MAX_MCS_8, |
| 68 | DATA_RATE_11AC_MAX_MCS_9, |
| 69 | DATA_RATE_11AC_MAX_MCS_NA |
| 70 | }; |
| 71 | #endif /* End of WLAN_FEATURE_11AC */ |
| 72 | |
| 73 | /** |
| 74 | * struct index_data_rate_type - non vht data rate type |
| 75 | * @beacon_rate_index: Beacon rate index |
| 76 | * @supported_rate: Supported rate table |
| 77 | */ |
| 78 | struct index_data_rate_type { |
| 79 | uint8_t beacon_rate_index; |
| 80 | uint16_t supported_rate[4]; |
| 81 | }; |
| 82 | |
| 83 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 84 | /* |
| 85 | * Used to allocate the size of 4096 for the link layer stats. |
| 86 | * The size of 4096 is considered assuming that all data per |
| 87 | * respective event fit with in the limit.Please take a call |
| 88 | * on the limit based on the data requirements on link layer |
| 89 | * statistics. |
| 90 | */ |
| 91 | #define LL_STATS_EVENT_BUF_SIZE 4096 |
| 92 | |
| 93 | /** |
| 94 | * wlan_hdd_cfg80211_ll_stats_set() - set link layer stats |
| 95 | * @wiphy: Pointer to wiphy |
| 96 | * @wdev: Pointer to wdev |
| 97 | * @data: Pointer to data |
| 98 | * @data_len: Data length |
| 99 | * |
| 100 | * Return: int |
| 101 | */ |
| 102 | int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 103 | struct wireless_dev *wdev, |
| 104 | const void *data, |
| 105 | int data_len); |
| 106 | |
| 107 | /** |
| 108 | * wlan_hdd_cfg80211_ll_stats_get() - get link layer stats |
| 109 | * @wiphy: Pointer to wiphy |
| 110 | * @wdev: Pointer to wdev |
| 111 | * @data: Pointer to data |
| 112 | * @data_len: Data length |
| 113 | * |
| 114 | * Return: int |
| 115 | */ |
| 116 | int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 117 | struct wireless_dev *wdev, |
| 118 | const void *data, |
| 119 | int data_len); |
| 120 | |
| 121 | |
| 122 | /** |
| 123 | * wlan_hdd_cfg80211_ll_stats_clear() - clear link layer stats |
| 124 | * @wiphy: Pointer to wiphy |
| 125 | * @wdev: Pointer to wdev |
| 126 | * @data: Pointer to data |
| 127 | * @data_len: Data length |
| 128 | * |
| 129 | * Return: int |
| 130 | */ |
| 131 | int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 132 | struct wireless_dev *wdev, |
| 133 | const void *data, |
| 134 | int data_len); |
| 135 | |
| 136 | void hdd_init_ll_stats_ctx(void); |
| 137 | #else |
| 138 | static inline void hdd_init_ll_stats_ctx(void) |
| 139 | { |
| 140 | return; |
| 141 | } |
| 142 | |
| 143 | #endif /* End of WLAN_FEATURE_LINK_LAYER_STATS */ |
| 144 | |
| 145 | #ifdef WLAN_FEATURE_STATS_EXT |
| 146 | /** |
| 147 | * wlan_hdd_cfg80211_stats_ext_request() - ext stats request |
| 148 | * @wiphy: Pointer to wiphy |
| 149 | * @wdev: Pointer to wdev |
| 150 | * @data: Pointer to data |
| 151 | * @data_len: Data length |
| 152 | * |
| 153 | * Return: int |
| 154 | */ |
| 155 | int wlan_hdd_cfg80211_stats_ext_request(struct wiphy *wiphy, |
| 156 | struct wireless_dev *wdev, |
| 157 | const void *data, |
| 158 | int data_len); |
| 159 | #endif /* End of WLAN_FEATURE_STATS_EXT */ |
| 160 | |
| 161 | /** |
| 162 | * wlan_hdd_cfg80211_get_station() - get station statistics |
| 163 | * @wiphy: Pointer to wiphy |
| 164 | * @dev: Pointer to network device |
| 165 | * @mac: Pointer to mac |
| 166 | * @sinfo: Pointer to station info |
| 167 | * |
| 168 | * Return: 0 for success, non-zero for failure |
| 169 | */ |
| 170 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) |
| 171 | int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, |
| 172 | struct net_device *dev, const uint8_t *mac, |
| 173 | struct station_info *sinfo); |
| 174 | #else |
| 175 | int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, |
| 176 | struct net_device *dev, uint8_t *mac, |
| 177 | struct station_info *sinfo); |
| 178 | #endif |
| 179 | |
| 180 | struct net_device_stats *hdd_get_stats(struct net_device *dev); |
| 181 | |
| 182 | int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 183 | struct net_device *dev, |
| 184 | int idx, struct survey_info *survey); |
| 185 | #endif /* end #if !defined(WLAN_HDD_STATS_H) */ |
| 186 | |