xref: /wlan-driver/qcacld-3.0/components/p2p/dispatcher/src/wlan_p2p_cfg.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2024 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: This file contains p2p configures interface definitions
22  */
23 
24 #include <wlan_objmgr_psoc_obj.h>
25 #include "wlan_p2p_public_struct.h"
26 #include "wlan_p2p_cfg_api.h"
27 #include "../../core/src/wlan_p2p_main.h"
28 #include "wlan_mlme_ucfg_api.h"
29 
30 static inline struct p2p_soc_priv_obj *
wlan_psoc_get_p2p_object(struct wlan_objmgr_psoc * psoc)31 wlan_psoc_get_p2p_object(struct wlan_objmgr_psoc *psoc)
32 {
33 	return wlan_objmgr_psoc_get_comp_private_obj(psoc,
34 					WLAN_UMAC_COMP_P2P);
35 }
36 
37 QDF_STATUS
cfg_p2p_get_go_keepalive_period(struct wlan_objmgr_psoc * psoc,uint32_t * period)38 cfg_p2p_get_go_keepalive_period(struct wlan_objmgr_psoc *psoc,
39 				uint32_t *period)
40 {
41 	struct p2p_soc_priv_obj *p2p_soc_obj;
42 
43 	p2p_soc_obj = wlan_psoc_get_p2p_object(psoc);
44 	if (!p2p_soc_obj) {
45 		*period = 0;
46 		p2p_err("p2p psoc null");
47 		return QDF_STATUS_E_INVAL;
48 	}
49 
50 	*period = p2p_soc_obj->param.go_keepalive_period;
51 
52 	return QDF_STATUS_SUCCESS;
53 }
54 
55 QDF_STATUS
cfg_p2p_get_go_link_monitor_period(struct wlan_objmgr_psoc * psoc,uint32_t * period)56 cfg_p2p_get_go_link_monitor_period(struct wlan_objmgr_psoc *psoc,
57 				   uint32_t *period)
58 {
59 	struct p2p_soc_priv_obj *p2p_soc_obj;
60 
61 	p2p_soc_obj = wlan_psoc_get_p2p_object(psoc);
62 	if (!p2p_soc_obj) {
63 		*period = 0;
64 		p2p_err("p2p psoc null");
65 		return QDF_STATUS_E_INVAL;
66 	}
67 
68 	*period = p2p_soc_obj->param.go_link_monitor_period;
69 
70 	return QDF_STATUS_SUCCESS;
71 }
72 
73 QDF_STATUS
cfg_p2p_get_device_addr_admin(struct wlan_objmgr_psoc * psoc,bool * enable)74 cfg_p2p_get_device_addr_admin(struct wlan_objmgr_psoc *psoc,
75 			      bool *enable)
76 {
77 	struct p2p_soc_priv_obj *p2p_soc_obj;
78 
79 	p2p_soc_obj = wlan_psoc_get_p2p_object(psoc);
80 	if (!p2p_soc_obj) {
81 		*enable = false;
82 		p2p_err("p2p psoc null");
83 		return QDF_STATUS_E_INVAL;
84 	}
85 
86 	*enable = p2p_soc_obj->param.p2p_device_addr_admin;
87 
88 	return QDF_STATUS_SUCCESS;
89 }
90 
cfg_p2p_is_roam_config_disabled(struct wlan_objmgr_psoc * psoc)91 bool cfg_p2p_is_roam_config_disabled(struct wlan_objmgr_psoc *psoc)
92 {
93 	uint32_t sta_roam_disable = 0;
94 
95 	if (ucfg_mlme_get_roam_disable_config(psoc, &sta_roam_disable) ==
96 	    QDF_STATUS_SUCCESS)
97 		return sta_roam_disable & LFR3_STA_ROAM_DISABLE_BY_P2P;
98 
99 	return false;
100 }
101 
102 bool
cfg_p2p_is_go_ignore_non_p2p_probe_req(struct wlan_objmgr_psoc * psoc)103 cfg_p2p_is_go_ignore_non_p2p_probe_req(struct wlan_objmgr_psoc *psoc)
104 {
105 	struct p2p_soc_priv_obj *p2p_soc_obj;
106 
107 	p2p_soc_obj = wlan_psoc_get_p2p_object(psoc);
108 	if (!p2p_soc_obj) {
109 		p2p_err("p2p psoc null");
110 		return false;
111 	}
112 
113 	return p2p_soc_obj->param.go_ignore_non_p2p_probe_req;
114 }
115 
116