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