Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Min Liu | 2fef579 | 2018-01-19 17:59:42 +0800 | [diff] [blame] | 2 | * Copyright (c) 2013-2018 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 | #if !defined(WLAN_HDD_HOSTAPD_H) |
| 20 | #define WLAN_HDD_HOSTAPD_H |
| 21 | |
| 22 | /** |
| 23 | * DOC: wlan_hdd_hostapd.h |
| 24 | * |
| 25 | * WLAN Host Device driver hostapd header file |
| 26 | */ |
| 27 | |
| 28 | /* Include files */ |
| 29 | |
| 30 | #include <linux/netdevice.h> |
| 31 | #include <linux/skbuff.h> |
Anurag Chouhan | ffb2154 | 2016-02-17 14:33:03 +0530 | [diff] [blame] | 32 | #include <qdf_list.h> |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 33 | #include <qdf_types.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 34 | #include <wlan_hdd_main.h> |
| 35 | |
| 36 | /* Preprocessor definitions and constants */ |
| 37 | |
| 38 | /* max length of command string in hostapd ioctl */ |
| 39 | #define HOSTAPD_IOCTL_COMMAND_STRLEN_MAX 8192 |
| 40 | |
Jeff Johnson | 23c3b84 | 2017-09-03 09:05:29 -0700 | [diff] [blame] | 41 | struct hdd_adapter *hdd_wlan_create_ap_dev(struct hdd_context *hdd_ctx, |
Ryan Hsu | 07495ea | 2016-01-21 15:25:39 -0800 | [diff] [blame] | 42 | tSirMacAddr macAddr, |
| 43 | unsigned char name_assign_type, |
| 44 | uint8_t *name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 45 | |
Jeff Johnson | fd33cce | 2017-10-02 13:28:39 -0700 | [diff] [blame] | 46 | QDF_STATUS hdd_unregister_hostapd(struct hdd_adapter *adapter, bool rtnl_held); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 47 | |
| 48 | eCsrAuthType |
| 49 | hdd_translate_rsn_to_csr_auth_type(uint8_t auth_suite[4]); |
| 50 | |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 51 | int hdd_softap_set_channel_change(struct net_device *dev, |
Kiran Kumar Lokere | 1364467 | 2016-02-29 15:40:10 -0800 | [diff] [blame] | 52 | int target_channel, |
Min Liu | 2fef579 | 2018-01-19 17:59:42 +0800 | [diff] [blame] | 53 | enum phy_ch_width target_bw, |
| 54 | bool forced); |
Abhishek Singh | 1bdb157 | 2015-10-16 16:24:19 +0530 | [diff] [blame] | 55 | |
Chandrasekaran Manishekar | cde33d7 | 2016-04-14 19:03:39 +0530 | [diff] [blame] | 56 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
Jeff Johnson | 866aca8 | 2017-09-10 15:27:20 -0700 | [diff] [blame] | 57 | void hdd_sap_restart_with_channel_switch(struct hdd_adapter *adapter, |
Chandrasekaran Manishekar | cde33d7 | 2016-04-14 19:03:39 +0530 | [diff] [blame] | 58 | uint32_t target_channel, |
Min Liu | 2fef579 | 2018-01-19 17:59:42 +0800 | [diff] [blame] | 59 | uint32_t target_bw, |
| 60 | bool forced); |
Archana Ramachandran | ea34c4f | 2017-03-19 18:56:18 -0700 | [diff] [blame] | 61 | /** |
Jeff Johnson | 2381294 | 2017-10-06 11:33:55 -0700 | [diff] [blame] | 62 | * hdd_sap_restart_chan_switch_cb() - Function to restart SAP with |
Archana Ramachandran | ea34c4f | 2017-03-19 18:56:18 -0700 | [diff] [blame] | 63 | * a different channel |
| 64 | * @psoc: PSOC object information |
| 65 | * @vdev_id: vdev id |
| 66 | * @channel: channel to switch |
Min Liu | 2fef579 | 2018-01-19 17:59:42 +0800 | [diff] [blame] | 67 | * @forced: Force to switch channel, ignore SCC/MCC check |
Archana Ramachandran | ea34c4f | 2017-03-19 18:56:18 -0700 | [diff] [blame] | 68 | * |
| 69 | * This function restarts SAP with a different channel |
| 70 | * |
| 71 | * Return: None |
| 72 | * |
| 73 | */ |
Jeff Johnson | 2381294 | 2017-10-06 11:33:55 -0700 | [diff] [blame] | 74 | void hdd_sap_restart_chan_switch_cb(struct wlan_objmgr_psoc *psoc, |
| 75 | uint8_t vdev_id, uint32_t channel, |
Min Liu | 2fef579 | 2018-01-19 17:59:42 +0800 | [diff] [blame] | 76 | uint32_t channel_bw, |
| 77 | bool forced); |
Archana Ramachandran | ea34c4f | 2017-03-19 18:56:18 -0700 | [diff] [blame] | 78 | /** |
| 79 | * wlan_hdd_get_channel_for_sap_restart() - Function to get |
| 80 | * suitable channel and restart SAP |
| 81 | * @psoc: PSOC object information |
| 82 | * @vdev_id: vdev id |
| 83 | * @channel: channel to be returned |
| 84 | * @sec_ch: secondary channel to be returned |
Archana Ramachandran | ea34c4f | 2017-03-19 18:56:18 -0700 | [diff] [blame] | 85 | * |
| 86 | * This function gets the channel parameters to restart SAP |
| 87 | * |
| 88 | * Return: None |
| 89 | * |
| 90 | */ |
| 91 | QDF_STATUS wlan_hdd_get_channel_for_sap_restart( |
| 92 | struct wlan_objmgr_psoc *psoc, |
| 93 | uint8_t vdev_id, uint8_t *channel, |
Ajit Pal Singh | 9b0ebdb | 2017-06-08 11:26:43 +0530 | [diff] [blame] | 94 | uint8_t *sec_ch); |
Chandrasekaran Manishekar | cde33d7 | 2016-04-14 19:03:39 +0530 | [diff] [blame] | 95 | #endif |
| 96 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 97 | eCsrEncryptionType |
| 98 | hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]); |
| 99 | |
| 100 | eCsrEncryptionType |
| 101 | hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]); |
| 102 | |
| 103 | eCsrAuthType |
| 104 | hdd_translate_wpa_to_csr_auth_type(uint8_t auth_suite[4]); |
| 105 | |
| 106 | eCsrEncryptionType |
| 107 | hdd_translate_wpa_to_csr_encryption_type(uint8_t cipher_suite[4]); |
| 108 | |
Jeff Johnson | 866aca8 | 2017-09-10 15:27:20 -0700 | [diff] [blame] | 109 | QDF_STATUS hdd_softap_sta_deauth(struct hdd_adapter *adapter, |
Jeff Johnson | e6bf719 | 2017-11-07 15:16:09 -0800 | [diff] [blame] | 110 | struct csr_del_sta_params *pDelStaParams); |
Jeff Johnson | 866aca8 | 2017-09-10 15:27:20 -0700 | [diff] [blame] | 111 | void hdd_softap_sta_disassoc(struct hdd_adapter *adapter, |
Jeff Johnson | e6bf719 | 2017-11-07 15:16:09 -0800 | [diff] [blame] | 112 | struct csr_del_sta_params *pDelStaParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 113 | int hdd_softap_unpack_ie(tHalHandle halHandle, |
| 114 | eCsrEncryptionType *pEncryptType, |
| 115 | eCsrEncryptionType *mcEncryptType, |
| 116 | eCsrAuthType *pAuthType, |
| 117 | bool *pMFPCapable, |
| 118 | bool *pMFPRequired, |
| 119 | uint16_t gen_ie_len, uint8_t *gen_ie); |
| 120 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 121 | QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, |
Jeff Johnson | 0604a36 | 2018-03-24 17:36:59 -0700 | [diff] [blame] | 122 | void *context); |
Krunal Soni | 4a020c7 | 2017-10-30 20:58:40 -0700 | [diff] [blame] | 123 | /** |
| 124 | * hdd_init_ap_mode() - to init the AP adaptor |
| 125 | * @adapter: SAP/GO adapter |
| 126 | * @rtnl_held: flag to indicate if RTNL lock needs to be aquired |
| 127 | * |
| 128 | * This API can be called to open the SAP session as well as |
| 129 | * to create and store the vdev object. It also initializes necessary |
| 130 | * SAP adapter related params. |
| 131 | */ |
Jeff Johnson | fd33cce | 2017-10-02 13:28:39 -0700 | [diff] [blame] | 132 | QDF_STATUS hdd_init_ap_mode(struct hdd_adapter *adapter, bool reinit); |
Krunal Soni | 4a020c7 | 2017-10-30 20:58:40 -0700 | [diff] [blame] | 133 | /** |
| 134 | * hdd_deinit_ap_mode() - to deinit the AP adaptor |
| 135 | * @hdd_ctx: pointer to hdd_ctx |
| 136 | * @adapter: SAP/GO adapter |
| 137 | * @rtnl_held: flag to indicate if RTNL lock needs to be aquired |
| 138 | * |
| 139 | * This API can be called to close the SAP session as well as |
| 140 | * release the vdev object completely. It also deinitializes necessary |
| 141 | * SAP adapter related params. |
| 142 | */ |
| 143 | void hdd_deinit_ap_mode(struct hdd_context *hdd_ctx, |
Krunal Soni | b51eec7 | 2017-11-20 21:53:01 -0800 | [diff] [blame] | 144 | struct hdd_adapter *adapter, bool rtnl_held); |
Jeff Johnson | 1571209 | 2017-10-28 12:02:53 -0700 | [diff] [blame] | 145 | void hdd_set_ap_ops(struct net_device *dev); |
Krunal Soni | 5943765 | 2017-11-21 13:42:14 -0800 | [diff] [blame] | 146 | /** |
| 147 | * hdd_sap_create_ctx() - Wrapper API to create SAP context |
| 148 | * @adapter: pointer to adapter |
| 149 | * |
| 150 | * This wrapper API can be called to create the sap context. It will |
| 151 | * eventually calls SAP API to create the sap context |
| 152 | * |
| 153 | * Return: true or false based on overall success or failure |
| 154 | */ |
| 155 | bool hdd_sap_create_ctx(struct hdd_adapter *adapter); |
| 156 | /** |
| 157 | * hdd_sap_destroy_ctx() - Wrapper API to destroy SAP context |
| 158 | * @adapter: pointer to adapter |
| 159 | * |
| 160 | * This wrapper API can be called to destroy the sap context. It will |
| 161 | * eventually calls SAP API to destroy the sap context |
| 162 | * |
| 163 | * Return: true or false based on overall success or failure |
| 164 | */ |
| 165 | bool hdd_sap_destroy_ctx(struct hdd_adapter *adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 166 | int hdd_hostapd_stop(struct net_device *dev); |
Jeff Johnson | c54bbf9 | 2017-08-28 11:59:35 -0700 | [diff] [blame] | 167 | int hdd_sap_context_init(struct hdd_context *hdd_ctx); |
| 168 | void hdd_sap_context_destroy(struct hdd_context *hdd_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 169 | #ifdef QCA_HT_2040_COEX |
Jeff Johnson | 9c4f93d | 2017-10-04 08:56:22 -0700 | [diff] [blame] | 170 | QDF_STATUS hdd_set_sap_ht2040_mode(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 171 | uint8_t channel_type); |
| 172 | #endif |
| 173 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 174 | int wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, |
| 175 | struct net_device *dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 176 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 177 | int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 178 | struct net_device *dev, |
| 179 | struct cfg80211_ap_settings *params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 180 | |
| 181 | int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
| 182 | struct net_device *dev, |
| 183 | struct cfg80211_beacon_data *params); |
| 184 | |
Rajeev Kumar Sirasanagandla | 996e529 | 2016-11-22 21:20:33 +0530 | [diff] [blame] | 185 | /** |
| 186 | * hdd_is_peer_associated - is peer connected to softap |
| 187 | * @adapter: pointer to softap adapter |
| 188 | * @mac_addr: address to check in peer list |
| 189 | * |
| 190 | * This function has to be invoked only when bss is started and is used |
| 191 | * to check whether station with specified addr is peer or not |
| 192 | * |
| 193 | * Return: true if peer mac, else false |
| 194 | */ |
| 195 | bool hdd_is_peer_associated(struct hdd_adapter *adapter, |
| 196 | struct qdf_mac_addr *mac_addr); |
| 197 | |
Jeff Johnson | 866aca8 | 2017-09-10 15:27:20 -0700 | [diff] [blame] | 198 | int hdd_destroy_acs_timer(struct hdd_adapter *adapter); |
Kapil Gupta | c1224bf | 2017-06-22 21:22:40 +0530 | [diff] [blame] | 199 | |
Jeff Johnson | 2381294 | 2017-10-06 11:33:55 -0700 | [diff] [blame] | 200 | QDF_STATUS wlan_hdd_config_acs(struct hdd_context *hdd_ctx, |
| 201 | struct hdd_adapter *adapter); |
| 202 | |
Jeff Johnson | 866aca8 | 2017-09-10 15:27:20 -0700 | [diff] [blame] | 203 | void hdd_sap_indicate_disconnect_for_sta(struct hdd_adapter *adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 204 | #endif /* end #if !defined(WLAN_HDD_HOSTAPD_H) */ |