xref: /wlan-dirver/qca-wifi-host-cmn/os_if/linux/spectral/inc/wlan_cfg80211_spectral.h (revision 2f4b444fb7e689b83a4ab0e7b3b38f0bf4def8e0)
1 /*
2  * Copyright (c) 2017, 2019-2021 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 extern const struct nla_policy
40 	spectral_scan_get_status_policy
41 	[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_STATUS_MAX + 1];
42 
43 #define CONFIG_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_CONFIG))
46 
47 #define SCAN_REQUESTED(type)    ((type == \
48 	QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE_SCAN_AND_CONFIG) || \
49 	(type == QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE_SCAN))
50 
51 /**
52  * wlan_cfg80211_register_spectral_cmd_handler() - Registration api for spectral
53  * @pdev:    Pointer to pdev
54  * @idx:     Index in function table
55  * @handler: Pointer to handler
56  *
57  * Return: 0 on success, negative value on failure
58  */
59 void wlan_cfg80211_register_spectral_cmd_handler(
60 			struct wlan_objmgr_pdev *pdev,
61 			struct spectral_cfg80211_vendor_cmd_handlers *handlers);
62 
63 /**
64  * wlan_cfg80211_spectral_scan_config_and_start() - Start spectral scan
65  * @wiphy:    Pointer to wiphy
66  * @pdev:     Pointer to pdev
67  * @vdev:     Pointer to vdev
68  * @data:     Reference to data
69  * @data_len: Length of @data
70  *
71  * Return: 0 on success, negative value on failure
72  */
73 int wlan_cfg80211_spectral_scan_config_and_start(struct wiphy *wiphy,
74 						 struct wlan_objmgr_pdev *pdev,
75 						 struct wlan_objmgr_vdev *vdev,
76 						 const void *data,
77 						 int data_len);
78 
79 /**
80  * wlan_cfg80211_spectral_scan_stop() - Stop spectral scan
81  * @wiphy:    Pointer to wiphy
82  * @pdev:     Pointer to pdev
83  * @vdev:     Pointer to vdev
84  * @data:     Reference to data
85  * @data_len: Length of @data
86  *
87  * Return: 0 on success, negative value on failure
88  */
89 int wlan_cfg80211_spectral_scan_stop(struct wiphy *wiphy,
90 				     struct wlan_objmgr_pdev *pdev,
91 				     struct wlan_objmgr_vdev *vdev,
92 				     const void *data,
93 				     int data_len);
94 
95 /**
96  * wlan_cfg80211_spectral_scan_get_config() - Get spectral scan config
97  * @wiphy:    Pointer to wiphy
98  * @pdev:     Pointer to pdev
99  * @vdev:     Pointer to vdev
100  * @data:     Reference to data
101  * @data_len: Length of @data
102  *
103  * Return: 0 on success, negative value on failure
104  */
105 int wlan_cfg80211_spectral_scan_get_config(struct wiphy *wiphy,
106 					   struct wlan_objmgr_pdev *pdev,
107 					   struct wlan_objmgr_vdev *vdev,
108 					   const void *data,
109 					   int data_len);
110 
111 /**
112  * wlan_cfg80211_spectral_scan_get_cap() - Get spectral system capabilities
113  * @wiphy:    Pointer to wiphy
114  * @pdev:     Pointer to pdev
115  * @vdev:     Pointer to vdev
116  * @data:     Reference to data
117  * @data_len: Length of @data
118  *
119  * Return: 0 on success, negative value on failure
120  */
121 int wlan_cfg80211_spectral_scan_get_cap(struct wiphy *wiphy,
122 					struct wlan_objmgr_pdev *pdev,
123 					struct wlan_objmgr_vdev *vdev,
124 					const void *data,
125 					int data_len);
126 
127 /**
128  * wlan_cfg80211_spectral_scan_get_diag_stats() - Get spectral diag stats
129  * @wiphy:    Pointer to wiphy
130  * @pdev:     Pointer to pdev
131  * @vdev:     Pointer to vdev
132  * @data:     Reference to data
133  * @data_len: Length of @data
134  *
135  * Return: 0 on success, negative value on failure
136  */
137 int wlan_cfg80211_spectral_scan_get_diag_stats(struct wiphy *wiphy,
138 					       struct wlan_objmgr_pdev *pdev,
139 					       struct wlan_objmgr_vdev *vdev,
140 					       const void *data,
141 					       int data_len);
142 
143 /**
144  * wlan_cfg80211_spectral_scan_get_status() - Get spectral scan status
145  * @wiphy:    Pointer to wiphy
146  * @pdev:     Pointer to pdev
147  * @vdev:     Pointer to vdev
148  * @data:     Reference to data
149  * @data_len: Length of @data
150  *
151  * Return: 0 on success, negative value on failure
152  */
153 int wlan_cfg80211_spectral_scan_get_status(struct wiphy *wiphy,
154 					   struct wlan_objmgr_pdev *pdev,
155 					   struct wlan_objmgr_vdev *vdev,
156 					   const void *data,
157 					   int data_len);
158 
159 /**
160  * wlan_cfg80211_spectral_scan_dma_debug_config() - configure DMA debug
161  * @pdev:       Pointer to pdev
162  * @vdev:       Pointer to vdev
163  * @tb:         Pointer to Spectral Scan config attribute
164  * @sscan_mode: Spectral scan mode
165  *
166  * Return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure
167  */
168 QDF_STATUS wlan_cfg80211_spectral_scan_dma_debug_config(
169 		struct wlan_objmgr_pdev *pdev,
170 		struct wlan_objmgr_vdev *vdev,
171 		struct nlattr **tb,
172 		enum spectral_scan_mode sscan_mode);
173 #endif
174