1 /* 2 * Copyright (c) 2018 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /** 20 * DOC: Declares VDEV MLME SM APIs and structures 21 */ 22 23 #ifndef _VDEV_MLME_SM_H_ 24 #define _VDEV_MLME_SM_H_ 25 26 #ifdef CMN_VDEV_MLME_SM_ENABLE 27 /** 28 * mlme_vdev_sm_deliver_event() - Delivers event to VDEV MLME SM 29 * @vdev_mlme: MLME VDEV comp object 30 * @event: MLME event 31 * @event_data_len: data size 32 * @event_data: event data 33 * 34 * API to dispatch event to VDEV MLME SM 35 * 36 * Return: SUCCESS: on handling event 37 * FAILURE: on ignoring the event 38 */ 39 QDF_STATUS mlme_vdev_sm_deliver_event(struct vdev_mlme_obj *vdev_mlme, 40 enum wlan_vdev_sm_evt event, 41 uint16_t event_data_len, 42 void *event_data); 43 44 #ifdef SM_ENG_HIST_ENABLE 45 /** 46 * mlme_vdev_sm_history_print() - Prints SM history 47 * @vdev_mlme: MLME VDEV comp object 48 * 49 * API to print SM history 50 * 51 * Return: void 52 */ 53 void mlme_vdev_sm_history_print(struct vdev_mlme_obj *vdev_mlme); 54 #endif 55 56 #endif 57 58 /** 59 * mlme_vdev_sm_create - Invoke SME creation for VDEV 60 * @vdev_mlme_obj: VDEV MLME comp object 61 * 62 * API allocates VDEV MLME SM and initializes SM lock 63 * 64 * Return: SUCCESS on successful allocation 65 * FAILURE, if registration fails 66 */ 67 QDF_STATUS mlme_vdev_sm_create(struct vdev_mlme_obj *vdev_mlme); 68 69 /** 70 * mlme_vdev_sm_destroy - Invoke SME destroy for VDEV 71 * @vdev_mlme_obj: VDEV MLME comp object 72 * 73 * API frees VDEV MLME SM and destroys the SM lock 74 * 75 * Return: SUCCESS on successful destroy 76 * FAILURE, if registration fails 77 */ 78 QDF_STATUS mlme_vdev_sm_destroy(struct vdev_mlme_obj *vdev_mlme); 79 80 #ifdef VDEV_SM_LOCK_SUPPORT 81 /** 82 * mlme_vdev_sm_spinlock_create - Create VDEV MLME spinlock 83 * @vdev_mlme_obj: VDEV MLME comp object 84 * 85 * Creates VDEV MLME spinlock 86 * 87 * Return: void 88 */ 89 static inline void mlme_vdev_sm_spinlock_create(struct vdev_mlme_obj *vdev_mlme) 90 { 91 qdf_spinlock_create(&vdev_mlme->sm_lock); 92 } 93 94 /** 95 * mlme_vdev_sm_spinlock_destroy - Destroy VDEV MLME spinlock 96 * @vdev_mlme_obj: VDEV MLME comp object 97 * 98 * Destroy VDEV MLME spinlock 99 * 100 * Return: void 101 */ 102 static inline void mlme_vdev_sm_spinlock_destroy( 103 struct vdev_mlme_obj *vdev_mlme) 104 { 105 qdf_spinlock_destroy(&vdev_mlme->sm_lock); 106 } 107 108 /** 109 * mlme_vdev_sm_spin_lock - acquire spinlock 110 * @vdev_mlme_obj: vdev mlme comp object 111 * 112 * acquire vdev mlme spinlock 113 * 114 * return: void 115 */ 116 static inline void mlme_vdev_sm_spin_lock(struct vdev_mlme_obj *vdev_mlme) 117 { 118 qdf_spin_lock_bh(&vdev_mlme->sm_lock); 119 } 120 121 /** 122 * mlme_vdev_sm_spin_unlock - release spinlock 123 * @vdev_mlme_obj: vdev mlme comp object 124 * 125 * release vdev mlme spinlock 126 * 127 * return: void 128 */ 129 static inline void mlme_vdev_sm_spin_unlock(struct vdev_mlme_obj *vdev_mlme) 130 { 131 qdf_spin_unlock_bh(&vdev_mlme->sm_lock); 132 } 133 134 #else 135 static inline void mlme_vdev_sm_spinlock_create(struct vdev_mlme_obj *vdev_mlme) 136 { 137 mlme_info("VDEV SM lock is disabled!!!"); 138 } 139 140 static inline void mlme_vdev_sm_spinlock_destroy( 141 struct vdev_mlme_obj *vdev_mlme) 142 { 143 mlme_info("VDEV SM lock is disabled!!!"); 144 } 145 146 static inline void mlme_vdev_sm_spin_lock(struct vdev_mlme_obj *vdev_mlme) 147 { 148 } 149 150 static inline void mlme_vdev_sm_spin_unlock(struct vdev_mlme_obj *vdev_mlme) 151 { 152 } 153 #endif 154 #endif 155