1 /* 2 * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /* 21 * DOC: contains scan manager functionality 22 */ 23 24 #ifndef _WLAN_SCAN_MANAGER_6GHZ_API_H_ 25 #define _WLAN_SCAN_MANAGER_6GHZ_API_H_ 26 27 #include "wlan_scan_main.h" 28 29 #ifdef CONFIG_BAND_6GHZ 30 31 /* 32 * Userspace/framework tracks last few days(e.g: 10 days) history of 33 * connected APs and maintains best 10 channels out of that list by 34 * considering multiple parameters like scoring, location etc. 35 * It's likely to find an AP in one of these channels when a scan issued. 36 * So, framework issues first scan request with a maximum of 10 channels 37 * Any scan request which consist of more than 10 channels can be considered as 38 * full scan 39 */ 40 #define FULL_SCAN_CH_COUNT_MIN_BY_USERSPACE 11 41 42 /* 43 * This can used to set the RNR_ONLY flag to certain type(PSC/non-PSC) or 44 * all channels. 45 */ 46 #define SET_RNR_FLAG_TO_PSC_CHANNEL 0x1 47 #define SET_RNR_FLAG_TO_NON_PSC_CHANNEL 0x2 48 #define SET_RNR_FLAG_TO_ALL_6G_CHANNELS 0x3 49 50 /** 51 * scm_add_channel_flags() - Update 6ghz channel flags in active/pno scan req 52 * @vdev: vdev 53 * @pno_chan_list: channel list 54 * @num_chan: number channels 55 * @is_colocated_6ghz_scan_enabled: Colacated 6ghz flag 56 * @is_pno_scan: is pno scan 57 * 58 * Add channel flags for 6ghz channels from active/pno scan request based on ini 59 * 60 * Return: None 61 */ 62 void 63 scm_add_channel_flags(struct wlan_objmgr_vdev *vdev, 64 struct chan_list *chan_list, 65 uint8_t *num_chan, 66 bool is_colocated_6ghz_scan_enabled, 67 bool is_pno_scan); 68 69 /** 70 * scm_update_6ghz_channel_list() - Update 6ghz channel list in the scan req 71 * @req: scan start request 72 * @scan_obj: scan component object 73 * 74 * Filter out the unsupported 6ghz channels from scan request and add supported 75 * 6ghz channels based on the ini. 76 * 77 * Return: None 78 */ 79 void 80 scm_update_6ghz_channel_list(struct scan_start_request *req, 81 struct wlan_scan_obj *scan_obj); 82 83 /** 84 * scm_is_6ghz_scan_optimization_supported() - Check firmware capability 85 * @psoc: psoc 86 * 87 * Check if firmware supports 6ghz scan optimization from fw_ext_caps of psoc. 88 * 89 * Return: None 90 */ 91 bool 92 scm_is_6ghz_scan_optimization_supported(struct wlan_objmgr_psoc *psoc); 93 94 /** 95 * scm_add_all_valid_6g_channels() - Add all valid 6g channels to scan request 96 * @vdev: vdev on which scan request is issued 97 * @req: Scan start request 98 * @num_scan_ch: Total number of scan channels 99 * 100 * If colocated 6ghz scan flag present in host scan request or at least one 6G 101 * channel is present in the host scan request, then this API 102 * fills all remaining (other than channel(s) resent in host scan req) valid 103 * 6 GHz channel(s) to scan requests channel list and set the flag 104 * FLAG_SCAN_ONLY_IF_RNR_FOUND for each of those added channels. 105 * By this driver allows Firmware to scan 6G channels based on RNR IEs only. 106 * 107 * Return: None 108 */ 109 void scm_add_all_valid_6g_channels(struct wlan_objmgr_pdev *pdev, 110 struct chan_list *chan_list, 111 uint8_t *num_scan_ch, 112 bool is_colocated_6ghz); 113 114 #else 115 static inline void 116 scm_add_channel_flags(struct wlan_objmgr_vdev *vdev, 117 struct chan_list *pno_chan_list, 118 uint8_t *num_chan, 119 bool is_colocated_6ghz, 120 bool is_pno_scan) 121 { 122 } 123 124 static inline void 125 scm_update_6ghz_channel_list(struct scan_start_request *req, 126 struct wlan_scan_obj *scan_obj) 127 { 128 } 129 130 static inline bool 131 scm_is_6ghz_scan_optimization_supported(struct wlan_objmgr_psoc *psoc) 132 { 133 return false; 134 } 135 136 static inline void scm_add_all_valid_6g_channels(struct wlan_objmgr_pdev *pdev, 137 struct chan_list *chan_list, 138 uint8_t *num_scan_ch, 139 bool is_colocated_6ghz) 140 { 141 } 142 #endif 143 144 #endif 145