1 /* 2 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 /** 18 * DOC: Define VDEV MLME structure and APIs 19 */ 20 #ifndef _WLAN_VDEV_MLME_H_ 21 #define _WLAN_VDEV_MLME_H_ 22 23 #include <wlan_vdev_mgr_tgt_if_rx_defs.h> 24 #include <wlan_objmgr_vdev_obj.h> 25 #include <wlan_vdev_mlme_api.h> 26 #include <wlan_ext_mlme_obj_types.h> 27 28 struct vdev_mlme_obj; 29 struct cnx_mgr; 30 31 /* Requestor ID for multiple vdev restart */ 32 #define MULTIPLE_VDEV_RESTART_REQ_ID 0x1234 33 34 /* values for vdev_type */ 35 #define WLAN_VDEV_MLME_TYPE_UNKNOWN 0x0 36 #define WLAN_VDEV_MLME_TYPE_AP 0x1 37 #define WLAN_VDEV_MLME_TYPE_STA 0x2 38 #define WLAN_VDEV_MLME_TYPE_IBSS 0x3 39 #define WLAN_VDEV_MLME_TYPE_MONITOR 0x4 40 #define WLAN_VDEV_MLME_TYPE_NAN 0x5 41 #define WLAN_VDEV_MLME_TYPE_OCB 0x6 42 #define WLAN_VDEV_MLME_TYPE_NDI 0x7 43 44 /* values for vdev_subtype */ 45 #define WLAN_VDEV_MLME_SUBTYPE_UNKNOWN 0x0 46 #define WLAN_VDEV_MLME_SUBTYPE_P2P_DEVICE 0x1 47 #define WLAN_VDEV_MLME_SUBTYPE_P2P_CLIENT 0x2 48 #define WLAN_VDEV_MLME_SUBTYPE_P2P_GO 0x3 49 #define WLAN_VDEV_MLME_SUBTYPE_PROXY_STA 0x4 50 #define WLAN_VDEV_MLME_SUBTYPE_MESH 0x5 51 #define WLAN_VDEV_MLME_SUBTYPE_MESH_11S 0x6 52 #define WLAN_VDEV_MLME_SUBTYPE_SMART_MONITOR 0x7 53 54 /* vdev control flags (per bits) */ 55 #define WLAN_VDEV_MLME_FLAGS_NON_MBSSID_AP 0x00000001 56 #define WLAN_VDEV_MLME_FLAGS_TRANSMIT_AP 0x00000002 57 #define WLAN_VDEV_MLME_FLAGS_NON_TRANSMIT_AP 0x00000004 58 #define WLAN_VDEV_MLME_FLAGS_EMA_MODE 0x00000008 59 60 /** 61 * struct vdev_mlme_proto_generic - generic mlme proto structure 62 * sent in frames 63 * @dtim_period: frequency of data transmissions per beacon 1-255 64 * @slot_time: slot time 65 * @protection_mode: rts cts protection mode 66 * @beacon_interval: beacon interval 67 * @ldpc: low density parity check value 68 * @nss: number of spatial stream 69 * @nss_2g: 2.4GHz number of spatial stream 70 * @nss_5g: 5GHz number of spatial stream 71 * @tsfadjust: adjusted timer sync value 72 */ 73 struct vdev_mlme_proto_generic { 74 uint8_t dtim_period; 75 uint32_t slot_time; 76 uint32_t protection_mode; 77 uint16_t beacon_interval; 78 uint8_t ldpc; 79 uint8_t nss; 80 uint8_t nss_2g; 81 uint8_t nss_5g; 82 uint64_t tsfadjust; 83 }; 84 85 /** 86 * struct vdev_mlme_proto_ap - ap specific mlme protocol 87 * @. 88 */ 89 struct vdev_mlme_proto_ap { 90 }; 91 92 /** 93 * struct vdev_mlme_proto_sta - sta specific mlme protocol 94 * @assoc_id: association id of station 95 * @uapsd_cfg: uapsd configuration 96 */ 97 struct vdev_mlme_proto_sta { 98 uint16_t assoc_id; 99 uint16_t uapsd_cfg; 100 }; 101 102 /** 103 * struct vdev_mlme_proto_bss_color - bss color cfg 104 * @flags: proposed for future use cases, currently not used. 105 * @evt_type: bss color collision event. 106 * @current_bss_color: current bss color. 107 * @detection_period_ms: scan interval for both AP and STA mode. 108 * @scan_period_ms: scan period for passive scan to detect collision. 109 * @free_slot_expiry_time_ms: FW to notify host at timer expiry after 110 * which Host will disable the bss color. 111 */ 112 struct vdev_mlme_proto_bss_color { 113 uint32_t flags; 114 uint8_t evt_type; 115 uint32_t current_bss_color; 116 uint32_t detection_period_ms; 117 uint32_t scan_period_ms; 118 uint32_t free_slot_expiry_time_ms; 119 }; 120 121 /** 122 * struct vdev_mlme_vht_info - vdev VHT information 123 * @caps: vht capabilities 124 * @subfer: su beam former capability 125 * @subfee: su beam formee capability 126 * @mubfer: mu beam former capability 127 * @mubfee: mu beam formee capability 128 * @implicit_bf: Implicit BF support 129 * @sounding_dimension: Beamformer number of sounding dimension 130 * @bfee_sts_cap: beam formee STA capability 131 * @allow_vht: vht capability status 132 */ 133 struct vdev_mlme_vht_info { 134 uint32_t caps; 135 uint8_t subfer; 136 uint8_t mubfer; 137 uint8_t subfee; 138 uint8_t mubfee; 139 uint8_t implicit_bf; 140 uint8_t sounding_dimension; 141 uint8_t bfee_sts_cap; 142 bool allow_vht; 143 }; 144 145 /** 146 * struct vdev_mlme_ht_info - vdev HT information 147 * @ht_caps: HT capabilities 148 * @allow_ht: HT capability status 149 */ 150 struct vdev_mlme_ht_info { 151 uint32_t ht_caps; 152 bool allow_ht; 153 }; 154 155 /** 156 * struct vdev_mlme_he_ops_info - vdev mlme HEOPS information 157 * @he_ops: he ops 158 */ 159 struct vdev_mlme_he_ops_info { 160 uint32_t he_ops; 161 }; 162 163 #ifdef WLAN_FEATURE_11BE 164 /** 165 * struct vdev_mlme_eht_ops_info - vdev mlme EHTOPS information 166 * @eht_ops: eht ops 167 */ 168 struct vdev_mlme_eht_ops_info { 169 uint32_t eht_ops; 170 }; 171 #endif 172 173 /** 174 * struct vdev_mlme_he_ops_info - vdev protocol structure holding information 175 * that is used in frames 176 * @generic: generic protocol information 177 * @ap: ap specific protocol information 178 * @sta: sta specific protocol information 179 * @vht_info: vht information 180 * @ht_info: ht capabilities information 181 * @he_ops_info: he ops information 182 * @bss_color: 11ax HE BSS Color information 183 */ 184 struct vdev_mlme_proto { 185 struct vdev_mlme_proto_generic generic; 186 struct vdev_mlme_proto_ap ap; 187 struct vdev_mlme_proto_sta sta; 188 struct vdev_mlme_vht_info vht_info; 189 struct vdev_mlme_ht_info ht_info; 190 struct vdev_mlme_he_ops_info he_ops_info; 191 #ifdef WLAN_FEATURE_11BE 192 struct vdev_mlme_eht_ops_info eht_ops_info; 193 #endif 194 struct vdev_mlme_proto_bss_color bss_color; 195 }; 196 197 /** 198 * struct vdev_mlme_mgmt_generic - generic vdev mlme mgmt cfg 199 * @rts_threshold: RTS threshold 200 * @frag_threshold: Fragmentation threshold 201 * @probe_delay: time in msec for delaying to send first probe request 202 * @repeat_probe_time: probe request transmission time 203 * @drop_unencry: drop unencrypted status 204 * @ tx_pwrlimit: Tx power limit 205 * @tx_power: Tx power 206 * @minpower: Min power 207 * @maxpower: Max power 208 * @maxregpower: max regulatory power 209 * @antennamax: max antenna 210 * @reg_class_id: reg domain class id 211 * @ampdu: ampdu limit 212 * @amsdu: amsdu limit 213 * @ssid: service set identifier 214 * @ssid_len: ssid length 215 * @type: vdev type 216 * @sub_type: vdev subtype 217 * @rx_decap_type: rx decap type 218 * @tx_encap_type: tx encap type 219 * @disable_hw_ack: disable ha ack flag 220 * @bssid: bssid 221 * @phy_mode: phy mode 222 * @special_vdev_mode: indicates special vdev mode 223 */ 224 struct vdev_mlme_mgmt_generic { 225 uint32_t rts_threshold; 226 uint32_t frag_threshold; 227 uint32_t probe_delay; 228 uint32_t repeat_probe_time; 229 uint32_t drop_unencry; 230 uint32_t tx_pwrlimit; 231 uint8_t tx_power; 232 uint8_t minpower; 233 uint8_t maxpower; 234 uint8_t maxregpower; 235 uint8_t antennamax; 236 uint8_t reg_class_id; 237 uint8_t ampdu; 238 uint8_t amsdu; 239 char ssid[WLAN_SSID_MAX_LEN + 1]; 240 uint8_t ssid_len; 241 uint8_t type; 242 uint8_t subtype; 243 uint8_t rx_decap_type; 244 uint8_t tx_encap_type; 245 bool disable_hw_ack; 246 uint8_t bssid[QDF_MAC_ADDR_SIZE]; 247 uint32_t phy_mode; 248 bool special_vdev_mode; 249 }; 250 251 /** 252 * struct vdev_mlme_mgmt_ap - ap specific vdev mlme mgmt cfg 253 * @hidden_ssid: flag to indicate whether it is hidden ssid 254 * @cac_duration_ms: cac duration in millseconds 255 */ 256 struct vdev_mlme_mgmt_ap { 257 bool hidden_ssid; 258 uint32_t cac_duration_ms; 259 }; 260 261 /** 262 * struct vdev_mlme_mgmt_sta - sta specific vdev mlme mgmt cfg 263 * @he_mcs_12_13_map: map to indicate mcs12/13 caps of peer&dut 264 */ 265 struct vdev_mlme_mgmt_sta { 266 uint16_t he_mcs_12_13_map; 267 }; 268 269 /** 270 * struct vdev_mlme_inactivity_params - vdev mlme inactivity parameters 271 * @bmiss_first_bcnt: bmiss first time 272 * @bmiss_final_bcnt: bmiss final time 273 * @keepalive_min_idle_inactive_time_secs: min time AP consider STA to be 274 * inactive 275 * @keepalive_max_idle_inactive_time_secs: max inactive idle time for AP to send 276 * data-null 277 * @keepalive_max_unresponsive_time_secs: max time to send WMI_STA_KICKOUT 278 */ 279 struct vdev_mlme_inactivity_params { 280 uint32_t bmiss_first_bcnt; 281 uint32_t bmiss_final_bcnt; 282 uint32_t keepalive_min_idle_inactive_time_secs; 283 uint32_t keepalive_max_idle_inactive_time_secs; 284 uint32_t keepalive_max_unresponsive_time_secs; 285 }; 286 287 /** 288 * struct vdev_mlme_rate_info - vdev mlme rate information 289 * @rate_flags: dynamic bandwidth info 290 * @per_band_tx_mgmt_rate: per band Tx mgmt rate 291 * @max_rate: max bandwidth rate 292 * @tx_mgmt_rate: Tx Mgmt rate 293 * @bcn_tx_rate: beacon Tx rate 294 * @bcn_tx_rate_code: beacon Tx rate code 295 * @type: Type of ratemask configuration 296 * @lower32: Lower 32 bits in the 1st 64-bit value 297 * @higher32: Higher 32 bits in the 1st 64-bit value 298 * @lower32_2: Lower 32 bits in the 2nd 64-bit value 299 * @half_rate: Half rate 300 * @quarter_rate: quarter rate 301 */ 302 struct vdev_mlme_rate_info { 303 uint32_t rate_flags; 304 uint32_t per_band_tx_mgmt_rate; 305 uint32_t max_rate; 306 uint32_t tx_mgmt_rate; 307 uint32_t bcn_tx_rate; 308 #ifdef WLAN_BCN_RATECODE_ENABLE 309 uint32_t bcn_tx_rate_code; 310 #endif 311 uint32_t rtscts_tx_rate; 312 uint8_t type; 313 uint32_t lower32; 314 uint32_t higher32; 315 uint32_t lower32_2; 316 bool half_rate; 317 bool quarter_rate; 318 }; 319 320 /** 321 * struct vdev_mlme_chainmask_info - vdev mlme chainmask information 322 * @tx_chainmask: Tx chainmask 323 * @rx_chainmask: Rx Chainmask 324 * @num_rx_chain: Num of bits set in Rx chain 325 * @num_tx_chain: Num of bits set in Tx chain 326 */ 327 struct vdev_mlme_chainmask_info { 328 uint8_t tx_chainmask; 329 uint8_t rx_chainmask; 330 uint8_t num_rx_chain; 331 uint8_t num_tx_chain; 332 }; 333 334 /** 335 * struct vdev_mlme_powersave_info - vdev mlme powersave information 336 * @packet_powersave: packet powersave 337 * @max_li_of_moddtim: max mod dtim 338 * @dyndtim_cnt: dynamic dtim count 339 * @listen_interval: listen interval 340 * @moddtim_cnt: mod dtim count 341 */ 342 struct vdev_mlme_powersave_info { 343 uint32_t packet_powersave; 344 uint32_t max_li_of_moddtim; 345 uint32_t dyndtim_cnt; 346 uint32_t listen_interval; 347 uint32_t moddtim_cnt; 348 }; 349 350 /** 351 * struct vdev_mlme_beacon_info - vdev mlme beacon information 352 * @beacon_buffer: buffer allocated for beacon frame 353 * @beacon_offsets: beacon IE's offsets 354 */ 355 struct vdev_mlme_beacon_info { 356 qdf_nbuf_t beacon_buffer; 357 void *beacon_offsets; 358 }; 359 360 /** 361 * struct vdev_mlme_mbss_11ax - mbss 11ax fields required for up cmd 362 * @profile_idx: profile index of the connected non-trans ap (mbssid case). 363 * 0 means invalid. 364 * @profile_num: the total profile numbers of non-trans aps (mbssid 365 * case). 366 * 0 means non-MBSS AP. 367 * @mbssid-flags: MBSS IE flags indicating vdev type 368 * @vdevid_trans: id of transmitting vdev for MBSS IE 369 * @trans_bssid: bssid of transmitted AP (MBSS IE case) 370 */ 371 struct vdev_mlme_mbss_11ax { 372 uint32_t profile_idx; 373 uint32_t profile_num; 374 uint32_t mbssid_flags; 375 uint8_t vdevid_trans; 376 uint8_t trans_bssid[QDF_MAC_ADDR_SIZE]; 377 }; 378 379 /** 380 * struct vdev_mlme_mgmt - vdev mlme mgmt related cfg 381 * @generic: generic mgmt information 382 * @ap: ap specific mgmt information 383 * @sta: sta specific mgmt information 384 * @inactivity_params: inactivity parameters 385 * @rate_info: bandwidth rate information 386 * @chainmask_info: Chainmask information 387 * @powersave_info: Power save parameters 388 * @beacon_info: beacon buffer information 389 * @mbss_11ax: MBSS 11ax information 390 */ 391 struct vdev_mlme_mgmt { 392 struct vdev_mlme_mgmt_generic generic; 393 struct vdev_mlme_mgmt_ap ap; 394 struct vdev_mlme_mgmt_sta sta; 395 struct vdev_mlme_inactivity_params inactivity_params; 396 struct vdev_mlme_rate_info rate_info; 397 struct vdev_mlme_chainmask_info chainmask_info; 398 struct vdev_mlme_powersave_info powersave_info; 399 struct vdev_mlme_beacon_info beacon_info; 400 struct vdev_mlme_mbss_11ax mbss_11ax; 401 }; 402 403 /** 404 * enum beacon_update_op - Beacon update op type 405 * @BEACON_INIT: Initialize beacon 406 * @BEACON_REINIT: Re-initialize beacon 407 * @BEACON_UPDATE: Update dynamic fields of beacon 408 * @BEACON_CSA: Enable CSA IE 409 * @BEACON_FREE: Beacon buffer free 410 */ 411 enum beacon_update_op { 412 BEACON_INIT, 413 BEACON_REINIT, 414 BEACON_UPDATE, 415 BEACON_CSA, 416 BEACON_FREE, 417 }; 418 419 /** 420 * enum vdev_cmd_type - Command type 421 * @START_REQ: Start request 422 * @RESTART_REQ: Restart request 423 * @STOP_REQ: STOP request 424 * @DELETE_REQ: DELETE request 425 */ 426 enum vdev_cmd_type { 427 START_REQ, 428 RESTART_REQ, 429 STOP_REQ, 430 DELETE_REQ, 431 }; 432 433 /** 434 * enum vdev_start_resp_type - start respone type 435 * @START_RESPONSE: Start response 436 * @RESTART_RESPONSE: Restart response 437 */ 438 enum vdev_start_resp_type { 439 START_RESPONSE = 0, 440 RESTART_RESPONSE, 441 }; 442 443 /** 444 * struct vdev_mlme_ops - VDEV MLME operation callbacks structure 445 * @mlme_vdev_validate_basic_params: callback to validate VDEV basic params 446 * @mlme_vdev_reset_proto_params: callback to Reset protocol params 447 * @mlme_vdev_start_send: callback to initiate actions of VDEV 448 * MLME start operation 449 * @mlme_vdev_restart_send: callback to initiate actions of VDEV 450 * MLME restart operation 451 * @mlme_vdev_stop_start_send: callback to block start/restart VDEV 452 * request command 453 * @mlme_vdev_start_continue: callback to initiate operations on 454 * LMAC/FW start response 455 * @mlme_vdev_sta_conn_start: callback to initiate STA connection 456 * @mlme_vdev_up_send: callback to initiate actions of VDEV 457 * MLME up operation 458 * @mlme_vdev_notify_up_complete: callback to notify VDEV MLME on moving 459 * to UP state 460 * @mlme_vdev_notify_roam_start: callback to initiate roaming 461 * @mlme_vdev_update_beacon: callback to initiate beacon update 462 * @mlme_vdev_disconnect_peers: callback to initiate disconnection of 463 * peers 464 * @mlme_vdev_dfs_cac_timer_stop: callback to stop the DFS CAC timer 465 * @mlme_vdev_stop_send: callback to initiate actions of VDEV 466 * MLME stop operation 467 * @mlme_vdev_stop_continue: callback to initiate operations on 468 * LMAC/FW stop response 469 * @mlme_vdev_bss_peer_delete_continue: callback to initiate operations on BSS 470 * peer delete completion 471 * @mlme_vdev_down_send: callback to initiate actions of VDEV 472 * MLME down operation 473 * @mlme_vdev_notify_start_state_exit: callback to notify on vdev start 474 * start state exit 475 * @mlme_vdev_is_newchan_no_cac: callback to check CAC is required 476 * @mlme_vdev_ext_peer_delete_all_rsp: callback to initiate actions for 477 * vdev mlme peer delete all response 478 * @mlme_vdev_dfs_cac_wait_notify: callback to notify about CAC state 479 * @mlme_vdev_csa_complete: callback to indicate CSA complete 480 * @mlme_vdev_sta_disconn_start: callback to initiate STA disconnection 481 */ 482 struct vdev_mlme_ops { 483 QDF_STATUS (*mlme_vdev_validate_basic_params)( 484 struct vdev_mlme_obj *vdev_mlme, 485 uint16_t event_data_len, void *event_data); 486 QDF_STATUS (*mlme_vdev_reset_proto_params)( 487 struct vdev_mlme_obj *vdev_mlme, 488 uint16_t event_data_len, void *event_data); 489 QDF_STATUS (*mlme_vdev_start_send)( 490 struct vdev_mlme_obj *vdev_mlme, 491 uint16_t event_data_len, void *event_data); 492 QDF_STATUS (*mlme_vdev_restart_send)( 493 struct vdev_mlme_obj *vdev_mlme, 494 uint16_t event_data_len, void *event_data); 495 QDF_STATUS (*mlme_vdev_stop_start_send)( 496 struct vdev_mlme_obj *vdev_mlme, 497 enum vdev_cmd_type type, 498 uint16_t event_data_len, void *event_data); 499 QDF_STATUS (*mlme_vdev_start_continue)( 500 struct vdev_mlme_obj *vdev_mlme, 501 uint16_t event_data_len, void *event_data); 502 QDF_STATUS (*mlme_vdev_sta_conn_start)( 503 struct vdev_mlme_obj *vdev_mlme, 504 uint16_t event_data_len, void *event_data); 505 QDF_STATUS (*mlme_vdev_start_req_failed)( 506 struct vdev_mlme_obj *vdev_mlme, 507 uint16_t event_data_len, void *event_data); 508 QDF_STATUS (*mlme_vdev_up_send)( 509 struct vdev_mlme_obj *vdev_mlme, 510 uint16_t event_data_len, void *event_data); 511 QDF_STATUS (*mlme_vdev_notify_up_complete)( 512 struct vdev_mlme_obj *vdev_mlme, 513 uint16_t event_data_len, void *event_data); 514 QDF_STATUS (*mlme_vdev_notify_roam_start)( 515 struct vdev_mlme_obj *vdev_mlme, 516 uint16_t event_data_len, void *event_data); 517 QDF_STATUS (*mlme_vdev_update_beacon)( 518 struct vdev_mlme_obj *vdev_mlme, 519 enum beacon_update_op op, 520 uint16_t event_data_len, void *event_data); 521 QDF_STATUS (*mlme_vdev_disconnect_peers)( 522 struct vdev_mlme_obj *vdev_mlme, 523 uint16_t event_data_len, void *event_data); 524 QDF_STATUS (*mlme_vdev_dfs_cac_timer_stop)( 525 struct vdev_mlme_obj *vdev_mlme, 526 uint16_t event_data_len, void *event_data); 527 QDF_STATUS (*mlme_vdev_stop_send)( 528 struct vdev_mlme_obj *vdev_mlme, 529 uint16_t event_data_len, void *event_data); 530 QDF_STATUS (*mlme_vdev_stop_continue)( 531 struct vdev_mlme_obj *vdev_mlme, 532 uint16_t event_data_len, void *event_data); 533 QDF_STATUS (*mlme_vdev_down_send)( 534 struct vdev_mlme_obj *vdev_mlme, 535 uint16_t event_data_len, void *event_data); 536 QDF_STATUS (*mlme_vdev_notify_down_complete)( 537 struct vdev_mlme_obj *vdev_mlme, 538 uint16_t event_data_len, void *event_data); 539 QDF_STATUS (*mlme_vdev_ext_stop_rsp)( 540 struct vdev_mlme_obj *vdev_mlme, 541 struct vdev_stop_response *rsp); 542 QDF_STATUS (*mlme_vdev_ext_start_rsp)( 543 struct vdev_mlme_obj *vdev_mlme, 544 struct vdev_start_response *rsp); 545 QDF_STATUS (*mlme_vdev_notify_start_state_exit)( 546 struct vdev_mlme_obj *vdev_mlme); 547 QDF_STATUS (*mlme_vdev_is_newchan_no_cac)( 548 struct vdev_mlme_obj *vdev_mlme); 549 QDF_STATUS (*mlme_vdev_ext_peer_delete_all_rsp)( 550 struct vdev_mlme_obj *vdev_mlme, 551 struct peer_delete_all_response *rsp); 552 QDF_STATUS (*mlme_vdev_dfs_cac_wait_notify)( 553 struct vdev_mlme_obj *vdev_mlme); 554 QDF_STATUS (*mlme_vdev_csa_complete)( 555 struct vdev_mlme_obj *vdev_mlme); 556 QDF_STATUS (*mlme_vdev_sta_disconn_start)( 557 struct vdev_mlme_obj *vdev_mlme, 558 uint16_t event_data_len, void *event_data); 559 560 }; 561 562 /** 563 * struct vdev_mlme_obj - VDEV MLME component object 564 * @proto: VDEV MLME proto substructure 565 * @mgmt: VDEV MLME mgmt substructure 566 * @sm_lock: VDEV SM lock 567 * @vdev_cmd_lock: VDEV MLME command atomicity 568 * @sm_hdl: VDEV SM handle 569 * @cnx_mgr_ctx: connection manager context, valid for STA and P2P-CLI mode only 570 * @vdev: Pointer to vdev objmgr 571 * @ops: VDEV MLME callback table 572 * @ext_vdev_ptr: VDEV MLME legacy pointer 573 * @reg_tpc_obj: Regulatory transmit power info 574 * @vdev_rt: VDEV response timer 575 * @vdev_wakelock: vdev wakelock sub structure 576 */ 577 struct vdev_mlme_obj { 578 struct vdev_mlme_proto proto; 579 struct vdev_mlme_mgmt mgmt; 580 #ifdef VDEV_SM_LOCK_SUPPORT 581 qdf_spinlock_t sm_lock; 582 qdf_mutex_t vdev_cmd_lock; 583 #endif 584 struct wlan_sm *sm_hdl; 585 union { 586 struct cnx_mgr *cnx_mgr_ctx; 587 }; 588 struct wlan_objmgr_vdev *vdev; 589 struct vdev_mlme_ops *ops; 590 mlme_vdev_ext_t *ext_vdev_ptr; 591 struct reg_tpc_power_info reg_tpc_obj; 592 }; 593 594 /** 595 * wlan_vdev_mlme_set_ssid() - set ssid 596 * @vdev: VDEV object 597 * @ssid: SSID (input) 598 * @ssid_len: Length of SSID 599 * 600 * API to set the SSID of VDEV 601 * 602 * Caller need to acquire lock with wlan_vdev_obj_lock() 603 * 604 * Return: SUCCESS, if update is done 605 * FAILURE, if ssid length is > max ssid len 606 */ 607 static inline QDF_STATUS wlan_vdev_mlme_set_ssid( 608 struct wlan_objmgr_vdev *vdev, 609 const uint8_t *ssid, uint8_t ssid_len) 610 { 611 struct vdev_mlme_obj *vdev_mlme; 612 613 /* This API is invoked with lock acquired, do not add log prints */ 614 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 615 if (!vdev_mlme) 616 return QDF_STATUS_E_FAILURE; 617 618 if (ssid_len <= WLAN_SSID_MAX_LEN) { 619 qdf_mem_copy(vdev_mlme->mgmt.generic.ssid, ssid, ssid_len); 620 vdev_mlme->mgmt.generic.ssid_len = ssid_len; 621 } else { 622 vdev_mlme->mgmt.generic.ssid_len = 0; 623 return QDF_STATUS_E_FAILURE; 624 } 625 return QDF_STATUS_SUCCESS; 626 } 627 628 /** 629 * wlan_vdev_mlme_get_ssid() - get ssid 630 * @vdev: VDEV object 631 * @ssid: SSID 632 * @ssid_len: Length of SSID 633 * 634 * API to get the SSID of VDEV, it updates the SSID and its length 635 * in @ssid, @ssid_len respectively 636 * 637 * Caller need to acquire lock with wlan_vdev_obj_lock() 638 * 639 * Return: SUCCESS, if update is done 640 * FAILURE, if ssid length is > max ssid len 641 */ 642 static inline QDF_STATUS wlan_vdev_mlme_get_ssid( 643 struct wlan_objmgr_vdev *vdev, 644 uint8_t *ssid, uint8_t *ssid_len) 645 { 646 struct vdev_mlme_obj *vdev_mlme; 647 648 /* This API is invoked with lock acquired, do not add log prints */ 649 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 650 if (!vdev_mlme) 651 return QDF_STATUS_E_FAILURE; 652 653 if (vdev_mlme->mgmt.generic.ssid_len > 0) { 654 *ssid_len = vdev_mlme->mgmt.generic.ssid_len; 655 qdf_mem_copy(ssid, vdev_mlme->mgmt.generic.ssid, *ssid_len); 656 } else { 657 *ssid_len = 0; 658 return QDF_STATUS_E_FAILURE; 659 } 660 return QDF_STATUS_SUCCESS; 661 } 662 663 /** 664 * wlan_vdev_mlme_set_nss() - set NSS 665 * @vdev: VDEV object 666 * @nss: nss configured by user 667 * 668 * API to set the Number of Spatial streams 669 * 670 * Return: void 671 */ 672 static inline void wlan_vdev_mlme_set_nss( 673 struct wlan_objmgr_vdev *vdev, 674 uint8_t nss) 675 { 676 struct vdev_mlme_obj *vdev_mlme; 677 678 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 679 if (!vdev_mlme) 680 return; 681 682 vdev_mlme->proto.generic.nss = nss; 683 } 684 685 /** 686 * wlan_vdev_mlme_get_nss() - get NSS 687 * @vdev: VDEV object 688 * 689 * API to get the Number of Spatial Streams 690 * 691 * Return: 692 * @nss: nss value 693 */ 694 static inline uint8_t wlan_vdev_mlme_get_nss( 695 struct wlan_objmgr_vdev *vdev) 696 { 697 struct vdev_mlme_obj *vdev_mlme; 698 699 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 700 if (!vdev_mlme) 701 return 0; 702 703 return vdev_mlme->proto.generic.nss; 704 } 705 706 /** 707 * wlan_vdev_mlme_set_txchainmask() - set Tx chainmask 708 * @vdev: VDEV object 709 * @chainmask : chainmask either configured by user or max supported 710 * 711 * API to set the Tx chainmask 712 * 713 * Return: void 714 */ 715 static inline void wlan_vdev_mlme_set_txchainmask( 716 struct wlan_objmgr_vdev *vdev, 717 uint8_t chainmask) 718 { 719 struct vdev_mlme_obj *vdev_mlme; 720 721 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 722 723 if (!vdev_mlme) 724 return; 725 726 vdev_mlme->mgmt.chainmask_info.tx_chainmask = chainmask; 727 } 728 729 /** 730 * wlan_vdev_mlme_get_txchainmask() - get Tx chainmask 731 * @vdev: VDEV object 732 * 733 * API to get the Tx chainmask 734 * 735 * Return: 736 * @chainmask : Tx chainmask either configured by user or max supported 737 */ 738 static inline uint8_t wlan_vdev_mlme_get_txchainmask( 739 struct wlan_objmgr_vdev *vdev) 740 { 741 struct vdev_mlme_obj *vdev_mlme; 742 743 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 744 if (!vdev_mlme) 745 return 0; 746 747 return vdev_mlme->mgmt.chainmask_info.tx_chainmask; 748 } 749 750 /** 751 * wlan_vdev_mlme_set_rxchainmask() - set Rx chainmask 752 * @vdev: VDEV object 753 * @chainmask : Rx chainmask either configured by user or max supported 754 * 755 * API to set the Rx chainmask 756 * 757 * Return: void 758 */ 759 static inline void wlan_vdev_mlme_set_rxchainmask( 760 struct wlan_objmgr_vdev *vdev, 761 uint8_t chainmask) 762 { 763 struct vdev_mlme_obj *vdev_mlme; 764 765 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 766 if (!vdev_mlme) 767 return; 768 769 vdev_mlme->mgmt.chainmask_info.rx_chainmask = chainmask; 770 } 771 772 /** 773 * wlan_vdev_mlme_get_rxchainmask() - get Rx chainmask 774 * @vdev: VDEV object 775 * 776 * API to get the Rx chainmask 777 * 778 * Return: 779 * @chainmask : Rx chainmask either configured by user or max supported 780 */ 781 static inline uint8_t wlan_vdev_mlme_get_rxchainmask( 782 struct wlan_objmgr_vdev *vdev) 783 { 784 struct vdev_mlme_obj *vdev_mlme; 785 786 /* This API is invoked with lock acquired, do not add log prints */ 787 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 788 if (!vdev_mlme) 789 return 0; 790 791 return vdev_mlme->mgmt.chainmask_info.rx_chainmask; 792 } 793 794 /** 795 * wlan_vdev_mlme_set_txpower() - set tx power 796 * @vdev: VDEV object 797 * @txpow: tx power either configured by used or max allowed 798 * 799 * API to set the tx power 800 * 801 * Return: void 802 */ 803 static inline void wlan_vdev_mlme_set_txpower( 804 struct wlan_objmgr_vdev *vdev, 805 uint8_t txpow) 806 { 807 struct vdev_mlme_obj *vdev_mlme; 808 809 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 810 if (!vdev_mlme) 811 return; 812 813 vdev_mlme->mgmt.generic.tx_power = txpow; 814 } 815 816 /** 817 * wlan_vdev_mlme_get_txpower() - get tx power 818 * @vdev: VDEV object 819 * 820 * API to get the tx power 821 * 822 * Return: 823 * @txpow: tx power either configured by used or max allowed 824 */ 825 static inline uint8_t wlan_vdev_mlme_get_txpower( 826 struct wlan_objmgr_vdev *vdev) 827 { 828 struct vdev_mlme_obj *vdev_mlme; 829 830 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 831 if (!vdev_mlme) 832 return 0; 833 834 return vdev_mlme->mgmt.generic.tx_power; 835 } 836 837 /** 838 * wlan_vdev_mlme_set_maxrate() - set max rate 839 * @vdev: VDEV object 840 * @maxrate: configured by used or based on configured mode 841 * 842 * API to set the max rate the vdev supports 843 * 844 * Return: void 845 */ 846 static inline void wlan_vdev_mlme_set_maxrate( 847 struct wlan_objmgr_vdev *vdev, 848 uint32_t maxrate) 849 { 850 struct vdev_mlme_obj *vdev_mlme; 851 852 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 853 if (!vdev_mlme) 854 return; 855 856 vdev_mlme->mgmt.rate_info.max_rate = maxrate; 857 } 858 859 /** 860 * wlan_vdev_mlme_get_maxrate() - get max rate 861 * @vdev: VDEV object 862 * 863 * API to get the max rate the vdev supports 864 * 865 * Return: 866 * @maxrate: configured by used or based on configured mode 867 */ 868 static inline uint32_t wlan_vdev_mlme_get_maxrate( 869 struct wlan_objmgr_vdev *vdev) 870 { 871 struct vdev_mlme_obj *vdev_mlme; 872 873 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 874 if (!vdev_mlme) 875 return 0; 876 877 return vdev_mlme->mgmt.rate_info.max_rate; 878 } 879 880 /** 881 * wlan_vdev_mlme_set_txmgmtrate() - set txmgmtrate 882 * @vdev: VDEV object 883 * @txmgmtrate: Tx Mgmt rate 884 * 885 * API to set Mgmt Tx rate 886 * 887 * Return: void 888 */ 889 static inline void wlan_vdev_mlme_set_txmgmtrate( 890 struct wlan_objmgr_vdev *vdev, 891 uint32_t txmgmtrate) 892 { 893 struct vdev_mlme_obj *vdev_mlme; 894 895 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 896 if (!vdev_mlme) 897 return; 898 899 vdev_mlme->mgmt.rate_info.tx_mgmt_rate = txmgmtrate; 900 } 901 902 /** 903 * wlan_vdev_mlme_get_txmgmtrate() - get txmgmtrate 904 * @vdev: VDEV object 905 * 906 * API to get Mgmt Tx rate 907 * 908 * Return: 909 * @txmgmtrate: Tx Mgmt rate 910 */ 911 static inline uint32_t wlan_vdev_mlme_get_txmgmtrate( 912 struct wlan_objmgr_vdev *vdev) 913 { 914 struct vdev_mlme_obj *vdev_mlme; 915 916 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 917 if (!vdev_mlme) 918 return 0; 919 920 return vdev_mlme->mgmt.rate_info.tx_mgmt_rate; 921 } 922 923 /** 924 * wlan_vdev_mlme_is_special_vdev() - check given vdev is a special vdev 925 * @vdev: VDEV object 926 * 927 * API to check given vdev is a special vdev. 928 * 929 * Return: true if given vdev is special vdev, else false 930 */ 931 static inline bool wlan_vdev_mlme_is_special_vdev( 932 struct wlan_objmgr_vdev *vdev) 933 { 934 struct vdev_mlme_obj *vdev_mlme; 935 936 if (!vdev) 937 return false; 938 939 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 940 if (!vdev_mlme) 941 return false; 942 943 return vdev_mlme->mgmt.generic.special_vdev_mode; 944 } 945 946 #ifdef WLAN_FEATURE_11AX 947 /** 948 * wlan_vdev_mlme_set_he_mcs_12_13_map() - set he mcs12/13 map 949 * @vdev: VDEV object 950 * @he_mcs_12_13_map: he mcs12/13 map from self&peer 951 * 952 * API to set he mcs 12/13 map 953 * 954 * Return: void 955 */ 956 static inline void wlan_vdev_mlme_set_he_mcs_12_13_map( 957 struct wlan_objmgr_vdev *vdev, 958 uint16_t he_mcs_12_13_map) 959 { 960 struct vdev_mlme_obj *vdev_mlme; 961 962 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 963 if (!vdev_mlme) 964 return; 965 966 vdev_mlme->mgmt.sta.he_mcs_12_13_map = he_mcs_12_13_map; 967 } 968 969 /** 970 * wlan_vdev_mlme_get_he_mcs_12_13_map() - get he mcs12/13 map 971 * @vdev: VDEV object 972 * 973 * API to get he mcs12/13 support capability 974 * 975 * Return: 976 * @he_mcs_12_13_map: he mcs12/13 map 977 */ 978 static inline uint16_t wlan_vdev_mlme_get_he_mcs_12_13_map( 979 struct wlan_objmgr_vdev *vdev) 980 { 981 struct vdev_mlme_obj *vdev_mlme; 982 983 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 984 if (!vdev_mlme) 985 return 0; 986 987 return vdev_mlme->mgmt.sta.he_mcs_12_13_map; 988 } 989 #else 990 static inline void wlan_vdev_mlme_set_he_mcs_12_13_map( 991 struct wlan_objmgr_vdev *vdev, 992 uint16_t he_mcs_12_13_map) 993 { 994 } 995 996 static inline uint16_t wlan_vdev_mlme_get_he_mcs_12_13_map( 997 struct wlan_objmgr_vdev *vdev) 998 { 999 return 0; 1000 } 1001 #endif 1002 #endif 1003