blob: a7f4e126f9c16dc127d79dc9c6d1ff1609c94622 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Nirav Shahbf1b0332016-05-25 14:27:39 +05302 * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
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
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080038#define DATA_RATE_11AC_MCS_MASK 0x03
39
40/* LL stats get request time out value */
Mukul Sharma71d0c572016-09-03 15:35:30 +053041#define WLAN_WAIT_TIME_LL_STATS 800
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080042
Himanshu Agarwal37e42412016-07-21 14:35:09 +053043#define WLAN_HDD_TGT_NOISE_FLOOR_DBM (-96)
44
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080045/**
46 * struct index_vht_data_rate_type - vht data rate type
47 * @beacon_rate_index: Beacon rate index
48 * @supported_VHT80_rate: VHT80 rate
49 * @supported_VHT40_rate: VHT40 rate
50 * @supported_VHT20_rate: VHT20 rate
51 */
52struct index_vht_data_rate_type {
53 uint8_t beacon_rate_index;
54 uint16_t supported_VHT80_rate[2];
55 uint16_t supported_VHT40_rate[2];
56 uint16_t supported_VHT20_rate[2];
57};
58
59/**
60 * enum - eDataRate11ACMaxMcs
61 * @DATA_RATE_11AC_MAX_MCS_7: MCS7 rate
62 * @DATA_RATE_11AC_MAX_MCS_8: MCS8 rate
63 * @DATA_RATE_11AC_MAX_MCS_9: MCS9 rate
64 * @DATA_RATE_11AC_MAX_MCS_NA:i Not applicable
65 */
66enum eDataRate11ACMaxMcs{
67 DATA_RATE_11AC_MAX_MCS_7,
68 DATA_RATE_11AC_MAX_MCS_8,
69 DATA_RATE_11AC_MAX_MCS_9,
70 DATA_RATE_11AC_MAX_MCS_NA
71};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080072
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 */
78struct 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 */
102int 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 */
116int 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 */
131int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy,
132 struct wireless_dev *wdev,
133 const void *data,
134 int data_len);
135
136void hdd_init_ll_stats_ctx(void);
Prashanth Bhatta75fa9a12016-01-11 18:30:08 -0800137
138static inline bool hdd_link_layer_stats_supported(void)
139{
140 return true;
141}
142
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800143#else
Prashanth Bhatta75fa9a12016-01-11 18:30:08 -0800144
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800145static inline void hdd_init_ll_stats_ctx(void)
146{
147 return;
148}
149
Prashanth Bhatta75fa9a12016-01-11 18:30:08 -0800150static inline bool hdd_link_layer_stats_supported(void)
151{
152 return false;
153}
154
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800155#endif /* End of WLAN_FEATURE_LINK_LAYER_STATS */
156
157#ifdef WLAN_FEATURE_STATS_EXT
158/**
159 * wlan_hdd_cfg80211_stats_ext_request() - ext stats request
160 * @wiphy: Pointer to wiphy
161 * @wdev: Pointer to wdev
162 * @data: Pointer to data
163 * @data_len: Data length
164 *
165 * Return: int
166 */
167int wlan_hdd_cfg80211_stats_ext_request(struct wiphy *wiphy,
168 struct wireless_dev *wdev,
169 const void *data,
170 int data_len);
Prashanth Bhatta75fa9a12016-01-11 18:30:08 -0800171
Prashanth Bhatta75fa9a12016-01-11 18:30:08 -0800172#else
173static inline void wlan_hdd_cfg80211_stats_ext_init(hdd_context_t *pHddCtx) {}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800174#endif /* End of WLAN_FEATURE_STATS_EXT */
175
176/**
177 * wlan_hdd_cfg80211_get_station() - get station statistics
178 * @wiphy: Pointer to wiphy
179 * @dev: Pointer to network device
180 * @mac: Pointer to mac
181 * @sinfo: Pointer to station info
182 *
183 * Return: 0 for success, non-zero for failure
184 */
185#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
186int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy,
187 struct net_device *dev, const uint8_t *mac,
188 struct station_info *sinfo);
189#else
190int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy,
191 struct net_device *dev, uint8_t *mac,
192 struct station_info *sinfo);
193#endif
194
Himanshu Agarwal37e42412016-07-21 14:35:09 +0530195/**
196 * wlan_hdd_cfg80211_dump_station() - dump station statistics
197 * @wiphy: Pointer to wiphy
198 * @dev: Pointer to network device
199 * @idx: variable to determine whether to get stats or not
200 * @mac: Pointer to mac
201 * @sinfo: Pointer to station info
202 *
203 * Return: 0 for success, non-zero for failure
204 */
205int wlan_hdd_cfg80211_dump_station(struct wiphy *wiphy,
206 struct net_device *dev,
207 int idx, u8 *mac,
208 struct station_info *sinfo);
209
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800210struct net_device_stats *hdd_get_stats(struct net_device *dev);
211
212int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy,
213 struct net_device *dev,
214 int idx, struct survey_info *survey);
Nirav Shahbf1b0332016-05-25 14:27:39 +0530215
216void hdd_display_hif_stats(void);
217void hdd_clear_hif_stats(void);
218
Arun Khandavalli4b55da72016-07-19 19:55:01 +0530219void wlan_hdd_cfg80211_stats_ext_callback(void *ctx,
220 tStatsExtEvent *msg);
221
222void wlan_hdd_cfg80211_link_layer_stats_callback(void *ctx,
223 int indType, void *pRsp);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800224#endif /* end #if !defined(WLAN_HDD_STATS_H) */
225