blob: 972941c07818f0299a0ff5f9f9660b8e24e6fbf5 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
2 * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
3 *
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 __CDS_CONCURRENCY_H
29#define __CDS_CONCURRENCY_H
30
31/**
32 * DOC: cds_concurrency.h
33 *
34 * CDS Concurrenct Connection Management entity
35 */
36
37/* Include files */
38
39#include "wlan_hdd_main.h"
40
41#define MAX_NUMBER_OF_CONC_CONNECTIONS 3
42#define MAX_NUM_CHAN 128
43#define DBS_OPPORTUNISTIC_TIME 10
44
45/**
46 * enum cds_chain_mode - Chain Mask tx & rx combination.
47 *
48 * @CDS_ONE_ONE: One for Tx, One for Rx
49 * @CDS_TWO_TWO: Two for Tx, Two for Rx
50 * @CDS_MAX_NO_OF_CHAIN_MODE: Max place holder
51 *
52 * These are generic IDs that identify the various roles
53 * in the software system
54 */
55enum cds_chain_mode {
56 CDS_ONE_ONE = 0,
57 CDS_TWO_TWO,
58 CDS_MAX_NO_OF_CHAIN_MODE
59};
60
61/**
62 * enum cds_conc_priority_mode - t/p, powersave, latency.
63 *
64 * @CDS_THROUGHPUT: t/p is the priority
65 * @CDS_POWERSAVE: powersave is the priority
66 * @CDS_LATENCY: latency is the priority
67 * @CDS_MAX_CONC_PRIORITY_MODE: Max place holder
68 *
69 * These are generic IDs that identify the various roles
70 * in the software system
71 */
72enum cds_conc_priority_mode {
73 CDS_THROUGHPUT = 0,
74 CDS_POWERSAVE,
75 CDS_LATENCY,
76 CDS_MAX_CONC_PRIORITY_MODE
77};
78
79/**
80 * enum cds_con_mode - concurrency mode for PCL table
81 *
82 * @CDS_STA_MODE: station mode
83 * @CDS_SAP_MODE: SAP mode
84 * @CDS_P2P_CLIENT_MODE: P2P client mode
85 * @CDS_P2P_GO_MODE: P2P Go mode
86 * @CDS_IBSS_MODE: IBSS mode
87 * @CDS_MAX_NUM_OF_MODE: max value place holder
88 */
89enum cds_con_mode {
90 CDS_STA_MODE = 0,
91 CDS_SAP_MODE,
92 CDS_P2P_CLIENT_MODE,
93 CDS_P2P_GO_MODE,
94 CDS_IBSS_MODE,
95 CDS_MAX_NUM_OF_MODE
96};
97
98/**
99 * enum cds_pcl_type - Various types of Preferred channel list (PCL).
100 *
101 * @CDS_NONE: No channel preference
102 * @CDS_24G: 2.4 Ghz channels only
103 * @CDS_5G: 5 Ghz channels only
104 * @CDS_SCC_CH: SCC channel only
105 * @CDS_MCC_CH: MCC channels only
106 * @CDS_SCC_CH_24G: SCC channel & 2.4 Ghz channels
107 * @CDS_SCC_CH_5G: SCC channel & 5 Ghz channels
108 * @CDS_24G_SCC_CH: 2.4 Ghz channels & SCC channel
109 * @CDS_5G_SCC_CH: 5 Ghz channels & SCC channel
110 * @CDS_SCC_ON_5_SCC_ON_24_24G: SCC channel on 5 Ghz, SCC
111 * channel on 2.4 Ghz & 2.4 Ghz channels
112 * @CDS_SCC_ON_5_SCC_ON_24_5G: SCC channel on 5 Ghz, SCC channel
113 * on 2.4 Ghz & 5 Ghz channels
114 * @CDS_SCC_ON_24_SCC_ON_5_24G: SCC channel on 2.4 Ghz, SCC
115 * channel on 5 Ghz & 2.4 Ghz channels
116 * @CDS_SCC_ON_24_SCC_ON_5_5G: SCC channel on 2.4 Ghz, SCC
117 * channel on 5 Ghz & 5 Ghz channels
118 * @CDS_SCC_ON_5_SCC_ON_24: SCC channel on 5 Ghz, SCC channel on
119 * 2.4 Ghz
120 * @CDS_SCC_ON_24_SCC_ON_5: SCC channel on 2.4 Ghz, SCC channel
121 * on 5 Ghz
122 * @CDS_MCC_CH_24G: MCC channels & 2.4 Ghz channels
123 * @CDS_MCC_CH_5G: MCC channels & 5 Ghz channels
124 * @CDS_24G_MCC_CH: 2.4 Ghz channels & MCC channels
125 * @CDS_5G_MCC_CH: 5 Ghz channels & MCC channels
126 * @CDS_MAX_PCL_TYPE: Max place holder
127 *
128 * These are generic IDs that identify the various roles
129 * in the software system
130 */
131enum cds_pcl_type {
132 CDS_NONE = 0,
133 CDS_24G,
134 CDS_5G,
135 CDS_SCC_CH,
136 CDS_MCC_CH,
137 CDS_SCC_CH_24G,
138 CDS_SCC_CH_5G,
139 CDS_24G_SCC_CH,
140 CDS_5G_SCC_CH,
141 CDS_SCC_ON_5_SCC_ON_24_24G,
142 CDS_SCC_ON_5_SCC_ON_24_5G,
143 CDS_SCC_ON_24_SCC_ON_5_24G,
144 CDS_SCC_ON_24_SCC_ON_5_5G,
145 CDS_SCC_ON_5_SCC_ON_24,
146 CDS_SCC_ON_24_SCC_ON_5,
147 CDS_MCC_CH_24G,
148 CDS_MCC_CH_5G,
149 CDS_24G_MCC_CH,
150 CDS_5G_MCC_CH,
151
152 CDS_MAX_PCL_TYPE
153};
154
155/**
156 * enum cds_one_connection_mode - Combination of first connection
157 * type, band & spatial stream used.
158 *
159 * @CDS_STA_24_1x1: STA connection using 1x1@2.4 Ghz
160 * @CDS_STA_24_2x2: STA connection using 2x2@2.4 Ghz
161 * @CDS_STA_5_1x1: STA connection using 1x1@5 Ghz
162 * @CDS_STA_5_2x2: STA connection using 2x2@5 Ghz
163 * @CDS_P2P_CLI_24_1x1: P2P Client connection using 1x1@2.4 Ghz
164 * @CDS_P2P_CLI_24_2x2: P2P Client connection using 2x2@2.4 Ghz
165 * @CDS_P2P_CLI_5_1x1: P2P Client connection using 1x1@5 Ghz
166 * @CDS_P2P_CLI_5_2x2: P2P Client connection using 2x2@5 Ghz
167 * @CDS_P2P_GO_24_1x1: P2P GO connection using 1x1@2.4 Ghz
168 * @CDS_P2P_GO_24_2x2: P2P GO connection using 2x2@2.4 Ghz
169 * @CDS_P2P_GO_5_1x1: P2P GO connection using 1x1@5 Ghz
170 * @CDS_P2P_GO_5_2x2: P2P GO connection using 2x2@5 Ghz
171 * @CDS_SAP_24_1x1: SAP connection using 1x1@2.4 Ghz
172 * @CDS_SAP_24_2x2: SAP connection using 2x2@2.4 Ghz
173 * @CDS_SAP_5_1x1: SAP connection using 1x1@5 Ghz
174 * @CDS_SAP_5_1x1: SAP connection using 2x2@5 Ghz
175 * @CDS_IBSS_24_1x1: IBSS connection using 1x1@2.4 Ghz
176 * @CDS_IBSS_24_2x2: IBSS connection using 2x2@2.4 Ghz
177 * @CDS_IBSS_5_1x1: IBSS connection using 1x1@5 Ghz
178 * @CDS_IBSS_5_2x2: IBSS connection using 2x2@5 Ghz
179 * @CDS_MAX_ONE_CONNECTION_MODE: Max place holder
180 *
181 * These are generic IDs that identify the various roles
182 * in the software system
183 */
184enum cds_one_connection_mode {
185 CDS_STA_24_1x1 = 0,
186 CDS_STA_24_2x2,
187 CDS_STA_5_1x1,
188 CDS_STA_5_2x2,
189 CDS_P2P_CLI_24_1x1,
190 CDS_P2P_CLI_24_2x2,
191 CDS_P2P_CLI_5_1x1,
192 CDS_P2P_CLI_5_2x2,
193 CDS_P2P_GO_24_1x1,
194 CDS_P2P_GO_24_2x2,
195 CDS_P2P_GO_5_1x1,
196 CDS_P2P_GO_5_2x2,
197 CDS_SAP_24_1x1,
198 CDS_SAP_24_2x2,
199 CDS_SAP_5_1x1,
200 CDS_SAP_5_2x2,
201 CDS_IBSS_24_1x1,
202 CDS_IBSS_24_2x2,
203 CDS_IBSS_5_1x1,
204 CDS_IBSS_5_2x2,
205
206 CDS_MAX_ONE_CONNECTION_MODE
207};
208
209/**
210 * enum cds_two_connection_mode - Combination of first two
211 * connections type, concurrency state, band & spatial stream
212 * used.
213 *
214 * @CDS_STA_SAP_SCC_24_1x1: STA & SAP connection on SCC using
215 * 1x1@2.4 Ghz
216 * @CDS_STA_SAP_SCC_24_2x2: STA & SAP connection on SCC using
217 * 2x2@2.4 Ghz
218 * @CDS_STA_SAP_MCC_24_1x1: STA & SAP connection on MCC using
219 * 1x1@2.4 Ghz
220 * @CDS_STA_SAP_MCC_24_2x2: STA & SAP connection on MCC using
221 * 2x2@2.4 Ghz
222 * @CDS_STA_SAP_SCC_5_1x1: STA & SAP connection on SCC using
223 * 1x1@5 Ghz
224 * @CDS_STA_SAP_SCC_5_2x2: STA & SAP connection on SCC using
225 * 2x2@5 Ghz
226 * @CDS_STA_SAP_MCC_5_1x1: STA & SAP connection on MCC using
227 * 1x1@5 Ghz
228 * @CDS_STA_SAP_MCC_5_2x2: STA & SAP connection on MCC using
229 * 2x2@5 Ghz
230 * @CDS_STA_SAP_DBS_1x1,: STA & SAP connection on DBS using 1x1
231 * @CDS_STA_P2P_GO_SCC_24_1x1: STA & P2P GO connection on SCC
232 * using 1x1@2.4 Ghz
233 * @CDS_STA_P2P_GO_SCC_24_2x2: STA & P2P GO connection on SCC
234 * using 2x2@2.4 Ghz
235 * @CDS_STA_P2P_GO_MCC_24_1x1: STA & P2P GO connection on MCC
236 * using 1x1@2.4 Ghz
237 * @CDS_STA_P2P_GO_MCC_24_2x2: STA & P2P GO connection on MCC
238 * using 2x2@2.4 Ghz
239 * @CDS_STA_P2P_GO_SCC_5_1x1: STA & P2P GO connection on SCC
240 * using 1x1@5 Ghz
241 * @CDS_STA_P2P_GO_SCC_5_2x2: STA & P2P GO connection on SCC
242 * using 2x2@5 Ghz
243 * @CDS_STA_P2P_GO_MCC_5_1x1: STA & P2P GO connection on MCC
244 * using 1x1@5 Ghz
245 * @CDS_STA_P2P_GO_MCC_5_2x2: STA & P2P GO connection on MCC
246 * using 2x2@5 Ghz
247 * @CDS_STA_P2P_GO_DBS_1x1: STA & P2P GO connection on DBS using
248 * 1x1
249 * @CDS_STA_P2P_CLI_SCC_24_1x1: STA & P2P CLI connection on SCC
250 * using 1x1@2.4 Ghz
251 * @CDS_STA_P2P_CLI_SCC_24_2x2: STA & P2P CLI connection on SCC
252 * using 2x2@2.4 Ghz
253 * @CDS_STA_P2P_CLI_MCC_24_1x1: STA & P2P CLI connection on MCC
254 * using 1x1@2.4 Ghz
255 * @CDS_STA_P2P_CLI_MCC_24_2x2: STA & P2P CLI connection on MCC
256 * using 2x2@2.4 Ghz
257 * @CDS_STA_P2P_CLI_SCC_5_1x1: STA & P2P CLI connection on SCC
258 * using 1x1@5 Ghz
259 * @CDS_STA_P2P_CLI_SCC_5_2x2: STA & P2P CLI connection on SCC
260 * using 2x2@5 Ghz
261 * @CDS_STA_P2P_CLI_MCC_5_1x1: STA & P2P CLI connection on MCC
262 * using 1x1@5 Ghz
263 * @CDS_STA_P2P_CLI_MCC_5_2x2: STA & P2P CLI connection on MCC
264 * using 2x2@5 Ghz
265 * @CDS_STA_P2P_CLI_DBS_1x1: STA & P2P CLI connection on DBS
266 * using 1x1
267 * @CDS_P2P_GO_P2P_CLI_SCC_24_1x1: P2P GO & CLI connection on
268 * SCC using 1x1@2.4 Ghz
269 * @CDS_P2P_GO_P2P_CLI_SCC_24_2x2: P2P GO & CLI connection on
270 * SCC using 2x2@2.4 Ghz
271 * @CDS_P2P_GO_P2P_CLI_MCC_24_1x1: P2P GO & CLI connection on
272 * MCC using 1x1@2.4 Ghz
273 * @CDS_P2P_GO_P2P_CLI_MCC_24_2x2: P2P GO & CLI connection on
274 * MCC using 2x2@2.4 Ghz
275 * @CDS_P2P_GO_P2P_CLI_SCC_5_1x1: P2P GO & CLI connection on
276 * SCC using 1x1@5 Ghz
277 * @CDS_P2P_GO_P2P_CLI_SCC_5_2x2: P2P GO & CLI connection on
278 * SCC using 2x2@5 Ghz
279 * @CDS_P2P_GO_P2P_CLI_MCC_5_1x1: P2P GO & CLI connection on
280 * MCC using 1x1@5 Ghz
281 * @CDS_P2P_GO_P2P_CLI_MCC_5_2x2: P2P GO & CLI connection on
282 * MCC using 2x2@5 Ghz
283 * @CDS_P2P_GO_P2P_CLI_DBS_1x1: P2P GO & CLI connection on DBS
284 * using 1x1
285 * @CDS_P2P_GO_SAP_SCC_24_1x1: P2P GO & SAP connection on
286 * SCC using 1x1@2.4 Ghz
287 * @CDS_P2P_GO_SAP_SCC_24_2x2: P2P GO & SAP connection on
288 * SCC using 2x2@2.4 Ghz
289 * @CDS_P2P_GO_SAP_MCC_24_1x1: P2P GO & SAP connection on
290 * MCC using 1x1@2.4 Ghz
291 * @CDS_P2P_GO_SAP_MCC_24_2x2: P2P GO & SAP connection on
292 * MCC using 2x2@2.4 Ghz
293 * @CDS_P2P_GO_SAP_SCC_5_1x1: P2P GO & SAP connection on
294 * SCC using 1x1@5 Ghz
295 * @CDS_P2P_GO_SAP_SCC_5_2x2: P2P GO & SAP connection on
296 * SCC using 2x2@5 Ghz
297 * @CDS_P2P_GO_SAP_MCC_5_1x1: P2P GO & SAP connection on
298 * MCC using 1x1@5 Ghz
299 * @CDS_P2P_GO_SAP_MCC_5_2x2: P2P GO & SAP connection on
300 * MCC using 2x2@5 Ghz
301 * @CDS_P2P_GO_SAP_DBS_1x1: P2P GO & SAP connection on DBS using
302 * 1x1
303 * @CDS_MAX_TWO_CONNECTION_MODE: Max place holder
304 *
305 * These are generic IDs that identify the various roles
306 * in the software system
307 */
308enum cds_two_connection_mode {
309 CDS_STA_SAP_SCC_24_1x1 = 0,
310 CDS_STA_SAP_SCC_24_2x2,
311 CDS_STA_SAP_MCC_24_1x1,
312 CDS_STA_SAP_MCC_24_2x2,
313 CDS_STA_SAP_SCC_5_1x1,
314 CDS_STA_SAP_SCC_5_2x2,
315 CDS_STA_SAP_MCC_5_1x1,
316 CDS_STA_SAP_MCC_5_2x2,
317 CDS_STA_SAP_MCC_24_5_1x1,
318 CDS_STA_SAP_MCC_24_5_2x2,
319 CDS_STA_SAP_DBS_1x1,
320 CDS_STA_P2P_GO_SCC_24_1x1,
321 CDS_STA_P2P_GO_SCC_24_2x2,
322 CDS_STA_P2P_GO_MCC_24_1x1,
323 CDS_STA_P2P_GO_MCC_24_2x2,
324 CDS_STA_P2P_GO_SCC_5_1x1,
325 CDS_STA_P2P_GO_SCC_5_2x2,
326 CDS_STA_P2P_GO_MCC_5_1x1,
327 CDS_STA_P2P_GO_MCC_5_2x2,
328 CDS_STA_P2P_GO_MCC_24_5_1x1,
329 CDS_STA_P2P_GO_MCC_24_5_2x2,
330 CDS_STA_P2P_GO_DBS_1x1,
331 CDS_STA_P2P_CLI_SCC_24_1x1,
332 CDS_STA_P2P_CLI_SCC_24_2x2,
333 CDS_STA_P2P_CLI_MCC_24_1x1,
334 CDS_STA_P2P_CLI_MCC_24_2x2,
335 CDS_STA_P2P_CLI_SCC_5_1x1,
336 CDS_STA_P2P_CLI_SCC_5_2x2,
337 CDS_STA_P2P_CLI_MCC_5_1x1,
338 CDS_STA_P2P_CLI_MCC_5_2x2,
339 CDS_STA_P2P_CLI_MCC_24_5_1x1,
340 CDS_STA_P2P_CLI_MCC_24_5_2x2,
341 CDS_STA_P2P_CLI_DBS_1x1,
342 CDS_P2P_GO_P2P_CLI_SCC_24_1x1,
343 CDS_P2P_GO_P2P_CLI_SCC_24_2x2,
344 CDS_P2P_GO_P2P_CLI_MCC_24_1x1,
345 CDS_P2P_GO_P2P_CLI_MCC_24_2x2,
346 CDS_P2P_GO_P2P_CLI_SCC_5_1x1,
347 CDS_P2P_GO_P2P_CLI_SCC_5_2x2,
348 CDS_P2P_GO_P2P_CLI_MCC_5_1x1,
349 CDS_P2P_GO_P2P_CLI_MCC_5_2x2,
350 CDS_P2P_GO_P2P_CLI_MCC_24_5_1x1,
351 CDS_P2P_GO_P2P_CLI_MCC_24_5_2x2,
352 CDS_P2P_GO_P2P_CLI_DBS_1x1,
353 CDS_P2P_GO_SAP_SCC_24_1x1,
354 CDS_P2P_GO_SAP_SCC_24_2x2,
355 CDS_P2P_GO_SAP_MCC_24_1x1,
356 CDS_P2P_GO_SAP_MCC_24_2x2,
357 CDS_P2P_GO_SAP_SCC_5_1x1,
358 CDS_P2P_GO_SAP_SCC_5_2x2,
359 CDS_P2P_GO_SAP_MCC_5_1x1,
360 CDS_P2P_GO_SAP_MCC_5_2x2,
361 CDS_P2P_GO_SAP_MCC_24_5_1x1,
362 CDS_P2P_GO_SAP_MCC_24_5_2x2,
363 CDS_P2P_GO_SAP_DBS_1x1,
364
365 CDS_MAX_TWO_CONNECTION_MODE
366};
367
368/**
369 * enum cds_conc_next_action - actions to be taken on old
370 * connections.
371 *
372 * @CDS_NOP: No action
373 * @CDS_DBS: switch to DBS mode
374 * @CDS_DBS_DOWNGRADE: switch to DBS mode & downgrade to 1x1
375 * @CDS_MCC: switch to MCC/SCC mode
376 * @CDS_MCC_UPGRADE: switch to MCC/SCC mode & upgrade to 2x2
377 * @CDS_MAX_CONC_PRIORITY_MODE: Max place holder
378 *
379 * These are generic IDs that identify the various roles
380 * in the software system
381 */
382enum cds_conc_next_action {
383 CDS_NOP = 0,
384 CDS_DBS,
385 CDS_DBS_DOWNGRADE,
386 CDS_MCC,
387 CDS_MCC_UPGRADE,
388 CDS_MAX_CONC_NEXT_ACTION
389};
390
391/**
392 * enum cds_band - wifi band.
393 *
394 * @CDS_BAND_24: 2.4 Ghz band
395 * @CDS_BAND_5: 5 Ghz band
396 * @CDS_MAX_BAND: Max place holder
397 *
398 * These are generic IDs that identify the various roles
399 * in the software system
400 */
401enum cds_band {
402 CDS_BAND_24 = 0,
403 CDS_BAND_5,
404 CDS_MAX_BAND
405};
406
407/**
408 * struct cds_conc_connection_info - information of all existing
409 * connections in the wlan system
410 *
411 * @mode: connection type
412 * @chan: channel of the connection
413 * @mac: The HW mac it is running
414 * @tx_spatial_stream: Tx spatial stream used by the connection
415 * @rx_spatial_stream: Tx spatial stream used by the connection
416 * @original_nss: nss negotiated at connection time
417 * @vdev_id: vdev id of the connection
418 * @in_use: if the table entry is active
419 */
420struct cds_conc_connection_info {
421 enum cds_con_mode mode;
422 uint8_t chan;
423 uint8_t mac;
424 enum cds_chain_mode chain_mask;
425 uint8_t tx_spatial_stream;
426 uint8_t rx_spatial_stream;
427 uint32_t original_nss;
428 uint32_t vdev_id;
429 bool in_use;
430};
431
432bool cds_is_connection_in_progress(hdd_context_t *hdd_ctx);
433void cds_dump_concurrency_info(hdd_context_t *pHddCtx);
434void cds_set_concurrency_mode(hdd_context_t *pHddCtx, tCDF_CON_MODE mode);
435void cds_clear_concurrency_mode(hdd_context_t *pHddCtx,
436 tCDF_CON_MODE mode);
437uint32_t cds_get_connection_count(hdd_context_t *hdd_ctx);
438/**
439 * cds_is_sta_connection_pending() - This function will check if sta connection
440 * is pending or not.
441 * @hdd_ctx: pointer to hdd context
442 *
443 * This function will return the status of flag is_sta_connection_pending
444 *
445 * Return: true or false
446 */
447static inline bool
448cds_is_sta_connection_pending(hdd_context_t *hdd_ctx)
449{
450 bool status;
451 spin_lock(&hdd_ctx->sta_update_info_lock);
452 status = hdd_ctx->is_sta_connection_pending;
453 spin_unlock(&hdd_ctx->sta_update_info_lock);
454 return status;
455}
456
457/**
458 * cds_change_sta_conn_pending_status() - This function will change the value
459 * of is_sta_connection_pending
460 * @hdd_ctx: pointer to hdd context
461 * @value: value to set
462 *
463 * This function will change the value of is_sta_connection_pending
464 *
465 * Return: none
466 */
467static inline void
468cds_change_sta_conn_pending_status(hdd_context_t *hdd_ctx,
469 bool value)
470{
471 spin_lock(&hdd_ctx->sta_update_info_lock);
472 hdd_ctx->is_sta_connection_pending = value;
473 spin_unlock(&hdd_ctx->sta_update_info_lock);
474}
475
476/**
477 * cds_is_sap_restart_required() - This function will check if sap restart
478 * is pending or not.
479 * @hdd_ctx: pointer to hdd context.
480 *
481 * This function will return the status of flag is_sap_restart_required.
482 *
483 * Return: true or false
484 */
485static inline bool
486cds_is_sap_restart_required(hdd_context_t *hdd_ctx)
487{
488 bool status;
489 spin_lock(&hdd_ctx->sap_update_info_lock);
490 status = hdd_ctx->is_sap_restart_required;
491 spin_unlock(&hdd_ctx->sap_update_info_lock);
492 return status;
493}
494
495/**
496 * cds_change_sap_restart_required_status() - This function will change the
497 * value of is_sap_restart_required
498 * @hdd_ctx: pointer to hdd context
499 * @value: value to set
500 *
501 * This function will change the value of is_sap_restart_required
502 *
503 * Return: none
504 */
505static inline void
506cds_change_sap_restart_required_status(hdd_context_t *hdd_ctx,
507 bool value)
508{
509 spin_lock(&hdd_ctx->sap_update_info_lock);
510 hdd_ctx->is_sap_restart_required = value;
511 spin_unlock(&hdd_ctx->sap_update_info_lock);
512}
513
514/**
515 * cds_set_connection_in_progress() - to set the connection in progress flag
516 * @hdd_ctx: pointer to hdd context
517 * @value: value to set
518 *
519 * This function will set the passed value to connection in progress flag.
520 * If value is previously being set to true then no need to set it again.
521 *
522 * Return: true if value is being set correctly and false otherwise.
523 */
524static inline bool
525cds_set_connection_in_progress(hdd_context_t *hdd_ctx,
526 bool value)
527{
528 bool status = true;
529 spin_lock(&hdd_ctx->connection_status_lock);
530 /*
531 * if the value is set to true previously and if someone is
532 * trying to make it true again then it could be some race
533 * condition being triggered. Avoid this situation by returning
534 * false
535 */
536 if (hdd_ctx->connection_in_progress && value)
537 status = false;
538 else
539 hdd_ctx->connection_in_progress = value;
540 spin_unlock(&hdd_ctx->connection_status_lock);
541 return status;
542}
543
544
545int cds_cfg80211_get_concurrency_matrix(struct wiphy *wiphy,
546 struct wireless_dev *wdev,
547 const void *data,
548 int data_len);
549uint32_t cds_get_concurrency_mode(void);
550CDF_STATUS cds_check_and_restart_sap(hdd_context_t *hdd_ctx,
551 eCsrRoamResult roam_result,
552 hdd_station_ctx_t *hdd_sta_ctx);
553void cds_handle_conc_rule1(hdd_context_t *hdd_ctx,
554 hdd_adapter_t *adapter,
555 tCsrRoamProfile *roam_profile);
556#ifdef FEATURE_WLAN_CH_AVOID
557bool cds_handle_conc_rule2(hdd_context_t *hdd_ctx,
558 hdd_adapter_t *adapter,
559 tCsrRoamProfile *roam_profile,
560 uint32_t *roam_id);
561#else
562static inline bool cds_handle_conc_rule2(hdd_context_t *hdd_ctx,
563 hdd_adapter_t *adapter,
564 tCsrRoamProfile *roam_profile,
565 uint32_t *roam_id)
566{
567 return true;
568}
569#endif /* FEATURE_WLAN_CH_AVOID */
570bool cds_handle_conc_multiport(uint8_t session_id, uint8_t channel);
571
572#ifdef FEATURE_WLAN_FORCE_SAP_SCC
573void cds_force_sap_on_scc(hdd_context_t *hdd_ctx, eCsrRoamResult roam_result);
574#else
575static inline void cds_force_sap_on_scc(hdd_context_t *hdd_ctx,
576 eCsrRoamResult roam_result)
577{
578
579}
580#endif /* FEATURE_WLAN_FORCE_SAP_SCC */
581
582#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
583void cds_check_concurrent_intf_and_restart_sap(
584 hdd_context_t *hdd_ctx,
585 hdd_station_ctx_t *hdd_sta_ctx,
586 hdd_adapter_t *adapter);
587#else
588static inline void cds_check_concurrent_intf_and_restart_sap(
589 hdd_context_t *hdd_ctx,
590 hdd_station_ctx_t *hdd_sta_ctx,
591 hdd_adapter_t *adapter)
592{
593
594}
595#endif /* FEATURE_WLAN_MCC_TO_SCC_SWITCH */
596uint8_t cds_is_mcc_in_24G(hdd_context_t *hdd_ctx);
597int32_t cds_set_mas(hdd_adapter_t *adapter, uint8_t mas_value);
598int cds_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapter,
599 uint32_t set_value);
600CDF_STATUS cds_change_mcc_go_beacon_interval(hdd_adapter_t *pHostapdAdapter);
601int cds_go_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapter,
602 uint32_t set_value);
603void cds_set_mcc_latency(hdd_adapter_t *adapter, int set_value);
604#if defined(FEATURE_WLAN_MCC_TO_SCC_SWITCH) || \
605 defined(FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE)
606void cds_restart_sap(hdd_adapter_t *ap_adapter);
607#else
608static inline void cds_restart_sap(hdd_adapter_t *ap_adapter)
609{
610
611}
612#endif /* FEATURE_WLAN_MCC_TO_SCC_SWITCH ||
613 * FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE
614 */
615
616#ifdef FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE
617void cds_check_and_restart_sap_with_non_dfs_acs(hdd_context_t *hdd_ctx);
618#else
619static inline void cds_check_and_restart_sap_with_non_dfs_acs(
620 hdd_context_t *hdd_ctx)
621{
622
623}
624#endif /* FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE */
625void cds_incr_active_session(hdd_context_t *pHddCtx, tCDF_CON_MODE mode,
626 uint8_t sessionId);
627void cds_decr_active_session(hdd_context_t *pHddCtx, tCDF_CON_MODE mode,
628 uint8_t sessionId);
629void cds_decr_session_set_pcl(hdd_context_t *hdd_ctx,
630 tCDF_CON_MODE mode,
631 uint8_t session_id);
632CDF_STATUS cds_init_policy_mgr(hdd_context_t *hdd_ctx);
633CDF_STATUS cds_get_pcl(hdd_context_t *hdd_ctx, enum cds_con_mode mode,
634 uint8_t *pcl_Channels, uint32_t *len);
635bool cds_allow_concurrency(hdd_context_t *hdd_ctx, enum cds_con_mode mode,
636 uint8_t channel, enum hw_mode_bandwidth bw);
637enum cds_conc_priority_mode cds_get_first_connection_pcl_table_index(
638 hdd_context_t *hdd_ctx);
639enum cds_one_connection_mode cds_get_second_connection_pcl_table_index(
640 hdd_context_t *hdd_ctx);
641enum cds_two_connection_mode cds_get_third_connection_pcl_table_index(
642 hdd_context_t *hdd_ctx);
643CDF_STATUS cds_mode_switch_dbs_to_mcc(hdd_context_t *hdd_ctx);
644CDF_STATUS cds_mode_switch_mcc_to_dbs(hdd_context_t *hdd_ctx);
645CDF_STATUS cds_incr_connection_count(hdd_context_t *hdd_ctx,
646 uint32_t vdev_id);
647CDF_STATUS cds_update_connection_info(hdd_context_t *hdd_ctx,
648 uint32_t vdev_id);
649CDF_STATUS cds_decr_connection_count(hdd_context_t *hdd_ctx,
650 uint32_t vdev_id);
651CDF_STATUS cds_current_connections_update(
652 hdd_context_t *hdd_ctx, uint8_t channel);
653#ifdef MPC_UT_FRAMEWORK
654CDF_STATUS cds_incr_connection_count_utfw(hdd_context_t *hdd_ctx,
655 uint32_t vdev_id, uint32_t tx_streams, uint32_t rx_streams,
656 uint32_t chain_mask, uint32_t type, uint32_t sub_type,
657 uint32_t channelid, uint32_t mac_id);
658CDF_STATUS cds_update_connection_info_utfw(hdd_context_t *hdd_ctx,
659 uint32_t vdev_id, uint32_t tx_streams, uint32_t rx_streams,
660 uint32_t chain_mask, uint32_t type, uint32_t sub_type,
661 uint32_t channelid, uint32_t mac_id);
662CDF_STATUS cds_decr_connection_count_utfw(hdd_context_t *hdd_ctx,
663 uint32_t del_all, uint32_t vdev_id);
664struct cds_conc_connection_info *cds_get_conn_info(hdd_context_t *hdd_ctx,
665 uint32_t *len);
666enum cds_pcl_type get_pcl_from_first_conn_table(
667 enum cds_con_mode type,
668 enum cds_conc_priority_mode sys_pref);
669enum cds_pcl_type get_pcl_from_second_conn_table(
670 enum cds_one_connection_mode idx, enum cds_con_mode type,
671 enum cds_conc_priority_mode sys_pref, uint8_t dbs_capable);
672enum cds_pcl_type get_pcl_from_third_conn_table(
673 enum cds_two_connection_mode idx, enum cds_con_mode type,
674 enum cds_conc_priority_mode sys_pref, uint8_t dbs_capable);
675#else
676static inline CDF_STATUS cds_incr_connection_count_utfw(
677 hdd_context_t *hdd_ctx, uint32_t vdev_id,
678 uint32_t tx_streams, uint32_t rx_streams,
679 uint32_t chain_mask, uint32_t type, uint32_t sub_type,
680 uint32_t channelid, uint32_t mac_id)
681{
682 return CDF_STATUS_SUCCESS;
683}
684static inline CDF_STATUS cds_update_connection_info_utfw(
685 hdd_context_t *hdd_ctx, uint32_t vdev_id,
686 uint32_t tx_streams, uint32_t rx_streams,
687 uint32_t chain_mask, uint32_t type, uint32_t sub_type,
688 uint32_t channelid, uint32_t mac_id)
689{
690 return CDF_STATUS_SUCCESS;
691}
692static inline CDF_STATUS cds_decr_connection_count_utfw(
693 hdd_context_t *hdd_ctx,
694 uint32_t del_all, uint32_t vdev_id)
695{
696 return CDF_STATUS_SUCCESS;
697}
698static inline struct cds_conc_connection_info *cds_get_conn_info(
699 hdd_context_t *hdd_ctx, uint32_t *len)
700{
701 return NULL;
702}
703#endif
704enum cds_con_mode cds_convert_device_mode_to_hdd_type(
705 device_mode_t device_mode);
706uint32_t cds_get_connection_count(hdd_context_t *hdd_ctx);
707CDF_STATUS cds_soc_set_hw_mode(hdd_context_t *hdd_ctx,
708 enum hw_mode_ss_config mac0_ss,
709 enum hw_mode_bandwidth mac0_bw,
710 enum hw_mode_ss_config mac1_ss,
711 enum hw_mode_bandwidth mac1_bw,
712 enum hw_mode_dbs_capab dbs,
713 enum hw_mode_agile_dfs_capab dfs);
714enum cds_conc_next_action cds_need_opportunistic_upgrade(
715 hdd_context_t *hdd_ctx);
716CDF_STATUS cds_next_actions(
717 hdd_context_t *hdd_ctx, enum cds_conc_next_action action);
718void cds_set_dual_mac_scan_config(hdd_context_t *hdd_ctx,
719 uint8_t dbs_val,
720 uint8_t dbs_plus_agile_scan_val,
721 uint8_t single_mac_scan_with_dbs_val);
722void cds_set_dual_mac_fw_mode_config(hdd_context_t *hdd_ctx,
723 uint8_t dbs,
724 uint8_t dfs);
725void cds_soc_set_dual_mac_cfg_cb(enum set_hw_mode_status status,
726 uint32_t scan_config,
727 uint32_t fw_mode_config);
728bool cds_map_concurrency_mode(hdd_context_t *hdd_ctx,
729 tCDF_CON_MODE *old_mode, enum cds_con_mode *new_mode);
730CDF_STATUS cds_get_channel_from_scan_result(hdd_adapter_t *adapter,
731 tCsrRoamProfile *roam_profile, uint8_t *channel);
732#endif /* __CDS_CONCURRENCY_H */