1 /*
2  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /**
19  * DOC: wlan_hdd_cfr.h
20  *
21  * WLAN Host Device Driver cfr capture implementation
22  *
23  */
24 
25 #if !defined(_WLAN_HDD_CFR_H)
26 #define _WLAN_HDD_CFR_H
27 
28 #ifdef WLAN_CFR_ENABLE
29 
30 #include "wlan_cfr_utils_api.h"
31 
32 #define HDD_INVALID_GROUP_ID MAX_TA_RA_ENTRIES
33 #define LEGACY_CFR_VERSION 1
34 #define ENHANCED_CFR_VERSION 2
35 
36 /**
37  * wlan_hdd_cfg80211_peer_cfr_capture_cfg() - configure peer cfr capture
38  * @wiphy:    WIPHY structure pointer
39  * @wdev:     Wireless device structure pointer
40  * @data:     Pointer to the data received
41  * @data_len: Length of the data received
42  *
43  * This function starts CFR capture
44  *
45  * Return: 0 on success and errno on failure
46  */
47 int
48 wlan_hdd_cfg80211_peer_cfr_capture_cfg(struct wiphy *wiphy,
49 				       struct wireless_dev *wdev,
50 				       const void *data,
51 				       int data_len);
52 
53 #ifdef WLAN_ENH_CFR_ENABLE
54 /**
55  * hdd_cfr_disconnect() - Handle disconnection event in CFR
56  * @vdev: Pointer to vdev object
57  *
58  * Handle disconnection event in CFR. Stop CFR if it started and get
59  * disconnection event.
60  *
61  * Return: QDF status
62  */
63 QDF_STATUS hdd_cfr_disconnect(struct wlan_objmgr_vdev *vdev);
64 #else
65 static inline QDF_STATUS
hdd_cfr_disconnect(struct wlan_objmgr_vdev * vdev)66 hdd_cfr_disconnect(struct wlan_objmgr_vdev *vdev)
67 {
68 	return QDF_STATUS_SUCCESS;
69 }
70 #endif
71 
72 extern const struct nla_policy cfr_config_policy[
73 			QCA_WLAN_VENDOR_ATTR_PEER_CFR_MAX + 1];
74 
75 #define FEATURE_CFR_VENDOR_COMMANDS \
76 { \
77 	.info.vendor_id = QCA_NL80211_VENDOR_ID, \
78 	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_PEER_CFR_CAPTURE_CFG, \
79 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV | \
80 			WIPHY_VENDOR_CMD_NEED_NETDEV, \
81 	.doit = wlan_hdd_cfg80211_peer_cfr_capture_cfg, \
82 	vendor_command_policy(cfr_config_policy, \
83 			      QCA_WLAN_VENDOR_ATTR_PEER_CFR_MAX) \
84 },
85 #else
86 #define FEATURE_CFR_VENDOR_COMMANDS
87 static inline QDF_STATUS
hdd_cfr_disconnect(struct wlan_objmgr_vdev * vdev)88 hdd_cfr_disconnect(struct wlan_objmgr_vdev *vdev)
89 {
90 	return QDF_STATUS_SUCCESS;
91 }
92 #endif /* WLAN_CFR_ENABLE */
93 #endif /* _WLAN_HDD_CFR_H */
94 
95