xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/mgmt_txrx/core/src/wlan_mgmt_txrx_rx_reo_i.h (revision d0c05845839e5f2ba5a8dcebe0cd3e4cd4e8dfcf)
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: wlan_mgmt_txrx_rx_reo_i.h
20  *  This file contains mgmt rx re-ordering related APIs
21  */
22 
23 #ifndef _WLAN_MGMT_TXRX_RX_REO_I_H
24 #define _WLAN_MGMT_TXRX_RX_REO_I_H
25 
26 #ifdef WLAN_MGMT_RX_REO_SUPPORT
27 #include <qdf_list.h>
28 #include <qdf_timer.h>
29 #include <qdf_lock.h>
30 #include <qdf_nbuf.h>
31 #include <qdf_threads.h>
32 #include <qdf_defer.h>
33 #include <wlan_mgmt_txrx_rx_reo_utils_api.h>
34 #include <wlan_mgmt_txrx_rx_reo_public_structs.h>
35 #include <wlan_objmgr_pdev_obj.h>
36 #include <wlan_objmgr_psoc_obj.h>
37 #include <wlan_mlo_mgr_public_structs.h>
38 
39 #define MGMT_RX_REO_LIST_MAX_SIZE             (100)
40 #define MGMT_RX_REO_LIST_TIMEOUT_US           (500 * USEC_PER_MSEC)
41 #define MGMT_RX_REO_AGEOUT_TIMER_PERIOD_MS    (250)
42 #define MGMT_RX_REO_GLOBAL_MGMT_RX_INACTIVITY_TIMEOUT   (10 * 60 * MSEC_PER_SEC)
43 #define MGMT_RX_REO_STATUS_WAIT_FOR_FRAME_ON_OTHER_LINKS         (BIT(0))
44 #define MGMT_RX_REO_STATUS_AGED_OUT                              (BIT(1))
45 #define MGMT_RX_REO_STATUS_OLDER_THAN_LATEST_AGED_OUT_FRAME      (BIT(2))
46 #define MGMT_RX_REO_STATUS_LIST_MAX_SIZE_EXCEEDED                (BIT(3))
47 
48 #define MGMT_RX_REO_INVALID_LINK_ID   (-1)
49 
50 /* Reason to release an entry from the reorder list */
51 #define MGMT_RX_REO_LIST_ENTRY_RELEASE_REASON_ZERO_WAIT_COUNT           (BIT(0))
52 #define MGMT_RX_REO_LIST_ENTRY_RELEASE_REASON_AGED_OUT                  (BIT(1))
53 #define MGMT_RX_REO_LIST_ENTRY_RELEASE_REASON_OLDER_THAN_AGED_OUT_FRAME (BIT(2))
54 #define MGMT_RX_REO_LIST_ENTRY_RELEASE_REASON_LIST_MAX_SIZE_EXCEEDED    (BIT(3))
55 #define MGMT_RX_REO_RELEASE_REASON_MAX      \
56 	(MGMT_RX_REO_LIST_ENTRY_RELEASE_REASON_LIST_MAX_SIZE_EXCEEDED << 1)
57 
58 #define MGMT_RX_REO_LIST_ENTRY_IS_WAITING_FOR_FRAME_ON_OTHER_LINK(entry)   \
59 	((entry)->status & MGMT_RX_REO_STATUS_WAIT_FOR_FRAME_ON_OTHER_LINKS)
60 #define MGMT_RX_REO_LIST_ENTRY_IS_AGED_OUT(entry)   \
61 	((entry)->status & MGMT_RX_REO_STATUS_AGED_OUT)
62 #define MGMT_RX_REO_LIST_ENTRY_IS_OLDER_THAN_LATEST_AGED_OUT_FRAME(entry)  \
63 	((entry)->status & MGMT_RX_REO_STATUS_OLDER_THAN_LATEST_AGED_OUT_FRAME)
64 #define MGMT_RX_REO_LIST_ENTRY_IS_MAX_SIZE_EXCEEDED(entry)  \
65 	((entry)->status & MGMT_RX_REO_STATUS_LIST_MAX_SIZE_EXCEEDED)
66 
67 #ifdef WLAN_MGMT_RX_REO_DEBUG_SUPPORT
68 #define MGMT_RX_REO_INGRESS_FRAME_DEBUG_ENTRIES_MAX             (1000)
69 #define MGMT_RX_REO_EGRESS_FRAME_DEBUG_ENTRIES_MAX              (1000)
70 
71 #define MGMT_RX_REO_EGRESS_FRAME_DEBUG_INFO_BOARDER_MAX_SIZE   (816)
72 #define MGMT_RX_REO_EGRESS_FRAME_DELIVERY_REASON_STATS_BOARDER_A_MAX_SIZE  (66)
73 #define MGMT_RX_REO_EGRESS_FRAME_DELIVERY_REASON_STATS_BOARDER_B_MAX_SIZE  (73)
74 #define MGMT_RX_REO_EGRESS_FRAME_DEBUG_INFO_FLAG_MAX_SIZE   (3)
75 #define MGMT_RX_REO_EGRESS_FRAME_DEBUG_INFO_WAIT_COUNT_MAX_SIZE   (69)
76 #define MGMT_RX_REO_EGRESS_FRAME_DEBUG_INFO_PER_LINK_SNAPSHOTS_MAX_SIZE   (94)
77 #define MGMT_RX_REO_EGRESS_FRAME_DEBUG_INFO_SNAPSHOT_MAX_SIZE     (22)
78 
79 #define MGMT_RX_REO_INGRESS_FRAME_DEBUG_INFO_BOARDER_MAX_SIZE   (785)
80 #define MGMT_RX_REO_INGRESS_FRAME_DEBUG_INFO_FLAG_MAX_SIZE   (13)
81 #define MGMT_RX_REO_INGRESS_FRAME_DEBUG_INFO_WAIT_COUNT_MAX_SIZE   (69)
82 #define MGMT_RX_REO_INGRESS_FRAME_DEBUG_INFO_PER_LINK_SNAPSHOTS_MAX_SIZE   (94)
83 #define MGMT_RX_REO_INGRESS_FRAME_DEBUG_INFO_SNAPSHOT_MAX_SIZE     (22)
84 #endif /* WLAN_MGMT_RX_REO_DEBUG_SUPPORT*/
85 
86 /*
87  * struct mgmt_rx_reo_pdev_info - Pdev information required by the Management
88  * Rx REO module
89  * @host_snapshot: Latest snapshot seen at the Host.
90  * It considers both MGMT Rx and MGMT FW consumed.
91  * @last_valid_shared_snapshot: Array of last valid snapshots(for snapshots
92  * shared between host and target)
93  * @host_target_shared_snapshot_info: Array of meta information related to
94  * snapshots(for snapshots shared between host and target)
95  * @filter: MGMT Rx REO filter
96  */
97 struct mgmt_rx_reo_pdev_info {
98 	struct mgmt_rx_reo_snapshot_params host_snapshot;
99 	struct mgmt_rx_reo_snapshot_params last_valid_shared_snapshot
100 				[MGMT_RX_REO_SHARED_SNAPSHOT_MAX];
101 	struct mgmt_rx_reo_snapshot_info host_target_shared_snapshot_info
102 				[MGMT_RX_REO_SHARED_SNAPSHOT_MAX];
103 	struct mgmt_rx_reo_filter filter;
104 	struct mgmt_rx_reo_shared_snapshot raw_snapshots[MAX_MLO_LINKS]
105 			[MGMT_RX_REO_SHARED_SNAPSHOT_MAX]
106 			[MGMT_RX_REO_SNAPSHOT_READ_RETRY_LIMIT]
107 			[MGMT_RX_REO_SNAPSHOT_B2B_READ_SWAR_RETRY_LIMIT];
108 };
109 
110 /**
111  * mgmt_rx_reo_attach() - Initializes the per pdev data structures related to
112  * management rx-reorder module
113  * @pdev: pointer to pdev object
114  *
115  * Return: QDF_STATUS
116  */
117 QDF_STATUS
118 mgmt_rx_reo_attach(struct wlan_objmgr_pdev *pdev);
119 
120 /**
121  * mgmt_rx_reo_detach() - Clears the per pdev data structures related to
122  * management rx-reorder module
123  * @pdev: pointer to pdev object
124  *
125  * Return: QDF_STATUS
126  */
127 QDF_STATUS
128 mgmt_rx_reo_detach(struct wlan_objmgr_pdev *pdev);
129 
130 /**
131  * mgmt_rx_reo_pdev_obj_create_notification() - pdev create handler for
132  * management rx-reorder module
133  * @pdev: pointer to pdev object
134  * @mgmt_txrx_pdev_ctx: pdev private object of mgmt txrx module
135  *
136  * This function gets called from object manager when pdev is being created and
137  * creates management rx-reorder pdev context
138  *
139  * Return: QDF_STATUS
140  */
141 QDF_STATUS
142 mgmt_rx_reo_pdev_obj_create_notification(
143 	struct wlan_objmgr_pdev *pdev,
144 	struct mgmt_txrx_priv_pdev_context *mgmt_txrx_pdev_ctx);
145 
146 /**
147  * mgmt_rx_reo_pdev_obj_destroy_notification() - pdev destroy handler for
148  * management rx-reorder feature
149  * @pdev: pointer to pdev object
150  * @mgmt_txrx_pdev_ctx: pdev private object of mgmt txrx module
151  *
152  * This function gets called from object manager when pdev is being destroyed
153  * and destroys management rx-reorder pdev context
154  *
155  * Return: QDF_STATUS
156  */
157 QDF_STATUS
158 mgmt_rx_reo_pdev_obj_destroy_notification(
159 	struct wlan_objmgr_pdev *pdev,
160 	struct mgmt_txrx_priv_pdev_context *mgmt_txrx_pdev_ctx);
161 
162 /**
163  * enum mgmt_rx_reo_frame_descriptor_type - Enumeration for management frame
164  * descriptor type.
165  * @MGMT_RX_REO_FRAME_DESC_HOST_CONSUMED_FRAME: Management frame to be consumed
166  * by host.
167  * @MGMT_RX_REO_FRAME_DESC_FW_CONSUMED_FRAME: Management frame consumed by FW
168  * @MGMT_RX_REO_FRAME_DESC_ERROR_FRAME: Management frame which got dropped
169  * at host due to any error
170  * @MGMT_RX_REO_FRAME_DESC_TYPE_MAX: Maximum number of frame types
171  */
172 enum mgmt_rx_reo_frame_descriptor_type {
173 	MGMT_RX_REO_FRAME_DESC_HOST_CONSUMED_FRAME = 0,
174 	MGMT_RX_REO_FRAME_DESC_FW_CONSUMED_FRAME,
175 	MGMT_RX_REO_FRAME_DESC_ERROR_FRAME,
176 	MGMT_RX_REO_FRAME_DESC_TYPE_MAX,
177 };
178 
179 /**
180  * struct mgmt_rx_reo_global_ts_info - This structure holds the global time
181  * stamp information of a frame.
182  * @valid: Indicates whether global time stamp is valid
183  * @global_ts: Global time stamp value
184  * @start_ts: Start time stamp value
185  * @end_ts: End time stamp value
186  */
187 struct mgmt_rx_reo_global_ts_info {
188 	bool valid;
189 	uint32_t global_ts;
190 	uint32_t start_ts;
191 	uint32_t end_ts;
192 };
193 
194 /**
195  * struct mgmt_rx_reo_list – Linked list used to reorder the management frames
196  * received. Each list entry would correspond to a management frame. List
197  * entries would be sorted in the same order in which they are received by MAC
198  * HW.
199  * @list: List used for reordering
200  * @list_lock: Lock to protect the list
201  * @max_list_size: Maximum size of the reorder list
202  * @list_entry_timeout_us: Time out value(microsecond) for the reorder list
203  * entries
204  * @ageout_timer: Periodic timer to age-out the list entries
205  * @global_mgmt_rx_inactivity_timer: Global management Rx inactivity timer
206  * @ts_last_released_frame: Stores the global time stamp for the last frame
207  * removed from the reorder list
208  */
209 struct mgmt_rx_reo_list {
210 	qdf_list_t list;
211 	qdf_spinlock_t list_lock;
212 	uint32_t max_list_size;
213 	uint32_t list_entry_timeout_us;
214 	qdf_timer_t ageout_timer;
215 	qdf_timer_t global_mgmt_rx_inactivity_timer;
216 	struct mgmt_rx_reo_global_ts_info ts_last_released_frame;
217 };
218 
219 /*
220  * struct mgmt_rx_reo_wait_count - Wait count for a mgmt frame
221  * @per_link_count: Array of wait counts for all MLO links. Each array entry
222  * holds the number of frames this mgmt frame should wait for on that
223  * particular link.
224  * @total_count: Sum of entries in @per_link_count
225  */
226 struct mgmt_rx_reo_wait_count {
227 	unsigned int per_link_count[MAX_MLO_LINKS];
228 	unsigned long long int total_count;
229 };
230 
231 /**
232  * struct mgmt_rx_reo_list_entry - Entry in the Management reorder list
233  * @node: List node
234  * @nbuf: nbuf corresponding to this frame
235  * @rx_params: Management rx event parameters
236  * @wait_count: Wait counts for the frame
237  * @initial_wait_count: Wait count when the frame is queued
238  * @insertion_ts: Host time stamp when this entry is inserted to the list.
239  * @removal_ts: Host time stamp when this entry is removed from the list
240  * @ingress_timestamp: Host time stamp when this frame has arrived reorder
241  * module
242  * @egress_timestamp: Host time stamp when this frame has exited reorder
243  * module
244  * @status: Status for this entry
245  * @pdev: Pointer to pdev object corresponding to this frame
246  * @release_reason: Release reason
247  * @is_delivered: Indicates whether the frame is delivered successfully
248  * @is_premature_delivery: Indicates whether the frame is delivered
249  * prematurely
250  * @is_parallel_rx: Indicates that this frame is received in parallel to the
251  * last frame which is delivered to the upper layer.
252  * @shared_snapshots: snapshots shared b/w host and target
253  * @host_snapshot: host snapshot
254  */
255 struct mgmt_rx_reo_list_entry {
256 	qdf_list_node_t node;
257 	qdf_nbuf_t nbuf;
258 	struct mgmt_rx_event_params *rx_params;
259 	struct mgmt_rx_reo_wait_count wait_count;
260 	struct mgmt_rx_reo_wait_count initial_wait_count;
261 	uint64_t insertion_ts;
262 	uint64_t removal_ts;
263 	uint64_t ingress_timestamp;
264 	uint64_t egress_timestamp;
265 	uint32_t status;
266 	struct wlan_objmgr_pdev *pdev;
267 	uint8_t release_reason;
268 	bool is_delivered;
269 	bool is_premature_delivery;
270 	bool is_parallel_rx;
271 	struct mgmt_rx_reo_snapshot_params shared_snapshots
272 			[MAX_MLO_LINKS][MGMT_RX_REO_SHARED_SNAPSHOT_MAX];
273 	struct mgmt_rx_reo_snapshot_params host_snapshot[MAX_MLO_LINKS];
274 };
275 
276 #ifdef WLAN_MGMT_RX_REO_SIM_SUPPORT
277 
278 #define MGMT_RX_REO_SIM_INTER_FRAME_DELAY_MIN             (300 * USEC_PER_MSEC)
279 #define MGMT_RX_REO_SIM_INTER_FRAME_DELAY_MIN_MAX_DELTA   (200 * USEC_PER_MSEC)
280 
281 #define MGMT_RX_REO_SIM_DELAY_MAC_HW_TO_FW_MIN            (1000 * USEC_PER_MSEC)
282 #define MGMT_RX_REO_SIM_DELAY_MAC_HW_TO_FW_MIN_MAX_DELTA  (500 * USEC_PER_MSEC)
283 
284 #define MGMT_RX_REO_SIM_DELAY_FW_TO_HOST_MIN              (1000 * USEC_PER_MSEC)
285 #define MGMT_RX_REO_SIM_DELAY_FW_TO_HOST_MIN_MAX_DELTA    (500 * USEC_PER_MSEC)
286 
287 #define MGMT_RX_REO_SIM_PERCENTAGE_FW_CONSUMED_FRAMES  (10)
288 #define MGMT_RX_REO_SIM_PERCENTAGE_ERROR_FRAMES        (10)
289 
290 #define MGMT_RX_REO_SIM_PENDING_FRAME_LIST_MAX_SIZE    (1000)
291 #define MGMT_RX_REO_SIM_STALE_FRAME_LIST_MAX_SIZE      \
292 				(MGMT_RX_REO_SIM_PENDING_FRAME_LIST_MAX_SIZE)
293 #define MGMT_RX_REO_SIM_STALE_FRAME_TEMP_LIST_MAX_SIZE (100)
294 
295 /**
296  * struct mgmt_rx_frame_params - Parameters associated with a management frame.
297  * This structure is used by the simulation framework.
298  * @link_id: MLO HW link id
299  * @mgmt_pkt_ctr: Management packet counter
300  * @global_timestamp: Global time stamp in micro seconds
301  */
302 struct mgmt_rx_frame_params {
303 	uint8_t link_id;
304 	uint16_t mgmt_pkt_ctr;
305 	uint32_t global_timestamp;
306 };
307 
308 /**
309  * struct mgmt_rx_reo_master_frame_list - List which contains all the
310  * management frames received and not yet consumed by FW/Host. Order of frames
311  * in the list is same as the order in which they are received in the air.
312  * This is used by the simulation framework to confirm that the outcome of
313  * reordering is correct.
314  * @pending_list: List which contains all the frames received after the
315  * last frame delivered to upper layer. These frames will eventually reach host.
316  * @stale_list: List which contains all the stale management frames which
317  * are not yet consumed by FW/Host. Stale management frames are the frames which
318  * are older than last delivered frame to upper layer.
319  * @lock: Spin lock to protect pending frame list and stale frame list.
320  */
321 struct mgmt_rx_reo_master_frame_list {
322 	qdf_list_t pending_list;
323 	qdf_list_t stale_list;
324 	qdf_spinlock_t lock;
325 };
326 
327 /**
328  * struct mgmt_rx_reo_pending_frame_list_entry - Structure used to represent an
329  * entry in the pending frame list.
330  * @params: parameters related to the management frame
331  * @node: linked list node
332  */
333 struct mgmt_rx_reo_pending_frame_list_entry {
334 	struct mgmt_rx_frame_params params;
335 	qdf_list_node_t node;
336 };
337 
338 /**
339  * struct mgmt_rx_reo_stale_frame_list_entry - Structure used to represent an
340  * entry in the stale frame list.
341  * @params: parameters related to the management frame
342  * @node: linked list node
343  */
344 struct mgmt_rx_reo_stale_frame_list_entry {
345 	struct mgmt_rx_frame_params params;
346 	qdf_list_node_t node;
347 };
348 
349 /**
350  * struct mgmt_rx_frame_mac_hw - Structure used to represent the management
351  * frame at MAC HW level
352  * @params: parameters related to the management frame
353  * @frame_handler_fw: Work structure to queue the frame to the FW
354  * @sim_context: pointer management rx-reorder simulation context
355  */
356 struct mgmt_rx_frame_mac_hw {
357 	struct mgmt_rx_frame_params params;
358 	qdf_work_t frame_handler_fw;
359 	struct mgmt_rx_reo_sim_context *sim_context;
360 };
361 
362 /**
363  * struct mgmt_rx_frame_fw - Structure used to represent the management
364  * frame at FW level
365  * @params: parameters related to the management frame
366  * @is_consumed_by_fw: indicates whether the frame is consumed by FW
367  * @frame_handler_host: Work structure to queue the frame to the host
368  * @sim_context: pointer management rx-reorder simulation context
369  */
370 struct mgmt_rx_frame_fw {
371 	struct mgmt_rx_frame_params params;
372 	bool is_consumed_by_fw;
373 	qdf_work_t frame_handler_host;
374 	struct mgmt_rx_reo_sim_context *sim_context;
375 };
376 
377 /**
378  * struct mgmt_rx_reo_sim_mac_hw - Structure used to represent the MAC HW
379  * @mgmt_pkt_ctr: Stores the last management packet counter for all the links
380  */
381 struct mgmt_rx_reo_sim_mac_hw {
382 	uint16_t mgmt_pkt_ctr[MAX_MLO_LINKS];
383 };
384 
385 /**
386  * struct mgmt_rx_reo_sim_link_id_to_pdev_map - Map from link id to pdev
387  * object. This is used for simulation purpose only.
388  * @map: link id to pdev map. Link id is the array index.
389  * @lock: lock used to protect this structure
390  * @num_mlo_links: Total number of MLO HW links. In case of simulation all the
391  * pdevs are assumed to have MLO capability and number of MLO links is same as
392  * the number of pdevs in the system.
393  * @valid_link_list: List of valid link id values
394  */
395 struct mgmt_rx_reo_sim_link_id_to_pdev_map {
396 	struct wlan_objmgr_pdev *map[MAX_MLO_LINKS];
397 	qdf_spinlock_t lock;
398 	uint8_t num_mlo_links;
399 	int8_t valid_link_list[MAX_MLO_LINKS];
400 };
401 
402 /**
403  * struct mgmt_rx_reo_mac_hw_simulator - Structure which stores the members
404  * required for the MAC HW simulation
405  * @mac_hw_info: MAC HW info
406  * @mac_hw_thread: kthread which simulates MAC HW
407  */
408 struct mgmt_rx_reo_mac_hw_simulator {
409 	struct mgmt_rx_reo_sim_mac_hw mac_hw_info;
410 	qdf_thread_t *mac_hw_thread;
411 };
412 
413 /**
414  * struct mgmt_rx_reo_sim_context - Management rx-reorder simulation context
415  * @host_mgmt_frame_handler: Per link work queue to simulate the host layer
416  * @fw_mgmt_frame_handler: Per link work queue to simulate the FW layer
417  * @master_frame_list: List used to store information about all the management
418  * frames
419  * @mac_hw_sim:  MAC HW simulation object
420  * @snapshot: snapshots required for reo algorithm
421  * @link_id_to_pdev_map: link_id to pdev object map
422  */
423 struct mgmt_rx_reo_sim_context {
424 	struct workqueue_struct *host_mgmt_frame_handler[MAX_MLO_LINKS];
425 	struct workqueue_struct *fw_mgmt_frame_handler[MAX_MLO_LINKS];
426 	struct mgmt_rx_reo_master_frame_list master_frame_list;
427 	struct mgmt_rx_reo_mac_hw_simulator mac_hw_sim;
428 	struct mgmt_rx_reo_snapshot snapshot[MAX_MLO_LINKS]
429 					    [MGMT_RX_REO_SHARED_SNAPSHOT_MAX];
430 	struct mgmt_rx_reo_sim_link_id_to_pdev_map link_id_to_pdev_map;
431 };
432 #endif /* WLAN_MGMT_RX_REO_SIM_SUPPORT */
433 
434 #ifdef WLAN_MGMT_RX_REO_DEBUG_SUPPORT
435 /**
436  * struct reo_ingress_debug_frame_info - Debug information about a frame
437  * entering reorder algorithm
438  * @link_id: link id
439  * @mgmt_pkt_ctr: management packet counter
440  * @global_timestamp: MLO global time stamp
441  * @start_timestamp: start time stamp of the frame
442  * @end_timestamp: end time stamp of the frame
443  * @duration_us: duration of the frame in us
444  * @desc_type: Type of the frame descriptor
445  * @frame_type: frame type
446  * @frame_subtype: frame sub type
447  * @ingress_timestamp: Host time stamp when the frames enters the reorder
448  * algorithm
449  * @ingress_duration: Duration in us for processing the incoming frame.
450  * ingress_duration = Time stamp at which reorder list update is done -
451  * Time stamp at which frame has entered the reorder module
452  * @wait_count: Wait count calculated for the current frame
453  * @is_queued: Indicates whether this frame is queued to reorder list
454  * @is_stale: Indicates whether this frame is stale.
455  * @is_parallel_rx: Indicates that this frame is received in parallel to the
456  * last frame which is delivered to the upper layer.
457  * @zero_wait_count_rx: Indicates whether this frame's wait count was
458  * zero when received by host
459  * @immediate_delivery: Indicates whether this frame can be delivered
460  * immediately to the upper layers
461  * @is_error: Indicates whether any error occurred during processing this frame
462  * @ts_last_released_frame: Stores the global time stamp for the last frame
463  * removed from the reorder list
464  * @list_size_rx: Size of the reorder list when this frame is received (before
465  * updating the list based on this frame).
466  * @list_insertion_pos: Position in the reorder list where this frame is going
467  * to get inserted (Applicable for only host consumed frames)
468  * @shared_snapshots: snapshots shared b/w host and target
469  * @host_snapshot: host snapshot
470  * @cpu_id: CPU index
471  * @reo_required: Indicates whether reorder is required for the current frame.
472  * If reorder is not required, current frame will just be used for updating the
473  * wait count of frames already part of the reorder list.
474  */
475 struct reo_ingress_debug_frame_info {
476 	uint8_t link_id;
477 	uint16_t mgmt_pkt_ctr;
478 	uint32_t global_timestamp;
479 	uint32_t start_timestamp;
480 	uint32_t end_timestamp;
481 	uint32_t duration_us;
482 	enum mgmt_rx_reo_frame_descriptor_type desc_type;
483 	uint8_t frame_type;
484 	uint8_t frame_subtype;
485 	uint64_t ingress_timestamp;
486 	uint64_t ingress_duration;
487 	struct mgmt_rx_reo_wait_count wait_count;
488 	bool is_queued;
489 	bool is_stale;
490 	bool is_parallel_rx;
491 	bool zero_wait_count_rx;
492 	bool immediate_delivery;
493 	bool is_error;
494 	struct mgmt_rx_reo_global_ts_info ts_last_released_frame;
495 	int16_t list_size_rx;
496 	int16_t list_insertion_pos;
497 	struct mgmt_rx_reo_snapshot_params shared_snapshots
498 			[MAX_MLO_LINKS][MGMT_RX_REO_SHARED_SNAPSHOT_MAX];
499 	struct mgmt_rx_reo_snapshot_params host_snapshot[MAX_MLO_LINKS];
500 	int cpu_id;
501 	bool reo_required;
502 };
503 
504 /**
505  * struct reo_egress_debug_frame_info - Debug information about a frame
506  * leaving the reorder module
507  * @is_delivered: Indicates whether the frame is delivered to upper layers
508  * @is_premature_delivery: Indicates whether the frame is delivered
509  * prematurely
510  * @link_id: link id
511  * @mgmt_pkt_ctr: management packet counter
512  * @global_timestamp: MLO global time stamp
513  * @ingress_timestamp: Host time stamp when the frame enters the reorder module
514  * @insertion_ts: Host time stamp when the frame is inserted into the reorder
515  * list
516  * @egress_timestamp: Host time stamp just before delivery of the frame to upper
517  * layer
518  * @egress_duration: Duration in us taken by the upper layer to process
519  * the frame.
520  * @removal_ts: Host time stamp when this entry is removed from the list
521  * @initial_wait_count: Wait count when the frame is queued
522  * @final_wait_count: Wait count when frame is released to upper layer
523  * @release_reason: Reason for delivering the frame to upper layers
524  * @shared_snapshots: snapshots shared b/w host and target
525  * @host_snapshot: host snapshot
526  * @cpu_id: CPU index
527  */
528 struct reo_egress_debug_frame_info {
529 	bool is_delivered;
530 	bool is_premature_delivery;
531 	uint8_t link_id;
532 	uint16_t mgmt_pkt_ctr;
533 	uint32_t global_timestamp;
534 	uint64_t ingress_timestamp;
535 	uint64_t insertion_ts;
536 	uint64_t egress_timestamp;
537 	uint64_t egress_duration;
538 	uint64_t removal_ts;
539 	struct mgmt_rx_reo_wait_count initial_wait_count;
540 	struct mgmt_rx_reo_wait_count final_wait_count;
541 	uint8_t release_reason;
542 	struct mgmt_rx_reo_snapshot_params shared_snapshots
543 			[MAX_MLO_LINKS][MGMT_RX_REO_SHARED_SNAPSHOT_MAX];
544 	struct mgmt_rx_reo_snapshot_params host_snapshot[MAX_MLO_LINKS];
545 	int cpu_id;
546 };
547 
548 /**
549  * struct reo_ingress_frame_stats - Structure to store statistics related to
550  * incoming frames
551  * @ingress_count: Number of frames entering reo module
552  * @queued_count: Number of frames queued to reorder list
553  * @zero_wait_count_rx_count: Number of frames for which wait count is
554  * zero when received at host
555  * @immediate_delivery_count: Number of frames which can be delivered
556  * immediately to the upper layers without reordering. A frame can be
557  * immediately delivered if it has wait count of zero on reception at host
558  * and the global time stamp is less than or equal to the global time
559  * stamp of all the frames in the reorder list. Such frames would get
560  * inserted to the head of the reorder list and gets delivered immediately
561  * to the upper layers.
562  * @stale_count: Number of stale frames. Any frame older than the
563  * last frame delivered to upper layer is a stale frame.
564  * @error_count: Number of frames dropped due to error occurred
565  * within the reorder module
566  */
567 struct reo_ingress_frame_stats {
568 	uint64_t ingress_count
569 		[MAX_MLO_LINKS][MGMT_RX_REO_FRAME_DESC_TYPE_MAX];
570 	uint64_t queued_count[MAX_MLO_LINKS];
571 	uint64_t zero_wait_count_rx_count[MAX_MLO_LINKS];
572 	uint64_t immediate_delivery_count[MAX_MLO_LINKS];
573 	uint64_t stale_count[MAX_MLO_LINKS]
574 			    [MGMT_RX_REO_FRAME_DESC_TYPE_MAX];
575 	uint64_t error_count[MAX_MLO_LINKS]
576 			    [MGMT_RX_REO_FRAME_DESC_TYPE_MAX];
577 };
578 
579 /**
580  * struct reo_egress_frame_stats - Structure to store statistics related to
581  * outgoing frames
582  * @delivery_attempts_count: Number of attempts to deliver management
583  * frames to upper layers
584  * @delivery_success_count: Number of successful management frame
585  * deliveries to upper layer
586  * @premature_delivery_count:  Number of frames delivered
587  * prematurely. Premature delivery is the delivery of a management frame
588  * to the upper layers even before its wait count is reaching zero.
589  * @delivery_count: Number frames delivered successfully for
590  * each link and release  reason.
591  */
592 struct reo_egress_frame_stats {
593 	uint64_t delivery_attempts_count[MAX_MLO_LINKS];
594 	uint64_t delivery_success_count[MAX_MLO_LINKS];
595 	uint64_t premature_delivery_count[MAX_MLO_LINKS];
596 	uint64_t delivery_count[MAX_MLO_LINKS]
597 			       [MGMT_RX_REO_RELEASE_REASON_MAX];
598 };
599 
600 /**
601  * struct reo_ingress_debug_info - Circular array to store the
602  * debug information about the frames entering the reorder algorithm.
603  * @frame_list: Circular array to store the debug info about frames
604  * @next_index: The index at which information about next frame will be logged
605  * @wrap_aroud: Flag to indicate whether wrap around occurred when logging
606  * debug information to @frame_list
607  * @stats: Stats related to incoming frames
608  * @boarder: boarder string
609  */
610 struct reo_ingress_debug_info {
611 	struct reo_ingress_debug_frame_info
612 			frame_list[MGMT_RX_REO_INGRESS_FRAME_DEBUG_ENTRIES_MAX];
613 	int next_index;
614 	bool wrap_aroud;
615 	struct reo_ingress_frame_stats stats;
616 	char boarder[MGMT_RX_REO_INGRESS_FRAME_DEBUG_INFO_BOARDER_MAX_SIZE + 1];
617 };
618 
619 /**
620  * struct reo_egress_debug_info - Circular array to store the
621  * debug information about the frames leaving the reorder module.
622  * @debug_info: Circular array to store the debug info
623  * @next_index: The index at which information about next frame will be logged
624  * @wrap_aroud: Flag to indicate whether wrap around occurred when logging
625  * debug information to @frame_list
626  * @stats: Stats related to outgoing frames
627  * @boarder: boarder string
628  */
629 struct reo_egress_debug_info {
630 	struct reo_egress_debug_frame_info
631 			frame_list[MGMT_RX_REO_EGRESS_FRAME_DEBUG_ENTRIES_MAX];
632 	int next_index;
633 	bool wrap_aroud;
634 	struct reo_egress_frame_stats stats;
635 	char boarder[MGMT_RX_REO_EGRESS_FRAME_DEBUG_INFO_BOARDER_MAX_SIZE + 1];
636 };
637 #endif /* WLAN_MGMT_RX_REO_DEBUG_SUPPORT */
638 
639 /**
640  * struct mgmt_rx_reo_context - This structure holds the info required for
641  * management rx-reordering. Reordering is done across all the psocs.
642  * So there should be only one instance of this structure defined.
643  * @reo_list: Linked list used for reordering
644  * @reo_algo_entry_lock: Spin lock to protect reo algorithm entry critical
645  * section execution
646  * @frame_release_lock: Spin lock to serialize the frame delivery to the
647  * upper layers. This could prevent race conditions like the one given in
648  * the following example.
649  * Lets take an example of 2 links (Link A & B) and each has received
650  * a management frame A1(deauth) and B1(auth) such that MLO global time
651  * stamp of A1 < MLO global time stamp of B1. Host is concurrently
652  * executing "mgmt_rx_reo_list_release_entries" for A1 and B1 in
653  * 2 different CPUs. It is possible that frame B1 gets processed by
654  * upper layers before frame A1 and this could result in unwanted
655  * disconnection. Hence it is required to serialize the delivery
656  * of management frames to upper layers in the strict order of MLO
657  * global time stamp.
658  * @sim_context: Management rx-reorder simulation context
659  * @ingress_frame_debug_info: Debug object to log incoming frames
660  * @egress_frame_debug_info: Debug object to log outgoing frames
661  * @simulation_in_progress: Flag to indicate whether simulation is
662  * in progress
663  */
664 struct mgmt_rx_reo_context {
665 	struct mgmt_rx_reo_list reo_list;
666 	qdf_spinlock_t reo_algo_entry_lock;
667 	qdf_spinlock_t frame_release_lock;
668 #ifdef WLAN_MGMT_RX_REO_SIM_SUPPORT
669 	struct mgmt_rx_reo_sim_context sim_context;
670 #endif /* WLAN_MGMT_RX_REO_SIM_SUPPORT */
671 #ifdef WLAN_MGMT_RX_REO_DEBUG_SUPPORT
672 	struct  reo_ingress_debug_info ingress_frame_debug_info;
673 	struct  reo_egress_debug_info egress_frame_debug_info;
674 #endif /* WLAN_MGMT_RX_REO_DEBUG_SUPPORT */
675 	bool simulation_in_progress;
676 };
677 
678 /**
679  * struct mgmt_rx_reo_frame_descriptor - Frame Descriptor used to describe
680  * a management frame in mgmt rx reo module.
681  * @type: Frame descriptor type
682  * @frame_type: frame type
683  * @frame_subtype: frame subtype
684  * @nbuf: nbuf corresponding to this frame
685  * @rx_params: Management rx event parameters
686  * @wait_count: Wait counts for the frame
687  * @ingress_timestamp: Host time stamp when the frames enters the reorder
688  * algorithm
689  * @is_stale: Indicates whether this frame is stale. Any frame older than the
690  * last frame delivered to upper layer is a stale frame. Stale frames should not
691  * be delivered to the upper layers. These frames can be discarded after
692  * updating the host snapshot and wait counts of entries currently residing in
693  * the reorder list.
694  * @zero_wait_count_rx: Indicates whether this frame's wait count was
695  * zero when received by host
696  * @immediate_delivery: Indicates whether this frame can be delivered
697  * immediately to the upper layers
698  * @list_size_rx: Size of the reorder list when this frame is received (before
699  * updating the list based on this frame).
700  * @list_insertion_pos: Position in the reorder list where this frame is going
701  * to get inserted (Applicable for only host consumed frames)
702  * @shared_snapshots: snapshots shared b/w host and target
703  * @host_snapshot: host snapshot
704  * @is_parallel_rx: Indicates that this frame is received in parallel to the
705  * last frame which is delivered to the upper layer.
706  * @pkt_ctr_delta: Packet counter delta of the current and last frame
707  * @reo_required: Indicates whether reorder is required for the current frame.
708  * If reorder is not required, current frame will just be used for updating the
709  * wait count of frames already part of the reorder list.
710  */
711 struct mgmt_rx_reo_frame_descriptor {
712 	enum mgmt_rx_reo_frame_descriptor_type type;
713 	uint8_t frame_type;
714 	uint8_t frame_subtype;
715 	qdf_nbuf_t nbuf;
716 	struct mgmt_rx_event_params *rx_params;
717 	struct mgmt_rx_reo_wait_count wait_count;
718 	uint64_t ingress_timestamp;
719 	bool is_stale;
720 	bool zero_wait_count_rx;
721 	bool immediate_delivery;
722 	int16_t list_size_rx;
723 	int16_t list_insertion_pos;
724 	struct mgmt_rx_reo_snapshot_params shared_snapshots
725 			[MAX_MLO_LINKS][MGMT_RX_REO_SHARED_SNAPSHOT_MAX];
726 	struct mgmt_rx_reo_snapshot_params host_snapshot[MAX_MLO_LINKS];
727 	bool is_parallel_rx;
728 	int pkt_ctr_delta;
729 	bool reo_required;
730 };
731 
732 /**
733  * mgmt_rx_reo_get_context_from_reo_list() - Helper API to get pointer to
734  * management rx reorder context from pointer to management reorder list
735  * @reo_list: Pointer to management rx reorder list
736  *
737  * Return: Pointer to management rx reorder context
738  */
739 static inline struct mgmt_rx_reo_context *
740 mgmt_rx_reo_get_context_from_reo_list(const struct mgmt_rx_reo_list *reo_list) {
741 	qdf_assert_always(reo_list);
742 
743 	return qdf_container_of(reo_list, struct mgmt_rx_reo_context,
744 				reo_list);
745 }
746 
747 /**
748  * mgmt_rx_reo_get_global_ts() - Helper API to get global time stamp
749  * corresponding to the mgmt rx event
750  * @rx_params: Management rx event params
751  *
752  * Return: global time stamp corresponding to the mgmt rx event
753  */
754 static inline uint32_t
755 mgmt_rx_reo_get_global_ts(struct mgmt_rx_event_params *rx_params)
756 {
757 	qdf_assert_always(rx_params);
758 	qdf_assert_always(rx_params->reo_params);
759 
760 	return rx_params->reo_params->global_timestamp;
761 }
762 
763 /**
764  * mgmt_rx_reo_get_start_ts() - Helper API to get start time stamp of the frame
765  * @rx_params: Management rx event params
766  *
767  * Return: start time stamp of the frame
768  */
769 static inline uint32_t
770 mgmt_rx_reo_get_start_ts(struct mgmt_rx_event_params *rx_params)
771 {
772 	qdf_assert_always(rx_params);
773 	qdf_assert_always(rx_params->reo_params);
774 
775 	return rx_params->reo_params->start_timestamp;
776 }
777 
778 /**
779  * mgmt_rx_reo_get_end_ts() - Helper API to get end time stamp of the frame
780  * @rx_params: Management rx event params
781  *
782  * Return: end time stamp of the frame
783  */
784 static inline uint32_t
785 mgmt_rx_reo_get_end_ts(struct mgmt_rx_event_params *rx_params)
786 {
787 	qdf_assert_always(rx_params);
788 	qdf_assert_always(rx_params->reo_params);
789 
790 	return rx_params->reo_params->end_timestamp;
791 }
792 
793 /**
794  * mgmt_rx_reo_get_duration_us() - Helper API to get the duration of the frame
795  * in us
796  * @rx_params: Management rx event params
797  *
798  * Return: Duration of the frame in us
799  */
800 static inline uint32_t
801 mgmt_rx_reo_get_duration_us(struct mgmt_rx_event_params *rx_params)
802 {
803 	qdf_assert_always(rx_params);
804 	qdf_assert_always(rx_params->reo_params);
805 
806 	return rx_params->reo_params->duration_us;
807 }
808 
809 /**
810  * mgmt_rx_reo_get_pkt_counter() - Helper API to get packet counter
811  * corresponding to the mgmt rx event
812  * @rx_params: Management rx event params
813  *
814  * Return: Management packet counter corresponding to the mgmt rx event
815  */
816 static inline uint16_t
817 mgmt_rx_reo_get_pkt_counter(struct mgmt_rx_event_params *rx_params)
818 {
819 	qdf_assert_always(rx_params);
820 	qdf_assert_always(rx_params->reo_params);
821 
822 	return rx_params->reo_params->mgmt_pkt_ctr;
823 }
824 
825 /**
826  * mgmt_rx_reo_get_link_id() - Helper API to get link id corresponding to the
827  * mgmt rx event
828  * @rx_params: Management rx event params
829  *
830  * Return: link id corresponding to the mgmt rx event
831  */
832 static inline uint8_t
833 mgmt_rx_reo_get_link_id(struct mgmt_rx_event_params *rx_params)
834 {
835 	qdf_assert_always(rx_params);
836 	qdf_assert_always(rx_params->reo_params);
837 
838 	return rx_params->reo_params->link_id;
839 }
840 
841 /**
842  * mgmt_rx_reo_get_pdev_id() - Helper API to get pdev id corresponding to the
843  * mgmt rx event
844  * @rx_params: Management rx event params
845  *
846  * Return: pdev id corresponding to the mgmt rx event
847  */
848 static inline uint8_t
849 mgmt_rx_reo_get_pdev_id(struct mgmt_rx_event_params *rx_params)
850 {
851 	qdf_assert_always(rx_params);
852 	qdf_assert_always(rx_params->reo_params);
853 
854 	return rx_params->reo_params->pdev_id;
855 }
856 
857 /**
858  * mgmt_rx_reo_init_context() - Initialize the management rx-reorder context
859  *
860  * API to initialize the global management rx-reorder context object.
861  *
862  * Return: QDF_STATUS
863  */
864 QDF_STATUS
865 mgmt_rx_reo_init_context(void);
866 
867 /**
868  * mgmt_rx_reo_deinit_context() - De initialize the management rx-reorder
869  * context
870  *
871  * API to de initialize the global management rx-reorder context object.
872  *
873  * Return: QDF_STATUS
874  */
875 QDF_STATUS
876 mgmt_rx_reo_deinit_context(void);
877 
878 /**
879  * mgmt_rx_reo_is_simulation_in_progress() - API to check whether
880  * simulation is in progress
881  *
882  * Return: true if simulation is in progress, else false
883  */
884 bool
885 mgmt_rx_reo_is_simulation_in_progress(void);
886 
887 /**
888  * mgmt_rx_reo_print_ingress_frame_stats() - Helper API to print
889  * stats related to incoming management frames
890  *
891  * This API prints stats related to management frames entering management
892  * Rx reorder module.
893  *
894  * Return: QDF_STATUS
895  */
896 QDF_STATUS
897 mgmt_rx_reo_print_ingress_frame_stats(void);
898 
899 /**
900  * mgmt_rx_reo_print_ingress_frame_info() - Print the debug information
901  * about the latest frames entered the reorder module
902  * @num_frames: Number of frames for which the debug information is to be
903  * printed. If @num_frames is 0, then debug information about all the frames
904  * in the ring buffer will be  printed.
905  *
906  * Return: QDF_STATUS of operation
907  */
908 QDF_STATUS
909 mgmt_rx_reo_print_ingress_frame_info(uint16_t num_frames);
910 
911 /**
912  * mgmt_rx_reo_print_egress_frame_stats() - Helper API to print
913  * stats related to outgoing management frames
914  *
915  * This API prints stats related to management frames exiting management
916  * Rx reorder module.
917  *
918  * Return: QDF_STATUS
919  */
920 QDF_STATUS
921 mgmt_rx_reo_print_egress_frame_stats(void);
922 
923 /**
924  * mgmt_rx_reo_print_egress_frame_info() - Print the debug information
925  * about the latest frames leaving the reorder module
926  * @num_frames: Number of frames for which the debug information is to be
927  * printed. If @num_frames is 0, then debug information about all the frames
928  * in the ring buffer will be  printed.
929  *
930  * Return: QDF_STATUS of operation
931  */
932 QDF_STATUS
933 mgmt_rx_reo_print_egress_frame_info(uint16_t num_frames);
934 
935 #ifdef WLAN_MGMT_RX_REO_SIM_SUPPORT
936 /**
937  * mgmt_rx_reo_sim_start() - Helper API to start management Rx reorder
938  * simulation
939  *
940  * This API starts the simulation framework which mimics the management frame
941  * generation by target. MAC HW is modelled as a kthread. FW and host layers
942  * are modelled as an ordered work queues.
943  *
944  * Return: QDF_STATUS
945  */
946 QDF_STATUS
947 mgmt_rx_reo_sim_start(void);
948 
949 /**
950  * mgmt_rx_reo_sim_stop() - Helper API to stop management Rx reorder
951  * simulation
952  *
953  * This API stops the simulation framework which mimics the management frame
954  * generation by target. MAC HW is modelled as a kthread. FW and host layers
955  * are modelled as an ordered work queues.
956  *
957  * Return: QDF_STATUS
958  */
959 QDF_STATUS
960 mgmt_rx_reo_sim_stop(void);
961 
962 /**
963  * mgmt_rx_reo_sim_process_rx_frame() - API to process the management frame
964  * in case of simulation
965  * @pdev: pointer to pdev object
966  * @buf: pointer to management frame buffer
967  * @mgmt_rx_params: pointer to management frame parameters
968  *
969  * This API validates whether the reo algorithm has reordered frames correctly.
970  *
971  * Return: QDF_STATUS
972  */
973 QDF_STATUS
974 mgmt_rx_reo_sim_process_rx_frame(struct wlan_objmgr_pdev *pdev,
975 				 qdf_nbuf_t buf,
976 				 struct mgmt_rx_event_params *mgmt_rx_params);
977 
978 /**
979  * mgmt_rx_reo_sim_get_snapshot_address() - Get snapshot address
980  * @pdev: pointer to pdev
981  * @id: snapshot identifier
982  * @address: pointer to snapshot address
983  *
984  * Helper API to get address of snapshot @id for pdev @pdev. For simulation
985  * purpose snapshots are allocated in the simulation context object.
986  *
987  * Return: QDF_STATUS
988  */
989 QDF_STATUS
990 mgmt_rx_reo_sim_get_snapshot_address(
991 			struct wlan_objmgr_pdev *pdev,
992 			enum mgmt_rx_reo_shared_snapshot_id id,
993 			struct mgmt_rx_reo_snapshot **address);
994 
995 /**
996  * mgmt_rx_reo_sim_pdev_object_create_notification() - pdev create handler for
997  * management rx-reorder simulation framework
998  * @pdev: pointer to pdev object
999  *
1000  * This function gets called from object manager when pdev is being created and
1001  * builds the link id to pdev map in simulation context object.
1002  *
1003  * Return: QDF_STATUS
1004  */
1005 QDF_STATUS
1006 mgmt_rx_reo_sim_pdev_object_create_notification(struct wlan_objmgr_pdev *pdev);
1007 
1008 /**
1009  * mgmt_rx_reo_sim_pdev_object_destroy_notification() - pdev destroy handler for
1010  * management rx-reorder simulation framework
1011  * @pdev: pointer to pdev object
1012  *
1013  * This function gets called from object manager when pdev is being destroyed
1014  * and destroys the link id to pdev map in simulation context.
1015  *
1016  * Return: QDF_STATUS
1017  */
1018 QDF_STATUS
1019 mgmt_rx_reo_sim_pdev_object_destroy_notification(struct wlan_objmgr_pdev *pdev);
1020 
1021 /**
1022  * mgmt_rx_reo_sim_get_mlo_link_id_from_pdev() - Helper API to get the MLO HW
1023  * link id from the pdev object.
1024  * @pdev: Pointer to pdev object
1025  *
1026  * This API is applicable for simulation only. A static map from MLO HW link id
1027  * to the pdev object is created at the init time. This API uses the map to
1028  * find the MLO HW link id for a given pdev.
1029  *
1030  * Return: On success returns the MLO HW link id corresponding to the pdev
1031  * object. On failure returns -1.
1032  */
1033 int8_t
1034 mgmt_rx_reo_sim_get_mlo_link_id_from_pdev(struct wlan_objmgr_pdev *pdev);
1035 
1036 /**
1037  * mgmt_rx_reo_sim_get_pdev_from_mlo_link_id() - Helper API to get the pdev
1038  * object from the MLO HW link id.
1039  * @mlo_link_id: MLO HW link id
1040  * @refdbgid: Reference debug id
1041  *
1042  * This API is applicable for simulation only. A static map from MLO HW link id
1043  * to the pdev object is created at the init time. This API uses the map to
1044  * find the pdev object from the MLO HW link id.
1045  *
1046  * Return: On success returns the pdev object corresponding to the MLO HW
1047  * link id. On failure returns NULL.
1048  */
1049 struct wlan_objmgr_pdev *
1050 mgmt_rx_reo_sim_get_pdev_from_mlo_link_id(uint8_t mlo_link_id,
1051 					  wlan_objmgr_ref_dbgid refdbgid);
1052 #endif /* WLAN_MGMT_RX_REO_SIM_SUPPORT */
1053 
1054 /**
1055  * is_mgmt_rx_reo_required() - Whether MGMT REO required for this frame/event
1056  * @pdev: pdev for which this frame/event is intended
1057  * @desc: Descriptor corresponding to this frame/event
1058  *
1059  * Return: true if REO is required; else false
1060  */
1061 static inline bool is_mgmt_rx_reo_required(
1062 			struct wlan_objmgr_pdev *pdev,
1063 			struct mgmt_rx_reo_frame_descriptor *desc)
1064 {
1065 	/**
1066 	 * NOTE: Implementing a simple policy based on the number of MLO vdevs
1067 	 * in the given pdev.
1068 	 */
1069 	return  wlan_pdev_get_mlo_vdev_count(pdev);
1070 }
1071 
1072 /**
1073  * wlan_mgmt_rx_reo_algo_entry() - Entry point to the MGMT Rx REO algorithm for
1074  * a given MGMT frame/event.
1075  * @pdev: pdev for which this frame/event is intended
1076  * @desc: Descriptor corresponding to this frame/event
1077  * @is_queued: Whether this frame/event is queued in the REO list
1078  *
1079  * Return: QDF_STATUS of operation
1080  */
1081 QDF_STATUS
1082 wlan_mgmt_rx_reo_algo_entry(struct wlan_objmgr_pdev *pdev,
1083 			    struct mgmt_rx_reo_frame_descriptor *desc,
1084 			    bool *is_queued);
1085 
1086 /**
1087  * mgmt_rx_reo_list_max_size_exceeded() - Helper API to check whether
1088  * list has exceeded the maximum configured size
1089  * @reo_list: Pointer to reorder list
1090  *
1091  * This API expects the caller to acquire the spin lock protecting the reorder
1092  * list.
1093  *
1094  * Return: true if reorder list has exceeded the max size
1095  */
1096 static inline bool
1097 mgmt_rx_reo_list_max_size_exceeded(struct mgmt_rx_reo_list *reo_list)
1098 {
1099 	return (qdf_list_size(&reo_list->list) > reo_list->max_list_size);
1100 }
1101 
1102 /**
1103  * mgmt_rx_reo_validate_mlo_link_info() - Validate the MLO HW link info
1104  * obtained from the global shared memory arena
1105  * @psoc: Pointer to psoc object
1106  *
1107  * Validate the following MLO HW link related information extracted from
1108  * management Rx reorder related TLVs in global shared memory arena.
1109  *         1. Number of active MLO HW links
1110  *         2. Valid MLO HW link bitmap
1111  *
1112  * Return: QDF_STATUS of operation
1113  */
1114 QDF_STATUS
1115 mgmt_rx_reo_validate_mlo_link_info(struct wlan_objmgr_psoc *psoc);
1116 #endif /* WLAN_MGMT_RX_REO_SUPPORT */
1117 #endif /* _WLAN_MGMT_TXRX_RX_REO_I_H */
1118