Srinivas Pitla | 39a9222 | 2018-10-05 10:52:48 +0530 | [diff] [blame] | 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: Implements MLME global APIs |
| 19 | */ |
| 20 | |
| 21 | #include "wlan_objmgr_cmn.h" |
| 22 | #include "include/wlan_mlme_cmn.h" |
| 23 | #include "include/wlan_pdev_mlme.h" |
| 24 | #include "include/wlan_vdev_mlme.h" |
| 25 | #include "include/wlan_mlme_cmn.h" |
| 26 | #include "wlan_pdev_mlme_main.h" |
| 27 | #include "wlan_vdev_mlme_main.h" |
| 28 | |
| 29 | struct mlme_ext_ops *glbl_ops; |
| 30 | mlme_get_global_ops_cb glbl_ops_cb; |
| 31 | |
| 32 | QDF_STATUS wlan_cmn_mlme_init(void) |
| 33 | { |
| 34 | QDF_STATUS status; |
| 35 | |
| 36 | status = wlan_pdev_mlme_init(); |
| 37 | if (status != QDF_STATUS_SUCCESS) |
| 38 | return status; |
| 39 | |
| 40 | status = wlan_vdev_mlme_init(); |
| 41 | if (status != QDF_STATUS_SUCCESS) |
| 42 | return status; |
| 43 | |
| 44 | if (glbl_ops_cb) |
| 45 | glbl_ops = glbl_ops_cb(); |
| 46 | |
| 47 | return QDF_STATUS_SUCCESS; |
| 48 | } |
| 49 | |
| 50 | QDF_STATUS wlan_cmn_mlme_deinit(void) |
| 51 | { |
| 52 | QDF_STATUS status; |
| 53 | |
| 54 | status = wlan_vdev_mlme_deinit(); |
| 55 | if (status != QDF_STATUS_SUCCESS) |
| 56 | return status; |
| 57 | |
| 58 | status = wlan_pdev_mlme_deinit(); |
| 59 | if (status != QDF_STATUS_SUCCESS) |
| 60 | return status; |
| 61 | |
| 62 | return QDF_STATUS_SUCCESS; |
| 63 | } |
| 64 | |
| 65 | QDF_STATUS mlme_pdev_ops_ext_hdl_create(struct pdev_mlme_obj *pdev_mlme) |
| 66 | { |
| 67 | QDF_STATUS ret = QDF_STATUS_SUCCESS; |
| 68 | |
| 69 | if ((glbl_ops) && glbl_ops->mlme_pdev_ext_hdl_create) |
| 70 | ret = glbl_ops->mlme_pdev_ext_hdl_create(pdev_mlme); |
| 71 | |
| 72 | return ret; |
| 73 | } |
| 74 | |
| 75 | QDF_STATUS mlme_pdev_ops_ext_hdl_destroy(struct pdev_mlme_obj *pdev_mlme) |
| 76 | { |
| 77 | QDF_STATUS ret = QDF_STATUS_SUCCESS; |
| 78 | |
| 79 | if ((glbl_ops) && glbl_ops->mlme_pdev_ext_hdl_destroy) |
| 80 | ret = glbl_ops->mlme_pdev_ext_hdl_destroy(pdev_mlme); |
| 81 | |
| 82 | return ret; |
| 83 | } |
| 84 | |
| 85 | QDF_STATUS mlme_vdev_ops_ext_hdl_create(struct vdev_mlme_obj *vdev_mlme) |
| 86 | { |
| 87 | QDF_STATUS ret = QDF_STATUS_SUCCESS; |
| 88 | |
| 89 | if ((glbl_ops) && glbl_ops->mlme_vdev_ext_hdl_create) |
| 90 | ret = glbl_ops->mlme_vdev_ext_hdl_create(vdev_mlme); |
| 91 | |
| 92 | return ret; |
| 93 | } |
| 94 | |
| 95 | QDF_STATUS mlme_vdev_ops_ext_hdl_post_create(struct vdev_mlme_obj *vdev_mlme) |
| 96 | { |
| 97 | QDF_STATUS ret = QDF_STATUS_SUCCESS; |
| 98 | |
| 99 | if ((glbl_ops) && glbl_ops->mlme_vdev_ext_hdl_post_create) |
| 100 | ret = glbl_ops->mlme_vdev_ext_hdl_post_create(vdev_mlme); |
| 101 | |
| 102 | return ret; |
| 103 | } |
| 104 | |
| 105 | QDF_STATUS mlme_vdev_ops_ext_hdl_destroy(struct vdev_mlme_obj *vdev_mlme) |
| 106 | { |
| 107 | QDF_STATUS ret = QDF_STATUS_SUCCESS; |
| 108 | |
| 109 | if ((glbl_ops) && glbl_ops->mlme_vdev_ext_hdl_destroy) |
| 110 | ret = glbl_ops->mlme_vdev_ext_hdl_destroy(vdev_mlme); |
| 111 | |
| 112 | return ret; |
| 113 | } |
| 114 | |
| 115 | QDF_STATUS mlme_vdev_ops_start_fw_send(struct wlan_objmgr_vdev *vdev, |
| 116 | uint8_t restart) |
| 117 | { |
| 118 | QDF_STATUS ret = QDF_STATUS_SUCCESS; |
| 119 | |
| 120 | if (glbl_ops && glbl_ops->mlme_vdev_start_fw_send) |
| 121 | ret = glbl_ops->mlme_vdev_start_fw_send(vdev, restart); |
| 122 | |
| 123 | return ret; |
| 124 | } |
| 125 | |
| 126 | QDF_STATUS mlme_vdev_ops_multivdev_restart_fw_cmd_send( |
| 127 | struct wlan_objmgr_pdev *pdev) |
| 128 | { |
| 129 | QDF_STATUS ret = QDF_STATUS_SUCCESS; |
| 130 | |
| 131 | if ((glbl_ops) && glbl_ops->mlme_multivdev_restart_fw_send) |
| 132 | glbl_ops->mlme_multivdev_restart_fw_send(pdev); |
| 133 | |
| 134 | return ret; |
| 135 | } |
| 136 | |
| 137 | QDF_STATUS mlme_vdev_ops_stop_fw_send(struct wlan_objmgr_vdev *vdev) |
| 138 | { |
| 139 | QDF_STATUS ret = QDF_STATUS_SUCCESS; |
| 140 | |
| 141 | if (glbl_ops && glbl_ops->mlme_vdev_stop_fw_send) |
| 142 | ret = glbl_ops->mlme_vdev_stop_fw_send(vdev); |
| 143 | |
| 144 | return ret; |
| 145 | } |
| 146 | |
| 147 | QDF_STATUS mlme_vdev_ops_down_fw_send(struct wlan_objmgr_vdev *vdev) |
| 148 | { |
| 149 | QDF_STATUS ret = QDF_STATUS_SUCCESS; |
| 150 | |
| 151 | if (glbl_ops && glbl_ops->mlme_vdev_down_fw_send) |
| 152 | ret = glbl_ops->mlme_vdev_down_fw_send(vdev); |
| 153 | |
| 154 | return ret; |
| 155 | } |
| 156 | |
| 157 | QDF_STATUS mlme_vdev_enqueue_exp_ser_cmd(struct vdev_mlme_obj *vdev_mlme, |
| 158 | uint8_t cmd_type) |
| 159 | { |
| 160 | QDF_STATUS ret = QDF_STATUS_SUCCESS; |
| 161 | |
| 162 | if (glbl_ops && glbl_ops->mlme_vdev_enqueue_exp_cmd) |
| 163 | ret = glbl_ops->mlme_vdev_enqueue_exp_cmd(vdev_mlme, cmd_type); |
| 164 | |
| 165 | return ret; |
| 166 | } |
| 167 | |
| 168 | void mlme_set_ops_register_cb(mlme_get_global_ops_cb ops_cb) |
| 169 | { |
| 170 | glbl_ops_cb = ops_cb; |
| 171 | } |