1 /* 2 * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /* 21 * This file lim_utils.h contains the utility definitions 22 * LIM uses. 23 * Author: Chandra Modumudi 24 * Date: 02/13/02 25 * History:- 26 * Date Modified by Modification Information 27 * -------------------------------------------------------------------- 28 */ 29 #ifndef __LIM_UTILS_H 30 #define __LIM_UTILS_H 31 32 #include "sir_api.h" 33 #include "sir_debug.h" 34 35 #include "lim_types.h" 36 #include "lim_scan_result_utils.h" 37 #include "lim_timer_utils.h" 38 #include "lim_trace.h" 39 #include "include/wlan_vdev_mlme.h" 40 #include "wlan_mlme_vdev_mgr_interface.h" 41 #include "wlan_qct_sys.h" 42 #include <wlan_cp_stats_chipset_stats.h> 43 44 #define LIM_QOS_AP_SUPPORTS_UAPSD 0x80 45 46 #define LIM_IS_QOS_BSS(ie_struct) \ 47 (ie_struct->WMMParams.present || ie_struct->WMMInfoAp.present) 48 49 #define LIM_IS_UAPSD_BSS(ie_struct) \ 50 ((ie_struct->WMMParams.present && \ 51 (ie_struct->WMMParams.qosInfo & LIM_QOS_AP_SUPPORTS_UAPSD)) || \ 52 (ie_struct->WMMInfoAp.present && ie_struct->WMMInfoAp.uapsd)) 53 54 #define LIM_AID_MASK 0xC000 55 #define LIM_SPECTRUM_MANAGEMENT_BIT_MASK 0x0100 56 #define LIM_RRM_BIT_MASK 0x1000 57 #define LIM_SHORT_PREAMBLE_BIT_MASK 0x0020 58 #define LIM_IMMEDIATE_BLOCK_ACK_MASK 0x8000 59 #define LIM_MAX_REASSOC_RETRY_LIMIT 2 60 61 #define VHT_MCS_3x3_MASK 0x30 62 #define VHT_MCS_2x2_MASK 0x0C 63 64 #define CENTER_FREQ_DIFF_160MHz 8 65 #define CENTER_FREQ_DIFF_80P80MHz 16 66 67 #define CH_TO_CNTR_FREQ_DIFF_160MHz 14 68 #define CH_TO_CNTR_FREQ_DIFF_80MHz 6 69 70 #define IS_VHT_NSS_1x1(__mcs_map) ((__mcs_map & 0xFFFC) == 0xFFFC) 71 72 #define MGMT_RX_PACKETS_THRESHOLD 200 73 74 /* 11B AP detection bit position */ 75 #define OBSS_DETECTION_11B_AP_BIT_MASK 0x0001 76 /* 11B STA detection bit position */ 77 #define OBSS_DETECTION_11B_STA_BIT_MASK 0x0002 78 /* 11G AP detection bit position */ 79 #define OBSS_DETECTION_11G_AP_BIT_MASK 0x0004 80 /* 11A AP detection bit position */ 81 #define OBSS_DETECTION_11A_BIT_MASK 0x0008 82 /* HT legacy detection bit position */ 83 #define OBSS_DETECTION_HT_LEGACY_BIT_MASK 0x0010 84 /* HT mixed detection bit position */ 85 #define OBSS_DETECTION_HT_MIXED_BIT_MASK 0x0020 86 /* HT 20mhz detection bit position */ 87 #define OBSS_DETECTION_HT_20MHZ_BIT_MASK 0x0040 88 89 /** 90 * OBSS detection period in ms, used by firmware to decide 91 * absent detection and also gap between same detection ind. 92 */ 93 #define OBSS_DETECTION_PERIOD_MS 4000 94 95 /* To check if 11B AP detection bit set */ 96 #define OBSS_DETECTION_IS_11B_AP(_m) ((_m) & OBSS_DETECTION_11B_AP_BIT_MASK) 97 /* To check if 11B STA detection bit set */ 98 #define OBSS_DETECTION_IS_11B_STA(_m) ((_m) & OBSS_DETECTION_11B_STA_BIT_MASK) 99 /* To check if 11G AP detection bit set */ 100 #define OBSS_DETECTION_IS_11G_AP(_m) ((_m) & OBSS_DETECTION_11G_AP_BIT_MASK) 101 /* To check if 11A AP detection bit set */ 102 #define OBSS_DETECTION_IS_11A(_m) ((_m) & OBSS_DETECTION_11A_BIT_MASK) 103 /* To check if HT legacy detection bit set */ 104 #define OBSS_DETECTION_IS_HT_LEGACY(_m) \ 105 ((_m) & OBSS_DETECTION_HT_LEGACY_BIT_MASK) 106 /* To check if HT mixed detection bit set */ 107 #define OBSS_DETECTION_IS_HT_MIXED(_m) ((_m) & OBSS_DETECTION_HT_MIXED_BIT_MASK) 108 /* To check if HT 20mhz detection bit set */ 109 #define OBSS_DETECTION_IS_HT_20MHZ(_m) ((_m) & OBSS_DETECTION_HT_20MHZ_BIT_MASK) 110 111 #define MAX_WAIT_FOR_BCN_TX_COMPLETE_FOR_LL_SAP 500 112 #define MAX_WAIT_FOR_BCN_TX_COMPLETE 4000 113 114 #define MAX_WAKELOCK_FOR_CSA 5000 115 #define MAX_WAIT_FOR_CH_WIDTH_UPDATE_COMPLETE 200 116 117 #ifdef WLAN_FEATURE_11BE 118 #define MAX_NUM_PWR_LEVELS 16 119 #else 120 #define MAX_NUM_PWR_LEVELS 8 121 #endif 122 123 /* SR is disabled if NON_SRG is disallowed and SRG INFO is not present */ 124 #define SR_DISABLE NON_SRG_PD_SR_DISALLOWED & (~SRG_INFO_PRESENT & 0x0F) 125 126 typedef union uPmfSaQueryTimerId { 127 struct { 128 uint8_t sessionId; 129 uint16_t peerIdx; 130 } fields; 131 uint32_t value; 132 } tPmfSaQueryTimerId, *tpPmfSaQueryTimerId; 133 134 typedef struct last_processed_frame { 135 tSirMacAddr sa; 136 uint16_t seq_num; 137 } last_processed_msg; 138 139 /* LIM utility functions */ 140 bool lim_is_valid_frame(last_processed_msg *last_processed_frm, 141 uint8_t *pRxPacketInfo); 142 void lim_update_last_processed_frame(last_processed_msg *last_processed_frm, 143 uint8_t *pRxPacketInfo); 144 145 char *lim_mlm_state_str(tLimMlmStates state); 146 char *lim_sme_state_str(tLimSmeStates state); 147 char *lim_msg_str(uint32_t msgType); 148 char *lim_result_code_str(tSirResultCodes resultCode); 149 char *lim_dot11_mode_str(struct mac_context *mac, uint8_t dot11Mode); 150 void lim_print_mlm_state(struct mac_context *mac, uint16_t logLevel, 151 tLimMlmStates state); 152 void lim_print_sme_state(struct mac_context *mac, uint16_t logLevel, 153 tLimSmeStates state); 154 void lim_print_msg_name(struct mac_context *mac, uint16_t logLevel, uint32_t msgType); 155 156 QDF_STATUS lim_send_set_max_tx_power_req(struct mac_context *mac, 157 int8_t txPower, 158 struct pe_session *pe_session); 159 160 /** 161 * lim_get_num_pwr_levels() - Utility to get number of tx power levels 162 * @is_psd: PSD power check 163 * @ch_width: BSS channel bandwidth 164 * 165 * This function is used to get the number of tx power levels based on 166 * channel bandwidth and psd power. 167 * 168 * Return: number of tx power levels 169 */ 170 uint32_t lim_get_num_pwr_levels(bool is_psd, 171 enum phy_ch_width ch_width); 172 173 /** 174 * lim_get_max_tx_power() - Utility to get maximum tx power 175 * @mac: mac handle 176 * @mlme_obj: pointer to struct containing list of tx powers 177 * 178 * This function is used to get the maximum possible tx power from the list 179 * of tx powers mentioned in @attr. 180 * 181 * Return: Max tx power 182 */ 183 uint8_t lim_get_max_tx_power(struct mac_context *mac, 184 struct vdev_mlme_obj *mlme_obj); 185 /** 186 * lim_calculate_tpc() - Utility to get maximum tx power 187 * @mac: mac handle 188 * @session: PE Session Entry 189 * 190 * This function is used to get the maximum possible tx power from the list 191 * of tx powers mentioned in @attr. 192 * 193 * Return: None 194 */ 195 void lim_calculate_tpc(struct mac_context *mac, 196 struct pe_session *session); 197 198 /* AID pool management functions */ 199 200 /** 201 * lim_init_peer_idxpool() -- initializes peer index pool 202 * @mac: mac context 203 * @pe_session: session entry 204 * 205 * This function is called while starting a BSS at AP 206 * to initialize AID pool. 207 * 208 * Return: None 209 */ 210 void lim_init_peer_idxpool(struct mac_context *, struct pe_session *); 211 uint16_t lim_assign_peer_idx(struct mac_context *, struct pe_session *); 212 213 /** 214 * lim_create_peer_idxpool() - api to create aid pool 215 * @pe_session: pe session 216 * @idx_pool_size: aid pool size 217 * 218 * Return: true if pool is created successfully 219 */ 220 bool lim_create_peer_idxpool(struct pe_session *pe_session, 221 uint8_t idx_pool_size); 222 223 /** 224 * lim_free_peer_idxpool() - api to free aid pool 225 * @pe_session: pe session 226 * 227 * Return: Void 228 */ 229 void lim_free_peer_idxpool(struct pe_session *pe_session); 230 231 #ifdef WLAN_FEATURE_11BE_MLO 232 /** 233 * lim_assign_mlo_conn_idx() - api to assign mlo peer station index with given 234 * partner peer station index 235 * @mac: mac context 236 * @pe_session: session entry 237 * @partner_peer_idx: partner peer station index 238 * 239 * Return: peer station index 240 */ 241 uint16_t lim_assign_mlo_conn_idx(struct mac_context *mac, 242 struct pe_session *pe_session, 243 uint16_t partner_peer_idx); 244 245 /** 246 * lim_release_mlo_conn_idx() - api to release mlo peer AID 247 * @mac: mac context 248 * @peer_idx: given aid 249 * @pe_session: session entry 250 * @free_aid: trigger mlo mgr to free AID or not. It only can be 251 * true before mlo peer is created. Once mlo peer is 252 * created, AID is freed in mlo peer context. 253 * 254 * Return: Void 255 */ 256 void 257 lim_release_mlo_conn_idx(struct mac_context *mac, uint16_t peer_idx, 258 struct pe_session *pe_session, bool free_aid); 259 260 /** 261 * lim_update_sta_mlo_info() - update sta mlo information 262 * @pe_session: session entry 263 * @add_sta_params: pointer to tpAddStaParams 264 * @sta_ds: pointer tpDphHashNode 265 * 266 * Return: Void 267 */ 268 void lim_update_sta_mlo_info(struct pe_session *pe_session, 269 tpAddStaParams add_sta_params, 270 tpDphHashNode sta_ds); 271 272 void lim_set_mlo_caps(struct mac_context *mac, struct pe_session *session, 273 uint8_t *ie_start, uint32_t num_bytes); 274 275 QDF_STATUS lim_send_mlo_caps_ie(struct mac_context *mac_ctx, 276 struct wlan_objmgr_vdev *vdev, 277 enum QDF_OPMODE device_mode, 278 uint8_t vdev_id); 279 280 /** 281 * lim_strip_mlo_ie() - Removes the MLO IE data from additional IE data 282 * 283 * @mac_ctx: global MAC context 284 * @add_ie: Additional IE buffer 285 * @add_ielen: Pointer to length of additional IE 286 * 287 * Return: Void 288 */ 289 void lim_strip_mlo_ie(struct mac_context *mac_ctx, 290 uint8_t *add_ie, uint16_t *add_ielen); 291 292 /** 293 * lim_set_emlsr_caps() - This API will set EMLSR caps in vdev obj if ELMSR is 294 * supported. 295 * @mac: mac context 296 * @pe_session: session entry 297 * 298 * Return: Void 299 */ 300 void lim_set_emlsr_caps(struct mac_context *mac_ctx, 301 struct pe_session *session); 302 #else 303 static inline uint16_t lim_assign_mlo_conn_idx(struct mac_context *mac, 304 struct pe_session *pe_session, 305 uint16_t partner_peer_idx) 306 { 307 return 0; 308 } 309 310 static inline void 311 lim_release_mlo_conn_idx(struct mac_context *mac, uint16_t peer_idx, 312 struct pe_session *pe_session, bool free_aid) 313 { 314 } 315 316 static inline void lim_update_sta_mlo_info(struct pe_session *session, 317 tpAddStaParams add_sta_params, 318 tpDphHashNode sta_ds) 319 { 320 } 321 322 static inline 323 void lim_set_mlo_caps(struct mac_context *mac, struct pe_session *session, 324 uint8_t *ie_start, uint32_t num_bytes) 325 { 326 } 327 328 static inline 329 void lim_strip_mlo_ie(struct mac_context *mac_ctx, 330 uint8_t *addn_ie, uint16_t *addn_ielen) 331 { 332 } 333 334 static inline 335 QDF_STATUS lim_send_mlo_caps_ie(struct mac_context *mac_ctx, 336 struct wlan_objmgr_vdev *vdev, 337 enum QDF_OPMODE device_mode, 338 uint8_t vdev_id) 339 { 340 return QDF_STATUS_E_NOSUPPORT; 341 } 342 343 static inline void lim_set_emlsr_caps(struct mac_context *mac_ctx, 344 struct pe_session *session) 345 { 346 } 347 #endif 348 349 void lim_enable_overlap11g_protection(struct mac_context *mac, 350 tpUpdateBeaconParams pBeaconParams, 351 tpSirMacMgmtHdr pMh, 352 struct pe_session *pe_session); 353 void lim_update_overlap_sta_param(struct mac_context *mac, tSirMacAddr bssId, 354 tpLimProtStaParams pStaParams); 355 void lim_update_short_preamble(struct mac_context *mac, tSirMacAddr peerMacAddr, 356 tpUpdateBeaconParams pBeaconParams, 357 struct pe_session *pe_session); 358 void lim_update_short_slot_time(struct mac_context *mac, tSirMacAddr peerMacAddr, 359 tpUpdateBeaconParams pBeaconParams, 360 struct pe_session *pe_session); 361 362 /* 363 * lim_send_sme_mgmt_frame_ind() - Function to send mgmt frame ind to HDD 364 * @mac_ctx: Pointer to Global MAC structure 365 * @frame_type: Type of mgmt frame 366 * @frame: Frame pointer 367 * @frame_len: Length og mgmt frame 368 * @vdev_id: session id 369 * @rx_freq: Frequency on which packet is received 370 * @rx_rssi: rssi value 371 * @rx_flags: RXMGMT flags to be set for the frame. Defined in enum rxmgmt_flags 372 * 373 * Indicate the Mgmt Frame received to SME to HDD callback 374 * handle Probe_req/Action frame currently 375 * 376 * Return: None 377 */ 378 void lim_send_sme_mgmt_frame_ind(struct mac_context *mac_ctx, uint8_t frame_type, 379 uint8_t *frame, uint32_t frame_len, 380 uint16_t vdev_id, uint32_t rx_freq, 381 int8_t rx_rssi, enum rxmgmt_flags rx_flags); 382 383 /* 384 * lim_deactivate_timers() - Function to deactivate lim timers 385 * @mac_ctx: Pointer to global mac structure 386 * 387 * This function is used to deactivate lim timers 388 * 389 * Return: None 390 */ 391 void lim_deactivate_timers(struct mac_context *mac_ctx); 392 393 /* 394 * lim_deactivate_timers_for_vdev() - Deactivate lim connection timers 395 * @mac_ctx: Pointer to global mac structure 396 * @vdev_id: vdev id 397 * 398 * This function is used to trigger timeout of lim connection timers to abort 399 * connect request. 400 * 401 * Return: None 402 */ 403 void lim_deactivate_timers_for_vdev(struct mac_context *mac_ctx, 404 uint8_t vdev_id); 405 406 /* 407 * The below 'product' check tobe removed if 'Association' is 408 * allowed in IBSS. 409 */ 410 void lim_release_peer_idx(struct mac_context *, uint16_t, struct pe_session *); 411 412 void lim_decide_ap_protection(struct mac_context *mac, tSirMacAddr peerMacAddr, 413 tpUpdateBeaconParams pBeaconParams, struct pe_session *); 414 void lim_decide_ap_protection_on_delete(struct mac_context *mac, 415 tpDphHashNode sta, 416 tpUpdateBeaconParams pBeaconParams, 417 struct pe_session *pe_session); 418 419 QDF_STATUS lim_update_11a_protection(struct mac_context *mac, 420 uint8_t enable, 421 uint8_t overlap, 422 tpUpdateBeaconParams pBeaconParams, 423 struct pe_session *); 424 QDF_STATUS lim_enable11g_protection(struct mac_context *mac, 425 uint8_t enable, 426 uint8_t overlap, 427 tpUpdateBeaconParams pBeaconParams, 428 struct pe_session *pe_session); 429 QDF_STATUS lim_enable_ht_protection_from11g(struct mac_context *mac, 430 uint8_t enable, 431 uint8_t overlap, 432 tpUpdateBeaconParams 433 pBeaconParams, 434 struct pe_session *pe_session); 435 QDF_STATUS lim_enable_ht20_protection(struct mac_context *mac, 436 uint8_t enable, uint8_t overlap, 437 tpUpdateBeaconParams pBeaconParams, 438 struct pe_session *pe_session); 439 QDF_STATUS lim_enable_ht_non_gf_protection(struct mac_context *mac, 440 uint8_t enable, uint8_t overlap, 441 tpUpdateBeaconParams 442 pBeaconParams, struct pe_session *); 443 QDF_STATUS lim_enable_ht_rifs_protection(struct mac_context *mac, 444 uint8_t enable, uint8_t overlap, 445 tpUpdateBeaconParams 446 pBeaconParams, 447 struct pe_session *pe_session); 448 QDF_STATUS lim_enable_ht_lsig_txop_protection(struct mac_context *mac, 449 uint8_t enable, 450 uint8_t overlap, 451 tpUpdateBeaconParams 452 pBeaconParams, struct pe_session *); 453 QDF_STATUS lim_enable_short_preamble(struct mac_context *mac, 454 uint8_t enable, 455 tpUpdateBeaconParams pBeaconParams, 456 struct pe_session *pe_session); 457 QDF_STATUS lim_enable_ht_obss_protection(struct mac_context *mac, 458 uint8_t enable, uint8_t overlap, 459 tpUpdateBeaconParams 460 pBeaconParams, struct pe_session *); 461 void lim_decide_sta_protection(struct mac_context *mac, 462 tpSchBeaconStruct pBeaconStruct, 463 tpUpdateBeaconParams pBeaconParams, 464 struct pe_session *pe_session); 465 void lim_decide_sta_protection_on_assoc(struct mac_context *mac, 466 tpSchBeaconStruct pBeaconStruct, 467 struct pe_session *pe_session); 468 469 /** 470 * lim_get_cb_mode_for_freq() - Get cb mode depending on the freq 471 * @mac: pointer to Global MAC structure 472 * @pe_session: pe session 473 * @chan_freq: Freq to get cb mode for 474 * 475 * Return: cb mode allowed for the freq 476 */ 477 uint8_t lim_get_cb_mode_for_freq(struct mac_context *mac, 478 struct pe_session *session, 479 qdf_freq_t chan_freq); 480 481 /** 482 * lim_update_sta_run_time_ht_switch_chnl_params() - Process change in HT 483 * bandwidth 484 * @mac: pointer to Global MAC structure 485 * @pHTInfo: ht info IE 486 * @pe_session: pe session 487 * 488 * Return: none 489 */ 490 void lim_update_sta_run_time_ht_switch_chnl_params(struct mac_context *mac, 491 tDot11fIEHTInfo *pHTInfo, 492 struct pe_session *pe_session); 493 494 /* Deferred Message Queue read/write */ 495 uint8_t lim_write_deferred_msg_q(struct mac_context *mac, 496 struct scheduler_msg *limMsg); 497 struct scheduler_msg *lim_read_deferred_msg_q(struct mac_context *mac); 498 void lim_handle_defer_msg_error(struct mac_context *mac, 499 struct scheduler_msg *pLimMsg); 500 501 /* Deferred Message Queue Reset */ 502 void lim_reset_deferred_msg_q(struct mac_context *mac); 503 504 static inline void lim_sys_process_mmh_msg_api(struct mac_context *mac, 505 struct scheduler_msg *msg) 506 { 507 sys_process_mmh_msg(mac, msg); 508 } 509 510 void lim_handle_update_olbc_cache(struct mac_context *mac); 511 512 uint8_t lim_is_null_ssid(tSirMacSSid *pSsid); 513 514 /* 11h Support */ 515 void lim_stop_tx_and_switch_channel(struct mac_context *mac, uint8_t sessionId); 516 517 /** 518 * lim_process_channel_switch() - Process channel switch 519 * @mac: pointer to Global MAC structure 520 * @vdev_id: Vdev on which CSA is happening 521 * 522 * Return: none 523 */ 524 void lim_process_channel_switch(struct mac_context *mac, uint8_t vdev_id); 525 526 /** 527 * lim_switch_primary_channel() - switch primary channel of session 528 * @mac: Global MAC structure 529 * @new_channel_freq: new chnannel freq in Mhz 530 * @pe_session: pe session context 531 * 532 * This function changes the current operating channel frequency. 533 * 534 * return qdf_status 535 */ 536 QDF_STATUS lim_switch_primary_channel(struct mac_context *mac, 537 uint32_t new_channel_freq, 538 struct pe_session *pe_session); 539 540 /** 541 * lim_switch_primary_secondary_channel() - switch primary and secondary 542 * channel of session 543 * @mac: Global MAC structure 544 * @pe_session: session context 545 * 546 * This function changes the primary and secondary channel. 547 * If 11h is enabled and user provides a "new channel freq" 548 * that is different from the current operating channel, 549 * then we must set this new channel in session context and 550 * assign notify LIM of such change. 551 * 552 * @return qdf_status 553 */ 554 QDF_STATUS lim_switch_primary_secondary_channel(struct mac_context *mac, 555 struct pe_session *pe_session); 556 557 void lim_update_sta_run_time_ht_capability(struct mac_context *mac, 558 tDot11fIEHTCaps *pHTCaps); 559 void lim_update_sta_run_time_ht_info(struct mac_context *mac, 560 tDot11fIEHTInfo *pRcvdHTInfo, 561 struct pe_session *pe_session); 562 563 /** 564 * lim_is_channel_valid_for_channel_switch - check channel valid for switching 565 * @mac: Global mac context 566 * @channel_freq: channel freq (MHz) 567 * 568 * This function checks if the channel to which AP is expecting us to switch, 569 * is a valid channel for us. 570 * 571 * Return bool, true if channel is valid 572 */ 573 bool lim_is_channel_valid_for_channel_switch(struct mac_context *mac, 574 uint32_t channel_freq); 575 576 QDF_STATUS lim_restore_pre_channel_switch_state(struct mac_context *mac, 577 struct pe_session *pe_session); 578 579 void lim_prepare_for11h_channel_switch(struct mac_context *mac, 580 struct pe_session *pe_session); 581 void lim_switch_channel_cback(struct mac_context *mac, QDF_STATUS status, 582 uint32_t *data, struct pe_session *pe_session); 583 584 /** 585 * lim_assoc_rej_get_remaining_delta() - Get remaining time delta for 586 * the rssi based disallowed list entry 587 * @node: rssi based disallowed list entry 588 * 589 * Return: remaining delta, can be -ve if time has already expired. 590 */ 591 int 592 lim_assoc_rej_get_remaining_delta(struct sir_rssi_disallow_lst *node); 593 594 /** 595 * lim_rem_denylist_entry_with_lowest_delta() - Remove the entry with lowest 596 * time delta 597 * @list: rssi based rejected BSSID list 598 * 599 * Return: QDF_STATUS 600 */ 601 QDF_STATUS 602 lim_rem_denylist_entry_with_lowest_delta(qdf_list_t *list); 603 604 static inline enum reg_wifi_band lim_get_rf_band(uint32_t chan_freq) 605 { 606 if (WLAN_REG_IS_6GHZ_CHAN_FREQ(chan_freq)) 607 return REG_BAND_6G; 608 609 if (WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq)) 610 return REG_BAND_5G; 611 612 if (WLAN_REG_IS_24GHZ_CH_FREQ(chan_freq)) 613 return REG_BAND_2G; 614 615 return REG_BAND_UNKNOWN; 616 } 617 618 static inline QDF_STATUS 619 lim_get_mgmt_staid(struct mac_context *mac, uint16_t *staid, 620 struct pe_session *pe_session) 621 { 622 if (LIM_IS_AP_ROLE(pe_session)) 623 *staid = 1; 624 else if (LIM_IS_STA_ROLE(pe_session)) 625 *staid = 0; 626 else 627 return QDF_STATUS_E_FAILURE; 628 629 return QDF_STATUS_SUCCESS; 630 } 631 632 static inline int lim_select_cb_mode(tDphHashNode *sta, 633 struct pe_session *pe_session, uint8_t channel, 634 uint8_t chan_bw) 635 { 636 if (sta->mlmStaContext.vhtCapability && chan_bw) { 637 if (channel == 36 || channel == 52 || channel == 100 || 638 channel == 116 || channel == 149) { 639 return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1; 640 } else if (channel == 40 || channel == 56 || channel == 104 || 641 channel == 120 || channel == 153) { 642 return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1; 643 } else if (channel == 44 || channel == 60 || channel == 108 || 644 channel == 124 || channel == 157) { 645 return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH - 1; 646 } else if (channel == 48 || channel == 64 || channel == 112 || 647 channel == 128 || channel == 161) { 648 return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1; 649 } else if (channel == 165) { 650 return PHY_SINGLE_CHANNEL_CENTERED; 651 } 652 } else if (sta->mlmStaContext.htCapability) { 653 if (channel == 40 || channel == 48 || channel == 56 || 654 channel == 64 || channel == 104 || channel == 112 || 655 channel == 120 || channel == 128 || channel == 136 || 656 channel == 144 || channel == 153 || channel == 161) { 657 return PHY_DOUBLE_CHANNEL_LOW_PRIMARY; 658 } else if (channel == 36 || channel == 44 || channel == 52 || 659 channel == 60 || channel == 100 || 660 channel == 108 || channel == 116 || 661 channel == 124 || channel == 132 || 662 channel == 140 || channel == 149 || 663 channel == 157) { 664 return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; 665 } else if (channel == 165) { 666 return PHY_SINGLE_CHANNEL_CENTERED; 667 } 668 } 669 return PHY_SINGLE_CHANNEL_CENTERED; 670 } 671 672 /* ANI peer station count management and associated actions */ 673 void lim_util_count_sta_add(struct mac_context *mac, tpDphHashNode pSta, 674 struct pe_session *pe_session); 675 void lim_util_count_sta_del(struct mac_context *mac, tpDphHashNode pSta, 676 struct pe_session *pe_session); 677 678 uint8_t lim_get_ht_capability(struct mac_context *, uint32_t, struct pe_session *); 679 QDF_STATUS lim_tx_complete(void *context, qdf_nbuf_t buf, bool free); 680 681 QDF_STATUS lim_validate_delts_req(struct mac_context *mac, 682 tpSirDeltsReq pDeltsReq, 683 tSirMacAddr peerMacAddr, 684 struct pe_session *pe_session); 685 686 void lim_pkt_free(struct mac_context *mac, 687 eFrameType frmType, uint8_t *pBD, void *body); 688 689 void lim_get_b_dfrom_rx_packet(struct mac_context *mac, void *body, uint32_t **pBD); 690 691 /** 692 * utils_power_xy() - calc result of base raised to power 693 * @base: Base value 694 * @power: Base raised to this Power value 695 * 696 * Given a base(X) and power(Y), this API will return 697 * the result of base raised to power - (X ^ Y) 698 * 699 * Return: Result of X^Y 700 * 701 */ 702 static inline uint32_t utils_power_xy(uint16_t base, uint16_t power) 703 { 704 uint32_t result = 1, i; 705 706 for (i = 0; i < power; i++) 707 result *= base; 708 709 return result; 710 } 711 712 QDF_STATUS lim_post_sm_state_update(struct mac_context *mac, 713 tSirMacHTMIMOPowerSaveState MIMOPSState, 714 uint8_t *pPeerStaMac, uint8_t sessionId); 715 716 void lim_delete_sta_context(struct mac_context *mac, struct scheduler_msg *limMsg); 717 void lim_delete_dialogue_token_list(struct mac_context *mac); 718 719 /** 720 * lim_get_channel_from_beacon() - extract channel number 721 * from beacon and convert to channel frequency 722 * @mac: Pointer to Global MAC structure 723 * @pBeacon: Pointer to beacon or probe rsp 724 * 725 * Return: channel frequency 726 */ 727 uint32_t lim_get_channel_from_beacon(struct mac_context *mac, 728 tpSchBeaconStruct pBeacon); 729 730 /** 731 * lim_get_nw_type() - Get type of the network from 732 * data packet or beacon 733 * @mac: Pointer to Global MAC structure 734 * @chan_freq: Channel frequency 735 * @type: Type of packet 736 * @pBeacon: Pointer to beacon or probe response 737 * 738 * Return: Network type a/b/g 739 */ 740 tSirNwType lim_get_nw_type(struct mac_context *mac, uint32_t chan_freq, 741 uint32_t type, tpSchBeaconStruct pBeacon); 742 743 void lim_set_tspec_uapsd_mask_per_session(struct mac_context *mac, 744 struct pe_session *pe_session, 745 struct mac_ts_info *pTsInfo, uint32_t action); 746 747 void lim_handle_heart_beat_timeout_for_session(struct mac_context *mac, 748 struct pe_session *pe_session); 749 750 /** 751 * lim_process_add_sta_rsp() - process WDA_ADD_STA_RSP from WMA 752 * @mac_ctx: Pointer to Global MAC structure 753 * @msg: msg from WMA 754 * 755 * Return: void 756 */ 757 void lim_process_add_sta_rsp(struct mac_context *mac_ctx, 758 struct scheduler_msg *msg); 759 760 void lim_update_beacon(struct mac_context *mac); 761 762 void lim_process_ap_mlm_add_sta_rsp(struct mac_context *mac, 763 struct scheduler_msg *limMsgQ, 764 struct pe_session *pe_session); 765 766 /** 767 * lim_process_ap_mlm_del_bss_rsp() - handle del bss response of AP 768 * @mac: Pointer to Global MAC structure 769 * @vdev_stop_rsp: pointer to vdev stop response 770 * @pe_session: pointer to pe_session 771 * 772 * Return: none 773 */ 774 void lim_process_ap_mlm_del_bss_rsp(struct mac_context *mac, 775 struct del_bss_resp *vdev_stop_rsp, 776 struct pe_session *pe_session); 777 778 void lim_process_ap_mlm_del_sta_rsp(struct mac_context *mac, 779 struct scheduler_msg *limMsgQ, 780 struct pe_session *pe_session); 781 782 /** 783 * ch_width_in_mhz() - API to get channel space in MHz 784 * 785 * For CH_WIDTH_80P80MHZ, the channel space is max channel space of one 786 * segment - 80MHz. 787 * 788 */ 789 static inline uint16_t ch_width_in_mhz(enum phy_ch_width ch_width) 790 { 791 switch (ch_width) { 792 case CH_WIDTH_40MHZ: 793 return 40; 794 case CH_WIDTH_80MHZ: 795 return 80; 796 case CH_WIDTH_160MHZ: 797 return 160; 798 case CH_WIDTH_80P80MHZ: 799 return 80; 800 case CH_WIDTH_5MHZ: 801 return 5; 802 case CH_WIDTH_10MHZ: 803 return 10; 804 case CH_WIDTH_320MHZ: 805 return 320; 806 default: 807 return 20; 808 } 809 } 810 811 struct pe_session *lim_is_ap_session_active(struct mac_context *mac); 812 813 #define limGetWscIEPtr(mac, ie, ie_len) \ 814 wlan_get_vendor_ie_ptr_from_oui(SIR_MAC_WSC_OUI, \ 815 SIR_MAC_WSC_OUI_SIZE, ie, ie_len) 816 817 #define limGetP2pIEPtr(mac, ie, ie_len) \ 818 wlan_get_vendor_ie_ptr_from_oui(SIR_MAC_P2P_OUI, \ 819 SIR_MAC_P2P_OUI_SIZE, ie, ie_len) 820 821 uint8_t lim_get_noa_attr_stream(struct mac_context *mac, uint8_t *pNoaStream, 822 struct pe_session *pe_session); 823 824 uint8_t lim_build_p2p_ie(struct mac_context *mac, uint8_t *ie, uint8_t *data, 825 uint8_t ie_len); 826 827 bool lim_isconnected_on_dfs_freq(struct mac_context *mac_ctx, 828 qdf_freq_t curr_chan_freq); 829 830 uint32_t lim_get_max_rate_flags(struct mac_context *mac_ctx, 831 tpDphHashNode sta_ds); 832 833 bool lim_check_vht_op_mode_change(struct mac_context *mac, 834 struct pe_session *pe_session, 835 uint8_t chanWidth, 836 uint8_t *peerMac); 837 #ifdef WLAN_FEATURE_11AX_BSS_COLOR 838 bool lim_send_he_ie_update(struct mac_context *mac_ctx, struct pe_session *pe_session); 839 #endif 840 bool lim_set_nss_change(struct mac_context *mac, struct pe_session *pe_session, 841 uint8_t rxNss, uint8_t *peerMac); 842 bool lim_check_membership_user_position(struct mac_context *mac, 843 struct pe_session *pe_session, 844 uint32_t membership, uint32_t userPosition); 845 846 /** 847 * enum ack_status - Indicate TX status of ASSOC/AUTH 848 * @ACKED : Ack is received. 849 * @NOT_ACKED : No Ack received. 850 * @SENT_FAIL : Failure while sending. 851 * 852 * Indicate if driver is waiting for ACK status of assoc/auth or ACK received 853 * for ASSOC/AUTH OR NO ACK is received for the assoc/auth sent or assoc/auth 854 * sent failed. 855 */ 856 enum assoc_ack_status { 857 ACKED, 858 NOT_ACKED, 859 SENT_FAIL, 860 }; 861 862 typedef enum { 863 WLAN_PE_DIAG_SCAN_REQ_EVENT = 0, 864 WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT, 865 WLAN_PE_DIAG_SCAN_RSP_EVENT, 866 WLAN_PE_DIAG_JOIN_REQ_EVENT, 867 WLAN_PE_DIAG_JOIN_RSP_EVENT, 868 WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, 869 WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, 870 WLAN_PE_DIAG_REASSOC_REQ_EVENT, 871 WLAN_PE_DIAG_REASSOC_RSP_EVENT, 872 WLAN_PE_DIAG_AUTH_REQ_EVENT, 873 WLAN_PE_DIAG_AUTH_RSP_EVENT = 10, 874 WLAN_PE_DIAG_DISASSOC_REQ_EVENT, 875 WLAN_PE_DIAG_DISASSOC_RSP_EVENT, 876 WLAN_PE_DIAG_DISASSOC_IND_EVENT, 877 WLAN_PE_DIAG_DISASSOC_CNF_EVENT, 878 WLAN_PE_DIAG_DEAUTH_REQ_EVENT, 879 WLAN_PE_DIAG_DEAUTH_RSP_EVENT, 880 WLAN_PE_DIAG_DEAUTH_IND_EVENT, 881 WLAN_PE_DIAG_START_BSS_REQ_EVENT, 882 WLAN_PE_DIAG_START_BSS_RSP_EVENT, 883 WLAN_PE_DIAG_AUTH_IND_EVENT = 20, 884 WLAN_PE_DIAG_ASSOC_IND_EVENT, 885 WLAN_PE_DIAG_ASSOC_CNF_EVENT, 886 WLAN_PE_DIAG_REASSOC_IND_EVENT, 887 WLAN_PE_DIAG_SWITCH_CHL_IND_EVENT, 888 WLAN_PE_DIAG_SWITCH_CHL_RSP_EVENT, 889 WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, 890 WLAN_PE_DIAG_STOP_BSS_RSP_EVENT, 891 WLAN_PE_DIAG_DEAUTH_CNF_EVENT, 892 WLAN_PE_DIAG_ADDTS_REQ_EVENT, 893 WLAN_PE_DIAG_ADDTS_RSP_EVENT = 30, 894 WLAN_PE_DIAG_DELTS_REQ_EVENT, 895 WLAN_PE_DIAG_DELTS_RSP_EVENT, 896 WLAN_PE_DIAG_DELTS_IND_EVENT, 897 WLAN_PE_DIAG_ENTER_BMPS_REQ_EVENT, 898 WLAN_PE_DIAG_ENTER_BMPS_RSP_EVENT, 899 WLAN_PE_DIAG_EXIT_BMPS_REQ_EVENT, 900 WLAN_PE_DIAG_EXIT_BMPS_RSP_EVENT, 901 WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT, 902 WLAN_PE_DIAG_ENTER_IMPS_REQ_EVENT, 903 WLAN_PE_DIAG_ENTER_IMPS_RSP_EVENT = 40, 904 WLAN_PE_DIAG_EXIT_IMPS_REQ_EVENT, 905 WLAN_PE_DIAG_EXIT_IMPS_RSP_EVENT, 906 WLAN_PE_DIAG_ENTER_UAPSD_REQ_EVENT, 907 WLAN_PE_DIAG_ENTER_UAPSD_RSP_EVENT, 908 WLAN_PE_DIAG_EXIT_UAPSD_REQ_EVENT, 909 WLAN_PE_DIAG_EXIT_UAPSD_RSP_EVENT, 910 WLAN_PE_DIAG_WOWL_ADD_BCAST_PTRN_EVENT, 911 WLAN_PE_DIAG_WOWL_DEL_BCAST_PTRN_EVENT, 912 WLAN_PE_DIAG_ENTER_WOWL_REQ_EVENT, 913 WLAN_PE_DIAG_ENTER_WOWL_RSP_EVENT = 50, 914 WLAN_PE_DIAG_EXIT_WOWL_REQ_EVENT, 915 WLAN_PE_DIAG_EXIT_WOWL_RSP_EVENT, 916 WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, 917 WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, 918 WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, 919 WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, 920 WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT, 921 WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, 922 WLAN_PE_DIAG_PREAUTH_DONE, 923 WLAN_PE_DIAG_REASSOCIATING = 60, 924 WLAN_PE_DIAG_CONNECTED, 925 WLAN_PE_DIAG_ASSOC_REQ_EVENT, 926 WLAN_PE_DIAG_AUTH_COMP_EVENT, 927 WLAN_PE_DIAG_ASSOC_COMP_EVENT, 928 WLAN_PE_DIAG_AUTH_START_EVENT, 929 WLAN_PE_DIAG_ASSOC_START_EVENT, 930 WLAN_PE_DIAG_REASSOC_START_EVENT, 931 WLAN_PE_DIAG_ROAM_AUTH_START_EVENT, 932 WLAN_PE_DIAG_ROAM_AUTH_COMP_EVENT, 933 WLAN_PE_DIAG_ROAM_ASSOC_START_EVENT = 70, 934 WLAN_PE_DIAG_ROAM_ASSOC_COMP_EVENT, 935 WLAN_PE_DIAG_SCAN_COMPLETE_EVENT, 936 WLAN_PE_DIAG_SCAN_RESULT_FOUND_EVENT, 937 WLAN_PE_DIAG_ASSOC_TIMEOUT, 938 WLAN_PE_DIAG_AUTH_TIMEOUT, 939 WLAN_PE_DIAG_DEAUTH_FRAME_EVENT, 940 WLAN_PE_DIAG_DISASSOC_FRAME_EVENT, 941 WLAN_PE_DIAG_AUTH_ACK_EVENT, 942 WLAN_PE_DIAG_ASSOC_ACK_EVENT, 943 WLAN_PE_DIAG_AUTH_ALGO_NUM, 944 } WLAN_PE_DIAG_EVENT_TYPE; 945 946 #ifdef FEATURE_WLAN_DIAG_SUPPORT 947 void lim_diag_event_report(struct mac_context *mac, uint16_t eventType, 948 struct pe_session *pe_session, uint16_t status, 949 uint16_t reasonCode); 950 /** 951 * lim_diag_mgmt_tx_event_report() - to log TX event to external application 952 * @mac_ctx: mac context 953 * @mgmt_hdr: 802.11 mgmt header of given frame 954 * @session: PE session for given frame 955 * @result_code: result code of to be populated in TX frame 956 * @reason_code: reason code if TX OTA status 957 * 958 * Anytime driver sends some mgmt frame down to firmware for OTA delivery, 959 * log mgmt frame through DIAG utility. Don't log frames which come too 960 * excessively. 961 * 962 * Return: void 963 */ 964 void lim_diag_mgmt_tx_event_report(struct mac_context *mac_ctx, void *mgmt_hdr, 965 struct pe_session *session, uint16_t result_code, 966 uint16_t reason_code); 967 /** 968 * lim_diag_mgmt_rx_event_report() - to log RX event to external application 969 * @mac_ctx: mac context 970 * @mgmt_hdr: 802.11 mgmt header of given frame 971 * @session: PE session for given frame 972 * @result_code: result code given in RX frame 973 * @reason_code: reason code for RX OTA status 974 * 975 * Anytime driver receives some mgmt frame from firmware OTA, 976 * log mgmt frame through DIAG utility. Don't log frames which come too 977 * excessively. 978 * 979 * Return: void 980 */ 981 void lim_diag_mgmt_rx_event_report(struct mac_context *mac_ctx, void *mgmt_hdr, 982 struct pe_session *session, uint16_t result_code, 983 uint16_t reason_code); 984 #else 985 static inline void lim_diag_event_report(struct mac_context *mac, uint16_t 986 eventType, struct pe_session *pe_session, uint16_t status, 987 uint16_t reasonCode) {} 988 static inline 989 void lim_diag_mgmt_tx_event_report(struct mac_context *mac_ctx, void *mgmt_hdr, 990 struct pe_session *session, uint16_t result_code, 991 uint16_t reason_code) {} 992 static inline 993 void lim_diag_mgmt_rx_event_report(struct mac_context *mac_ctx, void *mgmt_hdr, 994 struct pe_session *session, uint16_t result_code, 995 uint16_t reason_code) {} 996 #endif /* FEATURE_WLAN_DIAG_SUPPORT */ 997 998 void pe_set_resume_channel(struct mac_context *mac, uint16_t channel, 999 ePhyChanBondState cbState); 1000 1001 void lim_get_short_slot_from_phy_mode(struct mac_context *mac, 1002 struct pe_session *pe_session, 1003 uint32_t phyMode, uint8_t *pShortSlotEnable); 1004 1005 void lim_clean_up_disassoc_deauth_req(struct mac_context *mac, uint8_t *staMac, 1006 bool cleanRxPath); 1007 1008 bool lim_check_disassoc_deauth_ack_pending(struct mac_context *mac, 1009 uint8_t *staMac); 1010 1011 void lim_pmf_sa_query_timer_handler(void *pMacGlobal, uint32_t param); 1012 void lim_pmf_comeback_timer_callback(void *context); 1013 void lim_set_protected_bit(struct mac_context *mac, 1014 struct pe_session *pe_session, 1015 tSirMacAddr peer, tpSirMacMgmtHdr pMacHdr); 1016 1017 void lim_set_ht_caps(struct mac_context *p_mac, uint8_t *p_ie_start, 1018 uint32_t num_bytes); 1019 1020 void lim_set_vht_caps(struct mac_context *p_mac, uint8_t *p_ie_start, 1021 uint32_t num_bytes); 1022 bool lim_validate_received_frame_a1_addr(struct mac_context *mac_ctx, 1023 tSirMacAddr a1, struct pe_session *session); 1024 void lim_set_stads_rtt_cap(tpDphHashNode sta_ds, struct s_ext_cap *ext_cap, 1025 struct mac_context *mac_ctx); 1026 1027 void lim_check_and_reset_protection_params(struct mac_context *mac_ctx); 1028 1029 QDF_STATUS lim_send_ext_cap_ie(struct mac_context *mac_ctx, uint32_t session_id, 1030 tDot11fIEExtCap *extracted_extcap, bool merge); 1031 1032 /** 1033 * lim_send_ies_per_band() - gets ht and vht capability and send to firmware via 1034 * wma 1035 * @mac_ctx: global mac context 1036 * @vdev_id: vdev for which IE is targeted 1037 * @dot11_mode: vdev dot11 mode 1038 * @device_mode: device mode 1039 * 1040 * This function gets ht and vht capability and send to firmware via wma 1041 * 1042 * Return: status of operation 1043 */ 1044 QDF_STATUS lim_send_ies_per_band(struct mac_context *mac_ctx, 1045 uint8_t vdev_id, 1046 enum csr_cfgdot11mode dot11_mode, 1047 enum QDF_OPMODE device_mode); 1048 1049 /** 1050 * lim_update_connect_rsn_ie() - Update the connection RSN IE 1051 * @session: PE session 1052 * @rsn_ie_buf: RSN IE buffer 1053 * @pmksa: PMKSA entry for the connecting AP 1054 * 1055 * Return: None 1056 */ 1057 void 1058 lim_update_connect_rsn_ie(struct pe_session *session, uint8_t *rsn_ie_buf, 1059 struct wlan_crypto_pmksa *pmksa); 1060 1061 /** 1062 * lim_send_action_frm_tb_ppdu_cfg() - sets action frame in TB PPDU cfg to FW 1063 * @mac_ctx: global MAC context 1064 * @vdev_id: vdev id 1065 * @cfg: config setting 1066 * 1067 * Preapres the vendor action frame and send action frame in HE TB PPDU 1068 * configuration to FW. 1069 * 1070 * Return: QDF_STATUS 1071 */ 1072 QDF_STATUS lim_send_action_frm_tb_ppdu_cfg(struct mac_context *mac_ctx, 1073 uint32_t vdev_id, 1074 uint8_t cfg); 1075 1076 void lim_update_extcap_struct(struct mac_context *mac_ctx, uint8_t *buf, 1077 tDot11fIEExtCap *ext_cap); 1078 QDF_STATUS lim_strip_extcap_update_struct(struct mac_context *mac_ctx, 1079 uint8_t *addn_ie, uint16_t *addn_ielen, tDot11fIEExtCap *dst); 1080 void lim_merge_extcap_struct(tDot11fIEExtCap *dst, tDot11fIEExtCap *src, 1081 bool add); 1082 1083 /** 1084 * lim_strip_he_ies_from_add_ies() - This function strip HE IE from add_ie 1085 * @mac_ctx: pointer to mac context 1086 * @pe_session: pointer to PE session 1087 * 1088 * This API is to strip HE IE from add_ie 1089 * 1090 * Return: none 1091 */ 1092 void lim_strip_he_ies_from_add_ies(struct mac_context *mac_ctx, 1093 struct pe_session *session); 1094 1095 void lim_strip_eht_ies_from_add_ies(struct mac_context *mac_ctx, 1096 struct pe_session *session); 1097 1098 /** 1099 * lim_strip_wapi_ies_from_add_ies() - This function strip WAPI IE from add_ie 1100 * @mac_ctx: pointer to mac context 1101 * @pe_session: pointer to PE session 1102 * 1103 * This API is to strip WAPI IE from add_ie 1104 * 1105 * Return: none 1106 */ 1107 void lim_strip_wapi_ies_from_add_ies(struct mac_context *mac_ctx, 1108 struct pe_session *session); 1109 1110 /** 1111 * lim_del_pmf_sa_query_timer() - This function deletes SA query timer 1112 * @mac_ctx: pointer to mac context 1113 * @pe_session: pointer to PE session 1114 * 1115 * This API is to delete the PMF SA query timer created for each associated STA 1116 * 1117 * Return: none 1118 */ 1119 void lim_del_pmf_sa_query_timer(struct mac_context *mac_ctx, struct pe_session *pe_session); 1120 1121 /** 1122 * lim_get_vdev_rmf_capable() - get rmf capable - MFPC 1123 * @mac: mac context 1124 * @session: pe session 1125 * 1126 * Get intersection of local & peer (BSS) RSN caps 1127 * and check MFPC bit. 1128 * 1129 * Return: bool 1130 */ 1131 bool lim_get_vdev_rmf_capable(struct mac_context *mac, 1132 struct pe_session *session); 1133 1134 /** 1135 * lim_add_bssid_to_reject_list:- Add rssi reject Ap info to denylist mgr. 1136 * @pdev: pdev 1137 * @entry: info of the BSSID to be put in rssi reject list. 1138 * 1139 * This API will add the passed ap info to the rssi reject list. 1140 * 1141 */ 1142 void 1143 lim_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev, 1144 struct sir_rssi_disallow_lst *entry); 1145 1146 /** 1147 * lim_strip_op_class_update_struct - strip sup op class IE and populate 1148 * the dot11f structure 1149 * @mac_ctx: global MAC context 1150 * @addn_ie: Additional IE buffer 1151 * @addn_ielen: Length of additional IE 1152 * @dst: Supp operating class IE structure to be updated 1153 * 1154 * This function is used to strip supp op class IE from IE buffer and 1155 * update the passed structure. 1156 * 1157 * Return: QDF_STATUS 1158 */ 1159 QDF_STATUS lim_strip_supp_op_class_update_struct(struct mac_context *mac_ctx, 1160 uint8_t *addn_ie, uint16_t *addn_ielen, 1161 tDot11fIESuppOperatingClasses *dst); 1162 1163 uint8_t lim_get_80Mhz_center_channel(uint8_t primary_channel); 1164 void lim_update_obss_scanparams(struct pe_session *session, 1165 tDot11fIEOBSSScanParameters *scan_params); 1166 void lim_init_obss_params(struct mac_context *mac_ctx, struct pe_session *session); 1167 #ifdef WLAN_FEATURE_HOST_ROAM 1168 uint32_t lim_create_timers_host_roam(struct mac_context *mac_ctx); 1169 /** 1170 * lim_delete_timers_host_roam() - Delete timers used in host based roaming 1171 * @mac_ctx: Global MAC context 1172 * 1173 * Delete reassoc and preauth timers 1174 * 1175 * Return: none 1176 */ 1177 void lim_delete_timers_host_roam(struct mac_context *mac_ctx); 1178 /** 1179 * lim_deactivate_timers_host_roam() - deactivate timers used in host based 1180 * roaming 1181 * @mac_ctx: Global MAC context 1182 * 1183 * Delete reassoc and preauth timers 1184 * 1185 * Return: none 1186 */ 1187 void lim_deactivate_timers_host_roam(struct mac_context *mac_ctx); 1188 void lim_deactivate_and_change_timer_host_roam(struct mac_context *mac_ctx, 1189 uint32_t timer_id); 1190 #else 1191 static inline uint32_t lim_create_timers_host_roam(struct mac_context *mac_ctx) 1192 { 1193 return 0; 1194 } 1195 static inline void lim_delete_timers_host_roam(struct mac_context *mac_ctx) 1196 {} 1197 static inline void lim_deactivate_timers_host_roam(struct mac_context *mac_ctx) {} 1198 static inline void lim_deactivate_and_change_timer_host_roam( 1199 struct mac_context *mac_ctx, uint32_t timer_id) 1200 {} 1201 #endif 1202 1203 uint8_t lim_compute_ext_cap_ie_length(tDot11fIEExtCap *ext_cap); 1204 1205 void lim_update_caps_info_for_bss(struct mac_context *mac_ctx, 1206 uint16_t *caps, uint16_t bss_caps); 1207 void lim_send_set_dtim_period(struct mac_context *mac_ctx, uint8_t dtim_period, 1208 struct pe_session *session); 1209 1210 QDF_STATUS lim_strip_ie(struct mac_context *mac_ctx, 1211 uint8_t *addn_ie, uint16_t *addn_ielen, 1212 uint8_t eid, enum size_of_len_field size_of_len_field, 1213 uint8_t *oui, uint8_t out_len, uint8_t *extracted_ie, 1214 uint32_t eid_max_len); 1215 1216 #define MCSMAPMASK1x1 0x3 1217 #define MCSMAPMASK2x2 0xC 1218 1219 #ifdef WLAN_FEATURE_11AX 1220 1221 /** 1222 * lim_intersect_ap_he_caps() - Intersect AP capability with self STA capability 1223 * @session: pointer to PE session 1224 * @add_bss: pointer to ADD BSS params 1225 * @beacon: pointer to beacon 1226 * @assoc_rsp: pointer to assoc response 1227 * @bss_desc: pointer to BSS description 1228 * 1229 * Return: None 1230 */ 1231 void lim_intersect_ap_he_caps(struct pe_session *session, 1232 struct bss_params *add_bss, 1233 tSchBeaconStruct *pBeaconStruct, 1234 tpSirAssocRsp assoc_rsp, 1235 struct bss_description *bss_desc); 1236 1237 /** 1238 * lim_intersect_sta_he_caps() - Intersect STA capability with SAP capability 1239 * @mac_ctx: pointer to the MAC context 1240 * @assoc_req: pointer to assoc request 1241 * @session: pointer to PE session 1242 * @sta_ds: pointer to STA dph hash table entry 1243 * 1244 * Return: None 1245 */ 1246 void lim_intersect_sta_he_caps(struct mac_context *mac_ctx, 1247 tpSirAssocReq assoc_req, 1248 struct pe_session *session, 1249 tpDphHashNode sta_ds); 1250 1251 /** 1252 * lim_add_he_cap() - Copy HE capability into Add sta params 1253 * @mac_ctx: Global MAC context 1254 * @pe_session: pe session entry 1255 * @add_sta_params: pointer to add sta params 1256 * @assoc_req: pointer to Assoc request 1257 * 1258 * Return: None 1259 */ 1260 void lim_add_he_cap(struct mac_context *mac_ctx, struct pe_session *pe_session, 1261 tpAddStaParams add_sta_params, tpSirAssocReq assoc_req); 1262 1263 /** 1264 * lim_add_self_he_cap() - Copy HE capability into add sta from PE session 1265 * @add_sta_params: pointer to add sta params 1266 * @session: pointer to PE Session 1267 * 1268 * Return: None 1269 */ 1270 void lim_add_self_he_cap(tpAddStaParams add_sta_params, struct pe_session *session); 1271 1272 /** 1273 * lim_add_bss_he_cap() - Copy HE capability into ADD BSS params 1274 * @add_bss: pointer to add bss params 1275 * @assoc_rsp: pointer to assoc response 1276 * 1277 * Return: None 1278 */ 1279 void lim_add_bss_he_cap(struct bss_params *add_bss, tpSirAssocRsp assoc_rsp); 1280 1281 /** 1282 * lim_add_bss_he_cfg() - Set HE config to BSS params 1283 * @add_bss: pointer to add bss params 1284 * @session: Pointer to Session entry struct 1285 * 1286 * Return: None 1287 */ 1288 void lim_add_bss_he_cfg(struct bss_params *add_bss, struct pe_session *session); 1289 1290 /** 1291 * lim_copy_bss_he_cap() - Copy HE capability into PE session from start bss 1292 * @session: pointer to PE session 1293 * 1294 * Return: None 1295 */ 1296 void lim_copy_bss_he_cap(struct pe_session *session); 1297 1298 /** 1299 * lim_update_he_caps_mcs() - Update he caps MCS 1300 * @mac: MAC context 1301 * @session: pointer to PE session 1302 * 1303 * Return: None 1304 */ 1305 void lim_update_he_caps_mcs(struct mac_context *mac, 1306 struct pe_session *session); 1307 1308 1309 /** 1310 * lim_update_he_6gop_assoc_resp() - Update HE 6GHz op info to BSS params 1311 * @add_bss: pointer to add bss params 1312 * @he_op: Pointer to HE operation info IE 1313 * @session: Pointer to Session entry struct 1314 * 1315 * Return: None 1316 */ 1317 void lim_update_he_6gop_assoc_resp(struct bss_params *pAddBssParams, 1318 tDot11fIEhe_op *he_op, 1319 struct pe_session *pe_session); 1320 /** 1321 * lim_copy_join_req_he_cap() - Copy HE capability to PE session from Join req 1322 * and update as per bandwidth supported 1323 * @session: pointer to PE session 1324 * 1325 * Return: None 1326 */ 1327 void lim_copy_join_req_he_cap(struct pe_session *session); 1328 1329 /** 1330 * lim_log_he_6g_cap() - Print HE 6G cap IE 1331 * @mac: pointer to MAC context 1332 * @he_6g_cap: pointer to HE 6G cap IE 1333 * 1334 * Print HE 6G caps stored as dot11f structure 1335 * 1336 * Return: None 1337 */ 1338 void lim_log_he_6g_cap(struct mac_context *mac, 1339 tDot11fIEhe_6ghz_band_cap *he_6g_cap); 1340 1341 /** 1342 * lim_log_he_op() - Print HE Operation 1343 * @mac: pointer to MAC context 1344 * @he_op: pointer to HE Operation 1345 * @session: pointer to PE session 1346 * 1347 * Print HE operation stored as dot11f structure 1348 * 1349 * Return: None 1350 */ 1351 void lim_log_he_op(struct mac_context *mac, tDot11fIEhe_op *he_ops, 1352 struct pe_session *session); 1353 1354 #ifdef WLAN_FEATURE_11AX_BSS_COLOR 1355 /** 1356 * lim_log_he_bss_color() - Print HE bss color 1357 * @mac: pointer to MAC context 1358 * @he_bss_color: pointer to HE bss color 1359 * 1360 * Print HE bss color IE 1361 * 1362 * Return: None 1363 */ 1364 void lim_log_he_bss_color(struct mac_context *mac, 1365 tDot11fIEbss_color_change *he_bss_color); 1366 #endif 1367 1368 /** 1369 * lim_log_he_cap() - Print HE capabilities 1370 * @mac: pointer to MAC context 1371 * @he_cap: pointer to HE Capability 1372 * 1373 * Received HE capabilities are converted into dot11f structure. 1374 * This function will print all the HE capabilities as stored 1375 * in the dot11f structure. 1376 * 1377 * Return: None 1378 */ 1379 void lim_log_he_cap(struct mac_context *mac, tDot11fIEhe_cap *he_cap); 1380 1381 /** 1382 * lim_check_he_80_mcs11_supp() - Check whether MCS 0-11 rates are supported 1383 * @session: pointer to PE session 1384 * @he_cap: pointer to HE capabilities 1385 * 1386 * Return: true if MCS 0-11 rates are supported 1387 */ 1388 bool lim_check_he_80_mcs11_supp(struct pe_session *session, 1389 tDot11fIEhe_cap *he_cap); 1390 1391 void lim_check_and_force_he_ldpc_cap(struct pe_session *session, 1392 tDot11fIEhe_cap *he_cap); 1393 1394 /** 1395 * lim_update_stads_he_caps() - Copy HE capability into STA DPH hash table entry 1396 * @mac_ctx: pointer to mac context 1397 * @sta_ds: pointer to sta dph hash table entry 1398 * @assoc_rsp: pointer to assoc response 1399 * @session_entry: pointer to PE session 1400 * @beacon: pointer to beacon 1401 * 1402 * Return: None 1403 */ 1404 void lim_update_stads_he_caps(struct mac_context *mac_ctx, 1405 tpDphHashNode sta_ds, tpSirAssocRsp assoc_rsp, 1406 struct pe_session *session_entry, 1407 tSchBeaconStruct *beacon); 1408 1409 /** 1410 * lim_update_usr_he_cap() - Update HE capability based on userspace 1411 * @mac_ctx: global mac context 1412 * @session: PE session entry 1413 * 1414 * Parse the HE Capability IE and populate the fields to be 1415 * sent to FW as part of add bss and update PE session. 1416 */ 1417 void lim_update_usr_he_cap(struct mac_context *mac_ctx, struct pe_session *session); 1418 1419 /** 1420 * lim_decide_he_op() - Determine HE operation elements 1421 * @mac_ctx: global mac context 1422 * @he_ops: mlme he ops 1423 * @session: PE session entry 1424 * 1425 * Parse the HE Operation IE and populate the fields to be 1426 * sent to FW as part of add bss. 1427 */ 1428 void lim_decide_he_op(struct mac_context *mac_ctx, uint32_t *mlme_he_ops, 1429 struct pe_session *session); 1430 1431 /** 1432 * lim_update_sta_he_capable(): Update he_capable in add sta params 1433 * @mac: pointer to MAC context 1434 * @add_sta_params: pointer to add sta params 1435 * @sta_ds: pointer to dph hash table entry 1436 * @session_entry: pointer to PE session 1437 * 1438 * Return: None 1439 */ 1440 void lim_update_sta_he_capable(struct mac_context *mac, 1441 tpAddStaParams add_sta_params, tpDphHashNode sta_ds, 1442 struct pe_session *session_entry); 1443 1444 static inline bool lim_is_session_he_capable(struct pe_session *session) 1445 { 1446 return session->he_capable; 1447 } 1448 1449 /** 1450 * lim_update_he_bw_cap_mcs(): Update he mcs map per bandwidth 1451 * @session_entry: pointer to PE session 1452 * @beacon: pointer to beacon 1453 * 1454 * Return: None 1455 */ 1456 void lim_update_he_bw_cap_mcs(struct pe_session *session, 1457 tSirProbeRespBeacon *beacon); 1458 1459 static inline bool lim_is_he_6ghz_band(struct pe_session *session) 1460 { 1461 return session->he_6ghz_band; 1462 } 1463 1464 /** 1465 * lim_get_session_he_frag_cap(): Get session HE fragmentation cap 1466 * @session: pointer to session 1467 * 1468 * Return: HE fragmentation value 1469 */ 1470 static inline uint8_t lim_get_session_he_frag_cap(struct pe_session *session) 1471 { 1472 return session->he_config.fragmentation; 1473 } 1474 1475 static inline bool lim_is_sta_he_capable(tpDphHashNode sta_ds) 1476 { 1477 return sta_ds->mlmStaContext.he_capable; 1478 } 1479 1480 /** 1481 * lim_update_bss_he_capable() - Update he_capable in add BSS params 1482 * @mac: pointer to MAC context 1483 * @add_bss: pointer to add BSS params 1484 * 1485 * Return: None 1486 */ 1487 void lim_update_bss_he_capable(struct mac_context *mac, 1488 struct bss_params *add_bss); 1489 1490 /** 1491 * lim_update_stads_he_capable() - Update he_capable in sta ds context 1492 * @sta_ds: pointer to sta ds 1493 * @assoc_req: pointer to assoc request 1494 * 1495 * Return: None 1496 */ 1497 void lim_update_stads_he_capable(tpDphHashNode sta_ds, tpSirAssocReq assoc_req); 1498 1499 /** 1500 * lim_update_session_he_capable(): Update he_capable in PE session 1501 * @mac: pointer to MAC context 1502 * @session: pointer to PE session 1503 * 1504 * Return: None 1505 */ 1506 void lim_update_session_he_capable(struct mac_context *mac, struct pe_session *session); 1507 1508 /** 1509 * lim_update_session_he_capable_chan_switch(): Update he_capable in PE session 1510 * @mac: pointer to MAC context 1511 * @session: pointer to PE session 1512 * @new_chan_freq: new channel frequency Mhz 1513 * 1514 * Update session he capable during AP channel switching 1515 * 1516 * Return: None 1517 */ 1518 void lim_update_session_he_capable_chan_switch(struct mac_context *mac, 1519 struct pe_session *session, 1520 uint32_t new_chan_freq); 1521 1522 /** 1523 * lim_set_he_caps() - update HE caps to be sent to FW as part of scan IE 1524 * @mac: pointer to MAC 1525 * @ie_start: pointer to start of IE buffer 1526 * @num_bytes: length of IE buffer 1527 * @band: 2g or 5g band 1528 * 1529 * Return: None 1530 */ 1531 void lim_set_he_caps(struct mac_context *mac, uint8_t *ie_start, 1532 uint32_t num_bytes, uint8_t band); 1533 1534 /** 1535 * lim_send_he_caps_ie() - gets HE capability and send to firmware via wma 1536 * @mac_ctx: global mac context 1537 * @device_mode: VDEV op mode 1538 * @vdev_id: vdev for which IE is targeted 1539 * 1540 * This function gets HE capability and send to firmware via wma 1541 * 1542 * Return: QDF_STATUS 1543 */ 1544 QDF_STATUS lim_send_he_caps_ie(struct mac_context *mac_ctx, 1545 enum QDF_OPMODE device_mode, 1546 uint8_t vdev_id); 1547 1548 /** 1549 * lim_populate_he_mcs_per_bw() - pouldate HE mcs set per BW (le 80, 160, 80+80) 1550 * @mac_ctx: Global MAC context 1551 * @self_rx: self rx mcs set 1552 * @self_tx: self tx mcs set 1553 * @peer_rx: peer rx mcs set 1554 * @peer_tx: peer tx mcs set 1555 * @nss: nss 1556 * @cfg_rx_param: rx wni param to read 1557 * @cfg_tx_param: tx wni param to read 1558 * 1559 * MCS values are interpreted as in IEEE 11ax-D1.4 spec onwards 1560 * +-----------------------------------------------------+ 1561 * | SS8 | SS7 | SS6 | SS5 | SS4 | SS3 | SS2 | SS1 | 1562 * +-----------------------------------------------------+ 1563 * | 15-14 | 13-12 | 11-10 | 9-8 | 7-6 | 5-4 | 3-2 | 1-0 | 1564 * +-----------------------------------------------------+ 1565 * 1566 * Return: status of operation 1567 */ 1568 QDF_STATUS lim_populate_he_mcs_per_bw(struct mac_context *mac_ctx, 1569 uint16_t *supp_rx_mcs, 1570 uint16_t *supp_tx_mcs, 1571 uint16_t peer_rx, uint16_t peer_tx, 1572 uint8_t nss, uint16_t rx_mcs, 1573 uint16_t tx_mcs); 1574 1575 /** 1576 * lim_populate_he_mcs_set() - function to populate HE mcs rate set 1577 * @mac_ctx: pointer to global mac structure 1578 * @rates: pointer to supported rate set 1579 * @peer_vht_caps: pointer to peer HE capabilities 1580 * @session_entry: pe session entry 1581 * @nss: number of spatial streams 1582 * 1583 * Populates HE mcs rate set based on peer and self capabilities 1584 * 1585 * Return: QDF_STATUS 1586 */ 1587 QDF_STATUS lim_populate_he_mcs_set(struct mac_context *mac_ctx, 1588 struct supported_rates *rates, 1589 tDot11fIEhe_cap *peer_he_caps, 1590 struct pe_session *session_entry, 1591 uint8_t nss); 1592 1593 /** 1594 * lim_update_stads_he_6ghz_op() - Update sta ds channel info 1595 * @session: pe session 1596 * @sta_ds: pointer to sta ds struct 1597 1598 * Update sta_ds channel width. 1599 * 1600 * Return: void 1601 */ 1602 void lim_update_stads_he_6ghz_op(struct pe_session *session, 1603 tpDphHashNode sta_ds); 1604 1605 /** 1606 * lim_update_he_6ghz_band_caps() - Update he 6ghz band caps 1607 * @mac_ctx: Global MAC context 1608 * @pAssocRsp: contains the structured assoc/reassoc Response got from AP 1609 * @add_bss: pointer to ADD BSS params 1610 * 1611 * Update 6ghz band caps based on HE capability 1612 * 1613 * Return: none 1614 */ 1615 void lim_update_he_6ghz_band_caps(struct mac_context *mac, 1616 tDot11fIEhe_6ghz_band_cap *he_6ghz_band_cap, 1617 tpAddStaParams params); 1618 1619 #else 1620 static inline void lim_add_he_cap(struct mac_context *mac_ctx, 1621 struct pe_session *pe_session, 1622 tpAddStaParams add_sta_params, 1623 tpSirAssocReq assoc_req) 1624 { 1625 } 1626 1627 static inline void lim_add_self_he_cap(tpAddStaParams add_sta_params, 1628 struct pe_session *session) 1629 { 1630 } 1631 1632 static inline void lim_add_bss_he_cap(struct bss_params *add_bss, 1633 tpSirAssocRsp assoc_rsp) 1634 { 1635 return; 1636 } 1637 1638 static inline void lim_add_bss_he_cfg(struct bss_params *add_bss, 1639 struct pe_session *session) 1640 { 1641 } 1642 1643 static inline void lim_update_he_6gop_assoc_resp( 1644 struct bss_params *pAddBssParams, 1645 tDot11fIEhe_op *he_op, 1646 struct pe_session *pe_session) 1647 { 1648 } 1649 1650 static inline void lim_intersect_ap_he_caps(struct pe_session *session, 1651 struct bss_params *add_bss, 1652 tSchBeaconStruct *pBeaconStruct, 1653 tpSirAssocRsp assoc_rsp, 1654 struct bss_description *bss_desc) 1655 { 1656 return; 1657 } 1658 1659 static inline void lim_intersect_sta_he_caps(struct mac_context *mac_ctx, 1660 tpSirAssocReq assoc_req, 1661 struct pe_session *session, 1662 tpDphHashNode sta_ds) 1663 { 1664 } 1665 1666 static inline void lim_update_stads_he_caps(struct mac_context *mac_ctx, 1667 tpDphHashNode sta_ds, 1668 tpSirAssocRsp assoc_rsp, 1669 struct pe_session *session_entry, 1670 tSchBeaconStruct *beacon) 1671 { 1672 return; 1673 } 1674 1675 static inline void lim_update_usr_he_cap(struct mac_context *mac_ctx, 1676 struct pe_session *session) 1677 { 1678 } 1679 1680 static inline void lim_decide_he_op(struct mac_context *mac_ctx, 1681 uint32_t *mlme_he_ops, struct pe_session *session) 1682 { 1683 } 1684 1685 static inline 1686 void lim_copy_bss_he_cap(struct pe_session *session) 1687 { 1688 } 1689 1690 static inline 1691 void lim_update_he_caps_mcs(struct mac_context *mac, struct pe_session *session) 1692 { 1693 } 1694 1695 static inline void lim_copy_join_req_he_cap(struct pe_session *session) 1696 { 1697 } 1698 1699 static inline void lim_log_he_op(struct mac_context *mac, 1700 tDot11fIEhe_op *he_ops, 1701 struct pe_session *session) 1702 { 1703 } 1704 1705 static inline void lim_log_he_cap(struct mac_context *mac, 1706 tDot11fIEhe_cap *he_cap) 1707 { 1708 } 1709 1710 static inline void lim_update_sta_he_capable(struct mac_context *mac, 1711 tpAddStaParams add_sta_params, 1712 tpDphHashNode sta_ds, struct pe_session *session_entry) 1713 { 1714 } 1715 1716 static inline bool lim_is_session_he_capable(struct pe_session *session) 1717 { 1718 return false; 1719 } 1720 1721 static inline void lim_update_he_bw_cap_mcs(struct pe_session *session, 1722 tSirProbeRespBeacon *beacon) 1723 { 1724 } 1725 1726 static inline bool lim_is_he_6ghz_band(struct pe_session *session) 1727 { 1728 return false; 1729 } 1730 1731 static inline uint8_t lim_get_session_he_frag_cap(struct pe_session *session) 1732 { 1733 return 0; 1734 } 1735 1736 static inline bool lim_is_sta_he_capable(tpDphHashNode sta_ds) 1737 { 1738 return false; 1739 } 1740 1741 static inline void lim_update_bss_he_capable(struct mac_context *mac, 1742 struct bss_params *add_bss) 1743 { 1744 } 1745 1746 static inline void lim_update_stads_he_capable(tpDphHashNode sta_ds, 1747 tpSirAssocReq assoc_req) 1748 { 1749 } 1750 1751 static inline void lim_update_session_he_capable(struct mac_context *mac, 1752 struct pe_session *session) 1753 { 1754 } 1755 1756 static inline 1757 void lim_update_session_he_capable_chan_switch(struct mac_context *mac, 1758 struct pe_session *session, 1759 uint32_t new_chan_freq) 1760 { 1761 } 1762 1763 static inline void lim_set_he_caps(struct mac_context *mac, struct pe_session *session, 1764 uint8_t *ie_start, uint32_t num_bytes, 1765 uint8_t band) 1766 { 1767 } 1768 1769 static inline QDF_STATUS lim_send_he_caps_ie(struct mac_context *mac_ctx, 1770 enum QDF_OPMODE device_mode, 1771 uint8_t vdev_id) 1772 { 1773 return QDF_STATUS_SUCCESS; 1774 } 1775 1776 static inline 1777 QDF_STATUS lim_populate_he_mcs_set(struct mac_context *mac_ctx, 1778 struct supported_rates *rates, 1779 tDot11fIEhe_cap *peer_he_caps, 1780 struct pe_session *session_entry, 1781 uint8_t nss) 1782 { 1783 return QDF_STATUS_SUCCESS; 1784 } 1785 1786 static inline void 1787 lim_update_stads_he_6ghz_op(struct pe_session *session, 1788 tpDphHashNode sta_ds) 1789 { 1790 } 1791 1792 static inline void 1793 lim_update_he_6ghz_band_caps(struct mac_context *mac, 1794 tDot11fIEhe_6ghz_band_cap *he_6ghz_band_cap, 1795 tpAddStaParams params) 1796 { 1797 } 1798 #endif 1799 1800 #ifdef WLAN_FEATURE_11BE 1801 static inline bool lim_is_session_eht_capable(struct pe_session *session) 1802 { 1803 if (!session) 1804 return false; 1805 1806 return session->eht_capable; 1807 } 1808 1809 static inline bool lim_is_sta_eht_capable(tpDphHashNode sta_ds) 1810 { 1811 return sta_ds->mlmStaContext.eht_capable; 1812 } 1813 1814 QDF_STATUS lim_strip_eht_op_ie(struct mac_context *mac_ctx, 1815 uint8_t *frame_ies, 1816 uint16_t *ie_buf_size, 1817 uint8_t *eht_op_ie); 1818 1819 QDF_STATUS lim_strip_eht_cap_ie(struct mac_context *mac_ctx, 1820 uint8_t *frame_ies, 1821 uint16_t *ie_buf_size, 1822 uint8_t *eht_cap_ie); 1823 1824 /** 1825 * lim_populate_eht_mcs_set() - function to populate EHT mcs rate set 1826 * @mac_ctx: pointer to global mac structure 1827 * @rates: pointer to supported rate set 1828 * @peer_eht_caps: pointer to peer EHT capabilities 1829 * @session_entry: pe session entry 1830 * @nss: number of spatial streams 1831 * 1832 * Populates EHT mcs rate set based on peer and self capabilities 1833 * 1834 * Return: QDF_STATUS 1835 */ 1836 QDF_STATUS lim_populate_eht_mcs_set(struct mac_context *mac_ctx, 1837 struct supported_rates *rates, 1838 tDot11fIEeht_cap *peer_eht_caps, 1839 struct pe_session *session_entry, 1840 uint8_t nss); 1841 1842 /** 1843 * lim_update_eht_bw_cap_mcs(): Update eht mcs map per bandwidth 1844 * @session_entry: pointer to PE session 1845 * @beacon: pointer to beacon 1846 * 1847 * Return: None 1848 */ 1849 void lim_update_eht_bw_cap_mcs(struct pe_session *session, 1850 tSirProbeRespBeacon *beacon); 1851 1852 /** 1853 * lim_add_self_eht_cap() - Copy EHT capability into add sta from PE session 1854 * @add_sta_params: pointer to add sta params 1855 * @session: pointer to PE Session 1856 * 1857 * Return: None 1858 */ 1859 void lim_add_self_eht_cap(tpAddStaParams add_sta_params, 1860 struct pe_session *session); 1861 1862 /** 1863 * lim_update_usr_eht_cap() - Update EHT capability based on userspace 1864 * @mac_ctx: global mac context 1865 * @session: PE session entry 1866 * 1867 * Parse the EHT Capability IE and populate the fields to be 1868 * sent to FW as part of add bss and update PE session. 1869 */ 1870 void lim_update_usr_eht_cap(struct mac_context *mac_ctx, 1871 struct pe_session *session); 1872 1873 /** 1874 * lim_copy_bss_eht_cap() - Copy EHT capability into PE session from start bss 1875 * @session: pointer to PE session 1876 * 1877 * Return: None 1878 */ 1879 void lim_copy_bss_eht_cap(struct pe_session *session); 1880 1881 /** 1882 * lim_copy_join_req_eht_cap() - Copy EHT capability to PE session from Join req 1883 * and update as per bandwidth supported 1884 * @session: pointer to PE session 1885 * 1886 * Return: None 1887 */ 1888 void lim_copy_join_req_eht_cap(struct pe_session *session); 1889 1890 /** 1891 * lim_add_eht_cap() - Copy EHT capability into Add sta params 1892 * @mac_ctx: Global MAC context 1893 * @pe_session: pe session entry 1894 * @add_sta_params: pointer to add sta params 1895 * @assoc_req: pointer to Assoc request 1896 * 1897 * Return: None 1898 */ 1899 void lim_add_eht_cap(struct mac_context *mac_ctx, struct pe_session *pe_session, 1900 tpAddStaParams add_sta_params, tpSirAssocReq assoc_req); 1901 1902 /** 1903 * lim_intersect_ap_eht_caps() - Intersect AP and self STA EHT capabilities 1904 * @session: pointer to PE session 1905 * @add_bss: pointer to ADD BSS params 1906 * @beacon: pointer to beacon 1907 * @assoc_rsp: pointer to assoc response 1908 * 1909 * Return: None 1910 */ 1911 void lim_intersect_ap_eht_caps(struct pe_session *session, 1912 struct bss_params *add_bss, 1913 tSchBeaconStruct *pBeaconStruct, 1914 tpSirAssocRsp assoc_rsp); 1915 1916 /** 1917 * lim_add_bss_eht_cap() - Copy EHT capability into ADD BSS params 1918 * @add_bss: pointer to add bss params 1919 * @assoc_rsp: pointer to assoc response 1920 * 1921 * Return: None 1922 */ 1923 void lim_add_bss_eht_cap(struct bss_params *add_bss, tpSirAssocRsp assoc_rsp); 1924 1925 /** 1926 * lim_intersect_sta_eht_caps() - Intersect STA capability with SAP capability 1927 * @mac_ctx: pointer to the MAC context 1928 * @assoc_req: pointer to assoc request 1929 * @session: pointer to PE session 1930 * @sta_ds: pointer to STA dph hash table entry 1931 * 1932 * Return: None 1933 */ 1934 void lim_intersect_sta_eht_caps(struct mac_context *mac_ctx, 1935 tpSirAssocReq assoc_req, 1936 struct pe_session *session, 1937 tpDphHashNode sta_ds); 1938 1939 /** 1940 * lim_update_session_eht_capable(): Update eht_capable in PE session 1941 * @mac: pointer to MAC context 1942 * @session: pointer to PE session 1943 * 1944 * Return: None 1945 */ 1946 void lim_update_session_eht_capable(struct mac_context *mac, 1947 struct pe_session *session); 1948 1949 /** 1950 * lim_add_bss_eht_cfg() - Set EHT config to BSS params 1951 * @add_bss: pointer to add bss params 1952 * @session: Pointer to Session entry struct 1953 * 1954 * Return: None 1955 */ 1956 void lim_add_bss_eht_cfg(struct bss_params *add_bss, 1957 struct pe_session *session); 1958 1959 /** 1960 * lim_decide_eht_op() - Determine EHT operation elements 1961 * @mac_ctx: global mac context 1962 * @eht_ops: mlme eht ops 1963 * @session: PE session entry 1964 * 1965 * Parse the EHT Operation IE and populate the fields to be 1966 * sent to FW as part of add bss. 1967 */ 1968 void lim_decide_eht_op(struct mac_context *mac_ctx, uint32_t *mlme_eht_ops, 1969 struct pe_session *session); 1970 1971 /** 1972 * lim_update_stads_eht_capable() - Update eht_capable in sta ds context 1973 * @sta_ds: pointer to sta ds 1974 * @assoc_req: pointer to assoc request 1975 * 1976 * Return: None 1977 */ 1978 void lim_update_stads_eht_capable(tpDphHashNode sta_ds, 1979 tpSirAssocReq assoc_req); 1980 1981 /** 1982 * lim_update_sta_eht_capable(): Update eht_capable in add sta params 1983 * @mac: pointer to MAC context 1984 * @add_sta_params: pointer to add sta params 1985 * @sta_ds: pointer to dph hash table entry 1986 * @session_entry: pointer to PE session 1987 * 1988 * Return: None 1989 */ 1990 void lim_update_sta_eht_capable(struct mac_context *mac, 1991 tpAddStaParams add_sta_params, 1992 tpDphHashNode sta_ds, 1993 struct pe_session *session_entry); 1994 1995 #ifdef FEATURE_WLAN_TDLS 1996 /** 1997 * lim_update_tdls_sta_eht_capable(): Update eht_capable in add tdls sta params 1998 * @mac: pointer to MAC context 1999 * @add_sta_params: pointer to add sta params 2000 * @sta_ds: pointer to dph hash table entry 2001 * @session_entry: pointer to PE session 2002 * 2003 * Return: None 2004 */ 2005 void lim_update_tdls_sta_eht_capable(struct mac_context *mac, 2006 tpAddStaParams add_sta_params, 2007 tpDphHashNode sta_ds, 2008 struct pe_session *session_entry); 2009 #else 2010 static inline 2011 void lim_update_tdls_sta_eht_capable(struct mac_context *mac, 2012 tpAddStaParams add_sta_params, 2013 tpDphHashNode sta_ds, 2014 struct pe_session *session_entry) 2015 { 2016 } 2017 #endif 2018 2019 /** 2020 * lim_update_session_eht_capable_chan_switch(): Update eht_capable in PE 2021 * session 2022 * @mac: pointer to MAC context 2023 * @session: pointer to PE session 2024 * @new_chan_freq: new channel frequency Mhz 2025 * 2026 * Update session eht capable during AP channel switching 2027 * 2028 * Return: None 2029 */ 2030 void lim_update_session_eht_capable_chan_switch(struct mac_context *mac, 2031 struct pe_session *session, 2032 uint32_t new_chan_freq); 2033 2034 /** 2035 * lim_update_bss_eht_capable() - Update eht_capable in add BSS params 2036 * @mac: pointer to MAC context 2037 * @add_bss: pointer to add BSS params 2038 * 2039 * Return: None 2040 */ 2041 void lim_update_bss_eht_capable(struct mac_context *mac, 2042 struct bss_params *add_bss); 2043 2044 /** 2045 * lim_log_eht_cap() - Print EHT capabilities 2046 * @mac: pointer to MAC context 2047 * @eht_cap: pointer to HE Capability 2048 * 2049 * Received EHT capabilities are converted into dot11f structure. 2050 * This function will print all the EHT capabilities as stored 2051 * in the dot11f structure. 2052 * 2053 * Return: None 2054 */ 2055 void lim_log_eht_cap(struct mac_context *mac, tDot11fIEeht_cap *eht_cap); 2056 2057 /** 2058 * lim_set_eht_caps() - update EHT caps to be sent to FW as part of scan IE 2059 * @mac: pointer to MAC 2060 * @ie_start: pointer to start of IE buffer 2061 * @num_bytes: length of IE buffer 2062 * @band: 2g or 5g band 2063 * @vdev_id: vdev id 2064 * 2065 * Return: None 2066 */ 2067 void lim_set_eht_caps(struct mac_context *mac, uint8_t *ie_start, 2068 uint32_t num_bytes, uint8_t band, uint8_t vdev_id); 2069 2070 /** 2071 * lim_send_eht_caps_ie() - gets EHT capability and send to firmware via wma 2072 * @mac_ctx: global mac context 2073 * @device_mode: VDEV op mode 2074 * @vdev_id: vdev for which IE is targeted 2075 * 2076 * This function gets EHT capability and send to firmware via wma 2077 * 2078 * Return: QDF_STATUS 2079 */ 2080 QDF_STATUS lim_send_eht_caps_ie(struct mac_context *mac_ctx, 2081 enum QDF_OPMODE device_mode, 2082 uint8_t vdev_id); 2083 /** 2084 * lim_log_eht_op() - Print EHT Operation 2085 * @mac: pointer to MAC context 2086 * @eht_op: pointer to EHT Operation 2087 * @session: pointer to PE session 2088 * 2089 * Print EHT operation stored as dot11f structure 2090 * 2091 * Return: None 2092 */ 2093 void lim_log_eht_op(struct mac_context *mac, tDot11fIEeht_op *eht_ops, 2094 struct pe_session *session); 2095 2096 /** 2097 * lim_update_stads_eht_caps() - Copy EHT capability into STA DPH hash table 2098 * entry 2099 * @mac_ctx: pointer to mac context 2100 * @sta_ds: pointer to sta dph hash table entry 2101 * @assoc_rsp: pointer to assoc response 2102 * @session_entry: pointer to PE session 2103 * @beacon: pointer to beacon 2104 * 2105 * Return: None 2106 */ 2107 void lim_update_stads_eht_caps(struct mac_context *mac_ctx, 2108 tpDphHashNode sta_ds, tpSirAssocRsp assoc_rsp, 2109 struct pe_session *session_entry, 2110 tSchBeaconStruct *beacon); 2111 2112 /** 2113 * lim_update_stads_eht_bw_320mhz() - Set ch_width to 320MHz for sta_ds 2114 * @session: pointer to PE session 2115 * @sta_ds: pointer to sta dph hash table entry 2116 * 2117 * Set ch_width to 320 MHz only when session is in 320 MHz and peer eht 2118 * caps support 320 MHz after eht caps intersection. 2119 * 2120 * Return: None 2121 */ 2122 void lim_update_stads_eht_bw_320mhz(struct pe_session *session, 2123 tpDphHashNode sta_ds); 2124 2125 /** 2126 * lim_is_session_chwidth_320mhz() - Check if session chan width is 320 MHz 2127 * @session: pointer to PE session 2128 * 2129 * Check if session channel width is 320 MHz 2130 * 2131 * Return: bool 2132 */ 2133 bool lim_is_session_chwidth_320mhz(struct pe_session *session); 2134 2135 /** 2136 * lim_update_eht_caps_mcs() - update eht caps 2137 * 2138 * @mac: Pointer to Global mac structure 2139 * @session: Session pointer of the interface 2140 * 2141 * Return: None 2142 */ 2143 void 2144 lim_update_eht_caps_mcs(struct mac_context *mac, struct pe_session *session); 2145 2146 /** 2147 * lim_update_des_chan_puncture() - set puncture_bitmap of des_chan 2148 * @des_chan: pointer to wlan_channel 2149 * @ch_params: pointer to ch_params 2150 * 2151 * Return: void 2152 */ 2153 void lim_update_des_chan_puncture(struct wlan_channel *des_chan, 2154 struct ch_params *ch_params); 2155 2156 /** 2157 * lim_overwrite_sta_puncture() - overwrite STA puncture with AP puncture 2158 * @session: session 2159 * @@ch_param: pointer to ch_params 2160 * 2161 * Return: void 2162 */ 2163 void lim_overwrite_sta_puncture(struct pe_session *session, 2164 struct ch_params *ch_param); 2165 #else 2166 static inline 2167 void lim_update_tdls_sta_eht_capable(struct mac_context *mac, 2168 tpAddStaParams add_sta_params, 2169 tpDphHashNode sta_ds, 2170 struct pe_session *session_entry) 2171 { 2172 } 2173 2174 static inline bool lim_is_session_eht_capable(struct pe_session *session) 2175 { 2176 return false; 2177 } 2178 2179 static inline bool lim_is_sta_eht_capable(tpDphHashNode sta_ds) 2180 { 2181 return false; 2182 } 2183 2184 static inline 2185 QDF_STATUS lim_strip_eht_op_ie(struct mac_context *mac_ctx, 2186 uint8_t *frame_ies, 2187 uint16_t *ie_buf_size, 2188 uint8_t *eht_op_ie) 2189 { 2190 return QDF_STATUS_E_FAILURE; 2191 } 2192 2193 static inline 2194 QDF_STATUS lim_strip_eht_cap_ie(struct mac_context *mac_ctx, 2195 uint8_t *frame_ies, 2196 uint16_t *ie_buf_size, 2197 uint8_t *eht_cap_ie) 2198 { 2199 return QDF_STATUS_E_FAILURE; 2200 } 2201 2202 static inline 2203 QDF_STATUS lim_populate_eht_mcs_set(struct mac_context *mac_ctx, 2204 struct supported_rates *rates, 2205 tDot11fIEeht_cap *peer_eht_caps, 2206 struct pe_session *session_entry, 2207 uint8_t nss) 2208 { 2209 return QDF_STATUS_SUCCESS; 2210 } 2211 2212 static inline void lim_update_eht_bw_cap_mcs(struct pe_session *session, 2213 tSirProbeRespBeacon *beacon) 2214 { 2215 } 2216 2217 static inline void lim_add_self_eht_cap(tpAddStaParams add_sta_params, 2218 struct pe_session *session) 2219 { 2220 } 2221 2222 static inline void lim_update_usr_eht_cap(struct mac_context *mac_ctx, 2223 struct pe_session *session) 2224 { 2225 } 2226 2227 static inline void lim_copy_bss_eht_cap(struct pe_session *session) 2228 { 2229 } 2230 2231 static inline void lim_copy_join_req_eht_cap(struct pe_session *session) 2232 { 2233 } 2234 2235 static inline void lim_add_eht_cap(struct mac_context *mac_ctx, 2236 struct pe_session *pe_session, 2237 tpAddStaParams add_sta_params, 2238 tpSirAssocReq assoc_req) 2239 { 2240 } 2241 2242 static inline void 2243 lim_intersect_ap_eht_caps(struct pe_session *session, 2244 struct bss_params *add_bss, 2245 tSchBeaconStruct *pBeaconStruct, 2246 tpSirAssocRsp assoc_rsp) 2247 { 2248 } 2249 2250 static inline void lim_add_bss_eht_cap(struct bss_params *add_bss, 2251 tpSirAssocRsp assoc_rsp) 2252 { 2253 } 2254 2255 static inline 2256 void lim_intersect_sta_eht_caps(struct mac_context *mac_ctx, 2257 tpSirAssocReq assoc_req, 2258 struct pe_session *session, 2259 tpDphHashNode sta_ds) 2260 { 2261 } 2262 2263 static inline 2264 void lim_update_session_eht_capable(struct mac_context *mac, 2265 struct pe_session *session) 2266 { 2267 } 2268 2269 static inline void 2270 lim_add_bss_eht_cfg(struct bss_params *add_bss, struct pe_session *session) 2271 { 2272 } 2273 2274 static inline void 2275 lim_decide_eht_op(struct mac_context *mac_ctx, uint32_t *mlme_eht_ops, 2276 struct pe_session *session) 2277 { 2278 } 2279 2280 static inline void 2281 lim_update_stads_eht_capable(tpDphHashNode sta_ds, tpSirAssocReq assoc_req) 2282 { 2283 } 2284 2285 static inline void 2286 lim_update_sta_eht_capable(struct mac_context *mac, 2287 tpAddStaParams add_sta_params, 2288 tpDphHashNode sta_ds, 2289 struct pe_session *session_entry) 2290 { 2291 } 2292 2293 static inline void 2294 lim_update_session_eht_capable_chan_switch(struct mac_context *mac, 2295 struct pe_session *session, 2296 uint32_t new_chan_freq) 2297 { 2298 } 2299 2300 static inline void 2301 lim_update_bss_eht_capable(struct mac_context *mac, 2302 struct bss_params *add_bss) 2303 { 2304 } 2305 2306 static inline void 2307 lim_log_eht_cap(struct mac_context *mac, tDot11fIEeht_cap *eht_cap) 2308 { 2309 } 2310 2311 static inline void 2312 lim_set_eht_caps(struct mac_context *mac, uint8_t *ie_start, 2313 uint32_t num_bytes, uint8_t band, uint8_t vdev_id) 2314 { 2315 } 2316 2317 static inline QDF_STATUS 2318 lim_send_eht_caps_ie(struct mac_context *mac_ctx, 2319 enum QDF_OPMODE device_mode, uint8_t vdev_id) 2320 { 2321 return QDF_STATUS_SUCCESS; 2322 } 2323 2324 static inline void 2325 lim_log_eht_op(struct mac_context *mac, tDot11fIEeht_op *eht_ops, 2326 struct pe_session *session) 2327 { 2328 } 2329 2330 static inline void 2331 lim_update_stads_eht_caps(struct mac_context *mac_ctx, 2332 tpDphHashNode sta_ds, tpSirAssocRsp assoc_rsp, 2333 struct pe_session *session_entry, 2334 tSchBeaconStruct *beacon) 2335 { 2336 } 2337 2338 static inline void 2339 lim_update_stads_eht_bw_320mhz(struct pe_session *session, 2340 tpDphHashNode sta_ds) 2341 { 2342 } 2343 2344 static inline bool 2345 lim_is_session_chwidth_320mhz(struct pe_session *session) 2346 { 2347 return false; 2348 } 2349 2350 static inline void 2351 lim_update_eht_caps_mcs(struct mac_context *mac, struct pe_session *session) 2352 { 2353 } 2354 2355 static inline void 2356 lim_update_des_chan_puncture(struct wlan_channel *des_chan, 2357 struct ch_params *ch_params) 2358 { 2359 } 2360 2361 static inline void 2362 lim_overwrite_sta_puncture(struct pe_session *session, 2363 struct ch_params *ch_param) 2364 { 2365 } 2366 #endif /* WLAN_FEATURE_11BE */ 2367 2368 #ifdef WLAN_FEATURE_11BE_MLO 2369 /** 2370 * lim_extract_per_link_id() - Extract Link ID per vdev and share with FW 2371 * @session: pointer to PE session 2372 * @add_bss: pointer to ADD BSS params 2373 * @assoc_rsp: pointer to assoc response 2374 * 2375 * Return: None 2376 */ 2377 void lim_extract_per_link_id(struct pe_session *session, 2378 struct bss_params *add_bss, 2379 tpSirAssocRsp assoc_rsp); 2380 2381 /** 2382 * lim_extract_ml_info() - Extract ML info and send with FW 2383 * @session: pointer to PE session 2384 * @add_bss: pointer to ADD BSS params 2385 * @assoc_rsp: pointer to assoc response 2386 * 2387 * Return: None 2388 */ 2389 void lim_extract_ml_info(struct pe_session *session, 2390 struct bss_params *add_bss, 2391 tpSirAssocRsp assoc_rsp); 2392 2393 /** 2394 * lim_intersect_ap_emlsr_caps() - Intersect AP and self STA EML capabilities 2395 * @mac_ctx: Global MAC context 2396 * @session: pointer to PE session 2397 * @add_bss: pointer to ADD BSS params 2398 * @assoc_rsp: pointer to assoc response 2399 * 2400 * Return: None 2401 */ 2402 void lim_intersect_ap_emlsr_caps(struct mac_context *mac_ctx, 2403 struct pe_session *session, 2404 struct bss_params *add_bss, 2405 tpSirAssocRsp assoc_rsp); 2406 2407 /** 2408 * lim_extract_msd_caps() - Extract MLD AP MSD capabilities and assign 2409 * the same caps to link vdev 2410 * @mac_ctx: Global MAC context 2411 * @session: pointer to PE session 2412 * @add_bss: pointer to ADD BSS params 2413 * @assoc_rsp: pointer to assoc response 2414 * 2415 * Return: None 2416 */ 2417 void lim_extract_msd_caps(struct mac_context *mac_ctx, 2418 struct pe_session *session, 2419 struct bss_params *add_bss, 2420 tpSirAssocRsp assoc_rsp); 2421 #else 2422 static inline void 2423 lim_extract_per_link_id(struct pe_session *session, 2424 struct bss_params *add_bss, 2425 tpSirAssocRsp assoc_rsp) 2426 { 2427 } 2428 2429 static inline void 2430 lim_extract_ml_info(struct pe_session *session, 2431 struct bss_params *add_bss, 2432 tpSirAssocRsp assoc_rsp) 2433 { 2434 } 2435 2436 static inline void 2437 lim_intersect_ap_emlsr_caps(struct mac_context *mac_ctx, 2438 struct pe_session *session, 2439 struct bss_params *add_bss, 2440 tpSirAssocRsp assoc_rsp) 2441 { 2442 } 2443 2444 static inline void 2445 lim_extract_msd_caps(struct mac_context *mac_ctx, 2446 struct pe_session *session, 2447 struct bss_params *add_bss, 2448 tpSirAssocRsp assoc_rsp) 2449 { 2450 } 2451 #endif /* WLAN_FEATURE_11BE_MLO */ 2452 2453 #if defined(CONFIG_BAND_6GHZ) && defined(WLAN_FEATURE_11AX) 2454 /** 2455 * lim_send_he_6g_band_caps_ie() - Send HE 6ghz band caps to FW 2456 * @mac_ctx: Global MAC context 2457 * @vdev_id: vdev id 2458 * 2459 * Send HE 6ghz band capabilities IE to firmware 2460 * 2461 * Return: QDF_STATUS_SUCCESS on success 2462 */ 2463 QDF_STATUS lim_send_he_6g_band_caps_ie(struct mac_context *mac_ctx, 2464 uint8_t vdev_id); 2465 #else 2466 static inline 2467 QDF_STATUS lim_send_he_6g_band_caps_ie(struct mac_context *mac_ctx, 2468 uint8_t vdev_id) 2469 { 2470 return QDF_STATUS_SUCCESS; 2471 } 2472 #endif 2473 2474 /** 2475 * lim_decrement_pending_mgmt_count: Decrement mgmt frame count 2476 * @mac_ctx: Pointer to global MAC structure 2477 * 2478 * This function is used to decrement pe mgmt count once frame 2479 * removed from queue 2480 * 2481 * Return: None 2482 */ 2483 void lim_decrement_pending_mgmt_count(struct mac_context *mac_ctx); 2484 2485 /** 2486 * lim_check_if_vendor_oui_match() - Check if the given OUI match in IE buffer 2487 * @mac_ctx: MAC context 2488 * @ie: IE buffer 2489 * @ie_len: length of @ie 2490 * 2491 * This API is used to check if given vendor OUI 2492 * matches in given IE buffer 2493 * 2494 * Return: True, if mataches. False otherwise 2495 */ 2496 bool lim_check_if_vendor_oui_match(struct mac_context *mac_ctx, 2497 uint8_t *oui, uint8_t oui_len, 2498 uint8_t *ie, uint8_t ie_len); 2499 2500 QDF_STATUS lim_util_get_type_subtype(void *pkt, uint8_t *type, 2501 uint8_t *subtype); 2502 2503 /** 2504 * lim_get_min_session_txrate() - Get the minimum rate supported in the session 2505 * @session: Pointer to PE session 2506 * @pre_auth_freq: Pointer to pre_auth_freq 2507 * 2508 * This API will find the minimum rate supported by the given PE session and 2509 * return the enum rateid corresponding to the rate. 2510 * 2511 * Return: enum rateid 2512 */ 2513 enum rateid lim_get_min_session_txrate(struct pe_session *session, 2514 qdf_freq_t *pre_auth_freq); 2515 2516 /** 2517 * lim_send_dfs_chan_sw_ie_update() - updates the channel switch IE in beacon 2518 * template 2519 * 2520 * @mac_ctx - pointer to global mac context 2521 * @session - A pointer to pesession 2522 * Return None 2523 */ 2524 void lim_send_dfs_chan_sw_ie_update(struct mac_context *mac_ctx, 2525 struct pe_session *session); 2526 2527 /** 2528 * lim_process_ap_ecsa_timeout() -process ECSA timeout which decrement csa count 2529 * in beacon and update beacon template in firmware 2530 * 2531 * @data - A pointer to pesession 2532 * Return None 2533 */ 2534 void lim_process_ap_ecsa_timeout(void *session); 2535 2536 /** 2537 * lim_send_csa_tx_complete() - send csa tx complete event when beacon 2538 * count decremented to zero 2539 * 2540 * @vdev_id - vdev_id 2541 * Return None 2542 */ 2543 void lim_send_csa_tx_complete(uint8_t vdev_id); 2544 2545 /** 2546 * lim_is_csa_tx_pending() - check id csa tx ind not sent 2547 * 2548 * @vdev_id - vdev_id 2549 * Return - true if csa tx ind is not sent else false 2550 */ 2551 bool lim_is_csa_tx_pending(uint8_t vdev_id); 2552 2553 /** 2554 * lim_send_stop_bss_failure_resp() -send failure delete bss resp to sme 2555 * @mac_ctx: mac ctx 2556 * @session: session pointer 2557 * 2558 * Return None 2559 */ 2560 void lim_send_stop_bss_failure_resp(struct mac_context *mac_ctx, 2561 struct pe_session *session); 2562 2563 /** 2564 * lim_delete_all_peers() -delete all connected peers 2565 * @session: session pointer 2566 * 2567 * Return None 2568 */ 2569 void lim_delete_all_peers(struct pe_session *session); 2570 2571 /** 2572 * lim_send_vdev_stop() -send delete bss/stop vdev req 2573 * @session: session pointer 2574 * 2575 * Return QDF_STATUS 2576 */ 2577 QDF_STATUS lim_send_vdev_stop(struct pe_session *session); 2578 2579 /** 2580 * lim_send_vdev_stop() -send delete bss/stop vdev req for STA 2581 * @session: session pointer 2582 * 2583 * Return QDF_STATUS 2584 */ 2585 QDF_STATUS lim_sta_send_del_bss(struct pe_session *session); 2586 2587 /** 2588 * lim_send_start_bss_confirm() -send start bss confirm req 2589 * @mac_ctx: pointer to global mac structure 2590 * @start_cnf: start confirm structure pointer 2591 * 2592 * Return None 2593 */ 2594 void lim_send_start_bss_confirm(struct mac_context *mac_ctx, 2595 tLimMlmStartCnf *start_cnf); 2596 2597 /** 2598 * lim_send_chan_switch_action_frame()- Send an action frame 2599 * containing CSA IE or ECSA IE depending on the connected 2600 * sta capability. 2601 * 2602 * @mac_ctx: pointer to global mac structure 2603 * @new_channel_freq: new channel freq(Mhz) to switch to. 2604 * @ch_bandwidth: ch bw of enum phy_ch_width 2605 * @session_entry: pe session 2606 * 2607 * Return: void 2608 */ 2609 void lim_send_chan_switch_action_frame(struct mac_context *mac_ctx, 2610 uint16_t new_channel_freq, 2611 enum phy_ch_width ch_bandwidth, 2612 struct pe_session *session_entry); 2613 2614 /** 2615 * send_extended_chan_switch_action_frame()- function to send ECSA 2616 * action frame for each sta connected to SAP/GO and AP in case of 2617 * STA . 2618 * @mac_ctx: pointer to global mac structure 2619 * @new_channel_freq: new channel to switch to. 2620 * @ch_bandwidth: channel bw of type enum phy_ch_width 2621 * @session_entry: pe session 2622 * 2623 * This function is called to send ECSA frame for STA/CLI and SAP/GO. 2624 * 2625 * Return: void 2626 */ 2627 void send_extended_chan_switch_action_frame(struct mac_context *mac_ctx, 2628 uint16_t new_channel_freq, 2629 enum phy_ch_width ch_bandwidth, 2630 struct pe_session *session_entry); 2631 2632 /** 2633 * lim_process_obss_detection_ind() - Process obss detection indication 2634 * @mac_ctx: Pointer to Global MAC structure. 2635 * @obss_detection: obss detection info. 2636 * 2637 * Process obss detection indication and apply necessary protection for 2638 * the given AP session. 2639 * 2640 * Return: QDF_STATUS 2641 */ 2642 QDF_STATUS lim_process_obss_detection_ind(struct mac_context *mac_ctx, 2643 struct wmi_obss_detect_info 2644 *obss_detection); 2645 2646 /** 2647 * lim_obss_send_detection_cfg() - Send obss detection configuration to firmware 2648 * @mac_ctx: Pointer to Global MAC structure 2649 * @session: Pointer to session 2650 * @force: Force to send new configuration even if new cfg same as old 2651 * 2652 * Generate new cfg based on current protection status and send new cfg to 2653 * firmware. 2654 * 2655 * Return: QDF_STATUS 2656 */ 2657 QDF_STATUS lim_obss_send_detection_cfg(struct mac_context *mac_ctx, 2658 struct pe_session *session, 2659 bool force); 2660 2661 /** 2662 * lim_obss_generate_detection_config() - get new obss offload detection cfg 2663 * @mac_ctx: Pointer to Global MAC structure 2664 * @session: Pointer to session 2665 * @cfg: Obss detection cfg buffer pointer 2666 * 2667 * Generate new cfg based on current protection status. 2668 * 2669 * Return: QDF_STATUS 2670 */ 2671 QDF_STATUS lim_obss_generate_detection_config(struct mac_context *mac_ctx, 2672 struct pe_session *session, 2673 struct obss_detection_cfg *cfg); 2674 2675 /** 2676 * lim_enable_obss_detection_config() - Enable obss detection 2677 * @mac_ctx: Pointer to Global MAC structure 2678 * @session: Pointer to session 2679 * 2680 * This function will enable legacy obss detection (by starting timer) 2681 * or also offload based detection based on support. 2682 * 2683 * Return: None 2684 */ 2685 void lim_enable_obss_detection_config(struct mac_context *mac_ctx, 2686 struct pe_session *session); 2687 2688 #ifdef WLAN_SUPPORT_TWT 2689 void lim_set_peer_twt_cap(struct pe_session *session, struct s_ext_cap *ext_cap); 2690 #else 2691 static inline void lim_set_peer_twt_cap(struct pe_session *session, 2692 struct s_ext_cap *ext_cap) 2693 { 2694 } 2695 #endif 2696 2697 /** 2698 * lim_rx_invalid_peer_process() - process rx invalid peer indication 2699 * @mac_ctx: Pointer to Global MAC structure 2700 * @lim_msg: Pointer to scheduler message 2701 * 2702 * This function will process the rx data invalid peer indication, 2703 * if the vdev operation mode is SAP, then send the deauth mgmt frame 2704 * to STA. 2705 * 2706 * Return: None 2707 */ 2708 void lim_rx_invalid_peer_process(struct mac_context *mac_ctx, 2709 struct scheduler_msg *lim_msg); 2710 2711 /** 2712 * lim_req_send_delba_ind_process() - process send delba indication 2713 * @mac_ctx: mac context 2714 * @lim_msg: lim message 2715 * 2716 * This function will process the send delba indication from DP. 2717 * 2718 * Return: None 2719 */ 2720 void lim_req_send_delba_ind_process(struct mac_context *mac_ctx, 2721 struct scheduler_msg *lim_msg); 2722 2723 /** 2724 * lim_send_beacon() - send beacon indication to firmware 2725 * @mac_ctx: Pointer to Global MAC structure 2726 * @session: session pointer 2727 * 2728 * Return: None 2729 */ 2730 void lim_send_beacon(struct mac_context *mac_ctx, struct pe_session *session); 2731 2732 /** 2733 * lim_ndi_mlme_vdev_up_transition() - Send event to transition NDI VDEV to UP 2734 * @session: session pointer 2735 * 2736 * Return: None 2737 */ 2738 void lim_ndi_mlme_vdev_up_transition(struct pe_session *session); 2739 2740 /** 2741 * lim_sap_move_to_cac_wait_state() - move to cac wait state 2742 * @sap_ctx: SAP context 2743 * 2744 * Return: QDF_STATUS 2745 */ 2746 QDF_STATUS lim_sap_move_to_cac_wait_state(struct pe_session *session); 2747 2748 /** 2749 * lim_disconnect_complete - Deliver vdev disconnect complete event or 2750 * STA send deleting bss 2751 * @session: PE session pointer 2752 * @del_bss: Whether to call lim_sta_send_del_bss 2753 * 2754 * API delivers vdev disconnect complete event 2755 * 2756 * Return: None 2757 */ 2758 void lim_disconnect_complete(struct pe_session *session, bool del_bss); 2759 2760 /** 2761 * lim_ap_mlme_vdev_rnr_notify() - SAP is changed, notify co-located sap to 2762 * update RNR IE 2763 * @session: PE session pointer 2764 * 2765 * Return: QDF_STATUS 2766 */ 2767 QDF_STATUS lim_ap_mlme_vdev_rnr_notify(struct pe_session *session); 2768 2769 /** 2770 * lim_sta_mlme_vdev_stop_send() - send VDEV stop 2771 * @vdev_mlme_obj: VDEV MLME comp object 2772 * @data_len: data size 2773 * @data: event data 2774 * 2775 * API invokes vdev stop 2776 * 2777 * Return: SUCCESS on successful completion of vdev stop 2778 * FAILURE, if it fails due to any 2779 */ 2780 QDF_STATUS lim_sta_mlme_vdev_stop_send(struct vdev_mlme_obj *vdev_mlme, 2781 uint16_t data_len, void *data); 2782 2783 /** 2784 * lim_sta_mlme_vdev_req_fail() - send VDEV start req failure 2785 * @vdev_mlme_obj: VDEV MLME comp object 2786 * @data_len: data size 2787 * @data: event data 2788 * 2789 * API invokes vdev stop 2790 * 2791 * Return: SUCCESS on successful completion of req failure operation 2792 * FAILURE, if it fails due to any 2793 */ 2794 QDF_STATUS lim_sta_mlme_vdev_req_fail(struct vdev_mlme_obj *vdev_mlme, 2795 uint16_t data_len, void *data); 2796 2797 /** 2798 * lim_sta_mlme_vdev_start_send() - send VDEV start 2799 * @vdev_mlme_obj: VDEV MLME comp object 2800 * @data_len: data size 2801 * @data: event data 2802 * 2803 * API invokes vdev start 2804 * 2805 * Return: SUCCESS on successful completion of vdev start 2806 * FAILURE, if it fails due to any 2807 */ 2808 QDF_STATUS lim_sta_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme, 2809 uint16_t data_len, void *data); 2810 2811 /** 2812 * lim_sta_mlme_vdev_restart_send() - send VDEV restart 2813 * @vdev_mlme_obj: VDEV MLME comp object 2814 * @data_len: data size 2815 * @data: event data 2816 * 2817 * API invokes vdev restart 2818 * 2819 * Return: SUCCESS on successful completion of vdev restart 2820 * FAILURE, if it fails due to any 2821 */ 2822 QDF_STATUS lim_sta_mlme_vdev_restart_send(struct vdev_mlme_obj *vdev_mlme, 2823 uint16_t data_len, void *data); 2824 2825 /** 2826 * lim_ap_mlme_vdev_start_send() - Invokes VDEV start operation 2827 * @vdev_mlme_obj: VDEV MLME comp object 2828 * @data_len: data size 2829 * @data: event data 2830 * 2831 * API invokes VDEV start operation 2832 * 2833 * Return: SUCCESS on successful completion of start operation 2834 * FAILURE, if it fails due to any 2835 */ 2836 QDF_STATUS lim_ap_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme, 2837 uint16_t data_len, void *event); 2838 /* 2839 * lim_ap_mlme_vdev_update_beacon() - Updates beacon 2840 * @vdev_mlme_obj: VDEV MLME comp object 2841 * @op: beacon update type 2842 * @data_len: data size 2843 * @data: event data 2844 * 2845 * API updates/allocates/frees the beacon 2846 * 2847 * Return: SUCCESS on successful update of beacon 2848 * FAILURE, if it fails due to any 2849 */ 2850 QDF_STATUS lim_ap_mlme_vdev_update_beacon(struct vdev_mlme_obj *vdev_mlme, 2851 enum beacon_update_op op, 2852 uint16_t data_len, void *data); 2853 2854 /** 2855 * lim_ap_mlme_vdev_up_send() - VDEV up operation 2856 * @vdev_mlme_obj: VDEV MLME comp object 2857 * @data_len: data size 2858 * @data: event data 2859 * 2860 * API invokes VDEV up operations 2861 * 2862 * Return: SUCCESS on successful completion of up operation 2863 * FAILURE, if it fails due to any 2864 */ 2865 QDF_STATUS lim_ap_mlme_vdev_up_send(struct vdev_mlme_obj *vdev_mlme, 2866 uint16_t data_len, void *data); 2867 2868 /** 2869 * lim_ap_mlme_vdev_disconnect_peers - Disconnect peers 2870 * @vdev_mlme_obj: VDEV MLME comp object 2871 * @data_len: data size 2872 * @data: event data 2873 * 2874 * API trigger stations disconnection connected with AP 2875 * 2876 * Return: SUCCESS on successful invocation of station disconnection 2877 * FAILURE, if it fails due to any 2878 */ 2879 QDF_STATUS lim_ap_mlme_vdev_disconnect_peers(struct vdev_mlme_obj *vdev_mlme, 2880 uint16_t data_len, void *data); 2881 2882 /** 2883 * lim_ap_mlme_vdev_stop_send - Invokes VDEV stop operation 2884 * @vdev_mlme_obj: VDEV MLME comp object 2885 * @data_len: data size 2886 * @data: event data 2887 * 2888 * API invokes VDEV stop operation 2889 * 2890 * Return: SUCCESS on successful completion of stop operation 2891 * FAILURE, if it fails due to any 2892 */ 2893 QDF_STATUS lim_ap_mlme_vdev_stop_send(struct vdev_mlme_obj *vdev_mlme, 2894 uint16_t data_len, void *data); 2895 2896 /** 2897 * lim_ap_mlme_vdev_restart_send - Invokes VDEV restart operation 2898 * @vdev_mlme_obj: VDEV MLME comp object 2899 * @data_len: data size 2900 * @data: event data 2901 * 2902 * API invokes VDEV restart operation 2903 * 2904 * Return: SUCCESS on successful completion of restart operation 2905 * FAILURE, if it fails due to any 2906 */ 2907 QDF_STATUS lim_ap_mlme_vdev_restart_send(struct vdev_mlme_obj *vdev_mlme, 2908 uint16_t data_len, void *data); 2909 2910 /** 2911 * lim_ap_mlme_vdev_restart_send - Invokes VDEV sta disconnect operation 2912 * @vdev_mlme_obj: VDEV MLME comp object 2913 * @data_len: data size 2914 * @data: event data 2915 * 2916 * API invokes VDEV sta disconnect operation 2917 * 2918 * Return: SUCCESS on successful completion of sta disconnect operation 2919 * FAILURE, if it fails due to any 2920 */ 2921 QDF_STATUS 2922 lim_sta_mlme_vdev_sta_disconnect_start(struct vdev_mlme_obj *vdev_mlme, 2923 uint16_t data_len, void *data); 2924 2925 /** 2926 * lim_ap_mlme_vdev_start_req_failed - handle vdev start req failure 2927 * @vdev_mlme_obj: VDEV MLME comp object 2928 * @data_len: data size 2929 * @data: event data 2930 * 2931 * API invokes on START fail response 2932 * 2933 * Return: SUCCESS on successful invocation of callback 2934 * FAILURE, if it fails due to any 2935 */ 2936 QDF_STATUS lim_ap_mlme_vdev_start_req_failed(struct vdev_mlme_obj *vdev_mlme, 2937 uint16_t data_len, void *data); 2938 2939 /** 2940 * lim_mon_mlme_vdev_start_send() - Invokes VDEV start operation 2941 * @vdev_mlme_obj: VDEV MLME comp object 2942 * @data_len: data size 2943 * @data: event data 2944 * 2945 * API invokes VDEV start operation 2946 * 2947 * Return: SUCCESS on successful completion of start operation 2948 * FAILURE, if it fails due to any 2949 */ 2950 QDF_STATUS lim_mon_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme, 2951 uint16_t data_len, void *event); 2952 2953 /** 2954 * lim_get_capability_info() - Get capability information 2955 * @mac: pointer to mac data 2956 * @pcap: pointer to return capability information 2957 * @pe_session: pointer to pe session 2958 * 2959 * Return: SUCCESS on successful get capability information 2960 * FAILURE, if it fails due to any 2961 */ 2962 QDF_STATUS lim_get_capability_info(struct mac_context *mac, uint16_t *pCap, 2963 struct pe_session *pe_session); 2964 2965 /** 2966 * lim_op_class_from_bandwidth() - get op class from bandwidth 2967 * @mac_ctx: mac context 2968 * @channel_freq: channel frequency MHz 2969 * @ch_bandwidth: channel bandwidth 2970 * @offset: second channel offfset 2971 * 2972 * This API can get the operating class based on channel freq, 2973 * bandwidth and second channel offset. 2974 * 2975 * Return: op class 2976 */ 2977 uint8_t lim_op_class_from_bandwidth(struct mac_context *mac_ctx, 2978 uint16_t channel_freq, 2979 enum phy_ch_width ch_bandwidth, 2980 enum offset_t offset); 2981 2982 /** 2983 * lim_flush_bssid() - flush bssid from scan cache 2984 * @mac_ctx: pointer to mac data 2985 * @bssid: bssid to be flushed 2986 * 2987 * Return: void 2988 */ 2989 void lim_flush_bssid(struct mac_context *mac_ctx, uint8_t *bssid); 2990 2991 /** 2992 * lim_is_sha384_akm() - Function to check if the negotiated AKM for the 2993 * current session is based on sha384 key derivation function. 2994 * @mac_ctx: pointer to mac data 2995 * @akm: negotiated AKM for the current session 2996 * 2997 * Return: true if akm is sha384 based kdf or false 2998 */ 2999 bool lim_is_sha384_akm(enum ani_akm_type akm); 3000 3001 3002 /** 3003 * lim_pre_vdev_start() - set set vdev params from session 3004 * @mac: pointer to mac context 3005 * @mlme_obj: vdev mlme obj 3006 * @session: pointer to pe session 3007 * 3008 * Return: QDF_STATUS 3009 */ 3010 QDF_STATUS lim_pre_vdev_start(struct mac_context *mac, 3011 struct vdev_mlme_obj *mlme_obj, 3012 struct pe_session *session); 3013 3014 /** 3015 * lim_set_ch_phy_mode() - set channel phy mode 3016 * @vdev: pointer to vdev 3017 * 3018 * Return: QDF_STATUS 3019 */ 3020 QDF_STATUS 3021 lim_set_ch_phy_mode(struct wlan_objmgr_vdev *vdev, uint8_t dot11mode); 3022 3023 #if defined(CONFIG_BAND_6GHZ) && defined(WLAN_FEATURE_11AX) 3024 /** 3025 * lim_ap_check_6g_compatible_peer() - check all client support 6Ghz band 3026 * @mac_ctx: mac context 3027 * @session: pe session 3028 * 3029 * Return: void 3030 */ 3031 void lim_ap_check_6g_compatible_peer(struct mac_context *mac_ctx, 3032 struct pe_session *session); 3033 #else 3034 static inline void lim_ap_check_6g_compatible_peer( 3035 struct mac_context *mac_ctx, struct pe_session *session) 3036 {} 3037 #endif 3038 3039 /** 3040 * enum max_tx_power_interpretation 3041 * @LOCAL_EIRP: Local power interpretation 3042 * @LOCAL_EIRP_PSD: Local PSD power interpretation 3043 * @REGULATORY_CLIENT_EIRP: Regulatory power interpretation 3044 * @REGULATORY_CLIENT_EIRP_PSD: Regulatory PSD power interpretation 3045 */ 3046 enum max_tx_power_interpretation { 3047 LOCAL_EIRP = 0, 3048 LOCAL_EIRP_PSD, 3049 REGULATORY_CLIENT_EIRP, 3050 REGULATORY_CLIENT_EIRP_PSD, 3051 }; 3052 3053 /** 3054 * lim_parse_tpe_ie() - get the power info from the TPE IE 3055 * @mac_ctx: mac context 3056 * @session: pe session 3057 * @tpe_ies: list of TPE IEs 3058 * @num_tpe_ies: number of TPE IEs in list 3059 * @he_op: HE OP IE 3060 * @has_tpe_updated: flag set to true only if the TPE values have changed 3061 * 3062 * Return: void 3063 */ 3064 void lim_parse_tpe_ie(struct mac_context *mac, struct pe_session *session, 3065 tDot11fIEtransmit_power_env *tpe_ies, 3066 uint8_t num_tpe_ies, tDot11fIEhe_op *he_op, 3067 bool *has_tpe_updated); 3068 3069 /** 3070 * lim_process_tpe_ie_from_beacon() - get the TPE IE from the BSS descriptor 3071 * @mac_ctx: mac context 3072 * @session: pe session 3073 * @bss_desc: pointer to BSS descriptor 3074 * @has_tpe_updated: flag set to true only if the TPE values have changed 3075 * 3076 * Return: void 3077 */ 3078 void lim_process_tpe_ie_from_beacon(struct mac_context *mac, 3079 struct pe_session *session, 3080 struct bss_description *bss_desc, 3081 bool *has_tpe_updated); 3082 3083 /** 3084 * lim_send_conc_params_update() - Function to check and update params based on 3085 * STA/SAP concurrency.such as EDCA params 3086 * and RTS profile. If updated, it will also 3087 * also send the updated parameters to FW. 3088 * 3089 * Return: void 3090 */ 3091 void lim_send_conc_params_update(void); 3092 3093 /** 3094 * lim_is_self_and_peer_ocv_capable() - check whether OCV capable 3095 * @mac: pointer to mac data 3096 * @pe_session: pointer to pe session 3097 .* @peer: peer mac address 3098 * 3099 * Return: true if both self and peer ocv capable 3100 */ 3101 bool 3102 lim_is_self_and_peer_ocv_capable(struct mac_context *mac, 3103 uint8_t *peer, 3104 struct pe_session *pe_session); 3105 3106 /** 3107 * lim_fill_oci_params() - fill oci parameters 3108 * @mac: pointer to mac data 3109 * @session: pointer to pe session 3110 .* @oci: pointer of tDot11fIEoci 3111 * @peer: peer mac address 3112 * @tx_chan_width: tx channel width in MHz 3113 * 3114 * Return: void 3115 */ 3116 void 3117 lim_fill_oci_params(struct mac_context *mac, struct pe_session *session, 3118 tDot11fIEoci *oci, uint8_t *peer, uint16_t *tx_chan_width); 3119 3120 #ifdef WLAN_FEATURE_SAE 3121 /** 3122 * lim_process_sae_msg() - Process SAE message 3123 * @mac: Global MAC pointer 3124 * @body: Buffer pointer 3125 * 3126 * Return: None 3127 */ 3128 void lim_process_sae_msg(struct mac_context *mac, struct sir_sae_msg *body); 3129 3130 /** 3131 * lim_trigger_auth_req_sae() - sends SAE auth request to sme 3132 * @mac_ctx: Global MAC pointer 3133 * @session: pointer to pe session 3134 * @peer_bssid: bssid to do SAE auth 3135 * 3136 * Return: QDF_STATUS 3137 */ 3138 QDF_STATUS lim_trigger_auth_req_sae(struct mac_context *mac_ctx, 3139 struct pe_session *session, 3140 struct qdf_mac_addr *peer_bssid); 3141 #else 3142 static inline void lim_process_sae_msg(struct mac_context *mac, void *body) 3143 {} 3144 3145 static inline QDF_STATUS lim_trigger_auth_req_sae( 3146 struct mac_context *mac_ctx, 3147 struct pe_session *session, 3148 struct qdf_mac_addr *peer_bssid) 3149 {} 3150 #endif 3151 3152 /** 3153 * lim_get_he_max_mcs_idx() - get max mcs index from he cap 3154 * @ch_width: channel width 3155 * @he_cap: pointer to tDot11fIEhe_cap 3156 * 3157 * Return: max mcs index from he cap 3158 */ 3159 uint8_t lim_get_he_max_mcs_idx(enum phy_ch_width ch_width, 3160 tDot11fIEhe_cap *he_cap); 3161 3162 /** 3163 * lim_get_vht_max_mcs_idx() - get max mcs index from vht cap 3164 * @vht_cap: pointer to tDot11fIEVHTCaps 3165 * 3166 * Return: max mcs index from vht cap 3167 */ 3168 uint8_t lim_get_vht_max_mcs_idx(tDot11fIEVHTCaps *vht_cap); 3169 3170 /** 3171 * lim_get_ht_max_mcs_idx() - get max mcs index from ht cap 3172 * @ht_cap: pointer to tDot11fIEHTCaps 3173 * 3174 * Return: max mcs index from ht cap 3175 */ 3176 uint8_t lim_get_ht_max_mcs_idx(tDot11fIEHTCaps *ht_cap); 3177 3178 /** 3179 * lim_get_max_rate_idx() - get max rate index from tSirMacRateSet 3180 * @rateset: pointer to tSirMacRateSet 3181 * 3182 * Return: max rate index from tSirMacRateSet 3183 */ 3184 uint8_t lim_get_max_rate_idx(tSirMacRateSet *rateset); 3185 3186 /** 3187 * lim_update_nss() - Function to update NSS 3188 * @mac_ctx: pointer to Global Mac structure 3189 * @sta_ds: pointer to tpDphHashNode 3190 * @rx_nss: Rx NSS in operating mode notification 3191 * @session: pointer to pe_session 3192 * 3193 * function to update NSS 3194 * 3195 * Return: None 3196 */ 3197 void lim_update_nss(struct mac_context *mac_ctx, tpDphHashNode sta_ds, 3198 uint8_t rx_nss, struct pe_session *session); 3199 3200 /** 3201 * lim_update_channel_width() - Function to update channel width 3202 * @mac_ctx: pointer to Global Mac structure 3203 * @sta_ptr: pointer to tpDphHashNode 3204 * @session: pointer to pe_session 3205 * @ch_width: Channel width in operating mode notification 3206 * @new_ch_width: Final channel bandwifdth 3207 * 3208 * function to send WMI_PEER_SET_PARAM_CMDID to FW to update ch_width 3209 * 3210 * Return: Success or Failure 3211 */ 3212 bool lim_update_channel_width(struct mac_context *mac_ctx, 3213 tpDphHashNode sta_ptr, 3214 struct pe_session *session, 3215 enum phy_ch_width ch_width, 3216 enum phy_ch_width *new_ch_width); 3217 3218 /** 3219 * lim_get_vht_ch_width() - Function to get the VHT 3220 * operating channel width based on frequency params 3221 * 3222 * @vht_cap: Pointer to VHT Caps IE. 3223 * @vht_op: Pointer to VHT Operation IE. 3224 * @ht_info: Pointer to HT Info IE. 3225 * 3226 * Return: VHT channel width 3227 */ 3228 uint8_t lim_get_vht_ch_width(tDot11fIEVHTCaps *vht_cap, 3229 tDot11fIEVHTOperation *vht_op, 3230 tDot11fIEHTInfo *ht_info); 3231 3232 /* 3233 * lim_set_tpc_power() - Function to compute and send TPC power level to the 3234 * FW based on the opmode of the pe_session 3235 * 3236 * @mac_ctx: Pointer to Global MAC structure 3237 * @pe_session: Pointer to session 3238 * @bss_desc: Pointer to bss description 3239 * 3240 * Return: TPC status 3241 */ 3242 bool 3243 lim_set_tpc_power(struct mac_context *mac_ctx, struct pe_session *session, 3244 struct bss_description *bss_desc); 3245 3246 /** 3247 * lim_update_tx_power() - Function to update the TX power for 3248 * the STA interface based on the SAP concurrency 3249 * 3250 * @mac_ctx: Pointer to Global mac structure 3251 * @sap_session: Session pointer of the SAP 3252 * @sta_session: Session pointer of the STA 3253 * @restore_sta_power: Flag to update the new Tx power for STA 3254 * 3255 * Return: QDF_STATUS 3256 */ 3257 QDF_STATUS 3258 lim_update_tx_power(struct mac_context *mac_ctx, struct pe_session *sap_session, 3259 struct pe_session *sta_session, bool restore_sta_power); 3260 3261 /** 3262 * lim_skip_tpc_update_for_sta() - Function to check if the TPC set power 3263 * needs to be skipped for STA. 3264 * 3265 * @mac_ctx: Pointer to Global mac structure 3266 * @sta_session: Session pointer of the STA. 3267 * @sap_session: Session pointer of the SAP 3268 * 3269 * Return: skip tpc for sta 3270 */ 3271 bool 3272 lim_skip_tpc_update_for_sta(struct mac_context *mac, 3273 struct pe_session *sta_session, 3274 struct pe_session *sap_session); 3275 3276 #ifdef FEATURE_WLAN_GC_SKIP_JOIN 3277 static inline bool 3278 lim_connect_skip_join_for_gc(struct pe_session *pe_session) 3279 { 3280 if (pe_session->opmode == QDF_P2P_CLIENT_MODE) 3281 return true; 3282 else 3283 return false; 3284 } 3285 #else 3286 static inline bool 3287 lim_connect_skip_join_for_gc(struct pe_session *pe_session) 3288 { 3289 return false; 3290 } 3291 #endif 3292 3293 /** 3294 * lim_get_concurrent_session() - Function to get the concurrent session pointer 3295 * 3296 * @mac_ctx: Pointer to Global mac structure 3297 * @vdev_id: vdev id 3298 * @opmode: opmode of the interface 3299 * 3300 * Return: pe_session 3301 */ 3302 struct pe_session * 3303 lim_get_concurrent_session(struct mac_context *mac_ctx, uint8_t vdev_id, 3304 enum QDF_OPMODE opmode); 3305 3306 /** 3307 * lim_check_conc_power_for_csa() - Function to change the TX power 3308 * of STA when channel switch happens in SAP 3309 * 3310 * @mac_ctx: Pointer to Global mac structure. 3311 * @session: Session pointer of the SAP. 3312 * 3313 * Return: None 3314 */ 3315 void 3316 lim_check_conc_power_for_csa(struct mac_context *mac_ctx, 3317 struct pe_session *session); 3318 3319 /** 3320 * lim_cleanup_power_change() - Function to reset the change_scc_power 3321 * flag in concurrent SAP vdev 3322 * 3323 * @mac_ctx: Pointer to Global mac structure. 3324 * @session: Session pointer of the interface 3325 */ 3326 void 3327 lim_cleanup_power_change(struct mac_context *mac_ctx, 3328 struct pe_session *session); 3329 3330 /** 3331 * lim_is_power_change_required_for_sta() - Function to check if the 6 GHz 3332 * STA power level has to be changed 3333 * 3334 * @mac_ctx: Pointer to Global mac structure. 3335 * @sta_session: Session pointer of STA. 3336 * @sap_session: Session pointer of SAP. 3337 * 3338 * Return: restart required for sta 3339 */ 3340 bool 3341 lim_is_power_change_required_for_sta(struct mac_context *mac_ctx, 3342 struct pe_session *sta_session, 3343 struct pe_session *sap_session); 3344 3345 /** 3346 * lim_update_tx_pwr_on_ctry_change_cb() - Callback to be invoked by regulatory 3347 * module when country code changes (without channel change) OR if fcc 3348 * constraint is set to true. 3349 * This API calls TPC calculation API to recalculate and update the TX power. 3350 * @vdev_id: vdev id 3351 * 3352 * Return: None 3353 */ 3354 void 3355 lim_update_tx_pwr_on_ctry_change_cb(uint8_t vdev_id); 3356 3357 /* 3358 * lim_get_connected_chan_for_mode() - Get connected channel for given opmode 3359 * in given frequency range. 3360 * 3361 * @psoc: Pointer to psoc object 3362 * @opmode: Vdev opmode 3363 * @freq: Frequency 3364 * 3365 * Return: Return connected channel in given frequcy range for given opmode. 3366 */ 3367 struct wlan_channel * 3368 lim_get_connected_chan_for_mode(struct wlan_objmgr_psoc *psoc, 3369 enum QDF_OPMODE opmode, 3370 qdf_freq_t start_freq, 3371 qdf_freq_t end_freq); 3372 3373 /** 3374 * lim_convert_vht_chwidth_to_phy_chwidth() - Convert VHT operation 3375 * ch width into phy ch width 3376 * 3377 * @ch_width: VHT op channel width 3378 * @is_40: is 40 MHz 3379 * 3380 * Return: phy chwidth 3381 */ 3382 enum phy_ch_width 3383 lim_convert_vht_chwidth_to_phy_chwidth(uint8_t ch_width, bool is_40); 3384 3385 /* 3386 * lim_cmp_ssid() - Compare two SSIDs. 3387 * @ssid: first ssid 3388 * @pe_session: pointer to session 3389 * 3390 * Return: qdf_mem_cmp of ssids 3391 */ 3392 uint32_t lim_cmp_ssid(tSirMacSSid *ssid, struct pe_session *pe_session); 3393 3394 /* 3395 * lim_configure_fd_for_existing_6ghz_sap() - Based on the concurrent 3396 * legacy SAP interface UP/DOWN, configure the FD for the 6 GHz SAPs. 3397 * @session: pointer to pe_session 3398 * @is_sap_starting: true if SAP is starting, false if SAP is stopping 3399 * 3400 * Return: None 3401 */ 3402 void 3403 lim_configure_fd_for_existing_6ghz_sap(struct pe_session *session, 3404 bool is_sap_starting); 3405 3406 #ifdef WLAN_CHIPSET_STATS 3407 /** 3408 * lim_cp_stats_cstats_log_assoc_resp_evt() - Log chipset stats for assoc resp 3409 * 3410 * @session_entry: pointer to session object 3411 * @dir: Direction 3412 * @status_code: assoc/reassoc status 3413 * @aid: association identifier 3414 * @bssid: bssid 3415 * @da: destination address 3416 * @is_ht: is HT 3417 * @is_vht: is VHT 3418 * @is_he: is HE 3419 * @is_eht: is EHT 3420 * @is_reassoc: is reassoc frame 3421 * 3422 * Return : void 3423 */ 3424 void lim_cp_stats_cstats_log_assoc_resp_evt(struct pe_session *session_entry, 3425 enum cstats_dir dir, 3426 uint16_t status_code, uint16_t aid, 3427 uint8_t *bssid, uint8_t *da, 3428 bool is_ht, bool is_vht, bool is_he, 3429 bool is_eht, bool is_reassoc); 3430 3431 /** 3432 * lim_cp_stats_cstats_log_auth_evt() - Log chipset stats for auth frames 3433 * 3434 * @pe_session: pointer to session object 3435 * @dir: direction 3436 * @algo: auth algorithm 3437 * @seq: auth sequence 3438 * @status: Status 3439 * 3440 * Return : void 3441 */ 3442 void lim_cp_stats_cstats_log_auth_evt(struct pe_session *pe_session, 3443 enum cstats_dir dir, uint16_t algo, 3444 uint16_t seq, uint16_t status); 3445 3446 /** 3447 * lim_cp_stats_cstats_log_deauth_evt() - Log chipset stats for deauth frames 3448 * 3449 * @pe_session: pointer to session object 3450 * @dir: direction 3451 * @reasonCode: reason code 3452 * 3453 * Return : void 3454 */ 3455 void lim_cp_stats_cstats_log_deauth_evt(struct pe_session *pe_session, 3456 enum cstats_dir dir, 3457 uint16_t reasonCode); 3458 3459 /** 3460 * lim_cp_stats_cstats_log_disassoc_evt() - Log chipset stats for disassoc frm 3461 * 3462 * @pe_session: pointer to session object 3463 * @dir: direction 3464 * @reasonCode: reason code 3465 * 3466 * Return : void 3467 */ 3468 void lim_cp_stats_cstats_log_disassoc_evt(struct pe_session *pe_session, 3469 enum cstats_dir dir, 3470 uint16_t reasonCode); 3471 3472 /** 3473 * lim_cp_stats_cstats_log_assoc_req_evt() - Log chipset stats for assoc req frm 3474 * 3475 * @pe_session: pointer to session object 3476 * @dir: Direction 3477 * @bssid: bssid 3478 * @sa: source addr 3479 * @ssid_len: ssid length 3480 * @ssid: ssid 3481 * @is_ht: is HT 3482 * @is_vht: is VHT 3483 * @is_he: is HE 3484 * @is_eht: is EHT 3485 * @is_reassoc: is reassociation request 3486 * 3487 * Return : void 3488 */ 3489 void lim_cp_stats_cstats_log_assoc_req_evt(struct pe_session *pe_session, 3490 enum cstats_dir dir, uint8_t *bssid, 3491 uint8_t *sa, uint8_t ssid_len, 3492 uint8_t *ssid, bool is_ht, 3493 bool is_vht, bool is_he, 3494 bool is_eht, bool is_reassoc); 3495 3496 /** 3497 * lim_cp_stats_cstats_log_disc_req_evt() : chipset stats for TDLS disc req 3498 * 3499 * @frm: pointer to tDot11fTDLSDisReq 3500 * @pe_session: pointer to session object 3501 * 3502 * Return: void 3503 */ 3504 void lim_cp_stats_cstats_log_disc_req_evt(tDot11fTDLSDisReq *frm, 3505 struct pe_session *pe_session); 3506 3507 /** 3508 * lim_cp_stats_cstats_log_disc_resp_evt() : chipset stats for TDLS disc resp 3509 * 3510 * @frm: pointer to tDot11fTDLSDisRsp 3511 * @pe_session: pointer to session object 3512 * 3513 * Return: void 3514 */ 3515 void lim_cp_stats_cstats_log_disc_resp_evt(tDot11fTDLSDisRsp *frm, 3516 struct pe_session *pe_session); 3517 3518 /** 3519 * lim_cp_stats_cstats_log_setup_req_evt() : chipset stats for TDLS setup req 3520 * 3521 * @frm: pointer to tDot11fTDLSSetupReq 3522 * @pe_session: pointer to session object 3523 * 3524 * Return: void 3525 */ 3526 void lim_cp_stats_cstats_log_setup_req_evt(tDot11fTDLSSetupReq *frm, 3527 struct pe_session *pe_session); 3528 3529 /** 3530 * lim_cp_stats_cstats_log_setup_resp_evt() : chipset stats for TDLS setup resp 3531 * 3532 * @frm: pointer to tDot11fTDLSSetupRsp 3533 * @pe_session: pointer to session object 3534 * 3535 * Return: void 3536 */ 3537 void lim_cp_stats_cstats_log_setup_resp_evt(tDot11fTDLSSetupRsp *frm, 3538 struct pe_session *pe_session); 3539 3540 /** 3541 * lim_cp_stats_cstats_log_setup_confirm_evt() : chipset stats for TDLS setup 3542 * confirm 3543 * 3544 * @frm: pointer to tDot11fTDLSSetupCnf 3545 * @pe_session: pointer to session object 3546 * 3547 * Return: void 3548 */ 3549 void lim_cp_stats_cstats_log_setup_confirm_evt(tDot11fTDLSSetupCnf *frm, 3550 struct pe_session *pe_session); 3551 3552 /** 3553 * lim_cp_stats_cstats_log_tear_down_evt() : chipset stats for TDLS teardown 3554 * 3555 * @frm: pointer to tDot11fTDLSSetupCnf 3556 * @pe_session: pointer to session object 3557 * 3558 * Return: void 3559 */ 3560 void lim_cp_stats_cstats_log_tear_down_evt(tDot11fTDLSTeardown *frm, 3561 struct pe_session *pe_session); 3562 3563 /** 3564 * lim_cp_stats_cstats_log_csa_evt() : chipset stats for CSA event 3565 * 3566 * @pe_session: pointer to session object 3567 * @dir: Direction of the event i.e TX/RX 3568 * @target_freq: Target freq 3569 * @target_ch_width: Target channel width 3570 * @switch_mode: Switch mode 3571 * 3572 * Return: void 3573 */ 3574 void lim_cp_stats_cstats_log_csa_evt(struct pe_session *pe_session, 3575 enum cstats_dir dir, uint16_t target_freq, 3576 uint8_t target_ch_width, 3577 uint8_t switch_mode); 3578 #else 3579 static inline void 3580 lim_cp_stats_cstats_log_assoc_resp_evt(struct pe_session *session_entry, 3581 enum cstats_dir dir, 3582 uint16_t status_code, uint16_t aid, 3583 uint8_t *bssid, uint8_t *da, 3584 bool is_ht, bool is_vht, bool is_he, 3585 bool is_eht, bool is_reassoc) 3586 { 3587 } 3588 3589 static inline void 3590 lim_cp_stats_cstats_log_auth_evt(struct pe_session *pe_session, 3591 enum cstats_dir dir, uint16_t algo, 3592 uint16_t seq, uint16_t status) 3593 { 3594 } 3595 3596 static inline void 3597 lim_cp_stats_cstats_log_deauth_evt(struct pe_session *pe_session, 3598 enum cstats_dir dir, uint16_t reasonCode) 3599 { 3600 } 3601 3602 static inline void 3603 lim_cp_stats_cstats_log_disassoc_evt(struct pe_session *pe_session, 3604 enum cstats_dir dir, uint16_t reasonCode) 3605 { 3606 } 3607 3608 static inline void 3609 lim_cp_stats_cstats_log_assoc_req_evt(struct pe_session *pe_session, 3610 enum cstats_dir dir, uint8_t *bssid, 3611 uint8_t *sa, uint8_t ssid_len, 3612 uint8_t *ssid, bool is_ht, 3613 bool is_vht, bool is_he, 3614 bool is_eht, bool is_reassoc) 3615 { 3616 } 3617 3618 static inline void 3619 lim_cp_stats_cstats_log_disc_req_evt(tDot11fTDLSDisReq *frm, 3620 struct pe_session *pe_session) 3621 { 3622 } 3623 3624 static inline void 3625 lim_cp_stats_cstats_log_disc_resp_evt(tDot11fTDLSDisRsp *frm, 3626 struct pe_session *pe_session) 3627 { 3628 } 3629 3630 static inline void 3631 lim_cp_stats_cstats_log_setup_req_evt(tDot11fTDLSSetupReq *frm, 3632 struct pe_session *pe_session) 3633 { 3634 } 3635 3636 static inline void 3637 lim_cp_stats_cstats_log_setup_resp_evt(tDot11fTDLSSetupRsp *frm, 3638 struct pe_session *pe_session) 3639 { 3640 } 3641 3642 static inline void 3643 lim_cp_stats_cstats_log_setup_confirm_evt(tDot11fTDLSSetupCnf *frm, 3644 struct pe_session *pe_session) 3645 { 3646 } 3647 3648 static inline void 3649 lim_cp_stats_cstats_log_tear_down_evt(tDot11fTDLSTeardown *frm, 3650 struct pe_session *pe_session) 3651 { 3652 } 3653 3654 static inline void 3655 lim_cp_stats_cstats_log_csa_evt(struct pe_session *pe_session, 3656 enum cstats_dir dir, uint16_t target_freq, 3657 uint8_t target_ch_width, uint8_t switch_mode) 3658 { 3659 } 3660 #endif /* WLAN_CHIPSET_STATS */ 3661 3662 #define MAX_TX_PSD_POWER 15 3663 3664 /** 3665 * lim_get_tpe_ie_length() : Get the tpe ie length 3666 * @ch_width: phy channel width 3667 * @tpe_ie: pointer to dot11f TPE IE structure 3668 * @num_tpe: number of TPE IE 3669 * 3670 * Return: tpe ie length 3671 */ 3672 uint16_t lim_get_tpe_ie_length(enum phy_ch_width ch_width, 3673 tDot11fIEtransmit_power_env *tpe_ie, 3674 uint16_t num_tpe); 3675 3676 /** 3677 * lim_fill_complete_tpe_ie() : fill tpe ie to target buffer 3678 * @ch_width: phy channel width 3679 * @tpe_ie_len: the total bytes to fill target buffer 3680 * @tpe_ptr: pointer to dot11f TPE IE structure 3681 * @num_tpe: number of TPE IE 3682 * @target: the buffer to fill data 3683 * 3684 * Return: QDF_STATUS 3685 */ 3686 QDF_STATUS lim_fill_complete_tpe_ie(enum phy_ch_width ch_width, 3687 uint16_t tpe_ie_len, 3688 tDot11fIEtransmit_power_env *tpe_ptr, 3689 uint16_t num_tpe, uint8_t *target); 3690 #endif /* __LIM_UTILS_H */ 3691