blob: 618ae55c8af538bae6b0c8f7c5803f2379070504 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Jeff Johnson111ad912018-03-08 10:17:56 -08002 * Copyright (c) 2012-2018 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
140/** TS Info Ack Policy */
Srinivas Girigowda48592672017-03-25 14:58:44 -0700141enum hdd_wlan_wmm_ts_info_ack_policy {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800142 HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK = 0,
143 HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK = 1,
Srinivas Girigowda48592672017-03-25 14:58:44 -0700144};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800145
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800146/** Enable 11d */
147#define ENABLE_11D 1
148
149/** Disable 11d */
150#define DISABLE_11D 0
151
152/*
Srinivas Girigowda48592672017-03-25 14:58:44 -0700153 * refer wpa.h in wpa supplicant code for REASON_MICHAEL_MIC_FAILURE
154 *
155 * supplicant sets REASON_MICHAEL_MIC_FAILURE as the reason code when it
156 * sends the MLME deauth IOCTL for TKIP counter measures
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800157 */
158#define HDD_REASON_MICHAEL_MIC_FAILURE 14
159
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800160#define HDD_RTSCTS_EN_MASK 0xF
161#define HDD_RTSCTS_ENABLE 1
162#define HDD_CTS_ENABLE 2
163
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800164#define HDD_AUTO_RATE_SGI 0x8
165
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800166/* Packet Types. */
167#define WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP 2
168#define WLAN_KEEP_ALIVE_NULL_PKT 1
169
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +0530170/*
171 * Defines for fw_test command
172 */
173#define HDD_FWTEST_PARAMS 3
174#define HDD_FWTEST_SU_PARAM_ID 53
175#define HDD_FWTEST_MU_PARAM_ID 2
176#define HDD_FWTEST_SU_DEFAULT_VALUE 100
177#define HDD_FWTEST_MU_DEFAULT_VALUE 40
178#define HDD_FWTEST_MAX_VALUE 500
179
Rachit Kankane0dc3e852018-05-07 17:33:42 +0530180#ifdef WLAN_WEXT_SUPPORT_ENABLE
Jeff Johnson7f2c5912018-03-23 11:42:28 -0700181/**
182 * hdd_unregister_wext() - unregister wext context
183 * @dev: net device handle
184 *
185 * Unregisters wext interface context for a given net device
186 *
187 * Returns: None
188 */
189void hdd_unregister_wext(struct net_device *dev);
190
191/**
192 * hdd_register_wext() - register wext context
193 * @dev: net device handle
194 *
195 * Registers wext interface context for a given net device
196 *
197 * Returns: None
198 */
199void hdd_register_wext(struct net_device *dev);
200
Rajeev Kumarf5a17ac2018-03-08 16:30:21 -0800201void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length,
202 char *buffer, uint16_t buf_len);
203void hdd_wlan_list_fw_profile(uint16_t *length,
204 char *buffer, uint16_t buf_len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800205
Rajeev Kumarf5a17ac2018-03-08 16:30:21 -0800206int iw_set_var_ints_getnone(struct net_device *dev,
207 struct iw_request_info *info,
208 union iwreq_data *wrqu, char *extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800209
Rajeev Kumarf5a17ac2018-03-08 16:30:21 -0800210int iw_set_three_ints_getnone(struct net_device *dev,
211 struct iw_request_info *info,
212 union iwreq_data *wrqu, char *extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800213
Rajeev Kumarf5a17ac2018-03-08 16:30:21 -0800214int hdd_priv_get_data(struct iw_point *p_priv_data,
215 union iwreq_data *wrqu);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800216
Rajeev Kumarf5a17ac2018-03-08 16:30:21 -0800217void *mem_alloc_copy_from_user_helper(const void *wrqu_data, size_t len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800218
Jeff Johnson3d278b02017-08-29 14:17:47 -0700219int hdd_get_ldpc(struct hdd_adapter *adapter, int *value);
220int hdd_set_ldpc(struct hdd_adapter *adapter, int value);
221int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value);
222int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value);
223int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value);
224int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value);
Manjeet Singhe80d6d82016-09-02 19:04:41 +0530225
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -0800226/**
227 * hdd_assemble_rate_code() - assemble rate code to be sent to FW
228 * @preamble: rate preamble
229 * @nss: number of streams
230 * @rate: rate index
231 *
232 * Rate code assembling is different for targets which are 11ax capable.
233 * Check for the target support and assemble the rate code accordingly.
234 *
235 * Return: assembled rate code
236 */
237int hdd_assemble_rate_code(uint8_t preamble, uint8_t nss, uint8_t rate);
238
239/**
240 * hdd_set_11ax_rate() - set 11ax rate
241 * @adapter: adapter being modified
242 * @value: new 11ax rate code
243 * @sap_config: pointer to SAP config to check HW mode
244 * this will be NULL for call from STA persona
245 *
246 * Return: 0 on success, negative errno on failure
247 */
Jeff Johnson3d278b02017-08-29 14:17:47 -0700248int hdd_set_11ax_rate(struct hdd_adapter *adapter, int value,
Jeff Johnsone4c11db2018-05-05 23:22:32 -0700249 struct sap_config *sap_config);
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -0800250
Jeff Johnsoncec6e922018-06-12 16:17:27 -0700251int wlan_hdd_update_phymode(struct net_device *net, mac_handle_t mac_handle,
Jeff Johnson6d38ab82017-08-28 11:36:27 -0700252 int new_phymode, struct hdd_context *phddctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800253
Jeff Johnson441e1f72017-02-07 08:50:49 -0800254struct iw_request_info;
Jeff Johnson4e632672017-10-03 11:40:51 -0700255
Jeff Johnson441e1f72017-02-07 08:50:49 -0800256/**
Jeff Johnson441e1f72017-02-07 08:50:49 -0800257 * hdd_check_private_wext_control() - Check to see if private
258 * wireless extensions ioctls are allowed
259 * @hdd_ctx: Global HDD context
260 * @info: Wireless extensions ioctl information passed by the kernel
261 *
262 * This function will examine the "private_wext_control" configuration
263 * item to determine whether or not private wireless extensions ioctls
264 * are allowed.
265 *
266 * Return: 0 if the ioctl is allowed to be processed, -ENOTSUPP if the
267 * ioctls have been disabled. Note that in addition to returning
268 * status, this function will log a message if the ioctls are disabled
269 * or deprecated.
270 */
Jeff Johnson82797b62017-08-11 15:31:27 -0700271int hdd_check_private_wext_control(struct hdd_context *hdd_ctx,
Jeff Johnson441e1f72017-02-07 08:50:49 -0800272 struct iw_request_info *info);
273
Will Huang496b36c2017-07-11 16:38:50 +0800274/**
Jeff Johnsondf5d7792018-04-14 15:58:24 -0700275 * hdd_crash_inject() - Inject a crash
276 * @adapter: Adapter upon which the command was received
277 * @v1: first value to inject
278 * @v2: second value to inject
279 *
280 * This function is the handler for the crash inject debug feature.
281 * This feature only exists for internal testing and must not be
282 * enabled on a production device.
283 *
284 * Return: result of the command
285 */
286#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
287int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2);
288#else
289static inline
290int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2)
291{
292 return -ENOTSUPP;
293}
294#endif
295
Nirav Shahd21a2e32018-04-20 16:34:43 +0530296#ifdef CONFIG_DP_TRACE
297void hdd_set_dump_dp_trace(uint16_t cmd_type, uint16_t count);
298#else
299static inline
300void hdd_set_dump_dp_trace(uint16_t cmd_type, uint16_t count) {}
301#endif
Rachit Kankane0dc3e852018-05-07 17:33:42 +0530302#else /* WLAN_WEXT_SUPPORT_ENABLE */
303
304static inline void hdd_unregister_wext(struct net_device *dev)
305{
306}
307
308static inline void hdd_register_wext(struct net_device *dev)
309{
310}
311#endif /* WLAN_WEXT_SUPPORT_ENABLE */
Nirav Shahd21a2e32018-04-20 16:34:43 +0530312
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800313#endif /* __WEXT_IW_H__ */