1 /* 2 * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. 3 * 4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc. 5 * 6 * 7 * Permission to use, copy, modify, and/or distribute this software for 8 * any purpose with or without fee is hereby granted, provided that the 9 * above copyright notice and this permission notice appear in all 10 * copies. 11 * 12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 19 * PERFORMANCE OF THIS SOFTWARE. 20 */ 21 22 /* 23 * This file was originally distributed by Qualcomm Atheros, Inc. 24 * under proprietary terms before Copyright ownership was assigned 25 * to the Linux Foundation. 26 */ 27 /** 28 * @file cdp_txrx_mon.h 29 * @brief Define the monitor mode API functions 30 * called by the host control SW and the OS interface module 31 */ 32 33 #ifndef _CDP_TXRX_MON_H_ 34 #define _CDP_TXRX_MON_H_ 35 #include "cdp_txrx_handle.h" 36 static inline void cdp_monitor_set_filter_ucast_data 37 (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, u_int8_t val) 38 { 39 if (!soc || !soc->ops) { 40 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 41 "%s: Invalid Instance", __func__); 42 QDF_BUG(0); 43 return; 44 } 45 46 if (!soc->ops->mon_ops || 47 !soc->ops->mon_ops->txrx_monitor_set_filter_ucast_data) 48 return; 49 50 soc->ops->mon_ops->txrx_monitor_set_filter_ucast_data 51 (pdev, val); 52 } 53 54 static inline void cdp_monitor_set_filter_mcast_data 55 (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, u_int8_t val) 56 { 57 if (!soc || !soc->ops) { 58 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 59 "%s: Invalid Instance", __func__); 60 QDF_BUG(0); 61 return; 62 } 63 64 if (!soc->ops->mon_ops || 65 !soc->ops->mon_ops->txrx_monitor_set_filter_mcast_data) 66 return; 67 68 soc->ops->mon_ops->txrx_monitor_set_filter_mcast_data 69 (pdev, val); 70 } 71 72 static inline void cdp_monitor_set_filter_non_data 73 (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, u_int8_t val) 74 { 75 if (!soc || !soc->ops) { 76 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 77 "%s: Invalid Instance", __func__); 78 QDF_BUG(0); 79 return; 80 } 81 82 if (!soc->ops->mon_ops || 83 !soc->ops->mon_ops->txrx_monitor_set_filter_non_data) 84 return; 85 86 soc->ops->mon_ops->txrx_monitor_set_filter_non_data 87 (pdev, val); 88 } 89 90 static inline bool cdp_monitor_get_filter_ucast_data 91 (ol_txrx_soc_handle soc, struct cdp_vdev *vdev_txrx_handle) 92 { 93 if (!soc || !soc->ops) { 94 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 95 "%s: Invalid Instance", __func__); 96 QDF_BUG(0); 97 return 0; 98 } 99 100 if (!soc->ops->mon_ops || 101 !soc->ops->mon_ops->txrx_monitor_get_filter_ucast_data) 102 return 0; 103 104 return soc->ops->mon_ops->txrx_monitor_get_filter_ucast_data 105 (vdev_txrx_handle); 106 } 107 108 static inline bool cdp_monitor_get_filter_mcast_data 109 (ol_txrx_soc_handle soc, struct cdp_vdev *vdev_txrx_handle) 110 { 111 if (!soc || !soc->ops) { 112 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 113 "%s: Invalid Instance", __func__); 114 QDF_BUG(0); 115 return 0; 116 } 117 118 if (!soc->ops->mon_ops || 119 !soc->ops->mon_ops->txrx_monitor_get_filter_mcast_data) 120 return 0; 121 122 return soc->ops->mon_ops->txrx_monitor_get_filter_mcast_data 123 (vdev_txrx_handle); 124 } 125 126 static inline bool cdp_monitor_get_filter_non_data 127 (ol_txrx_soc_handle soc, struct cdp_vdev *vdev_txrx_handle) 128 { 129 if (!soc || !soc->ops) { 130 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 131 "%s: Invalid Instance", __func__); 132 QDF_BUG(0); 133 return 0; 134 } 135 136 if (!soc->ops->mon_ops || 137 !soc->ops->mon_ops->txrx_monitor_get_filter_non_data) 138 return 0; 139 140 return soc->ops->mon_ops->txrx_monitor_get_filter_non_data 141 (vdev_txrx_handle); 142 } 143 144 static inline int cdp_reset_monitor_mode 145 (ol_txrx_soc_handle soc, struct cdp_pdev *pdev) 146 { 147 if (!soc || !soc->ops) { 148 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 149 "%s: Invalid Instance", __func__); 150 QDF_BUG(0); 151 return 0; 152 } 153 154 if (!soc->ops->mon_ops || 155 !soc->ops->mon_ops->txrx_reset_monitor_mode) 156 return 0; 157 158 return soc->ops->mon_ops->txrx_reset_monitor_mode(pdev); 159 } 160 #endif 161