xref: /wlan-dirver/qca-wifi-host-cmn/os_if/linux/spectral/inc/wlan_cfg80211_spectral.h (revision 901120c066e139c7f8a2c8e4820561fdd83c67ef)
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_spectral_get_nl80211_chwidth() - Get nl80211_chan_width value for
53  * channel width from enum phy_ch_width
54  * @phy_chwidth: enum phy_ch_width channel width value
55  *
56  * Return: channel width converted to nl80211_chan_width
57  */
58 int
59 wlan_spectral_get_nl80211_chwidth(uint8_t phy_chwidth);
60 
61 /**
62  * wlan_spectral_get_phy_ch_width() - Convert channel width from
63  * nl80211_chan_width to enum phy_ch_width
64  * @nl_chwidth: nl80211 channel width value
65  *
66  * Return: channel width converted to phy_ch_width
67  */
68 uint8_t
69 wlan_spectral_get_phy_ch_width(uint8_t nl_chwidth);
70 
71 /**
72  * wlan_cfg80211_register_spectral_cmd_handler() - Registration api for spectral
73  * @pdev:    Pointer to pdev
74  * @idx:     Index in function table
75  * @handler: Pointer to handler
76  *
77  * Return: 0 on success, negative value on failure
78  */
79 void wlan_cfg80211_register_spectral_cmd_handler(
80 			struct wlan_objmgr_pdev *pdev,
81 			struct spectral_cfg80211_vendor_cmd_handlers *handlers);
82 
83 /**
84  * wlan_cfg80211_spectral_scan_config_and_start() - Start spectral scan
85  * @wiphy:    Pointer to wiphy
86  * @pdev:     Pointer to pdev
87  * @vdev:     Pointer to vdev
88  * @data:     Reference to data
89  * @data_len: Length of @data
90  *
91  * Return: 0 on success, negative value on failure
92  */
93 int wlan_cfg80211_spectral_scan_config_and_start(struct wiphy *wiphy,
94 						 struct wlan_objmgr_pdev *pdev,
95 						 struct wlan_objmgr_vdev *vdev,
96 						 const void *data,
97 						 int data_len);
98 
99 /**
100  * wlan_cfg80211_spectral_scan_stop() - Stop spectral scan
101  * @wiphy:    Pointer to wiphy
102  * @pdev:     Pointer to pdev
103  * @vdev:     Pointer to vdev
104  * @data:     Reference to data
105  * @data_len: Length of @data
106  *
107  * Return: 0 on success, negative value on failure
108  */
109 int wlan_cfg80211_spectral_scan_stop(struct wiphy *wiphy,
110 				     struct wlan_objmgr_pdev *pdev,
111 				     struct wlan_objmgr_vdev *vdev,
112 				     const void *data,
113 				     int data_len);
114 
115 /**
116  * wlan_cfg80211_spectral_scan_get_config() - Get spectral scan config
117  * @wiphy:    Pointer to wiphy
118  * @pdev:     Pointer to pdev
119  * @vdev:     Pointer to vdev
120  * @data:     Reference to data
121  * @data_len: Length of @data
122  *
123  * Return: 0 on success, negative value on failure
124  */
125 int wlan_cfg80211_spectral_scan_get_config(struct wiphy *wiphy,
126 					   struct wlan_objmgr_pdev *pdev,
127 					   struct wlan_objmgr_vdev *vdev,
128 					   const void *data,
129 					   int data_len);
130 
131 /**
132  * wlan_cfg80211_spectral_scan_get_cap() - Get spectral system capabilities
133  * @wiphy:    Pointer to wiphy
134  * @pdev:     Pointer to pdev
135  * @vdev:     Pointer to vdev
136  * @data:     Reference to data
137  * @data_len: Length of @data
138  *
139  * Return: 0 on success, negative value on failure
140  */
141 int wlan_cfg80211_spectral_scan_get_cap(struct wiphy *wiphy,
142 					struct wlan_objmgr_pdev *pdev,
143 					struct wlan_objmgr_vdev *vdev,
144 					const void *data,
145 					int data_len);
146 
147 /**
148  * wlan_cfg80211_spectral_scan_get_diag_stats() - Get spectral diag stats
149  * @wiphy:    Pointer to wiphy
150  * @pdev:     Pointer to pdev
151  * @vdev:     Pointer to vdev
152  * @data:     Reference to data
153  * @data_len: Length of @data
154  *
155  * Return: 0 on success, negative value on failure
156  */
157 int wlan_cfg80211_spectral_scan_get_diag_stats(struct wiphy *wiphy,
158 					       struct wlan_objmgr_pdev *pdev,
159 					       struct wlan_objmgr_vdev *vdev,
160 					       const void *data,
161 					       int data_len);
162 
163 /**
164  * wlan_cfg80211_spectral_scan_get_status() - Get spectral scan status
165  * @wiphy:    Pointer to wiphy
166  * @pdev:     Pointer to pdev
167  * @vdev:     Pointer to vdev
168  * @data:     Reference to data
169  * @data_len: Length of @data
170  *
171  * Return: 0 on success, negative value on failure
172  */
173 int wlan_cfg80211_spectral_scan_get_status(struct wiphy *wiphy,
174 					   struct wlan_objmgr_pdev *pdev,
175 					   struct wlan_objmgr_vdev *vdev,
176 					   const void *data,
177 					   int data_len);
178 
179 /**
180  * wlan_cfg80211_spectral_scan_dma_debug_config() - configure DMA debug
181  * @pdev:       Pointer to pdev
182  * @vdev:       Pointer to vdev
183  * @tb:         Pointer to Spectral Scan config attribute
184  * @sscan_mode: Spectral scan mode
185  *
186  * Return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure
187  */
188 QDF_STATUS wlan_cfg80211_spectral_scan_dma_debug_config(
189 		struct wlan_objmgr_pdev *pdev,
190 		struct wlan_objmgr_vdev *vdev,
191 		struct nlattr **tb,
192 		enum spectral_scan_mode sscan_mode);
193 #endif
194