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