1 /*
2  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
3  *
4  * 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 
19 #ifndef _QC_SAP_IOCTL_H_
20 #define _QC_SAP_IOCTL_H_
21 
22 /*
23  * QCSAP ioctls.
24  */
25 
26 /*
27  * Channel List Info
28  */
29 
30 struct channel_list_info {
31 	uint8_t num_channels;
32 	uint8_t channels[NUM_CHANNELS];
33 };
34 
35 #ifdef __linux__
36 /*
37  * Wireless Extensions API, private ioctl interfaces.
38  *
39  * NB: Even-numbered ioctl numbers have set semantics and are privileged!
40  *     (regardless of the incorrect comment in wireless.h!)
41  */
42 
43 #define QCSAP_IOCTL_SETPARAM          (SIOCIWFIRSTPRIV + 0)
44 #define QCSAP_IOCTL_GETPARAM          (SIOCIWFIRSTPRIV + 1)
45 /* (SIOCIWFIRSTPRIV+2) is unused */
46 #define QCSAP_IOCTL_SET_NONE_GET_THREE (SIOCIWFIRSTPRIV + 3)
47 #define WE_GET_TSF 1
48 #define QCSAP_IOCTL_GET_STAWPAIE      (SIOCIWFIRSTPRIV + 4)
49 #define QCSAP_IOCTL_STOPBSS           (SIOCIWFIRSTPRIV + 6)
50 #define QCSAP_IOCTL_VERSION           (SIOCIWFIRSTPRIV + 7)
51 /* (SIOCIWFIRSTPRIV + 8) is unused */
52 #define QCSAP_IOCTL_GET_CHANNEL       (SIOCIWFIRSTPRIV + 9)
53 #define QCSAP_IOCTL_ASSOC_STA_MACADDR (SIOCIWFIRSTPRIV + 10)
54 #define QCSAP_IOCTL_DISASSOC_STA      (SIOCIWFIRSTPRIV + 11)
55 #define QCSAP_IOCTL_SET_PKTLOG        (SIOCIWFIRSTPRIV + 12)
56 
57 /* Private ioctls and their sub-ioctls */
58 #define QCSAP_PRIV_GET_CHAR_SET_NONE   (SIOCIWFIRSTPRIV + 13)
59 #define QCSAP_GET_STATS 1
60 #define QCSAP_LIST_FW_PROFILE 2
61 
62 /* (SIOCIWFIRSTPRIV + 14) is unused */
63 
64 #define QCSAP_IOCTL_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 15)
65 #define WE_SET_WLAN_DBG 1
66 #define WE_SET_DP_TRACE 2
67 #define QCSAP_IOCTL_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 16)
68 #define WE_UNIT_TEST_CMD   7
69 /*
70  * <ioctl>
71  * ch_avoid - unit test SAP channel avoidance
72  *
73  * @INPUT: chan avoid ranges
74  *
75  * @OUTPUT: none
76  *
77  * This IOCTL is used to fake a channel avoidance event.
78  * To test SAP/GO chan switch during chan avoid event process.
79  *
80  * @E.g: iwpriv wlan0 ch_avoid 2452 2462
81  *
82  * Supported Feature: SAP chan avoidance.
83  *
84  * Usage: Internal
85  *
86  * </ioctl>
87  */
88 #define WE_SET_CHAN_AVOID 21
89 
90 #define WE_SET_THERMAL_THROTTLE_CFG     27
91 
92 #define WE_P2P_NOA_CMD  2
93 
94 #define QCSAP_IOCTL_MODIFY_ACL          (SIOCIWFIRSTPRIV + 18)
95 #define QCSAP_IOCTL_GET_CHANNEL_LIST    (SIOCIWFIRSTPRIV + 19)
96 #define QCSAP_IOCTL_SET_TX_POWER        (SIOCIWFIRSTPRIV + 20)
97 #define QCSAP_IOCTL_GET_STA_INFO        (SIOCIWFIRSTPRIV + 21)
98 #define QCSAP_IOCTL_SET_MAX_TX_POWER    (SIOCIWFIRSTPRIV + 22)
99 #define QCSAP_IOCTL_GET_INI_CFG         (SIOCIWFIRSTPRIV + 25)
100 
101 #define QCSAP_IOCTL_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28)
102 /* QCSAP_IOCTL_SET_TWO_INT_GET_NONE sub commands */
103 #define QCSAP_IOCTL_SET_FW_CRASH_INJECT 1
104 #define QCSAP_IOCTL_DUMP_DP_TRACE_LEVEL 2
105 #define QCSAP_ENABLE_FW_PROFILE          3
106 #define QCSAP_SET_FW_PROFILE_HIST_INTVL  4
107 /* Private sub-ioctl for initiating WoW suspend without Apps suspend */
108 #define QCSAP_SET_WLAN_SUSPEND  5
109 #define QCSAP_SET_WLAN_RESUME   6
110 #define QCSAP_SET_BA_AGEING_TIMEOUT 7
111 
112 #define QCSAP_IOCTL_PRIV_GET_RSSI       (SIOCIWFIRSTPRIV + 29)
113 #define QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
114 #define QCSAP_IOCTL_GET_BA_AGEING_TIMEOUT (SIOCIWFIRSTPRIV + 32)
115 
116 #define MAX_VAR_ARGS         7
117 
118 #define QCSAP_IOCTL_MAX_STR_LEN 1024
119 
120 #define RC_2_RATE_IDX(_rc)              ((_rc) & 0x7)
121 #define HT_RC_2_STREAMS(_rc)            ((((_rc) & 0x78) >> 3) + 1)
122 
123 #define RC_2_RATE_IDX_11AC(_rc)         ((_rc) & 0xf)
124 #define HT_RC_2_STREAMS_11AC(_rc)       ((((_rc) & 0x30) >> 4) + 1)
125 
126 #define RC_2_RATE_IDX_11AX(_rc)         ((_rc) & 0x1f)
127 #define HT_RC_2_STREAMS_11AX(_rc)       (((_rc) >> 5) & 0x7)
128 
129 #ifdef WLAN_FEATURE_11BE
130 #define RC_2_RATE_IDX_11BE(_rc)         ((_rc) & 0x1f)
131 #define HT_RC_2_STREAMS_11BE(_rc)       (((_rc) >> 5) & 0x7)
132 #endif
133 
134 /*
135  * <ioctl>
136  * setRadar - simulate a radar event
137  *
138  * @INPUT: None
139  *
140  * @OUTPUT: None
141  *
142  * This IOCTL is used to simulate a radar event, state machines for
143  * SAP will behave as same way in which a radar event is reported by WMA
144  *
145  * @E.g: iwpriv wlan0 setRadar
146  *
147  * Supported Feature: DFS
148  *
149  * Usage: Internal
150  *
151  * </ioctl>
152  */
153 
154 /*
155  * <ioctl>
156  * setRadarDbg - enable/disable radar specific logs
157  *
158  * @INPUT: 1/0
159  *
160  * @OUTPUT: None
161  *
162  * This IOCTL is enable radar phyerror info in wma
163  *
164  * @E.g: iwpriv wlan0 setRadarDbg <enable>
165  *  iwpriv wlan0 setRadarDbg 1
166  *
167  * Supported Feature: DFS
168  *
169  * Usage: Internal
170  *
171  * </ioctl>
172  */
173 enum {
174 	QCSAP_PARAM_MAX_ASSOC = 1,
175 	QCSAP_PARAM_GET_WLAN_DBG,
176 	QCSAP_PARAM_CLR_ACL = 4,
177 	QCSAP_PARAM_ACL_MODE,
178 	QCSAP_PARAM_HIDE_SSID,
179 	QCSAP_PARAM_SET_MC_RATE,
180 	QCSAP_PARAM_SET_TXRX_FW_STATS,
181 	QCSAP_PARAM_SET_MCC_CHANNEL_LATENCY,
182 	QCSAP_PARAM_SET_MCC_CHANNEL_QUOTA,
183 	QCSAP_DBGLOG_LOG_LEVEL,
184 	QCSAP_DBGLOG_VAP_ENABLE,
185 	QCSAP_DBGLOG_VAP_DISABLE,
186 	QCSAP_DBGLOG_MODULE_ENABLE,
187 	QCSAP_DBGLOG_MODULE_DISABLE,
188 	QCSAP_DBGLOG_MOD_LOG_LEVEL,
189 	QCSAP_DBGLOG_TYPE,
190 	QCSAP_DBGLOG_REPORT_ENABLE,
191 	QCASAP_TXRX_FWSTATS_RESET,
192 	QCSAP_PARAM_RTSCTS,
193 	QCASAP_SET_11N_RATE,
194 	QCASAP_SET_VHT_RATE,
195 	QCASAP_SHORT_GI,
196 	QCSAP_SET_AMPDU,
197 	QCSAP_SET_AMSDU,
198 	QCSAP_GTX_HT_MCS,
199 	QCSAP_GTX_VHT_MCS,
200 	QCSAP_GTX_USRCFG,
201 	QCSAP_GTX_THRE,
202 	QCSAP_GTX_MARGIN,
203 	QCSAP_GTX_STEP,
204 	QCSAP_GTX_MINTPC,
205 	QCSAP_GTX_BWMASK,
206 	QCASAP_SET_TM_LEVEL,
207 	QCASAP_SET_DFS_IGNORE_CAC,
208 	QCASAP_GET_DFS_NOL,
209 	QCASAP_SET_DFS_NOL,
210 	QCSAP_PARAM_SET_CHANNEL_CHANGE,
211 	QCASAP_SET_DFS_TARGET_CHNL,
212 	QCASAP_SET_RADAR_CMD,
213 	QCSAP_GET_ACL,
214 	QCASAP_TX_CHAINMASK_CMD,
215 	QCASAP_RX_CHAINMASK_CMD,
216 	QCASAP_NSS_CMD,
217 	QCSAP_IPA_UC_STAT,
218 	QCASAP_SET_PHYMODE,
219 	QCASAP_GET_TEMP_CMD,
220 	QCASAP_DUMP_STATS,
221 	QCASAP_CLEAR_STATS,
222 	QCASAP_SET_RADAR_DBG,
223 	QCSAP_GET_FW_PROFILE_DATA,
224 	QCSAP_START_FW_PROFILING,
225 	QCSAP_CAP_TSF,
226 	QCSAP_GET_TSF,
227 	QCSAP_PARAM_CONC_SYSTEM_PREF,
228 	QCASAP_PARAM_LDPC,
229 	QCASAP_PARAM_TX_STBC,
230 	QCASAP_PARAM_RX_STBC,
231 	QCSAP_PARAM_CHAN_WIDTH,
232 	QCSAP_PARAM_SET_TXRX_STATS,
233 	QCASAP_SET_11AX_RATE,
234 	QCASAP_SET_PEER_RATE, /* Not Supported */
235 	QCASAP_PARAM_DCM,
236 	QCASAP_PARAM_RANGE_EXT,
237 	QCSAP_SET_DEFAULT_AMPDU,
238 	QCSAP_ENABLE_RTS_BURSTING,
239 	QCASAP_SET_HE_BSS_COLOR,
240 	QCSAP_SET_BTCOEX_MODE,
241 	QCSAP_SET_BTCOEX_LOW_RSSI_THRESHOLD,
242 };
243 
244 int iw_get_channel_list_with_cc(struct net_device *dev,
245 				mac_handle_t mac_handle,
246 				struct iw_request_info *info,
247 				union iwreq_data *wrqu,
248 				char *extra);
249 
250 #endif /* __linux__ */
251 
252 #endif /*_QC_SAP_IOCTL_H_*/
253