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_me.h 21 * @brief Define the host data path mcast enhance API functions 22 * called by the host control SW and the OS interface module 23 */ 24 #ifndef _CDP_TXRX_ME_H_ 25 #define _CDP_TXRX_ME_H_ 26 27 #include <cdp_txrx_ops.h> 28 /* TODO: adf need to be replaced with qdf */ 29 #include "cdp_txrx_handle.h" 30 31 static inline u_int16_t 32 cdp_tx_desc_alloc_and_mark_for_mcast_clone(ol_txrx_soc_handle soc, 33 struct cdp_pdev *pdev, u_int16_t buf_count) 34 { 35 if (!soc || !soc->ops) { 36 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 37 "%s: Invalid Instance", __func__); 38 QDF_BUG(0); 39 return 0; 40 } 41 42 if (!soc->ops->me_ops || 43 !soc->ops->me_ops->tx_desc_alloc_and_mark_for_mcast_clone) 44 return 0; 45 46 return soc->ops->me_ops-> 47 tx_desc_alloc_and_mark_for_mcast_clone 48 (pdev, buf_count); 49 } 50 51 static inline u_int16_t 52 cdp_tx_desc_free_and_unmark_for_mcast_clone(ol_txrx_soc_handle soc, 53 struct cdp_pdev *pdev, u_int16_t buf_count) 54 { 55 if (!soc || !soc->ops) { 56 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 57 "%s: Invalid Instance", __func__); 58 QDF_BUG(0); 59 return 0; 60 } 61 62 if (!soc->ops->me_ops || 63 !soc->ops->me_ops->tx_desc_free_and_unmark_for_mcast_clone) 64 return 0; 65 66 return soc->ops->me_ops-> 67 tx_desc_free_and_unmark_for_mcast_clone 68 (pdev, buf_count); 69 } 70 71 static inline u_int16_t 72 cdp_tx_get_mcast_buf_allocated_marked(ol_txrx_soc_handle soc, 73 struct cdp_pdev *pdev) 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 0; 80 } 81 82 if (!soc->ops->me_ops || 83 !soc->ops->me_ops->tx_get_mcast_buf_allocated_marked) 84 return 0; 85 86 return soc->ops->me_ops->tx_get_mcast_buf_allocated_marked 87 (pdev); 88 } 89 90 static inline void 91 cdp_tx_me_alloc_descriptor(ol_txrx_soc_handle soc, struct cdp_pdev *pdev) 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; 98 } 99 100 if (!soc->ops->me_ops || 101 !soc->ops->me_ops->tx_me_alloc_descriptor) 102 return; 103 104 soc->ops->me_ops->tx_me_alloc_descriptor(pdev); 105 } 106 107 static inline void 108 cdp_tx_me_free_descriptor(ol_txrx_soc_handle soc, struct cdp_pdev *pdev) 109 { 110 if (!soc || !soc->ops) { 111 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 112 "%s: Invalid Instance", __func__); 113 QDF_BUG(0); 114 return; 115 } 116 117 if (!soc->ops->me_ops || 118 !soc->ops->me_ops->tx_me_free_descriptor) 119 return; 120 121 soc->ops->me_ops->tx_me_free_descriptor(pdev); 122 } 123 124 static inline uint16_t 125 cdp_tx_me_convert_ucast(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, 126 qdf_nbuf_t wbuf, u_int8_t newmac[][6], uint8_t newmaccnt) 127 { 128 if (!soc || !soc->ops) { 129 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 130 "%s: Invalid Instance", __func__); 131 QDF_BUG(0); 132 return 0; 133 } 134 135 if (!soc->ops->me_ops || 136 !soc->ops->me_ops->tx_me_convert_ucast) 137 return 0; 138 139 return soc->ops->me_ops->tx_me_convert_ucast 140 (vdev, wbuf, newmac, newmaccnt); 141 } 142 143 static inline uint16_t 144 cdp_tx_me_find_ast_entry(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, 145 uint8_t *da_mac_addr, uint8_t *ra_mac_addr) 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->me_ops || 155 !soc->ops->me_ops->tx_me_find_ast_entry) 156 return 0; 157 158 return soc->ops->me_ops->tx_me_find_ast_entry(vdev, da_mac_addr, 159 ra_mac_addr); 160 } 161 162 /* Should be a function pointer in ol_txrx_osif_ops{} */ 163 /** 164 * @brief notify mcast frame indication from FW. 165 * @details 166 * This notification will be used to convert 167 * multicast frame to unicast. 168 * 169 * @param pdev - handle to the ctrl SW's physical device object 170 * @param vdev_id - ID of the virtual device received the special data 171 * @param msdu - the multicast msdu returned by FW for host inspect 172 */ 173 174 static inline int cdp_mcast_notify(ol_txrx_soc_handle soc, 175 struct cdp_pdev *pdev, u_int8_t vdev_id, qdf_nbuf_t msdu) 176 { 177 if (!soc || !soc->ops) { 178 QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, 179 "%s: Invalid Instance", __func__); 180 QDF_BUG(0); 181 return 0; 182 } 183 184 if (!soc->ops->me_ops || 185 !soc->ops->me_ops->mcast_notify) 186 return 0; 187 188 return soc->ops->me_ops->mcast_notify(pdev, vdev_id, msdu); 189 } 190 #endif 191