Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 1 | /* |
Aditya Sathish | 8a73575 | 2019-01-21 16:56:01 +0530 | [diff] [blame] | 2 | * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 3 | * |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 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 | |
Yun Park | 87adad0 | 2017-04-03 08:44:15 -0700 | [diff] [blame] | 19 | /** |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 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 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 27 | #include <cdp_txrx_ops.h> |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 28 | /* TODO: adf need to be replaced with qdf */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 29 | #include "cdp_txrx_handle.h" |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 30 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 31 | static inline u_int16_t |
| 32 | cdp_tx_desc_alloc_and_mark_for_mcast_clone(ol_txrx_soc_handle soc, |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 33 | struct cdp_pdev *pdev, u_int16_t buf_count) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 34 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 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-> |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 47 | tx_desc_alloc_and_mark_for_mcast_clone |
| 48 | (pdev, buf_count); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 49 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 50 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 51 | static inline u_int16_t |
| 52 | cdp_tx_desc_free_and_unmark_for_mcast_clone(ol_txrx_soc_handle soc, |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 53 | struct cdp_pdev *pdev, u_int16_t buf_count) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 54 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 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-> |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 67 | tx_desc_free_and_unmark_for_mcast_clone |
| 68 | (pdev, buf_count); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 69 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 70 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 71 | static inline u_int16_t |
| 72 | cdp_tx_get_mcast_buf_allocated_marked(ol_txrx_soc_handle soc, |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 73 | struct cdp_pdev *pdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 74 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 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 |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 87 | (pdev); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 88 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 89 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 90 | static inline void |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 91 | cdp_tx_me_alloc_descriptor(ol_txrx_soc_handle soc, struct cdp_pdev *pdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 92 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 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); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 105 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 106 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 107 | static inline void |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 108 | cdp_tx_me_free_descriptor(ol_txrx_soc_handle soc, struct cdp_pdev *pdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 109 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 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); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | static inline uint16_t |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 125 | cdp_tx_me_convert_ucast(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 126 | qdf_nbuf_t wbuf, u_int8_t newmac[][6], uint8_t newmaccnt) |
| 127 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 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 |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 140 | (vdev, wbuf, newmac, newmaccnt); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 141 | } |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 142 | |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 143 | /* Should be a function pointer in ol_txrx_osif_ops{} */ |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 144 | /** |
| 145 | * @brief notify mcast frame indication from FW. |
| 146 | * @details |
| 147 | * This notification will be used to convert |
| 148 | * multicast frame to unicast. |
| 149 | * |
| 150 | * @param pdev - handle to the ctrl SW's physical device object |
| 151 | * @param vdev_id - ID of the virtual device received the special data |
| 152 | * @param msdu - the multicast msdu returned by FW for host inspect |
| 153 | */ |
| 154 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 155 | static inline int cdp_mcast_notify(ol_txrx_soc_handle soc, |
| 156 | struct cdp_pdev *pdev, u_int8_t vdev_id, qdf_nbuf_t msdu) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 157 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 158 | if (!soc || !soc->ops) { |
| 159 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 160 | "%s: Invalid Instance", __func__); |
| 161 | QDF_BUG(0); |
| 162 | return 0; |
| 163 | } |
| 164 | |
| 165 | if (!soc->ops->me_ops || |
| 166 | !soc->ops->me_ops->mcast_notify) |
| 167 | return 0; |
| 168 | |
| 169 | return soc->ops->me_ops->mcast_notify(pdev, vdev_id, msdu); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 170 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 171 | #endif |