1 /* 2 * Copyright (c) 2021, The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2023 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 * @MLO_BRIDGE_PEER_CREATE: Bridge peer create 51 * @MLO_PEER_REASSOC: Partner peer reassoc 52 */ 53 enum mlo_msg_type { 54 MLO_PEER_CREATE, 55 MLO_PEER_ASSOC, 56 MLO_PEER_ASSOC_FAIL, 57 MLO_PEER_DISCONNECT, 58 MLO_PEER_DEAUTH, 59 MLO_PEER_PENDING_AUTH, 60 MLO_BRIDGE_PEER_CREATE, 61 MLO_PEER_REASSOC, 62 }; 63 64 /* 65 * struct peer_create_notif_s - MLO partner peer create notification 66 * @vdev_link: Link VDEV 67 * @ml_peer: ML peer to attached 68 * @addr: Link MAC address 69 * @frm_buf: Assoc request buffer 70 */ 71 struct peer_create_notif_s { 72 struct wlan_objmgr_vdev *vdev_link; 73 struct wlan_mlo_peer_context *ml_peer; 74 struct qdf_mac_addr addr; 75 qdf_nbuf_t frm_buf; 76 }; 77 78 /* 79 * struct peer_assoc_notify_s - MLO partner peer assoc notification 80 * @peer: Link peer on which Peer ASSOC to be sent 81 */ 82 struct peer_assoc_notify_s { 83 struct wlan_objmgr_peer *peer; 84 }; 85 86 /* 87 * struct peer_assoc_fail_notify_s - MLO partner peer assoc fail notification 88 * @peer: Link peer on which Peer assoc resp failure to be sent 89 */ 90 struct peer_assoc_fail_notify_s { 91 struct wlan_objmgr_peer *peer; 92 }; 93 94 /* 95 * struct peer_discon_notify_s - MLO partner peer disconnect notification 96 * @peer: Link peer on which Peer disconnect to be sent 97 */ 98 struct peer_discon_notify_s { 99 struct wlan_objmgr_peer *peer; 100 }; 101 102 /* 103 * struct peer_deauth_notify_s - MLO partner peer deauth notification 104 * @peer: Link peer on which Peer deauth to be sent 105 * @is_disassoc: flag indicates that disassoc frame needs to be sent 106 */ 107 struct peer_deauth_notify_s { 108 struct wlan_objmgr_peer *peer; 109 uint8_t is_disassoc; 110 }; 111 112 /* 113 * struct peer_auth_process_notif_s - MLO peer pending auth notification 114 * @auth_params: Auth param structure 115 */ 116 struct peer_auth_process_notif_s { 117 struct mlpeer_auth_params *auth_params; 118 }; 119 120 /* 121 * union msg_payload - MLO message payload 122 * @peer_create: peer create notification structure 123 * @peer_assoc: peer assoc notification structure 124 * @peer_assoc_fail: peer assoc fail notification structure 125 * @peer_disconn: peer disconnect notification structure 126 * @peer_deauth: peer deauth notification structure 127 * @peer_auth_process: Peer Auth process notification structure 128 */ 129 union msg_payload { 130 struct peer_create_notif_s peer_create; 131 struct peer_assoc_notify_s peer_assoc; 132 struct peer_assoc_fail_notify_s peer_assoc_fail; 133 struct peer_discon_notify_s peer_disconn; 134 struct peer_deauth_notify_s peer_deauth; 135 struct peer_auth_process_notif_s peer_auth; 136 }; 137 138 #define MLO_MAX_MSGQ_SIZE 256 139 /* 140 * struct mlo_ctxt_switch_msg_s - MLO ctxt switch message 141 * @type: peer create notification structure 142 * @peer_assoc: peer assoc notification structure 143 * @peer_assoc_fail: peer assoc fail notification structure 144 * @peer_disconn: peer disconnect notification structure 145 */ 146 struct mlo_ctxt_switch_msg_s { 147 qdf_list_node_t node; 148 enum mlo_msg_type type; 149 struct wlan_mlo_dev_context *ml_dev; 150 union msg_payload m; 151 }; 152 153 /** 154 * mlo_msgq_post() - Posts message to defer context 155 * @type: msg tupe 156 * @ml_dev: MLO dev context 157 * @payload: msg buf 158 * 159 * This function post message to defer context queue for defer processing 160 * 161 * Return: SUCCESS if msg is posted 162 */ 163 QDF_STATUS mlo_msgq_post(enum mlo_msg_type type, 164 struct wlan_mlo_dev_context *ml_dev, 165 void *payload); 166 167 /** 168 * mlo_msgq_init() - Init MLO message queue 169 * 170 * This function initializes MLO msg queue module 171 * 172 * Return: void 173 */ 174 void mlo_msgq_init(void); 175 176 /** 177 * mlo_msgq_free() - Free MLO message queue 178 * 179 * This function frees MLO msg queue module 180 * 181 * Return: void 182 */ 183 void mlo_msgq_free(void); 184 #endif 185