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 wmi_extract_dfs_radar_detection_event(void *wmi_hdl, 49 uint8_t *evt_buf, 50 struct radar_found_info *radar_found, 51 uint32_t len) 52 { 53 struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl; 54 55 if (wmi_handle && wmi_handle->ops->extract_dfs_radar_detection_event) 56 return wmi_handle->ops->extract_dfs_radar_detection_event( 57 wmi_handle, evt_buf, radar_found, len); 58 59 return QDF_STATUS_E_FAILURE; 60 } 61 62 #ifdef QCA_MCL_DFS_SUPPORT 63 QDF_STATUS wmi_extract_wlan_radar_event_info(void *wmi_hdl, 64 uint8_t *evt_buf, 65 struct radar_event_info *wlan_radar_event, 66 uint32_t len) 67 { 68 struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl; 69 70 if (wmi_handle->ops->extract_wlan_radar_event_info) 71 return wmi_handle->ops->extract_wlan_radar_event_info( 72 wmi_handle, evt_buf, wlan_radar_event, len); 73 74 return QDF_STATUS_E_FAILURE; 75 } 76 qdf_export_symbol(wmi_extract_dfs_radar_detection_event); 77 #endif 78 79 #if defined(WLAN_DFS_FULL_OFFLOAD) && defined(QCA_DFS_NOL_OFFLOAD) 80 QDF_STATUS wmi_send_usenol_pdev_param(void *wmi_hdl, bool usenol, 81 struct wlan_objmgr_pdev *pdev) 82 { 83 struct pdev_params pparam; 84 int pdev_idx; 85 struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl; 86 87 pdev_idx = lmac_get_pdev_idx(pdev); 88 if (pdev_idx < 0) 89 return QDF_STATUS_E_FAILURE; 90 91 qdf_mem_set(&pparam, sizeof(pparam), 0); 92 pparam.param_id = wmi_pdev_param_use_nol; 93 pparam.param_value = usenol; 94 95 return wmi_unified_pdev_param_send(wmi_handle, &pparam, pdev_idx); 96 } 97 98 QDF_STATUS 99 wmi_send_subchan_marking_pdev_param(void *wmi_hdl, 100 bool subchanmark, 101 struct wlan_objmgr_pdev *pdev) 102 { 103 struct pdev_params pparam; 104 int pdev_idx; 105 struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl; 106 107 pdev_idx = lmac_get_pdev_idx(pdev); 108 if (pdev_idx < 0) 109 return QDF_STATUS_E_FAILURE; 110 111 qdf_mem_set(&pparam, sizeof(pparam), 0); 112 pparam.param_id = wmi_pdev_param_sub_channel_marking; 113 pparam.param_value = subchanmark; 114 115 return wmi_unified_pdev_param_send(wmi_handle, &pparam, pdev_idx); 116 } 117 118 #endif 119