1 /*
2  * Copyright (c) 2012-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
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef _OS_IF_PKT_CAPTURE_H_
21 #define _OS_IF_PKT_CAPTURE_H_
22 
23 #include "qdf_types.h"
24 #include "qca_vendor.h"
25 #include "wlan_hdd_main.h"
26 
27 #ifdef WLAN_FEATURE_PKT_CAPTURE
28 
29 #define os_if_pkt_enter() QDF_TRACE_ENTER(QDF_MODULE_ID_HDD, "enter")
30 #define os_if_pkt_exit() QDF_TRACE_EXIT(QDF_MODULE_ID_HDD, "exit")
31 
32 #define FEATURE_MONITOR_MODE_VENDOR_COMMANDS				   \
33 	{								   \
34 		.info.vendor_id = QCA_NL80211_VENDOR_ID,		   \
35 		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SET_MONITOR_MODE, \
36 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |			   \
37 			WIPHY_VENDOR_CMD_NEED_NETDEV |			   \
38 			WIPHY_VENDOR_CMD_NEED_RUNNING,			   \
39 		.doit = wlan_hdd_cfg80211_set_monitor_mode,		   \
40 		vendor_command_policy(set_monitor_mode_policy,		   \
41 				QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MAX) \
42 	},
43 
44 /* Short name for QCA_NL80211_VENDOR_SUBCMD_SET_MONITOR_MODE command */
45 
46 #define SET_MONITOR_MODE_CONFIG_MAX \
47 	QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MAX
48 #define SET_MONITOR_MODE_INVALID \
49 	QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_INVALID
50 #define SET_MONITOR_MODE_DATA_TX_FRAME_TYPE \
51 	QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_DATA_TX_FRAME_TYPE
52 #define SET_MONITOR_MODE_DATA_RX_FRAME_TYPE \
53 	QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_DATA_RX_FRAME_TYPE
54 #define SET_MONITOR_MODE_MGMT_TX_FRAME_TYPE \
55 	QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MGMT_TX_FRAME_TYPE
56 #define SET_MONITOR_MODE_MGMT_RX_FRAME_TYPE \
57 	QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_MGMT_RX_FRAME_TYPE
58 #define SET_MONITOR_MODE_CTRL_TX_FRAME_TYPE \
59 	QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CTRL_TX_FRAME_TYPE
60 #define SET_MONITOR_MODE_CTRL_RX_FRAME_TYPE \
61 	QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CTRL_RX_FRAME_TYPE
62 #define SET_MONITOR_MODE_CONNECTED_BEACON_INTERVAL \
63 	QCA_WLAN_VENDOR_ATTR_SET_MONITOR_MODE_CONNECTED_BEACON_INTERVAL
64 
65 extern const struct nla_policy
66 set_monitor_mode_policy[SET_MONITOR_MODE_CONFIG_MAX + 1];
67 
68 /**
69  * os_if_monitor_mode_configure() - Process monitor mode configuration
70  * operation in the received vendor command
71  * @adapter: adapter pointer
72  * @data: %QCA_NL80211_VENDOR_SUBCMD_SET_MONITOR_MODE payload
73  * @data_len: length of @data
74  *
75  * Return: %QDF_STATUS_SUCCESS on success, error status otherwise
76  */
77 QDF_STATUS os_if_monitor_mode_configure(struct hdd_adapter *adapter,
78 					const void *data, int data_len);
79 #endif
80 #endif
81