1 /* 2 * Header for Linux cfg80211 scan 3 * 4 * Portions of this code are copyright (c) 2021 Cypress Semiconductor Corporation 5 * 6 * Copyright (C) 1999-2017, Broadcom Corporation 7 * 8 * Unless you and Broadcom execute a separate written software license 9 * agreement governing use of this software, this software is licensed to you 10 * under the terms of the GNU General Public License version 2 (the "GPL"), 11 * available at http://www.broadcom.com/licenses/GPLv2.php, with the 12 * following added to such license: 13 * 14 * As a special exception, the copyright holders of this software give you 15 * permission to link this software with independent modules, and to copy and 16 * distribute the resulting executable under terms of your choice, provided that 17 * you also meet, for each linked independent module, the terms and conditions of 18 * the license of that module. An independent module is a module which is not 19 * derived from this software. The special exception does not apply to any 20 * modifications of the software. 21 * 22 * Notwithstanding the above, under no circumstances may you combine this 23 * software in any way with any other Broadcom software provided under a license 24 * other than the GPL, without Broadcom's express prior written consent. 25 * 26 * 27 * <<Broadcom-WL-IPTag/Open:>> 28 * 29 * $Id$ 30 */ 31 32 #ifndef _wl_cfgscan_h_ 33 #define _wl_cfgscan_h_ 34 35 #include <linux/wireless.h> 36 #include <typedefs.h> 37 #include <ethernet.h> 38 #include <wlioctl.h> 39 #include <linux/wireless.h> 40 #include <net/cfg80211.h> 41 #include <linux/rfkill.h> 42 #include <osl.h> 43 44 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)) 45 #define GET_SCAN_WDEV(scan_request) \ 46 (scan_request && scan_request->dev) ? scan_request->dev->ieee80211_ptr : NULL; 47 #else 48 #define GET_SCAN_WDEV(scan_request) \ 49 scan_request ? scan_request->wdev : NULL; 50 #endif // endif 51 #ifdef WL_SCHED_SCAN 52 #define GET_SCHED_SCAN_WDEV(scan_request) \ 53 (scan_request && scan_request->dev) ? scan_request->dev->ieee80211_ptr : NULL; 54 #endif /* WL_SCHED_SCAN */ 55 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 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)) 70 extern void wl_cfg80211_abort_scan(struct wiphy *wiphy, struct wireless_dev *wdev); 71 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)) */ 72 extern void wl_cfg80211_scan_abort(struct bcm_cfg80211 *cfg); 73 extern s32 wl_init_scan(struct bcm_cfg80211 *cfg); 74 extern int wl_cfg80211_scan_stop(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev); 75 extern s32 wl_notify_scan_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev, 76 const wl_event_msg_t *e, void *data); 77 extern void wl_cfg80211_set_passive_scan(struct net_device *dev, char *command); 78 #ifdef PNO_SUPPORT 79 extern s32 wl_notify_pfn_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev, 80 const wl_event_msg_t *e, void *data); 81 #endif /* PNO_SUPPORT */ 82 #ifdef GSCAN_SUPPORT 83 extern s32 wl_notify_gscan_event(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev, 84 const wl_event_msg_t *e, void *data); 85 #endif /* GSCAN_SUPPORT */ 86 87 #ifdef WES_SUPPORT 88 #ifdef CUSTOMER_SCAN_TIMEOUT_SETTING 89 #define CUSTOMER_WL_SCAN_TIMER_INTERVAL_MS 25000 /* Scan timeout */ 90 enum wl_custom_scan_time_type { 91 WL_CUSTOM_SCAN_CHANNEL_TIME = 0, 92 WL_CUSTOM_SCAN_UNASSOC_TIME, 93 WL_CUSTOM_SCAN_PASSIVE_TIME, 94 WL_CUSTOM_SCAN_HOME_TIME, 95 WL_CUSTOM_SCAN_HOME_AWAY_TIME 96 }; 97 extern s32 wl_cfg80211_custom_scan_time(struct net_device *dev, 98 enum wl_custom_scan_time_type type, int time); 99 #endif /* CUSTOMER_SCAN_TIMEOUT_SETTING */ 100 #endif /* WES_SUPPORT */ 101 102 #if defined(SUPPORT_RANDOM_MAC_SCAN) 103 int wl_cfg80211_set_random_mac(struct net_device *dev, bool enable); 104 int wl_cfg80211_random_mac_enable(struct net_device *dev); 105 int wl_cfg80211_random_mac_disable(struct net_device *dev); 106 int wl_cfg80211_scan_mac_enable(struct net_device *dev, uint8 *rand_mac, uint8 *rand_mask); 107 int wl_cfg80211_scan_mac_disable(struct net_device *dev); 108 #endif /* SUPPORT_RANDOM_MAC_SCAN */ 109 110 #ifdef WL_SCHED_SCAN 111 extern int wl_cfg80211_sched_scan_start(struct wiphy *wiphy, struct net_device *dev, 112 struct cfg80211_sched_scan_request *request); 113 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)) 114 int 115 wl_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev, u64 req); 116 #else 117 int wl_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev); 118 #endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(4, 11, 0) */ 119 #endif /* WL_SCHED_SCAN */ 120 #endif /* _wl_cfgscan_h_ */ 121