blob: 5553abb156a220d241adc2fab6ee8667a1df7732 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Jeff Johnsond039a332018-12-26 19:40:53 -08002 * Copyright (c) 2012-2019 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 WLAN_QCT_WLANSAP_INTERNAL_H
20#define WLAN_QCT_WLANSAP_INTERNAL_H
21
22/*
23 * This file contains the internal API exposed by the wlan SAP PAL layer
24 * module.
25 */
26
27#include "cds_api.h"
28#include "cds_packet.h"
29
30/* Pick up the CSR API definitions */
31#include "csr_api.h"
32#include "sap_api.h"
33#include "sap_fsm_ext.h"
34#include "sap_ch_select.h"
Sandeep Puligilla0806e0f2017-03-06 19:25:47 -080035#include <wlan_scan_public_structs.h>
36#include <wlan_objmgr_pdev_obj.h>
Abhishek Singh3d30a3b2018-09-12 15:49:18 +053037#include "wlan_vdev_mlme_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080038
39/*----------------------------------------------------------------------------
40 * Preprocessor Definitions and Constants
41 * -------------------------------------------------------------------------*/
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/*----------------------------------------------------------------------------
47 * Defines
48 * -------------------------------------------------------------------------*/
49/* DFS Non Occupancy Period =30 minutes, in microseconds */
50#define SAP_DFS_NON_OCCUPANCY_PERIOD (30 * 60 * 1000 * 1000)
51
52#define SAP_DEBUG
Ryan Hsu4252a2f2016-01-05 11:18:24 -080053
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080054#define IS_ETSI_WEATHER_CH(_ch) ((_ch >= 120) && (_ch <= 130))
55#define IS_CH_BONDING_WITH_WEATHER_CH(_ch) (_ch == 116)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080056#define IS_CHAN_JAPAN_INDOOR(_ch) ((_ch >= 36) && (_ch <= 64))
57#define IS_CHAN_JAPAN_OUTDOOR(_ch)((_ch >= 100) && (_ch <= 140))
58#define DEFAULT_CAC_TIMEOUT (60 * 1000) /* msecs - 1 min */
59#define ETSI_WEATHER_CH_CAC_TIMEOUT (10 * 60 * 1000) /* msecs - 10 min */
60#define SAP_CHAN_PREFERRED_INDOOR 1
61#define SAP_CHAN_PREFERRED_OUTDOOR 2
62
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080063/*----------------------------------------------------------------------------
64 * Typedefs
65 * -------------------------------------------------------------------------*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080066/*----------------------------------------------------------------------------
67 * Type Declarations - For internal SAP context information
68 * -------------------------------------------------------------------------*/
69/*----------------------------------------------------------------------------
70 * Opaque SAP context Type Declaration
71 * -------------------------------------------------------------------------*/
72/* We were only using this syntax, when this was truly opaque. */
73/* (I.E., it was defined in a different file.) */
74
Rajeev Kumar Sirasanagandla301aacb2018-08-07 15:48:18 +053075/**
76 * enum sap_fsm_state - SAP FSM states for Access Point role
77 * @SAP_INIT: init state
78 * @SAP_DFS_CAC_WAIT: cac wait
79 * @SAP_STARTING: starting phase
80 * @SAP_STARTED: up and running
81 * @SAP_STOPPING: about to stop and transitions to init
82 */
83enum sap_fsm_state {
84 SAP_INIT,
85 SAP_DFS_CAC_WAIT,
86 SAP_STARTING,
87 SAP_STARTED,
88 SAP_STOPPING
89};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080090
91/*----------------------------------------------------------------------------
92 * SAP context Data Type Declaration
93 * -------------------------------------------------------------------------*/
94/*----------------------------------------------------------------------------
95 * Type Declarations - QOS related
96 * -------------------------------------------------------------------------*/
97/* SAP QOS config */
98typedef struct sSapQosCfg {
99 uint8_t WmmIsEnabled;
100} tSapQosCfg;
101
102typedef struct sSapAcsChannelInfo {
103 uint32_t channelNum;
104 uint32_t weight;
105} tSapAcsChannelInfo;
106
107#ifdef FEATURE_AP_MCC_CH_AVOIDANCE
108/*
109 * In a setup having two MDM both operating in AP+AP MCC scenario
110 * if both the AP decides to use same or close channel set, CTS to
111 * self, mechanism is causing issues with connectivity. For this, its
112 * proposed that 2nd MDM devices which comes up later should detect
113 * presence of first MDM device via special Q2Q IE present in becon
114 * and avoid those channels mentioned in IE.
115 *
116 * Following struct will keep this info in sapCtx struct, and will be used
117 * to avoid such channels in Random Channel Select in case of radar ind.
118 */
119struct sap_avoid_channels_info {
120 bool present;
Wu Gao0821b0d2019-01-11 17:31:11 +0800121 uint8_t channels[CFG_VALID_CHANNEL_LIST_LEN];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800122};
123#endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
124
Jeff Johnsond0337e02017-09-13 19:57:31 -0700125struct sap_context {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800126
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800127 /* Include the current channel of AP */
128 uint32_t channel;
129 uint32_t secondary_ch;
130
131 /* Include the SME(CSR) sessionId here */
132 uint8_t sessionId;
133
Rajeev Kumar Sirasanagandla327f9b62018-09-10 19:13:35 +0530134 /* vdev object corresponding to sessionId */
135 struct wlan_objmgr_vdev *vdev;
136
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800137 /* Include the associations MAC addresses */
138 uint8_t self_mac_addr[CDS_MAC_ADDRESS_LEN];
139
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800140 /* Include the SME(CSR) context here */
Jeff Johnson66ee8a92018-03-17 15:24:26 -0700141 struct csr_roam_profile csr_roamProfile;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800142 uint32_t csr_roamId;
143
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800144 /* SAP event Callback to hdd */
145 tpWLAN_SAPEventCB pfnSapEventCallback;
146
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800147 /*
148 * Include the state machine structure here, state var that keeps
149 * track of state machine
150 */
Rajeev Kumar Sirasanagandla301aacb2018-08-07 15:48:18 +0530151 enum sap_fsm_state fsm_state;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800152
153 /* Actual storage for AP and self (STA) SSID */
154 tCsrSSIDInfo SSIDList[2];
155
156 /* Actual storage for AP bssid */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530157 struct qdf_mac_addr bssid;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800158
159 /* Mac filtering settings */
160 eSapMacAddrACL eSapMacAddrAclMode;
Anurag Chouhan6d760662016-02-20 16:05:43 +0530161 struct qdf_mac_addr acceptMacList[MAX_ACL_MAC_ADDRESS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800162 uint8_t nAcceptMac;
Anurag Chouhan6d760662016-02-20 16:05:43 +0530163 struct qdf_mac_addr denyMacList[MAX_ACL_MAC_ADDRESS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800164 uint8_t nDenyMac;
165
166 /* QOS config */
167 tSapQosCfg SapQosCfg;
168
169 void *pUsrContext;
170
171 uint32_t nStaWPARSnReqIeLength;
172 uint8_t pStaWpaRsnReqIE[MAX_ASSOC_IND_IE_LEN];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800173
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800174 uint8_t *channelList;
Liangwei Dongaef84342016-10-21 05:28:00 -0400175 uint8_t num_of_channel;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800176 uint16_t ch_width_orig;
Amar Singhal5cccafe2017-02-15 12:42:58 -0800177 struct ch_params ch_params;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800178
gaoleze5108942017-03-31 16:56:42 +0800179 uint32_t auto_channel_select_weight;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800180 tSapAcsChannelInfo acsBestChannelInfo;
181 bool enableOverLapCh;
182 struct sap_acs_cfg *acs_cfg;
183
184#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
185 uint8_t cc_switch_mode;
186#endif
187
Ryan Hsu4252a2f2016-01-05 11:18:24 -0800188#if defined(FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800189 bool dfs_ch_disable;
190#endif
191 bool isCacEndNotified;
192 bool isCacStartNotified;
193 bool is_sap_ready_for_chnl_chng;
194
195#ifdef FEATURE_AP_MCC_CH_AVOIDANCE
196 /*
197 * In a setup having two MDM both operating in AP+AP MCC scenario
198 * if both the AP decides to use same or close channel set, CTS to
199 * self, mechanism is causing issues with connectivity. For this, its
200 * proposed that 2nd MDM devices which comes up later should detect
201 * presence of first MDM device via special Q2Q IE present in becon
202 * and avoid those channels mentioned in IE.
203 *
204 * this struct contains the list of channels on which another MDM AP
205 * in MCC mode were detected.
206 */
207 struct sap_avoid_channels_info sap_detected_avoid_ch_ie;
208#endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
209 /*
210 * sap_state, sap_status are created
211 * to inform upper layers about ACS scan status.
212 * Don't use these members for anyother purposes.
213 */
214 eSapHddEvent sap_state;
215 eSapStatus sap_status;
216 uint32_t roc_ind_scan_id;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +0530217 bool is_pre_cac_on;
218 bool pre_cac_complete;
Himanshu Agarwaldfc4dca2017-08-29 19:49:05 +0530219 bool vendor_acs_dfs_lte_enabled;
Kapil Gupta8878ad92017-02-13 11:56:04 +0530220 uint8_t dfs_vendor_channel;
221 uint8_t dfs_vendor_chan_bw;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +0530222 uint8_t chan_before_pre_cac;
Jiachao Wu712d4fd2017-08-23 16:52:34 +0800223 uint16_t beacon_tx_rate;
Agrawal Ashish65634612016-08-18 13:24:32 +0530224 enum sap_acs_dfs_mode dfs_mode;
Sandeep Puligilla0806e0f2017-03-06 19:25:47 -0800225 wlan_scan_requester req_id;
bings29724712017-03-15 01:40:50 +0800226 uint8_t sap_sta_id;
Arif Hussain759a0232017-03-20 13:17:18 -0700227 bool dfs_cac_offload;
Sandeep Puligilla20aa0c72017-10-30 12:24:06 -0700228 bool is_chan_change_inprogress;
Jeff Johnsond0337e02017-09-13 19:57:31 -0700229};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800230
231/*----------------------------------------------------------------------------
232 * External declarations for global context
233 * -------------------------------------------------------------------------*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800234
235/*----------------------------------------------------------------------------
236 * SAP state machine event definition
237 * -------------------------------------------------------------------------*/
238/* The event structure */
239typedef struct sWLAN_SAPEvent {
240 /* A VOID pointer type for all possible inputs */
241 void *params;
242 /* State machine input event message */
243 uint32_t event;
Jeff Johnson6a18c962018-07-01 09:09:37 -0700244 /* introduced to handle csr_roam_complete_cb roamStatus */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800245 uint32_t u1;
Jeff Johnson6a18c962018-07-01 09:09:37 -0700246 /* introduced to handle csr_roam_complete_cb roamResult */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800247 uint32_t u2;
248} tWLAN_SAPEvent, *ptWLAN_SAPEvent;
249
250/*----------------------------------------------------------------------------
251 * Function Declarations and Documentation
252 * -------------------------------------------------------------------------*/
Jeff Johnson03d1e2c2018-10-31 08:32:02 -0700253
254/**
255 * sap_get_mac_context() - Get a pointer to the global MAC context
256 *
257 * Return: pointer to the global MAC context, or NULL if the MAC
258 * context is no longer registered
259 */
260static inline struct mac_context *sap_get_mac_context(void)
261{
262 return cds_get_context(QDF_MODULE_ID_PE);
263}
264
Jeff Johnsonf1cd3c72017-09-14 07:18:06 -0700265QDF_STATUS wlansap_context_get(struct sap_context *ctx);
266void wlansap_context_put(struct sap_context *ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800267
Jeff Johnsonffa38762017-09-25 18:14:47 -0700268/**
Jeff Johnson164b3bb2017-09-25 19:34:14 -0700269 * wlansap_pre_start_bss_acs_scan_callback() - callback for scan results
Jeff Johnson793e5a92018-11-08 07:57:04 -0800270 * @mac_handle: the mac_handle passed in with the scan request
Jeff Johnson164b3bb2017-09-25 19:34:14 -0700271 * @sap_ctx: the SAP context pointer.
272 * @scanid: scan id passed
273 * @sessionid: session identifier
274 * @scan_status: status of scan -success, failure or abort
275 *
276 * Api for scan callback. This function is invoked as a result of scan
277 * completion and reports the scan results.
278 *
279 * Return: The QDF_STATUS code associated with performing the operation
280 */
Jeff Johnson793e5a92018-11-08 07:57:04 -0800281QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(mac_handle_t mac_handle,
Jeff Johnson164b3bb2017-09-25 19:34:14 -0700282 struct sap_context *sap_ctx,
283 uint8_t sessionid,
284 uint32_t scanid,
285 eCsrScanStatus scan_status);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800286
Jeff Johnsonf1cd3c72017-09-14 07:18:06 -0700287QDF_STATUS SapFsm(struct sap_context *sapContext, ptWLAN_SAPEvent sapEvent,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800288 uint8_t *status);
289
Jeff Johnson7730fbb2018-11-08 13:48:27 -0800290uint8_t sap_select_channel(mac_handle_t mac_handle, struct sap_context *sap_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800291 tScanResultHandle pScanResult);
292
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530293QDF_STATUS
Jeff Johnsonf1cd3c72017-09-14 07:18:06 -0700294sap_signal_hdd_event(struct sap_context *sapContext,
Jeff Johnson172237b2017-11-07 15:32:59 -0800295 struct csr_roam_info *pCsrRoamInfo,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800296 eSapHddEvent sapHddevent, void *);
297
Jeff Johnsonf1cd3c72017-09-14 07:18:06 -0700298QDF_STATUS sap_fsm(struct sap_context *sapContext, ptWLAN_SAPEvent sapEvent);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800299
300eSapStatus
Jeff Johnsone4c11db2018-05-05 23:22:32 -0700301sapconvert_to_csr_profile(tsap_config_t *pconfig_params,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800302 eCsrRoamBssType bssType,
Jeff Johnson66ee8a92018-03-17 15:24:26 -0700303 struct csr_roam_profile *profile);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800304
Jeff Johnson66ee8a92018-03-17 15:24:26 -0700305void sap_free_roam_profile(struct csr_roam_profile *profile);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800306
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530307QDF_STATUS
Jeff Johnsonf1cd3c72017-09-14 07:18:06 -0700308sap_is_peer_mac_allowed(struct sap_context *sapContext, uint8_t *peerMac);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800309
310void
Anurag Chouhan6d760662016-02-20 16:05:43 +0530311sap_sort_mac_list(struct qdf_mac_addr *macList, uint8_t size);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800312
313void
Anurag Chouhan6d760662016-02-20 16:05:43 +0530314sap_add_mac_to_acl(struct qdf_mac_addr *macList, uint8_t *size,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800315 uint8_t *peerMac);
316
317void
Anurag Chouhan6d760662016-02-20 16:05:43 +0530318sap_remove_mac_from_acl(struct qdf_mac_addr *macList, uint8_t *size,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800319 uint8_t index);
320
321void
Anurag Chouhan6d760662016-02-20 16:05:43 +0530322sap_print_acl(struct qdf_mac_addr *macList, uint8_t size);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800323
Srinivas Girigowda74a66d62017-06-21 23:28:25 -0700324bool
Anurag Chouhan6d760662016-02-20 16:05:43 +0530325sap_search_mac_list(struct qdf_mac_addr *macList, uint8_t num_mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800326 uint8_t *peerMac, uint8_t *index);
327
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800328#ifdef FEATURE_WLAN_CH_AVOID
Jeff Johnson7730fbb2018-11-08 13:48:27 -0800329void sap_update_unsafe_channel_list(mac_handle_t mac_handle,
Jeff Johnsone13d8062017-09-28 06:54:55 -0700330 struct sap_context *sap_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800331#endif /* FEATURE_WLAN_CH_AVOID */
332
Jeff Johnsonf1cd3c72017-09-14 07:18:06 -0700333QDF_STATUS sap_init_dfs_channel_nol_list(struct sap_context *sapContext);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800334
Jeff Johnsonf1cd3c72017-09-14 07:18:06 -0700335bool sap_dfs_is_channel_in_nol_list(struct sap_context *sapContext,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800336 uint8_t channelNumber,
337 ePhyChanBondState chanBondState);
338void sap_dfs_cac_timer_callback(void *data);
339
Jeff Johnson19681ce2018-11-08 06:59:00 -0800340/**
341 * sap_cac_reset_notify() - BSS cleanup notification handler
342 * @mac_handle: Opaque handle to the global MAC context
343 *
344 * This function should be called upon stop bss indication to clean up
345 * DFS global structure.
346 */
347void sap_cac_reset_notify(mac_handle_t mac_handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800348
Jeff Johnson19681ce2018-11-08 06:59:00 -0800349bool is_concurrent_sap_ready_for_channel_change(mac_handle_t mac_handle,
Jeff Johnsonf1cd3c72017-09-14 07:18:06 -0700350 struct sap_context *sapContext);
Jeff Johnson15f78292018-11-09 13:24:05 -0800351
352bool sap_is_conc_sap_doing_scc_dfs(mac_handle_t mac_handle,
Krunal Sonie8324ce2017-09-25 10:16:56 -0700353 struct sap_context *given_sapctx);
Jeff Johnson15f78292018-11-09 13:24:05 -0800354
Jeff Johnson19681ce2018-11-08 06:59:00 -0800355uint8_t sap_get_total_number_sap_intf(mac_handle_t mac_handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800356
Jeff Johnson19681ce2018-11-08 06:59:00 -0800357/**
Abhishek Singh53791fa2018-06-14 14:02:50 +0530358 * sap_channel_sel - Function for initiating scan request for ACS
359 * @sap_context: Sap Context value.
360 *
361 * Initiates Scan for ACS to pick a channel.
362 *
363 * Return: The QDF_STATUS code associated with performing the operation.
364 */
365QDF_STATUS sap_channel_sel(struct sap_context *sapContext);
366
367/**
368 * sap_validate_chan - Function validate the channel and forces SCC
369 * @sap_context: Sap Context value.
370 * @pre_start_bss: if its called pre start BSS with valid channel.
371 * @check_for_connection_update: true, check and wait for connection update
372 * false, do not perform connection update
373 *
374 * validate and update the channel in case of force SCC.
375 *
376 * Return: The QDF_STATUS code associated with performing the operation.
377 */
378QDF_STATUS
379sap_validate_chan(struct sap_context *sap_context,
380 bool pre_start_bss,
381 bool check_for_connection_update);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800382
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800383/**
384 * sap_check_in_avoid_ch_list() - checks if given channel present is channel
385 * avoidance list
386 * avoid_channels_info struct
387 * @sap_ctx: sap context.
388 * @channel: channel to be checked in sap_ctx's avoid ch list
389 *
390 * sap_ctx contains sap_avoid_ch_info strcut containing the list of channels on
391 * which MDM device's AP with MCC was detected. This function checks if given
392 * channel is present in that list.
393 *
394 * Return: true, if channel was present, false othersie.
395 */
396bool
Jeff Johnsonf1cd3c72017-09-14 07:18:06 -0700397sap_check_in_avoid_ch_list(struct sap_context *sap_ctx, uint8_t channel);
Jeff Johnson15f78292018-11-09 13:24:05 -0800398
Kapil Gupta94ca6f62016-12-11 18:43:12 +0530399/**
Krunal Sonib01de792017-04-14 11:44:39 -0700400 * sap_set_session_param() - set sap related param to sap context and global var
Jeff Johnson15f78292018-11-09 13:24:05 -0800401 * @mac_handle: Opaque handle to the global MAC context
Krunal Sonib01de792017-04-14 11:44:39 -0700402 * @sapctx: pointer to sapctx
403 * @session_id: session id for sap
404 *
405 * This API will set appropriate softap parameters to sap context
406 *
407 * Return: QDF_STATUS
408 */
Jeff Johnson15f78292018-11-09 13:24:05 -0800409QDF_STATUS sap_set_session_param(mac_handle_t mac_handle,
410 struct sap_context *sapctx,
411 uint32_t session_id);
412
Krunal Sonib01de792017-04-14 11:44:39 -0700413/**
414 * sap_clear_session_param() - clear sap related param from sap context
Jeff Johnson15f78292018-11-09 13:24:05 -0800415 * @mac_handle: Opaque handle to the global MAC context
Krunal Sonib01de792017-04-14 11:44:39 -0700416 * @sapctx: pointer to sapctx
417 * @session_id: session id for sap
418 *
419 * This API will clear appropriate softap parameters from sap context
420 *
421 * Return: QDF_STATUS
422 */
Jeff Johnson15f78292018-11-09 13:24:05 -0800423QDF_STATUS sap_clear_session_param(mac_handle_t mac_handle,
424 struct sap_context *sapctx,
425 uint32_t session_id);
Kapil Gupta94ca6f62016-12-11 18:43:12 +0530426
Sandeep Puligilla0806e0f2017-03-06 19:25:47 -0800427void sap_scan_event_callback(struct wlan_objmgr_vdev *vdev,
428 struct scan_event *event, void *arg);
429
Wen Gongbf560c82018-05-09 15:44:35 +0800430#ifdef DFS_COMPONENT_ENABLE
Arif Hussaincd151632017-02-11 16:57:19 -0800431/**
432 * sap_indicate_radar() - Process radar indication
433 * @sap_ctx: pointer to sap context
434 *
435 * process radar indication.
436 *
437 * Return: channel to which sap wishes to switch.
438 */
Jeff Johnsonf1cd3c72017-09-14 07:18:06 -0700439uint8_t sap_indicate_radar(struct sap_context *sap_ctx);
Wen Gongbf560c82018-05-09 15:44:35 +0800440#else
441static inline uint8_t sap_indicate_radar(struct sap_context *sap_ctx)
442{
443 return 0;
444}
445#endif
Arif Hussaincd151632017-02-11 16:57:19 -0800446
wadesong1795e142018-01-05 11:13:07 +0800447/**
448 * sap_select_default_oper_chan() - Select AP mode default operating channel
449 * @acs_cfg: pointer to ACS config info
450 *
451 * Select AP mode default operating channel based on ACS hw mode and channel
452 * range configuration when ACS scan fails due to some reasons, such as scan
453 * timeout, etc.
454 *
455 * Return: Selected operating channel number
456 */
457uint8_t sap_select_default_oper_chan(struct sap_acs_cfg *acs_cfg);
458
Abhishek Singh3d30a3b2018-09-12 15:49:18 +0530459/*
460 * sap_is_dfs_cac_wait_state() - check if sap is in cac wait state
461 * @sap_ctx: sap context to check
462 *
463 * Return: true if sap is in cac wait state
464 */
465#ifdef CONFIG_VDEV_SM
466static inline bool sap_is_dfs_cac_wait_state(struct sap_context *sap_ctx)
467{
468 if (!sap_ctx)
469 return false;
470
Abhishek Singhd5cf22d2019-01-08 19:51:09 +0530471 return QDF_IS_STATUS_SUCCESS(wlan_vdev_is_dfs_cac_wait(sap_ctx->vdev));
Abhishek Singh3d30a3b2018-09-12 15:49:18 +0530472}
473#else
474static inline bool sap_is_dfs_cac_wait_state(struct sap_context *sap_ctx)
475{
476 if (!sap_ctx)
477 return false;
478
479 return (sap_ctx->fsm_state == SAP_DFS_CAC_WAIT);
480}
481#endif
482
Tushnim Bhattacharyya691680e2018-01-23 20:50:06 -0800483/**
484 * sap_channel_in_acs_channel_list() - check if channel in acs channel list
485 * @channel_num: channel to check
486 * @sap_ctx: struct ptSapContext
487 * @spect_info_params: strcut tSapChSelSpectInfo
488 *
489 * This function checks if specified channel is in the configured ACS channel
490 * list.
491 *
492 * Return: channel number if in acs channel list or SAP_CHANNEL_NOT_SELECTED
493 */
494uint8_t sap_channel_in_acs_channel_list(uint8_t channel_num,
495 struct sap_context *sap_ctx,
496 tSapChSelSpectInfo *spect_info_params);
497
Rajeev Kumar Sirasanagandla327f9b62018-09-10 19:13:35 +0530498/**
Liangwei Dong3fb00162018-09-28 04:16:03 -0400499 * sap_chan_bond_dfs_sub_chan - check bonded channel includes dfs sub chan
500 * @sap_context: Handle to SAP context.
501 * @channel_number: chan whose bonded chan will be checked
502 * @bond_state: The channel bonding mode of the passed channel.
503 *
504 * This function checks if a given bonded channel includes dfs sub chan.
505 *
506 * Return: true if at least one dfs sub chan is bonded, otherwise false
507 */
508bool
509sap_chan_bond_dfs_sub_chan(struct sap_context *sap_context,
510 uint8_t channel_number,
511 ePhyChanBondState bond_state);
512
513/**
Rajeev Kumar Sirasanagandla327f9b62018-09-10 19:13:35 +0530514 * sap_acquire_vdev_ref() - Increment reference count for vdev object
515 * @mac: mac handle
516 * @sap_ctx: to store vdev object pointer
517 * @session_id: used to get vdev object
518 *
519 * This function is used to increment vdev object reference count and store
520 * vdev pointer in sap_ctx.
521 *
522 * Return: QDF_STATUS_SUCCESS - If able to get vdev object reference
523 * else qdf status failure codes
524 */
Jeff Johnsonc59ef8b2018-12-02 12:01:21 -0800525QDF_STATUS sap_acquire_vdev_ref(struct mac_context *mac,
Rajeev Kumar Sirasanagandla327f9b62018-09-10 19:13:35 +0530526 struct sap_context *sap_ctx,
527 uint8_t session_id);
528
529/**
530 * sap_release_vdev_ref() - Decrement reference count for vdev object
531 * @sap_ctx: for which vdev reference is to be decremented
532 *
533 * Return: None
534 */
535void sap_release_vdev_ref(struct sap_context *sap_ctx);
536
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800537#ifdef __cplusplus
538}
539#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800540#endif