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