1 /* 2 * Header for Linux cfg80211 scan 3 * 4 * Copyright (C) 2020, Broadcom. 5 * 6 * Unless you and Broadcom execute a separate written software license 7 * agreement governing use of this software, this software is licensed to you 8 * under the terms of the GNU General Public License version 2 (the "GPL"), 9 * available at http://www.broadcom.com/licenses/GPLv2.php, with the 10 * following added to such license: 11 * 12 * As a special exception, the copyright holders of this software give you 13 * permission to link this software with independent modules, and to copy and 14 * distribute the resulting executable under terms of your choice, provided that 15 * you also meet, for each linked independent module, the terms and conditions of 16 * the license of that module. An independent module is a module which is not 17 * derived from this software. The special exception does not apply to any 18 * modifications of the software. 19 * 20 * 21 * <<Broadcom-WL-IPTag/Dual:>> 22 */ 23 24 #ifndef _wl_cfgscan_h_ 25 #define _wl_cfgscan_h_ 26 27 #include <linux/wireless.h> 28 #include <typedefs.h> 29 #include <ethernet.h> 30 #include <wlioctl.h> 31 #include <linux/wireless.h> 32 #include <net/cfg80211.h> 33 #include <linux/rfkill.h> 34 #include <osl.h> 35 36 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)) 37 #define GET_SCAN_WDEV(scan_request) \ 38 (scan_request && scan_request->dev) ? scan_request->dev->ieee80211_ptr : NULL; 39 #else 40 #define GET_SCAN_WDEV(scan_request) \ 41 scan_request ? scan_request->wdev : NULL; 42 #endif 43 #ifdef WL_SCHED_SCAN 44 #define GET_SCHED_SCAN_WDEV(scan_request) \ 45 (scan_request && scan_request->dev) ? scan_request->dev->ieee80211_ptr : NULL; 46 #endif /* WL_SCHED_SCAN */ 47 48 #ifdef DUAL_ESCAN_RESULT_BUFFER 49 #define wl_escan_set_sync_id(a, b) ((a) = (b)->escan_info.cur_sync_id) 50 #define wl_escan_set_type(a, b) ((a)->escan_info.escan_type\ 51 [((a)->escan_info.cur_sync_id)%SCAN_BUF_CNT] = (b)) 52 #else 53 #define wl_escan_set_sync_id(a, b) ((a) = htod16((b)->escan_sync_id_cntr++)) 54 #define wl_escan_set_type(a, b) 55 #endif /* DUAL_ESCAN_RESULT_BUFFER */ 56 extern s32 wl_escan_handler(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev, 57 const wl_event_msg_t *e, void *data); 58 extern s32 wl_do_escan(struct bcm_cfg80211 *cfg, struct wiphy *wiphy, 59 struct net_device *ndev, struct cfg80211_scan_request *request); 60 extern s32 __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, 61 struct cfg80211_scan_request *request, struct cfg80211_ssid *this_ssid); 62 #if defined(WL_CFG80211_P2P_DEV_IF) 63 extern s32 wl_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request); 64 #else 65 extern s32 wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, 66 struct cfg80211_scan_request *request); 67 extern int wl_cfg80211_scan_stop(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev); 68 #endif /* WL_CFG80211_P2P_DEV_IF */ 69 70 #if defined(OEM_ANDROID) && defined(DHCP_SCAN_SUPPRESS) 71 extern void wl_cfg80211_work_handler(struct work_struct *work); 72 extern void wl_cfg80211_scan_supp_timerfunc(ulong data); 73 #endif /* DHCP_SCAN_SUPPRESS */ 74 75 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)) 76 extern void wl_cfg80211_abort_scan(struct wiphy *wiphy, struct wireless_dev *wdev); 77 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)) */ 78 extern s32 wl_init_scan(struct bcm_cfg80211 *cfg); 79 extern int wl_cfg80211_scan_stop(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev); 80 extern s32 wl_notify_scan_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev, 81 const wl_event_msg_t *e, void *data); 82 extern void wl_cfg80211_set_passive_scan(struct net_device *dev, char *command); 83 #ifdef PNO_SUPPORT 84 extern s32 wl_notify_pfn_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev, 85 const wl_event_msg_t *e, void *data); 86 #endif /* PNO_SUPPORT */ 87 #ifdef GSCAN_SUPPORT 88 extern s32 wl_notify_gscan_event(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev, 89 const wl_event_msg_t *e, void *data); 90 #endif /* GSCAN_SUPPORT */ 91 92 #ifdef WES_SUPPORT 93 #ifdef CUSTOMER_SCAN_TIMEOUT_SETTING 94 #define CUSTOMER_WL_SCAN_TIMER_INTERVAL_MS 25000 /* Scan timeout */ 95 enum wl_custom_scan_time_type { 96 WL_CUSTOM_SCAN_CHANNEL_TIME = 0, 97 WL_CUSTOM_SCAN_UNASSOC_TIME, 98 WL_CUSTOM_SCAN_PASSIVE_TIME, 99 WL_CUSTOM_SCAN_HOME_TIME, 100 WL_CUSTOM_SCAN_HOME_AWAY_TIME 101 }; 102 extern s32 wl_cfg80211_custom_scan_time(struct net_device *dev, 103 enum wl_custom_scan_time_type type, int time); 104 #endif /* CUSTOMER_SCAN_TIMEOUT_SETTING */ 105 #endif /* WES_SUPPORT */ 106 107 #if defined(SUPPORT_RANDOM_MAC_SCAN) 108 int wl_cfg80211_set_random_mac(struct net_device *dev, bool enable); 109 int wl_cfg80211_random_mac_enable(struct net_device *dev); 110 int wl_cfg80211_random_mac_disable(struct net_device *dev); 111 int wl_cfg80211_scan_mac_enable(struct net_device *dev); 112 int wl_cfg80211_scan_mac_disable(struct net_device *dev); 113 int wl_cfg80211_scan_mac_config(struct net_device *dev, uint8 *rand_mac, uint8 *rand_mask); 114 #endif /* SUPPORT_RANDOM_MAC_SCAN */ 115 116 #ifdef WL_SCHED_SCAN 117 extern int wl_cfg80211_sched_scan_start(struct wiphy *wiphy, struct net_device *dev, 118 struct cfg80211_sched_scan_request *request); 119 #if (LINUX_VERSION_CODE > KERNEL_VERSION(4, 11, 0)) 120 extern int wl_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev, u64 reqid); 121 #else 122 extern int wl_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev); 123 #endif /* LINUX_VER > 4.11 */ 124 #endif /* WL_SCHED_SCAN */ 125 extern s32 wl_cfgscan_listen_on_channel(struct bcm_cfg80211 *cfg, struct wireless_dev *wdev, 126 struct ieee80211_channel *channel, unsigned int duration); 127 extern void wl_cfgscan_listen_complete_work(struct work_struct *work); 128 extern s32 wl_cfgscan_notify_listen_complete(struct bcm_cfg80211 *cfg); 129 extern s32 wl_cfgscan_cancel_listen_on_channel(struct bcm_cfg80211 *cfg, bool notify_user); 130 #if defined(WL_CFG80211_P2P_DEV_IF) 131 extern s32 wl_cfgscan_remain_on_channel(struct wiphy *wiphy, bcm_struct_cfgdev *cfgdev, 132 struct ieee80211_channel *channel, unsigned int duration, u64 *cookie); 133 #else 134 extern s32 wl_cfgscan_remain_on_channel(struct wiphy *wiphy, bcm_struct_cfgdev *cfgdev, 135 struct ieee80211_channel *channel, enum nl80211_channel_type channel_type, 136 unsigned int duration, u64 *cookie); 137 #endif /* WL_CFG80211_P2P_DEV_IF */ 138 extern s32 wl_cfgscan_cancel_remain_on_channel(struct wiphy *wiphy, 139 bcm_struct_cfgdev *cfgdev, u64 cookie); 140 extern chanspec_t wl_freq_to_chanspec(int freq); 141 extern s32 wl_inform_single_bss(struct bcm_cfg80211 *cfg, wl_bss_info_t *bi, bool update_ssid); 142 #ifdef WL_GET_RCC 143 extern int wl_android_get_roam_scan_chanlist(struct bcm_cfg80211 *cfg); 144 #endif /* WL_GET_RCC */ 145 extern s32 wl_get_assoc_channels(struct bcm_cfg80211 *cfg, 146 struct net_device *dev, wlcfg_assoc_info_t *info); 147 extern void wl_cfgscan_cancel_scan(struct bcm_cfg80211 *cfg); 148 extern void wl_cfgscan_scan_abort(struct bcm_cfg80211 *cfg); 149 #ifdef DHD_GET_VALID_CHANNELS 150 typedef enum { 151 WIFI_BAND_UNSPECIFIED, 152 /* 2.4 GHz */ 153 WIFI_BAND_BG = 1, 154 /* 5 GHz without DFS */ 155 WIFI_BAND_A = 2, 156 /* 5 GHz DFS only */ 157 WIFI_BAND_A_DFS = 4, 158 /* 5 GHz with DFS */ 159 WIFI_BAND_A_WITH_DFS = 6, 160 /* 2.4 GHz + 5 GHz; no DFS */ 161 WIFI_BAND_ABG = 3, 162 /* 2.4 GHz + 5 GHz with DFS */ 163 WIFI_BAND_ABG_WITH_DFS = 7, 164 /* 6GHz */ 165 WIFI_BAND_6GHZ = 8, 166 /* 5 GHz no DFS + 6 GHz */ 167 WIFI_BAND_5GHZ_6GHZ = 10, 168 /* 2.4 GHz + 5 GHz no DFS + 6 GHz */ 169 WIFI_AND_24GHZ_5GHZ_6GHZ = 11, 170 /* 2.4 GHz + 5 GHz with DFS + 6 GHz */ 171 WIFI_BAND_24GHZ_5GHZ_WITH_DFS_6GHZ = 15 172 } wifi_band; 173 174 extern bool wl_cfgscan_is_dfs_set(wifi_band band); 175 extern s32 wl_cfgscan_get_band_freq_list(struct bcm_cfg80211 *cfg, int band, 176 uint32 *list, uint32 *num_channels); 177 #endif /* DHD_GET_VALID_CHANNELS */ 178 #endif /* _wl_cfgscan_h_ */ 179