xref: /wlan-dirver/qca-wifi-host-cmn/os_if/linux/spectral/inc/wlan_cfg80211_spectral.h (revision 45a38684b07295822dc8eba39e293408f203eec8)
1 /*
2  * Copyright (c) 2017, 2019-2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: declares driver functions interfacing with linux kernel
21  */
22 
23 #ifndef _WLAN_CFG80211_SPECTRAL_H_
24 #define _WLAN_CFG80211_SPECTRAL_H_
25 
26 #include <linux/version.h>
27 #include <linux/netdevice.h>
28 #include <net/cfg80211.h>
29 #include <qca_vendor.h>
30 #include <qdf_list.h>
31 #include <qdf_types.h>
32 #include <spectral_ioctl.h>
33 #include <wlan_spectral_public_structs.h>
34 
35 extern const struct nla_policy
36 	spectral_scan_policy
37 	[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_MAX + 1];
38 
39 #define CONFIG_REQUESTED(type)    ((type == \
40 	QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE_SCAN_AND_CONFIG) || \
41 	(type == QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE_CONFIG))
42 
43 #define SCAN_REQUESTED(type)    ((type == \
44 	QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE_SCAN_AND_CONFIG) || \
45 	(type == QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE_SCAN))
46 
47 /**
48  * wlan_cfg80211_register_spectral_cmd_handler() - Registration api for spectral
49  * @pdev:    Pointer to pdev
50  * @idx:     Index in function table
51  * @handler: Pointer to handler
52  *
53  * Return: 0 on success, negative value on failure
54  */
55 void wlan_cfg80211_register_spectral_cmd_handler(
56 			struct wlan_objmgr_pdev *pdev,
57 			struct spectral_cfg80211_vendor_cmd_handlers *handlers);
58 
59 /**
60  * wlan_cfg80211_spectral_scan_config_and_start() - Start spectral scan
61  * @wiphy:    Pointer to wiphy
62  * @pdev:     Pointer to pdev
63  * @vdev:     Pointer to vdev
64  * @data:     Reference to data
65  * @data_len: Length of @data
66  *
67  * Return: 0 on success, negative value on failure
68  */
69 int wlan_cfg80211_spectral_scan_config_and_start(struct wiphy *wiphy,
70 						 struct wlan_objmgr_pdev *pdev,
71 						 struct wlan_objmgr_vdev *vdev,
72 						 const void *data,
73 						 int data_len);
74 
75 /**
76  * wlan_cfg80211_spectral_scan_stop() - Stop spectral scan
77  * @wiphy:    Pointer to wiphy
78  * @pdev:     Pointer to pdev
79  * @vdev:     Pointer to vdev
80  * @data:     Reference to data
81  * @data_len: Length of @data
82  *
83  * Return: 0 on success, negative value on failure
84  */
85 int wlan_cfg80211_spectral_scan_stop(struct wiphy *wiphy,
86 				     struct wlan_objmgr_pdev *pdev,
87 				     struct wlan_objmgr_vdev *vdev,
88 				     const void *data,
89 				     int data_len);
90 
91 /**
92  * wlan_cfg80211_spectral_scan_get_config() - Get spectral scan config
93  * @wiphy:    Pointer to wiphy
94  * @pdev:     Pointer to pdev
95  * @vdev:     Pointer to vdev
96  * @data:     Reference to data
97  * @data_len: Length of @data
98  *
99  * Return: 0 on success, negative value on failure
100  */
101 int wlan_cfg80211_spectral_scan_get_config(struct wiphy *wiphy,
102 					   struct wlan_objmgr_pdev *pdev,
103 					   struct wlan_objmgr_vdev *vdev,
104 					   const void *data,
105 					   int data_len);
106 
107 /**
108  * wlan_cfg80211_spectral_scan_get_cap() - Get spectral system capabilities
109  * @wiphy:    Pointer to wiphy
110  * @pdev:     Pointer to pdev
111  * @vdev:     Pointer to vdev
112  * @data:     Reference to data
113  * @data_len: Length of @data
114  *
115  * Return: 0 on success, negative value on failure
116  */
117 int wlan_cfg80211_spectral_scan_get_cap(struct wiphy *wiphy,
118 					struct wlan_objmgr_pdev *pdev,
119 					struct wlan_objmgr_vdev *vdev,
120 					const void *data,
121 					int data_len);
122 
123 /**
124  * wlan_cfg80211_spectral_scan_get_diag_stats() - Get spectral diag stats
125  * @wiphy:    Pointer to wiphy
126  * @pdev:     Pointer to pdev
127  * @vdev:     Pointer to vdev
128  * @data:     Reference to data
129  * @data_len: Length of @data
130  *
131  * Return: 0 on success, negative value on failure
132  */
133 int wlan_cfg80211_spectral_scan_get_diag_stats(struct wiphy *wiphy,
134 					       struct wlan_objmgr_pdev *pdev,
135 					       struct wlan_objmgr_vdev *vdev,
136 					       const void *data,
137 					       int data_len);
138 
139 /**
140  * wlan_cfg80211_spectral_scan_get_status() - Get spectral scan status
141  * @wiphy:    Pointer to wiphy
142  * @pdev:     Pointer to pdev
143  * @vdev:     Pointer to vdev
144  * @data:     Reference to data
145  * @data_len: Length of @data
146  *
147  * Return: 0 on success, negative value on failure
148  */
149 int wlan_cfg80211_spectral_scan_get_status(struct wiphy *wiphy,
150 					   struct wlan_objmgr_pdev *pdev,
151 					   struct wlan_objmgr_vdev *vdev,
152 					   const void *data,
153 					   int data_len);
154 
155 /**
156  * wlan_cfg80211_spectral_scan_dma_debug_config() - configure DMA debug
157  * @pdev:       Pointer to pdev
158  * @vdev:       Pointer to vdev
159  * @tb:         Pointer to Spectral Scan config attribute
160  * @sscan_mode: Spectral scan mode
161  *
162  * Return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure
163  */
164 QDF_STATUS wlan_cfg80211_spectral_scan_dma_debug_config(
165 		struct wlan_objmgr_pdev *pdev,
166 		struct wlan_objmgr_vdev *vdev,
167 		struct nlattr **tb,
168 		enum spectral_scan_mode sscan_mode);
169 #endif
170