xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_mon.h (revision 1397a33f48ea6455be40871470b286e535820eb8) !
1 /*
2  * Copyright (c) 2016-2018 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  * @file cdp_txrx_mon.h
21  * @brief Define the monitor mode API functions
22  * called by the host control SW and the OS interface module
23  */
24 
25 #ifndef _CDP_TXRX_MON_H_
26 #define _CDP_TXRX_MON_H_
27 #include "cdp_txrx_handle.h"
28 static inline void cdp_monitor_set_filter_ucast_data
29 	(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, u_int8_t val)
30 {
31 	if (!soc || !soc->ops) {
32 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
33 				"%s: Invalid Instance", __func__);
34 		QDF_BUG(0);
35 		return;
36 	}
37 
38 	if (!soc->ops->mon_ops ||
39 	    !soc->ops->mon_ops->txrx_monitor_set_filter_ucast_data)
40 		return;
41 
42 	soc->ops->mon_ops->txrx_monitor_set_filter_ucast_data
43 			(pdev, val);
44 }
45 
46 static inline void cdp_monitor_set_filter_mcast_data
47 	(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, u_int8_t val)
48 {
49 	if (!soc || !soc->ops) {
50 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
51 				"%s: Invalid Instance", __func__);
52 		QDF_BUG(0);
53 		return;
54 	}
55 
56 	if (!soc->ops->mon_ops ||
57 	    !soc->ops->mon_ops->txrx_monitor_set_filter_mcast_data)
58 		return;
59 
60 	soc->ops->mon_ops->txrx_monitor_set_filter_mcast_data
61 			(pdev, val);
62 }
63 
64 static inline void cdp_monitor_set_filter_non_data
65 	(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, u_int8_t val)
66 {
67 	if (!soc || !soc->ops) {
68 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
69 				"%s: Invalid Instance", __func__);
70 		QDF_BUG(0);
71 		return;
72 	}
73 
74 	if (!soc->ops->mon_ops ||
75 	    !soc->ops->mon_ops->txrx_monitor_set_filter_non_data)
76 		return;
77 
78 	soc->ops->mon_ops->txrx_monitor_set_filter_non_data
79 			(pdev, val);
80 }
81 
82 static inline bool cdp_monitor_get_filter_ucast_data
83 (ol_txrx_soc_handle soc, struct cdp_vdev *vdev_txrx_handle)
84 {
85 	if (!soc || !soc->ops) {
86 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
87 				"%s: Invalid Instance", __func__);
88 		QDF_BUG(0);
89 		return 0;
90 	}
91 
92 	if (!soc->ops->mon_ops ||
93 	    !soc->ops->mon_ops->txrx_monitor_get_filter_ucast_data)
94 		return 0;
95 
96 	return soc->ops->mon_ops->txrx_monitor_get_filter_ucast_data
97 			(vdev_txrx_handle);
98 }
99 
100 static inline bool cdp_monitor_get_filter_mcast_data
101 (ol_txrx_soc_handle soc, struct cdp_vdev *vdev_txrx_handle)
102 {
103 	if (!soc || !soc->ops) {
104 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
105 				"%s: Invalid Instance", __func__);
106 		QDF_BUG(0);
107 		return 0;
108 	}
109 
110 	if (!soc->ops->mon_ops ||
111 	    !soc->ops->mon_ops->txrx_monitor_get_filter_mcast_data)
112 		return 0;
113 
114 	return soc->ops->mon_ops->txrx_monitor_get_filter_mcast_data
115 			(vdev_txrx_handle);
116 }
117 
118 static inline bool cdp_monitor_get_filter_non_data
119 (ol_txrx_soc_handle soc, struct cdp_vdev *vdev_txrx_handle)
120 {
121 	if (!soc || !soc->ops) {
122 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
123 				"%s: Invalid Instance", __func__);
124 		QDF_BUG(0);
125 		return 0;
126 	}
127 
128 	if (!soc->ops->mon_ops ||
129 	    !soc->ops->mon_ops->txrx_monitor_get_filter_non_data)
130 		return 0;
131 
132 	return soc->ops->mon_ops->txrx_monitor_get_filter_non_data
133 			(vdev_txrx_handle);
134 }
135 
136 static inline QDF_STATUS cdp_reset_monitor_mode
137 (ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
138 {
139 	if (!soc || !soc->ops) {
140 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
141 				"%s: Invalid Instance", __func__);
142 		QDF_BUG(0);
143 		return 0;
144 	}
145 
146 	if (!soc->ops->mon_ops ||
147 	    !soc->ops->mon_ops->txrx_reset_monitor_mode)
148 		return 0;
149 
150 	return soc->ops->mon_ops->txrx_reset_monitor_mode(pdev);
151 }
152 #endif
153