blob: 8e068f548833d8fae333c870b12ae771d24d88ca [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Srinivas Girigowda576b2352017-08-25 14:44:26 -07002 * Copyright (c) 2015-2017 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 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28#ifndef __WLAN_HDD_OCB_H
29#define __WLAN_HDD_OCB_H
30
31#include <net/iw_handler.h>
32#include "sir_api.h"
33
34#define WLAN_OCB_CHANNEL_MAX 5
35
36/**
37 * struct ocb_qos_params - QoS Parameters for each AC
38 * @aifsn: Arbitration Inter-Frame Spacing
39 * @cwmin: Contention Window (Min)
40 * @cwmax: Contention Window (Max)
41 */
42struct ocb_qos_params {
43 uint8_t aifsn;
44 uint8_t cwmin;
45 uint8_t cwmax;
46};
47
48/**
49 * struct ocb_channel - Parameters for each OCB channel
50 * @channel_freq: Channel Center Frequency (MHz)
51 * @duration: Channel Duration (ms)
52 * @start_guard_interval: Start Guard Interval (ms)
53 * @channel_bandwidth: Channel Bandwidth (MHz)
54 * @tx_power: Transmit Power (1/2 dBm)
55 * @tx_rate: Transmit Data Rate (mbit)
56 * @qos_params: Array of QoS Parameters
57 * @per_packet_rx_stats: Enable per packet RX statistics
58 */
59struct ocb_channel {
60 uint32_t channel_freq;
61 uint32_t duration;
62 uint32_t start_guard_interval;
63 uint32_t channel_bandwidth;
64 uint32_t tx_power;
65 uint32_t tx_rate;
66 struct ocb_qos_params qos_params[MAX_NUM_AC];
67 uint32_t per_packet_rx_stats;
68};
69
70/**
71 * struct dot11p_channel_sched - OCB channel schedule
72 * @num_channels: Number of channels
73 * @channels: Array of channel parameters
74 * @off_channel_tx: Enable off channel TX
75 */
76struct dot11p_channel_sched {
77 uint32_t num_channels;
78 struct ocb_channel channels[WLAN_OCB_CHANNEL_MAX];
79 uint32_t off_channel_tx;
80};
81
82/**
83 * enum qca_wlan_vendor_attr_ocb_set_config - vendor subcmd to set ocb config
84 * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_CHANNEL_COUNT:
85 * number of channels in the configuration
86 * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_SCHEDULE_SIZE: size of the schedule
87 * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_CHANNEL_ARRAY: array of channels
88 * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_SCHEDULE_ARRAY:
89 * array of channels to be scheduled
90 * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_NDL_CHANNEL_ARRAY:
91 * array of NDL channel information
92 * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_NDL_ACTIVE_STATE_ARRAY:
93 * array of NDL active state configuration
94 * @QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_FLAGS:
95 * flag to set the absolute expiry
96 */
97enum qca_wlan_vendor_attr_ocb_set_config {
98 QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_INVALID = 0,
99 QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_CHANNEL_COUNT,
100 QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_SCHEDULE_SIZE,
101 QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_CHANNEL_ARRAY,
102 QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_SCHEDULE_ARRAY,
103 QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_NDL_CHANNEL_ARRAY,
104 QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_NDL_ACTIVE_STATE_ARRAY,
105 QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_FLAGS,
106 QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_AFTER_LAST,
107 QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_MAX =
108 QCA_WLAN_VENDOR_ATTR_OCB_SET_CONFIG_AFTER_LAST - 1,
109};
110
111/**
112 * enum qca_wlan_vendor_attr_ocb_set_utc_time - vendor subcmd to set UTC time
113 * @QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_VALUE:
114 * the UTC time as an array of 10 bytes
115 * @QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_ERROR:
116 * the time error as an array of 5 bytes
117 */
118enum qca_wlan_vendor_attr_ocb_set_utc_time {
119 QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_INVALID = 0,
120 QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_VALUE,
121 QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_ERROR,
122 QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_AFTER_LAST,
123 QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_MAX =
124 QCA_WLAN_VENDOR_ATTR_OCB_SET_UTC_TIME_AFTER_LAST - 1,
125};
126
127/**
128 * enum qca_wlan_vendor_attr_ocb_start_timing_advert - vendor subcmd to start
129 sending timing advert
130 frames
131 * @QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_CHANNEL_FREQ:
132 * channel frequency on which to send the frames
133 * @QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_REPEAT_RATE:
134 * number of times the frame is sent in 5 seconds
135 */
136enum qca_wlan_vendor_attr_ocb_start_timing_advert {
137 QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_INVALID = 0,
138 QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_CHANNEL_FREQ,
139 QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_REPEAT_RATE,
140 QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_AFTER_LAST,
141 QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_MAX =
142 QCA_WLAN_VENDOR_ATTR_OCB_START_TIMING_ADVERT_AFTER_LAST - 1,
143};
144
145/**
146 * enum qca_wlan_vendor_attr_ocb_stop_timing_advert - vendor subcmd to stop
147 * timing advert
148 * @QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_CHANNEL_FREQ:
149 * the channel frequency on which to stop the timing advert
150 */
151enum qca_wlan_vendor_attr_ocb_stop_timing_advert {
152 QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_INVALID = 0,
153 QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_CHANNEL_FREQ,
154 QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_AFTER_LAST,
155 QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_MAX =
156 QCA_WLAN_VENDOR_ATTR_OCB_STOP_TIMING_ADVERT_AFTER_LAST - 1,
157};
158
159/**
160 * enum qca_wlan_vendor_attr_dcc_get_tsf_response - vendor subcmd to get TSF
161 * timer value
162 * @QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_TIMER_HIGH:
163 * higher 32 bits of the timer
164 * @QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_TIMER_LOW:
165 * lower 32 bits of the timer
166 */
167enum qca_wlan_vendor_attr_ocb_get_tsf_resp {
168 QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_INVALID = 0,
169 QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_TIMER_HIGH,
170 QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_TIMER_LOW,
171 QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_AFTER_LAST,
172 QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_MAX =
173 QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_AFTER_LAST - 1,
174};
175
176/**
177 * enum qca_wlan_vendor_attr_dcc_get_stats - vendor subcmd to get
178 * dcc stats
179 * @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_CHANNEL_COUNT:
180 * the number of channels in the request array
181 * @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_REQUEST_ARRAY
182 * array of the channel and information being requested
183 */
184enum qca_wlan_vendor_attr_dcc_get_stats {
185 QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_INVALID = 0,
186 QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_CHANNEL_COUNT,
187 QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_REQUEST_ARRAY,
188 QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_AFTER_LAST,
189 QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_MAX =
190 QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_AFTER_LAST - 1,
191};
192
193/**
194 * enum qca_wlan_vendor_attr_dcc_get_stats_resp - response event from get
195 * dcc stats
196 * @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_CHANNEL_COUNT:
197 * the number of channels in the request array
198 * @QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_STATS_ARRAY
199 * array of the information being requested
200 */
201enum qca_wlan_vendor_attr_dcc_get_stats_resp {
202 QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_INVALID = 0,
203 QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_CHANNEL_COUNT,
204 QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_STATS_ARRAY,
205 QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_AFTER_LAST,
206 QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_MAX =
207 QCA_WLAN_VENDOR_ATTR_DCC_GET_STATS_RESP_AFTER_LAST - 1,
208};
209
210/**
211 * enum qca_wlan_vendor_attr_dcc_clear_stats - vendor subcmd to clear DCC stats
212 * @QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_BITMAP:
213 * mask of the type of stats to be cleared
214 */
215enum qca_wlan_vendor_attr_dcc_clear_stats {
216 QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_INVALID = 0,
217 QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_BITMAP,
218 QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_AFTER_LAST,
219 QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_MAX =
220 QCA_WLAN_VENDOR_ATTR_DCC_CLEAR_STATS_AFTER_LAST - 1,
221};
222
223/**
224 * enum qca_wlan_vendor_attr_ocb_set_config - vendor subcmd to update dcc
225 * @QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_CHANNEL_COUNT:
226 * number of channels in the configuration
227 * @QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_CHANNEL_ARRAY: the array of NDL
228 * channel info
229 * @QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_ACTIVE_STATE_ARRAY: the array of
230 * NDL active states
231 */
232enum qca_wlan_vendor_attr_dcc_update_ndl {
233 QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_INVALID = 0,
234 QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_CHANNEL_COUNT,
235 QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_CHANNEL_ARRAY,
236 QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_ACTIVE_STATE_ARRAY,
237 QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_AFTER_LAST,
238 QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_MAX =
239 QCA_WLAN_VENDOR_ATTR_DCC_UPDATE_NDL_AFTER_LAST - 1,
240};
Jeff Johnson7106aba2017-08-28 11:49:07 -0700241
242struct hdd_context;
243
Agrawal Ashishb141b092016-09-02 19:59:26 +0530244#ifdef WLAN_FEATURE_DSRC
Jeff Johnson7106aba2017-08-28 11:49:07 -0700245void hdd_set_dot11p_config(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800246
247void hdd_remove_ocb_tx_header(struct sk_buff *skb);
248
249int iw_set_dot11p_channel_sched(struct net_device *dev,
250 struct iw_request_info *info,
251 union iwreq_data *wrqu, char *extra);
252
253int wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy,
254 struct wireless_dev *wdev,
255 const void *data,
256 int data_len);
257
258int wlan_hdd_cfg80211_ocb_set_utc_time(struct wiphy *wiphy,
259 struct wireless_dev *wdev,
260 const void *data,
261 int data_len);
262
263int wlan_hdd_cfg80211_ocb_start_timing_advert(struct wiphy *wiphy,
264 struct wireless_dev *wdev,
265 const void *data,
266 int data_len);
267
268int wlan_hdd_cfg80211_ocb_stop_timing_advert(struct wiphy *wiphy,
269 struct wireless_dev *wdev,
270 const void *data,
271 int data_len);
272
273int wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy *wiphy,
274 struct wireless_dev *wdev,
275 const void *data,
276 int data_len);
277
278int wlan_hdd_cfg80211_dcc_get_stats(struct wiphy *wiphy,
279 struct wireless_dev *wdev,
280 const void *data,
281 int data_len);
282
283int wlan_hdd_cfg80211_dcc_clear_stats(struct wiphy *wiphy,
284 struct wireless_dev *wdev,
285 const void *data,
286 int data_len);
287
288int wlan_hdd_cfg80211_dcc_update_ndl(struct wiphy *wiphy,
289 struct wireless_dev *wdev,
290 const void *data,
291 int data_len);
292
Jeff Johnson7106aba2017-08-28 11:49:07 -0700293void wlan_hdd_dcc_register_for_dcc_stats_event(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800294
Arun Khandavalli4b55da72016-07-19 19:55:01 +0530295void wlan_hdd_dcc_stats_event(void *context_ptr, void *response_ptr);
Agrawal Ashishb141b092016-09-02 19:59:26 +0530296#else
Jeff Johnson7106aba2017-08-28 11:49:07 -0700297static inline void hdd_set_dot11p_config(struct hdd_context *hdd_ctx)
Agrawal Ashishb141b092016-09-02 19:59:26 +0530298{
Agrawal Ashishb141b092016-09-02 19:59:26 +0530299}
Arun Khandavalli4b55da72016-07-19 19:55:01 +0530300
Agrawal Ashishb141b092016-09-02 19:59:26 +0530301static inline void hdd_remove_ocb_tx_header(struct sk_buff *skb)
302{
Agrawal Ashishb141b092016-09-02 19:59:26 +0530303}
304static inline int iw_set_dot11p_channel_sched(struct net_device *dev,
305 struct iw_request_info *info,
306 union iwreq_data *wrqu, char *extra)
307{
308 return 0;
309}
310
311static inline int wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy,
312 struct wireless_dev *wdev,
313 const void *data,
314 int data_len)
315{
316 return 0;
317}
318
319static inline int wlan_hdd_cfg80211_ocb_set_utc_time(struct wiphy *wiphy,
320 struct wireless_dev *wdev,
321 const void *data,
322 int data_len)
323{
324 return 0;
325}
326
327static inline int wlan_hdd_cfg80211_ocb_start_timing_advert(struct wiphy *wiphy,
328 struct wireless_dev *wdev,
329 const void *data,
330 int data_len)
331{
332 return 0;
333}
334
335static inline int wlan_hdd_cfg80211_ocb_stop_timing_advert(struct wiphy *wiphy,
336 struct wireless_dev *wdev,
337 const void *data,
338 int data_len)
339{
340 return 0;
341}
342
343static inline int wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy *wiphy,
344 struct wireless_dev *wdev,
345 const void *data,
346 int data_len)
347{
348 return 0;
349}
350
351static inline int wlan_hdd_cfg80211_dcc_get_stats(struct wiphy *wiphy,
352 struct wireless_dev *wdev,
353 const void *data,
354 int data_len)
355{
356 return 0;
357}
358
359static inline int wlan_hdd_cfg80211_dcc_clear_stats(struct wiphy *wiphy,
360 struct wireless_dev *wdev,
361 const void *data,
362 int data_len)
363{
364 return 0;
365}
366
367static inline int wlan_hdd_cfg80211_dcc_update_ndl(struct wiphy *wiphy,
368 struct wireless_dev *wdev,
369 const void *data,
370 int data_len)
371{
372 return 0;
373}
374
375static inline void wlan_hdd_dcc_register_for_dcc_stats_event(
Jeff Johnson7106aba2017-08-28 11:49:07 -0700376 struct hdd_context *hdd_ctx)
Agrawal Ashishb141b092016-09-02 19:59:26 +0530377{
Agrawal Ashishb141b092016-09-02 19:59:26 +0530378}
Srinivas Girigowda576b2352017-08-25 14:44:26 -0700379
Agrawal Ashishb141b092016-09-02 19:59:26 +0530380static inline void wlan_hdd_dcc_stats_event(void *context_ptr,
381 void *response_ptr)
382{
Agrawal Ashishb141b092016-09-02 19:59:26 +0530383}
384#endif
Arun Khandavalli4b55da72016-07-19 19:55:01 +0530385
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800386#endif /* __WLAN_HDD_OCB_H */