blob: 96f8e2968aff060170f3c832b349fe0bfdf2eff5 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Jeff Johnson4e09dd02018-12-30 10:25:34 -08002 * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080019#ifndef __WEXT_IW_H__
20#define __WEXT_IW_H__
21
22#include <linux/version.h>
23#include <linux/module.h>
24#include <linux/netdevice.h>
25#include <linux/wireless.h>
26#include <net/iw_handler.h>
27#include <linux/timer.h>
Anurag Chouhance0dc992016-02-16 18:18:03 +053028#include "qdf_event.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080029
Jeff Johnson6d38ab82017-08-28 11:36:27 -070030struct hdd_context;
Jeff Johnsone4c11db2018-05-05 23:22:32 -070031struct sap_config;
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -080032
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080033/*
34 * order of parameters in addTs private ioctl
35 */
36#define HDD_WLAN_WMM_PARAM_HANDLE 0
37#define HDD_WLAN_WMM_PARAM_TID 1
38#define HDD_WLAN_WMM_PARAM_DIRECTION 2
39#define HDD_WLAN_WMM_PARAM_APSD 3
40#define HDD_WLAN_WMM_PARAM_USER_PRIORITY 4
41#define HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE 5
42#define HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE 6
43#define HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE 7
44#define HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE 8
45#define HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE 9
46#define HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE 10
47#define HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE 11
48#define HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE 12
49#define HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL 13
50#define HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL 14
51#define HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN 15
52#define HDD_WLAN_WMM_PARAM_ACK_POLICY 16
53#define HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL 17
54#define HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL 18
55#define HDD_WLAN_WMM_PARAM_COUNT 19
56
57#define MHZ 6
58
59#define WE_MAX_STR_LEN IW_PRIV_SIZE_MASK
60#define WLAN_HDD_UI_BAND_AUTO 0
61#define WLAN_HDD_UI_BAND_5_GHZ 1
62#define WLAN_HDD_UI_BAND_2_4_GHZ 2
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080063
Srinivas Girigowda48592672017-03-25 14:58:44 -070064enum hdd_wlan_wmm_direction {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080065 HDD_WLAN_WMM_DIRECTION_UPSTREAM = 0,
66 HDD_WLAN_WMM_DIRECTION_DOWNSTREAM = 1,
67 HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL = 2,
Srinivas Girigowda48592672017-03-25 14:58:44 -070068};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080069
Srinivas Girigowda48592672017-03-25 14:58:44 -070070enum hdd_wlan_wmm_power_save {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080071 HDD_WLAN_WMM_POWER_SAVE_LEGACY = 0,
72 HDD_WLAN_WMM_POWER_SAVE_UAPSD = 1,
Srinivas Girigowda48592672017-03-25 14:58:44 -070073};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080074
75typedef enum {
76 /* TSPEC/re-assoc done, async */
77 HDD_WLAN_WMM_STATUS_SETUP_SUCCESS = 0,
Srinivas Girigowda48592672017-03-25 14:58:44 -070078 /* no need to setup TSPEC since ACM=0 and no UAPSD desired,
79 * sync + async
80 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080081 HDD_WLAN_WMM_STATUS_SETUP_SUCCESS_NO_ACM_NO_UAPSD = 1,
Srinivas Girigowda48592672017-03-25 14:58:44 -070082 /* no need to setup TSPEC since ACM=0 and UAPSD already exists,
83 * sync + async
84 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080085 HDD_WLAN_WMM_STATUS_SETUP_SUCCESS_NO_ACM_UAPSD_EXISTING = 2,
86 /* TSPEC result pending, sync */
87 HDD_WLAN_WMM_STATUS_SETUP_PENDING = 3,
88 /* TSPEC/re-assoc failed, sync + async */
89 HDD_WLAN_WMM_STATUS_SETUP_FAILED = 4,
90 /* Request rejected due to invalid params, sync + async */
91 HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM = 5,
92 /* TSPEC request rejected since AP!=QAP, sync */
93 HDD_WLAN_WMM_STATUS_SETUP_FAILED_NO_WMM = 6,
94
95 /* TSPEC modification/re-assoc successful, async */
96 HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS = 7,
Srinivas Girigowda48592672017-03-25 14:58:44 -070097 /* TSPEC modification a no-op since ACM=0 and
98 * no change in UAPSD, sync + async
99 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800100 HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS_NO_ACM_NO_UAPSD = 8,
Srinivas Girigowda48592672017-03-25 14:58:44 -0700101 /* TSPEC modification a no-op since ACM=0 and
102 * requested U-APSD already exists, sync + async
103 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800104 HDD_WLAN_WMM_STATUS_MODIFY_SUCCESS_NO_ACM_UAPSD_EXISTING = 9,
105 /* TSPEC result pending, sync */
106 HDD_WLAN_WMM_STATUS_MODIFY_PENDING = 10,
107 /* TSPEC modification failed, prev TSPEC in effect, sync + async */
108 HDD_WLAN_WMM_STATUS_MODIFY_FAILED = 11,
Srinivas Girigowda48592672017-03-25 14:58:44 -0700109 /* TSPEC modification request rejected due to invalid params,
110 * sync + async
111 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800112 HDD_WLAN_WMM_STATUS_MODIFY_FAILED_BAD_PARAM = 12,
113
114 /* TSPEC release successful, sync and also async */
115 HDD_WLAN_WMM_STATUS_RELEASE_SUCCESS = 13,
116 /* TSPEC release pending, sync */
117 HDD_WLAN_WMM_STATUS_RELEASE_PENDING = 14,
118 /* TSPEC release failed, sync + async */
119 HDD_WLAN_WMM_STATUS_RELEASE_FAILED = 15,
120 /* TSPEC release rejected due to invalid params, sync */
121 HDD_WLAN_WMM_STATUS_RELEASE_FAILED_BAD_PARAM = 16,
122 /* TSPEC modified due to the mux'ing of requests on ACs, async */
123
124 HDD_WLAN_WMM_STATUS_MODIFIED = 17,
125 /* TSPEC revoked by AP, async */
126 HDD_WLAN_WMM_STATUS_LOST = 18,
127 /* some internal failure like memory allocation failure, etc, sync */
128 HDD_WLAN_WMM_STATUS_INTERNAL_FAILURE = 19,
129
Srinivas Girigowda48592672017-03-25 14:58:44 -0700130 /* U-APSD failed during setup but OTA setup (whether TSPEC exchnage or
131 * re-assoc) was done so app should release this QoS, async
132 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800133 HDD_WLAN_WMM_STATUS_SETUP_UAPSD_SET_FAILED = 20,
Srinivas Girigowda48592672017-03-25 14:58:44 -0700134 /* U-APSD failed during modify, but OTA setup (whether TSPEC exchnage or
135 * re-assoc) was done so app should release this QoS, async
136 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800137 HDD_WLAN_WMM_STATUS_MODIFY_UAPSD_SET_FAILED = 21
138} hdd_wlan_wmm_status_e;
139
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800140/** Enable 11d */
141#define ENABLE_11D 1
142
143/** Disable 11d */
144#define DISABLE_11D 0
145
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800146#define HDD_RTSCTS_EN_MASK 0xF
147#define HDD_RTSCTS_ENABLE 1
148#define HDD_CTS_ENABLE 2
149
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800150#define HDD_AUTO_RATE_SGI 0x8
151
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800152/* Packet Types. */
153#define WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP 2
154#define WLAN_KEEP_ALIVE_NULL_PKT 1
155
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +0530156/*
157 * Defines for fw_test command
158 */
159#define HDD_FWTEST_PARAMS 3
160#define HDD_FWTEST_SU_PARAM_ID 53
161#define HDD_FWTEST_MU_PARAM_ID 2
162#define HDD_FWTEST_SU_DEFAULT_VALUE 100
163#define HDD_FWTEST_MU_DEFAULT_VALUE 40
164#define HDD_FWTEST_MAX_VALUE 500
165
Rachit Kankane0dc3e852018-05-07 17:33:42 +0530166#ifdef WLAN_WEXT_SUPPORT_ENABLE
Jeff Johnson7f2c5912018-03-23 11:42:28 -0700167/**
168 * hdd_unregister_wext() - unregister wext context
169 * @dev: net device handle
170 *
171 * Unregisters wext interface context for a given net device
172 *
173 * Returns: None
174 */
175void hdd_unregister_wext(struct net_device *dev);
176
177/**
178 * hdd_register_wext() - register wext context
179 * @dev: net device handle
180 *
181 * Registers wext interface context for a given net device
182 *
183 * Returns: None
184 */
185void hdd_register_wext(struct net_device *dev);
186
Rajeev Kumarf5a17ac2018-03-08 16:30:21 -0800187void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length,
188 char *buffer, uint16_t buf_len);
189void hdd_wlan_list_fw_profile(uint16_t *length,
190 char *buffer, uint16_t buf_len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800191
Rajeev Kumarf5a17ac2018-03-08 16:30:21 -0800192int iw_set_var_ints_getnone(struct net_device *dev,
193 struct iw_request_info *info,
194 union iwreq_data *wrqu, char *extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800195
Rajeev Kumarf5a17ac2018-03-08 16:30:21 -0800196int iw_set_three_ints_getnone(struct net_device *dev,
197 struct iw_request_info *info,
198 union iwreq_data *wrqu, char *extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800199
Rajeev Kumarf5a17ac2018-03-08 16:30:21 -0800200int hdd_priv_get_data(struct iw_point *p_priv_data,
201 union iwreq_data *wrqu);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800202
Rajeev Kumarf5a17ac2018-03-08 16:30:21 -0800203void *mem_alloc_copy_from_user_helper(const void *wrqu_data, size_t len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800204
Jeff Johnson3d278b02017-08-29 14:17:47 -0700205int hdd_get_ldpc(struct hdd_adapter *adapter, int *value);
Jeff Johnson1ca04762018-10-25 10:24:39 -0700206
207/**
208 * hdd_set_ldpc() - Set adapter LDPC
209 * @adapter: adapter being modified
210 * @value: new LDPC value
211 *
212 * Return: 0 on success, negative errno on failure
213 */
Jeff Johnson3d278b02017-08-29 14:17:47 -0700214int hdd_set_ldpc(struct hdd_adapter *adapter, int value);
Jeff Johnson1ca04762018-10-25 10:24:39 -0700215
Jeff Johnson3d278b02017-08-29 14:17:47 -0700216int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value);
Jeff Johnson57ff4fa2018-10-25 10:29:47 -0700217
218/**
219 * hdd_set_tx_stbc() - Set adapter TX STBC
220 * @adapter: adapter being modified
221 * @value: new TX STBC value
222 *
223 * Return: 0 on success, negative errno on failure
224 */
Jeff Johnson3d278b02017-08-29 14:17:47 -0700225int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value);
Jeff Johnson57ff4fa2018-10-25 10:29:47 -0700226
Jeff Johnson3d278b02017-08-29 14:17:47 -0700227int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value);
Jeff Johnsonb6645852018-10-25 10:35:41 -0700228
229/**
230 * hdd_set_rx_stbc() - Set adapter RX STBC
231 * @adapter: adapter being modified
232 * @value: new RX STBC value
233 *
234 * Return: 0 on success, negative errno on failure
235 */
Jeff Johnson3d278b02017-08-29 14:17:47 -0700236int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value);
Manjeet Singhe80d6d82016-09-02 19:04:41 +0530237
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -0800238/**
239 * hdd_assemble_rate_code() - assemble rate code to be sent to FW
240 * @preamble: rate preamble
241 * @nss: number of streams
242 * @rate: rate index
243 *
244 * Rate code assembling is different for targets which are 11ax capable.
245 * Check for the target support and assemble the rate code accordingly.
246 *
247 * Return: assembled rate code
248 */
249int hdd_assemble_rate_code(uint8_t preamble, uint8_t nss, uint8_t rate);
250
251/**
252 * hdd_set_11ax_rate() - set 11ax rate
253 * @adapter: adapter being modified
254 * @value: new 11ax rate code
255 * @sap_config: pointer to SAP config to check HW mode
256 * this will be NULL for call from STA persona
257 *
258 * Return: 0 on success, negative errno on failure
259 */
Jeff Johnson3d278b02017-08-29 14:17:47 -0700260int hdd_set_11ax_rate(struct hdd_adapter *adapter, int value,
Jeff Johnsone4c11db2018-05-05 23:22:32 -0700261 struct sap_config *sap_config);
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -0800262
Jeff Johnsonc1713242018-10-23 13:45:42 -0700263/**
264 * wlan_hdd_update_phymode() - handle change in PHY mode
265 * @adapter: adapter being modified
266 * @new_phymode: new PHY mode for the device
267 *
268 * This function is called when the device is set to a new PHY mode.
269 * It takes a holistic look at the desired PHY mode along with the
270 * configured capabilities of the driver and the reported capabilities
271 * of the hardware in order to correctly configure all PHY-related
272 * parameters.
273 *
274 * Return: 0 on success, negative errno value on error
275 */
276int wlan_hdd_update_phymode(struct hdd_adapter *adapter, int new_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800277
Jeff Johnson441e1f72017-02-07 08:50:49 -0800278struct iw_request_info;
Jeff Johnson4e632672017-10-03 11:40:51 -0700279
Jeff Johnson441e1f72017-02-07 08:50:49 -0800280/**
Jeff Johnson441e1f72017-02-07 08:50:49 -0800281 * hdd_check_private_wext_control() - Check to see if private
282 * wireless extensions ioctls are allowed
283 * @hdd_ctx: Global HDD context
284 * @info: Wireless extensions ioctl information passed by the kernel
285 *
286 * This function will examine the "private_wext_control" configuration
287 * item to determine whether or not private wireless extensions ioctls
288 * are allowed.
289 *
290 * Return: 0 if the ioctl is allowed to be processed, -ENOTSUPP if the
291 * ioctls have been disabled. Note that in addition to returning
292 * status, this function will log a message if the ioctls are disabled
293 * or deprecated.
294 */
Jeff Johnson82797b62017-08-11 15:31:27 -0700295int hdd_check_private_wext_control(struct hdd_context *hdd_ctx,
Jeff Johnson441e1f72017-02-07 08:50:49 -0800296 struct iw_request_info *info);
297
Will Huang496b36c2017-07-11 16:38:50 +0800298/**
Jeff Johnsondf5d7792018-04-14 15:58:24 -0700299 * hdd_crash_inject() - Inject a crash
300 * @adapter: Adapter upon which the command was received
301 * @v1: first value to inject
302 * @v2: second value to inject
303 *
304 * This function is the handler for the crash inject debug feature.
305 * This feature only exists for internal testing and must not be
306 * enabled on a production device.
307 *
308 * Return: result of the command
309 */
310#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
311int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2);
312#else
313static inline
314int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2)
315{
316 return -ENOTSUPP;
317}
318#endif
319
Nirav Shahd21a2e32018-04-20 16:34:43 +0530320#ifdef CONFIG_DP_TRACE
321void hdd_set_dump_dp_trace(uint16_t cmd_type, uint16_t count);
322#else
323static inline
324void hdd_set_dump_dp_trace(uint16_t cmd_type, uint16_t count) {}
325#endif
Rachit Kankane0dc3e852018-05-07 17:33:42 +0530326#else /* WLAN_WEXT_SUPPORT_ENABLE */
327
328static inline void hdd_unregister_wext(struct net_device *dev)
329{
330}
331
332static inline void hdd_register_wext(struct net_device *dev)
333{
334}
335#endif /* WLAN_WEXT_SUPPORT_ENABLE */
Nirav Shahd21a2e32018-04-20 16:34:43 +0530336
Jeff Johnson0187c622019-01-04 06:39:44 -0800337#if defined(WLAN_WEXT_SUPPORT_ENABLE) && defined(HASTINGS_BT_WAR)
338int hdd_hastings_bt_war_enable_fw(struct hdd_context *hdd_ctx);
339int hdd_hastings_bt_war_disable_fw(struct hdd_context *hdd_ctx);
340#else
341static inline
342int hdd_hastings_bt_war_enable_fw(struct hdd_context *hdd_ctx)
343{
344 return -ENOTSUPP;
345}
346
347static inline
348int hdd_hastings_bt_war_disable_fw(struct hdd_context *hdd_ctx)
349{
350 return -ENOTSUPP;
351}
352
353#endif
354
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800355#endif /* __WEXT_IW_H__ */