1 /* 2 * Copyright (c) 2021, The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18 /* 19 * DOC: contains mlo manager msgq structure definitions 20 */ 21 22 #ifndef __MLO_MGR_MSGQ_H 23 #define __MLO_MGR_MSGQ_H 24 25 /* 26 * struct ctxt_switch_mgr - MLO context switch manager 27 * @ctxt_mgr_timer: Timer to process messages 28 * @msgq_list: list to hold pending messages 29 * @ctxt_lock: Lock to have atomic context 30 * @timer_started: indicates whether timer is running 31 * @max_messages_procd: Max messages can be stored 32 */ 33 struct ctxt_switch_mgr { 34 qdf_timer_t ctxt_mgr_timer; 35 qdf_list_t msgq_list; 36 qdf_spinlock_t ctxt_lock; 37 bool timer_started; 38 bool allow_msg; 39 uint16_t max_messages_procd; 40 }; 41 42 /* 43 * enum mlo_msg_type – MLO partner peer message type 44 * @MLO_PEER_CREATE: Partner peer create 45 * @MLO_PEER_ASSOC: Partner peer ASSOC 46 * @MLO_PEER_ASSOC_FAIL: Partner peer ASSOC failure 47 * @MLO_PEER_DISCONNECT: Partner peer Disconnect 48 * @MLO_PEER_DEAUTH: Initiate Deauth for ML connection 49 * @MLO_PEER_PENDING_AUTH: Initiate process of pending auth 50 */ 51 enum mlo_msg_type { 52 MLO_PEER_CREATE, 53 MLO_PEER_ASSOC, 54 MLO_PEER_ASSOC_FAIL, 55 MLO_PEER_DISCONNECT, 56 MLO_PEER_DEAUTH, 57 MLO_PEER_PENDING_AUTH, 58 }; 59 60 /* 61 * struct peer_create_notif_s - MLO partner peer create notification 62 * @vdev_link: Link VDEV 63 * @ml_peer: ML peer to attached 64 * @addr: Link MAC address 65 * @frm_buf: Assoc request buffer 66 */ 67 struct peer_create_notif_s { 68 struct wlan_objmgr_vdev *vdev_link; 69 struct wlan_mlo_peer_context *ml_peer; 70 struct qdf_mac_addr addr; 71 qdf_nbuf_t frm_buf; 72 }; 73 74 /* 75 * struct peer_assoc_notify_s - MLO partner peer assoc notification 76 * @peer: Link peer on which Peer ASSOC to be sent 77 */ 78 struct peer_assoc_notify_s { 79 struct wlan_objmgr_peer *peer; 80 }; 81 82 /* 83 * struct peer_assoc_fail_notify_s - MLO partner peer assoc fail notification 84 * @peer: Link peer on which Peer assoc resp failure to be sent 85 */ 86 struct peer_assoc_fail_notify_s { 87 struct wlan_objmgr_peer *peer; 88 }; 89 90 /* 91 * struct peer_discon_notify_s - MLO partner peer disconnect notification 92 * @peer: Link peer on which Peer disconnect to be sent 93 */ 94 struct peer_discon_notify_s { 95 struct wlan_objmgr_peer *peer; 96 }; 97 98 /* 99 * struct peer_deauth_notify_s - MLO partner peer deauth notification 100 * @peer: Link peer on which Peer deauth to be sent 101 */ 102 struct peer_deauth_notify_s { 103 struct wlan_objmgr_peer *peer; 104 }; 105 106 /* 107 * struct peer_auth_process_notif_s - MLO peer pending auth notification 108 * @auth_params: Auth param structure 109 */ 110 struct peer_auth_process_notif_s { 111 struct mlpeer_auth_params *auth_params; 112 }; 113 114 /* 115 * union msg_payload - MLO message payload 116 * @peer_create: peer create notification structure 117 * @peer_assoc: peer assoc notification structure 118 * @peer_assoc_fail: peer assoc fail notification structure 119 * @peer_disconn: peer disconnect notification structure 120 * @peer_deauth: peer deauth notification structure 121 * @peer_auth_process: Peer Auth process notification structure 122 */ 123 union msg_payload { 124 struct peer_create_notif_s peer_create; 125 struct peer_assoc_notify_s peer_assoc; 126 struct peer_assoc_fail_notify_s peer_assoc_fail; 127 struct peer_discon_notify_s peer_disconn; 128 struct peer_deauth_notify_s peer_deauth; 129 struct peer_auth_process_notif_s peer_auth; 130 }; 131 132 #define MLO_MAX_MSGQ_SIZE 256 133 /* 134 * struct mlo_ctxt_switch_msg_s - MLO ctxt switch message 135 * @type: peer create notification structure 136 * @peer_assoc: peer assoc notification structure 137 * @peer_assoc_fail: peer assoc fail notification structure 138 * @peer_disconn: peer disconnect notification structure 139 */ 140 struct mlo_ctxt_switch_msg_s { 141 qdf_list_node_t node; 142 enum mlo_msg_type type; 143 struct wlan_mlo_dev_context *ml_dev; 144 union msg_payload m; 145 }; 146 147 /** 148 * mlo_msgq_post() - Posts message to defer context 149 * @type: msg tupe 150 * @ml_dev: MLO dev context 151 * @payload: msg buf 152 * 153 * This function post message to defer context queue for defer processing 154 * 155 * Return: SUCCESS if msg is posted 156 */ 157 QDF_STATUS mlo_msgq_post(enum mlo_msg_type type, 158 struct wlan_mlo_dev_context *ml_dev, 159 void *payload); 160 161 /** 162 * mlo_msgq_init() - Init MLO message queue 163 * 164 * This function initializes MLO msg queue module 165 * 166 * Return: void 167 */ 168 void mlo_msgq_init(void); 169 170 /** 171 * mlo_msgq_free() - Free MLO message queue 172 * 173 * This function frees MLO msg queue module 174 * 175 * Return: void 176 */ 177 void mlo_msgq_free(void); 178 #endif 179