xref: /wlan-driver/qca-wifi-host-cmn/wmi/src/wmi_unified_dfs_api.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2017-2019, 2021 The Linux Foundation. All rights reserved.
3  *
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: Implement API's specific to DFS component.
22  */
23 
24 #include <qdf_status.h>
25 #include <qdf_module.h>
26 #include <wmi_unified_api.h>
27 #include <wmi_unified_priv.h>
28 #include <wlan_objmgr_vdev_obj.h>
29 #include <wlan_dfs_utils_api.h>
30 #include <wmi_unified_dfs_api.h>
31 #include <init_deinit_lmac.h>
32 
wmi_extract_dfs_cac_complete_event(wmi_unified_t wmi_handle,uint8_t * evt_buf,uint32_t * vdev_id,uint32_t len)33 QDF_STATUS wmi_extract_dfs_cac_complete_event(
34 		wmi_unified_t wmi_handle,
35 		uint8_t *evt_buf,
36 		uint32_t *vdev_id,
37 		uint32_t len)
38 {
39 	if (wmi_handle && wmi_handle->ops->extract_dfs_cac_complete_event)
40 		return wmi_handle->ops->extract_dfs_cac_complete_event(
41 				wmi_handle, evt_buf, vdev_id, len);
42 
43 	return QDF_STATUS_E_FAILURE;
44 }
45 qdf_export_symbol(wmi_extract_dfs_cac_complete_event);
46 
47 QDF_STATUS
wmi_extract_dfs_ocac_complete_event(wmi_unified_t wmi_handle,uint8_t * evt_buf,struct vdev_adfs_complete_status * param)48 wmi_extract_dfs_ocac_complete_event(wmi_unified_t wmi_handle,
49 				    uint8_t *evt_buf,
50 				    struct vdev_adfs_complete_status *param)
51 {
52 	if (wmi_handle && wmi_handle->ops->extract_dfs_ocac_complete_event)
53 		return wmi_handle->ops->extract_dfs_ocac_complete_event(
54 				wmi_handle, evt_buf, param);
55 
56 	return QDF_STATUS_E_FAILURE;
57 }
58 
59 qdf_export_symbol(wmi_extract_dfs_ocac_complete_event);
60 
wmi_extract_dfs_radar_detection_event(wmi_unified_t wmi_handle,uint8_t * evt_buf,struct radar_found_info * radar_found,uint32_t len)61 QDF_STATUS wmi_extract_dfs_radar_detection_event(
62 		wmi_unified_t wmi_handle,
63 		uint8_t *evt_buf,
64 		struct radar_found_info *radar_found,
65 		uint32_t len)
66 {
67 	if (wmi_handle && wmi_handle->ops->extract_dfs_radar_detection_event)
68 		return wmi_handle->ops->extract_dfs_radar_detection_event(
69 				wmi_handle, evt_buf, radar_found, len);
70 
71 	return QDF_STATUS_E_FAILURE;
72 }
73 
74 #ifdef MOBILE_DFS_SUPPORT
wmi_extract_wlan_radar_event_info(wmi_unified_t wmi_handle,uint8_t * evt_buf,struct radar_event_info * wlan_radar_event,uint32_t len)75 QDF_STATUS wmi_extract_wlan_radar_event_info(
76 		wmi_unified_t wmi_handle,
77 		uint8_t *evt_buf,
78 		struct radar_event_info *wlan_radar_event,
79 		uint32_t len)
80 {
81 	if (wmi_handle->ops->extract_wlan_radar_event_info)
82 		return wmi_handle->ops->extract_wlan_radar_event_info(
83 				wmi_handle, evt_buf, wlan_radar_event, len);
84 
85 	return QDF_STATUS_E_FAILURE;
86 }
87 qdf_export_symbol(wmi_extract_dfs_radar_detection_event);
88 #endif
89 
90 #if defined(WLAN_DFS_FULL_OFFLOAD) && defined(QCA_DFS_NOL_OFFLOAD)
wmi_send_usenol_pdev_param(wmi_unified_t wmi_handle,bool usenol,struct wlan_objmgr_pdev * pdev)91 QDF_STATUS wmi_send_usenol_pdev_param(wmi_unified_t wmi_handle, bool usenol,
92 				      struct wlan_objmgr_pdev *pdev)
93 {
94 	struct pdev_params pparam;
95 	int pdev_idx;
96 
97 	pdev_idx = lmac_get_pdev_idx(pdev);
98 	if (pdev_idx < 0)
99 		return QDF_STATUS_E_FAILURE;
100 
101 	qdf_mem_zero(&pparam, sizeof(pparam));
102 	pparam.param_id = wmi_pdev_param_use_nol;
103 	pparam.param_value = usenol;
104 
105 	return wmi_unified_pdev_param_send(wmi_handle, &pparam, pdev_idx);
106 }
107 
108 QDF_STATUS
wmi_send_subchan_marking_pdev_param(wmi_unified_t wmi_handle,bool subchanmark,struct wlan_objmgr_pdev * pdev)109 wmi_send_subchan_marking_pdev_param(wmi_unified_t wmi_handle,
110 				    bool subchanmark,
111 				    struct wlan_objmgr_pdev *pdev)
112 {
113 	struct pdev_params pparam;
114 	int pdev_idx;
115 
116 	pdev_idx = lmac_get_pdev_idx(pdev);
117 	if (pdev_idx < 0)
118 		return QDF_STATUS_E_FAILURE;
119 
120 	qdf_mem_zero(&pparam, sizeof(pparam));
121 	pparam.param_id = wmi_pdev_param_sub_channel_marking;
122 	pparam.param_value = subchanmark;
123 
124 	return wmi_unified_pdev_param_send(wmi_handle, &pparam, pdev_idx);
125 }
126 
127 #endif
128