1 /*
2  * Copyright (c) 2015-2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef __WLAN_HDD_OCB_H
21 #define __WLAN_HDD_OCB_H
22 
23 #include <net/iw_handler.h>
24 #include "sir_api.h"
25 
26 #define WLAN_OCB_CHANNEL_MAX 5
27 
28 /**
29  * struct ocb_qos_params - QoS Parameters for each AC
30  * @aifsn:  Arbitration Inter-Frame Spacing
31  * @cwmin:  Contention Window (Min)
32  * @cwmax:  Contention Window (Max)
33  */
34 struct ocb_qos_params {
35 	uint8_t aifsn;
36 	uint8_t cwmin;
37 	uint8_t cwmax;
38 };
39 
40 /**
41  * struct ocb_channel - Parameters for each OCB channel
42  * @channel_freq:           Channel Center Frequency (MHz)
43  * @duration:               Channel Duration (ms)
44  * @start_guard_interval:   Start Guard Interval (ms)
45  * @channel_bandwidth:      Channel Bandwidth (MHz)
46  * @tx_power:               Transmit Power (1/2 dBm)
47  * @tx_rate:                Transmit Data Rate (mbit)
48  * @qos_params:             Array of QoS Parameters
49  * @per_packet_rx_stats:    Enable per packet RX statistics
50  */
51 struct ocb_channel {
52 	uint32_t channel_freq;
53 	uint32_t duration;
54 	uint32_t start_guard_interval;
55 	uint32_t channel_bandwidth;
56 	uint32_t tx_power;
57 	uint32_t tx_rate;
58 	struct ocb_qos_params qos_params[QCA_WLAN_AC_ALL];
59 	uint32_t per_packet_rx_stats;
60 };
61 
62 /**
63  * struct dot11p_channel_sched - OCB channel schedule
64  * @num_channels:   Number of channels
65  * @channels:       Array of channel parameters
66  * @off_channel_tx: Enable off channel TX
67  */
68 struct dot11p_channel_sched {
69 	uint32_t num_channels;
70 	struct ocb_channel channels[WLAN_OCB_CHANNEL_MAX];
71 	uint32_t off_channel_tx;
72 };
73 
74 /**
75  * enum qca_wlan_vendor_attr_ocb_set_config - vendor subcmd to set ocb config
76  * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_INVALID: invalid value
77  * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_CHANNEL_COUNT:
78  *	number of channels in the configuration
79  * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_SCHEDULE_SIZE: size of the schedule
80  * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_CHANNEL_ARRAY: array of channels
81  * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_SCHEDULE_ARRAY:
82  *	array of channels to be scheduled
83  * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_NDL_CHANNEL_ARRAY:
84  *	array of NDL channel information
85  * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_NDL_ACTIVE_STATE_ARRAY:
86  *	array of NDL active state configuration
87  * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_FLAGS:
88  *	flag to set the absolute expiry
89  * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_AFTER_LAST: number of enumerators
90  * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_MAX: last enumerator
91  */
92 enum qca_wlan_vendor_attr_ocb_set_config {
93 	QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_INVALID = 0,
94 	QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_CHANNEL_COUNT,
95 	QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_SCHEDULE_SIZE,
96 	QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_CHANNEL_ARRAY,
97 	QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_SCHEDULE_ARRAY,
98 	QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_NDL_CHANNEL_ARRAY,
99 	QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_NDL_ACTIVE_STATE_ARRAY,
100 	QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_FLAGS,
101 	QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_AFTER_LAST,
102 	QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_MAX =
103 		QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_AFTER_LAST - 1,
104 };
105 
106 /**
107  * enum qca_wlan_vendor_attr_ocb_set_utc_time - vendor subcmd to set UTC time
108  * @QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_INVALID: invalid value
109  * @QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_VALUE:
110  *	the UTC time as an array of 10 bytes
111  * @QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_ERROR:
112  *	the time error as an array of 5 bytes
113  * @QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_AFTER_LAST: number of enumerators
114  * @QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_MAX: last enumerator
115  */
116 enum qca_wlan_vendor_attr_ocb_set_utc_time {
117 	QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_INVALID = 0,
118 	QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_VALUE,
119 	QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_ERROR,
120 	QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_AFTER_LAST,
121 	QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_MAX =
122 		QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_AFTER_LAST - 1,
123 };
124 
125 /**
126  * enum qca_wlan_vendor_attr_ocb_start_timing_advert - vendor subcmd to start
127  *						       sending timing advert
128  *						       frames
129  * @QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_INVALID: invalid value
130  * @QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_CHANNEL_FREQ:
131  *	channel frequency on which to send the frames
132  * @QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_REPEAT_RATE:
133  *	number of times the frame is sent in 5 seconds
134  * @QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_AFTER_LAST:
135  *	number of enumerators
136  * @QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_MAX: last enumerator
137  */
138 enum qca_wlan_vendor_attr_ocb_start_timing_advert {
139 	QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_INVALID = 0,
140 	QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_CHANNEL_FREQ,
141 	QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_REPEAT_RATE,
142 	QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_AFTER_LAST,
143 	QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_MAX =
144 		QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_AFTER_LAST - 1,
145 };
146 
147 /**
148  * enum qca_wlan_vendor_attr_ocb_stop_timing_advert - vendor subcmd to stop
149  *						      timing advert
150  * @QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_INVALID: invalid value
151  * @QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_CHANNEL_FREQ:
152  *	the channel frequency on which to stop the timing advert
153  * @QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_AFTER_LAST:
154  *	number of enumerators
155  * @QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_MAX: last enumerator
156  */
157 enum qca_wlan_vendor_attr_ocb_stop_timing_advert {
158 	QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_INVALID = 0,
159 	QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_CHANNEL_FREQ,
160 	QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_AFTER_LAST,
161 	QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_MAX =
162 		QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_AFTER_LAST - 1,
163 };
164 
165 /**
166  * enum qca_wlan_vendor_attr_ocb_get_tsf_resp - vendor subcmd to get TSF
167  *						timer value
168  * @QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_INVALID: invalid value
169  * @QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_TIMER_HIGH:
170  *      higher 32 bits of the timer
171  * @QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_TIMER_LOW:
172  *      lower 32 bits of the timer
173  * @QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_AFTER_LAST: number of enumerators
174  * @QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_MAX: last enumerator
175  */
176 enum qca_wlan_vendor_attr_ocb_get_tsf_resp {
177 	QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_INVALID = 0,
178 	QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_TIMER_HIGH,
179 	QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_TIMER_LOW,
180 	QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_AFTER_LAST,
181 	QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_MAX =
182 		QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_AFTER_LAST - 1,
183 };
184 
185 /**
186  * enum qca_wlan_vendor_attr_dcc_get_stats - vendor subcmd to get
187  *					     dcc stats
188  * @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_INVALID: invalid value
189  * @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_CHANNEL_COUNT:
190  *      the number of channels in the request array
191  * @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_REQUEST_ARRAY:
192  *      array of the channel and information being requested
193  * @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_AFTER_LAST: number of enumerators
194  * @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_MAX: last enumerator
195  */
196 enum qca_wlan_vendor_attr_dcc_get_stats {
197 	QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_INVALID = 0,
198 	QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_CHANNEL_COUNT,
199 	QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_REQUEST_ARRAY,
200 	QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_AFTER_LAST,
201 	QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_MAX =
202 		QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_AFTER_LAST - 1,
203 };
204 
205 /**
206  * enum qca_wlan_vendor_attr_dcc_get_stats_resp - response event from get
207  *						  dcc stats
208  * @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_INVALID: invalid value
209  * @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_CHANNEL_COUNT:
210  *      the number of channels in the request array
211  * @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_STATS_ARRAY:
212  *      array of the information being requested
213  * @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_AFTER_LAST: number of enumerators
214  * @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_MAX: last enumerator
215  */
216 enum qca_wlan_vendor_attr_dcc_get_stats_resp {
217 	QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_INVALID = 0,
218 	QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_CHANNEL_COUNT,
219 	QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_STATS_ARRAY,
220 	QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_AFTER_LAST,
221 	QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_MAX =
222 		QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_AFTER_LAST - 1,
223 };
224 
225 /**
226  * enum qca_wlan_vendor_attr_dcc_clear_stats - vendor subcmd to clear DCC stats
227  * @QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_INVALID: invalid value
228  * @QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_BITMAP:
229  *      mask of the type of stats to be cleared
230  * @QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_AFTER_LAST: number of enumerators
231  * @QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_MAX: last enumerator
232  */
233 enum qca_wlan_vendor_attr_dcc_clear_stats {
234 	QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_INVALID = 0,
235 	QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_BITMAP,
236 	QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_AFTER_LAST,
237 	QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_MAX =
238 		QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_AFTER_LAST - 1,
239 };
240 
241 /**
242  * enum qca_wlan_vendor_attr_dcc_update_ndl - vendor subcmd to update dcc
243  * @QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_INVALID: invalid value
244  * @QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_CHANNEL_COUNT:
245  *	number of channels in the configuration
246  * @QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_CHANNEL_ARRAY: the array of NDL
247  *  channel info
248  * @QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_ACTIVE_STATE_ARRAY: the array of
249  *  NDL active states
250  * @QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_AFTER_LAST: number of enumerators
251  * @QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_MAX: last enumerator
252  */
253 enum qca_wlan_vendor_attr_dcc_update_ndl {
254 	QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_INVALID = 0,
255 	QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_CHANNEL_COUNT,
256 	QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_CHANNEL_ARRAY,
257 	QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_ACTIVE_STATE_ARRAY,
258 	QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_AFTER_LAST,
259 	QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_MAX =
260 		QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_AFTER_LAST - 1,
261 };
262 
263 struct hdd_context;
264 
265 #ifdef WLAN_WEXT_SUPPORT_ENABLE
266 
267 #ifdef WLAN_FEATURE_DSRC
268 int iw_set_dot11p_channel_sched(struct net_device *dev,
269 				struct iw_request_info *info,
270 				union iwreq_data *wrqu, char *extra);
271 
272 extern const struct nla_policy qca_wlan_vendor_ocb_set_config_policy[
273 			QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_MAX + 1];
274 extern const struct nla_policy qca_wlan_vendor_ocb_set_utc_time_policy[
275 			QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_MAX + 1];
276 extern const struct nla_policy qca_wlan_vendor_ocb_start_timing_advert_policy[
277 			QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_MAX + 1];
278 extern const struct nla_policy  qca_wlan_vendor_ocb_stop_timing_advert_policy[
279 			QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_MAX + 1];
280 extern const struct nla_policy qca_wlan_vendor_dcc_get_stats[
281 			QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_MAX + 1];
282 extern const struct nla_policy qca_wlan_vendor_dcc_clear_stats[
283 			QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_MAX + 1];
284 extern const struct nla_policy qca_wlan_vendor_dcc_update_ndl[
285 			QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_MAX + 1];
286 
287 #define FEATURE_OCB_VENDOR_COMMANDS					     \
288 {									     \
289 	.info.vendor_id = QCA_NL80211_VENDOR_ID,			     \
290 	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_OCB_SET_CONFIG,	     \
291 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |				     \
292 		 WIPHY_VENDOR_CMD_NEED_NETDEV |				     \
293 		 WIPHY_VENDOR_CMD_NEED_RUNNING,				     \
294 	.doit = wlan_hdd_cfg80211_ocb_set_config,			     \
295 	vendor_command_policy(qca_wlan_vendor_ocb_set_config_policy,	     \
296 			      QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_MAX)	     \
297 },									     \
298 									     \
299 {									     \
300 	.info.vendor_id = QCA_NL80211_VENDOR_ID,			     \
301 	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_OCB_SET_UTC_TIME,	     \
302 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |				     \
303 		 WIPHY_VENDOR_CMD_NEED_NETDEV |				     \
304 		 WIPHY_VENDOR_CMD_NEED_RUNNING,				     \
305 	.doit = wlan_hdd_cfg80211_ocb_set_utc_time,			     \
306 	vendor_command_policy(qca_wlan_vendor_ocb_set_utc_time_policy,	     \
307 			      QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_MAX)     \
308 },									     \
309 									     \
310 {									     \
311 	.info.vendor_id = QCA_NL80211_VENDOR_ID,			     \
312 	.info.subcmd =							     \
313 		QCA_NL80211_VENDOR_SUBCMD_OCB_START_TIMING_ADVERT,	     \
314 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |				     \
315 		 WIPHY_VENDOR_CMD_NEED_NETDEV |				     \
316 		 WIPHY_VENDOR_CMD_NEED_RUNNING,				     \
317 	.doit = wlan_hdd_cfg80211_ocb_start_timing_advert,		     \
318 	vendor_command_policy(						     \
319 			qca_wlan_vendor_ocb_start_timing_advert_policy,	     \
320 			QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_MAX)    \
321 },									     \
322 									     \
323 {									     \
324 	.info.vendor_id = QCA_NL80211_VENDOR_ID,			     \
325 	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_OCB_STOP_TIMING_ADVERT,     \
326 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |				     \
327 		 WIPHY_VENDOR_CMD_NEED_NETDEV |				     \
328 		 WIPHY_VENDOR_CMD_NEED_RUNNING,				     \
329 	.doit = wlan_hdd_cfg80211_ocb_stop_timing_advert,		     \
330 	vendor_command_policy(						     \
331 			qca_wlan_vendor_ocb_stop_timing_advert_policy,	     \
332 			QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_MAX)     \
333 },									     \
334 									     \
335 {									     \
336 	.info.vendor_id = QCA_NL80211_VENDOR_ID,			     \
337 	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_OCB_GET_TSF_TIMER,	     \
338 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |				     \
339 		 WIPHY_VENDOR_CMD_NEED_NETDEV |				     \
340 		 WIPHY_VENDOR_CMD_NEED_RUNNING,				     \
341 	.doit = wlan_hdd_cfg80211_ocb_get_tsf_timer,			     \
342 	vendor_command_policy(VENDOR_CMD_RAW_DATA, 0)			     \
343 },									     \
344 									     \
345 {									     \
346 	.info.vendor_id = QCA_NL80211_VENDOR_ID,			     \
347 	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_DCC_GET_STATS,		     \
348 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |				     \
349 		 WIPHY_VENDOR_CMD_NEED_NETDEV |				     \
350 		 WIPHY_VENDOR_CMD_NEED_RUNNING,				     \
351 	.doit = wlan_hdd_cfg80211_dcc_get_stats,			     \
352 	vendor_command_policy(qca_wlan_vendor_dcc_get_stats,		     \
353 			      QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_MAX)	     \
354 },									     \
355 									     \
356 {									     \
357 	.info.vendor_id = QCA_NL80211_VENDOR_ID,			     \
358 	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_DCC_CLEAR_STATS,	     \
359 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |				     \
360 		WIPHY_VENDOR_CMD_NEED_NETDEV |				     \
361 		WIPHY_VENDOR_CMD_NEED_RUNNING,				     \
362 	.doit = wlan_hdd_cfg80211_dcc_clear_stats,			     \
363 	vendor_command_policy(qca_wlan_vendor_dcc_clear_stats,		     \
364 			      QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_MAX)	     \
365 },									     \
366 									     \
367 {									     \
368 	.info.vendor_id = QCA_NL80211_VENDOR_ID,			     \
369 	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_DCC_UPDATE_NDL,	     \
370 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |				     \
371 		WIPHY_VENDOR_CMD_NEED_NETDEV |				     \
372 		WIPHY_VENDOR_CMD_NEED_RUNNING,				     \
373 	.doit = wlan_hdd_cfg80211_dcc_update_ndl,			     \
374 	vendor_command_policy(qca_wlan_vendor_dcc_update_ndl,		     \
375 			      QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_MAX)	     \
376 },
377 
378 #else
379 #define FEATURE_OCB_VENDOR_COMMANDS
380 
381 static inline
iw_set_dot11p_channel_sched(struct net_device * dev,struct iw_request_info * info,union iwreq_data * wrqu,char * extra)382 int iw_set_dot11p_channel_sched(struct net_device *dev,
383 				struct iw_request_info *info,
384 				union iwreq_data *wrqu, char *extra)
385 {
386 	return 0;
387 }
388 #endif
389 #else
390 #define FEATURE_OCB_VENDOR_COMMANDS
391 #endif
392 
393 #ifdef WLAN_FEATURE_DSRC
394 int wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy,
395 				     struct wireless_dev *wdev,
396 				     const void *data,
397 				     int data_len);
398 
399 int wlan_hdd_cfg80211_ocb_set_utc_time(struct wiphy *wiphy,
400 				       struct wireless_dev *wdev,
401 				       const void *data,
402 				       int data_len);
403 
404 int wlan_hdd_cfg80211_ocb_start_timing_advert(struct wiphy *wiphy,
405 					      struct wireless_dev *wdev,
406 					      const void *data,
407 					      int data_len);
408 
409 int wlan_hdd_cfg80211_ocb_stop_timing_advert(struct wiphy *wiphy,
410 					     struct wireless_dev *wdev,
411 					     const void *data,
412 					     int data_len);
413 
414 int wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy *wiphy,
415 					struct wireless_dev *wdev,
416 					const void *data,
417 					int data_len);
418 
419 int wlan_hdd_cfg80211_dcc_get_stats(struct wiphy *wiphy,
420 				    struct wireless_dev *wdev,
421 				    const void *data,
422 				    int data_len);
423 
424 int wlan_hdd_cfg80211_dcc_clear_stats(struct wiphy *wiphy,
425 				      struct wireless_dev *wdev,
426 				      const void *data,
427 				      int data_len);
428 
429 int wlan_hdd_cfg80211_dcc_update_ndl(struct wiphy *wiphy,
430 				     struct wireless_dev *wdev,
431 				     const void *data,
432 				     int data_len);
433 
434 void wlan_hdd_dcc_register_for_dcc_stats_event(struct hdd_context *hdd_ctx);
435 
436 void wlan_hdd_dcc_stats_event(void *context_ptr, void *response_ptr);
437 #else
wlan_hdd_cfg80211_ocb_set_config(struct wiphy * wiphy,struct wireless_dev * wdev,const void * data,int data_len)438 static inline int wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy,
439 		struct wireless_dev *wdev,
440 		const void *data,
441 		int data_len)
442 {
443 	return 0;
444 }
445 
wlan_hdd_cfg80211_ocb_set_utc_time(struct wiphy * wiphy,struct wireless_dev * wdev,const void * data,int data_len)446 static inline int wlan_hdd_cfg80211_ocb_set_utc_time(struct wiphy *wiphy,
447 		struct wireless_dev *wdev,
448 		const void *data,
449 		int data_len)
450 {
451 	return 0;
452 }
453 
wlan_hdd_cfg80211_ocb_start_timing_advert(struct wiphy * wiphy,struct wireless_dev * wdev,const void * data,int data_len)454 static inline int wlan_hdd_cfg80211_ocb_start_timing_advert(struct wiphy *wiphy,
455 		struct wireless_dev *wdev,
456 		const void *data,
457 		int data_len)
458 {
459 	return 0;
460 }
461 
wlan_hdd_cfg80211_ocb_stop_timing_advert(struct wiphy * wiphy,struct wireless_dev * wdev,const void * data,int data_len)462 static inline int wlan_hdd_cfg80211_ocb_stop_timing_advert(struct wiphy *wiphy,
463 		struct wireless_dev *wdev,
464 		const void *data,
465 		int data_len)
466 {
467 	return 0;
468 }
469 
wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy * wiphy,struct wireless_dev * wdev,const void * data,int data_len)470 static inline int wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy *wiphy,
471 		struct wireless_dev *wdev,
472 		const void *data,
473 		int data_len)
474 {
475 	return 0;
476 }
477 
wlan_hdd_cfg80211_dcc_get_stats(struct wiphy * wiphy,struct wireless_dev * wdev,const void * data,int data_len)478 static inline int wlan_hdd_cfg80211_dcc_get_stats(struct wiphy *wiphy,
479 		struct wireless_dev *wdev,
480 		const void *data,
481 		int data_len)
482 {
483 	return 0;
484 }
485 
wlan_hdd_cfg80211_dcc_clear_stats(struct wiphy * wiphy,struct wireless_dev * wdev,const void * data,int data_len)486 static inline int wlan_hdd_cfg80211_dcc_clear_stats(struct wiphy *wiphy,
487 		struct wireless_dev *wdev,
488 		const void *data,
489 		int data_len)
490 {
491 	return 0;
492 }
493 
wlan_hdd_cfg80211_dcc_update_ndl(struct wiphy * wiphy,struct wireless_dev * wdev,const void * data,int data_len)494 static inline int wlan_hdd_cfg80211_dcc_update_ndl(struct wiphy *wiphy,
495 		struct wireless_dev *wdev,
496 		const void *data,
497 		int data_len)
498 {
499 	return 0;
500 }
501 
wlan_hdd_dcc_register_for_dcc_stats_event(struct hdd_context * hdd_ctx)502 static inline void wlan_hdd_dcc_register_for_dcc_stats_event(
503 		struct hdd_context *hdd_ctx)
504 {
505 }
506 
wlan_hdd_dcc_stats_event(void * context_ptr,void * response_ptr)507 static inline void wlan_hdd_dcc_stats_event(void *context_ptr,
508 		void *response_ptr)
509 {
510 }
511 #endif
512 
513 #endif /* __WLAN_HDD_OCB_H */
514