blob: c33031ff11e465c90ffe2f611206e188359228fe [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
43/**
44 * struct index_vht_data_rate_type - vht data rate type
45 * @beacon_rate_index: Beacon rate index
46 * @supported_VHT80_rate: VHT80 rate
47 * @supported_VHT40_rate: VHT40 rate
48 * @supported_VHT20_rate: VHT20 rate
49 */
50struct index_vht_data_rate_type {
51 uint8_t beacon_rate_index;
52 uint16_t supported_VHT80_rate[2];
53 uint16_t supported_VHT40_rate[2];
54 uint16_t supported_VHT20_rate[2];
55};
56
57/**
58 * enum - eDataRate11ACMaxMcs
59 * @DATA_RATE_11AC_MAX_MCS_7: MCS7 rate
60 * @DATA_RATE_11AC_MAX_MCS_8: MCS8 rate
61 * @DATA_RATE_11AC_MAX_MCS_9: MCS9 rate
62 * @DATA_RATE_11AC_MAX_MCS_NA:i Not applicable
63 */
64enum eDataRate11ACMaxMcs{
65 DATA_RATE_11AC_MAX_MCS_7,
66 DATA_RATE_11AC_MAX_MCS_8,
67 DATA_RATE_11AC_MAX_MCS_9,
68 DATA_RATE_11AC_MAX_MCS_NA
69};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080070
71/**
72 * struct index_data_rate_type - non vht data rate type
73 * @beacon_rate_index: Beacon rate index
74 * @supported_rate: Supported rate table
75 */
76struct index_data_rate_type {
77 uint8_t beacon_rate_index;
78 uint16_t supported_rate[4];
79};
80
81#ifdef WLAN_FEATURE_LINK_LAYER_STATS
82/*
83 * Used to allocate the size of 4096 for the link layer stats.
84 * The size of 4096 is considered assuming that all data per
85 * respective event fit with in the limit.Please take a call
86 * on the limit based on the data requirements on link layer
87 * statistics.
88 */
89#define LL_STATS_EVENT_BUF_SIZE 4096
90
91/**
92 * wlan_hdd_cfg80211_ll_stats_set() - set link layer stats
93 * @wiphy: Pointer to wiphy
94 * @wdev: Pointer to wdev
95 * @data: Pointer to data
96 * @data_len: Data length
97 *
98 * Return: int
99 */
100int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy,
101 struct wireless_dev *wdev,
102 const void *data,
103 int data_len);
104
105/**
106 * wlan_hdd_cfg80211_ll_stats_get() - get link layer stats
107 * @wiphy: Pointer to wiphy
108 * @wdev: Pointer to wdev
109 * @data: Pointer to data
110 * @data_len: Data length
111 *
112 * Return: int
113 */
114int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy,
115 struct wireless_dev *wdev,
116 const void *data,
117 int data_len);
118
119
120/**
121 * wlan_hdd_cfg80211_ll_stats_clear() - clear link layer stats
122 * @wiphy: Pointer to wiphy
123 * @wdev: Pointer to wdev
124 * @data: Pointer to data
125 * @data_len: Data length
126 *
127 * Return: int
128 */
129int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy,
130 struct wireless_dev *wdev,
131 const void *data,
132 int data_len);
133
134void hdd_init_ll_stats_ctx(void);
Prashanth Bhatta75fa9a12016-01-11 18:30:08 -0800135
136static inline bool hdd_link_layer_stats_supported(void)
137{
138 return true;
139}
140
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800141#else
Prashanth Bhatta75fa9a12016-01-11 18:30:08 -0800142
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800143static inline void hdd_init_ll_stats_ctx(void)
144{
145 return;
146}
147
Prashanth Bhatta75fa9a12016-01-11 18:30:08 -0800148static inline bool hdd_link_layer_stats_supported(void)
149{
150 return false;
151}
152
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800153#endif /* End of WLAN_FEATURE_LINK_LAYER_STATS */
154
155#ifdef WLAN_FEATURE_STATS_EXT
156/**
157 * wlan_hdd_cfg80211_stats_ext_request() - ext stats request
158 * @wiphy: Pointer to wiphy
159 * @wdev: Pointer to wdev
160 * @data: Pointer to data
161 * @data_len: Data length
162 *
163 * Return: int
164 */
165int wlan_hdd_cfg80211_stats_ext_request(struct wiphy *wiphy,
166 struct wireless_dev *wdev,
167 const void *data,
168 int data_len);
Prashanth Bhatta75fa9a12016-01-11 18:30:08 -0800169
Prashanth Bhatta75fa9a12016-01-11 18:30:08 -0800170#else
171static inline void wlan_hdd_cfg80211_stats_ext_init(hdd_context_t *pHddCtx) {}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800172#endif /* End of WLAN_FEATURE_STATS_EXT */
173
174/**
175 * wlan_hdd_cfg80211_get_station() - get station statistics
176 * @wiphy: Pointer to wiphy
177 * @dev: Pointer to network device
178 * @mac: Pointer to mac
179 * @sinfo: Pointer to station info
180 *
181 * Return: 0 for success, non-zero for failure
182 */
183#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
184int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy,
185 struct net_device *dev, const uint8_t *mac,
186 struct station_info *sinfo);
187#else
188int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy,
189 struct net_device *dev, uint8_t *mac,
190 struct station_info *sinfo);
191#endif
192
193struct net_device_stats *hdd_get_stats(struct net_device *dev);
194
195int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy,
196 struct net_device *dev,
197 int idx, struct survey_info *survey);
Nirav Shahbf1b0332016-05-25 14:27:39 +0530198
199void hdd_display_hif_stats(void);
200void hdd_clear_hif_stats(void);
201
Arun Khandavalli4b55da72016-07-19 19:55:01 +0530202void wlan_hdd_cfg80211_stats_ext_callback(void *ctx,
203 tStatsExtEvent *msg);
204
205void wlan_hdd_cfg80211_link_layer_stats_callback(void *ctx,
206 int indType, void *pRsp);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800207#endif /* end #if !defined(WLAN_HDD_STATS_H) */
208