1 /*
2  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. 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: contains definitions for NAN component
19  */
20 
21 #include "nan_public_structs.h"
22 #include "wlan_nan_api.h"
23 #include "../../core/src/nan_main_i.h"
24 #include "wlan_objmgr_vdev_obj.h"
25 #include "wlan_nan_api_i.h"
26 #include "cfg_nan_api.h"
27 
wlan_nan_get_ndi_state(struct wlan_objmgr_vdev * vdev)28 inline enum nan_datapath_state wlan_nan_get_ndi_state(
29 					struct wlan_objmgr_vdev *vdev)
30 {
31 	enum nan_datapath_state val;
32 	struct nan_vdev_priv_obj *priv_obj = nan_get_vdev_priv_obj(vdev);
33 
34 	if (!priv_obj) {
35 		nan_err("priv_obj is null");
36 		return NAN_DATA_INVALID_STATE;
37 	}
38 
39 	qdf_spin_lock_bh(&priv_obj->lock);
40 	val = priv_obj->state;
41 	qdf_spin_unlock_bh(&priv_obj->lock);
42 
43 	return val;
44 }
45 
wlan_nan_get_vdev_id_from_bssid(struct wlan_objmgr_pdev * pdev,tSirMacAddr bssid,wlan_objmgr_ref_dbgid dbg_id)46 uint8_t wlan_nan_get_vdev_id_from_bssid(struct wlan_objmgr_pdev *pdev,
47 					tSirMacAddr bssid,
48 					wlan_objmgr_ref_dbgid dbg_id)
49 {
50 	return nan_get_vdev_id_from_bssid(pdev, bssid, dbg_id);
51 }
52 
wlan_nan_is_disc_active(struct wlan_objmgr_psoc * psoc)53 bool wlan_nan_is_disc_active(struct wlan_objmgr_psoc *psoc)
54 {
55 	return nan_is_disc_active(psoc);
56 }
57 
wlan_nan_is_eht_capable(struct wlan_objmgr_psoc * psoc)58 bool wlan_nan_is_eht_capable(struct wlan_objmgr_psoc *psoc)
59 {
60 	return cfg_nan_is_eht_cap_enable(psoc);
61 }
62