xref: /wlan-driver/qcacld-3.0/os_if/dp/inc/os_if_dp_local_pkt_capture.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #ifndef _OS_IF_DP_LOCAL_PKT_CAPTURE_H_
18 #define _OS_IF_DP_LOCAL_PKT_CAPTURE_H_
19 
20 #include "qdf_types.h"
21 #include "qca_vendor.h"
22 
23 #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE
24 
25 #define FEATURE_MONITOR_MODE_VENDOR_COMMANDS				   \
26 	{								   \
27 		.info.vendor_id = QCA_NL80211_VENDOR_ID,		   \
28 		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SET_MONITOR_MODE, \
29 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |			   \
30 			WIPHY_VENDOR_CMD_NEED_NETDEV |			   \
31 			WIPHY_VENDOR_CMD_NEED_RUNNING,			   \
32 		.doit = wlan_hdd_cfg80211_set_monitor_mode,		   \
33 		vendor_command_policy(set_monitor_mode_policy,		   \
34 				QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MAX) \
35 	},								   \
36 	{								   \
37 		.info.vendor_id = QCA_NL80211_VENDOR_ID,		   \
38 		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_MONITOR_MODE, \
39 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |			   \
40 			WIPHY_VENDOR_CMD_NEED_NETDEV |			   \
41 			WIPHY_VENDOR_CMD_NEED_RUNNING,			   \
42 		.doit = wlan_hdd_cfg80211_get_monitor_mode,		   \
43 		vendor_command_policy(VENDOR_CMD_RAW_DATA, 0)		   \
44 	},
45 
46 extern const struct nla_policy
47 set_monitor_mode_policy[QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MAX + 1];
48 
49 /**
50  * os_if_dp_set_lpc_configure() - Configure local packet capture
51  * operation in the received vendor command
52  * @vdev: vdev
53  * @data: NL data
54  * @data_len: NL data length
55  *
56  * Return: QDF_STATUS_SUCCESS if Success;
57  *         QDF_STATUS_E_* if Failure
58  */
59 QDF_STATUS os_if_dp_set_lpc_configure(struct wlan_objmgr_vdev *vdev,
60 				      const void *data, int data_len);
61 
62 /**
63  * os_if_dp_local_pkt_capture_stop() - Stop local packet capture
64  * @vdev: vdev
65  *
66  * Return: 0 for Success and negative value for failure
67  */
68 QDF_STATUS os_if_dp_local_pkt_capture_stop(struct wlan_objmgr_vdev *vdev);
69 
70 /**
71  * os_if_dp_get_lpc_state() - get local packet capture state
72  * in the received vendor command
73  * @vdev: vdev
74  * @data: NL data
75  * @data_len: NL data length
76  *
77  * Return: QDF_STATUS_SUCCESS if Success;
78  *         QDF_STATUS_E_* if Failure
79  */
80 QDF_STATUS os_if_dp_get_lpc_state(struct wlan_objmgr_vdev *vdev,
81 				  const void *data, int data_len);
82 
83 /**
84  * os_if_lpc_mon_intf_creation_allowed() - Check if local packet capture
85  * monitor interface creation is allowed or not
86  * @psoc: psoc object handle
87  *
88  * Return: true, If monitor interface creation is allowed
89  *         false, Otherwise
90  */
91 bool os_if_lpc_mon_intf_creation_allowed(struct wlan_objmgr_psoc *psoc);
92 #else
93 static inline
os_if_dp_set_lpc_configure(struct wlan_objmgr_vdev * vdev,const void * data,int data_len)94 QDF_STATUS os_if_dp_set_lpc_configure(struct wlan_objmgr_vdev *vdev,
95 				      const void *data, int data_len)
96 {
97 	return QDF_STATUS_SUCCESS;
98 }
99 
100 static inline
os_if_dp_local_pkt_capture_stop(struct wlan_objmgr_vdev * vdev)101 QDF_STATUS os_if_dp_local_pkt_capture_stop(struct wlan_objmgr_vdev *vdev)
102 {
103 	return QDF_STATUS_SUCCESS;
104 }
105 
106 static inline
os_if_dp_get_lpc_state(struct wlan_objmgr_vdev * vdev,const void * data,int data_len)107 QDF_STATUS os_if_dp_get_lpc_state(struct wlan_objmgr_vdev *vdev,
108 				  const void *data, int data_len)
109 {
110 	return QDF_STATUS_SUCCESS;
111 }
112 
113 static inline
os_if_lpc_mon_intf_creation_allowed(struct wlan_objmgr_psoc * psoc)114 bool os_if_lpc_mon_intf_creation_allowed(struct wlan_objmgr_psoc *psoc)
115 {
116 	return true;
117 }
118 
119 #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */
120 #endif
121