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 #ifndef _SPECTRAL_DEFS_I_H_ 21 #define _SPECTRAL_DEFS_I_H_ 22 23 #include <wlan_objmgr_cmn.h> 24 #include <wlan_objmgr_global_obj.h> 25 #include <wlan_objmgr_psoc_obj.h> 26 #include <wlan_objmgr_pdev_obj.h> 27 #include <wlan_objmgr_vdev_obj.h> 28 #include <qdf_list.h> 29 #include <qdf_timer.h> 30 #include <qdf_util.h> 31 #include <wlan_spectral_public_structs.h> 32 #include <wlan_spectral_utils_api.h> 33 #include <spectral_ioctl.h> 34 35 #define spectral_fatal(format, args...) \ 36 QDF_TRACE_FATAL(QDF_MODULE_ID_SPECTRAL, format, ## args) 37 #define spectral_err(format, args...) \ 38 QDF_TRACE_ERROR(QDF_MODULE_ID_SPECTRAL, format, ## args) 39 #define spectral_warn(format, args...) \ 40 QDF_TRACE_WARN(QDF_MODULE_ID_SPECTRAL, format, ## args) 41 #define spectral_info(format, args...) \ 42 QDF_TRACE_INFO(QDF_MODULE_ID_SPECTRAL, format, ## args) 43 #define spectral_debug(format, args...) \ 44 QDF_TRACE_DEBUG(QDF_MODULE_ID_SPECTRAL, format, ## args) 45 46 #define spectral_fatal_nofl(format, args...) \ 47 QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 48 #define spectral_err_nofl(format, args...) \ 49 QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 50 #define spectral_warn_nofl(format, args...) \ 51 QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 52 #define spectral_info_nofl(format, args...) \ 53 QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 54 #define spectral_debug_nofl(format, args...) \ 55 QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 56 57 #define spectral_fatal_rl(format, args...) \ 58 QDF_TRACE_FATAL_RL(QDF_MODULE_ID_SPECTRAL, format, ## args) 59 #define spectral_err_rl(format, args...) \ 60 QDF_TRACE_ERROR_RL(QDF_MODULE_ID_SPECTRAL, format, ## args) 61 #define spectral_warn_rl(format, args...) \ 62 QDF_TRACE_WARN_RL(QDF_MODULE_ID_SPECTRAL, format, ## args) 63 #define spectral_info_rl(format, args...) \ 64 QDF_TRACE_INFO_RL(QDF_MODULE_ID_SPECTRAL, format, ## args) 65 #define spectral_debug_rl(format, args...) \ 66 QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_SPECTRAL, format, ## args) 67 68 #define spectral_fatal_rl_nofl(format, args...) \ 69 QDF_TRACE_FATAL_RL_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 70 #define spectral_err_rl_nofl(format, args...) \ 71 QDF_TRACE_ERROR_RL_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 72 #define spectral_warn_rl_nofl(format, args...) \ 73 QDF_TRACE_WARN_RL_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 74 #define spectral_info_rl_nofl(format, args...) \ 75 QDF_TRACE_INFO_RL_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 76 #define spectral_debug_rl_nofl(format, args...) \ 77 QDF_TRACE_DEBUG_RL_NO_FL(QDF_MODULE_ID_SPECTRAL, format, ## args) 78 79 /** 80 * struct pdev_spectral - Radio specific spectral object 81 * @psptrl_pdev: Back-pointer to struct wlan_objmgr_pdev 82 * @spectral_sock: Spectral Netlink socket for sending samples to 83 * applications 84 * @psptrl_target_handle: reference to spectral lmac object 85 * @skb: Socket buffer for sending samples to applications 86 * @spectral_pid : Spectral port ID 87 */ 88 struct pdev_spectral { 89 struct wlan_objmgr_pdev *psptrl_pdev; 90 struct sock *spectral_sock; 91 void *psptrl_target_handle; 92 struct sk_buff *skb; 93 uint32_t spectral_pid; 94 }; 95 96 struct wmi_spectral_cmd_ops; 97 /** 98 * struct spectral_context - spectral global context 99 * @psoc_obj: Reference to psoc global object 100 * @spectral_legacy_cbacks: Spectral legacy callbacks 101 * 102 * Call back functions to invoke independent of OL/DA 103 * @sptrlc_ucfg_phyerr_config: ucfg handler for phyerr 104 * @sptrlc_pdev_spectral_init: Init spectral 105 * @sptrlc_pdev_spectral_deinit: Deinit spectral 106 * @sptrlc_set_spectral_config: Set spectral configurations 107 * @sptrlc_get_spectral_config: Get spectral configurations 108 * @sptrlc_start_spectral_scan: Start spectral scan 109 * @sptrlc_stop_spectral_scan: Stop spectral scan 110 * @sptrlc_is_spectral_active: Check if spectral scan is active 111 * @sptrlc_is_spectral_enabled: Check if spectral is enabled 112 * @sptrlc_set_debug_level: Set debug level 113 * @sptrlc_get_debug_level: Get debug level 114 * @sptrlc_get_spectral_capinfo: Get spectral capability info 115 * @sptrlc_get_spectral_diagstats: Get spectral diag status 116 * @sptrlc_register_wmi_spectral_cmd_ops: Register wmi_spectral_cmd operations 117 * @sptrlc_register_netlink_cb: Register Netlink callbacks 118 * @sptrlc_use_nl_bcast: Check whether to use Netlink broadcast/unicast 119 * @sptrlc_deregister_netlink_cb: De-register Netlink callbacks 120 * @sptrlc_process_spectral_report: Process spectral report 121 */ 122 struct spectral_context { 123 struct wlan_objmgr_psoc *psoc_obj; 124 struct spectral_legacy_cbacks legacy_cbacks; 125 int (*sptrlc_spectral_control)(struct wlan_objmgr_pdev *pdev, 126 u_int id, void *indata, 127 uint32_t insize, void *outdata, 128 uint32_t *outsize); 129 int (*sptrlc_ucfg_phyerr_config)(struct wlan_objmgr_pdev *pdev, 130 void *ad); 131 void * (*sptrlc_pdev_spectral_init)(struct wlan_objmgr_pdev *pdev); 132 void (*sptrlc_pdev_spectral_deinit)(struct wlan_objmgr_pdev *pdev); 133 int (*sptrlc_set_spectral_config)(struct wlan_objmgr_pdev *pdev, 134 const uint32_t threshtype, 135 const uint32_t value); 136 void (*sptrlc_get_spectral_config)( 137 struct wlan_objmgr_pdev *pdev, 138 struct spectral_config *sptrl_config); 139 int (*sptrlc_start_spectral_scan)(struct wlan_objmgr_pdev *pdev); 140 void (*sptrlc_stop_spectral_scan)(struct wlan_objmgr_pdev *pdev); 141 bool (*sptrlc_is_spectral_active)(struct wlan_objmgr_pdev *pdev); 142 bool (*sptrlc_is_spectral_enabled)(struct wlan_objmgr_pdev *pdev); 143 int (*sptrlc_set_debug_level)(struct wlan_objmgr_pdev *pdev, 144 uint32_t debug_level); 145 uint32_t (*sptrlc_get_debug_level)(struct wlan_objmgr_pdev *pdev); 146 void (*sptrlc_get_spectral_capinfo)(struct wlan_objmgr_pdev *pdev, 147 void *outdata); 148 void (*sptrlc_get_spectral_diagstats)(struct wlan_objmgr_pdev *pdev, 149 void *outdata); 150 void (*sptrlc_register_wmi_spectral_cmd_ops)( 151 struct wlan_objmgr_pdev *pdev, 152 struct wmi_spectral_cmd_ops *cmd_ops); 153 void (*sptrlc_register_netlink_cb)( 154 struct wlan_objmgr_pdev *pdev, 155 struct spectral_nl_cb *nl_cb); 156 bool (*sptrlc_use_nl_bcast)(struct wlan_objmgr_pdev *pdev); 157 void (*sptrlc_deregister_netlink_cb)(struct wlan_objmgr_pdev *pdev); 158 int (*sptrlc_process_spectral_report)( 159 struct wlan_objmgr_pdev *pdev, 160 void *payload); 161 }; 162 163 #endif /* _SPECTRAL_DEFS_I_H_ */ 164