xref: /wlan-driver/qcacld-3.0/core/hdd/src/wlan_hdd_rx_monitor.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-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 #include "wlan_hdd_includes.h"
21 #include <linux/netdevice.h>
22 #include <linux/skbuff.h>
23 #include <linux/etherdevice.h>
24 #include <linux/if_ether.h>
25 #include <cds_sched.h>
26 #include <cds_utils.h>
27 #include "wlan_hdd_rx_monitor.h"
28 #include "ol_txrx.h"
29 #include "cdp_txrx_mon.h"
30 
hdd_enable_monitor_mode(struct net_device * dev)31 int hdd_enable_monitor_mode(struct net_device *dev)
32 {
33 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
34 	uint8_t vdev_id;
35 
36 	hdd_enter_dev(dev);
37 
38 	vdev_id = cdp_get_mon_vdev_from_pdev(soc, OL_TXRX_PDEV_ID);
39 	if (vdev_id < 0)
40 		return -EINVAL;
41 
42 	return cdp_set_monitor_mode(soc, vdev_id, false);
43 }
44 
hdd_disable_monitor_mode(void)45 int hdd_disable_monitor_mode(void)
46 {
47 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
48 
49 	return cdp_reset_monitor_mode(soc, OL_TXRX_PDEV_ID, false);
50 }
51