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