1 /* 2 * Copyright (c) 2019 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: Define Common MLME structure and APIs 19 */ 20 #ifndef _WLAN_MLME_CMN_H_ 21 #define _WLAN_MLME_CMN_H_ 22 23 #include <include/wlan_pdev_mlme.h> 24 #include <include/wlan_vdev_mlme.h> 25 26 /** 27 * struct vdev_mlme_ext_ops - VDEV MLME legacy callbacks structure 28 * @mlme_pdev_ext_hdl_create: callback to invoke creation of legacy 29 * pdev object 30 * @mlme_pdev_ext_hdl_destroy: callback to invoke destroy of legacy 31 * pdev object 32 * @mlme_vdev_ext_hdl_create: callback to invoke creation of legacy 33 * vdev object 34 * @mlme_vdev_ext_hdl_post_create: callback to invoke post creation actions 35 * of legacy vdev object 36 * @mlme_vdev_ext_hdl_destroy: callback to invoke destroy of legacy 37 * vdev object 38 * @mlme_vdev_start_fw_send: callback to invoke vdev start command 39 * @mlme_vdev_stop_fw_send: callback to invoke vdev stop command 40 * @mlme_vdev_down_fw_send: callback to invoke vdev down command 41 * @mlme_multivdev_restart_fw_send: callback to invoke multivdev restart 42 * command 43 * @mlme_vdev_enqueue_exp_cmd: callback to enqueue exception command 44 * required by serialization 45 */ 46 struct mlme_ext_ops { 47 QDF_STATUS (*mlme_pdev_ext_hdl_create)( 48 struct pdev_mlme_obj *pdev_mlme); 49 QDF_STATUS (*mlme_pdev_ext_hdl_destroy)( 50 struct pdev_mlme_obj *pdev_mlme); 51 QDF_STATUS (*mlme_vdev_ext_hdl_create)( 52 struct vdev_mlme_obj *vdev_mlme); 53 QDF_STATUS (*mlme_vdev_ext_hdl_post_create)( 54 struct vdev_mlme_obj *vdev_mlme); 55 QDF_STATUS (*mlme_vdev_ext_hdl_destroy)( 56 struct vdev_mlme_obj *vdev_mlme); 57 QDF_STATUS (*mlme_vdev_start_fw_send)( 58 struct wlan_objmgr_vdev *vdev, uint8_t restart); 59 QDF_STATUS (*mlme_vdev_stop_fw_send)(struct wlan_objmgr_vdev *vdev); 60 QDF_STATUS (*mlme_vdev_down_fw_send)(struct wlan_objmgr_vdev *vdev); 61 QDF_STATUS (*mlme_multivdev_restart_fw_send)( 62 struct wlan_objmgr_pdev *pdev); 63 QDF_STATUS (*mlme_vdev_enqueue_exp_cmd)( 64 struct vdev_mlme_obj *vdev_mlme, 65 uint8_t cmd_type); 66 }; 67 68 /** 69 * mlme_pdev_ops_ext_hdl_create - Alloc PDEV mlme ext handle 70 * @pdev_mlme_obj: PDEV MLME comp object 71 * 72 * API to allocate PDEV MLME ext handle 73 * 74 * Return: SUCCESS on successful allocation 75 * Else FAILURE 76 */ 77 QDF_STATUS mlme_pdev_ops_ext_hdl_create(struct pdev_mlme_obj *pdev_mlme); 78 79 /** 80 * mlme_pdev_ops_ext_hdl_destroy - Destroy PDEV mlme ext handle 81 * @pdev_mlme_obj: PDEV MLME comp object 82 * 83 * API to free pdev MLME ext handle 84 * 85 * Return: SUCCESS on successful free 86 * Else FAILURE 87 */ 88 QDF_STATUS mlme_pdev_ops_ext_hdl_destroy(struct pdev_mlme_obj *pdev_mlme); 89 90 /** 91 * mlme_vdev_ops_ext_hdl_create - Alloc VDEV mlme ext handle 92 * @vdev_mlme_obj: VDEV MLME comp object 93 * 94 * API to allocate VDEV MLME ext handle 95 * 96 * Return: SUCCESS on successful allocation 97 * Else FAILURE 98 */ 99 QDF_STATUS mlme_vdev_ops_ext_hdl_create(struct vdev_mlme_obj *vdev_mlme); 100 101 /** 102 * mlme_vdev_ops_ext_hdl_post_create - Perform post VDEV mlme ext handle alloc 103 * operations 104 * @vdev_mlme_obj: VDEV MLME comp object 105 * 106 * API to perform post vdev MLME ext handle allocation operations 107 * 108 * Return: SUCCESS on initialization successful 109 * Else FAILURE 110 */ 111 QDF_STATUS mlme_vdev_ops_ext_hdl_post_create(struct vdev_mlme_obj *vdev_mlme); 112 113 /** 114 * mlme_vdev_ops_ext_hdl_destroy - Destroy VDEV mlme ext handle 115 * @vdev_mlme_obj: VDEV MLME comp object 116 * 117 * API to free vdev MLME ext handle 118 * 119 * Return: SUCCESS on successful free 120 * Else FAILURE 121 */ 122 QDF_STATUS mlme_vdev_ops_ext_hdl_destroy(struct vdev_mlme_obj *vdev_mlme); 123 124 /** 125 * mlme_vdev_enqueue_exp_ser_cmd - Enqueue exception serialization cmd 126 * @vdev_mlme_obj: VDEV MLME comp object 127 * @cmd_type: Serialization command type 128 * 129 * API to enqueue the exception serialization command, used by 130 * mlme-serialization wrapper layer 131 * 132 * Return: SUCCESS on successful enqueuing the command 133 * Else FAILURE 134 */ 135 QDF_STATUS mlme_vdev_enqueue_exp_ser_cmd(struct vdev_mlme_obj *vdev_mlme, 136 uint8_t cmd_type); 137 138 /** 139 * mlme_vdev_ops_start_fw_send - Send WMI START/RESTART commmand to FW 140 * @vdev: VDEV object 141 * 142 * API to send WMI start/restart command to FW 143 * 144 * Return: SUCCESS on successful sending the command 145 * Else FAILURE 146 */ 147 QDF_STATUS mlme_vdev_ops_start_fw_send(struct wlan_objmgr_vdev *vdev, 148 uint8_t restart); 149 150 /** 151 * mlme_vdev_ops_multivdev_restart_fw_cmd_send - Send WMI Multivdev restart 152 * commmand to FW 153 * @pdev: PDEV object 154 * 155 * API to send WMI multivdev restart command to FW 156 * 157 * Return: SUCCESS on successful sending the command 158 * Else FAILURE 159 */ 160 QDF_STATUS mlme_vdev_ops_multivdev_restart_fw_cmd_send( 161 struct wlan_objmgr_pdev *pdev); 162 163 /** 164 * mlme_vdev_ops_stop_fw_send - Send WMI STOP commmand to FW 165 * @vdev: VDEV object 166 * 167 * API to send WMI stop command to FW 168 * 169 * Return: SUCCESS on successful sending the command 170 * Else FAILURE 171 */ 172 QDF_STATUS mlme_vdev_ops_stop_fw_send(struct wlan_objmgr_vdev *vdev); 173 174 /** 175 * mlme_vdev_ops_down_fw_send - Send WMI Down commmand to FW 176 * @vdev: VDEV object 177 * 178 * API to send WMI down command to FW 179 * 180 * Return: SUCCESS on successful sending the command 181 * Else FAILURE 182 */ 183 QDF_STATUS mlme_vdev_ops_down_fw_send(struct wlan_objmgr_vdev *vdev); 184 185 /** 186 * mlme_set_ops_register_cb - Sets ops registration callback 187 * @ops_cb: Function pointer 188 * 189 * API to set ops registration call back 190 * 191 * Return: void 192 */ 193 typedef struct mlme_ext_ops *(*mlme_get_global_ops_cb)(void); 194 void mlme_set_ops_register_cb(mlme_get_global_ops_cb ops_cb); 195 196 /** 197 * wlan_cmn_mlme_init - Initializes MLME component 198 * 199 * Registers callbacks with object manager for create/destroy 200 * 201 * Return: SUCCESS on successful registration 202 * FAILURE, if registration fails 203 */ 204 QDF_STATUS wlan_cmn_mlme_init(void); 205 206 /** 207 * wlan_cmn_mlme_deinit - Uninitializes MLME component 208 * 209 * Unregisters callbacks with object manager for create/destroy 210 * 211 * Return: SUCCESS on successful registration 212 * FAILURE, if registration fails 213 */ 214 QDF_STATUS wlan_cmn_mlme_deinit(void); 215 #endif 216