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