1 /** @file mlan_11h.h 2 * 3 * @brief This header file contains data structures and 4 * function declarations of 802.11h 5 * 6 * Copyright (C) 2008-2017, Marvell International Ltd. 7 * 8 * This software file (the "File") is distributed by Marvell International 9 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 10 * (the "License"). You may use, redistribute and/or modify this File in 11 * accordance with the terms and conditions of the License, a copy of which 12 * is available by writing to the Free Software Foundation, Inc., 13 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the 14 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 15 * 16 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE 18 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about 19 * this warranty disclaimer. 20 * 21 */ 22 23 /************************************************************* 24 Change Log: 25 03/26/2009: initial creation 26 *************************************************************/ 27 28 #ifndef _MLAN_11H_ 29 #define _MLAN_11H_ 30 31 /** 11H OID bitmasks */ 32 #define ENABLE_11H_MASK MBIT(0) 33 #define MASTER_RADAR_DET_MASK MBIT(1) 34 #define SLAVE_RADAR_DET_MASK MBIT(2) 35 36 /** DFS Master Radar Detect global enable */ 37 #define DFS_MASTER_RADAR_DETECT_EN (MTRUE) 38 /** DFS Slave Radar Detect global enable */ 39 #define DFS_SLAVE_RADAR_DETECT_EN (MFALSE) 40 41 #define CHANNEL_OFFSET_MASK 0x30 42 #define CHANNEL_BANDWIDTH_MASK 0x0C 43 44 /** 45 * 11H APIs 46 */ 47 48 /* Is master radar detection enabled in firmware? */ 49 extern t_bool wlan_11h_is_master_radar_det_active(mlan_private *priv); 50 51 /** Configure master radar detection. 52 * Need call wlan_11h_check_update_radar_det_state() after. 53 */ 54 extern mlan_status wlan_11h_config_master_radar_det(mlan_private *priv, 55 t_bool enable); 56 57 /** Configure slave radar detection. 58 * Need call wlan_11h_check_update_radar_det_state() after. 59 */ 60 extern mlan_status wlan_11h_config_slave_radar_det(mlan_private *priv, 61 t_bool enable); 62 63 /** Checks all interfaces and updates radar detect flags if necessary */ 64 extern mlan_status wlan_11h_check_update_radar_det_state(mlan_private *pmpriv); 65 66 /** Return 1 if 11h is active in the firmware, 0 if it is inactive */ 67 extern t_bool wlan_11h_is_active(mlan_private *priv); 68 69 /** Enable the tx interface and record the new transmit state */ 70 extern void wlan_11h_tx_enable(mlan_private *priv); 71 72 /** Disable the tx interface and record the new transmit state */ 73 extern void wlan_11h_tx_disable(mlan_private *priv); 74 75 /** Activate 11h extensions in the firmware */ 76 extern mlan_status wlan_11h_activate(mlan_private *priv, t_void *pioctl_buf, 77 t_bool flag); 78 79 /** Initialize the 11h device structure */ 80 extern void wlan_11h_init(mlan_adapter *pmadapter); 81 82 /** Cleanup for the 11h device structure */ 83 extern void wlan_11h_cleanup(mlan_adapter *pmadapter); 84 85 /** Initialize the 11h interface structure */ 86 extern void wlan_11h_priv_init(mlan_private *pmpriv); 87 88 /** Get an initial random channel to start an adhoc network on */ 89 extern t_u8 wlan_11h_get_adhoc_start_channel(mlan_private *priv); 90 91 /** Get channel that has been closed via Channel Switch Announcement */ 92 extern t_u8 wlan_11h_get_csa_closed_channel(mlan_private *priv); 93 94 /** Check if radar detection is required on the specified channel */ 95 extern t_bool wlan_11h_radar_detect_required(mlan_private *priv, t_u8 channel); 96 97 /** Perform a standard availibility check on the specified channel */ 98 extern t_s32 wlan_11h_issue_radar_detect(mlan_private *priv, 99 pmlan_ioctl_req pioctl_req, 100 t_u8 channel, Band_Config_t bandcfg); 101 102 /** Check previously issued radar report for a channel */ 103 extern mlan_status wlan_11h_check_chan_report(mlan_private *priv, t_u8 chan); 104 105 /** Add any 11h TLVs necessary to complete an adhoc start command */ 106 extern t_s32 wlan_11h_process_start(mlan_private *priv, 107 t_u8 **ppbuffer, 108 IEEEtypes_CapInfo_t *pcap_info, 109 t_u32 channel, 110 wlan_11h_bss_info_t *p11h_bss_info); 111 112 /** Add any 11h TLVs necessary to complete a join command (adhoc or infra) */ 113 extern t_s32 wlan_11h_process_join(mlan_private *priv, 114 t_u8 **ppbuffer, 115 IEEEtypes_CapInfo_t *pcap_info, 116 t_u8 band, 117 t_u32 channel, 118 wlan_11h_bss_info_t *p11h_bss_info); 119 120 /** Complete the firmware command preparation for an 11h command function */ 121 extern mlan_status wlan_11h_cmd_process(mlan_private *priv, 122 HostCmd_DS_COMMAND *pcmd_ptr, 123 const t_void *pinfo_buf); 124 125 /** Process the response of an 11h firmware command */ 126 extern mlan_status wlan_11h_cmdresp_process(mlan_private *priv, 127 const HostCmd_DS_COMMAND *resp); 128 129 /** Receive IEs from scan processing and record any needed info for 11h */ 130 extern mlan_status wlan_11h_process_bss_elem(mlan_adapter *pmadapter, 131 wlan_11h_bss_info_t *p11h_bss_info, 132 const t_u8 *pelement); 133 134 /** Handler for EVENT_CHANNEL_SWITCH_ANN */ 135 extern mlan_status wlan_11h_handle_event_chanswann(mlan_private *priv); 136 137 /** Handler for EVENT_CHANNEL_REPORT_RDY */ 138 extern mlan_status wlan_11h_handle_event_chanrpt_ready(mlan_private *priv, 139 mlan_event *pevent); 140 141 #ifdef DFS_TESTING_SUPPORT 142 /** Handler for DFS_TESTING IOCTL */ 143 extern mlan_status wlan_11h_ioctl_dfs_testing(pmlan_adapter pmadapter, 144 pmlan_ioctl_req pioctl_req); 145 extern mlan_status wlan_11h_ioctl_get_channel_nop_info(pmlan_adapter pmadapter, 146 pmlan_ioctl_req 147 pioctl_req); 148 #endif 149 150 extern mlan_status 151 152 wlan_11h_ioctl_dfs_cancel_chan_report(mlan_private *priv, 153 pmlan_ioctl_req pioctl_req); 154 extern 155 mlan_status wlan_11h_ioctl_chan_switch_count(pmlan_adapter pmadapter, 156 pmlan_ioctl_req pioctl_req); 157 158 /** Check if channel is under a NOP duration (should not be used) */ 159 extern t_bool wlan_11h_is_channel_under_nop(mlan_adapter *pmadapter, 160 t_u8 channel); 161 162 /** Check if RADAR_DETECTED handling is blocking data tx */ 163 extern t_bool wlan_11h_radar_detected_tx_blocked(mlan_adapter *pmadapter); 164 165 /** Callback for RADAR_DETECTED (for UAP cmdresp) */ 166 extern mlan_status wlan_11h_radar_detected_callback(t_void *priv); 167 168 /** BW_change event Handler for dfs_repeater */ 169 void wlan_dfs_rep_bw_change(mlan_adapter *pmadapter); 170 171 /** disconnect event Handler for dfs_repeater */ 172 void wlan_dfs_rep_disconnect(mlan_adapter *pmadapter); 173 174 /** Handler for RADAR_DETECTED */ 175 extern mlan_status wlan_11h_radar_detected_handling(mlan_adapter *pmadapter, 176 mlan_private *priv); 177 /** DFS Event pre-processing */ 178 extern mlan_status wlan_11h_dfs_event_preprocessing(mlan_adapter *pmadapter); 179 180 /** DFS switch to non-DFS channel */ 181 extern mlan_status wlan_11h_switch_non_dfs_chan(mlan_private *priv, t_u8 *chan); 182 183 extern void wlan_11h_update_bandcfg(IN Band_Config_t *uap_band_cfg, 184 IN t_u8 new_channel); 185 186 /** function checks if interface is active. **/ 187 extern t_bool wlan_is_intf_active(mlan_private *pmpriv); 188 189 #endif /*_MLAN_11H_ */ 190