blob: 2c529b5c8b379619a5ef4ffbae9f19915b253485 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Min Liu2fef5792018-01-19 17:59:42 +08002 * Copyright (c) 2013-2018 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#if !defined(WLAN_HDD_HOSTAPD_H)
29#define WLAN_HDD_HOSTAPD_H
30
31/**
32 * DOC: wlan_hdd_hostapd.h
33 *
34 * WLAN Host Device driver hostapd header file
35 */
36
37/* Include files */
38
39#include <linux/netdevice.h>
40#include <linux/skbuff.h>
Anurag Chouhanffb21542016-02-17 14:33:03 +053041#include <qdf_list.h>
Anurag Chouhan6d760662016-02-20 16:05:43 +053042#include <qdf_types.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080043#include <wlan_hdd_main.h>
44
45/* Preprocessor definitions and constants */
46
47/* max length of command string in hostapd ioctl */
48#define HOSTAPD_IOCTL_COMMAND_STRLEN_MAX 8192
49
Jeff Johnson23c3b842017-09-03 09:05:29 -070050struct hdd_adapter *hdd_wlan_create_ap_dev(struct hdd_context *hdd_ctx,
Ryan Hsu07495ea2016-01-21 15:25:39 -080051 tSirMacAddr macAddr,
52 unsigned char name_assign_type,
53 uint8_t *name);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080054
Jeff Johnsonfd33cce2017-10-02 13:28:39 -070055QDF_STATUS hdd_unregister_hostapd(struct hdd_adapter *adapter, bool rtnl_held);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080056
57eCsrAuthType
58hdd_translate_rsn_to_csr_auth_type(uint8_t auth_suite[4]);
59
Abhishek Singh1bdb1572015-10-16 16:24:19 +053060int hdd_softap_set_channel_change(struct net_device *dev,
Kiran Kumar Lokere13644672016-02-29 15:40:10 -080061 int target_channel,
Min Liu2fef5792018-01-19 17:59:42 +080062 enum phy_ch_width target_bw,
63 bool forced);
Abhishek Singh1bdb1572015-10-16 16:24:19 +053064
Chandrasekaran Manishekarcde33d72016-04-14 19:03:39 +053065#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
Jeff Johnson866aca82017-09-10 15:27:20 -070066void hdd_sap_restart_with_channel_switch(struct hdd_adapter *adapter,
Chandrasekaran Manishekarcde33d72016-04-14 19:03:39 +053067 uint32_t target_channel,
Min Liu2fef5792018-01-19 17:59:42 +080068 uint32_t target_bw,
69 bool forced);
Archana Ramachandranea34c4f2017-03-19 18:56:18 -070070/**
Jeff Johnson23812942017-10-06 11:33:55 -070071 * hdd_sap_restart_chan_switch_cb() - Function to restart SAP with
Archana Ramachandranea34c4f2017-03-19 18:56:18 -070072 * a different channel
73 * @psoc: PSOC object information
74 * @vdev_id: vdev id
75 * @channel: channel to switch
Min Liu2fef5792018-01-19 17:59:42 +080076 * @forced: Force to switch channel, ignore SCC/MCC check
Archana Ramachandranea34c4f2017-03-19 18:56:18 -070077 *
78 * This function restarts SAP with a different channel
79 *
80 * Return: None
81 *
82 */
Jeff Johnson23812942017-10-06 11:33:55 -070083void hdd_sap_restart_chan_switch_cb(struct wlan_objmgr_psoc *psoc,
84 uint8_t vdev_id, uint32_t channel,
Min Liu2fef5792018-01-19 17:59:42 +080085 uint32_t channel_bw,
86 bool forced);
Archana Ramachandranea34c4f2017-03-19 18:56:18 -070087/**
88 * wlan_hdd_get_channel_for_sap_restart() - Function to get
89 * suitable channel and restart SAP
90 * @psoc: PSOC object information
91 * @vdev_id: vdev id
92 * @channel: channel to be returned
93 * @sec_ch: secondary channel to be returned
Archana Ramachandranea34c4f2017-03-19 18:56:18 -070094 *
95 * This function gets the channel parameters to restart SAP
96 *
97 * Return: None
98 *
99 */
100QDF_STATUS wlan_hdd_get_channel_for_sap_restart(
101 struct wlan_objmgr_psoc *psoc,
102 uint8_t vdev_id, uint8_t *channel,
Ajit Pal Singh9b0ebdb2017-06-08 11:26:43 +0530103 uint8_t *sec_ch);
Chandrasekaran Manishekarcde33d72016-04-14 19:03:39 +0530104#endif
105
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800106eCsrEncryptionType
107hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]);
108
109eCsrEncryptionType
110hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]);
111
112eCsrAuthType
113hdd_translate_wpa_to_csr_auth_type(uint8_t auth_suite[4]);
114
115eCsrEncryptionType
116hdd_translate_wpa_to_csr_encryption_type(uint8_t cipher_suite[4]);
117
Jeff Johnson866aca82017-09-10 15:27:20 -0700118QDF_STATUS hdd_softap_sta_deauth(struct hdd_adapter *adapter,
Jeff Johnsone6bf7192017-11-07 15:16:09 -0800119 struct csr_del_sta_params *pDelStaParams);
Jeff Johnson866aca82017-09-10 15:27:20 -0700120void hdd_softap_sta_disassoc(struct hdd_adapter *adapter,
Jeff Johnsone6bf7192017-11-07 15:16:09 -0800121 struct csr_del_sta_params *pDelStaParams);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800122int hdd_softap_unpack_ie(tHalHandle halHandle,
123 eCsrEncryptionType *pEncryptType,
124 eCsrEncryptionType *mcEncryptType,
125 eCsrAuthType *pAuthType,
126 bool *pMFPCapable,
127 bool *pMFPRequired,
128 uint16_t gen_ie_len, uint8_t *gen_ie);
129
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530130QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800131 void *usrDataForCallback);
Krunal Soni4a020c72017-10-30 20:58:40 -0700132/**
133 * hdd_init_ap_mode() - to init the AP adaptor
134 * @adapter: SAP/GO adapter
135 * @rtnl_held: flag to indicate if RTNL lock needs to be aquired
136 *
137 * This API can be called to open the SAP session as well as
138 * to create and store the vdev object. It also initializes necessary
139 * SAP adapter related params.
140 */
Jeff Johnsonfd33cce2017-10-02 13:28:39 -0700141QDF_STATUS hdd_init_ap_mode(struct hdd_adapter *adapter, bool reinit);
Krunal Soni4a020c72017-10-30 20:58:40 -0700142/**
143 * hdd_deinit_ap_mode() - to deinit the AP adaptor
144 * @hdd_ctx: pointer to hdd_ctx
145 * @adapter: SAP/GO adapter
146 * @rtnl_held: flag to indicate if RTNL lock needs to be aquired
147 *
148 * This API can be called to close the SAP session as well as
149 * release the vdev object completely. It also deinitializes necessary
150 * SAP adapter related params.
151 */
152void hdd_deinit_ap_mode(struct hdd_context *hdd_ctx,
Krunal Sonib51eec72017-11-20 21:53:01 -0800153 struct hdd_adapter *adapter, bool rtnl_held);
Jeff Johnson15712092017-10-28 12:02:53 -0700154void hdd_set_ap_ops(struct net_device *dev);
Krunal Soni59437652017-11-21 13:42:14 -0800155/**
156 * hdd_sap_create_ctx() - Wrapper API to create SAP context
157 * @adapter: pointer to adapter
158 *
159 * This wrapper API can be called to create the sap context. It will
160 * eventually calls SAP API to create the sap context
161 *
162 * Return: true or false based on overall success or failure
163 */
164bool hdd_sap_create_ctx(struct hdd_adapter *adapter);
165/**
166 * hdd_sap_destroy_ctx() - Wrapper API to destroy SAP context
167 * @adapter: pointer to adapter
168 *
169 * This wrapper API can be called to destroy the sap context. It will
170 * eventually calls SAP API to destroy the sap context
171 *
172 * Return: true or false based on overall success or failure
173 */
174bool hdd_sap_destroy_ctx(struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800175int hdd_hostapd_stop(struct net_device *dev);
Jeff Johnsonc54bbf92017-08-28 11:59:35 -0700176int hdd_sap_context_init(struct hdd_context *hdd_ctx);
177void hdd_sap_context_destroy(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800178#ifdef QCA_HT_2040_COEX
Jeff Johnson9c4f93d2017-10-04 08:56:22 -0700179QDF_STATUS hdd_set_sap_ht2040_mode(struct hdd_adapter *adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800180 uint8_t channel_type);
181#endif
182
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800183int wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
184 struct net_device *dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800185
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800186int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
187 struct net_device *dev,
188 struct cfg80211_ap_settings *params);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800189
190int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy,
191 struct net_device *dev,
192 struct cfg80211_beacon_data *params);
193
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +0530194/**
195 * hdd_is_peer_associated - is peer connected to softap
196 * @adapter: pointer to softap adapter
197 * @mac_addr: address to check in peer list
198 *
199 * This function has to be invoked only when bss is started and is used
200 * to check whether station with specified addr is peer or not
201 *
202 * Return: true if peer mac, else false
203 */
204bool hdd_is_peer_associated(struct hdd_adapter *adapter,
205 struct qdf_mac_addr *mac_addr);
206
Jeff Johnson866aca82017-09-10 15:27:20 -0700207int hdd_destroy_acs_timer(struct hdd_adapter *adapter);
Kapil Guptac1224bf2017-06-22 21:22:40 +0530208
Jeff Johnson23812942017-10-06 11:33:55 -0700209QDF_STATUS wlan_hdd_config_acs(struct hdd_context *hdd_ctx,
210 struct hdd_adapter *adapter);
211
Jeff Johnson866aca82017-09-10 15:27:20 -0700212void hdd_sap_indicate_disconnect_for_sta(struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800213#endif /* end #if !defined(WLAN_HDD_HOSTAPD_H) */