Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Jeff Johnson | d039a33 | 2018-12-26 19:40:53 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19 | #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 Puligilla | 0806e0f | 2017-03-06 19:25:47 -0800 | [diff] [blame] | 35 | #include <wlan_scan_public_structs.h> |
| 36 | #include <wlan_objmgr_pdev_obj.h> |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 37 | #include "wlan_vdev_mlme_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 38 | |
| 39 | /*---------------------------------------------------------------------------- |
| 40 | * Preprocessor Definitions and Constants |
| 41 | * -------------------------------------------------------------------------*/ |
| 42 | #ifdef __cplusplus |
| 43 | extern "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 Hsu | 4252a2f | 2016-01-05 11:18:24 -0800 | [diff] [blame] | 53 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 54 | #define IS_ETSI_WEATHER_CH(_ch) ((_ch >= 120) && (_ch <= 130)) |
| 55 | #define IS_CH_BONDING_WITH_WEATHER_CH(_ch) (_ch == 116) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 56 | #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 Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 63 | /*---------------------------------------------------------------------------- |
| 64 | * Typedefs |
| 65 | * -------------------------------------------------------------------------*/ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 66 | /*---------------------------------------------------------------------------- |
| 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 Sirasanagandla | 301aacb | 2018-08-07 15:48:18 +0530 | [diff] [blame] | 75 | /** |
| 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 | */ |
| 83 | enum sap_fsm_state { |
| 84 | SAP_INIT, |
| 85 | SAP_DFS_CAC_WAIT, |
| 86 | SAP_STARTING, |
| 87 | SAP_STARTED, |
| 88 | SAP_STOPPING |
| 89 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 90 | |
| 91 | /*---------------------------------------------------------------------------- |
| 92 | * SAP context Data Type Declaration |
| 93 | * -------------------------------------------------------------------------*/ |
| 94 | /*---------------------------------------------------------------------------- |
| 95 | * Type Declarations - QOS related |
| 96 | * -------------------------------------------------------------------------*/ |
| 97 | /* SAP QOS config */ |
| 98 | typedef struct sSapQosCfg { |
| 99 | uint8_t WmmIsEnabled; |
| 100 | } tSapQosCfg; |
| 101 | |
| 102 | typedef 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 | */ |
| 119 | struct sap_avoid_channels_info { |
| 120 | bool present; |
Wu Gao | 0821b0d | 2019-01-11 17:31:11 +0800 | [diff] [blame] | 121 | uint8_t channels[CFG_VALID_CHANNEL_LIST_LEN]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 122 | }; |
| 123 | #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */ |
| 124 | |
Jeff Johnson | d0337e0 | 2017-09-13 19:57:31 -0700 | [diff] [blame] | 125 | struct sap_context { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 126 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 127 | /* 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 Sirasanagandla | 327f9b6 | 2018-09-10 19:13:35 +0530 | [diff] [blame] | 134 | /* vdev object corresponding to sessionId */ |
| 135 | struct wlan_objmgr_vdev *vdev; |
| 136 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 137 | /* Include the associations MAC addresses */ |
| 138 | uint8_t self_mac_addr[CDS_MAC_ADDRESS_LEN]; |
| 139 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 140 | /* Include the SME(CSR) context here */ |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 141 | struct csr_roam_profile csr_roamProfile; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 142 | uint32_t csr_roamId; |
| 143 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 144 | /* SAP event Callback to hdd */ |
| 145 | tpWLAN_SAPEventCB pfnSapEventCallback; |
| 146 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 147 | /* |
| 148 | * Include the state machine structure here, state var that keeps |
| 149 | * track of state machine |
| 150 | */ |
Rajeev Kumar Sirasanagandla | 301aacb | 2018-08-07 15:48:18 +0530 | [diff] [blame] | 151 | enum sap_fsm_state fsm_state; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 152 | |
| 153 | /* Actual storage for AP and self (STA) SSID */ |
| 154 | tCsrSSIDInfo SSIDList[2]; |
| 155 | |
| 156 | /* Actual storage for AP bssid */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 157 | struct qdf_mac_addr bssid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 158 | |
| 159 | /* Mac filtering settings */ |
| 160 | eSapMacAddrACL eSapMacAddrAclMode; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 161 | struct qdf_mac_addr acceptMacList[MAX_ACL_MAC_ADDRESS]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 162 | uint8_t nAcceptMac; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 163 | struct qdf_mac_addr denyMacList[MAX_ACL_MAC_ADDRESS]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 164 | 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 Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 173 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 174 | uint8_t *channelList; |
Liangwei Dong | aef8434 | 2016-10-21 05:28:00 -0400 | [diff] [blame] | 175 | uint8_t num_of_channel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 176 | uint16_t ch_width_orig; |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 177 | struct ch_params ch_params; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 178 | |
gaolez | e510894 | 2017-03-31 16:56:42 +0800 | [diff] [blame] | 179 | uint32_t auto_channel_select_weight; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 180 | 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 Hsu | 4252a2f | 2016-01-05 11:18:24 -0800 | [diff] [blame] | 188 | #if defined(FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 189 | 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 Chandrasekaran | 9e8c7be | 2016-08-03 14:57:14 +0530 | [diff] [blame] | 217 | bool is_pre_cac_on; |
| 218 | bool pre_cac_complete; |
Himanshu Agarwal | dfc4dca | 2017-08-29 19:49:05 +0530 | [diff] [blame] | 219 | bool vendor_acs_dfs_lte_enabled; |
Kapil Gupta | 8878ad9 | 2017-02-13 11:56:04 +0530 | [diff] [blame] | 220 | uint8_t dfs_vendor_channel; |
| 221 | uint8_t dfs_vendor_chan_bw; |
Manishekar Chandrasekaran | 9e8c7be | 2016-08-03 14:57:14 +0530 | [diff] [blame] | 222 | uint8_t chan_before_pre_cac; |
Jiachao Wu | 712d4fd | 2017-08-23 16:52:34 +0800 | [diff] [blame] | 223 | uint16_t beacon_tx_rate; |
Agrawal Ashish | 6563461 | 2016-08-18 13:24:32 +0530 | [diff] [blame] | 224 | enum sap_acs_dfs_mode dfs_mode; |
Sandeep Puligilla | 0806e0f | 2017-03-06 19:25:47 -0800 | [diff] [blame] | 225 | wlan_scan_requester req_id; |
bings | 2972471 | 2017-03-15 01:40:50 +0800 | [diff] [blame] | 226 | uint8_t sap_sta_id; |
Arif Hussain | 759a023 | 2017-03-20 13:17:18 -0700 | [diff] [blame] | 227 | bool dfs_cac_offload; |
Sandeep Puligilla | 20aa0c7 | 2017-10-30 12:24:06 -0700 | [diff] [blame] | 228 | bool is_chan_change_inprogress; |
Jeff Johnson | d0337e0 | 2017-09-13 19:57:31 -0700 | [diff] [blame] | 229 | }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 230 | |
| 231 | /*---------------------------------------------------------------------------- |
| 232 | * External declarations for global context |
| 233 | * -------------------------------------------------------------------------*/ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 234 | |
| 235 | /*---------------------------------------------------------------------------- |
| 236 | * SAP state machine event definition |
| 237 | * -------------------------------------------------------------------------*/ |
| 238 | /* The event structure */ |
| 239 | typedef 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 Johnson | 6a18c96 | 2018-07-01 09:09:37 -0700 | [diff] [blame] | 244 | /* introduced to handle csr_roam_complete_cb roamStatus */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 245 | uint32_t u1; |
Jeff Johnson | 6a18c96 | 2018-07-01 09:09:37 -0700 | [diff] [blame] | 246 | /* introduced to handle csr_roam_complete_cb roamResult */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 247 | uint32_t u2; |
| 248 | } tWLAN_SAPEvent, *ptWLAN_SAPEvent; |
| 249 | |
| 250 | /*---------------------------------------------------------------------------- |
| 251 | * Function Declarations and Documentation |
| 252 | * -------------------------------------------------------------------------*/ |
Jeff Johnson | 03d1e2c | 2018-10-31 08:32:02 -0700 | [diff] [blame] | 253 | |
| 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 | */ |
| 260 | static inline struct mac_context *sap_get_mac_context(void) |
| 261 | { |
| 262 | return cds_get_context(QDF_MODULE_ID_PE); |
| 263 | } |
| 264 | |
Jeff Johnson | f1cd3c7 | 2017-09-14 07:18:06 -0700 | [diff] [blame] | 265 | QDF_STATUS wlansap_context_get(struct sap_context *ctx); |
| 266 | void wlansap_context_put(struct sap_context *ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 267 | |
Jeff Johnson | ffa3876 | 2017-09-25 18:14:47 -0700 | [diff] [blame] | 268 | /** |
Jeff Johnson | 164b3bb | 2017-09-25 19:34:14 -0700 | [diff] [blame] | 269 | * wlansap_pre_start_bss_acs_scan_callback() - callback for scan results |
Jeff Johnson | 793e5a9 | 2018-11-08 07:57:04 -0800 | [diff] [blame] | 270 | * @mac_handle: the mac_handle passed in with the scan request |
Jeff Johnson | 164b3bb | 2017-09-25 19:34:14 -0700 | [diff] [blame] | 271 | * @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 Johnson | 793e5a9 | 2018-11-08 07:57:04 -0800 | [diff] [blame] | 281 | QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(mac_handle_t mac_handle, |
Jeff Johnson | 164b3bb | 2017-09-25 19:34:14 -0700 | [diff] [blame] | 282 | struct sap_context *sap_ctx, |
| 283 | uint8_t sessionid, |
| 284 | uint32_t scanid, |
| 285 | eCsrScanStatus scan_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 286 | |
Jeff Johnson | f1cd3c7 | 2017-09-14 07:18:06 -0700 | [diff] [blame] | 287 | QDF_STATUS SapFsm(struct sap_context *sapContext, ptWLAN_SAPEvent sapEvent, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 288 | uint8_t *status); |
| 289 | |
Jeff Johnson | 7730fbb | 2018-11-08 13:48:27 -0800 | [diff] [blame] | 290 | uint8_t sap_select_channel(mac_handle_t mac_handle, struct sap_context *sap_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 291 | tScanResultHandle pScanResult); |
| 292 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 293 | QDF_STATUS |
Jeff Johnson | f1cd3c7 | 2017-09-14 07:18:06 -0700 | [diff] [blame] | 294 | sap_signal_hdd_event(struct sap_context *sapContext, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 295 | struct csr_roam_info *pCsrRoamInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 296 | eSapHddEvent sapHddevent, void *); |
| 297 | |
Jeff Johnson | f1cd3c7 | 2017-09-14 07:18:06 -0700 | [diff] [blame] | 298 | QDF_STATUS sap_fsm(struct sap_context *sapContext, ptWLAN_SAPEvent sapEvent); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 299 | |
| 300 | eSapStatus |
Jeff Johnson | e4c11db | 2018-05-05 23:22:32 -0700 | [diff] [blame] | 301 | sapconvert_to_csr_profile(tsap_config_t *pconfig_params, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 302 | eCsrRoamBssType bssType, |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 303 | struct csr_roam_profile *profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 304 | |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 305 | void sap_free_roam_profile(struct csr_roam_profile *profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 306 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 307 | QDF_STATUS |
Jeff Johnson | f1cd3c7 | 2017-09-14 07:18:06 -0700 | [diff] [blame] | 308 | sap_is_peer_mac_allowed(struct sap_context *sapContext, uint8_t *peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 309 | |
| 310 | void |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 311 | sap_sort_mac_list(struct qdf_mac_addr *macList, uint8_t size); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 312 | |
| 313 | void |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 314 | sap_add_mac_to_acl(struct qdf_mac_addr *macList, uint8_t *size, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 315 | uint8_t *peerMac); |
| 316 | |
| 317 | void |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 318 | sap_remove_mac_from_acl(struct qdf_mac_addr *macList, uint8_t *size, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 319 | uint8_t index); |
| 320 | |
| 321 | void |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 322 | sap_print_acl(struct qdf_mac_addr *macList, uint8_t size); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 323 | |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 324 | bool |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 325 | sap_search_mac_list(struct qdf_mac_addr *macList, uint8_t num_mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 326 | uint8_t *peerMac, uint8_t *index); |
| 327 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 328 | #ifdef FEATURE_WLAN_CH_AVOID |
Jeff Johnson | 7730fbb | 2018-11-08 13:48:27 -0800 | [diff] [blame] | 329 | void sap_update_unsafe_channel_list(mac_handle_t mac_handle, |
Jeff Johnson | e13d806 | 2017-09-28 06:54:55 -0700 | [diff] [blame] | 330 | struct sap_context *sap_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 331 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 332 | |
Jeff Johnson | f1cd3c7 | 2017-09-14 07:18:06 -0700 | [diff] [blame] | 333 | QDF_STATUS sap_init_dfs_channel_nol_list(struct sap_context *sapContext); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 334 | |
Jeff Johnson | f1cd3c7 | 2017-09-14 07:18:06 -0700 | [diff] [blame] | 335 | bool sap_dfs_is_channel_in_nol_list(struct sap_context *sapContext, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 336 | uint8_t channelNumber, |
| 337 | ePhyChanBondState chanBondState); |
| 338 | void sap_dfs_cac_timer_callback(void *data); |
| 339 | |
Jeff Johnson | 19681ce | 2018-11-08 06:59:00 -0800 | [diff] [blame] | 340 | /** |
| 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 | */ |
| 347 | void sap_cac_reset_notify(mac_handle_t mac_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 348 | |
Jeff Johnson | 19681ce | 2018-11-08 06:59:00 -0800 | [diff] [blame] | 349 | bool is_concurrent_sap_ready_for_channel_change(mac_handle_t mac_handle, |
Jeff Johnson | f1cd3c7 | 2017-09-14 07:18:06 -0700 | [diff] [blame] | 350 | struct sap_context *sapContext); |
Jeff Johnson | 15f7829 | 2018-11-09 13:24:05 -0800 | [diff] [blame] | 351 | |
| 352 | bool sap_is_conc_sap_doing_scc_dfs(mac_handle_t mac_handle, |
Krunal Soni | e8324ce | 2017-09-25 10:16:56 -0700 | [diff] [blame] | 353 | struct sap_context *given_sapctx); |
Jeff Johnson | 15f7829 | 2018-11-09 13:24:05 -0800 | [diff] [blame] | 354 | |
Jeff Johnson | 19681ce | 2018-11-08 06:59:00 -0800 | [diff] [blame] | 355 | uint8_t sap_get_total_number_sap_intf(mac_handle_t mac_handle); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 356 | |
Jeff Johnson | 19681ce | 2018-11-08 06:59:00 -0800 | [diff] [blame] | 357 | /** |
Abhishek Singh | 53791fa | 2018-06-14 14:02:50 +0530 | [diff] [blame] | 358 | * 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 | */ |
| 365 | QDF_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 | */ |
| 378 | QDF_STATUS |
| 379 | sap_validate_chan(struct sap_context *sap_context, |
| 380 | bool pre_start_bss, |
| 381 | bool check_for_connection_update); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 382 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 383 | /** |
| 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 | */ |
| 396 | bool |
Jeff Johnson | f1cd3c7 | 2017-09-14 07:18:06 -0700 | [diff] [blame] | 397 | sap_check_in_avoid_ch_list(struct sap_context *sap_ctx, uint8_t channel); |
Jeff Johnson | 15f7829 | 2018-11-09 13:24:05 -0800 | [diff] [blame] | 398 | |
Kapil Gupta | 94ca6f6 | 2016-12-11 18:43:12 +0530 | [diff] [blame] | 399 | /** |
Krunal Soni | b01de79 | 2017-04-14 11:44:39 -0700 | [diff] [blame] | 400 | * sap_set_session_param() - set sap related param to sap context and global var |
Jeff Johnson | 15f7829 | 2018-11-09 13:24:05 -0800 | [diff] [blame] | 401 | * @mac_handle: Opaque handle to the global MAC context |
Krunal Soni | b01de79 | 2017-04-14 11:44:39 -0700 | [diff] [blame] | 402 | * @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 Johnson | 15f7829 | 2018-11-09 13:24:05 -0800 | [diff] [blame] | 409 | QDF_STATUS sap_set_session_param(mac_handle_t mac_handle, |
| 410 | struct sap_context *sapctx, |
| 411 | uint32_t session_id); |
| 412 | |
Krunal Soni | b01de79 | 2017-04-14 11:44:39 -0700 | [diff] [blame] | 413 | /** |
| 414 | * sap_clear_session_param() - clear sap related param from sap context |
Jeff Johnson | 15f7829 | 2018-11-09 13:24:05 -0800 | [diff] [blame] | 415 | * @mac_handle: Opaque handle to the global MAC context |
Krunal Soni | b01de79 | 2017-04-14 11:44:39 -0700 | [diff] [blame] | 416 | * @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 Johnson | 15f7829 | 2018-11-09 13:24:05 -0800 | [diff] [blame] | 423 | QDF_STATUS sap_clear_session_param(mac_handle_t mac_handle, |
| 424 | struct sap_context *sapctx, |
| 425 | uint32_t session_id); |
Kapil Gupta | 94ca6f6 | 2016-12-11 18:43:12 +0530 | [diff] [blame] | 426 | |
Sandeep Puligilla | 0806e0f | 2017-03-06 19:25:47 -0800 | [diff] [blame] | 427 | void sap_scan_event_callback(struct wlan_objmgr_vdev *vdev, |
| 428 | struct scan_event *event, void *arg); |
| 429 | |
Wen Gong | bf560c8 | 2018-05-09 15:44:35 +0800 | [diff] [blame] | 430 | #ifdef DFS_COMPONENT_ENABLE |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 431 | /** |
| 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 Johnson | f1cd3c7 | 2017-09-14 07:18:06 -0700 | [diff] [blame] | 439 | uint8_t sap_indicate_radar(struct sap_context *sap_ctx); |
Wen Gong | bf560c8 | 2018-05-09 15:44:35 +0800 | [diff] [blame] | 440 | #else |
| 441 | static inline uint8_t sap_indicate_radar(struct sap_context *sap_ctx) |
| 442 | { |
| 443 | return 0; |
| 444 | } |
| 445 | #endif |
Arif Hussain | cd15163 | 2017-02-11 16:57:19 -0800 | [diff] [blame] | 446 | |
wadesong | 1795e14 | 2018-01-05 11:13:07 +0800 | [diff] [blame] | 447 | /** |
| 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 | */ |
| 457 | uint8_t sap_select_default_oper_chan(struct sap_acs_cfg *acs_cfg); |
| 458 | |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 459 | /* |
| 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 |
| 466 | static inline bool sap_is_dfs_cac_wait_state(struct sap_context *sap_ctx) |
| 467 | { |
| 468 | if (!sap_ctx) |
| 469 | return false; |
| 470 | |
Abhishek Singh | d5cf22d | 2019-01-08 19:51:09 +0530 | [diff] [blame^] | 471 | return QDF_IS_STATUS_SUCCESS(wlan_vdev_is_dfs_cac_wait(sap_ctx->vdev)); |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 472 | } |
| 473 | #else |
| 474 | static 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 Bhattacharyya | 691680e | 2018-01-23 20:50:06 -0800 | [diff] [blame] | 483 | /** |
| 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 | */ |
| 494 | uint8_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 Sirasanagandla | 327f9b6 | 2018-09-10 19:13:35 +0530 | [diff] [blame] | 498 | /** |
Liangwei Dong | 3fb0016 | 2018-09-28 04:16:03 -0400 | [diff] [blame] | 499 | * 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 | */ |
| 508 | bool |
| 509 | sap_chan_bond_dfs_sub_chan(struct sap_context *sap_context, |
| 510 | uint8_t channel_number, |
| 511 | ePhyChanBondState bond_state); |
| 512 | |
| 513 | /** |
Rajeev Kumar Sirasanagandla | 327f9b6 | 2018-09-10 19:13:35 +0530 | [diff] [blame] | 514 | * 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 Johnson | c59ef8b | 2018-12-02 12:01:21 -0800 | [diff] [blame] | 525 | QDF_STATUS sap_acquire_vdev_ref(struct mac_context *mac, |
Rajeev Kumar Sirasanagandla | 327f9b6 | 2018-09-10 19:13:35 +0530 | [diff] [blame] | 526 | 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 | */ |
| 535 | void sap_release_vdev_ref(struct sap_context *sap_ctx); |
| 536 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 537 | #ifdef __cplusplus |
| 538 | } |
| 539 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 540 | #endif |