1 /* 2 * Copyright (c) 2019 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2023 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: wlan_vdev_mgr_utils_api.h 22 * 23 * This file provides declaration for APIs used for psoc enable/disable 24 */ 25 26 #ifndef __WLAN_VDEV_MGR_UTILS_API_H__ 27 #define __WLAN_VDEV_MGR_UTILS_API_H__ 28 29 #include <wlan_objmgr_psoc_obj.h> 30 #include <include/wlan_vdev_mlme.h> 31 #include <wlan_vdev_mgr_ucfg_api.h> 32 #include <cdp_txrx_cmn_struct.h> 33 34 /* The total time required to receive CSA event handler from FW with CSA count 35 * 0, plus, time required to process the CSA event, plus, time required to 36 * send multi-vdev restart request on the new channel and send updated beacon 37 * template is approximately 1 second (considered 16 AP vaps). 38 */ 39 #define VDEV_RESTART_TIME 1 40 41 /* Convert seconds to milliseconds */ 42 #define SECONDS_TO_MS(seconds) ((seconds) * 1000) 43 44 /** 45 * wlan_util_vdev_get_cdp_txrx_opmode - get cdp txrx opmode from qdf mode 46 * @vdev: pointer to vdev object 47 * 48 * Return: wlan_opmode 49 */ 50 enum wlan_op_mode 51 wlan_util_vdev_get_cdp_txrx_opmode(struct wlan_objmgr_vdev *vdev); 52 53 /** 54 * wlan_util_vdev_get_cdp_txrx_subtype - get cdp txrx subtype from qdf mode 55 * @vdev: pointer to vdev object 56 * 57 * Return: wlan_opmode 58 */ 59 enum wlan_op_subtype 60 wlan_util_vdev_get_cdp_txrx_subtype(struct wlan_objmgr_vdev *vdev); 61 62 /** 63 * wlan_util_vdev_mlme_set_ratemask_config() - common MLME API to set 64 * ratemask configuration and send it to FW 65 * @vdev_mlme: pointer to vdev_mlme object 66 * @index: ratemask array index 67 * 68 * Return: QDF_STATUS - Success or Failure 69 */ 70 QDF_STATUS 71 wlan_util_vdev_mlme_set_ratemask_config(struct vdev_mlme_obj *vdev_mlme, 72 uint8_t index); 73 74 /** 75 * wlan_util_vdev_mlme_set_param() - common MLME API to fill common 76 * parameters of vdev_mlme object 77 * @vdev_mlme: pointer to vdev_mlme object 78 * @param_id: param id for which the value should be set 79 * @mlme_cfg: value that should be set to the parameter 80 * 81 * Return: QDF_STATUS - Success or Failure 82 */ 83 QDF_STATUS wlan_util_vdev_mlme_set_param(struct vdev_mlme_obj *vdev_mlme, 84 enum wlan_mlme_cfg_id param_id, 85 struct wlan_vdev_mgr_cfg mlme_cfg); 86 87 /** 88 * wlan_util_vdev_mlme_get_param() - common MLME API to get common 89 * parameters of vdev_mlme object 90 * @vdev_mlme: pointer to vdev_mlme object 91 * @param_id: param id for which the value should be set 92 * @param_value: value that should bem set to the parameter 93 * 94 * Return: QDF_STATUS - Success or Failure 95 */ 96 void wlan_util_vdev_mlme_get_param(struct vdev_mlme_obj *vdev_mlme, 97 enum wlan_mlme_cfg_id param_id, 98 uint32_t *param_value); 99 100 /** 101 * wlan_util_vdev_get_param() - common MLME API to get common 102 * parameters of vdev_mlme object 103 * @vdev: pointer to vdev object 104 * @param_id: param id for which the value should be set 105 * @param_value: value that should bem set to the parameter 106 * 107 * Return: QDF_STATUS - Success or Failure 108 */ 109 void wlan_util_vdev_get_param(struct wlan_objmgr_vdev *vdev, 110 enum wlan_mlme_cfg_id param_id, 111 uint32_t *param_value); 112 113 /** 114 * wlan_util_vdev_mgr_get_csa_channel_switch_time() - Returns the time required 115 * to switch the channel after completing the CSA announcement. This does not 116 * include the CAC duration. 117 * @vdev: Pointer to vdev object 118 * @chan_switch_time: Pointer to save the CSA channel switch time. This does not 119 * include the DFS CAC duration 120 * 121 * Return: QDF_STATUS - Success or Failure 122 */ 123 QDF_STATUS wlan_util_vdev_mgr_get_csa_channel_switch_time( 124 struct wlan_objmgr_vdev *vdev, 125 uint32_t *chan_switch_time); 126 127 /** 128 * wlan_util_vdev_mgr_compute_max_channel_switch_time() - Compute the max 129 * channel switch time for the given vdev 130 * @vdev: pointer to vdev object 131 * @max_chan_switch_time: Pointer to save the computed max channel switch time 132 * 133 * Return: QDF_STATUS - Success or Failure 134 */ 135 QDF_STATUS wlan_util_vdev_mgr_compute_max_channel_switch_time( 136 struct wlan_objmgr_vdev *vdev, uint32_t *max_chan_switch_time); 137 138 /** 139 * wlan_utils_get_vdev_remaining_channel_switch_time() - Get the remaining 140 * channel switch time. 141 * @vdev: Pointer to vdev object 142 * 143 * Remaining channel switch time is equal to the time when last beacon sent on 144 * the CSA triggered vap plus max channel switch time minus current 145 * time. 146 * 147 * Return: Remaining cac time 148 */ 149 uint32_t wlan_utils_get_vdev_remaining_channel_switch_time( 150 struct wlan_objmgr_vdev *vdev); 151 152 /** 153 * wlan_util_vdev_mgr_get_cac_timeout_for_vdev() - Get the CAC timeout value for 154 * a given vdev. 155 * @vdev: Pointer to vdev object. 156 * 157 * Return: CAC timeout value 158 */ 159 int wlan_util_vdev_mgr_get_cac_timeout_for_vdev(struct wlan_objmgr_vdev *vdev); 160 161 #ifdef MOBILE_DFS_SUPPORT 162 /** 163 * wlan_util_vdev_mgr_set_cac_timeout_for_vdev() - set the CAC timeout value for 164 * a given vdev. 165 * @vdev: Pointer to vdev object. 166 * @new_chan_cac_ms: cac duration of new channel 167 * 168 * Return: void 169 */ 170 void wlan_util_vdev_mgr_set_cac_timeout_for_vdev(struct wlan_objmgr_vdev *vdev, 171 uint32_t new_chan_cac_ms); 172 #endif /* MOBILE_DFS_SUPPORT */ 173 174 /** 175 * wlan_util_vdev_mgr_set_acs_mode_for_vdev() - set if the SAP is started in ACS 176 * @vdev: Pointer to vdev object. 177 * @is_acs_mode: Indicates true if the SAP is started in ACS 178 * 179 * Return: void 180 */ 181 void wlan_util_vdev_mgr_set_acs_mode_for_vdev(struct wlan_objmgr_vdev *vdev, 182 bool is_acs_mode); 183 184 /** 185 * wlan_util_vdev_mgr_get_acs_mode_for_vdev() - Get the SAP start mode 186 * @vdev: Pointer to vdev object. 187 * 188 * Return: true if the SAP is started in ACS 189 */ 190 bool wlan_util_vdev_mgr_get_acs_mode_for_vdev(struct wlan_objmgr_vdev *vdev); 191 #ifdef WLAN_FEATURE_11BE_MLO 192 /** 193 * wlan_util_vdev_mgr_quiet_offload() - set quiet status for given link 194 * @psoc: pointer to psoc 195 * @quiet_event: pointer to struct vdev_sta_quiet_event 196 * 197 * Return: QDF_STATUS 198 */ 199 QDF_STATUS wlan_util_vdev_mgr_quiet_offload( 200 struct wlan_objmgr_psoc *psoc, 201 struct vdev_sta_quiet_event *quiet_event); 202 #endif /* WLAN_FEATURE_11BE_MLO */ 203 204 /** 205 * wlan_util_vdev_peer_set_param_send() - send peer param 206 * @vdev: Pointer to vdev object. 207 * @peer_mac_addr: peer mac address 208 * @param_id: peer param id 209 * @param_value: peer param value 210 * 211 * Return: QDF_STATUS 212 */ 213 QDF_STATUS wlan_util_vdev_peer_set_param_send(struct wlan_objmgr_vdev *vdev, 214 uint8_t *peer_mac_addr, 215 uint32_t param_id, 216 uint32_t param_value); 217 #endif /* __WLAN_VDEV_MGR_UTILS_API_H__ */ 218