xref: /wlan-driver/qca-wifi-host-cmn/umac/cmn_services/obj_mgr/inc/wlan_objmgr_vdev_obj.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: Define the vdev data structure of UMAC
22  */
23 
24 #ifndef _WLAN_OBJMGR_VDEV_OBJ_H_
25 #define _WLAN_OBJMGR_VDEV_OBJ_H_
26 
27 #include "qdf_atomic.h"
28 #include "qdf_list.h"
29 #include "qdf_lock.h"
30 #include "qdf_types.h"
31 #include "wlan_cmn.h"
32 #include "wlan_objmgr_cmn.h"
33 #include "wlan_objmgr_pdev_obj.h"
34 #include "wlan_objmgr_psoc_obj.h"
35 #include "wlan_vdev_mlme_main.h"
36 #include "include/wlan_vdev_mlme.h"
37 #include "wlan_vdev_mlme_api.h"
38 #include "wlan_mlme_dbg.h"
39 #ifdef WLAN_FEATURE_11BE_MLO
40 #include "wlan_mlo_mgr_public_structs.h"
41 #endif
42 
43 	/* CONF: privacy enabled */
44 #define WLAN_VDEV_F_PRIVACY              0x00000001
45 	/* CONF: 11g w/o 11b sta's */
46 #define WLAN_VDEV_F_PUREG                0x00000002
47 	/* CONF: des_bssid is set */
48 #define WLAN_VDEV_F_DESBSSID             0x00000004
49 	/* CONF: bg scan enabled */
50 #define WLAN_VDEV_F_BGSCAN               0x00000008
51 	/* CONF: sw tx retry enabled */
52 #define WLAN_VDEV_F_SWRETRY              0x00000010
53 	/* STATUS: update beacon tim */
54 #define WLAN_VDEV_F_TIMUPDATE            0x00000020
55 	/* CONF: WPA enabled */
56 #define WLAN_VDEV_F_WPA1                 0x00000040
57 	/* CONF: WPA2 enabled */
58 #define WLAN_VDEV_F_WPA2                 0x00000080
59 	/* CONF: WPA/WPA2 enabled */
60 #define WLAN_VDEV_F_WPA                  0x000000c0
61 	/* CONF: drop unencrypted */
62 #define WLAN_VDEV_F_DROPUNENC            0x00000100
63 	/* CONF: TKIP countermeasures */
64 #define WLAN_VDEV_F_COUNTERM             0x00000200
65 	/* CONF: hide SSID in beacon */  /*TODO PDEV/PSOC */
66 #define WLAN_VDEV_F_HIDESSID             0x00000400
67 	/* CONF: disable internal bridge */ /*TODO PDEV/PSOC */
68 #define WLAN_VDEV_F_NOBRIDGE             0x00000800
69 	/* STATUS: update beacon wme */
70 #define WLAN_VDEV_F_WMEUPDATE            0x00001000
71 	/* CONF: enable U-APSD */
72 #define WLAN_VDEV_F_UAPSD                0x00004000
73 	/* STATUS: sleeping */
74 #define WLAN_VDEV_F_SLEEP                0x00008000
75 	/* drop uapsd EOSP frames for test */
76 #define WLAN_VDEV_F_EOSPDROP             0x00010000
77 	/* CONF: A-MPDU supported */
78 #define WLAN_VDEV_F_AMPDU                0x00020000
79 	/* STATE: beacon APP IE updated */
80 #define WLAN_VDEV_F_APPIE_UPDATE         0x00040000
81 	/* CONF: WDS auto Detect/DELBA */
82 #define WLAN_VDEV_F_WDS_AUTODETECT       0x00080000
83 	/* 11b only without 11g stations */
84 #define WLAN_VDEV_F_PUREB                0x00100000
85 	/* disable HT rates */
86 #define WLAN_VDEV_F_HTRATES              0x00200000
87 	/* CONF: deliver rx frames with 802.11 header */
88 #define WLAN_VDEV_F_DELIVER_80211        0x00800000
89 	/* CONF: os sends down tx frames with 802.11 header */
90 #define WLAN_VDEV_F_SEND_80211           0x01000000
91 	/* CONF: statically configured WDS */
92 #define WLAN_VDEV_F_WDS_STATIC           0x02000000
93 	/* CONF: pure 11n mode */
94 #define WLAN_VDEV_F_PURE11N              0x04000000
95 	/* CONF: pure 11ac mode */
96 #define WLAN_VDEV_F_PURE11AC             0x08000000
97 	/* Basic Rates Update */
98 #define WLAN_VDEV_F_BR_UPDATE            0x10000000
99 	/* CONF: restrict bw ont top of per 11ac/n */
100 #define WLAN_VDEV_F_STRICT_BW            0x20000000
101 	/* Wi-Fi SON mode (with APS) */
102 #define WLAN_VDEV_F_SON                  0x40000000
103 	/* Wi-Fi SON mode (with APS) */
104 #define WLAN_VDEV_F_MBO                  0x80000000
105 
106 /* Feature extension flags */
107 		/* CONF: MSFT safe mode         */
108 #define WLAN_VDEV_FEXT_SAFEMODE             0x00000001
109 		/* if the vap can sleep*/
110 #define WLAN_VDEV_FEXT_CANSLEEP             0x00000002
111 		/* use sw bmiss timer */
112 #define WLAN_VDEV_FEXT_SWBMISS              0x00000004
113 		/* enable beacon copy */
114 #define WLAN_VDEV_FEXT_COPY_BEACON          0x00000008
115 #define WLAN_VDEV_FEXT_WAPI                 0x00000010
116 		/* 802.11h enabled */
117 #define WLAN_VDEV_FEXT_DOTH                 0x00000020
118 	/* if the vap has wds independence set */
119 #define WLAN_VDEV_FEXT_VAPIND               0x00000040
120 	/* QBSS load IE enabled */
121 #define WLAN_VDEV_FEXT_BSSLOAD              0x00000080
122 	/* Short Guard Interval Enable:1 Disable:0 */
123 #define WLAN_VDEV_FEXT_SGI                  0x00000100
124 	/* Short Guard Interval Enable:1 Disable:0 for VHT fixed rates */
125 #define WLAN_VDEV_FEXT_DATASGI              0x00000200
126 	/* LDPC Enable Rx:1 TX: 2 ; Disable:0 */
127 #define WLAN_VDEV_FEXT_LDPC_TX              0x00000400
128 #define WLAN_VDEV_FEXT_LDPC_RX              0x00000800
129 #define WLAN_VDEV_FEXT_LDPC                 0x00000c00
130 	/* wme enabled */
131 #define WLAN_VDEV_FEXT_WME                  0x00001000
132 	/* WNM Capabilities */
133 #define WLAN_VDEV_FEXT_WNM                  0x00002000
134 	/* RRM Capabilities */
135 #define WLAN_VDEV_FEXT_RRM                  0x00004000
136 	/* WNM Proxy ARP Capabilities */
137 #define WLAN_VDEV_FEXT_PROXYARP             0x00008000
138 	/* 256 QAM support in 2.4GHz mode Enable:1 Disable:0 */
139 #define WLAN_VDEV_FEXT_256QAM               0x00010000
140 	/* 2.4NG 256 QAM Interop mode Enable:1 Disable:0 */
141 #define WLAN_VDEV_FEXT_256QAM_INTEROP       0x00020000
142 	/* static mimo ps enabled */
143 #define WLAN_VDEV_FEXT_STATIC_MIMOPS        0x00040000
144 	/* dynamic mimo ps enabled */
145 #define WLAN_VDEV_FEXT_DYN_MIMOPS           0x00080000
146 	/* Country IE enabled */
147 #define WLAN_VDEV_FEXT_CNTRY_IE             0x00100000
148 	/*does not want to trigger multi channel operation
149 	instead follow master vaps channel (for AP/GO Vaps) */
150 #define WLAN_VDEV_FEXT_NO_MULCHAN           0x00200000
151 	/*non-beaconing AP VAP*/
152 #define WLAN_VDEV_FEXT_NON_BEACON           0x00400000
153 	/* SPL repeater enabled for SON*/
154 #define WLAN_VDEV_FEXT_SON_SPL_RPT          0x00800000
155 	/* SON IE update in MGMT frame */
156 #define WLAN_VDEV_FEXT_SON_INFO_UPDATE      0x01000000
157 	/* CONF: A-MSDU supported */
158 #define WLAN_VDEV_FEXT_AMSDU                0x02000000
159 	/* Fils discovery on 6G SAP*/
160 #define WLAN_VDEV_FEXT_FILS_DISC_6G_SAP     0x80000000
161 
162 /* Feature more extension flags */
163 	/* VDEV is MLO*/
164 #define WLAN_VDEV_FEXT2_MLO                 0x00000001
165 	/* STA VDEV is link type */
166 #define WLAN_VDEV_FEXT2_MLO_STA_LINK        0x00000002
167 	/* VDEV is MLO mcast primary*/
168 #define WLAN_VDEV_FEXT2_MLO_MCAST           0x00000004
169 	/* 20TU BCAST PROBE RESP on 6G SAP*/
170 #define WLAN_VDEV_FEXT2_20TU_PRB_RESP       0x00000008
171 	/* STA VDEV is TDLS link type */
172 #define WLAN_VDEV_FEXT2_MLO_STA_TDLS        0x00000010
173 
174 /* VDEV OP flags  */
175   /* if the vap destroyed by user */
176 #define WLAN_VDEV_OP_DELETE_PROGRESS        0x00000001
177  /* set to enable sta-fws fweature */
178 #define WLAN_VDEV_OP_STAFWD                 0x00000002
179    /* Off-channel support enabled */
180 #define WLAN_VDEV_OP_OFFCHAN                0x00000004
181   /* if the vap has erp update set */
182 #define WLAN_VDEV_OP_ERPUPDATE              0x00000008
183   /* this vap needs scheduler for off channel operation */
184 #define WLAN_VDEV_OP_NEEDS_SCHED            0x00000010
185   /*STA in forced sleep set PS bit for all outgoing frames */
186 #define WLAN_VDEV_OP_FORCED_SLEEP           0x00000020
187   /* update bssload IE in beacon */
188 #define WLAN_VDEV_OP_BSSLOAD_UPDATE         0x00000040
189   /* Hotspot 2.0 DGAF Disable bit */
190 #define WLAN_VDEV_OP_DGAF_DISABLE           0x00000080
191   /* STA SmartNet enabled */
192 #define WLAN_VDEV_OP_SMARTNET_EN            0x00000100
193   /* SoftAP to reject resuming in DFS channels */
194 #define WLAN_VDEV_OP_REJ_DFS_CHAN           0x00000200
195   /* Trigger mlme response */
196 #define WLAN_VDEV_OP_TRIGGER_MLME_RESP      0x00000400
197   /* test flag for MFP */
198 #define WLAN_VDEV_OP_MFP_TEST               0x00000800
199   /* flag to indicate using default ratemask */
200 #define WLAN_VDEV_OP_DEF_RATEMASK           0x00001000
201 /*For wakeup AP VAP when wds-sta connect to the AP only use when
202 	export (UMAC_REPEATER_DELAYED_BRINGUP || DBDC_REPEATER_SUPPORT)=1*/
203 #define WLAN_VDEV_OP_KEYFLAG                0x00002000
204   /* if performed the iwlist scanning */
205 #define WLAN_VDEV_OP_LIST_SCANNING          0x00004000
206    /*Set when VAP down*/
207 #define WLAN_VDEV_OP_IS_DOWN                0x00008000
208   /* if vap may require acs when another vap is brought down */
209 #define WLAN_VDEV_OP_NEEDS_UP_ACS           0x00010000
210   /* Block data traffic tx for this vap */
211 #define WLAN_VDEV_OP_BLOCK_TX_TRAFFIC       0x00020000
212   /* for mbo functionality */
213 #define WLAN_VDEV_OP_MBO                    0x00040000
214 /* VDEV Critical update category-1
215  * Inclusion of Critical Update IES flag
216  * This includes: CSA, ECSA, Quiet
217  * Quiet channel, Max Ch Switch Time IEs.
218  */
219 #define WLAN_VDEV_OP_CU_CAT1                0x00080000
220 /* VDEV Critical update category-2
221  * Modification of Critical Update IES flag
222  * This includes: DSSS Param, HT Operation element
223  * VHT Operation element, HE Operation element
224  * EHT Operation element, MU EDCA Param, EDCA param
225  * UORA Param, BSS Color Change Announcement element
226  * Spatial Reuse Param Set element
227  * Operating Mode Notification element
228  * Wide Bandwidth Channel Switch element
229  * Broadcast TWT element
230  */
231 #define WLAN_VDEV_OP_CU_CAT2                0x00100000
232   /* for mlo reconfig link removal functionality */
233 #define WLAN_VDEV_OP_MLO_STOP_LINK_DEL      0x00200000
234   /* for mlo reconfig link add functionality */
235 #define WLAN_VDEV_OP_MLO_LINK_ADD           0x00400000
236   /* for mlo reconfig link removal TBTT complete */
237 #define WLAN_VDEV_OP_MLO_LINK_TBTT_COMPLETE 0x00800000
238 
239 /* MLO link removal is in progress on this VDEV */
240 #define WLAN_VDEV_OP_MLO_LINK_REMOVAL_IN_PROGRESS 0x01000000
241 /* MLO link switch is in progress on this VDEV */
242 #define WLAN_VDEV_OP_MLO_LINK_SWITCH_IN_PROGRESS 0x02000000
243 
244  /* flag to indicate disconnect only legacy peers due to moving to DFS channel
245   * from non-DFS channel
246   */
247 #define WLAN_VDEV_OP_MLME_LEGACY_PEER_DISCON_TRIG 0x02000000
248   /* for mlo reconfig link removal functionality */
249 #define WLAN_VDEV_OP_MLO_REMOVE_LINK_VDEV      0x04000000
250 
251  /* CAPABILITY: IBSS available */
252 #define WLAN_VDEV_C_IBSS                    0x00000001
253 /* CAPABILITY: HOSTAP avail */
254 #define WLAN_VDEV_C_HOSTAP               0x00000002
255    /* CAPABILITY: Old Adhoc Demo */
256 #define WLAN_VDEV_C_AHDEMO               0x00000004
257   /* CAPABILITY: sw tx retry */
258 #define WLAN_VDEV_C_SWRETRY              0x00000008
259   /* CAPABILITY: monitor mode */
260 #define WLAN_VDEV_C_MONITOR              0x00000010
261   /* CAPABILITY: TKIP MIC avail */
262 #define WLAN_VDEV_C_TKIPMIC              0x00000020
263   /* CAPABILITY: 4-addr support */
264 #define WLAN_VDEV_C_WDS                  0x00000040
265   /* CAPABILITY: TKIP MIC for QoS frame */
266 #define WLAN_VDEV_C_WME_TKIPMIC          0x00000080
267   /* CAPABILITY: bg scanning */
268 #define WLAN_VDEV_C_BGSCAN               0x00000100
269   /* CAPABILITY: Restrict offchannel */
270 #define WLAN_VDEV_C_RESTRICT_OFFCHAN     0x00000200
271   /* CAPABILITY: eMLSR capability */
272 #define WLAN_VDEV_C_EMLSR_CAP            0x00000400
273   /* CAPABILITY: Exclude per sta profile in unicast Probe req */
274 #define WLAN_VDEV_C_EXCL_STA_PROF_PRB_REQ   0x00000800
275 
276 /* Invalid VDEV identifier */
277 #define WLAN_INVALID_VDEV_ID 255
278 
279 /* Invalid VDEV link id*/
280 #define WLAN_INVALID_LINK_ID 255
281 
282 /**
283  * struct wlan_vdev_create_params - Create params, HDD/OSIF passes this
284  *				    structure While creating VDEV
285  * @opmode:         Opmode of VDEV
286  * @flags:          create flags
287  * @size_vdev_priv: Size of vdev private
288  * @legacy_osif:    Legacy os_if private member
289  * @macaddr:        MAC address
290  * @mataddr:        MAT address
291  * @mldaddr:        MLD address
292  */
293 struct wlan_vdev_create_params {
294 	enum QDF_OPMODE opmode;
295 	uint32_t flags;
296 	size_t size_vdev_priv;
297 	void *legacy_osif;
298 	uint8_t macaddr[QDF_MAC_ADDR_SIZE];
299 	uint8_t mataddr[QDF_MAC_ADDR_SIZE];
300 	uint8_t mldaddr[QDF_MAC_ADDR_SIZE];
301 };
302 
303 /**
304  * struct wlan_channel - channel structure
305  * @ch_freq:      Channel in Mhz.
306  * @ch_ieee:      IEEE channel number.
307  * @ch_freq_seg1: Channel Center frequency for VHT80/160 and HE80/160.
308  * @ch_freq_seg2: Second channel Center frequency applicable for 80+80MHz mode.
309  * @ch_maxpower:  Maximum tx power in dBm.
310  * @ch_flagext:   Channel extension flags.
311  * @ch_flags:     Channel flags.
312  * @ch_cfreq1:    channel center frequency for primary
313  * @ch_cfreq2:    channel center frequency for secondary
314  * @ch_width:     Channel width.
315  * @ch_phymode:   Channel phymode.
316  * @puncture_bitmap:   Puncture bitmap per 20MHz.
317  */
318 struct wlan_channel {
319 	uint16_t     ch_freq;
320 	uint8_t      ch_ieee;
321 	uint8_t      ch_freq_seg1;
322 	uint8_t      ch_freq_seg2;
323 	int8_t       ch_maxpower;
324 	uint16_t     ch_flagext;
325 	uint64_t     ch_flags;
326 	uint32_t     ch_cfreq1;
327 	uint32_t     ch_cfreq2;
328 	enum phy_ch_width ch_width;
329 	enum wlan_phymode ch_phymode;
330 #ifdef WLAN_FEATURE_11BE
331 	uint16_t     puncture_bitmap;
332 #endif
333 };
334 
335 /**
336  * struct wlan_objmgr_vdev_mlme - VDEV MLME specific sub structure
337  * @vdev_opmode:        Opmode of VDEV
338  * @mlme_state:         VDEV MLME SM state
339  * @mlme_substate:      VDEV MLME SM substate
340  * @bss_chan:           BSS channel
341  * @des_chan:           Desired channel, for STA Desired may not be used
342  * @vdev_caps:          VDEV capabilities
343  * @vdev_feat_caps:     VDEV feature caps
344  * @vdev_feat_ext_caps: VDEV Extended feature caps
345  * @vdev_feat_ext2_caps: More VDEV Extended feature caps
346  * @vdev_op_flags:      Operation flags
347  * @mataddr:            MAT address
348  * @macaddr:            Contains link MAC address for ML connection and
349  *                      net dev address for non-ML connection
350  * @mldaddr:            MLD address
351  * @linkaddr:           Link MAC address
352  * @epcs_enable:        EPCS enable flag
353  * @mlo_link_id: link id for mlo connection
354  * @mlo_external_sae_auth: MLO external SAE auth
355  * @user_disable_eht: user disable eht for IOT issues
356  * @wlan_vdev_mlo_lock: lock to protect the set/clear of
357  * @skip_pumac_cnt: Counter to skip vdev to be selected as pumac
358  * WLAN_VDEV_FEXT2_MLO feature flag in vdev MLME
359  */
360 struct wlan_objmgr_vdev_mlme {
361 	enum QDF_OPMODE vdev_opmode;
362 	enum wlan_vdev_state mlme_state;
363 	enum wlan_vdev_state mlme_substate;
364 	struct wlan_channel *bss_chan;
365 	struct wlan_channel *des_chan;
366 	uint32_t vdev_caps;
367 	uint32_t vdev_feat_caps;
368 	uint32_t vdev_feat_ext_caps;
369 	uint32_t vdev_feat_ext2_caps;
370 	uint32_t vdev_op_flags;
371 	uint8_t  mataddr[QDF_MAC_ADDR_SIZE];
372 	uint8_t  macaddr[QDF_MAC_ADDR_SIZE];
373 	uint8_t  mldaddr[QDF_MAC_ADDR_SIZE];
374 	uint8_t  linkaddr[QDF_MAC_ADDR_SIZE];
375 #ifdef WLAN_FEATURE_11BE_MLO
376 	bool epcs_enable;
377 	uint8_t  mlo_link_id;
378 	bool mlo_external_sae_auth;
379 	bool user_disable_eht;
380 #ifdef WLAN_MLO_USE_SPINLOCK
381 	qdf_spinlock_t wlan_vdev_mlo_lock;
382 #else
383 	qdf_mutex_t wlan_vdev_mlo_lock;
384 #endif
385 #ifdef QCA_SUPPORT_PRIMARY_LINK_MIGRATE
386 	qdf_atomic_t skip_pumac_cnt;
387 #endif
388 #endif
389 };
390 
391 /**
392  *  struct wlan_objmgr_vdev_nif - VDEV HDD specific sub structure
393  *  @osdev:  OS specific pointer
394  */
395 struct wlan_objmgr_vdev_nif {
396 	struct vdev_osif_priv *osdev;
397 };
398 
399 /**
400  *  struct wlan_objmgr_vdev_objmgr - vdev object manager sub structure
401  *  @vdev_id:            VDEV id
402  *  @print_cnt:          Count to throttle Logical delete prints
403  *  @self_peer:          Self PEER
404  *  @bss_peer:           BSS PEER
405  *  @wlan_peer_list:     PEER list
406  *  @wlan_pdev:          PDEV pointer
407  *  @wlan_peer_count:    Peer count
408  *  @wlan_ml_peer_count: Multilink Peer count
409  *  @mlo_bridge_vdev:    Indicates it is bridge VDEV
410  *  @mlo_central_vdev:   Indicates it is central VDEV
411  *  @max_peer_count:     Max Peer count
412  *  @c_flags:            creation specific flags
413  *  @ref_cnt:            Ref count
414  *  @ref_id_dbg:         Array to track Ref count
415  *  @trace:              Trace ref and deref
416  */
417 struct wlan_objmgr_vdev_objmgr {
418 	uint8_t vdev_id;
419 	uint8_t print_cnt;
420 	struct wlan_objmgr_peer *self_peer;
421 	struct wlan_objmgr_peer *bss_peer;
422 	qdf_list_t wlan_peer_list;
423 	struct wlan_objmgr_pdev *wlan_pdev;
424 	uint16_t wlan_peer_count;
425 #ifdef WLAN_FEATURE_11BE_MLO
426 	qdf_atomic_t wlan_ml_peer_count;
427 #ifdef WLAN_MLO_MULTI_CHIP
428 	bool mlo_bridge_vdev;
429 	bool mlo_central_vdev;
430 #endif
431 #endif
432 	uint16_t max_peer_count;
433 	uint32_t c_flags;
434 	qdf_atomic_t ref_cnt;
435 	qdf_atomic_t ref_id_dbg[WLAN_REF_ID_MAX];
436 #ifdef WLAN_OBJMGR_REF_ID_TRACE
437 	struct wlan_objmgr_trace trace;
438 #endif
439 };
440 
441 /**
442  * struct wlan_objmgr_vdev - VDEV common object
443  * @vdev_node:      qdf list of pdev's vdev list
444  * @vdev_mlme:      VDEV MLME substructure
445  * @vdev_objmgr:    VDEV Object Mgr substructure
446  * @vdev_nif:       VDEV HDD substructure
447  * @vdev_comp_priv_obj:Component's private objects list
448  * @obj_status:     Component object status
449  * @obj_state:      VDEV object state
450  * @vdev_lock:      VDEV lock
451  * @mlo_dev_ctx:    MLO device context
452  * @twt_work:	    TWT work
453  */
454 struct wlan_objmgr_vdev {
455 	qdf_list_node_t vdev_node;
456 	struct wlan_objmgr_vdev_mlme vdev_mlme;
457 	struct wlan_objmgr_vdev_objmgr vdev_objmgr;
458 	struct wlan_objmgr_vdev_nif vdev_nif;
459 	void *vdev_comp_priv_obj[WLAN_UMAC_MAX_COMPONENTS];
460 	QDF_STATUS obj_status[WLAN_UMAC_MAX_COMPONENTS];
461 	WLAN_OBJ_STATE obj_state;
462 	qdf_spinlock_t vdev_lock;
463 #ifdef WLAN_FEATURE_11BE_MLO
464 	struct wlan_mlo_dev_context *mlo_dev_ctx;
465 #endif
466 #ifdef WLAN_SUPPORT_TWT
467 	qdf_work_t twt_work;
468 #endif
469 };
470 
471 /*
472  * APIs to Create/Delete Global object APIs
473  */
474 /**
475  * wlan_objmgr_vdev_obj_create() - vdev object create
476  * @pdev: PDEV object on which this vdev gets created
477  * @params: VDEV create params from HDD
478  *
479  * Creates vdev object, initializes with default values
480  * Attaches to psoc and pdev objects
481  * Invokes the registered notifiers to create component object
482  *
483  * Return: Handle to struct wlan_objmgr_vdev on successful creation,
484  *         NULL on Failure (on Mem alloc failure and Component objects
485  *         Failure)
486  */
487 struct wlan_objmgr_vdev *wlan_objmgr_vdev_obj_create(
488 			struct wlan_objmgr_pdev *pdev,
489 			struct wlan_vdev_create_params *params);
490 
491 /**
492  * wlan_objmgr_vdev_obj_delete() - vdev object delete
493  * @vdev: vdev object
494  *
495  * Logically deletes VDEV object,
496  * Once all the references are released, object manager invokes the registered
497  * notifiers to destroy component objects
498  *
499  * Return: SUCCESS/FAILURE
500  */
501 QDF_STATUS wlan_objmgr_vdev_obj_delete(struct wlan_objmgr_vdev *vdev);
502 
503 /**
504  * wlan_objmgr_vdev_mlo_dev_ctxt_attach() - vdev mlo ctxt object attach
505  * @vdev: vdev object
506  *
507  * Attach vdev to mlo dev context object.
508  *
509  * Return: SUCCESS/FAILURE
510  */
511 QDF_STATUS
512 wlan_objmgr_vdev_mlo_dev_ctxt_attach(struct wlan_objmgr_vdev *vdev);
513 
514 /**
515  * wlan_objmgr_vdev_mlo_dev_ctxt_detach() - vdev mlo ctxt object delete
516  * @vdev: vdev object
517  *
518  * Detach mlo dev context object from vdev.
519  *
520  * Return: SUCCESS/FAILURE
521  */
522 QDF_STATUS
523 wlan_objmgr_vdev_mlo_dev_ctxt_detach(struct wlan_objmgr_vdev *vdev);
524 
525 /*
526  * APIs to attach/detach component objects
527  */
528 /**
529  * wlan_objmgr_vdev_component_obj_attach() - vdev comp object attach
530  * @vdev: VDEV object
531  * @id: Component id
532  * @comp_priv_obj: component's private object pointer
533  * @status: Component's private object creation status
534  *
535  * API to be used for attaching component object with VDEV common object
536  *
537  * Return: SUCCESS on successful storing of component's object in common object
538  *         On FAILURE (appropriate failure codes are returned)
539  */
540 QDF_STATUS wlan_objmgr_vdev_component_obj_attach(
541 		struct wlan_objmgr_vdev *vdev,
542 		enum wlan_umac_comp_id id,
543 		void *comp_priv_obj,
544 		QDF_STATUS status);
545 
546 /**
547  * wlan_objmgr_vdev_component_obj_detach() - vdev comp object detach
548  * @vdev: VDEV object
549  * @id: Component id
550  * @comp_priv_obj: component's private object pointer
551  *
552  * API to be used for detaching component object with VDEV common object
553  *
554  * Return: SUCCESS on successful removal of component's object from common
555  *         object
556  *         On FAILURE (appropriate failure codes are returned)
557  */
558 QDF_STATUS wlan_objmgr_vdev_component_obj_detach(
559 		struct wlan_objmgr_vdev *vdev,
560 		enum wlan_umac_comp_id id,
561 		void *comp_priv_obj);
562 
563 /*
564  * APIs to operations on vdev objects
565  */
566 
567 typedef void (*wlan_objmgr_vdev_op_handler)(struct wlan_objmgr_vdev *vdev,
568 					void *object,
569 					void *arg);
570 
571 /**
572  * wlan_objmgr_iterate_peerobj_list() - iterate vdev's peer list
573  * @vdev: vdev object
574  * @handler: the handler will be called for each object of requested type
575  *            the handler should be implemented to perform required operation
576  * @arg:     arguments passed by caller
577  * @dbg_id: id of the caller
578  *
579  * API to be used for performing the operations on all PEER objects
580  * of vdev
581  *
582  * Return: SUCCESS/FAILURE
583  */
584 QDF_STATUS wlan_objmgr_iterate_peerobj_list(
585 		struct wlan_objmgr_vdev *vdev,
586 		wlan_objmgr_vdev_op_handler handler,
587 		void *arg, wlan_objmgr_ref_dbgid dbg_id);
588 
589 /**
590  * wlan_objmgr_vdev_get_log_del_peer_list() - vdev logically deleted peer list
591  * @vdev: vdev object
592  * @dbg_id: id of the caller
593  *
594  * API to be used for populating the list of logically deleted peers from the
595  * vdev's peer list
596  *
597  * The caller of this function should free the memory allocated for the
598  * peerlist and the peer member in the list
599  * Also the peer ref release is handled by the caller
600  *
601  * Return: list of peer pointers
602  *         NULL on FAILURE
603  */
604 qdf_list_t *wlan_objmgr_vdev_get_log_del_peer_list(
605 		struct wlan_objmgr_vdev *vdev,
606 		wlan_objmgr_ref_dbgid dbg_id);
607 
608 /**
609  * wlan_objmgr_trigger_vdev_comp_priv_object_creation() - vdev
610  * comp object creation
611  * @vdev: VDEV object
612  * @id: Component id
613  *
614  * API to create component private object in run time, this would
615  * be used for features which gets enabled in run time
616  *
617  * Return: SUCCESS on successful creation
618  *         On FAILURE (appropriate failure codes are returned)
619  */
620 QDF_STATUS wlan_objmgr_trigger_vdev_comp_priv_object_creation(
621 		struct wlan_objmgr_vdev *vdev,
622 		enum wlan_umac_comp_id id);
623 
624 /**
625  * wlan_objmgr_trigger_vdev_comp_priv_object_deletion() - vdev comp
626  *                                                        object deletion
627  * @vdev: VDEV object
628  * @id: Component id
629  *
630  * API to destroy component private object in run time, this would
631  * be used for features which gets disabled in run time
632  *
633  * Return: SUCCESS on successful deletion
634  *         On FAILURE (appropriate failure codes are returned)
635  */
636 QDF_STATUS wlan_objmgr_trigger_vdev_comp_priv_object_deletion(
637 		struct wlan_objmgr_vdev *vdev,
638 		enum wlan_umac_comp_id id);
639 
640 /**
641  * wlan_objmgr_vdev_get_comp_private_obj() - get vdev component private object
642  * @vdev: VDEV object
643  * @id: Component id
644  *
645  * API to get component private object
646  *
647  * Return: void *ptr on SUCCESS
648  *         NULL on Failure
649  */
650 void *wlan_objmgr_vdev_get_comp_private_obj(
651 		struct wlan_objmgr_vdev *vdev,
652 		enum wlan_umac_comp_id id);
653 
654 /* Util APIs */
655 
656 /**
657  * wlan_vdev_get_pdev() - get pdev
658  * @vdev: VDEV object
659  *
660  * API to get pdev object pointer from vdev
661  *
662  * Return: pdev object pointer
663  */
wlan_vdev_get_pdev(struct wlan_objmgr_vdev * vdev)664 static inline struct wlan_objmgr_pdev *wlan_vdev_get_pdev(
665 				struct wlan_objmgr_vdev *vdev)
666 {
667 	return vdev->vdev_objmgr.wlan_pdev;
668 }
669 
670 /**
671  * wlan_pdev_vdev_list_peek_head() - get first vdev from pdev list
672  * @vdev_list: qdf_list_t
673  *
674  * API to get the head vdev of given vdev (of pdev's vdev list)
675  *
676  * Caller need to acquire lock with wlan_vdev_obj_lock()
677  *
678  * Return: head peer
679  */
wlan_pdev_vdev_list_peek_head(qdf_list_t * vdev_list)680 static inline struct wlan_objmgr_vdev *wlan_pdev_vdev_list_peek_head(
681 					qdf_list_t *vdev_list)
682 {
683 	struct wlan_objmgr_vdev *vdev;
684 	qdf_list_node_t *vdev_node = NULL;
685 
686 	/* This API is invoked with lock acquired, do not add log prints */
687 	if (qdf_list_peek_front(vdev_list, &vdev_node) != QDF_STATUS_SUCCESS)
688 		return NULL;
689 
690 	vdev = qdf_container_of(vdev_node, struct wlan_objmgr_vdev, vdev_node);
691 	return vdev;
692 }
693 
694 
695 /**
696  * wlan_vdev_get_next_vdev_of_pdev() - get next vdev
697  * @vdev_list: qdf_list_t
698  * @vdev: VDEV object
699  *
700  * API to get next vdev object pointer of vdev
701  *
702  * Caller need to acquire lock with wlan_vdev_obj_lock()
703  *
704  * Return: VDEV object
705  */
wlan_vdev_get_next_vdev_of_pdev(qdf_list_t * vdev_list,struct wlan_objmgr_vdev * vdev)706 static inline struct wlan_objmgr_vdev *wlan_vdev_get_next_vdev_of_pdev(
707 					qdf_list_t *vdev_list,
708 					struct wlan_objmgr_vdev *vdev)
709 {
710 	struct wlan_objmgr_vdev *vdev_next;
711 	qdf_list_node_t *node = &vdev->vdev_node;
712 	qdf_list_node_t *next_node = NULL;
713 
714 	/* This API is invoked with lock acquired, do not add log prints */
715 	if (!node)
716 		return NULL;
717 
718 	if (qdf_list_peek_next(vdev_list, node, &next_node) !=
719 						QDF_STATUS_SUCCESS)
720 		return NULL;
721 
722 	vdev_next = qdf_container_of(next_node, struct wlan_objmgr_vdev,
723 				vdev_node);
724 	return vdev_next;
725 }
726 
727 
728 
729 /**
730  * wlan_vdev_set_pdev() - set pdev
731  * @vdev: VDEV object
732  * @pdev: PDEV object
733  *
734  * API to get pdev object pointer from vdev
735  *
736  * Caller need to acquire lock with wlan_vdev_obj_lock()
737  *
738  * Return: void
739  */
wlan_vdev_set_pdev(struct wlan_objmgr_vdev * vdev,struct wlan_objmgr_pdev * pdev)740 static inline void wlan_vdev_set_pdev(struct wlan_objmgr_vdev *vdev,
741 					struct wlan_objmgr_pdev *pdev)
742 {
743 	/* This API is invoked with lock acquired, do not add log prints */
744 	vdev->vdev_objmgr.wlan_pdev = pdev;
745 }
746 
747 /**
748  * wlan_vdev_get_psoc() - get psoc
749  * @vdev: VDEV object
750  *
751  * API to get pdev object pointer from vdev
752  *
753  * Return: psoc object pointer
754  */
wlan_vdev_get_psoc(struct wlan_objmgr_vdev * vdev)755 static inline struct wlan_objmgr_psoc *wlan_vdev_get_psoc(
756 				struct wlan_objmgr_vdev *vdev)
757 {
758 	struct wlan_objmgr_pdev *pdev;
759 	struct wlan_objmgr_psoc *psoc = NULL;
760 
761 	pdev = wlan_vdev_get_pdev(vdev);
762 	if (!pdev)
763 		return NULL;
764 
765 	psoc = wlan_pdev_get_psoc(pdev);
766 
767 	return psoc;
768 }
769 
770 /**
771  * wlan_vdev_get_psoc_id() - get psoc id
772  * @vdev: VDEV object
773  *
774  * API to get VDEV's psoc id
775  *
776  * Return: psoc id
777  */
wlan_vdev_get_psoc_id(struct wlan_objmgr_vdev * vdev)778 static inline uint8_t wlan_vdev_get_psoc_id(struct wlan_objmgr_vdev *vdev)
779 {
780 	struct wlan_objmgr_psoc *psoc;
781 
782 	psoc = wlan_vdev_get_psoc(vdev);
783 
784 	return wlan_psoc_get_id(psoc);
785 }
786 
787 /**
788  * wlan_vdev_skip_pumac() - get primary umac support
789  * @vdev: VDEV object
790  *
791  * API to get Primary umac support for MLO
792  *
793  * Return: get primary umac support (bool)
794  */
wlan_vdev_skip_pumac(struct wlan_objmgr_vdev * vdev)795 static inline bool wlan_vdev_skip_pumac(struct wlan_objmgr_vdev *vdev)
796 {
797 	struct wlan_objmgr_psoc *psoc;
798 
799 	psoc = wlan_vdev_get_psoc(vdev);
800 
801 	if (wlan_psoc_get_pumac_skip(psoc))
802 		return true;
803 
804 	return false;
805 }
806 
807 /**
808  * wlan_vdev_mlme_set_opmode() - set vdev opmode
809  * @vdev: VDEV object
810  * @mode: VDEV op mode
811  *
812  * API to set opmode in vdev object
813  *
814  * Return: void
815  */
wlan_vdev_mlme_set_opmode(struct wlan_objmgr_vdev * vdev,enum QDF_OPMODE mode)816 static inline void wlan_vdev_mlme_set_opmode(struct wlan_objmgr_vdev *vdev,
817 				enum QDF_OPMODE mode)
818 {
819 	vdev->vdev_mlme.vdev_opmode = mode;
820 }
821 
822 /**
823  * wlan_vdev_mlme_get_opmode() - get vdev opmode
824  * @vdev: VDEV object
825  *
826  * API to set opmode of vdev object
827  *
828  * Return: VDEV op mode
829  */
wlan_vdev_mlme_get_opmode(struct wlan_objmgr_vdev * vdev)830 static inline enum QDF_OPMODE wlan_vdev_mlme_get_opmode(
831 					struct wlan_objmgr_vdev *vdev)
832 {
833 	return vdev->vdev_mlme.vdev_opmode;
834 }
835 
836 /**
837  * wlan_vdev_mlme_set_macaddr() - set vdev macaddr
838  * @vdev: VDEV object
839  * @macaddr: MAC address
840  *
841  * API to set macaddr in vdev object
842  *
843  * Caller need to acquire lock with wlan_vdev_obj_lock()
844  *
845  * Return: void
846  */
wlan_vdev_mlme_set_macaddr(struct wlan_objmgr_vdev * vdev,uint8_t * macaddr)847 static inline void wlan_vdev_mlme_set_macaddr(struct wlan_objmgr_vdev *vdev,
848 					 uint8_t *macaddr)
849 {
850 	/* This API is invoked with lock acquired, do not add log prints */
851 	WLAN_ADDR_COPY(vdev->vdev_mlme.macaddr, macaddr);
852 }
853 
854 /**
855  * wlan_vdev_mlme_get_macaddr() - get vdev macaddr
856  * @vdev: VDEV object
857  *
858  * API to get MAC address from vdev object
859  *
860  * Caller need to acquire lock with wlan_vdev_obj_lock()
861  *
862  * Return: MAC address
863  */
wlan_vdev_mlme_get_macaddr(struct wlan_objmgr_vdev * vdev)864 static inline uint8_t *wlan_vdev_mlme_get_macaddr(struct wlan_objmgr_vdev *vdev)
865 {
866 	/* This API is invoked with lock acquired, do not add log prints */
867 	return vdev->vdev_mlme.macaddr;
868 }
869 
870 /**
871  * wlan_vdev_mlme_set_mataddr() - set vdev mataddr
872  * @vdev: VDEV object
873  * @mataddr: MAT address
874  *
875  * API to set mataddr in vdev object
876  *
877  * Caller need to acquire lock with wlan_vdev_obj_lock()
878  *
879  * Return: void
880  */
wlan_vdev_mlme_set_mataddr(struct wlan_objmgr_vdev * vdev,uint8_t * mataddr)881 static inline void wlan_vdev_mlme_set_mataddr(struct wlan_objmgr_vdev *vdev,
882 					uint8_t *mataddr)
883 {
884 	/* This API is invoked with lock acquired, do not add log prints */
885 	WLAN_ADDR_COPY(vdev->vdev_mlme.mataddr, mataddr);
886 }
887 
888 /**
889  * wlan_vdev_mlme_get_mldaddr() - get vdev mldaddr
890  * @vdev: VDEV object
891  *
892  * API to get MLD address from vdev object
893  *
894  * Caller need to acquire lock with wlan_vdev_obj_lock()
895  *
896  * Return: MAC address
897  */
wlan_vdev_mlme_get_mldaddr(struct wlan_objmgr_vdev * vdev)898 static inline uint8_t *wlan_vdev_mlme_get_mldaddr(struct wlan_objmgr_vdev *vdev)
899 {
900 	/* This API is invoked with lock acquired, do not add log prints */
901 	return vdev->vdev_mlme.mldaddr;
902 }
903 
904 /**
905  * wlan_vdev_mlme_set_mldaddr() - set vdev mldaddr
906  * @vdev: VDEV object
907  * @mldaddr: MLD address
908  *
909  * API to set MLD addr in vdev object
910  *
911  * Caller need to acquire lock with wlan_vdev_obj_lock()
912  *
913  * Return: void
914  */
wlan_vdev_mlme_set_mldaddr(struct wlan_objmgr_vdev * vdev,uint8_t * mldaddr)915 static inline void wlan_vdev_mlme_set_mldaddr(struct wlan_objmgr_vdev *vdev,
916 					uint8_t *mldaddr)
917 {
918 	/* This API is invoked with lock acquired, do not add log prints */
919 	WLAN_ADDR_COPY(vdev->vdev_mlme.mldaddr, mldaddr);
920 }
921 
922 /**
923  * wlan_vdev_mlme_reset_mldaddr() - clear vdev mldaddr
924  * @vdev: VDEV object
925  *
926  * API to clear MLD addr in vdev object
927  *
928  * Caller need to acquire lock with wlan_vdev_obj_lock()
929  *
930  * Return: void
931  */
wlan_vdev_mlme_reset_mldaddr(struct wlan_objmgr_vdev * vdev)932 static inline void wlan_vdev_mlme_reset_mldaddr(struct wlan_objmgr_vdev *vdev)
933 {
934 	/* This API is invoked with lock acquired, do not add log prints */
935 	qdf_zero_macaddr((struct qdf_mac_addr *)vdev->vdev_mlme.mldaddr);
936 }
937 
938 /**
939  * wlan_vdev_mlme_get_linkaddr() - get vdev linkaddr
940  * @vdev: VDEV object
941  *
942  * API to get link MAC address from vdev object
943  *
944  * Caller need to acquire lock with wlan_vdev_obj_lock()
945  *
946  * Return: Link MAC address
947  */
948 static inline
wlan_vdev_mlme_get_linkaddr(struct wlan_objmgr_vdev * vdev)949 uint8_t *wlan_vdev_mlme_get_linkaddr(struct wlan_objmgr_vdev *vdev)
950 {
951 	/* This API is invoked with lock acquired, do not add log prints */
952 	return vdev->vdev_mlme.linkaddr;
953 }
954 
955 /**
956  * wlan_vdev_mlme_set_linkaddr() - set vdev linkaddr
957  * @vdev: VDEV object
958  * @linkaddr: Link address
959  *
960  * API to set link addr in vdev object
961  *
962  * Caller need to acquire lock with wlan_vdev_obj_lock()
963  *
964  * Return: void
965  */
wlan_vdev_mlme_set_linkaddr(struct wlan_objmgr_vdev * vdev,uint8_t * linkaddr)966 static inline void wlan_vdev_mlme_set_linkaddr(struct wlan_objmgr_vdev *vdev,
967 					       uint8_t *linkaddr)
968 {
969 	/* This API is invoked with lock acquired, do not add log prints */
970 	qdf_copy_macaddr((struct qdf_mac_addr *)vdev->vdev_mlme.linkaddr,
971 			 (struct qdf_mac_addr *)linkaddr);
972 }
973 
974 /**
975  * wlan_vdev_mlme_get_mataddr() - get mataddr
976  * @vdev: VDEV object
977  *
978  * API to get MAT address from vdev object
979  *
980  * Caller need to acquire lock with wlan_vdev_obj_lock()
981  *
982  * Return: MAT address
983  */
wlan_vdev_mlme_get_mataddr(struct wlan_objmgr_vdev * vdev)984 static inline uint8_t *wlan_vdev_mlme_get_mataddr(struct wlan_objmgr_vdev *vdev)
985 {
986 	/* This API is invoked with lock acquired, do not add log prints */
987 	return vdev->vdev_mlme.mataddr;
988 }
989 
990 /**
991  * wlan_vdev_get_id() - get vdev id
992  * @vdev: VDEV object
993  *
994  * API to get vdev id
995  *
996  * Return: vdev id
997  */
wlan_vdev_get_id(struct wlan_objmgr_vdev * vdev)998 static inline uint8_t wlan_vdev_get_id(struct wlan_objmgr_vdev *vdev)
999 {
1000 	return vdev->vdev_objmgr.vdev_id;
1001 }
1002 
1003 #ifdef WLAN_FEATURE_11BE_MLO
wlan_vdev_get_link_id(struct wlan_objmgr_vdev * vdev)1004 static inline uint8_t wlan_vdev_get_link_id(struct wlan_objmgr_vdev *vdev)
1005 {
1006 	return vdev->vdev_mlme.mlo_link_id;
1007 }
1008 
1009 /**
1010  * wlan_vdev_set_link_id() - set vdev mlo link id
1011  * @vdev: VDEV object
1012  * @link_id: link id
1013  *
1014  * API to set vdev mlo link id
1015  *
1016  * Return: void
1017  */
wlan_vdev_set_link_id(struct wlan_objmgr_vdev * vdev,uint8_t link_id)1018 static inline void wlan_vdev_set_link_id(struct wlan_objmgr_vdev *vdev,
1019 					 uint8_t link_id)
1020 {
1021 	vdev->vdev_mlme.mlo_link_id = link_id;
1022 }
1023 
1024 #ifdef WLAN_MLO_USE_SPINLOCK
1025 /**
1026  * wlan_create_vdev_mlo_lock() - API to create spin lock
1027  * which protects the set/clear of WLAN_VDEV_FEXT2_MLO flag in
1028  * vdev MLME ext2 feature caps
1029  * @vdev: VDEV object
1030  *
1031  * Return: void
1032  */
1033 static inline
wlan_create_vdev_mlo_lock(struct wlan_objmgr_vdev * vdev)1034 void wlan_create_vdev_mlo_lock(struct wlan_objmgr_vdev *vdev)
1035 {
1036 	qdf_spinlock_create(&vdev->vdev_mlme.wlan_vdev_mlo_lock);
1037 }
1038 
1039 /**
1040  * wlan_destroy_vdev_mlo_lock() - API to destroy spin lock
1041  * which protects the set/clear of WLAN_VDEV_FEXT2_MLO flag in
1042  * vdev MLME ext2 feature caps
1043  * @vdev: VDEV object
1044  *
1045  * Return: void
1046  */
1047 static inline
wlan_destroy_vdev_mlo_lock(struct wlan_objmgr_vdev * vdev)1048 void wlan_destroy_vdev_mlo_lock(struct wlan_objmgr_vdev *vdev)
1049 {
1050 	qdf_spinlock_destroy(&vdev->vdev_mlme.wlan_vdev_mlo_lock);
1051 }
1052 
1053 /**
1054  * wlan_acquire_vdev_mlo_lock() - API to acquire spin lock
1055  * which protects the set/clear of WLAN_VDEV_FEXT2_MLO flag in
1056  * vdev MLME ext2 feature caps
1057  * @vdev: VDEV object
1058  *
1059  * Return: void
1060  */
1061 static inline
wlan_acquire_vdev_mlo_lock(struct wlan_objmgr_vdev * vdev)1062 void wlan_acquire_vdev_mlo_lock(struct wlan_objmgr_vdev *vdev)
1063 {
1064 	qdf_spin_lock_bh(&vdev->vdev_mlme.wlan_vdev_mlo_lock);
1065 }
1066 
1067 /**
1068  * wlan_release_vdev_mlo_lock() - API to release spin lock
1069  * which protects the set/clear of WLAN_VDEV_FEXT2_MLO flag in
1070  * vdev MLME ext2 feature caps
1071  * @vdev: VDEV object
1072  *
1073  * Return: void
1074  */
1075 static inline
wlan_release_vdev_mlo_lock(struct wlan_objmgr_vdev * vdev)1076 void wlan_release_vdev_mlo_lock(struct wlan_objmgr_vdev *vdev)
1077 {
1078 	qdf_spin_unlock_bh(&vdev->vdev_mlme.wlan_vdev_mlo_lock);
1079 }
1080 #else
1081 /**
1082  * wlan_create_vdev_mlo_lock() - API to create mutex which protects the
1083  * set/clear of WLAN_VDEV_FEXT2_MLO flag in vdev MLME ext2 feature caps
1084  * @vdev: VDEV object
1085  *
1086  * Return: void
1087  */
1088 static inline
wlan_create_vdev_mlo_lock(struct wlan_objmgr_vdev * vdev)1089 void wlan_create_vdev_mlo_lock(struct wlan_objmgr_vdev *vdev)
1090 {
1091 	qdf_mutex_create(&vdev->vdev_mlme.wlan_vdev_mlo_lock);
1092 }
1093 
1094 /**
1095  * wlan_destroy_vdev_mlo_lock() - API to destroy mutex which protects the
1096  * set/clear of WLAN_VDEV_FEXT2_MLO flag in vdev MLME ext2 feature caps
1097  * @vdev: VDEV object
1098  *
1099  * Return: void
1100  */
1101 static inline
wlan_destroy_vdev_mlo_lock(struct wlan_objmgr_vdev * vdev)1102 void wlan_destroy_vdev_mlo_lock(struct wlan_objmgr_vdev *vdev)
1103 {
1104 	qdf_mutex_destroy(&vdev->vdev_mlme.wlan_vdev_mlo_lock);
1105 }
1106 
1107 /**
1108  * wlan_acquire_vdev_mlo_lock() - API to acquire mutex which protects the
1109  * set/clear of WLAN_VDEV_FEXT2_MLO flag in vdev MLME ext2 feature caps
1110  * @vdev: VDEV object
1111  *
1112  * Return: void
1113  */
1114 static inline
wlan_acquire_vdev_mlo_lock(struct wlan_objmgr_vdev * vdev)1115 void wlan_acquire_vdev_mlo_lock(struct wlan_objmgr_vdev *vdev)
1116 {
1117 	qdf_mutex_acquire(&vdev->vdev_mlme.wlan_vdev_mlo_lock);
1118 }
1119 
1120 /**
1121  * wlan_release_vdev_mlo_lock() - API to release mutex which protects the
1122  * set/clear of WLAN_VDEV_FEXT2_MLO flag in vdev MLME ext2 feature caps
1123  * @vdev: VDEV object
1124  *
1125  * Return: void
1126  */
1127 static inline
wlan_release_vdev_mlo_lock(struct wlan_objmgr_vdev * vdev)1128 void wlan_release_vdev_mlo_lock(struct wlan_objmgr_vdev *vdev)
1129 {
1130 	qdf_mutex_release(&vdev->vdev_mlme.wlan_vdev_mlo_lock);
1131 }
1132 #endif /* WLAN_MLO_USE_SPINLOCK */
1133 #else
wlan_vdev_get_link_id(struct wlan_objmgr_vdev * vdev)1134 static inline uint8_t wlan_vdev_get_link_id(struct wlan_objmgr_vdev *vdev)
1135 {
1136 	return WLAN_INVALID_LINK_ID;
1137 }
1138 
1139 static inline
wlan_create_vdev_mlo_lock(struct wlan_objmgr_vdev * vdev)1140 void wlan_create_vdev_mlo_lock(struct wlan_objmgr_vdev *vdev)
1141 {
1142 }
1143 
1144 static inline
wlan_destroy_vdev_mlo_lock(struct wlan_objmgr_vdev * vdev)1145 void wlan_destroy_vdev_mlo_lock(struct wlan_objmgr_vdev *vdev)
1146 {
1147 }
1148 #endif
1149 
1150 /**
1151  * wlan_vdev_get_hw_macaddr() - get hw macaddr
1152  * @vdev: VDEV object
1153  *
1154  * API to retrieve the HW MAC address from PDEV
1155  *
1156  * Caller need to acquire lock with wlan_vdev_obj_lock()
1157  *
1158  * Return: HW MAC address
1159  */
wlan_vdev_get_hw_macaddr(struct wlan_objmgr_vdev * vdev)1160 static inline uint8_t *wlan_vdev_get_hw_macaddr(struct wlan_objmgr_vdev *vdev)
1161 {
1162 	struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(vdev);
1163 
1164 	/* This API is invoked with lock acquired, do not add log prints */
1165 	if (pdev)
1166 		return wlan_pdev_get_hw_macaddr(pdev);
1167 	else
1168 		return NULL;
1169 }
1170 
1171 /**
1172  * wlan_vdev_obj_lock() - Acquire VDEV spinlock
1173  * @vdev: VDEV object
1174  *
1175  * API to acquire VDEV lock
1176  * Parent lock should not be taken in child lock context
1177  * but child lock can be taken in parent lock context
1178  * (for ex: psoc lock can't be invoked in pdev/vdev/peer lock context)
1179  *
1180  * Return: void
1181  */
wlan_vdev_obj_lock(struct wlan_objmgr_vdev * vdev)1182 static inline void wlan_vdev_obj_lock(struct wlan_objmgr_vdev *vdev)
1183 {
1184 	qdf_spin_lock_bh(&vdev->vdev_lock);
1185 }
1186 
1187 /**
1188  * wlan_vdev_obj_unlock() - Release VDEV spinlock
1189  * @vdev: VDEV object
1190  *
1191  * API to Release VDEV lock
1192  *
1193  * Return: void
1194  */
wlan_vdev_obj_unlock(struct wlan_objmgr_vdev * vdev)1195 static inline void wlan_vdev_obj_unlock(struct wlan_objmgr_vdev *vdev)
1196 {
1197 	qdf_spin_unlock_bh(&vdev->vdev_lock);
1198 }
1199 
1200 /**
1201  * wlan_vdev_mlme_set_bss_chan() - set bss chan
1202  * @vdev: VDEV object
1203  * @bss_chan: Channel
1204  *
1205  * API to set the BSS channel
1206  *
1207  * Return: void
1208  */
wlan_vdev_mlme_set_bss_chan(struct wlan_objmgr_vdev * vdev,struct wlan_channel * bss_chan)1209 static inline void wlan_vdev_mlme_set_bss_chan(
1210 				struct wlan_objmgr_vdev *vdev,
1211 				struct wlan_channel *bss_chan)
1212 {
1213 	vdev->vdev_mlme.bss_chan = bss_chan;
1214 }
1215 
1216 /**
1217  * wlan_vdev_mlme_get_bss_chan() - get bss chan
1218  * @vdev: VDEV object
1219  *
1220  * API to get the BSS channel
1221  *
1222  * Return: Channel
1223  */
wlan_vdev_mlme_get_bss_chan(struct wlan_objmgr_vdev * vdev)1224 static inline struct wlan_channel *wlan_vdev_mlme_get_bss_chan(
1225 				struct wlan_objmgr_vdev *vdev)
1226 {
1227 	return vdev->vdev_mlme.bss_chan;
1228 }
1229 
1230 /**
1231  * wlan_vdev_mlme_set_des_chan() - set desired chan
1232  * @vdev: VDEV object
1233  * @des_chan: Channel configured by user
1234  *
1235  * API to set the desired channel
1236  *
1237  * Return: void
1238  */
wlan_vdev_mlme_set_des_chan(struct wlan_objmgr_vdev * vdev,struct wlan_channel * des_chan)1239 static inline void wlan_vdev_mlme_set_des_chan(
1240 				struct wlan_objmgr_vdev *vdev,
1241 				struct wlan_channel *des_chan)
1242 {
1243 	vdev->vdev_mlme.des_chan = des_chan;
1244 }
1245 
1246 /**
1247  * wlan_vdev_mlme_get_des_chan() - get desired chan
1248  * @vdev: VDEV object
1249  *
1250  * API to get the desired channel
1251  *
1252  * Return: Channel configured by user
1253  */
wlan_vdev_mlme_get_des_chan(struct wlan_objmgr_vdev * vdev)1254 static inline struct wlan_channel *wlan_vdev_mlme_get_des_chan(
1255 				struct wlan_objmgr_vdev *vdev)
1256 {
1257 	return vdev->vdev_mlme.des_chan;
1258 }
1259 
1260 /**
1261  * wlan_vdev_mlme_feat_cap_set() - set feature caps
1262  * @vdev: VDEV object
1263  * @cap: capabilities to be set
1264  *
1265  * API to set MLME feature capabilities
1266  *
1267  * Return: void
1268  */
wlan_vdev_mlme_feat_cap_set(struct wlan_objmgr_vdev * vdev,uint32_t cap)1269 static inline void wlan_vdev_mlme_feat_cap_set(struct wlan_objmgr_vdev *vdev,
1270 				uint32_t cap)
1271 {
1272 	vdev->vdev_mlme.vdev_feat_caps |= cap;
1273 }
1274 
1275 /**
1276  * wlan_vdev_mlme_feat_cap_clear() - clear feature caps
1277  * @vdev: VDEV object
1278  * @cap: capabilities to be cleared
1279  *
1280  * API to clear MLME feature capabilities
1281  *
1282  * Return: void
1283  */
wlan_vdev_mlme_feat_cap_clear(struct wlan_objmgr_vdev * vdev,uint32_t cap)1284 static inline void wlan_vdev_mlme_feat_cap_clear(struct wlan_objmgr_vdev *vdev,
1285 				uint32_t cap)
1286 {
1287 	vdev->vdev_mlme.vdev_feat_caps &= ~cap;
1288 }
1289 
1290 /**
1291  * wlan_vdev_mlme_feat_cap_get() - get feature caps
1292  * @vdev: VDEV object
1293  * @cap: capabilities to be checked
1294  *
1295  * API to know MLME feature capability is set or not
1296  *
1297  * Return: 1 -- if capabilities set
1298  *         0 -- if capabilities clear
1299  */
wlan_vdev_mlme_feat_cap_get(struct wlan_objmgr_vdev * vdev,uint32_t cap)1300 static inline uint8_t wlan_vdev_mlme_feat_cap_get(struct wlan_objmgr_vdev *vdev,
1301 				uint32_t cap)
1302 {
1303 	return (vdev->vdev_mlme.vdev_feat_caps & cap) ? 1 : 0;
1304 }
1305 
1306 /**
1307  * wlan_vdev_mlme_feat_ext_cap_set() - set ext feature caps
1308  * @vdev: VDEV object
1309  * @cap: capabilities to be set
1310  *
1311  * API to set the MLME extensive feature capabilities
1312  *
1313  * Return: void
1314  */
wlan_vdev_mlme_feat_ext_cap_set(struct wlan_objmgr_vdev * vdev,uint32_t cap)1315 static inline void wlan_vdev_mlme_feat_ext_cap_set(
1316 				struct wlan_objmgr_vdev *vdev,
1317 				uint32_t cap)
1318 {
1319 	vdev->vdev_mlme.vdev_feat_ext_caps |= cap;
1320 }
1321 
1322 /**
1323  * wlan_vdev_mlme_feat_ext_cap_clear() - clear ext feature caps
1324  * @vdev: VDEV object
1325  * @cap: capabilities to be cleared
1326  *
1327  * API to clear the MLME extensive feature capabilities
1328  *
1329  * Return: void
1330  */
wlan_vdev_mlme_feat_ext_cap_clear(struct wlan_objmgr_vdev * vdev,uint32_t cap)1331 static inline void wlan_vdev_mlme_feat_ext_cap_clear(
1332 				struct wlan_objmgr_vdev *vdev,
1333 				uint32_t cap)
1334 {
1335 	vdev->vdev_mlme.vdev_feat_ext_caps &= ~cap;
1336 }
1337 
1338 /**
1339  * wlan_vdev_mlme_feat_ext_cap_get() - get feature ext caps
1340  * @vdev: VDEV object
1341  * @cap: capabilities to be checked
1342  *
1343  * API to know MLME ext feature capability is set or not
1344  *
1345  * Return: 1 -- if capabilities set
1346  *         0 -- if capabilities clear
1347  */
wlan_vdev_mlme_feat_ext_cap_get(struct wlan_objmgr_vdev * vdev,uint32_t cap)1348 static inline uint8_t wlan_vdev_mlme_feat_ext_cap_get(
1349 				struct wlan_objmgr_vdev *vdev,
1350 				uint32_t cap)
1351 {
1352 	return (vdev->vdev_mlme.vdev_feat_ext_caps & cap) ? 1 : 0;
1353 }
1354 
1355 /**
1356  * wlan_vdev_mlme_feat_ext2_cap_set() - set ext2 feature caps
1357  * @vdev: VDEV object
1358  * @cap: capabilities to be set
1359  *
1360  * API to set the MLME more extensive feature capabilities
1361  *
1362  * Return: void
1363  */
wlan_vdev_mlme_feat_ext2_cap_set(struct wlan_objmgr_vdev * vdev,uint32_t cap)1364 static inline void wlan_vdev_mlme_feat_ext2_cap_set(
1365 				struct wlan_objmgr_vdev *vdev,
1366 				uint32_t cap)
1367 {
1368 	vdev->vdev_mlme.vdev_feat_ext2_caps |= cap;
1369 }
1370 
1371 /**
1372  * wlan_vdev_mlme_feat_ext2_cap_clear() - clear ext2 feature caps
1373  * @vdev: VDEV object
1374  * @cap: capabilities to be cleared
1375  *
1376  * API to clear the MLME more extensive feature capabilities
1377  *
1378  * Return: void
1379  */
wlan_vdev_mlme_feat_ext2_cap_clear(struct wlan_objmgr_vdev * vdev,uint32_t cap)1380 static inline void wlan_vdev_mlme_feat_ext2_cap_clear(
1381 				struct wlan_objmgr_vdev *vdev,
1382 				uint32_t cap)
1383 {
1384 	vdev->vdev_mlme.vdev_feat_ext2_caps &= ~cap;
1385 }
1386 
1387 /**
1388  * wlan_vdev_mlme_feat_ext2_cap_get() - get feature ext2 caps
1389  * @vdev: VDEV object
1390  * @cap: capabilities to be checked
1391  *
1392  * API to know MLME more ext feature capability is set or not
1393  *
1394  * Return: 1 -- if capabilities set
1395  *         0 -- if capabilities clear
1396  */
wlan_vdev_mlme_feat_ext2_cap_get(struct wlan_objmgr_vdev * vdev,uint32_t cap)1397 static inline uint8_t wlan_vdev_mlme_feat_ext2_cap_get(
1398 				struct wlan_objmgr_vdev *vdev,
1399 				uint32_t cap)
1400 {
1401 	return (vdev->vdev_mlme.vdev_feat_ext2_caps & cap) ? 1 : 0;
1402 }
1403 
1404 /**
1405  * wlan_vdev_mlme_op_flags_set() - set vdev op flag
1406  * @vdev: VDEV object
1407  * @flag: vdev op flag to be set
1408  *
1409  * API to set the MLME VDEV OP flag
1410  *
1411  * Return: void
1412  */
wlan_vdev_mlme_op_flags_set(struct wlan_objmgr_vdev * vdev,uint32_t flag)1413 static inline void wlan_vdev_mlme_op_flags_set(
1414 				struct wlan_objmgr_vdev *vdev,
1415 				uint32_t flag)
1416 {
1417 	vdev->vdev_mlme.vdev_op_flags |= flag;
1418 }
1419 
1420 /**
1421  * wlan_vdev_mlme_op_flags_clear() - clear vdev op flag
1422  * @vdev: VDEV object
1423  * @flag: vdev op flag to be cleared
1424  *
1425  * API to clear the MLME VDEV OP flag
1426  *
1427  * Return: void
1428  */
wlan_vdev_mlme_op_flags_clear(struct wlan_objmgr_vdev * vdev,uint32_t flag)1429 static inline void wlan_vdev_mlme_op_flags_clear(
1430 				struct wlan_objmgr_vdev *vdev,
1431 				uint32_t flag)
1432 {
1433 	vdev->vdev_mlme.vdev_op_flags &= ~flag;
1434 }
1435 
1436 /**
1437  * wlan_vdev_mlme_op_flags_get() - get vdev op flag
1438  * @vdev: VDEV object
1439  * @flag: vdev op flags to be checked
1440  *
1441  * API to know MLME VDEV OP flag is set or not
1442  *
1443  * Return: 1 -- if flag is set
1444  *         0 -- if flag is clear
1445  */
wlan_vdev_mlme_op_flags_get(struct wlan_objmgr_vdev * vdev,uint32_t flag)1446 static inline uint8_t wlan_vdev_mlme_op_flags_get(
1447 				struct wlan_objmgr_vdev *vdev,
1448 				uint32_t flag)
1449 {
1450 	return (vdev->vdev_mlme.vdev_op_flags & flag) ? 1 : 0;
1451 }
1452 
1453 /**
1454  * wlan_vdev_mlme_cap_set() - mlme caps set
1455  * @vdev: VDEV object
1456  * @cap: capabilities to be set
1457  *
1458  * API to set the MLME capabilities
1459  *
1460  * Return: void
1461  */
wlan_vdev_mlme_cap_set(struct wlan_objmgr_vdev * vdev,uint32_t cap)1462 static inline void wlan_vdev_mlme_cap_set(struct wlan_objmgr_vdev *vdev,
1463 				uint32_t cap)
1464 {
1465 	vdev->vdev_mlme.vdev_caps |= cap;
1466 }
1467 
1468 /**
1469  * wlan_vdev_mlme_cap_clear() -  mlme caps clear
1470  * @vdev: VDEV object
1471  * @cap: capabilities to be cleared
1472  *
1473  * API to clear the MLME capabilities
1474  *
1475  * Return: void
1476  */
wlan_vdev_mlme_cap_clear(struct wlan_objmgr_vdev * vdev,uint32_t cap)1477 static inline void wlan_vdev_mlme_cap_clear(struct wlan_objmgr_vdev *vdev,
1478 				uint32_t cap)
1479 {
1480 	vdev->vdev_mlme.vdev_caps &= ~cap;
1481 }
1482 
1483 /**
1484  * wlan_vdev_mlme_cap_get() - get mlme caps
1485  * @vdev: VDEV object
1486  * @cap: capabilities to be checked
1487  *
1488  * API to know MLME capability is set or not
1489  *
1490  * Return: 1 -- if capabilities set
1491  *         0 -- if capabilities clear
1492  */
wlan_vdev_mlme_cap_get(struct wlan_objmgr_vdev * vdev,uint32_t cap)1493 static inline uint8_t wlan_vdev_mlme_cap_get(struct wlan_objmgr_vdev *vdev,
1494 				uint32_t cap)
1495 {
1496 	return (vdev->vdev_mlme.vdev_caps & cap) ? 1 : 0;
1497 }
1498 
1499 /**
1500  * wlan_vdev_mlme_get_state() - get mlme state
1501  * @vdev: VDEV object
1502  *
1503  * API to get MLME state
1504  *
1505  * Return: state of MLME
1506  */
wlan_vdev_mlme_get_state(struct wlan_objmgr_vdev * vdev)1507 static inline enum wlan_vdev_state wlan_vdev_mlme_get_state(
1508 				struct wlan_objmgr_vdev *vdev)
1509 {
1510 	return vdev->vdev_mlme.mlme_state;
1511 }
1512 
1513 /**
1514  * wlan_vdev_mlme_get_substate() - get mlme substate
1515  * @vdev: VDEV object
1516  *
1517  * API to get VDEV MLME substate
1518  *
1519  * Return: substate of VDEV MLME
1520  */
wlan_vdev_mlme_get_substate(struct wlan_objmgr_vdev * vdev)1521 static inline enum wlan_vdev_state wlan_vdev_mlme_get_substate(
1522 				struct wlan_objmgr_vdev *vdev)
1523 {
1524 	return vdev->vdev_mlme.mlme_substate;
1525 }
1526 
1527 /**
1528  * wlan_vdev_set_selfpeer() - set self peer
1529  * @vdev: VDEV object
1530  * @peer: peer pointer
1531  *
1532  * API to set the self peer of VDEV
1533  *
1534  * Return: void
1535  */
wlan_vdev_set_selfpeer(struct wlan_objmgr_vdev * vdev,struct wlan_objmgr_peer * peer)1536 static inline void wlan_vdev_set_selfpeer(struct wlan_objmgr_vdev *vdev,
1537 						struct wlan_objmgr_peer *peer)
1538 {
1539 	vdev->vdev_objmgr.self_peer = peer;
1540 }
1541 
1542 /**
1543  * wlan_vdev_get_selfpeer() - get self peer
1544  * @vdev: VDEV object
1545  *
1546  * API to get the self peer of VDEV
1547  *
1548  * Return: peer pointer
1549  */
wlan_vdev_get_selfpeer(struct wlan_objmgr_vdev * vdev)1550 static inline struct wlan_objmgr_peer *wlan_vdev_get_selfpeer(
1551 					struct wlan_objmgr_vdev *vdev)
1552 {
1553 	return vdev->vdev_objmgr.self_peer;
1554 }
1555 
1556 /**
1557  * wlan_vdev_set_bsspeer() - set bss peer
1558  * @vdev: VDEV object
1559  * @peer: BSS peer pointer
1560  *
1561  * API to set the BSS peer of VDEV
1562  *
1563  * Return: void
1564  */
wlan_vdev_set_bsspeer(struct wlan_objmgr_vdev * vdev,struct wlan_objmgr_peer * peer)1565 static inline void wlan_vdev_set_bsspeer(struct wlan_objmgr_vdev *vdev,
1566 						 struct wlan_objmgr_peer *peer)
1567 {
1568 	vdev->vdev_objmgr.bss_peer = peer;
1569 }
1570 
1571 /**
1572  * wlan_vdev_get_bsspeer() - get bss peer
1573  * @vdev: VDEV object
1574  *
1575  * API to get the BSS peer of VDEV, wlan_objmgr_vdev_try_get_bsspeer API
1576  * preferred to use outside obj manager to take and handle ref count of
1577  * bss_peer with ref debug ID.
1578  *
1579  * Return: BSS peer pointer
1580  */
wlan_vdev_get_bsspeer(struct wlan_objmgr_vdev * vdev)1581 static inline struct wlan_objmgr_peer *wlan_vdev_get_bsspeer(
1582 					struct wlan_objmgr_vdev *vdev)
1583 {
1584 	return vdev->vdev_objmgr.bss_peer;
1585 }
1586 
1587 /**
1588  * wlan_objmgr_vdev_find_peer_by_mac() - get a peer with given mac from vdev
1589  * @vdev: VDEV object
1590  * @peer_mac: mac address of the peer to be found
1591  * @dbg_id: dbg_id of the module
1592  *
1593  * API to get and increment ref count of BSS peer of VDEV
1594  *
1595  * Return: peer pointer to the peer of the mac address
1596  */
1597 struct wlan_objmgr_peer *
1598 wlan_objmgr_vdev_find_peer_by_mac(struct wlan_objmgr_vdev *vdev,
1599 				  uint8_t *peer_mac,
1600 				  wlan_objmgr_ref_dbgid dbg_id);
1601 
1602 /**
1603  * wlan_objmgr_vdev_try_get_bsspeer() - get and increment ref count of BSS peer
1604  * of VDEV
1605  * @vdev: VDEV object
1606  * @id:   Object Manager ref debug id
1607  *
1608  * API to get and increment ref count of BSS peer of VDEV
1609  *
1610  * Return: BSS peer pointer if bss peer is present and valid else NULL
1611  */
1612 struct wlan_objmgr_peer *wlan_objmgr_vdev_try_get_bsspeer(
1613 					struct wlan_objmgr_vdev *vdev,
1614 					wlan_objmgr_ref_dbgid id);
1615 /**
1616  * wlan_vdev_get_ospriv() - get os priv pointer
1617  * @vdev: VDEV object
1618  *
1619  * API to get OS private pointer from VDEV
1620  *
1621  * Return: ospriv - private pointer
1622  */
wlan_vdev_get_ospriv(struct wlan_objmgr_vdev * vdev)1623 static inline struct vdev_osif_priv *wlan_vdev_get_ospriv(
1624 	struct wlan_objmgr_vdev *vdev)
1625 {
1626 	return vdev->vdev_nif.osdev;
1627 }
1628 
1629 /**
1630  * wlan_vdev_reset_ospriv() - reset os priv pointer
1631  * @vdev: VDEV object
1632  *
1633  * API to reset OS private pointer in VDEV
1634  *
1635  * Return: void
1636  */
wlan_vdev_reset_ospriv(struct wlan_objmgr_vdev * vdev)1637 static inline void wlan_vdev_reset_ospriv(struct wlan_objmgr_vdev *vdev)
1638 {
1639 	vdev->vdev_nif.osdev = NULL;
1640 }
1641 
1642 /**
1643  * wlan_vdev_get_peer_count() - get vdev peer count
1644  * @vdev: VDEV object
1645  *
1646  * API to get peer count from VDEV
1647  *
1648  * Return: peer_count - vdev's peer count
1649  */
wlan_vdev_get_peer_count(struct wlan_objmgr_vdev * vdev)1650 static inline uint16_t wlan_vdev_get_peer_count(struct wlan_objmgr_vdev *vdev)
1651 {
1652 	return vdev->vdev_objmgr.wlan_peer_count;
1653 }
1654 
1655 #ifdef WLAN_FEATURE_11BE_MLO
1656 /**
1657  * wlan_vdev_get_legacy_peer_count() - get vdev peer count
1658  * @vdev: VDEV object
1659  *
1660  * API to get legacy peer count from VDEV
1661  *
1662  * Return: peer_count - vdev's peer count
1663  */
wlan_vdev_get_legacy_peer_count(struct wlan_objmgr_vdev * vdev)1664 static inline uint16_t wlan_vdev_get_legacy_peer_count(
1665 					struct wlan_objmgr_vdev *vdev)
1666 {
1667 	return vdev->vdev_objmgr.wlan_peer_count -
1668 	       qdf_atomic_read(&vdev->vdev_objmgr.wlan_ml_peer_count);
1669 }
1670 #else
wlan_vdev_get_legacy_peer_count(struct wlan_objmgr_vdev * vdev)1671 static inline uint16_t wlan_vdev_get_legacy_peer_count(
1672 					struct wlan_objmgr_vdev *vdev)
1673 {
1674 	return vdev->vdev_objmgr.wlan_peer_count;
1675 }
1676 #endif
1677 
1678 /**
1679  * wlan_vdev_mlme_is_ap() - Check whether @vdev is an AP or not
1680  * @vdev: VDEV object
1681  *
1682  * Return: True if @vdev is ap, otherwise false.
1683  */
wlan_vdev_mlme_is_ap(struct wlan_objmgr_vdev * vdev)1684 static inline bool wlan_vdev_mlme_is_ap(struct wlan_objmgr_vdev *vdev)
1685 {
1686 	return (wlan_vdev_mlme_get_opmode(vdev) == QDF_SAP_MODE);
1687 }
1688 
1689 #ifdef WLAN_FEATURE_11BE_MLO
1690 /**
1691  * wlan_vdev_mlme_is_mlo_vdev() - Determine whether the given vdev is an MLO
1692  * vdev or not
1693  * @vdev: VDEV object
1694  *
1695  * Return: True if it is MLO, otherwise false.
1696  */
1697 bool wlan_vdev_mlme_is_mlo_vdev(struct wlan_objmgr_vdev *vdev);
1698 
1699 #ifdef WLAN_MLO_MULTI_CHIP
1700 /**
1701  * wlan_vdev_mlme_is_mlo_bridge_vdev() - check if it is bridge vdev
1702  * @vdev: Object manager VDEV object
1703  *
1704  * API to get if given vdev is bridge vdev or not
1705  *
1706  * Return: True if it is bridge vdev, otherwise false.
1707  */
1708 bool wlan_vdev_mlme_is_mlo_bridge_vdev(struct wlan_objmgr_vdev *vdev);
1709 #else
1710 static inline bool
wlan_vdev_mlme_is_mlo_bridge_vdev(struct wlan_objmgr_vdev * vdev)1711 wlan_vdev_mlme_is_mlo_bridge_vdev(struct wlan_objmgr_vdev *vdev)
1712 {
1713 	return false;
1714 }
1715 #endif
1716 
1717 /**
1718  * wlan_vdev_mlme_is_tdls_vdev() - Determine whether the given vdev is tdls MLO
1719  * vdev or not
1720  * @vdev: VDEV object
1721  *
1722  * Return: True if it is tdls MLO, otherwise false.
1723  */
1724 bool wlan_vdev_mlme_is_tdls_vdev(struct wlan_objmgr_vdev *vdev);
1725 
1726 /**
1727  * wlan_vdev_mlme_is_mlo_ap() - whether it is mlo ap or not
1728  * @vdev: VDEV object
1729  *
1730  * Return: True if it is mlo ap, otherwise false.
1731  */
wlan_vdev_mlme_is_mlo_ap(struct wlan_objmgr_vdev * vdev)1732 static inline bool wlan_vdev_mlme_is_mlo_ap(struct wlan_objmgr_vdev *vdev)
1733 {
1734 	return (wlan_vdev_mlme_get_opmode(vdev) == QDF_SAP_MODE) &&
1735 		wlan_vdev_mlme_is_mlo_vdev(vdev);
1736 }
1737 
1738 /**
1739  * wlan_vdev_mlme_set_epcs_flag() - Set epcs flag for vdev
1740  * @vdev: VDEV object
1741  * @flag: True or Flase
1742  *
1743  * Return: void
1744  */
1745 void wlan_vdev_mlme_set_epcs_flag(struct wlan_objmgr_vdev *vdev, bool flag);
1746 
1747 /**
1748  * wlan_vdev_mlme_get_epcs_flag() - Get epcs flag for vdev
1749  * @vdev: VDEV object
1750  *
1751  * Return: bool
1752  */
1753 bool wlan_vdev_mlme_get_epcs_flag(struct wlan_objmgr_vdev *vdev);
1754 
1755 /**
1756  * wlan_vdev_mlme_set_user_dis_eht_flag() - Set user disable eht flag for vdev
1757  * @vdev: VDEV object
1758  * @flag: True or Flase
1759  *
1760  * Return: void
1761  */
1762 void wlan_vdev_mlme_set_user_dis_eht_flag(struct wlan_objmgr_vdev *vdev,
1763 					  bool flag);
1764 
1765 /**
1766  * wlan_vdev_mlme_get_user_dis_eht_flag() - Get user disable eht flag for vdev
1767  * @vdev: VDEV object
1768  *
1769  * Return: bool
1770  */
1771 bool wlan_vdev_mlme_get_user_dis_eht_flag(struct wlan_objmgr_vdev *vdev);
1772 
1773 /**
1774  * wlan_vdev_mlme_set_mlo_vdev() - Set vdev as an MLO vdev
1775  * @vdev: VDEV object
1776  *
1777  * Return: void
1778  */
1779 void wlan_vdev_mlme_set_mlo_vdev(struct wlan_objmgr_vdev *vdev);
1780 
1781 /**
1782  * wlan_vdev_mlme_clear_mlo_vdev() - Mark that the vdev is no longer an MLO vdev
1783  * @vdev: VDEV object
1784  *
1785  * Return: void
1786  */
1787 void wlan_vdev_mlme_clear_mlo_vdev(struct wlan_objmgr_vdev *vdev);
1788 
1789 /**
1790  * wlan_vdev_mlme_set_mlo_link_vdev() - Set vdev as an MLO link vdev
1791  * @vdev: VDEV object
1792  *
1793  * Return: void
1794  */
1795 void wlan_vdev_mlme_set_mlo_link_vdev(struct wlan_objmgr_vdev *vdev);
1796 
1797 /**
1798  * wlan_vdev_mlme_clear_mlo_link_vdev() - Mark that the vdev is no longer an
1799  * MLO link vdev
1800  * @vdev: VDEV object
1801  *
1802  * Return: void
1803  */
1804 void wlan_vdev_mlme_clear_mlo_link_vdev(struct wlan_objmgr_vdev *vdev);
1805 
1806 #ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
1807 /**
1808  * wlan_vdev_mlme_set_mlo_link_switch_in_progress() - Set link switch in
1809  * progress flag for VDEV.
1810  * @vdev: VDEV object manager.
1811  *
1812  * Return: void
1813  */
1814 static inline void
wlan_vdev_mlme_set_mlo_link_switch_in_progress(struct wlan_objmgr_vdev * vdev)1815 wlan_vdev_mlme_set_mlo_link_switch_in_progress(struct wlan_objmgr_vdev *vdev)
1816 {
1817 	unsigned long flag = WLAN_VDEV_OP_MLO_LINK_SWITCH_IN_PROGRESS;
1818 
1819 	wlan_vdev_mlme_op_flags_set(vdev, flag);
1820 }
1821 
1822 /**
1823  * wlan_vdev_mlme_clear_mlo_link_switch_in_progress() - Clear link switch in
1824  * progress flag for VDEV.
1825  * @vdev: VDEV object manager
1826  *
1827  * Return: void
1828  */
1829 static inline void
wlan_vdev_mlme_clear_mlo_link_switch_in_progress(struct wlan_objmgr_vdev * vdev)1830 wlan_vdev_mlme_clear_mlo_link_switch_in_progress(struct wlan_objmgr_vdev *vdev)
1831 {
1832 	unsigned long flag = WLAN_VDEV_OP_MLO_LINK_SWITCH_IN_PROGRESS;
1833 
1834 	wlan_vdev_mlme_op_flags_clear(vdev, flag);
1835 }
1836 
1837 /**
1838  * wlan_vdev_mlme_is_mlo_link_switch_in_progress() - Return true if VDEV is
1839  * in link transitioning state.
1840  * @vdev: VDEV object manager.
1841  *
1842  * Return: bool
1843  */
1844 static inline bool
wlan_vdev_mlme_is_mlo_link_switch_in_progress(struct wlan_objmgr_vdev * vdev)1845 wlan_vdev_mlme_is_mlo_link_switch_in_progress(struct wlan_objmgr_vdev *vdev)
1846 {
1847 	unsigned long flag = WLAN_VDEV_OP_MLO_LINK_SWITCH_IN_PROGRESS;
1848 
1849 	return wlan_vdev_mlme_op_flags_get(vdev, flag);
1850 }
1851 #else
1852 static inline void
wlan_vdev_mlme_set_mlo_link_switch_in_progress(struct wlan_objmgr_vdev * vdev)1853 wlan_vdev_mlme_set_mlo_link_switch_in_progress(struct wlan_objmgr_vdev *vdev)
1854 {
1855 }
1856 
1857 static inline void
wlan_vdev_mlme_clear_mlo_link_switch_in_progress(struct wlan_objmgr_vdev * vdev)1858 wlan_vdev_mlme_clear_mlo_link_switch_in_progress(struct wlan_objmgr_vdev *vdev)
1859 {
1860 }
1861 
1862 static inline bool
wlan_vdev_mlme_is_mlo_link_switch_in_progress(struct wlan_objmgr_vdev * vdev)1863 wlan_vdev_mlme_is_mlo_link_switch_in_progress(struct wlan_objmgr_vdev *vdev)
1864 {
1865 	return false;
1866 }
1867 #endif /* WLAN_FEATURE_11BE_MLO_ADV_FEATURE  */
1868 
1869 #ifdef WLAN_MCAST_MLO
1870 /**
1871  * wlan_vdev_mlme_is_mlo_mcast_vdev() - whether it is mlo mcast vdev or not
1872  * @vdev: VDEV object
1873  *
1874  * Return: True if it is mlo mcast vdev, otherwise false.
1875  */
1876 static inline
wlan_vdev_mlme_is_mlo_mcast_vdev(struct wlan_objmgr_vdev * vdev)1877 bool wlan_vdev_mlme_is_mlo_mcast_vdev(struct wlan_objmgr_vdev *vdev)
1878 {
1879 	return wlan_vdev_mlme_feat_ext2_cap_get(vdev,
1880 						WLAN_VDEV_FEXT2_MLO_MCAST);
1881 }
1882 #else
1883 static inline
wlan_vdev_mlme_is_mlo_mcast_vdev(struct wlan_objmgr_vdev * vdev)1884 bool wlan_vdev_mlme_is_mlo_mcast_vdev(struct wlan_objmgr_vdev *vdev)
1885 {
1886 	return false;
1887 }
1888 #endif
1889 
1890 /**
1891  * wlan_vdev_mlme_is_mlo_link_vdev() - whether it is mlo sta link vdev or not
1892  * @vdev: VDEV object
1893  *
1894  * Return: True if it is mlo sta link, otherwise false.
1895  */
1896 static inline
wlan_vdev_mlme_is_mlo_link_vdev(struct wlan_objmgr_vdev * vdev)1897 bool wlan_vdev_mlme_is_mlo_link_vdev(struct wlan_objmgr_vdev *vdev)
1898 {
1899 	return wlan_vdev_mlme_feat_ext2_cap_get(vdev,
1900 						WLAN_VDEV_FEXT2_MLO_STA_LINK);
1901 }
1902 
1903 /**
1904  * wlan_vdev_mlme_is_assoc_sta_vdev() - whether it is mlo sta assoc vdev or not
1905  * @vdev: VDEV object
1906  *
1907  * Return: True if it is mlo sta assoc vdev, otherwise false.
1908  */
1909 static inline
wlan_vdev_mlme_is_assoc_sta_vdev(struct wlan_objmgr_vdev * vdev)1910 bool wlan_vdev_mlme_is_assoc_sta_vdev(struct wlan_objmgr_vdev *vdev)
1911 {
1912 	if (!(wlan_vdev_mlme_get_opmode(vdev) == QDF_STA_MODE) ||
1913 	    !wlan_vdev_mlme_is_mlo_vdev(vdev))
1914 		return false;
1915 
1916 	if (!wlan_vdev_mlme_is_mlo_link_vdev(vdev))
1917 		return true;
1918 
1919 	return false;
1920 }
1921 
1922 /**
1923  * wlan_vdev_mlme_is_link_sta_vdev() - whether it is mlo sta link vdev or not
1924  * @vdev: VDEV object
1925  *
1926  * Return: True if it is mlo sta link vdev, otherwise false.
1927  */
1928 static inline
wlan_vdev_mlme_is_link_sta_vdev(struct wlan_objmgr_vdev * vdev)1929 bool wlan_vdev_mlme_is_link_sta_vdev(struct wlan_objmgr_vdev *vdev)
1930 {
1931 	if (!(wlan_vdev_mlme_get_opmode(vdev) == QDF_STA_MODE) ||
1932 	    !wlan_vdev_mlme_is_mlo_vdev(vdev))
1933 		return false;
1934 
1935 	if (wlan_vdev_mlme_is_mlo_link_vdev(vdev))
1936 		return true;
1937 
1938 	return false;
1939 }
1940 #else
1941 static inline
wlan_vdev_mlme_set_user_dis_eht_flag(struct wlan_objmgr_vdev * vdev,bool flag)1942 void wlan_vdev_mlme_set_user_dis_eht_flag(struct wlan_objmgr_vdev *vdev,
1943 					  bool flag)
1944 {
1945 }
1946 
1947 static inline
wlan_vdev_mlme_get_user_dis_eht_flag(struct wlan_objmgr_vdev * vdev)1948 bool wlan_vdev_mlme_get_user_dis_eht_flag(struct wlan_objmgr_vdev *vdev)
1949 {
1950 	return false;
1951 }
1952 
1953 static inline
wlan_vdev_mlme_is_mlo_vdev(struct wlan_objmgr_vdev * vdev)1954 bool wlan_vdev_mlme_is_mlo_vdev(struct wlan_objmgr_vdev *vdev)
1955 {
1956 	return false;
1957 }
1958 
1959 static inline bool
wlan_vdev_mlme_is_mlo_bridge_vdev(struct wlan_objmgr_vdev * vdev)1960 wlan_vdev_mlme_is_mlo_bridge_vdev(struct wlan_objmgr_vdev *vdev)
1961 {
1962 	return false;
1963 }
1964 
wlan_vdev_mlme_is_mlo_ap(struct wlan_objmgr_vdev * vdev)1965 static inline bool wlan_vdev_mlme_is_mlo_ap(struct wlan_objmgr_vdev *vdev)
1966 {
1967 	return false;
1968 }
1969 
1970 static inline
wlan_vdev_mlme_set_mlo_vdev(struct wlan_objmgr_vdev * vdev)1971 void wlan_vdev_mlme_set_mlo_vdev(struct wlan_objmgr_vdev *vdev)
1972 {
1973 }
1974 
1975 static inline
wlan_vdev_mlme_clear_mlo_vdev(struct wlan_objmgr_vdev * vdev)1976 void wlan_vdev_mlme_clear_mlo_vdev(struct wlan_objmgr_vdev *vdev)
1977 {
1978 }
1979 
1980 static inline
wlan_vdev_mlme_set_mlo_link_vdev(struct wlan_objmgr_vdev * vdev)1981 void wlan_vdev_mlme_set_mlo_link_vdev(struct wlan_objmgr_vdev *vdev)
1982 {
1983 }
1984 
1985 static inline
wlan_vdev_mlme_clear_mlo_link_vdev(struct wlan_objmgr_vdev * vdev)1986 void wlan_vdev_mlme_clear_mlo_link_vdev(struct wlan_objmgr_vdev *vdev)
1987 {
1988 }
1989 
1990 static inline void
wlan_vdev_mlme_set_mlo_link_switch_in_progress(struct wlan_objmgr_vdev * vdev)1991 wlan_vdev_mlme_set_mlo_link_switch_in_progress(struct wlan_objmgr_vdev *vdev)
1992 {
1993 }
1994 
1995 static inline void
wlan_vdev_mlme_clear_mlo_link_switch_in_progress(struct wlan_objmgr_vdev * vdev)1996 wlan_vdev_mlme_clear_mlo_link_switch_in_progress(struct wlan_objmgr_vdev *vdev)
1997 {
1998 }
1999 
2000 static inline bool
wlan_vdev_mlme_is_mlo_link_switch_in_progress(struct wlan_objmgr_vdev * vdev)2001 wlan_vdev_mlme_is_mlo_link_switch_in_progress(struct wlan_objmgr_vdev *vdev)
2002 {
2003 	return false;
2004 }
2005 
2006 static inline
wlan_vdev_mlme_is_mlo_link_vdev(struct wlan_objmgr_vdev * vdev)2007 bool wlan_vdev_mlme_is_mlo_link_vdev(struct wlan_objmgr_vdev *vdev)
2008 {
2009 	return false;
2010 }
2011 
2012 static inline
wlan_vdev_mlme_is_assoc_sta_vdev(struct wlan_objmgr_vdev * vdev)2013 bool wlan_vdev_mlme_is_assoc_sta_vdev(struct wlan_objmgr_vdev *vdev)
2014 {
2015 	return false;
2016 }
2017 
2018 static inline
wlan_vdev_mlme_is_link_sta_vdev(struct wlan_objmgr_vdev * vdev)2019 bool wlan_vdev_mlme_is_link_sta_vdev(struct wlan_objmgr_vdev *vdev)
2020 {
2021 	return false;
2022 }
2023 #endif
2024 
2025 /**
2026  * DOC: Examples to use VDEV ref count APIs
2027  *
2028  * In all the scenarios, the pair of API should be followed
2029  * other it lead to memory leak
2030  *
2031  *  scenario 1:
2032  *
2033  *     wlan_objmgr_vdev_obj_create()
2034  *     ----
2035  *     wlan_objmgr_vdev_obj_delete()
2036  *
2037  *  scenario 2:
2038  *
2039  *     wlan_objmgr_vdev_get_ref()
2040  *     ----
2041  *     the operations which are done on
2042  *     vdev object
2043  *     ----
2044  *     wlan_objmgr_vdev_release_ref()
2045  *
2046  *  scenario 3:
2047  *
2048  *     API to retrieve vdev (xxx_get_vdev_xxx())
2049  *     ----
2050  *     the operations which are done on
2051  *     vdev object
2052  *     ----
2053  *     wlan_objmgr_vdev_release_ref()
2054  */
2055 
2056 /**
2057  * wlan_objmgr_vdev_get_ref() - increment ref count
2058  * @vdev: VDEV object
2059  * @id:   Object Manager ref debug id
2060  *
2061  * API to increment ref count of vdev
2062  *
2063  * Return: void
2064  */
2065 #ifdef WLAN_OBJMGR_REF_ID_TRACE
2066 #define wlan_objmgr_vdev_get_ref(vdev, id) \
2067 		wlan_objmgr_vdev_get_ref_debug(vdev, id, __func__, __LINE__)
2068 
2069 void wlan_objmgr_vdev_get_ref_debug(struct wlan_objmgr_vdev *vdev,
2070 				    wlan_objmgr_ref_dbgid id,
2071 				    const char *func, int line);
2072 #else
2073 void wlan_objmgr_vdev_get_ref(struct wlan_objmgr_vdev *vdev,
2074 				wlan_objmgr_ref_dbgid id);
2075 #endif
2076 
2077 /**
2078  * wlan_objmgr_vdev_try_get_ref() - increment ref count, if allowed
2079  * @vdev: VDEV object
2080  * @id:   Object Manager ref debug id
2081  *
2082  * API to increment ref count of vdev after checking valid object state
2083  *
2084  * Return: void
2085  */
2086 #ifdef WLAN_OBJMGR_REF_ID_TRACE
2087 #define wlan_objmgr_vdev_try_get_ref(vdev, id) \
2088 		wlan_objmgr_vdev_try_get_ref_debug(vdev, id, \
2089 		__func__, __LINE__)
2090 
2091 QDF_STATUS wlan_objmgr_vdev_try_get_ref_debug(struct wlan_objmgr_vdev *vdev,
2092 					      wlan_objmgr_ref_dbgid id,
2093 					      const char *func, int line);
2094 #else
2095 QDF_STATUS wlan_objmgr_vdev_try_get_ref(struct wlan_objmgr_vdev *vdev,
2096 						wlan_objmgr_ref_dbgid id);
2097 #endif
2098 
2099 /**
2100  * wlan_objmgr_vdev_release_ref() - decrement ref count
2101  * @vdev: VDEV object
2102  * @id:   Object Manager ref debug id
2103  *
2104  * API to decrement ref count of vdev, if ref count is 1, it initiates the
2105  * VDEV deletion
2106  *
2107  * Return: void
2108  */
2109 #ifdef WLAN_OBJMGR_REF_ID_TRACE
2110 #define wlan_objmgr_vdev_release_ref(vdev, id)\
2111 		wlan_objmgr_vdev_release_ref_debug(vdev, id, \
2112 		__func__, __LINE__)
2113 
2114 void wlan_objmgr_vdev_release_ref_debug(struct wlan_objmgr_vdev *vdev,
2115 					wlan_objmgr_ref_dbgid id,
2116 					const char *func, int line);
2117 #else
2118 void wlan_objmgr_vdev_release_ref(struct wlan_objmgr_vdev *vdev,
2119 						wlan_objmgr_ref_dbgid id);
2120 #endif
2121 
2122 /**
2123  * wlan_vdev_get_next_active_vdev_of_pdev() - get next active vdev
2124  * @pdev: PDEV object
2125  * @vdev_list: qdf_list_t
2126  * @vdev: VDEV object
2127  * @dbg_id: id of the caller
2128  *
2129  * API to get next active vdev object pointer of vdev
2130  *
2131  * Return: VDEV object
2132  */
2133 #ifdef WLAN_OBJMGR_REF_ID_TRACE
2134 #define wlan_vdev_get_next_active_vdev_of_pdev(pdev, vdev_list, vdev, dbg_id) \
2135 		wlan_vdev_get_next_active_vdev_of_pdev_debug(pdev, vdev_list, \
2136 		vdev, dbg_id, __func__, __LINE__)
2137 
2138 struct wlan_objmgr_vdev *wlan_vdev_get_next_active_vdev_of_pdev_debug(
2139 					struct wlan_objmgr_pdev *pdev,
2140 					qdf_list_t *vdev_list,
2141 					struct wlan_objmgr_vdev *vdev,
2142 					wlan_objmgr_ref_dbgid dbg_id,
2143 					const char *func, int line);
2144 #else
2145 struct wlan_objmgr_vdev *wlan_vdev_get_next_active_vdev_of_pdev(
2146 					struct wlan_objmgr_pdev *pdev,
2147 					qdf_list_t *vdev_list,
2148 					struct wlan_objmgr_vdev *vdev,
2149 					wlan_objmgr_ref_dbgid dbg_id);
2150 #endif
2151 
2152 /**
2153  * wlan_pdev_peek_active_first_vdev() - get first active vdev from pdev list
2154  * @pdev: PDEV object
2155  * @dbg_id: id of the caller
2156  *
2157  * API to get the head active vdev of given pdev (of pdev's vdev list)
2158  *
2159  * Return:
2160  */
2161 #ifdef WLAN_OBJMGR_REF_ID_TRACE
2162 #define wlan_pdev_peek_active_first_vdev(pdev, dbg_id) \
2163 		wlan_pdev_peek_active_first_vdev_debug(pdev, dbg_id, \
2164 		__func__, __LINE__)
2165 
2166 struct wlan_objmgr_vdev *wlan_pdev_peek_active_first_vdev_debug(
2167 		struct wlan_objmgr_pdev *pdev,
2168 		wlan_objmgr_ref_dbgid dbg_id,
2169 		const char *func, int line);
2170 #else
2171 struct wlan_objmgr_vdev *wlan_pdev_peek_active_first_vdev(
2172 		struct wlan_objmgr_pdev *pdev,
2173 		wlan_objmgr_ref_dbgid dbg_id);
2174 #endif
2175 
2176 /**
2177  * wlan_pdev_vdev_list_peek_active_head() - get first active vdev from pdev list
2178  * @pdev: PDEV object
2179  * @vdev_list: qdf_list_t
2180  * @dbg_id: id of the caller
2181  *
2182  * API to get the head active vdev of given vdev (of pdev's vdev list)
2183  *
2184  * Return: head peer
2185  */
2186 #ifdef WLAN_OBJMGR_REF_ID_TRACE
2187 #define wlan_pdev_vdev_list_peek_active_head(pdev, vdev_list, dbg_id) \
2188 		wlan_pdev_vdev_list_peek_active_head_debug(pdev, vdev_list, \
2189 		dbg_id, __func__, __LINE__)
2190 
2191 struct wlan_objmgr_vdev *wlan_pdev_vdev_list_peek_active_head_debug(
2192 				struct wlan_objmgr_pdev *pdev,
2193 				qdf_list_t *vdev_list,
2194 				wlan_objmgr_ref_dbgid dbg_id,
2195 				const char *func, int line);
2196 #else
2197 struct wlan_objmgr_vdev *wlan_pdev_vdev_list_peek_active_head(
2198 				struct wlan_objmgr_pdev *pdev,
2199 				qdf_list_t *vdev_list,
2200 				wlan_objmgr_ref_dbgid dbg_id);
2201 #endif
2202 
2203 /**
2204  * wlan_objmgr_vdev_peer_freed_notify() - Notifies modules about peer freed
2205  * @vdev: VDEV object
2206  *
2207  * API to invokes registered callbacks to notify about peer freed
2208  *
2209  * Return: void
2210  */
2211 void wlan_objmgr_vdev_peer_freed_notify(struct wlan_objmgr_vdev *vdev);
2212 
2213 /**
2214  * wlan_vdev_set_max_peer_count() - set max peer count
2215  * @vdev: VDEV object
2216  * @count: Max peer count
2217  *
2218  * API to set max peer count of VDEV
2219  *
2220  * Return: void
2221  */
wlan_vdev_set_max_peer_count(struct wlan_objmgr_vdev * vdev,uint16_t count)2222 static inline void wlan_vdev_set_max_peer_count(struct wlan_objmgr_vdev *vdev,
2223 						uint16_t count)
2224 {
2225 	vdev->vdev_objmgr.max_peer_count = count;
2226 }
2227 
2228 /**
2229  * wlan_vdev_get_max_peer_count() - get max peer count
2230  * @vdev: VDEV object
2231  *
2232  * API to get max peer count of VDEV
2233  *
2234  * Return: max peer count
2235  */
wlan_vdev_get_max_peer_count(struct wlan_objmgr_vdev * vdev)2236 static inline uint16_t wlan_vdev_get_max_peer_count(
2237 						struct wlan_objmgr_vdev *vdev)
2238 {
2239 	return vdev->vdev_objmgr.max_peer_count;
2240 }
2241 
2242 #ifdef WLAN_FEATURE_11BE_MLO
2243 /**wlan_vdev_set_mlo_external_sae_auth_conversion() - set MLO external sae auth
2244  * @vdev: VDEV object
2245  * @val: true or false
2246  *
2247  * API to set mlo external sae auth of VDEV
2248  *
2249  * Return: void
2250  */
2251 static inline void
wlan_vdev_set_mlo_external_sae_auth_conversion(struct wlan_objmgr_vdev * vdev,bool val)2252 wlan_vdev_set_mlo_external_sae_auth_conversion(struct wlan_objmgr_vdev *vdev,
2253 					       bool val)
2254 {
2255 	vdev->vdev_mlme.mlo_external_sae_auth = val;
2256 }
2257 
2258 /**wlan_vdev_get_mlo_external_sae_auth_conversion() - get MLO external sae auth
2259  * @vdev: VDEV object
2260  *
2261  * API to get mlo external sae auth of VDEV
2262  *
2263  * Return: mlo external sae auth of VDEV
2264  */
2265 static inline bool
wlan_vdev_get_mlo_external_sae_auth_conversion(struct wlan_objmgr_vdev * vdev)2266 wlan_vdev_get_mlo_external_sae_auth_conversion(struct wlan_objmgr_vdev *vdev)
2267 {
2268 	return vdev->vdev_mlme.mlo_external_sae_auth;
2269 }
2270 #endif
2271 
2272 /**
2273  * wlan_print_vdev_info() - print vdev members
2274  * @vdev: vdev object pointer
2275  *
2276  * Return: void
2277  */
2278 #ifdef WLAN_OBJMGR_DEBUG
2279 void wlan_print_vdev_info(struct wlan_objmgr_vdev *vdev);
2280 #else
wlan_print_vdev_info(struct wlan_objmgr_vdev * vdev)2281 static inline void wlan_print_vdev_info(struct wlan_objmgr_vdev *vdev) {}
2282 #endif
2283 
2284 /**
2285  * wlan_objmgr_vdev_trace_init_lock() - Initialize trace lock
2286  * @vdev: vdev object pointer
2287  *
2288  * Return: void
2289  */
2290 #ifdef WLAN_OBJMGR_REF_ID_TRACE
2291 static inline void
wlan_objmgr_vdev_trace_init_lock(struct wlan_objmgr_vdev * vdev)2292 wlan_objmgr_vdev_trace_init_lock(struct wlan_objmgr_vdev *vdev)
2293 {
2294 	wlan_objmgr_trace_init_lock(&vdev->vdev_objmgr.trace);
2295 }
2296 #else
2297 static inline void
wlan_objmgr_vdev_trace_init_lock(struct wlan_objmgr_vdev * vdev)2298 wlan_objmgr_vdev_trace_init_lock(struct wlan_objmgr_vdev *vdev)
2299 {
2300 }
2301 #endif
2302 
2303 /**
2304  * wlan_objmgr_vdev_trace_deinit_lock() - Deinitialize trace lock
2305  * @vdev: vdev object pointer
2306  *
2307  * Return: void
2308  */
2309 #ifdef WLAN_OBJMGR_REF_ID_TRACE
2310 static inline void
wlan_objmgr_vdev_trace_deinit_lock(struct wlan_objmgr_vdev * vdev)2311 wlan_objmgr_vdev_trace_deinit_lock(struct wlan_objmgr_vdev *vdev)
2312 {
2313 	wlan_objmgr_trace_deinit_lock(&vdev->vdev_objmgr.trace);
2314 }
2315 #else
2316 static inline void
wlan_objmgr_vdev_trace_deinit_lock(struct wlan_objmgr_vdev * vdev)2317 wlan_objmgr_vdev_trace_deinit_lock(struct wlan_objmgr_vdev *vdev)
2318 {
2319 }
2320 #endif
2321 
2322 /**
2323  * wlan_objmgr_vdev_trace_del_ref_list() - Delete trace ref list
2324  * @vdev: vdev object pointer
2325  *
2326  * Return: void
2327  */
2328 #ifdef WLAN_OBJMGR_REF_ID_TRACE
2329 static inline void
wlan_objmgr_vdev_trace_del_ref_list(struct wlan_objmgr_vdev * vdev)2330 wlan_objmgr_vdev_trace_del_ref_list(struct wlan_objmgr_vdev *vdev)
2331 {
2332 	wlan_objmgr_trace_del_ref_list(&vdev->vdev_objmgr.trace);
2333 }
2334 #else
2335 static inline void
wlan_objmgr_vdev_trace_del_ref_list(struct wlan_objmgr_vdev * vdev)2336 wlan_objmgr_vdev_trace_del_ref_list(struct wlan_objmgr_vdev *vdev)
2337 {
2338 }
2339 #endif
2340 
2341 /**
2342  * wlan_vdev_get_bss_peer_mac_for_pmksa() - To get bss peer mac/mld
2343  * address based on association to cache/retrieve PMK.
2344  * @vdev: Pointer to vdev
2345  * @bss_peer_mac: Pointer to BSS peer MAC address.
2346  *
2347  * The PMKSA entry for an ML candaidate will be present with MLD
2348  * address, whereas for non-ML candidate legacy MAC address is used
2349  * to save the PMKSA. To get the right entry during lookup, this API
2350  * will return MLD address if the VDEV is MLO VDEV else return
2351  * MAC address of BSS peer.
2352  *
2353  * Return: QDF_STATUS
2354  */
2355 QDF_STATUS
2356 wlan_vdev_get_bss_peer_mac_for_pmksa(struct wlan_objmgr_vdev *vdev,
2357 				     struct qdf_mac_addr *bss_peer_mac);
2358 
2359 /**
2360  * wlan_vdev_get_bss_peer_mac() - to get bss peer mac address
2361  * @vdev: pointer to vdev
2362  * @bss_peer_mac: pointer to bss_peer_mac_address
2363  *
2364  * This API is used to get mac address of peer.
2365  *
2366  * Context: Any context.
2367  *
2368  * Return: QDF_STATUS based on overall success
2369  */
2370 QDF_STATUS wlan_vdev_get_bss_peer_mac(struct wlan_objmgr_vdev *vdev,
2371 				      struct qdf_mac_addr *bss_peer_mac);
2372 
2373 #ifdef WLAN_FEATURE_11BE_MLO
2374 /**
2375  * wlan_vdev_get_bss_peer_mld_mac() - to get bss peer mld mac address
2376  * @vdev: pointer to vdev
2377  * @mld_mac: pointer to mld mac address
2378  *
2379  * This API is used to get mld mac address of peer.
2380  *
2381  * Context: Any context.
2382  *
2383  * Return: QDF_STATUS based on overall success
2384  */
2385 QDF_STATUS wlan_vdev_get_bss_peer_mld_mac(struct wlan_objmgr_vdev *vdev,
2386 					  struct qdf_mac_addr *mld_mac);
2387 
2388 /**
2389  * wlan_vdev_get_mlo_dev_ctx() - get MLO dev context
2390  * @vdev: VDEV object
2391  *
2392  * API to get MLO dev context pointer from vdev
2393  *
2394  * Return: MLO dev context pointer
2395  */
wlan_vdev_get_mlo_dev_ctx(struct wlan_objmgr_vdev * vdev)2396 static inline struct wlan_mlo_dev_context *wlan_vdev_get_mlo_dev_ctx(
2397 				struct wlan_objmgr_vdev *vdev)
2398 {
2399 	return vdev->mlo_dev_ctx;
2400 }
2401 
2402 /**
2403  * wlan_objmgr_vdev_init_ml_peer_count() - initialize ml_peer_count
2404  * @vdev: vdev object pointer
2405  *
2406  * Return: void
2407  */
2408 static inline void
wlan_objmgr_vdev_init_ml_peer_count(struct wlan_objmgr_vdev * vdev)2409 wlan_objmgr_vdev_init_ml_peer_count(struct wlan_objmgr_vdev *vdev)
2410 {
2411 	qdf_atomic_init(&vdev->vdev_objmgr.wlan_ml_peer_count);
2412 }
2413 
2414 #else
2415 static inline
wlan_vdev_get_bss_peer_mld_mac(struct wlan_objmgr_vdev * vdev,struct qdf_mac_addr * mld_mac)2416 QDF_STATUS wlan_vdev_get_bss_peer_mld_mac(struct wlan_objmgr_vdev *vdev,
2417 					  struct qdf_mac_addr *mld_mac)
2418 {
2419 	return QDF_STATUS_E_INVAL;
2420 }
2421 
2422 static inline void
wlan_objmgr_vdev_init_ml_peer_count(struct wlan_objmgr_vdev * vdev)2423 wlan_objmgr_vdev_init_ml_peer_count(struct wlan_objmgr_vdev *vdev)
2424 {
2425 }
2426 
2427 static inline
wlan_vdev_mlme_is_tdls_vdev(struct wlan_objmgr_vdev * vdev)2428 bool wlan_vdev_mlme_is_tdls_vdev(struct wlan_objmgr_vdev *vdev)
2429 {
2430 	return false;
2431 }
2432 
2433 #endif
2434 
2435 /**
2436  * wlan_mlo_peer_delete_is_not_allowed()
2437  * @vdev: VDEV object
2438  *
2439  * API to check if WLAN_VDEV_OP_MLME_LEGACY_PEER_DISCON_TRIG is set therefore
2440  * whether mlo peer delete should be allowed or not
2441  *
2442  * Return: True if MLO peer delete is not allowed, otherwise false.
2443  */
wlan_mlo_peer_delete_is_not_allowed(struct wlan_objmgr_vdev * vdev)2444 static inline bool wlan_mlo_peer_delete_is_not_allowed(
2445 		struct wlan_objmgr_vdev *vdev)
2446 {
2447 	return wlan_vdev_mlme_op_flags_get(vdev,
2448 				WLAN_VDEV_OP_MLME_LEGACY_PEER_DISCON_TRIG);
2449 }
2450 
2451 #ifdef QCA_SUPPORT_PRIMARY_LINK_MIGRATE
2452 /**
2453  * wlan_vdev_init_skip_pumac_cnt() - init skip_pumac_cnt
2454  * @vdev: VDEV object
2455  *
2456  * API to initialize skip_pumac_cnt
2457  *
2458  * Return: void
2459  */
2460 static inline void
wlan_vdev_init_skip_pumac_cnt(struct wlan_objmgr_vdev * vdev)2461 wlan_vdev_init_skip_pumac_cnt(struct wlan_objmgr_vdev *vdev)
2462 {
2463 	qdf_atomic_init(&vdev->vdev_mlme.skip_pumac_cnt);
2464 }
2465 
2466 /**
2467  * wlan_vdev_inc_skip_pumac_cnt() - inc skip_pumac_cnt
2468  * @vdev: VDEV object
2469  *
2470  * API to increment skip_pumac_cnt
2471  *
2472  * Return: void
2473  */
2474 static inline void
wlan_vdev_inc_skip_pumac_cnt(struct wlan_objmgr_vdev * vdev)2475 wlan_vdev_inc_skip_pumac_cnt(struct wlan_objmgr_vdev *vdev)
2476 {
2477 	qdf_atomic_inc(&vdev->vdev_mlme.skip_pumac_cnt);
2478 }
2479 
2480 /**
2481  * wlan_vdev_dec_skip_pumac_cnt() - dec skip_pumac_cnt
2482  * @vdev: VDEV object
2483  *
2484  * API to decrement skip_pumac_cnt
2485  *
2486  * Return: void
2487  */
2488 static inline void
wlan_vdev_dec_skip_pumac_cnt(struct wlan_objmgr_vdev * vdev)2489 wlan_vdev_dec_skip_pumac_cnt(struct wlan_objmgr_vdev *vdev)
2490 {
2491 	qdf_atomic_dec(&vdev->vdev_mlme.skip_pumac_cnt);
2492 }
2493 
2494 /**
2495  * wlan_vdev_read_skip_pumac_cnt() - read skip_pumac_cnt
2496  * @vdev: VDEV object
2497  *
2498  * API to read skip_pumac_cnt value
2499  *
2500  * Return: skip_pumac_cnt value
2501  */
2502 static inline int32_t
wlan_vdev_read_skip_pumac_cnt(struct wlan_objmgr_vdev * vdev)2503 wlan_vdev_read_skip_pumac_cnt(struct wlan_objmgr_vdev *vdev)
2504 {
2505 	return qdf_atomic_read(&vdev->vdev_mlme.skip_pumac_cnt);
2506 }
2507 #else
2508 static inline void
wlan_vdev_init_skip_pumac_cnt(struct wlan_objmgr_vdev * vdev)2509 wlan_vdev_init_skip_pumac_cnt(struct wlan_objmgr_vdev *vdev)
2510 { }
2511 
2512 static inline void
wlan_vdev_inc_skip_pumac_cnt(struct wlan_objmgr_vdev * vdev)2513 wlan_vdev_inc_skip_pumac_cnt(struct wlan_objmgr_vdev *vdev)
2514 { }
2515 
2516 static inline void
wlan_vdev_dec_skip_pumac_cnt(struct wlan_objmgr_vdev * vdev)2517 wlan_vdev_dec_skip_pumac_cnt(struct wlan_objmgr_vdev *vdev)
2518 { }
2519 
2520 static inline int32_t
wlan_vdev_read_skip_pumac_cnt(struct wlan_objmgr_vdev * vdev)2521 wlan_vdev_read_skip_pumac_cnt(struct wlan_objmgr_vdev *vdev)
2522 {
2523 	return 0;
2524 }
2525 #endif
2526 
2527 /**
2528  * wlan_vdev_get_peer_sta_count: Get peer STA count
2529  * @vdev: Pointer to vdev
2530  *
2531  * Return: STA peer count
2532  */
2533 uint8_t wlan_vdev_get_peer_sta_count(struct wlan_objmgr_vdev *vdev);
2534 #endif /* _WLAN_OBJMGR_VDEV_OBJ_H_*/
2535