1 /* 2 * Copyright (c) 2020, The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 /* 18 * DOC: Implements CM UTF 19 */ 20 21 #ifndef WLAN_CM_UTF_H 22 #define WLAN_CM_UTF_H 23 24 #include <qdf_debugfs.h> 25 #include <qdf_mem.h> 26 #include <qdf_trace.h> 27 #include <qdf_module.h> 28 #include <qdf_event.h> 29 #include <qdf_defer.h> 30 #include <wlan_cm_public_struct.h> 31 #include <wlan_mgmt_txrx_utils_api.h> 32 #include <wlan_reg_services_api.h> 33 #include <wlan_scan_tgt_api.h> 34 #include <wlan_cfg80211.h> 35 36 #define NUM_UTF_DEBUGFS_INFOS 2 37 38 /* 39 * <ini> 40 * wlan_cm_utf - WLAN CM UTF Configuration 41 * @Min: 0 42 * @Max: 1 43 * @Default: 0 44 * 45 * This ini is used to config wlan cm utf 46 * 47 * Related: None 48 * 49 * Usage: External 50 * 51 * </ini> 52 */ 53 #define CFG_WLAN_CM_UTF CFG_INI_UINT( \ 54 "wlan_cm_utf", \ 55 0, \ 56 1, \ 57 0, \ 58 CFG_VALUE_OR_DEFAULT, \ 59 "WLAN CM UTF Configuration") 60 61 #define CFG_WLAN_CM_UTF_PARAM CFG(CFG_WLAN_CM_UTF) 62 /** 63 * enum wlan_cm_utf_test - CM UTF Test ID 64 * @CM_UTF_ID_CONNECT_SUCCESS: Connect Succes 65 * @CM_UTF_ID_DISCONNECT_SUCCESS: Disconnect Success 66 * @CM_UTF_ID_PEER_CREATE_FAILURE: Peer Create Failure 67 * @CM_UTF_ID_PEER_CREATE_TIMEOUT: No Peer Create Response 68 * @CM_UTF_ID_PEER_DELETE_TIMEOUT: No Peer Delete Response 69 * @CM_UTF_ID_AUTH_FAILURE: Auth Req Failure 70 * @CM_UTF_ID_AUTH_TIMEOUT: No Auth Response 71 * @CM_UTF_ID_ASSOC_FAILURE: Assoc Req Failure 72 * @CM_UTF_ID_ASSOC_TIMEOUT: No Assoc Response 73 * @CM_UTF_ID_CONNECT_SCAN_FAILURE: SSID Not Found 74 * @CM_UTF_ID_CONNECT_SER_TIMEOUT: Serialization Active Cmd Timeout for Connect 75 * @CM_UTF_ID_DISCONNECT_SER_TIMEOUT: Ser Active Cmd Timeout for Disconnect 76 * @CM_UTF_ID_CONNECT_SER_FAILED: Serialization Cmd Queue Failure for Connect 77 * @CM_UTF_ID_DISCONNECT_SER_FAILED: Ser Cmd Queue Failure for Disconnect 78 */ 79 enum wlan_cm_utf_test { 80 CM_UTF_ID_CONNECT_SUCCESS, 81 CM_UTF_ID_DISCONNECT_SUCCESS, 82 CM_UTF_ID_PEER_CREATE_FAILURE, 83 CM_UTF_ID_PEER_CREATE_TIMEOUT, 84 CM_UTF_ID_PEER_DELETE_TIMEOUT, 85 CM_UTF_ID_AUTH_FAILURE, 86 CM_UTF_ID_AUTH_TIMEOUT, 87 CM_UTF_ID_ASSOC_FAILURE, 88 CM_UTF_ID_ASSOC_TIMEOUT, 89 CM_UTF_ID_CONNECT_SCAN_FAILURE, 90 CM_UTF_ID_CONNECT_SER_TIMEOUT, 91 CM_UTF_ID_DISCONNECT_SER_TIMEOUT, 92 CM_UTF_ID_CONNECT_SER_FAILED,//Need ser utf 93 CM_UTF_ID_DISCONNECT_SER_FAILED,//Need ser utf 94 CM_UTF_ID_MAX, 95 }; 96 97 /** 98 * enum wlan_cm_utf_evt - CM UTF Resp event 99 * @CM_UTF_BSS_PEER_CREATE_RESP: Peer Create Response 100 * @CM_UTF_BSS_PEER_DELETE_RESP: Peer Delete Response 101 * @CM_UTF_CONNECT_RESP: Connect Response 102 * @CM_UTF_DISCONNECT_RESP: Disconnect Response 103 * @CM_UTF_PEER_DELETE_IND: Peer Delete Indication 104 */ 105 enum wlan_cm_utf_evt { 106 CM_UTF_BSS_PEER_CREATE_RESP, 107 CM_UTF_BSS_PEER_DELETE_RESP, 108 CM_UTF_CONNECT_RESP, 109 CM_UTF_DISCONNECT_RESP, 110 CM_UTF_PEER_DELETE_IND, 111 }; 112 113 /** 114 * struct wlan_cm_utf_node- CM UTF node to hold CM req info 115 * @wlan_cm_utf_evt: CM UTF Resp event 116 * @peer_mac: Peer Mac 117 * @conn_req: Connect Request 118 * @disconn_req: Disconnect Request 119 */ 120 struct wlan_cm_utf_node { 121 enum wlan_cm_utf_evt evt_id; 122 struct qdf_mac_addr *peer_mac; 123 struct wlan_cm_vdev_connect_req conn_req; 124 struct wlan_cm_vdev_discon_req disconn_req; 125 }; 126 127 /** 128 * struct wlan_cm_utf- CM UTF handle 129 * @vdev: Vdev object 130 * @debugfs_de: debugfs entry 131 * @test_id: Test case Id 132 * @req: cfg80211 connect request params 133 * @cm_utf_timer: CM UTF timer 134 * @cm_utf_test_timer: CM UTF timer for each test 135 * @utf_node: CM UTF node to hold CM req info 136 * @cm_utf_work: CM UTF work queue for processing events 137 */ 138 struct wlan_cm_utf { 139 qdf_list_node_t cm_utf_node; 140 struct wlan_objmgr_vdev *vdev; 141 struct dentry *debugfs_de[NUM_UTF_DEBUGFS_INFOS]; 142 enum wlan_cm_utf_test test_id; 143 struct wlan_cm_connect_req req; 144 qdf_timer_t cm_utf_timer; 145 qdf_timer_t cm_utf_test_timer; 146 struct wlan_cm_utf_node utf_node; 147 uint32_t last_cmd_id; 148 enum wlan_cm_source last_cmd_source; 149 qdf_work_t cm_utf_work; 150 }; 151 152 /* 153 * Debugfs read/write functions 154 */ 155 /** 156 * wlan_cm_utf_cm_test_id_show() - debugfs function to display CM test case name 157 * @m: seq_file handle 158 * @v: not used, offset of read 159 */ 160 int wlan_cm_utf_cm_test_id_show(qdf_debugfs_file_t m, void *v); 161 162 int wlan_cm_utf_scan_db_update_show(qdf_debugfs_file_t m, void *v); 163 164 /** 165 * wlan_cm_utf_cm_test_id_write() - debugfs write to start CM UTF test 166 * 167 * @file: file handler to access cm utf handle 168 * @buf: received data buffer 169 * @count: length of received buffer 170 * @ppos: Not used 171 * 172 * Return: count 173 */ 174 ssize_t wlan_cm_utf_cm_test_id_write(struct file *file, 175 const char __user *buf, 176 size_t count, loff_t *ppos); 177 178 /** 179 * wlan_cm_utf_scan_db_update_write() - debugfs write to add manual scan entry 180 * 181 * @file: file handler to access cm utf handle 182 * @buf: received data buffer 183 * @count: length of received buffer 184 * @ppos: Not used 185 * 186 * Return: count 187 */ 188 ssize_t wlan_cm_utf_scan_db_update_write(struct file *file, 189 const char __user *buf, 190 size_t count, loff_t *ppos); 191 192 /** 193 * wlan_cm_utf_attach: Connection manager UTF init API 194 * @vdev: Vdev object 195 * 196 * Return: QDF_STATUS 197 */ 198 QDF_STATUS wlan_cm_utf_attach(struct wlan_objmgr_vdev *vdev); 199 200 /** 201 * wlan_cm_utf_detach: Connection manager UTF deinit API 202 * @vdev: Vdev object 203 * 204 * Return: QDF_STATUS 205 */ 206 void wlan_cm_utf_detach(struct wlan_objmgr_vdev *vdev); 207 208 /** 209 * wlan_cm_utf_bss_peer_create_req: Connection manager UTF bss peer 210 * create request handler 211 * @vdev: VDEV object 212 * @peer_mac: Peer mac address 213 * 214 * Return: QDF_STATUS 215 */ 216 QDF_STATUS wlan_cm_utf_bss_peer_create_req(struct wlan_objmgr_vdev *vdev, 217 struct qdf_mac_addr *peer_mac); 218 219 /** 220 * wlan_cm_utf_connect_req_active: Connection manager UTF handler when connect 221 * request is activated 222 * @vdev: VDEV object 223 * @vdev_connect_req: Vdev connect request 224 * 225 * Return: QDF_STATUS 226 */ 227 QDF_STATUS wlan_cm_utf_connect_req_active( 228 struct wlan_objmgr_vdev *vdev, 229 struct wlan_cm_vdev_connect_req *vdev_connect_req); 230 231 /** 232 * wlan_cm_utf_connect_req: Connection manager UTF connect request handler 233 * @vdev: VDEV object 234 * @vdev_connect_req: Vdev connect request 235 * 236 * Return: QDF_STATUS 237 */ 238 QDF_STATUS wlan_cm_utf_connect_req( 239 struct wlan_objmgr_vdev *vdev, 240 struct wlan_cm_vdev_connect_req *vdev_connect_req); 241 242 /** 243 * wlan_cm_utf_disconnect_req: Connection manager UTF disconnect 244 * request handler 245 * @vdev: VDEV object 246 * @vdev_connect_req: Vdev connect request 247 * 248 * Return: QDF_STATUS 249 */ 250 QDF_STATUS wlan_cm_utf_disconnect_req( 251 struct wlan_objmgr_vdev *vdev, 252 struct wlan_cm_vdev_discon_req *vdev_disconnect_req); 253 254 /** 255 * wlan_cm_utf_bss_peer_delete_req: Connection manager UTF bss peer 256 * delete request handler 257 * @vdev: VDEV object 258 * 259 * Return: QDF_STATUS 260 */ 261 QDF_STATUS wlan_cm_utf_bss_peer_delete_req(struct wlan_objmgr_vdev *vdev); 262 263 /** 264 * wlan_cm_utf_vdev_down: Connection manager UTF vdev down request handler 265 * @vdev: VDEV object 266 * 267 * Return: QDF_STATUS 268 */ 269 QDF_STATUS wlan_cm_utf_vdev_down(struct wlan_objmgr_vdev *vdev); 270 271 /** 272 * osif_cm_utf_register_cb() - API to register connection manager callbacks 273 * 274 * Return: QDF_STATUS 275 */ 276 QDF_STATUS osif_cm_utf_register_cb(void); 277 #endif //WLAN_CM_UTF_H 278