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