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