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