xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlo_mgr/inc/wlan_mlo_mgr_msgq.h (revision 8cfe6b10058a04cafb17eed051f2ddf11bee8931)
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  * @is_disassoc: flag indicates that disassoc frame needs to be sent
102  */
103 struct peer_deauth_notify_s {
104 	struct wlan_objmgr_peer *peer;
105 	uint8_t is_disassoc;
106 };
107 
108 /*
109  * struct peer_auth_process_notif_s - MLO peer pending auth notification
110  * @auth_params: Auth param structure
111  */
112 struct peer_auth_process_notif_s {
113 	struct mlpeer_auth_params *auth_params;
114 };
115 
116 /*
117  * union msg_payload - MLO message payload
118  * @peer_create: peer create notification structure
119  * @peer_assoc: peer assoc notification structure
120  * @peer_assoc_fail: peer assoc fail notification structure
121  * @peer_disconn: peer disconnect notification structure
122  * @peer_deauth: peer deauth notification structure
123  * @peer_auth_process: Peer Auth process notification structure
124  */
125 union msg_payload {
126 	struct peer_create_notif_s peer_create;
127 	struct peer_assoc_notify_s peer_assoc;
128 	struct peer_assoc_fail_notify_s peer_assoc_fail;
129 	struct peer_discon_notify_s peer_disconn;
130 	struct peer_deauth_notify_s peer_deauth;
131 	struct peer_auth_process_notif_s peer_auth;
132 };
133 
134 #define MLO_MAX_MSGQ_SIZE 256
135 /*
136  * struct mlo_ctxt_switch_msg_s - MLO ctxt switch message
137  * @type: peer create notification structure
138  * @peer_assoc: peer assoc notification structure
139  * @peer_assoc_fail: peer assoc fail notification structure
140  * @peer_disconn: peer disconnect notification structure
141  */
142 struct mlo_ctxt_switch_msg_s {
143 	qdf_list_node_t node;
144 	enum mlo_msg_type type;
145 	struct wlan_mlo_dev_context *ml_dev;
146 	union msg_payload m;
147 };
148 
149 /**
150  * mlo_msgq_post() - Posts message to defer context
151  * @type: msg tupe
152  * @ml_dev: MLO dev context
153  * @payload: msg buf
154  *
155  * This function post message to defer context queue for defer processing
156  *
157  * Return: SUCCESS if msg is posted
158  */
159 QDF_STATUS mlo_msgq_post(enum mlo_msg_type type,
160 			 struct wlan_mlo_dev_context *ml_dev,
161 			 void *payload);
162 
163 /**
164  * mlo_msgq_init() - Init MLO message queue
165  *
166  * This function initializes MLO msg queue module
167  *
168  * Return: void
169  */
170 void mlo_msgq_init(void);
171 
172 /**
173  * mlo_msgq_free() - Free MLO message queue
174  *
175  * This function frees MLO msg queue module
176  *
177  * Return: void
178  */
179 void mlo_msgq_free(void);
180 #endif
181