xref: /wlan-dirver/qca-wifi-host-cmn/wmi/src/wmi_unified_dfs_api.c (revision dd4dc88b837a295134aa9869114a2efee0f4894b)
1 /*
2  * Copyright (c) 2017-2019 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 
33 QDF_STATUS wmi_extract_dfs_cac_complete_event(void *wmi_hdl,
34 		uint8_t *evt_buf,
35 		uint32_t *vdev_id,
36 		uint32_t len)
37 {
38 	struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl;
39 
40 	if (wmi_handle && wmi_handle->ops->extract_dfs_cac_complete_event)
41 		return wmi_handle->ops->extract_dfs_cac_complete_event(
42 				wmi_handle, evt_buf, vdev_id, len);
43 
44 	return QDF_STATUS_E_FAILURE;
45 }
46 qdf_export_symbol(wmi_extract_dfs_cac_complete_event);
47 
48 QDF_STATUS
49 wmi_extract_dfs_ocac_complete_event(void *wmi_hdl,
50 				    uint8_t *evt_buf,
51 				    struct vdev_adfs_complete_status *param)
52 {
53 	struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl;
54 
55 	if (wmi_handle && wmi_handle->ops->extract_dfs_ocac_complete_event)
56 		return wmi_handle->ops->extract_dfs_ocac_complete_event(
57 				wmi_handle, evt_buf, param);
58 
59 	return QDF_STATUS_E_FAILURE;
60 }
61 
62 qdf_export_symbol(wmi_extract_dfs_ocac_complete_event);
63 
64 QDF_STATUS wmi_extract_dfs_radar_detection_event(void *wmi_hdl,
65 		uint8_t *evt_buf,
66 		struct radar_found_info *radar_found,
67 		uint32_t len)
68 {
69 	struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl;
70 
71 	if (wmi_handle && wmi_handle->ops->extract_dfs_radar_detection_event)
72 		return wmi_handle->ops->extract_dfs_radar_detection_event(
73 				wmi_handle, evt_buf, radar_found, len);
74 
75 	return QDF_STATUS_E_FAILURE;
76 }
77 
78 #ifdef QCA_MCL_DFS_SUPPORT
79 QDF_STATUS wmi_extract_wlan_radar_event_info(void *wmi_hdl,
80 		uint8_t *evt_buf,
81 		struct radar_event_info *wlan_radar_event,
82 		uint32_t len)
83 {
84 	struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl;
85 
86 	if (wmi_handle->ops->extract_wlan_radar_event_info)
87 		return wmi_handle->ops->extract_wlan_radar_event_info(
88 				wmi_handle, evt_buf, wlan_radar_event, len);
89 
90 	return QDF_STATUS_E_FAILURE;
91 }
92 qdf_export_symbol(wmi_extract_dfs_radar_detection_event);
93 #endif
94 
95 #if defined(WLAN_DFS_FULL_OFFLOAD) && defined(QCA_DFS_NOL_OFFLOAD)
96 QDF_STATUS wmi_send_usenol_pdev_param(void *wmi_hdl, bool usenol,
97 				      struct wlan_objmgr_pdev *pdev)
98 {
99 	struct pdev_params pparam;
100 	int pdev_idx;
101 	struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl;
102 
103 	pdev_idx = lmac_get_pdev_idx(pdev);
104 	if (pdev_idx < 0)
105 		return QDF_STATUS_E_FAILURE;
106 
107 	qdf_mem_zero(&pparam, sizeof(pparam));
108 	pparam.param_id = wmi_pdev_param_use_nol;
109 	pparam.param_value = usenol;
110 
111 	return wmi_unified_pdev_param_send(wmi_handle, &pparam, pdev_idx);
112 }
113 
114 QDF_STATUS
115 wmi_send_subchan_marking_pdev_param(void *wmi_hdl,
116 				    bool subchanmark,
117 				    struct wlan_objmgr_pdev *pdev)
118 {
119 	struct pdev_params pparam;
120 	int pdev_idx;
121 	struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl;
122 
123 	pdev_idx = lmac_get_pdev_idx(pdev);
124 	if (pdev_idx < 0)
125 		return QDF_STATUS_E_FAILURE;
126 
127 	qdf_mem_zero(&pparam, sizeof(pparam));
128 	pparam.param_id = wmi_pdev_param_sub_channel_marking;
129 	pparam.param_value = subchanmark;
130 
131 	return wmi_unified_pdev_param_send(wmi_handle, &pparam, pdev_idx);
132 }
133 
134 #endif
135