1 /* 2 * Copyright (c) 2018-2020 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 /** 164 * struct vdev_mlme_he_ops_info - vdev protocol structure holding information 165 * that is used in frames 166 * @generic: generic protocol information 167 * @ap: ap specific protocol information 168 * @sta: sta specific protocol information 169 * @vht_info: vht information 170 * @ht_info: ht capabilities information 171 * @he_ops_info: he ops information 172 * @bss_color: 11ax HE BSS Color information 173 */ 174 struct vdev_mlme_proto { 175 struct vdev_mlme_proto_generic generic; 176 struct vdev_mlme_proto_ap ap; 177 struct vdev_mlme_proto_sta sta; 178 struct vdev_mlme_vht_info vht_info; 179 struct vdev_mlme_ht_info ht_info; 180 struct vdev_mlme_he_ops_info he_ops_info; 181 struct vdev_mlme_proto_bss_color bss_color; 182 }; 183 184 /** 185 * struct vdev_mlme_mgmt_generic - generic vdev mlme mgmt cfg 186 * @rts_threshold: RTS threshold 187 * @frag_threshold: Fragmentation threshold 188 * @probe_delay: time in msec for delaying to send first probe request 189 * @repeat_probe_time: probe request transmission time 190 * @drop_unencry: drop unencrypted status 191 * @ tx_pwrlimit: Tx power limit 192 * @tx_power: Tx power 193 * @minpower: Min power 194 * @maxpower: Max power 195 * @maxregpower: max regulatory power 196 * @antennamax: max antenna 197 * @reg_class_id: reg domain class id 198 * @ampdu: ampdu limit 199 * @amsdu: amsdu limit 200 * @ssid: service set identifier 201 * @ssid_len: ssid length 202 * @type: vdev type 203 * @sub_type: vdev subtype 204 * @rx_decap_type: rx decap type 205 * @tx_encap_type: tx encap type 206 * @disable_hw_ack: disable ha ack flag 207 * @bssid: bssid 208 * @phy_mode: phy mode 209 * @special_vdev_mode: indicates special vdev mode 210 */ 211 struct vdev_mlme_mgmt_generic { 212 uint32_t rts_threshold; 213 uint32_t frag_threshold; 214 uint32_t probe_delay; 215 uint32_t repeat_probe_time; 216 uint32_t drop_unencry; 217 uint32_t tx_pwrlimit; 218 uint8_t tx_power; 219 uint8_t minpower; 220 uint8_t maxpower; 221 uint8_t maxregpower; 222 uint8_t antennamax; 223 uint8_t reg_class_id; 224 uint8_t ampdu; 225 uint8_t amsdu; 226 char ssid[WLAN_SSID_MAX_LEN + 1]; 227 uint8_t ssid_len; 228 uint8_t type; 229 uint8_t subtype; 230 uint8_t rx_decap_type; 231 uint8_t tx_encap_type; 232 bool disable_hw_ack; 233 uint8_t bssid[QDF_MAC_ADDR_SIZE]; 234 uint32_t phy_mode; 235 bool special_vdev_mode; 236 }; 237 238 /** 239 * struct vdev_mlme_mgmt_ap - ap specific vdev mlme mgmt cfg 240 * @hidden_ssid: flag to indicate whether it is hidden ssid 241 * @cac_duration_ms: cac duration in millseconds 242 */ 243 struct vdev_mlme_mgmt_ap { 244 bool hidden_ssid; 245 uint32_t cac_duration_ms; 246 }; 247 248 /** 249 * struct vdev_mlme_mgmt_sta - sta specific vdev mlme mgmt cfg 250 * @. 251 */ 252 struct vdev_mlme_mgmt_sta { 253 }; 254 255 /** 256 * struct vdev_mlme_inactivity_params - vdev mlme inactivity parameters 257 * @bmiss_first_bcnt: bmiss first time 258 * @bmiss_final_bcnt: bmiss final time 259 * @keepalive_min_idle_inactive_time_secs: min time AP consider STA to be 260 * inactive 261 * @keepalive_max_idle_inactive_time_secs: max inactive idle time for AP to send 262 * data-null 263 * @keepalive_max_unresponsive_time_secs: max time to send WMI_STA_KICKOUT 264 */ 265 struct vdev_mlme_inactivity_params { 266 uint32_t bmiss_first_bcnt; 267 uint32_t bmiss_final_bcnt; 268 uint32_t keepalive_min_idle_inactive_time_secs; 269 uint32_t keepalive_max_idle_inactive_time_secs; 270 uint32_t keepalive_max_unresponsive_time_secs; 271 }; 272 273 /** 274 * struct vdev_mlme_rate_info - vdev mlme rate information 275 * @rate_flags: dynamic bandwidth info 276 * @per_band_tx_mgmt_rate: per band Tx mgmt rate 277 * @max_rate: max bandwidth rate 278 * @tx_mgmt_rate: Tx Mgmt rate 279 * @bcn_tx_rate: beacon Tx rate 280 * @bcn_tx_rate_code: beacon Tx rate code 281 * @type: Type of ratemask configuration 282 * @lower32: Lower 32 bits in the 1st 64-bit value 283 * @higher32: Higher 32 bits in the 1st 64-bit value 284 * @lower32_2: Lower 32 bits in the 2nd 64-bit value 285 * @half_rate: Half rate 286 * @quarter_rate: quarter rate 287 */ 288 struct vdev_mlme_rate_info { 289 uint32_t rate_flags; 290 uint32_t per_band_tx_mgmt_rate; 291 uint32_t max_rate; 292 uint32_t tx_mgmt_rate; 293 uint32_t bcn_tx_rate; 294 #ifdef WLAN_BCN_RATECODE_ENABLE 295 uint32_t bcn_tx_rate_code; 296 #endif 297 uint8_t type; 298 uint32_t lower32; 299 uint32_t higher32; 300 uint32_t lower32_2; 301 bool half_rate; 302 bool quarter_rate; 303 }; 304 305 /** 306 * struct vdev_mlme_chainmask_info - vdev mlme chainmask information 307 * @tx_chainmask: Tx chainmask 308 * @rx_chainmask: Rx Chainmask 309 * @num_rx_chain: Num of bits set in Rx chain 310 * @num_tx_chain: Num of bits set in Tx chain 311 */ 312 struct vdev_mlme_chainmask_info { 313 uint8_t tx_chainmask; 314 uint8_t rx_chainmask; 315 uint8_t num_rx_chain; 316 uint8_t num_tx_chain; 317 }; 318 319 /** 320 * struct vdev_mlme_powersave_info - vdev mlme powersave information 321 * @packet_powersave: packet powersave 322 * @max_li_of_moddtim: max mod dtim 323 * @dyndtim_cnt: dynamic dtim count 324 * @listen_interval: listen interval 325 * @moddtim_cnt: mod dtim count 326 */ 327 struct vdev_mlme_powersave_info { 328 uint32_t packet_powersave; 329 uint32_t max_li_of_moddtim; 330 uint32_t dyndtim_cnt; 331 uint32_t listen_interval; 332 uint32_t moddtim_cnt; 333 }; 334 335 /** 336 * struct vdev_mlme_beacon_info - vdev mlme beacon information 337 * @beacon_buffer: buffer allocated for beacon frame 338 * @beacon_offsets: beacon IE's offsets 339 */ 340 struct vdev_mlme_beacon_info { 341 qdf_nbuf_t beacon_buffer; 342 void *beacon_offsets; 343 }; 344 345 /** 346 * struct vdev_mlme_mbss_11ax - mbss 11ax fields required for up cmd 347 * @profile_idx: profile index of the connected non-trans ap (mbssid case). 348 * 0 means invalid. 349 * @profile_num: the total profile numbers of non-trans aps (mbssid 350 * case). 351 * 0 means non-MBSS AP. 352 * @mbssid-flags: MBSS IE flags indicating vdev type 353 * @vdevid_trans: id of transmitting vdev for MBSS IE 354 * @trans_bssid: bssid of transmitted AP (MBSS IE case) 355 */ 356 struct vdev_mlme_mbss_11ax { 357 uint32_t profile_idx; 358 uint32_t profile_num; 359 uint32_t mbssid_flags; 360 uint8_t vdevid_trans; 361 uint8_t trans_bssid[QDF_MAC_ADDR_SIZE]; 362 }; 363 364 /** 365 * struct vdev_mlme_mgmt - vdev mlme mgmt related cfg 366 * @generic: generic mgmt information 367 * @ap: ap specific mgmt information 368 * @sta: sta specific mgmt information 369 * @inactivity_params: inactivity parameters 370 * @rate_info: bandwidth rate information 371 * @chainmask_info: Chainmask information 372 * @powersave_info: Power save parameters 373 * @beacon_info: beacon buffer information 374 * @mbss_11ax: MBSS 11ax information 375 */ 376 struct vdev_mlme_mgmt { 377 struct vdev_mlme_mgmt_generic generic; 378 struct vdev_mlme_mgmt_ap ap; 379 struct vdev_mlme_mgmt_sta sta; 380 struct vdev_mlme_inactivity_params inactivity_params; 381 struct vdev_mlme_rate_info rate_info; 382 struct vdev_mlme_chainmask_info chainmask_info; 383 struct vdev_mlme_powersave_info powersave_info; 384 struct vdev_mlme_beacon_info beacon_info; 385 struct vdev_mlme_mbss_11ax mbss_11ax; 386 }; 387 388 /** 389 * enum beacon_update_op - Beacon update op type 390 * @BEACON_INIT: Initialize beacon 391 * @BEACON_REINIT: Re-initialize beacon 392 * @BEACON_UPDATE: Update dynamic fields of beacon 393 * @BEACON_CSA: Enable CSA IE 394 * @BEACON_FREE: Beacon buffer free 395 */ 396 enum beacon_update_op { 397 BEACON_INIT, 398 BEACON_REINIT, 399 BEACON_UPDATE, 400 BEACON_CSA, 401 BEACON_FREE, 402 }; 403 404 /** 405 * enum vdev_cmd_type - Command type 406 * @START_REQ: Start request 407 * @RESTART_REQ: Restart request 408 * @STOP_REQ: STOP request 409 * @DELETE_REQ: DELETE request 410 */ 411 enum vdev_cmd_type { 412 START_REQ, 413 RESTART_REQ, 414 STOP_REQ, 415 DELETE_REQ, 416 }; 417 418 /** 419 * enum vdev_start_resp_type - start respone type 420 * @START_RESPONSE: Start response 421 * @RESTART_RESPONSE: Restart response 422 */ 423 enum vdev_start_resp_type { 424 START_RESPONSE = 0, 425 RESTART_RESPONSE, 426 }; 427 428 /** 429 * struct vdev_mlme_ops - VDEV MLME operation callbacks structure 430 * @mlme_vdev_validate_basic_params: callback to validate VDEV basic params 431 * @mlme_vdev_reset_proto_params: callback to Reset protocol params 432 * @mlme_vdev_start_send: callback to initiate actions of VDEV 433 * MLME start operation 434 * @mlme_vdev_restart_send: callback to initiate actions of VDEV 435 * MLME restart operation 436 * @mlme_vdev_stop_start_send: callback to block start/restart VDEV 437 * request command 438 * @mlme_vdev_start_continue: callback to initiate operations on 439 * LMAC/FW start response 440 * @mlme_vdev_up_send: callback to initiate actions of VDEV 441 * MLME up operation 442 * @mlme_vdev_notify_up_complete: callback to notify VDEV MLME on moving 443 * to UP state 444 * @mlme_vdev_notify_roam_start: callback to initiate roaming 445 * @mlme_vdev_update_beacon: callback to initiate beacon update 446 * @mlme_vdev_disconnect_peers: callback to initiate disconnection of 447 * peers 448 * @mlme_vdev_dfs_cac_timer_stop: callback to stop the DFS CAC timer 449 * @mlme_vdev_stop_send: callback to initiate actions of VDEV 450 * MLME stop operation 451 * @mlme_vdev_stop_continue: callback to initiate operations on 452 * LMAC/FW stop response 453 * @mlme_vdev_bss_peer_delete_continue: callback to initiate operations on BSS 454 * peer delete completion 455 * @mlme_vdev_down_send: callback to initiate actions of VDEV 456 * MLME down operation 457 * @mlme_vdev_notify_start_state_exit: callback to notify on vdev start 458 * start state exit 459 * @mlme_vdev_is_newchan_no_cac: callback to check CAC is required 460 * @mlme_vdev_ext_peer_delete_all_rsp: callback to initiate actions for 461 * vdev mlme peer delete all response 462 */ 463 struct vdev_mlme_ops { 464 QDF_STATUS (*mlme_vdev_validate_basic_params)( 465 struct vdev_mlme_obj *vdev_mlme, 466 uint16_t event_data_len, void *event_data); 467 QDF_STATUS (*mlme_vdev_reset_proto_params)( 468 struct vdev_mlme_obj *vdev_mlme, 469 uint16_t event_data_len, void *event_data); 470 QDF_STATUS (*mlme_vdev_start_send)( 471 struct vdev_mlme_obj *vdev_mlme, 472 uint16_t event_data_len, void *event_data); 473 QDF_STATUS (*mlme_vdev_restart_send)( 474 struct vdev_mlme_obj *vdev_mlme, 475 uint16_t event_data_len, void *event_data); 476 QDF_STATUS (*mlme_vdev_stop_start_send)( 477 struct vdev_mlme_obj *vdev_mlme, 478 enum vdev_cmd_type type, 479 uint16_t event_data_len, void *event_data); 480 QDF_STATUS (*mlme_vdev_start_continue)( 481 struct vdev_mlme_obj *vdev_mlme, 482 uint16_t event_data_len, void *event_data); 483 QDF_STATUS (*mlme_vdev_sta_conn_start)( 484 struct vdev_mlme_obj *vdev_mlme, 485 uint16_t event_data_len, void *event_data); 486 QDF_STATUS (*mlme_vdev_start_req_failed)( 487 struct vdev_mlme_obj *vdev_mlme, 488 uint16_t event_data_len, void *event_data); 489 QDF_STATUS (*mlme_vdev_up_send)( 490 struct vdev_mlme_obj *vdev_mlme, 491 uint16_t event_data_len, void *event_data); 492 QDF_STATUS (*mlme_vdev_notify_up_complete)( 493 struct vdev_mlme_obj *vdev_mlme, 494 uint16_t event_data_len, void *event_data); 495 QDF_STATUS (*mlme_vdev_notify_roam_start)( 496 struct vdev_mlme_obj *vdev_mlme, 497 uint16_t event_data_len, void *event_data); 498 QDF_STATUS (*mlme_vdev_update_beacon)( 499 struct vdev_mlme_obj *vdev_mlme, 500 enum beacon_update_op op, 501 uint16_t event_data_len, void *event_data); 502 QDF_STATUS (*mlme_vdev_disconnect_peers)( 503 struct vdev_mlme_obj *vdev_mlme, 504 uint16_t event_data_len, void *event_data); 505 QDF_STATUS (*mlme_vdev_dfs_cac_timer_stop)( 506 struct vdev_mlme_obj *vdev_mlme, 507 uint16_t event_data_len, void *event_data); 508 QDF_STATUS (*mlme_vdev_stop_send)( 509 struct vdev_mlme_obj *vdev_mlme, 510 uint16_t event_data_len, void *event_data); 511 QDF_STATUS (*mlme_vdev_stop_continue)( 512 struct vdev_mlme_obj *vdev_mlme, 513 uint16_t event_data_len, void *event_data); 514 QDF_STATUS (*mlme_vdev_down_send)( 515 struct vdev_mlme_obj *vdev_mlme, 516 uint16_t event_data_len, void *event_data); 517 QDF_STATUS (*mlme_vdev_notify_down_complete)( 518 struct vdev_mlme_obj *vdev_mlme, 519 uint16_t event_data_len, void *event_data); 520 QDF_STATUS (*mlme_vdev_ext_stop_rsp)( 521 struct vdev_mlme_obj *vdev_mlme, 522 struct vdev_stop_response *rsp); 523 QDF_STATUS (*mlme_vdev_ext_start_rsp)( 524 struct vdev_mlme_obj *vdev_mlme, 525 struct vdev_start_response *rsp); 526 QDF_STATUS (*mlme_vdev_notify_start_state_exit)( 527 struct vdev_mlme_obj *vdev_mlme); 528 QDF_STATUS (*mlme_vdev_is_newchan_no_cac)( 529 struct vdev_mlme_obj *vdev_mlme); 530 QDF_STATUS (*mlme_vdev_ext_peer_delete_all_rsp)( 531 struct vdev_mlme_obj *vdev_mlme, 532 struct peer_delete_all_response *rsp); 533 }; 534 535 /** 536 * struct vdev_mlme_obj - VDEV MLME component object 537 * @proto: VDEV MLME proto substructure 538 * @mgmt: VDEV MLME mgmt substructure 539 * @sm_lock: VDEV SM lock 540 * @vdev_cmd_lock: VDEV MLME command atomicity 541 * @sm_hdl: VDEV SM handle 542 * @cnx_mgr_ctx: connection manager context, valid for STA and P2P-CLI mode only 543 * @vdev: Pointer to vdev objmgr 544 * @ops: VDEV MLME callback table 545 * @ext_vdev_ptr: VDEV MLME legacy pointer 546 * @vdev_rt: VDEV response timer 547 * @vdev_wakelock: vdev wakelock sub structure 548 */ 549 struct vdev_mlme_obj { 550 struct vdev_mlme_proto proto; 551 struct vdev_mlme_mgmt mgmt; 552 #ifdef VDEV_SM_LOCK_SUPPORT 553 qdf_spinlock_t sm_lock; 554 qdf_mutex_t vdev_cmd_lock; 555 #endif 556 struct wlan_sm *sm_hdl; 557 union { 558 struct cnx_mgr *cnx_mgr_ctx; 559 }; 560 struct wlan_objmgr_vdev *vdev; 561 struct vdev_mlme_ops *ops; 562 mlme_vdev_ext_t *ext_vdev_ptr; 563 }; 564 565 /** 566 * wlan_vdev_mlme_set_ssid() - set ssid 567 * @vdev: VDEV object 568 * @ssid: SSID (input) 569 * @ssid_len: Length of SSID 570 * 571 * API to set the SSID of VDEV 572 * 573 * Caller need to acquire lock with wlan_vdev_obj_lock() 574 * 575 * Return: SUCCESS, if update is done 576 * FAILURE, if ssid length is > max ssid len 577 */ 578 static inline QDF_STATUS wlan_vdev_mlme_set_ssid( 579 struct wlan_objmgr_vdev *vdev, 580 const uint8_t *ssid, uint8_t ssid_len) 581 { 582 struct vdev_mlme_obj *vdev_mlme; 583 584 /* This API is invoked with lock acquired, do not add log prints */ 585 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 586 if (!vdev_mlme) 587 return QDF_STATUS_E_FAILURE; 588 589 if (ssid_len <= WLAN_SSID_MAX_LEN) { 590 qdf_mem_copy(vdev_mlme->mgmt.generic.ssid, ssid, ssid_len); 591 vdev_mlme->mgmt.generic.ssid_len = ssid_len; 592 } else { 593 vdev_mlme->mgmt.generic.ssid_len = 0; 594 return QDF_STATUS_E_FAILURE; 595 } 596 return QDF_STATUS_SUCCESS; 597 } 598 599 /** 600 * wlan_vdev_mlme_get_ssid() - get ssid 601 * @vdev: VDEV object 602 * @ssid: SSID 603 * @ssid_len: Length of SSID 604 * 605 * API to get the SSID of VDEV, it updates the SSID and its length 606 * in @ssid, @ssid_len respectively 607 * 608 * Caller need to acquire lock with wlan_vdev_obj_lock() 609 * 610 * Return: SUCCESS, if update is done 611 * FAILURE, if ssid length is > max ssid len 612 */ 613 static inline QDF_STATUS wlan_vdev_mlme_get_ssid( 614 struct wlan_objmgr_vdev *vdev, 615 uint8_t *ssid, uint8_t *ssid_len) 616 { 617 struct vdev_mlme_obj *vdev_mlme; 618 619 /* This API is invoked with lock acquired, do not add log prints */ 620 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 621 if (!vdev_mlme) 622 return QDF_STATUS_E_FAILURE; 623 624 if (vdev_mlme->mgmt.generic.ssid_len > 0) { 625 *ssid_len = vdev_mlme->mgmt.generic.ssid_len; 626 qdf_mem_copy(ssid, vdev_mlme->mgmt.generic.ssid, *ssid_len); 627 } else { 628 *ssid_len = 0; 629 return QDF_STATUS_E_FAILURE; 630 } 631 return QDF_STATUS_SUCCESS; 632 } 633 634 /** 635 * wlan_vdev_mlme_set_nss() - set NSS 636 * @vdev: VDEV object 637 * @nss: nss configured by user 638 * 639 * API to set the Number of Spatial streams 640 * 641 * Return: void 642 */ 643 static inline void wlan_vdev_mlme_set_nss( 644 struct wlan_objmgr_vdev *vdev, 645 uint8_t nss) 646 { 647 struct vdev_mlme_obj *vdev_mlme; 648 649 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 650 if (!vdev_mlme) 651 return; 652 653 vdev_mlme->proto.generic.nss = nss; 654 } 655 656 /** 657 * wlan_vdev_mlme_get_nss() - get NSS 658 * @vdev: VDEV object 659 * 660 * API to get the Number of Spatial Streams 661 * 662 * Return: 663 * @nss: nss value 664 */ 665 static inline uint8_t wlan_vdev_mlme_get_nss( 666 struct wlan_objmgr_vdev *vdev) 667 { 668 struct vdev_mlme_obj *vdev_mlme; 669 670 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 671 if (!vdev_mlme) 672 return 0; 673 674 return vdev_mlme->proto.generic.nss; 675 } 676 677 /** 678 * wlan_vdev_mlme_set_txchainmask() - set Tx chainmask 679 * @vdev: VDEV object 680 * @chainmask : chainmask either configured by user or max supported 681 * 682 * API to set the Tx chainmask 683 * 684 * Return: void 685 */ 686 static inline void wlan_vdev_mlme_set_txchainmask( 687 struct wlan_objmgr_vdev *vdev, 688 uint8_t chainmask) 689 { 690 struct vdev_mlme_obj *vdev_mlme; 691 692 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 693 694 if (!vdev_mlme) 695 return; 696 697 vdev_mlme->mgmt.chainmask_info.tx_chainmask = chainmask; 698 } 699 700 /** 701 * wlan_vdev_mlme_get_txchainmask() - get Tx chainmask 702 * @vdev: VDEV object 703 * 704 * API to get the Tx chainmask 705 * 706 * Return: 707 * @chainmask : Tx chainmask either configured by user or max supported 708 */ 709 static inline uint8_t wlan_vdev_mlme_get_txchainmask( 710 struct wlan_objmgr_vdev *vdev) 711 { 712 struct vdev_mlme_obj *vdev_mlme; 713 714 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 715 if (!vdev_mlme) 716 return 0; 717 718 return vdev_mlme->mgmt.chainmask_info.tx_chainmask; 719 } 720 721 /** 722 * wlan_vdev_mlme_set_rxchainmask() - set Rx chainmask 723 * @vdev: VDEV object 724 * @chainmask : Rx chainmask either configured by user or max supported 725 * 726 * API to set the Rx chainmask 727 * 728 * Return: void 729 */ 730 static inline void wlan_vdev_mlme_set_rxchainmask( 731 struct wlan_objmgr_vdev *vdev, 732 uint8_t chainmask) 733 { 734 struct vdev_mlme_obj *vdev_mlme; 735 736 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 737 if (!vdev_mlme) 738 return; 739 740 vdev_mlme->mgmt.chainmask_info.rx_chainmask = chainmask; 741 } 742 743 /** 744 * wlan_vdev_mlme_get_rxchainmask() - get Rx chainmask 745 * @vdev: VDEV object 746 * 747 * API to get the Rx chainmask 748 * 749 * Return: 750 * @chainmask : Rx chainmask either configured by user or max supported 751 */ 752 static inline uint8_t wlan_vdev_mlme_get_rxchainmask( 753 struct wlan_objmgr_vdev *vdev) 754 { 755 struct vdev_mlme_obj *vdev_mlme; 756 757 /* This API is invoked with lock acquired, do not add log prints */ 758 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 759 if (!vdev_mlme) 760 return 0; 761 762 return vdev_mlme->mgmt.chainmask_info.rx_chainmask; 763 } 764 765 /** 766 * wlan_vdev_mlme_set_txpower() - set tx power 767 * @vdev: VDEV object 768 * @txpow: tx power either configured by used or max allowed 769 * 770 * API to set the tx power 771 * 772 * Return: void 773 */ 774 static inline void wlan_vdev_mlme_set_txpower( 775 struct wlan_objmgr_vdev *vdev, 776 uint8_t txpow) 777 { 778 struct vdev_mlme_obj *vdev_mlme; 779 780 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 781 if (!vdev_mlme) 782 return; 783 784 vdev_mlme->mgmt.generic.tx_power = txpow; 785 } 786 787 /** 788 * wlan_vdev_mlme_get_txpower() - get tx power 789 * @vdev: VDEV object 790 * 791 * API to get the tx power 792 * 793 * Return: 794 * @txpow: tx power either configured by used or max allowed 795 */ 796 static inline uint8_t wlan_vdev_mlme_get_txpower( 797 struct wlan_objmgr_vdev *vdev) 798 { 799 struct vdev_mlme_obj *vdev_mlme; 800 801 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 802 if (!vdev_mlme) 803 return 0; 804 805 return vdev_mlme->mgmt.generic.tx_power; 806 } 807 808 /** 809 * wlan_vdev_mlme_set_maxrate() - set max rate 810 * @vdev: VDEV object 811 * @maxrate: configured by used or based on configured mode 812 * 813 * API to set the max rate the vdev supports 814 * 815 * Return: void 816 */ 817 static inline void wlan_vdev_mlme_set_maxrate( 818 struct wlan_objmgr_vdev *vdev, 819 uint32_t maxrate) 820 { 821 struct vdev_mlme_obj *vdev_mlme; 822 823 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 824 if (!vdev_mlme) 825 return; 826 827 vdev_mlme->mgmt.rate_info.max_rate = maxrate; 828 } 829 830 /** 831 * wlan_vdev_mlme_get_maxrate() - get max rate 832 * @vdev: VDEV object 833 * 834 * API to get the max rate the vdev supports 835 * 836 * Return: 837 * @maxrate: configured by used or based on configured mode 838 */ 839 static inline uint32_t wlan_vdev_mlme_get_maxrate( 840 struct wlan_objmgr_vdev *vdev) 841 { 842 struct vdev_mlme_obj *vdev_mlme; 843 844 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 845 if (!vdev_mlme) 846 return 0; 847 848 return vdev_mlme->mgmt.rate_info.max_rate; 849 } 850 851 /** 852 * wlan_vdev_mlme_set_txmgmtrate() - set txmgmtrate 853 * @vdev: VDEV object 854 * @txmgmtrate: Tx Mgmt rate 855 * 856 * API to set Mgmt Tx rate 857 * 858 * Return: void 859 */ 860 static inline void wlan_vdev_mlme_set_txmgmtrate( 861 struct wlan_objmgr_vdev *vdev, 862 uint32_t txmgmtrate) 863 { 864 struct vdev_mlme_obj *vdev_mlme; 865 866 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 867 if (!vdev_mlme) 868 return; 869 870 vdev_mlme->mgmt.rate_info.tx_mgmt_rate = txmgmtrate; 871 } 872 873 /** 874 * wlan_vdev_mlme_get_txmgmtrate() - get txmgmtrate 875 * @vdev: VDEV object 876 * 877 * API to get Mgmt Tx rate 878 * 879 * Return: 880 * @txmgmtrate: Tx Mgmt rate 881 */ 882 static inline uint32_t wlan_vdev_mlme_get_txmgmtrate( 883 struct wlan_objmgr_vdev *vdev) 884 { 885 struct vdev_mlme_obj *vdev_mlme; 886 887 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 888 if (!vdev_mlme) 889 return 0; 890 891 return vdev_mlme->mgmt.rate_info.tx_mgmt_rate; 892 } 893 894 /** 895 * wlan_vdev_mlme_is_special_vdev() - check given vdev is a special vdev 896 * @vdev: VDEV object 897 * 898 * API to check given vdev is a special vdev. 899 * 900 * Return: true if given vdev is special vdev, else false 901 */ 902 static inline bool wlan_vdev_mlme_is_special_vdev( 903 struct wlan_objmgr_vdev *vdev) 904 { 905 struct vdev_mlme_obj *vdev_mlme; 906 907 if (!vdev) 908 return false; 909 910 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 911 if (!vdev_mlme) 912 return false; 913 914 return vdev_mlme->mgmt.generic.special_vdev_mode; 915 } 916 #endif 917