Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 1 | /* |
Vivek Natarajan | 95f004f | 2019-01-10 22:15:46 +0530 | [diff] [blame] | 2 | * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved. |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 3 | * |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -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 | 21cd32f | 2017-04-03 10:38:31 -0700 | [diff] [blame] | 19 | /** |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 20 | * @file cdp_txrx_cmn.h |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 21 | * @brief Define the host data path converged API functions |
| 22 | * called by the host control SW and the OS interface module |
| 23 | */ |
| 24 | #ifndef _CDP_TXRX_CMN_H_ |
| 25 | #define _CDP_TXRX_CMN_H_ |
| 26 | |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 27 | #include "qdf_types.h" |
| 28 | #include "qdf_nbuf.h" |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 29 | #include "cdp_txrx_ops.h" |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 30 | #include "cdp_txrx_handle.h" |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 31 | #include "cdp_txrx_cmn_struct.h" |
Krunal Soni | 03ba0f5 | 2019-02-12 11:44:46 -0800 | [diff] [blame] | 32 | |
| 33 | #ifdef ENABLE_VERBOSE_DEBUG |
| 34 | extern bool is_dp_verbose_debug_enabled; |
| 35 | #endif |
| 36 | |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 37 | /****************************************************************************** |
| 38 | * |
| 39 | * Common Data Path Header File |
| 40 | * |
| 41 | *****************************************************************************/ |
Mohit Khanna | 7ac554b | 2018-05-24 11:58:13 -0700 | [diff] [blame] | 42 | #define dp_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP, params) |
| 43 | #define dp_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP, params) |
| 44 | #define dp_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP, params) |
Mohit Khanna | 287adee | 2018-11-28 17:09:34 -0800 | [diff] [blame] | 45 | #define dp_info(params...) \ |
| 46 | __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params) |
Mohit Khanna | 7ac554b | 2018-05-24 11:58:13 -0700 | [diff] [blame] | 47 | #define dp_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params) |
Krunal Soni | 03ba0f5 | 2019-02-12 11:44:46 -0800 | [diff] [blame] | 48 | #ifdef ENABLE_VERBOSE_DEBUG |
| 49 | /** |
| 50 | * @enum verbose_debug_module: |
| 51 | * if INI "enable_verbose_debug" has to set following bit positions to enable |
| 52 | * respective module's excessive logging, |
| 53 | * |
| 54 | * @hif_verbose_debug_mask: 1st bit [0th index] is for HIF module |
| 55 | * @hal_verbose_debug_mask: 2nd bit [1st index] is for HAL module |
| 56 | * @dp_verbose_debug_mask: 3rd bit [2nd index] is for DP module |
| 57 | */ |
| 58 | enum verbose_debug_module { |
| 59 | hif_vebose_debug_mask = 1 << 0, |
| 60 | hal_verbose_debug_mask = 1 << 1, |
| 61 | dp_verbose_debug_mask = 1 << 2, |
| 62 | }; |
| 63 | |
| 64 | #define dp_verbose_debug(params...) \ |
| 65 | if (unlikely(is_dp_verbose_debug_enabled)) \ |
| 66 | do {\ |
| 67 | QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params); \ |
| 68 | } while (0) |
| 69 | #else |
| 70 | #define dp_verbose_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params) |
| 71 | #endif |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 72 | |
Mohit Khanna | 287adee | 2018-11-28 17:09:34 -0800 | [diff] [blame] | 73 | #define dp_alert_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_DP, params) |
| 74 | #define dp_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_DP, params) |
| 75 | #define dp_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_DP, params) |
| 76 | #define dp_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_DP, params) |
| 77 | #define dp_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_DP, params) |
| 78 | |
Venkata Sharath Chandra Manchala | 8747958 | 2018-08-01 12:45:34 -0700 | [diff] [blame] | 79 | static inline QDF_STATUS |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 80 | cdp_soc_attach_target(ol_txrx_soc_handle soc) |
| 81 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 82 | if (!soc || !soc->ops) { |
| 83 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 84 | "%s: Invalid Instance:", __func__); |
| 85 | QDF_BUG(0); |
Venkata Sharath Chandra Manchala | 8747958 | 2018-08-01 12:45:34 -0700 | [diff] [blame] | 86 | return QDF_STATUS_E_INVAL; |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | if (!soc->ops->cmn_drv_ops || |
| 90 | !soc->ops->cmn_drv_ops->txrx_soc_attach_target) |
Venkata Sharath Chandra Manchala | 8747958 | 2018-08-01 12:45:34 -0700 | [diff] [blame] | 91 | return QDF_STATUS_SUCCESS; |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 92 | |
| 93 | return soc->ops->cmn_drv_ops->txrx_soc_attach_target(soc); |
| 94 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 95 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 96 | |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 97 | static inline int |
| 98 | cdp_soc_get_nss_cfg(ol_txrx_soc_handle soc) |
| 99 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 100 | if (!soc || !soc->ops) { |
| 101 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 102 | "%s: Invalid Instance:", __func__); |
| 103 | QDF_BUG(0); |
| 104 | return 0; |
| 105 | } |
| 106 | |
| 107 | if (!soc->ops->cmn_drv_ops || |
| 108 | !soc->ops->cmn_drv_ops->txrx_soc_get_nss_cfg) |
| 109 | return 0; |
| 110 | |
| 111 | return soc->ops->cmn_drv_ops->txrx_soc_get_nss_cfg(soc); |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 112 | } |
| 113 | |
| 114 | static inline void |
| 115 | cdp_soc_set_nss_cfg(ol_txrx_soc_handle soc, uint32_t config) |
| 116 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 117 | if (!soc || !soc->ops) { |
| 118 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 119 | "%s: Invalid Instance:", __func__); |
| 120 | QDF_BUG(0); |
| 121 | return; |
| 122 | } |
| 123 | |
| 124 | if (!soc->ops->cmn_drv_ops || |
| 125 | !soc->ops->cmn_drv_ops->txrx_soc_set_nss_cfg) |
| 126 | return; |
| 127 | |
| 128 | soc->ops->cmn_drv_ops->txrx_soc_set_nss_cfg(soc, config); |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 129 | } |
| 130 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 131 | static inline struct cdp_vdev * |
| 132 | cdp_vdev_attach(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 133 | uint8_t *vdev_mac_addr, uint8_t vdev_id, enum wlan_op_mode op_mode) |
| 134 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 135 | if (!soc || !soc->ops) { |
| 136 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 137 | "%s: Invalid Instance:", __func__); |
| 138 | QDF_BUG(0); |
| 139 | return NULL; |
| 140 | } |
| 141 | |
| 142 | if (!soc->ops->cmn_drv_ops || |
| 143 | !soc->ops->cmn_drv_ops->txrx_vdev_attach) |
| 144 | return NULL; |
| 145 | |
| 146 | return soc->ops->cmn_drv_ops->txrx_vdev_attach(pdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 147 | vdev_mac_addr, vdev_id, op_mode); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 148 | } |
Manjunathappa Prakash | 38205cc | 2018-03-06 14:22:44 -0800 | [diff] [blame] | 149 | #ifndef CONFIG_WIN |
| 150 | /** |
| 151 | * cdp_flow_pool_map() - Create flow pool for vdev |
| 152 | * @soc - data path soc handle |
| 153 | * @pdev |
| 154 | * @vdev_id - vdev_id corresponding to vdev start |
| 155 | * |
| 156 | * Create per vdev flow pool. |
| 157 | * |
| 158 | * return none |
| 159 | */ |
| 160 | static inline QDF_STATUS cdp_flow_pool_map(ol_txrx_soc_handle soc, |
| 161 | struct cdp_pdev *pdev, uint8_t vdev_id) |
| 162 | { |
| 163 | if (!soc || !soc->ops) { |
| 164 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
Chaithanya Garrepalli | 9cc562c | 2018-11-16 18:30:41 +0530 | [diff] [blame] | 165 | "%s: Invalid Instance:", __func__); |
Manjunathappa Prakash | 38205cc | 2018-03-06 14:22:44 -0800 | [diff] [blame] | 166 | QDF_BUG(0); |
| 167 | return QDF_STATUS_E_INVAL; |
| 168 | } |
| 169 | |
| 170 | if (!soc->ops->flowctl_ops || |
| 171 | !soc->ops->flowctl_ops->flow_pool_map_handler) |
| 172 | return QDF_STATUS_E_INVAL; |
| 173 | |
| 174 | return soc->ops->flowctl_ops->flow_pool_map_handler(soc, pdev, vdev_id); |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * cdp_flow_pool_unmap() - Delete flow pool |
| 179 | * @soc - data path soc handle |
| 180 | * @pdev |
| 181 | * @vdev_id - vdev_id corresponding to vdev start |
| 182 | * |
| 183 | * Delete flow pool |
| 184 | * |
| 185 | * return none |
| 186 | */ |
| 187 | static inline void cdp_flow_pool_unmap(ol_txrx_soc_handle soc, |
| 188 | struct cdp_pdev *pdev, uint8_t vdev_id) |
| 189 | { |
| 190 | if (!soc || !soc->ops) { |
| 191 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 192 | "%s: Invalid Instance:", __func__); |
| 193 | QDF_BUG(0); |
| 194 | return; |
| 195 | } |
| 196 | |
| 197 | if (!soc->ops->flowctl_ops || |
| 198 | !soc->ops->flowctl_ops->flow_pool_unmap_handler) |
| 199 | return; |
| 200 | |
| 201 | return soc->ops->flowctl_ops->flow_pool_unmap_handler(soc, pdev, |
| 202 | vdev_id); |
| 203 | } |
| 204 | #endif |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 205 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 206 | static inline void |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 207 | cdp_vdev_detach(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 208 | ol_txrx_vdev_delete_cb callback, void *cb_context) |
| 209 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 210 | if (!soc || !soc->ops) { |
| 211 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 212 | "%s: Invalid Instance:", __func__); |
| 213 | QDF_BUG(0); |
| 214 | return; |
| 215 | } |
| 216 | |
| 217 | if (!soc->ops->cmn_drv_ops || |
| 218 | !soc->ops->cmn_drv_ops->txrx_vdev_detach) |
| 219 | return; |
| 220 | |
| 221 | soc->ops->cmn_drv_ops->txrx_vdev_detach(vdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 222 | callback, cb_context); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 223 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 224 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 225 | static inline int |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 226 | cdp_pdev_attach_target(ol_txrx_soc_handle soc, struct cdp_pdev *pdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 227 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 228 | if (!soc || !soc->ops) { |
| 229 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 230 | "%s: Invalid Instance:", __func__); |
| 231 | QDF_BUG(0); |
| 232 | return 0; |
| 233 | } |
| 234 | |
| 235 | if (!soc->ops->cmn_drv_ops || |
| 236 | !soc->ops->cmn_drv_ops->txrx_pdev_attach_target) |
| 237 | return 0; |
| 238 | |
| 239 | return soc->ops->cmn_drv_ops->txrx_pdev_attach_target(pdev); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 240 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 241 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 242 | static inline struct cdp_pdev *cdp_pdev_attach |
Akshay Kosigi | 1a9c6d1 | 2018-04-26 00:54:23 +0530 | [diff] [blame] | 243 | (ol_txrx_soc_handle soc, struct cdp_ctrl_objmgr_pdev *ctrl_pdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 244 | HTC_HANDLE htc_pdev, qdf_device_t osdev, uint8_t pdev_id) |
| 245 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 246 | if (!soc || !soc->ops) { |
| 247 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 248 | "%s: Invalid Instance:", __func__); |
| 249 | QDF_BUG(0); |
| 250 | return NULL; |
| 251 | } |
| 252 | |
| 253 | if (!soc->ops->cmn_drv_ops || |
| 254 | !soc->ops->cmn_drv_ops->txrx_pdev_attach) |
| 255 | return NULL; |
| 256 | |
| 257 | return soc->ops->cmn_drv_ops->txrx_pdev_attach(soc, ctrl_pdev, |
| 258 | htc_pdev, osdev, pdev_id); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 259 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 260 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 261 | static inline int cdp_pdev_post_attach(ol_txrx_soc_handle soc, |
| 262 | struct cdp_pdev *pdev) |
Leo Chang | db6358c | 2016-09-27 17:00:52 -0700 | [diff] [blame] | 263 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 264 | if (!soc || !soc->ops) { |
| 265 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 266 | "%s: Invalid Instance:", __func__); |
| 267 | QDF_BUG(0); |
| 268 | return 0; |
| 269 | } |
| 270 | |
| 271 | if (!soc->ops->cmn_drv_ops || |
| 272 | !soc->ops->cmn_drv_ops->txrx_pdev_post_attach) |
| 273 | return 0; |
| 274 | |
| 275 | return soc->ops->cmn_drv_ops->txrx_pdev_post_attach(pdev); |
Leo Chang | db6358c | 2016-09-27 17:00:52 -0700 | [diff] [blame] | 276 | } |
| 277 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 278 | static inline void |
Himanshu Agarwal | b7e3c98 | 2017-02-23 16:26:33 +0530 | [diff] [blame] | 279 | cdp_pdev_pre_detach(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, int force) |
| 280 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 281 | if (!soc || !soc->ops) { |
| 282 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 283 | "%s: Invalid Instance:", __func__); |
| 284 | QDF_BUG(0); |
| 285 | return; |
| 286 | } |
| 287 | |
| 288 | if (!soc->ops->cmn_drv_ops || |
| 289 | !soc->ops->cmn_drv_ops->txrx_pdev_pre_detach) |
| 290 | return; |
| 291 | |
| 292 | soc->ops->cmn_drv_ops->txrx_pdev_pre_detach(pdev, force); |
Himanshu Agarwal | b7e3c98 | 2017-02-23 16:26:33 +0530 | [diff] [blame] | 293 | } |
| 294 | |
| 295 | static inline void |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 296 | cdp_pdev_detach(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, int force) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 297 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 298 | if (!soc || !soc->ops) { |
| 299 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 300 | "%s: Invalid Instance:", __func__); |
| 301 | QDF_BUG(0); |
| 302 | return; |
| 303 | } |
| 304 | |
| 305 | if (!soc->ops->cmn_drv_ops || |
| 306 | !soc->ops->cmn_drv_ops->txrx_pdev_detach) |
| 307 | return; |
| 308 | |
| 309 | soc->ops->cmn_drv_ops->txrx_pdev_detach(pdev, force); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 310 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 311 | |
Anish Nataraj | e9d4c3b | 2018-11-24 22:24:56 +0530 | [diff] [blame] | 312 | static inline void |
| 313 | cdp_pdev_deinit(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, int force) |
| 314 | { |
| 315 | if (!soc || !soc->ops) { |
| 316 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 317 | "%s: Invalid Instance:", __func__); |
| 318 | QDF_BUG(0); |
| 319 | return; |
| 320 | } |
| 321 | |
| 322 | if (!soc->ops->cmn_drv_ops || |
| 323 | !soc->ops->cmn_drv_ops->txrx_pdev_deinit) |
| 324 | return; |
| 325 | |
| 326 | soc->ops->cmn_drv_ops->txrx_pdev_deinit(pdev, force); |
| 327 | } |
| 328 | |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 329 | static inline void *cdp_peer_create |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 330 | (ol_txrx_soc_handle soc, struct cdp_vdev *vdev, |
Akshay Kosigi | 78eced8 | 2018-05-14 14:53:48 +0530 | [diff] [blame] | 331 | uint8_t *peer_mac_addr, struct cdp_ctrl_objmgr_peer *ctrl_peer) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 332 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 333 | if (!soc || !soc->ops) { |
| 334 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 335 | "%s: Invalid Instance:", __func__); |
| 336 | QDF_BUG(0); |
| 337 | return NULL; |
| 338 | } |
| 339 | |
| 340 | if (!soc->ops->cmn_drv_ops || |
| 341 | !soc->ops->cmn_drv_ops->txrx_peer_create) |
| 342 | return NULL; |
| 343 | |
| 344 | return soc->ops->cmn_drv_ops->txrx_peer_create(vdev, |
Akshay Kosigi | 78eced8 | 2018-05-14 14:53:48 +0530 | [diff] [blame] | 345 | peer_mac_addr, ctrl_peer); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 346 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 347 | |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 348 | static inline void cdp_peer_setup |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 349 | (ol_txrx_soc_handle soc, struct cdp_vdev *vdev, void *peer) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 350 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 351 | if (!soc || !soc->ops) { |
| 352 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 353 | "%s: Invalid Instance:", __func__); |
| 354 | QDF_BUG(0); |
| 355 | return; |
| 356 | } |
| 357 | |
| 358 | if (!soc->ops->cmn_drv_ops || |
| 359 | !soc->ops->cmn_drv_ops->txrx_peer_setup) |
| 360 | return; |
| 361 | |
| 362 | soc->ops->cmn_drv_ops->txrx_peer_setup(vdev, |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 363 | peer); |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 364 | } |
| 365 | |
Chaithanya Garrepalli | 9cc562c | 2018-11-16 18:30:41 +0530 | [diff] [blame] | 366 | /** |
| 367 | * cdp_peer_get_ast_info_by_soc() - search the soc AST hash table |
| 368 | * and return ast entry information |
| 369 | * of first ast entry found in the |
| 370 | * table with given mac address |
| 371 | * |
| 372 | * @soc - data path soc handle |
| 373 | * @ast_mac_addr - AST entry mac address |
| 374 | * @ast_entry_info - ast entry information |
| 375 | * |
| 376 | * return - true if ast entry found with ast_mac_addr |
| 377 | * false if ast entry not found |
| 378 | */ |
| 379 | static inline bool cdp_peer_get_ast_info_by_soc |
| 380 | (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr, |
| 381 | struct cdp_ast_entry_info *ast_entry_info) |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 382 | { |
| 383 | if (!soc || !soc->ops) { |
| 384 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 385 | "%s: Invalid Instance:", __func__); |
| 386 | QDF_BUG(0); |
Chaithanya Garrepalli | 9cc562c | 2018-11-16 18:30:41 +0530 | [diff] [blame] | 387 | return false; |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 388 | } |
| 389 | |
| 390 | if (!soc->ops->cmn_drv_ops || |
Chaithanya Garrepalli | 9cc562c | 2018-11-16 18:30:41 +0530 | [diff] [blame] | 391 | !soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_soc) |
| 392 | return false; |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 393 | |
Chaithanya Garrepalli | 9cc562c | 2018-11-16 18:30:41 +0530 | [diff] [blame] | 394 | return soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_soc |
| 395 | (soc, ast_mac_addr, |
| 396 | ast_entry_info); |
Chaithanya Garrepalli | cf347d1 | 2018-09-18 14:28:55 +0530 | [diff] [blame] | 397 | } |
| 398 | |
Chaithanya Garrepalli | 9cc562c | 2018-11-16 18:30:41 +0530 | [diff] [blame] | 399 | /** |
| 400 | * cdp_peer_get_ast_info_by_pdev() - search the soc AST hash table |
| 401 | * and return ast entry information |
| 402 | * if mac address and pdev_id matches |
| 403 | * |
| 404 | * @soc - data path soc handle |
| 405 | * @ast_mac_addr - AST entry mac address |
| 406 | * @pdev_id - pdev_id |
| 407 | * @ast_entry_info - ast entry information |
| 408 | * |
| 409 | * return - true if ast entry found with ast_mac_addr |
| 410 | * false if ast entry not found |
| 411 | */ |
| 412 | static inline bool cdp_peer_get_ast_info_by_pdev |
Chaithanya Garrepalli | cf347d1 | 2018-09-18 14:28:55 +0530 | [diff] [blame] | 413 | (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr, |
Chaithanya Garrepalli | 9cc562c | 2018-11-16 18:30:41 +0530 | [diff] [blame] | 414 | uint8_t pdev_id, |
| 415 | struct cdp_ast_entry_info *ast_entry_info) |
Chaithanya Garrepalli | cf347d1 | 2018-09-18 14:28:55 +0530 | [diff] [blame] | 416 | { |
| 417 | if (!soc || !soc->ops) { |
| 418 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 419 | "%s: Invalid Instance:", __func__); |
| 420 | QDF_BUG(0); |
Chaithanya Garrepalli | 9cc562c | 2018-11-16 18:30:41 +0530 | [diff] [blame] | 421 | return false; |
Chaithanya Garrepalli | cf347d1 | 2018-09-18 14:28:55 +0530 | [diff] [blame] | 422 | } |
| 423 | |
| 424 | if (!soc->ops->cmn_drv_ops || |
Chaithanya Garrepalli | 9cc562c | 2018-11-16 18:30:41 +0530 | [diff] [blame] | 425 | !soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_pdev) |
| 426 | return false; |
Chaithanya Garrepalli | cf347d1 | 2018-09-18 14:28:55 +0530 | [diff] [blame] | 427 | |
Chaithanya Garrepalli | 9cc562c | 2018-11-16 18:30:41 +0530 | [diff] [blame] | 428 | return soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_pdev |
Chaithanya Garrepalli | cf347d1 | 2018-09-18 14:28:55 +0530 | [diff] [blame] | 429 | (soc, |
| 430 | ast_mac_addr, |
Chaithanya Garrepalli | 9cc562c | 2018-11-16 18:30:41 +0530 | [diff] [blame] | 431 | pdev_id, |
| 432 | ast_entry_info); |
| 433 | } |
| 434 | |
| 435 | /** |
| 436 | * cdp_peer_ast_delete_by_soc() - delete the ast entry from soc AST hash table |
| 437 | * with given mac address |
| 438 | * |
| 439 | * @soc - data path soc handle |
| 440 | * @ast_mac_addr - AST entry mac address |
| 441 | * @callback - callback function to called on ast delete response from FW |
| 442 | * @cookie - argument to be passed to callback |
| 443 | * |
| 444 | * return - QDF_STATUS_SUCCESS if ast entry found with ast_mac_addr and delete |
| 445 | * is sent |
| 446 | * QDF_STATUS_E_INVAL false if ast entry not found |
| 447 | */ |
| 448 | static inline QDF_STATUS cdp_peer_ast_delete_by_soc |
| 449 | (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr, |
| 450 | txrx_ast_free_cb callback, |
| 451 | void *cookie) |
| 452 | { |
| 453 | if (!soc || !soc->ops) { |
| 454 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 455 | "%s: Invalid Instance:", __func__); |
| 456 | QDF_BUG(0); |
| 457 | return QDF_STATUS_E_INVAL; |
| 458 | } |
| 459 | |
| 460 | if (!soc->ops->cmn_drv_ops || |
| 461 | !soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_soc) |
| 462 | return QDF_STATUS_E_INVAL; |
| 463 | |
| 464 | return soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_soc |
| 465 | (soc, |
| 466 | ast_mac_addr, |
| 467 | callback, |
| 468 | cookie); |
| 469 | } |
| 470 | |
| 471 | /** |
| 472 | * cdp_peer_ast_delete_by_pdev() - delete the ast entry from soc AST hash table |
| 473 | * if mac address and pdev_id matches |
| 474 | * |
| 475 | * @soc - data path soc handle |
| 476 | * @ast_mac_addr - AST entry mac address |
| 477 | * @pdev_id - pdev id |
| 478 | * @callback - callback function to called on ast delete response from FW |
| 479 | * @cookie - argument to be passed to callback |
| 480 | * |
| 481 | * return - QDF_STATUS_SUCCESS if ast entry found with ast_mac_addr and delete |
| 482 | * is sent |
| 483 | * QDF_STATUS_E_INVAL false if ast entry not found |
| 484 | */ |
| 485 | static inline QDF_STATUS cdp_peer_ast_delete_by_pdev |
| 486 | (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr, |
| 487 | uint8_t pdev_id, txrx_ast_free_cb callback, |
| 488 | void *cookie) |
| 489 | { |
| 490 | if (!soc || !soc->ops) { |
| 491 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 492 | "%s: Invalid Instance:", __func__); |
| 493 | QDF_BUG(0); |
| 494 | return QDF_STATUS_E_INVAL; |
| 495 | } |
| 496 | |
| 497 | if (!soc->ops->cmn_drv_ops || |
| 498 | !soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_pdev) |
| 499 | return QDF_STATUS_E_INVAL; |
| 500 | |
| 501 | return soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_pdev |
| 502 | (soc, |
| 503 | ast_mac_addr, |
| 504 | pdev_id, |
| 505 | callback, |
| 506 | cookie); |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 507 | } |
| 508 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 509 | static inline int cdp_peer_add_ast |
| 510 | (ol_txrx_soc_handle soc, struct cdp_peer *peer_handle, |
| 511 | uint8_t *mac_addr, enum cdp_txrx_ast_entry_type type, uint32_t flags) |
| 512 | { |
| 513 | if (!soc || !soc->ops) { |
| 514 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 515 | "%s: Invalid Instance:", __func__); |
| 516 | QDF_BUG(0); |
| 517 | return 0; |
| 518 | } |
| 519 | |
| 520 | if (!soc->ops->cmn_drv_ops || |
| 521 | !soc->ops->cmn_drv_ops->txrx_peer_add_ast) |
| 522 | return 0; |
| 523 | |
| 524 | return soc->ops->cmn_drv_ops->txrx_peer_add_ast(soc, |
| 525 | peer_handle, |
| 526 | mac_addr, |
| 527 | type, |
| 528 | flags); |
| 529 | } |
| 530 | |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 531 | static inline void cdp_peer_reset_ast |
Chaithanya Garrepalli | 267ae0e | 2019-02-19 23:45:12 +0530 | [diff] [blame] | 532 | (ol_txrx_soc_handle soc, uint8_t *wds_macaddr, uint8_t *peer_macaddr, |
| 533 | void *vdev_hdl) |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 534 | { |
| 535 | |
| 536 | if (!soc || !soc->ops) { |
| 537 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 538 | "%s: Invalid Instance:", __func__); |
| 539 | QDF_BUG(0); |
| 540 | return; |
| 541 | } |
| 542 | if (!soc->ops->cmn_drv_ops || |
| 543 | !soc->ops->cmn_drv_ops->txrx_peer_reset_ast) |
| 544 | return; |
| 545 | |
Chaithanya Garrepalli | 267ae0e | 2019-02-19 23:45:12 +0530 | [diff] [blame] | 546 | soc->ops->cmn_drv_ops->txrx_peer_reset_ast(soc, wds_macaddr, |
| 547 | peer_macaddr, vdev_hdl); |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 548 | } |
| 549 | |
| 550 | static inline void cdp_peer_reset_ast_table |
Santosh Anbu | 76693bc | 2018-04-23 16:38:54 +0530 | [diff] [blame] | 551 | (ol_txrx_soc_handle soc, void *vdev_hdl) |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 552 | { |
| 553 | if (!soc || !soc->ops) { |
| 554 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 555 | "%s: Invalid Instance:", __func__); |
| 556 | QDF_BUG(0); |
| 557 | return; |
| 558 | } |
| 559 | |
| 560 | if (!soc->ops->cmn_drv_ops || |
| 561 | !soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table) |
| 562 | return; |
| 563 | |
Santosh Anbu | 76693bc | 2018-04-23 16:38:54 +0530 | [diff] [blame] | 564 | soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table(soc, vdev_hdl); |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 565 | } |
| 566 | |
| 567 | static inline void cdp_peer_flush_ast_table |
| 568 | (ol_txrx_soc_handle soc) |
| 569 | { |
| 570 | if (!soc || !soc->ops) { |
| 571 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 572 | "%s: Invalid Instance:", __func__); |
| 573 | QDF_BUG(0); |
| 574 | return; |
| 575 | } |
| 576 | |
| 577 | if (!soc->ops->cmn_drv_ops || |
| 578 | !soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table) |
| 579 | return; |
| 580 | |
| 581 | soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table(soc); |
| 582 | } |
| 583 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 584 | static inline int cdp_peer_update_ast |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 585 | (ol_txrx_soc_handle soc, uint8_t *wds_macaddr, |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 586 | struct cdp_peer *peer_handle, uint32_t flags) |
| 587 | { |
| 588 | if (!soc || !soc->ops) { |
| 589 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 590 | "%s: Invalid Instance:", __func__); |
| 591 | QDF_BUG(0); |
| 592 | return 0; |
| 593 | } |
| 594 | |
| 595 | if (!soc->ops->cmn_drv_ops || |
| 596 | !soc->ops->cmn_drv_ops->txrx_peer_update_ast) |
| 597 | return 0; |
| 598 | |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 599 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 600 | return soc->ops->cmn_drv_ops->txrx_peer_update_ast(soc, |
| 601 | peer_handle, |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 602 | wds_macaddr, |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 603 | flags); |
| 604 | } |
| 605 | |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 606 | static inline void cdp_peer_teardown |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 607 | (ol_txrx_soc_handle soc, struct cdp_vdev *vdev, void *peer) |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 608 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 609 | if (!soc || !soc->ops) { |
| 610 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 611 | "%s: Invalid Instance:", __func__); |
| 612 | QDF_BUG(0); |
| 613 | return; |
| 614 | } |
| 615 | |
| 616 | if (!soc->ops->cmn_drv_ops || |
| 617 | !soc->ops->cmn_drv_ops->txrx_peer_teardown) |
| 618 | return; |
| 619 | |
| 620 | soc->ops->cmn_drv_ops->txrx_peer_teardown(vdev, peer); |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 621 | } |
| 622 | |
| 623 | static inline void |
Pavankumar Nandeshwar | 753eed3 | 2019-01-22 15:40:15 +0530 | [diff] [blame] | 624 | cdp_vdev_flush_peers(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, |
| 625 | bool unmap_only) |
| 626 | { |
| 627 | if (!soc || !soc->ops) { |
| 628 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 629 | "%s: Invalid Instance:", __func__); |
| 630 | QDF_BUG(0); |
| 631 | return; |
| 632 | } |
| 633 | |
| 634 | if (!soc->ops->cmn_drv_ops || |
| 635 | !soc->ops->cmn_drv_ops->txrx_vdev_flush_peers) |
| 636 | return; |
| 637 | |
| 638 | soc->ops->cmn_drv_ops->txrx_vdev_flush_peers(vdev, unmap_only); |
| 639 | } |
| 640 | |
| 641 | static inline void |
Naveen Rawat | 761329b | 2017-09-19 10:30:11 -0700 | [diff] [blame] | 642 | cdp_peer_delete(ol_txrx_soc_handle soc, void *peer, uint32_t bitmap) |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 643 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 644 | if (!soc || !soc->ops) { |
| 645 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 646 | "%s: Invalid Instance:", __func__); |
| 647 | QDF_BUG(0); |
| 648 | return; |
| 649 | } |
| 650 | |
| 651 | if (!soc->ops->cmn_drv_ops || |
| 652 | !soc->ops->cmn_drv_ops->txrx_peer_delete) |
| 653 | return; |
| 654 | |
| 655 | soc->ops->cmn_drv_ops->txrx_peer_delete(peer, bitmap); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 656 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 657 | |
Alok Kumar | 2e254c5 | 2018-11-28 17:26:53 +0530 | [diff] [blame] | 658 | static inline void |
| 659 | cdp_peer_delete_sync(ol_txrx_soc_handle soc, void *peer, |
| 660 | QDF_STATUS(*delete_cb)( |
| 661 | uint8_t vdev_id, |
| 662 | uint32_t peerid_cnt, |
| 663 | uint16_t *peerid_list), |
| 664 | uint32_t bitmap) |
| 665 | { |
| 666 | if (!soc || !soc->ops) { |
| 667 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 668 | "%s: Invalid Instance:", __func__); |
| 669 | QDF_BUG(0); |
| 670 | return; |
| 671 | } |
| 672 | |
| 673 | if (!soc->ops->cmn_drv_ops || |
| 674 | !soc->ops->cmn_drv_ops->txrx_peer_delete_sync) |
| 675 | return; |
| 676 | |
| 677 | soc->ops->cmn_drv_ops->txrx_peer_delete_sync(peer, |
| 678 | delete_cb, |
| 679 | bitmap); |
| 680 | } |
| 681 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 682 | static inline int |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 683 | cdp_set_monitor_mode(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, |
| 684 | uint8_t smart_monitor) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 685 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 686 | if (!soc || !soc->ops) { |
| 687 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 688 | "%s: Invalid Instance:", __func__); |
| 689 | QDF_BUG(0); |
| 690 | return 0; |
| 691 | } |
| 692 | |
| 693 | if (!soc->ops->cmn_drv_ops || |
| 694 | !soc->ops->cmn_drv_ops->txrx_set_monitor_mode) |
| 695 | return 0; |
| 696 | |
| 697 | return soc->ops->cmn_drv_ops->txrx_set_monitor_mode(vdev, |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 698 | smart_monitor); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 699 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 700 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 701 | static inline void |
| 702 | cdp_set_curchan(ol_txrx_soc_handle soc, |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 703 | struct cdp_pdev *pdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 704 | uint32_t chan_mhz) |
| 705 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 706 | if (!soc || !soc->ops) { |
| 707 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 708 | "%s: Invalid Instance:", __func__); |
| 709 | QDF_BUG(0); |
| 710 | return; |
| 711 | } |
| 712 | |
| 713 | if (!soc->ops->cmn_drv_ops || |
| 714 | !soc->ops->cmn_drv_ops->txrx_set_curchan) |
| 715 | return; |
| 716 | |
| 717 | soc->ops->cmn_drv_ops->txrx_set_curchan(pdev, chan_mhz); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 718 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 719 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 720 | static inline void |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 721 | cdp_set_privacy_filters(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 722 | void *filter, uint32_t num) |
| 723 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 724 | if (!soc || !soc->ops) { |
| 725 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 726 | "%s: Invalid Instance:", __func__); |
| 727 | QDF_BUG(0); |
| 728 | return; |
| 729 | } |
| 730 | |
| 731 | if (!soc->ops->cmn_drv_ops || |
| 732 | !soc->ops->cmn_drv_ops->txrx_set_privacy_filters) |
| 733 | return; |
| 734 | |
| 735 | soc->ops->cmn_drv_ops->txrx_set_privacy_filters(vdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 736 | filter, num); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 737 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 738 | |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 739 | static inline int |
| 740 | cdp_set_monitor_filter(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, |
| 741 | struct cdp_monitor_filter *filter_val) |
| 742 | { |
| 743 | if (soc->ops->mon_ops->txrx_set_advance_monitor_filter) |
| 744 | return soc->ops->mon_ops->txrx_set_advance_monitor_filter(pdev, |
| 745 | filter_val); |
| 746 | return 0; |
| 747 | } |
| 748 | |
| 749 | |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 750 | /****************************************************************************** |
| 751 | * Data Interface (B Interface) |
| 752 | *****************************************************************************/ |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 753 | static inline void |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 754 | cdp_vdev_register(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, |
Akshay Kosigi | dbbaef4 | 2018-05-03 23:39:27 +0530 | [diff] [blame] | 755 | void *osif_vdev, struct cdp_ctrl_objmgr_vdev *ctrl_vdev, |
| 756 | struct ol_txrx_ops *txrx_ops) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 757 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 758 | if (!soc || !soc->ops) { |
| 759 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 760 | "%s: Invalid Instance:", __func__); |
| 761 | QDF_BUG(0); |
| 762 | return; |
| 763 | } |
| 764 | |
| 765 | if (!soc->ops->cmn_drv_ops || |
| 766 | !soc->ops->cmn_drv_ops->txrx_vdev_register) |
| 767 | return; |
| 768 | |
| 769 | soc->ops->cmn_drv_ops->txrx_vdev_register(vdev, |
Akshay Kosigi | dbbaef4 | 2018-05-03 23:39:27 +0530 | [diff] [blame] | 770 | osif_vdev, ctrl_vdev, txrx_ops); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 771 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 772 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 773 | static inline int |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 774 | cdp_mgmt_send(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 775 | qdf_nbuf_t tx_mgmt_frm, uint8_t type) |
| 776 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 777 | if (!soc || !soc->ops) { |
| 778 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 779 | "%s: Invalid Instance:", __func__); |
| 780 | QDF_BUG(0); |
| 781 | return 0; |
| 782 | } |
| 783 | |
| 784 | if (!soc->ops->cmn_drv_ops || |
| 785 | !soc->ops->cmn_drv_ops->txrx_mgmt_send) |
| 786 | return 0; |
| 787 | |
| 788 | return soc->ops->cmn_drv_ops->txrx_mgmt_send(vdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 789 | tx_mgmt_frm, type); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 790 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 791 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 792 | static inline int |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 793 | cdp_mgmt_send_ext(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 794 | qdf_nbuf_t tx_mgmt_frm, uint8_t type, |
| 795 | uint8_t use_6mbps, uint16_t chanfreq) |
| 796 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 797 | if (!soc || !soc->ops) { |
| 798 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 799 | "%s: Invalid Instance:", __func__); |
| 800 | QDF_BUG(0); |
| 801 | return 0; |
| 802 | } |
| 803 | |
| 804 | if (!soc->ops->cmn_drv_ops || |
| 805 | !soc->ops->cmn_drv_ops->txrx_mgmt_send_ext) |
| 806 | return 0; |
| 807 | |
| 808 | return soc->ops->cmn_drv_ops->txrx_mgmt_send_ext |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 809 | (vdev, tx_mgmt_frm, type, use_6mbps, chanfreq); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 810 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 811 | |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 812 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 813 | static inline void |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 814 | cdp_mgmt_tx_cb_set(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, |
Sravan Kumar Kairam | 786886b | 2017-07-19 17:38:20 +0530 | [diff] [blame] | 815 | uint8_t type, ol_txrx_mgmt_tx_cb download_cb, |
| 816 | ol_txrx_mgmt_tx_cb ota_ack_cb, void *ctxt) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 817 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 818 | if (!soc || !soc->ops) { |
| 819 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 820 | "%s: Invalid Instance:", __func__); |
| 821 | QDF_BUG(0); |
| 822 | return; |
| 823 | } |
| 824 | |
| 825 | if (!soc->ops->cmn_drv_ops || |
| 826 | !soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set) |
| 827 | return; |
| 828 | |
| 829 | soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 830 | (pdev, type, download_cb, ota_ack_cb, ctxt); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 831 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 832 | |
Alok Kumar | 14b3ba0 | 2019-02-14 14:37:02 +0530 | [diff] [blame] | 833 | static inline void |
| 834 | cdp_peer_unmap_sync_cb_set(ol_txrx_soc_handle soc, |
| 835 | struct cdp_pdev *pdev, |
| 836 | QDF_STATUS(*unmap_resp_cb)( |
| 837 | uint8_t vdev_id, |
| 838 | uint32_t peerid_cnt, |
| 839 | uint16_t *peerid_list)) |
| 840 | { |
| 841 | if (!soc || !soc->ops) { |
| 842 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 843 | "%s: Invalid Instance:", __func__); |
| 844 | QDF_BUG(0); |
| 845 | return; |
| 846 | } |
| 847 | |
| 848 | if (!soc->ops->cmn_drv_ops || |
| 849 | !soc->ops->cmn_drv_ops->txrx_peer_unmap_sync_cb_set) |
| 850 | return; |
| 851 | |
| 852 | soc->ops->cmn_drv_ops->txrx_peer_unmap_sync_cb_set(pdev, unmap_resp_cb); |
| 853 | } |
| 854 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 855 | static inline int cdp_get_tx_pending(ol_txrx_soc_handle soc, |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 856 | struct cdp_pdev *pdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 857 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 858 | if (!soc || !soc->ops) { |
| 859 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 860 | "%s: Invalid Instance:", __func__); |
| 861 | QDF_BUG(0); |
| 862 | return 0; |
| 863 | } |
| 864 | |
| 865 | if (!soc->ops->cmn_drv_ops || |
| 866 | !soc->ops->cmn_drv_ops->txrx_get_tx_pending) |
| 867 | return 0; |
| 868 | |
| 869 | |
| 870 | return soc->ops->cmn_drv_ops->txrx_get_tx_pending(pdev); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 871 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 872 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 873 | static inline void |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 874 | cdp_data_tx_cb_set(ol_txrx_soc_handle soc, struct cdp_vdev *data_vdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 875 | ol_txrx_data_tx_cb callback, void *ctxt) |
| 876 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 877 | if (!soc || !soc->ops) { |
| 878 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 879 | "%s: Invalid Instance:", __func__); |
| 880 | QDF_BUG(0); |
| 881 | return; |
| 882 | } |
| 883 | |
| 884 | if (!soc->ops->cmn_drv_ops || |
| 885 | !soc->ops->cmn_drv_ops->txrx_data_tx_cb_set) |
| 886 | return; |
| 887 | |
| 888 | soc->ops->cmn_drv_ops->txrx_data_tx_cb_set(data_vdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 889 | callback, ctxt); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 890 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 891 | |
| 892 | /****************************************************************************** |
Jeff Johnson | ff2dfb2 | 2018-05-12 10:27:57 -0700 | [diff] [blame] | 893 | * Statistics and Debugging Interface (C Interface) |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 894 | *****************************************************************************/ |
Orhan K AKYILDIZ | bcc3c4e | 2017-01-29 13:12:20 -0800 | [diff] [blame] | 895 | /** |
| 896 | * External Device physical address types |
| 897 | * |
| 898 | * Currently, both MAC and IPA uController use the same size addresses |
| 899 | * and descriptors are exchanged between these two depending on the mode. |
| 900 | * |
| 901 | * Rationale: qdf_dma_addr_t is the type used internally on the host for DMA |
| 902 | * operations. However, external device physical address sizes |
| 903 | * may be different from host-specific physical address sizes. |
| 904 | * This calls for the following definitions for target devices |
| 905 | * (MAC, IPA uc). |
| 906 | */ |
| 907 | #if HTT_PADDR64 |
| 908 | typedef uint64_t target_paddr_t; |
| 909 | #else |
| 910 | typedef uint32_t target_paddr_t; |
| 911 | #endif /*HTT_PADDR64 */ |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 912 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 913 | static inline int |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 914 | cdp_aggr_cfg(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 915 | int max_subfrms_ampdu, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 916 | int max_subfrms_amsdu) |
| 917 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 918 | if (!soc || !soc->ops) { |
| 919 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 920 | "%s: Invalid Instance:", __func__); |
| 921 | QDF_BUG(0); |
| 922 | return 0; |
| 923 | } |
| 924 | |
| 925 | if (!soc->ops->cmn_drv_ops || |
| 926 | !soc->ops->cmn_drv_ops->txrx_aggr_cfg) |
| 927 | return 0; |
| 928 | |
| 929 | return soc->ops->cmn_drv_ops->txrx_aggr_cfg(vdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 930 | max_subfrms_ampdu, max_subfrms_amsdu); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 931 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 932 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 933 | static inline int |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 934 | cdp_fw_stats_get(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 935 | struct ol_txrx_stats_req *req, bool per_vdev, |
| 936 | bool response_expected) |
| 937 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 938 | if (!soc || !soc->ops) { |
| 939 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 940 | "%s: Invalid Instance:", __func__); |
| 941 | QDF_BUG(0); |
| 942 | return 0; |
| 943 | } |
| 944 | |
| 945 | if (!soc->ops->cmn_drv_ops || |
| 946 | !soc->ops->cmn_drv_ops->txrx_fw_stats_get) |
| 947 | return 0; |
| 948 | |
| 949 | return soc->ops->cmn_drv_ops->txrx_fw_stats_get(vdev, req, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 950 | per_vdev, response_expected); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 951 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 952 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 953 | static inline int |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 954 | cdp_debug(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, int debug_specs) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 955 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 956 | if (!soc || !soc->ops) { |
| 957 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 958 | "%s: Invalid Instance:", __func__); |
| 959 | QDF_BUG(0); |
| 960 | return 0; |
| 961 | } |
| 962 | |
| 963 | if (!soc->ops->cmn_drv_ops || |
| 964 | !soc->ops->cmn_drv_ops->txrx_debug) |
| 965 | return 0; |
| 966 | |
| 967 | return soc->ops->cmn_drv_ops->txrx_debug(vdev, debug_specs); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 968 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 969 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 970 | static inline void cdp_fw_stats_cfg(ol_txrx_soc_handle soc, |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 971 | struct cdp_vdev *vdev, uint8_t cfg_stats_type, uint32_t cfg_val) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 972 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 973 | if (!soc || !soc->ops) { |
| 974 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 975 | "%s: Invalid Instance:", __func__); |
| 976 | QDF_BUG(0); |
| 977 | return; |
| 978 | } |
| 979 | |
| 980 | if (!soc->ops->cmn_drv_ops || |
| 981 | !soc->ops->cmn_drv_ops->txrx_fw_stats_cfg) |
| 982 | return; |
| 983 | |
| 984 | soc->ops->cmn_drv_ops->txrx_fw_stats_cfg(vdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 985 | cfg_stats_type, cfg_val); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 986 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 987 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 988 | static inline void cdp_print_level_set(ol_txrx_soc_handle soc, unsigned level) |
| 989 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 990 | if (!soc || !soc->ops) { |
| 991 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 992 | "%s: Invalid Instance:", __func__); |
| 993 | QDF_BUG(0); |
| 994 | return; |
| 995 | } |
| 996 | |
| 997 | if (!soc->ops->cmn_drv_ops || |
| 998 | !soc->ops->cmn_drv_ops->txrx_print_level_set) |
| 999 | return; |
| 1000 | |
| 1001 | soc->ops->cmn_drv_ops->txrx_print_level_set(level); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1002 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 1003 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1004 | static inline uint8_t * |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 1005 | cdp_get_vdev_mac_addr(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1006 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1007 | if (!soc || !soc->ops) { |
| 1008 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1009 | "%s: Invalid Instance:", __func__); |
| 1010 | QDF_BUG(0); |
| 1011 | return NULL; |
| 1012 | } |
| 1013 | |
| 1014 | if (!soc->ops->cmn_drv_ops || |
| 1015 | !soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr) |
| 1016 | return NULL; |
| 1017 | |
| 1018 | return soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr(vdev); |
| 1019 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1020 | } |
Manjunathappa Prakash | 5f45de5 | 2016-03-07 11:25:38 -0800 | [diff] [blame] | 1021 | |
| 1022 | /** |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1023 | * cdp_get_vdev_struct_mac_addr() - Return handle to struct qdf_mac_addr of |
Manjunathappa Prakash | 5f45de5 | 2016-03-07 11:25:38 -0800 | [diff] [blame] | 1024 | * vdev |
| 1025 | * @vdev: vdev handle |
| 1026 | * |
| 1027 | * Return: Handle to struct qdf_mac_addr |
| 1028 | */ |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1029 | static inline struct qdf_mac_addr *cdp_get_vdev_struct_mac_addr |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 1030 | (ol_txrx_soc_handle soc, struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1031 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1032 | if (!soc || !soc->ops) { |
| 1033 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1034 | "%s: Invalid Instance:", __func__); |
| 1035 | QDF_BUG(0); |
| 1036 | return NULL; |
| 1037 | } |
| 1038 | |
| 1039 | if (!soc->ops->cmn_drv_ops || |
| 1040 | !soc->ops->cmn_drv_ops->txrx_get_vdev_struct_mac_addr) |
| 1041 | return NULL; |
| 1042 | |
| 1043 | return soc->ops->cmn_drv_ops->txrx_get_vdev_struct_mac_addr |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1044 | (vdev); |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1045 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1046 | } |
Manjunathappa Prakash | 5f45de5 | 2016-03-07 11:25:38 -0800 | [diff] [blame] | 1047 | |
| 1048 | /** |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1049 | * cdp_get_pdev_from_vdev() - Return handle to pdev of vdev |
Manjunathappa Prakash | 5f45de5 | 2016-03-07 11:25:38 -0800 | [diff] [blame] | 1050 | * @vdev: vdev handle |
| 1051 | * |
| 1052 | * Return: Handle to pdev |
| 1053 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 1054 | static inline struct cdp_pdev *cdp_get_pdev_from_vdev |
| 1055 | (ol_txrx_soc_handle soc, struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1056 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1057 | if (!soc || !soc->ops) { |
| 1058 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1059 | "%s: Invalid Instance:", __func__); |
| 1060 | QDF_BUG(0); |
| 1061 | return NULL; |
| 1062 | } |
| 1063 | |
| 1064 | if (!soc->ops->cmn_drv_ops || |
| 1065 | !soc->ops->cmn_drv_ops->txrx_get_pdev_from_vdev) |
| 1066 | return NULL; |
| 1067 | |
| 1068 | return soc->ops->cmn_drv_ops->txrx_get_pdev_from_vdev(vdev); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1069 | } |
Manjunathappa Prakash | 5f45de5 | 2016-03-07 11:25:38 -0800 | [diff] [blame] | 1070 | |
| 1071 | /** |
Mohit Khanna | 7ac554b | 2018-05-24 11:58:13 -0700 | [diff] [blame] | 1072 | * cdp_get_os_rx_handles_from_vdev() - Return os rx handles for a vdev |
| 1073 | * @soc: ol_txrx_soc_handle handle |
| 1074 | * @vdev: vdev for which os rx handles are needed |
| 1075 | * @stack_fn_p: pointer to stack function pointer |
| 1076 | * @osif_handle_p: pointer to ol_osif_vdev_handle |
| 1077 | * |
| 1078 | * Return: void |
| 1079 | */ |
| 1080 | static inline |
| 1081 | void cdp_get_os_rx_handles_from_vdev(ol_txrx_soc_handle soc, |
| 1082 | struct cdp_vdev *vdev, |
| 1083 | ol_txrx_rx_fp *stack_fn_p, |
| 1084 | ol_osif_vdev_handle *osif_handle_p) |
| 1085 | { |
| 1086 | if (!soc || !soc->ops) { |
| 1087 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1088 | "%s: Invalid Instance:", __func__); |
| 1089 | QDF_BUG(0); |
| 1090 | return; |
| 1091 | } |
| 1092 | |
| 1093 | if (!soc->ops->cmn_drv_ops || |
| 1094 | !soc->ops->cmn_drv_ops->txrx_get_os_rx_handles_from_vdev) |
| 1095 | return; |
| 1096 | |
| 1097 | soc->ops->cmn_drv_ops->txrx_get_os_rx_handles_from_vdev(vdev, |
| 1098 | stack_fn_p, |
| 1099 | osif_handle_p); |
| 1100 | } |
| 1101 | |
| 1102 | /** |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1103 | * cdp_get_ctrl_pdev_from_vdev() - Return control pdev of vdev |
Manjunathappa Prakash | 5f45de5 | 2016-03-07 11:25:38 -0800 | [diff] [blame] | 1104 | * @vdev: vdev handle |
| 1105 | * |
| 1106 | * Return: Handle to control pdev |
| 1107 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 1108 | static inline struct cdp_cfg * |
| 1109 | cdp_get_ctrl_pdev_from_vdev(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1110 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1111 | if (!soc || !soc->ops) { |
| 1112 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1113 | "%s: Invalid Instance:", __func__); |
| 1114 | QDF_BUG(0); |
| 1115 | return NULL; |
| 1116 | } |
| 1117 | |
| 1118 | if (!soc->ops->cmn_drv_ops || |
| 1119 | !soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev) |
| 1120 | return NULL; |
| 1121 | |
| 1122 | return soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1123 | (vdev); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1124 | } |
| 1125 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 1126 | static inline struct cdp_vdev * |
| 1127 | cdp_get_vdev_from_vdev_id(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, |
Leo Chang | db6358c | 2016-09-27 17:00:52 -0700 | [diff] [blame] | 1128 | uint8_t vdev_id) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1129 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1130 | if (!soc || !soc->ops) { |
| 1131 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1132 | "%s: Invalid Instance:", __func__); |
| 1133 | QDF_BUG(0); |
| 1134 | return NULL; |
| 1135 | } |
| 1136 | |
| 1137 | if (!soc->ops->cmn_drv_ops || |
| 1138 | !soc->ops->cmn_drv_ops->txrx_get_vdev_from_vdev_id) |
| 1139 | return NULL; |
| 1140 | |
| 1141 | return soc->ops->cmn_drv_ops->txrx_get_vdev_from_vdev_id |
Leo Chang | db6358c | 2016-09-27 17:00:52 -0700 | [diff] [blame] | 1142 | (pdev, vdev_id); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1143 | } |
| 1144 | |
chenguo | 2a73379 | 2018-11-01 16:10:38 +0800 | [diff] [blame] | 1145 | static inline struct cdp_vdev * |
| 1146 | cdp_get_mon_vdev_from_pdev(ol_txrx_soc_handle soc, struct cdp_pdev *pdev) |
| 1147 | { |
| 1148 | if (!soc || !soc->ops) { |
| 1149 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1150 | "%s: Invalid Instance:", __func__); |
| 1151 | QDF_BUG(0); |
| 1152 | return NULL; |
| 1153 | } |
| 1154 | |
| 1155 | if (!soc->ops->cmn_drv_ops || |
| 1156 | !soc->ops->cmn_drv_ops->txrx_get_mon_vdev_from_pdev) |
| 1157 | return NULL; |
| 1158 | |
| 1159 | return soc->ops->cmn_drv_ops->txrx_get_mon_vdev_from_pdev |
| 1160 | (pdev); |
| 1161 | } |
| 1162 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1163 | static inline void |
| 1164 | cdp_soc_detach(ol_txrx_soc_handle soc) |
| 1165 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1166 | if (!soc || !soc->ops) { |
| 1167 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1168 | "%s: Invalid Instance:", __func__); |
| 1169 | QDF_BUG(0); |
| 1170 | return; |
| 1171 | } |
| 1172 | |
| 1173 | if (!soc->ops->cmn_drv_ops || |
| 1174 | !soc->ops->cmn_drv_ops->txrx_soc_detach) |
| 1175 | return; |
| 1176 | |
| 1177 | soc->ops->cmn_drv_ops->txrx_soc_detach((void *)soc); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 1178 | } |
Manjunathappa Prakash | 5f45de5 | 2016-03-07 11:25:38 -0800 | [diff] [blame] | 1179 | |
Sumedh Baikady | 1c61e06 | 2018-02-12 22:25:47 -0800 | [diff] [blame] | 1180 | /** |
Anish Nataraj | e9d4c3b | 2018-11-24 22:24:56 +0530 | [diff] [blame] | 1181 | * cdp_soc_init() - Initialize txrx SOC |
| 1182 | * @soc: ol_txrx_soc_handle handle |
| 1183 | * @devid: Device ID |
| 1184 | * @hif_handle: Opaque HIF handle |
| 1185 | * @psoc: Opaque Objmgr handle |
| 1186 | * @htc_handle: Opaque HTC handle |
| 1187 | * @qdf_dev: QDF device |
| 1188 | * @dp_ol_if_ops: Offload Operations |
| 1189 | * |
| 1190 | * Return: DP SOC handle on success, NULL on failure |
| 1191 | */ |
| 1192 | static inline ol_txrx_soc_handle |
| 1193 | cdp_soc_init(ol_txrx_soc_handle soc, u_int16_t devid, void *hif_handle, |
| 1194 | void *psoc, void *htc_handle, qdf_device_t qdf_dev, |
| 1195 | struct ol_if_ops *dp_ol_if_ops) |
| 1196 | { |
| 1197 | if (!soc || !soc->ops) { |
| 1198 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1199 | "%s: Invalid Instance:", __func__); |
| 1200 | QDF_BUG(0); |
| 1201 | return NULL; |
| 1202 | } |
| 1203 | |
| 1204 | if (!soc->ops->cmn_drv_ops || |
| 1205 | !soc->ops->cmn_drv_ops->txrx_soc_init) |
| 1206 | return NULL; |
| 1207 | |
| 1208 | return soc->ops->cmn_drv_ops->txrx_soc_init(soc, psoc, |
| 1209 | hif_handle, |
| 1210 | htc_handle, qdf_dev, |
| 1211 | dp_ol_if_ops, devid); |
| 1212 | } |
| 1213 | |
| 1214 | /** |
| 1215 | * cdp_soc_deinit() - Deinitialize txrx SOC |
| 1216 | * @soc: Opaque DP SOC handle |
| 1217 | * |
| 1218 | * Return: None |
| 1219 | */ |
| 1220 | static inline void |
| 1221 | cdp_soc_deinit(ol_txrx_soc_handle soc) |
| 1222 | { |
| 1223 | if (!soc || !soc->ops) { |
| 1224 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1225 | "%s: Invalid Instance:", __func__); |
| 1226 | QDF_BUG(0); |
| 1227 | return; |
| 1228 | } |
| 1229 | |
| 1230 | if (!soc->ops->cmn_drv_ops || |
| 1231 | !soc->ops->cmn_drv_ops->txrx_soc_deinit) |
| 1232 | return; |
| 1233 | |
| 1234 | soc->ops->cmn_drv_ops->txrx_soc_deinit((void *)soc); |
| 1235 | } |
| 1236 | |
| 1237 | /** |
| 1238 | * cdp_tso_soc_attach() - TSO attach function |
| 1239 | * @soc: ol_txrx_soc_handle handle |
| 1240 | * |
| 1241 | * Reserve TSO descriptor buffers |
| 1242 | * |
| 1243 | * Return: QDF_STATUS_SUCCESS on Success or |
| 1244 | * QDF_STATUS_E_FAILURE on failure |
| 1245 | */ |
| 1246 | static inline QDF_STATUS |
| 1247 | cdp_tso_soc_attach(ol_txrx_soc_handle soc) |
| 1248 | { |
| 1249 | if (!soc || !soc->ops) { |
| 1250 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1251 | "%s: Invalid Instance:", __func__); |
| 1252 | QDF_BUG(0); |
| 1253 | return 0; |
| 1254 | } |
| 1255 | |
| 1256 | if (!soc->ops->cmn_drv_ops || |
| 1257 | !soc->ops->cmn_drv_ops->txrx_tso_soc_attach) |
| 1258 | return 0; |
| 1259 | |
| 1260 | return soc->ops->cmn_drv_ops->txrx_tso_soc_attach((void *)soc); |
| 1261 | } |
| 1262 | |
| 1263 | /** |
| 1264 | * cdp_tso_soc_detach() - TSO detach function |
| 1265 | * @soc: ol_txrx_soc_handle handle |
| 1266 | * |
| 1267 | * Release TSO descriptor buffers |
| 1268 | * |
| 1269 | * Return: QDF_STATUS_SUCCESS on Success or |
| 1270 | * QDF_STATUS_E_FAILURE on failure |
| 1271 | */ |
| 1272 | static inline QDF_STATUS |
| 1273 | cdp_tso_soc_detach(ol_txrx_soc_handle soc) |
| 1274 | { |
| 1275 | if (!soc || !soc->ops) { |
| 1276 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1277 | "%s: Invalid Instance:", __func__); |
| 1278 | QDF_BUG(0); |
| 1279 | return 0; |
| 1280 | } |
| 1281 | |
| 1282 | if (!soc->ops->cmn_drv_ops || |
| 1283 | !soc->ops->cmn_drv_ops->txrx_tso_soc_detach) |
| 1284 | return 0; |
| 1285 | |
| 1286 | return soc->ops->cmn_drv_ops->txrx_tso_soc_detach((void *)soc); |
| 1287 | } |
| 1288 | |
| 1289 | /** |
Sumedh Baikady | 1c61e06 | 2018-02-12 22:25:47 -0800 | [diff] [blame] | 1290 | * cdp_addba_resp_tx_completion() - Indicate addba response tx |
| 1291 | * completion to dp to change tid state. |
| 1292 | * @soc: soc handle |
| 1293 | * @peer_handle: peer handle |
| 1294 | * @tid: tid |
| 1295 | * @status: Tx completion status |
| 1296 | * |
| 1297 | * Return: success/failure of tid update |
| 1298 | */ |
| 1299 | static inline int cdp_addba_resp_tx_completion(ol_txrx_soc_handle soc, |
| 1300 | void *peer_handle, |
| 1301 | uint8_t tid, int status) |
| 1302 | { |
| 1303 | if (!soc || !soc->ops) { |
| 1304 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1305 | "%s: Invalid Instance:", __func__); |
| 1306 | QDF_BUG(0); |
| 1307 | return 0; |
| 1308 | } |
| 1309 | |
| 1310 | if (!soc->ops->cmn_drv_ops || |
| 1311 | !soc->ops->cmn_drv_ops->addba_resp_tx_completion) |
| 1312 | return 0; |
| 1313 | |
| 1314 | return soc->ops->cmn_drv_ops->addba_resp_tx_completion(peer_handle, tid, |
| 1315 | status); |
| 1316 | } |
| 1317 | |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 1318 | static inline int cdp_addba_requestprocess(ol_txrx_soc_handle soc, |
| 1319 | void *peer_handle, uint8_t dialogtoken, uint16_t tid, |
| 1320 | uint16_t batimeout, uint16_t buffersize, uint16_t startseqnum) |
| 1321 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1322 | if (!soc || !soc->ops) { |
| 1323 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1324 | "%s: Invalid Instance:", __func__); |
| 1325 | QDF_BUG(0); |
| 1326 | return 0; |
| 1327 | } |
| 1328 | |
| 1329 | if (!soc->ops->cmn_drv_ops || |
| 1330 | !soc->ops->cmn_drv_ops->addba_requestprocess) |
| 1331 | return 0; |
| 1332 | |
| 1333 | return soc->ops->cmn_drv_ops->addba_requestprocess(peer_handle, |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 1334 | dialogtoken, tid, batimeout, buffersize, startseqnum); |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 1335 | } |
| 1336 | |
| 1337 | static inline void cdp_addba_responsesetup(ol_txrx_soc_handle soc, |
| 1338 | void *peer_handle, uint8_t tid, uint8_t *dialogtoken, |
| 1339 | uint16_t *statuscode, uint16_t *buffersize, uint16_t *batimeout) |
| 1340 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1341 | if (!soc || !soc->ops) { |
| 1342 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1343 | "%s: Invalid Instance:", __func__); |
| 1344 | QDF_BUG(0); |
| 1345 | return; |
| 1346 | } |
| 1347 | |
| 1348 | if (!soc->ops->cmn_drv_ops || |
| 1349 | !soc->ops->cmn_drv_ops->addba_responsesetup) |
| 1350 | return; |
| 1351 | |
| 1352 | soc->ops->cmn_drv_ops->addba_responsesetup(peer_handle, tid, |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 1353 | dialogtoken, statuscode, buffersize, batimeout); |
| 1354 | } |
| 1355 | |
| 1356 | static inline int cdp_delba_process(ol_txrx_soc_handle soc, |
| 1357 | void *peer_handle, int tid, uint16_t reasoncode) |
| 1358 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1359 | if (!soc || !soc->ops) { |
| 1360 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1361 | "%s: Invalid Instance:", __func__); |
| 1362 | QDF_BUG(0); |
| 1363 | return 0; |
| 1364 | } |
| 1365 | |
| 1366 | if (!soc->ops->cmn_drv_ops || |
| 1367 | !soc->ops->cmn_drv_ops->delba_process) |
| 1368 | return 0; |
| 1369 | |
| 1370 | return soc->ops->cmn_drv_ops->delba_process(peer_handle, |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 1371 | tid, reasoncode); |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 1372 | } |
| 1373 | |
sumedh baikady | df4a57c | 2018-04-08 22:19:22 -0700 | [diff] [blame] | 1374 | /** |
| 1375 | * cdp_delba_tx_completion() - Handle delba tx completion |
| 1376 | * to update stats and retry transmission if failed. |
| 1377 | * @soc: soc handle |
| 1378 | * @peer_handle: peer handle |
| 1379 | * @tid: Tid number |
| 1380 | * @status: Tx completion status |
| 1381 | * |
| 1382 | * Return: 0 on Success, 1 on failure |
| 1383 | */ |
| 1384 | |
| 1385 | static inline int cdp_delba_tx_completion(ol_txrx_soc_handle soc, |
| 1386 | void *peer_handle, |
| 1387 | uint8_t tid, int status) |
| 1388 | { |
| 1389 | if (!soc || !soc->ops) { |
| 1390 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1391 | "%s: Invalid Instance:", __func__); |
| 1392 | QDF_BUG(0); |
| 1393 | return 0; |
| 1394 | } |
| 1395 | |
| 1396 | if (!soc->ops->cmn_drv_ops || |
| 1397 | !soc->ops->cmn_drv_ops->delba_tx_completion) |
| 1398 | return 0; |
| 1399 | |
| 1400 | return soc->ops->cmn_drv_ops->delba_tx_completion(peer_handle, |
| 1401 | tid, status); |
| 1402 | } |
| 1403 | |
Gyanranjan Hazarika | 99a58d3 | 2017-12-22 21:56:17 -0800 | [diff] [blame] | 1404 | static inline void cdp_set_addbaresponse(ol_txrx_soc_handle soc, |
| 1405 | void *peer_handle, int tid, uint16_t statuscode) |
| 1406 | { |
| 1407 | if (!soc || !soc->ops) { |
| 1408 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1409 | "%s: Invalid Instance:", __func__); |
| 1410 | QDF_BUG(0); |
| 1411 | return; |
| 1412 | } |
| 1413 | |
| 1414 | if (!soc->ops->cmn_drv_ops || |
| 1415 | !soc->ops->cmn_drv_ops->set_addba_response) |
| 1416 | return; |
| 1417 | |
| 1418 | soc->ops->cmn_drv_ops->set_addba_response(peer_handle, tid, statuscode); |
| 1419 | } |
| 1420 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 1421 | /** |
| 1422 | * cdp_get_peer_mac_addr_frm_id: function to return vdev id and and peer |
| 1423 | * mac address |
| 1424 | * @soc: SOC handle |
| 1425 | * @peer_id: peer id of the peer for which mac_address is required |
| 1426 | * @mac_addr: reference to mac address |
| 1427 | * |
| 1428 | * reutm: vdev_id of the vap |
| 1429 | */ |
| 1430 | static inline uint8_t |
| 1431 | cdp_get_peer_mac_addr_frm_id(ol_txrx_soc_handle soc, uint16_t peer_id, |
| 1432 | uint8_t *mac_addr) |
| 1433 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1434 | if (!soc || !soc->ops) { |
| 1435 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1436 | "%s: Invalid Instance:", __func__); |
| 1437 | QDF_BUG(0); |
| 1438 | return CDP_INVALID_VDEV_ID; |
| 1439 | } |
| 1440 | |
| 1441 | if (!soc->ops->cmn_drv_ops || |
| 1442 | !soc->ops->cmn_drv_ops->get_peer_mac_addr_frm_id) |
| 1443 | return CDP_INVALID_VDEV_ID; |
| 1444 | |
| 1445 | return soc->ops->cmn_drv_ops->get_peer_mac_addr_frm_id(soc, |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 1446 | peer_id, mac_addr); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 1447 | } |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 1448 | |
| 1449 | /** |
| 1450 | * cdp_set_vdev_dscp_tid_map(): function to set DSCP-tid map in the vap |
| 1451 | * @vdev: vdev handle |
| 1452 | * @map_id: id of the tid map |
| 1453 | * |
| 1454 | * Return: void |
| 1455 | */ |
| 1456 | static inline void cdp_set_vdev_dscp_tid_map(ol_txrx_soc_handle soc, |
| 1457 | struct cdp_vdev *vdev, uint8_t map_id) |
| 1458 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1459 | if (!soc || !soc->ops) { |
| 1460 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1461 | "%s: Invalid Instance:", __func__); |
| 1462 | QDF_BUG(0); |
| 1463 | return; |
| 1464 | } |
| 1465 | |
| 1466 | if (!soc->ops->cmn_drv_ops || |
| 1467 | !soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map) |
| 1468 | return; |
| 1469 | |
| 1470 | soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map(vdev, |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 1471 | map_id); |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 1472 | } |
| 1473 | |
| 1474 | /** |
Pranita Solanke | 92096e4 | 2018-09-11 11:14:51 +0530 | [diff] [blame] | 1475 | * cdp_ath_get_total_per(): function to get hw retries |
| 1476 | * @soc : soc handle |
| 1477 | * @pdev: pdev handle |
| 1478 | * |
| 1479 | * Return: get hw retries |
| 1480 | */ |
| 1481 | static inline |
| 1482 | int cdp_ath_get_total_per(ol_txrx_soc_handle soc, |
| 1483 | struct cdp_pdev *pdev) |
| 1484 | { |
| 1485 | if (!soc || !soc->ops) { |
| 1486 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1487 | "%s: Invalid Instance:", __func__); |
| 1488 | QDF_BUG(0); |
| 1489 | return 0; |
| 1490 | } |
| 1491 | |
| 1492 | if (!soc->ops->cmn_drv_ops || |
| 1493 | !soc->ops->cmn_drv_ops->txrx_get_total_per) |
| 1494 | return 0; |
| 1495 | |
| 1496 | return soc->ops->cmn_drv_ops->txrx_get_total_per(pdev); |
| 1497 | } |
| 1498 | |
| 1499 | /** |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 1500 | * cdp_set_pdev_dscp_tid_map(): function to change tid values in DSCP-tid map |
| 1501 | * @pdev: pdev handle |
| 1502 | * @map_id: id of the tid map |
| 1503 | * @tos: index value in map that needs to be changed |
| 1504 | * @tid: tid value passed by user |
| 1505 | * |
| 1506 | * Return: void |
| 1507 | */ |
| 1508 | static inline void cdp_set_pdev_dscp_tid_map(ol_txrx_soc_handle soc, |
| 1509 | struct cdp_pdev *pdev, uint8_t map_id, uint8_t tos, uint8_t tid) |
| 1510 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1511 | if (!soc || !soc->ops) { |
| 1512 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1513 | "%s: Invalid Instance:", __func__); |
| 1514 | QDF_BUG(0); |
| 1515 | return; |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 1516 | } |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1517 | |
| 1518 | if (!soc->ops->cmn_drv_ops || |
| 1519 | !soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map) |
| 1520 | return; |
| 1521 | |
| 1522 | soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map(pdev, |
| 1523 | map_id, tos, tid); |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 1524 | } |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 1525 | |
| 1526 | /** |
Shashikala Prabhu | 8f6703b | 2018-10-31 09:43:00 +0530 | [diff] [blame] | 1527 | * cdp_hmmc_tid_override_en(): Function to enable hmmc tid override. |
| 1528 | * @soc : soc handle |
| 1529 | * @pdev: pdev handle |
| 1530 | * @val: hmmc-dscp flag value |
| 1531 | * |
| 1532 | * Return: void |
| 1533 | */ |
| 1534 | static inline void cdp_hmmc_tid_override_en(ol_txrx_soc_handle soc, |
| 1535 | struct cdp_pdev *pdev, bool val) |
| 1536 | { |
| 1537 | if (!soc || !soc->ops) { |
| 1538 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1539 | "%s: Invalid Instance:", __func__); |
| 1540 | QDF_BUG(0); |
| 1541 | return; |
| 1542 | } |
| 1543 | |
| 1544 | if (!soc->ops->cmn_drv_ops || |
| 1545 | !soc->ops->cmn_drv_ops->hmmc_tid_override_en) |
| 1546 | return; |
| 1547 | |
| 1548 | soc->ops->cmn_drv_ops->hmmc_tid_override_en(pdev, val); |
| 1549 | } |
| 1550 | |
| 1551 | /** |
| 1552 | * cdp_set_hmmc_tid_val(): Function to set hmmc tid value. |
| 1553 | * @soc : soc handle |
| 1554 | * @pdev: pdev handle |
| 1555 | * @tid: tid value |
| 1556 | * |
| 1557 | * Return: void |
| 1558 | */ |
| 1559 | static inline void cdp_set_hmmc_tid_val(ol_txrx_soc_handle soc, |
| 1560 | struct cdp_pdev *pdev, uint8_t tid) |
| 1561 | { |
| 1562 | if (!soc || !soc->ops) { |
| 1563 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1564 | "%s: Invalid Instance:", __func__); |
| 1565 | QDF_BUG(0); |
| 1566 | return; |
| 1567 | } |
| 1568 | |
| 1569 | if (!soc->ops->cmn_drv_ops || |
| 1570 | !soc->ops->cmn_drv_ops->set_hmmc_tid_val) |
| 1571 | return; |
| 1572 | |
| 1573 | soc->ops->cmn_drv_ops->set_hmmc_tid_val(pdev, tid); |
| 1574 | } |
| 1575 | |
| 1576 | /** |
Manikandan Mohan | e2fa8b7 | 2017-03-22 11:18:26 -0700 | [diff] [blame] | 1577 | * cdp_flush_cache_rx_queue() - flush cache rx queue frame |
| 1578 | * |
| 1579 | * Return: None |
| 1580 | */ |
| 1581 | static inline void cdp_flush_cache_rx_queue(ol_txrx_soc_handle soc) |
| 1582 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1583 | if (!soc || !soc->ops) { |
| 1584 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1585 | "%s: Invalid Instance:", __func__); |
| 1586 | QDF_BUG(0); |
| 1587 | return; |
| 1588 | } |
| 1589 | |
| 1590 | if (!soc->ops->cmn_drv_ops || |
| 1591 | !soc->ops->cmn_drv_ops->flush_cache_rx_queue) |
| 1592 | return; |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1593 | soc->ops->cmn_drv_ops->flush_cache_rx_queue(); |
Manikandan Mohan | e2fa8b7 | 2017-03-22 11:18:26 -0700 | [diff] [blame] | 1594 | } |
| 1595 | |
| 1596 | /** |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 1597 | * cdp_txrx_stats_request(): function to map to host and firmware statistics |
| 1598 | * @soc: soc handle |
| 1599 | * @vdev: virtual device |
| 1600 | * @req: stats request container |
| 1601 | * |
| 1602 | * return: status |
| 1603 | */ |
| 1604 | static inline |
| 1605 | int cdp_txrx_stats_request(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, |
| 1606 | struct cdp_txrx_stats_req *req) |
| 1607 | { |
| 1608 | if (!soc || !soc->ops || !soc->ops->cmn_drv_ops || !req) { |
| 1609 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1610 | "%s: Invalid Instance:", __func__); |
| 1611 | QDF_ASSERT(0); |
| 1612 | return 0; |
| 1613 | } |
| 1614 | |
| 1615 | if (soc->ops->cmn_drv_ops->txrx_stats_request) |
| 1616 | return soc->ops->cmn_drv_ops->txrx_stats_request(vdev, req); |
| 1617 | |
| 1618 | return 0; |
| 1619 | } |
| 1620 | |
| 1621 | /** |
Yun Park | 21cd32f | 2017-04-03 10:38:31 -0700 | [diff] [blame] | 1622 | * cdp_txrx_intr_attach(): function to attach and configure interrupt |
| 1623 | * @soc: soc handle |
| 1624 | */ |
Venkateswara Swamy Bandaru | a95b324 | 2017-05-19 20:20:30 +0530 | [diff] [blame] | 1625 | static inline QDF_STATUS cdp_txrx_intr_attach(ol_txrx_soc_handle soc) |
| 1626 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1627 | if (!soc || !soc->ops) { |
| 1628 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1629 | "%s: Invalid Instance:", __func__); |
| 1630 | QDF_BUG(0); |
| 1631 | return 0; |
| 1632 | } |
Venkateswara Swamy Bandaru | a95b324 | 2017-05-19 20:20:30 +0530 | [diff] [blame] | 1633 | |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1634 | if (!soc->ops->cmn_drv_ops || |
| 1635 | !soc->ops->cmn_drv_ops->txrx_intr_attach) |
| 1636 | return 0; |
| 1637 | |
| 1638 | return soc->ops->cmn_drv_ops->txrx_intr_attach(soc); |
Venkateswara Swamy Bandaru | a95b324 | 2017-05-19 20:20:30 +0530 | [diff] [blame] | 1639 | } |
| 1640 | |
| 1641 | /** |
Yun Park | 21cd32f | 2017-04-03 10:38:31 -0700 | [diff] [blame] | 1642 | * cdp_txrx_intr_detach(): function to detach interrupt |
| 1643 | * @soc: soc handle |
| 1644 | */ |
Venkateswara Swamy Bandaru | a95b324 | 2017-05-19 20:20:30 +0530 | [diff] [blame] | 1645 | static inline void cdp_txrx_intr_detach(ol_txrx_soc_handle soc) |
| 1646 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1647 | if (!soc || !soc->ops) { |
| 1648 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1649 | "%s: Invalid Instance:", __func__); |
| 1650 | QDF_BUG(0); |
| 1651 | return; |
| 1652 | } |
| 1653 | |
| 1654 | if (!soc->ops->cmn_drv_ops || |
| 1655 | !soc->ops->cmn_drv_ops->txrx_intr_detach) |
| 1656 | return; |
| 1657 | |
| 1658 | soc->ops->cmn_drv_ops->txrx_intr_detach(soc); |
Venkateswara Swamy Bandaru | a95b324 | 2017-05-19 20:20:30 +0530 | [diff] [blame] | 1659 | } |
| 1660 | |
| 1661 | /** |
Yun Park | 21cd32f | 2017-04-03 10:38:31 -0700 | [diff] [blame] | 1662 | * cdp_display_stats(): function to map to dump stats |
| 1663 | * @soc: soc handle |
| 1664 | * @value: statistics option |
| 1665 | */ |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 1666 | static inline QDF_STATUS |
Mohit Khanna | 90d7ebd | 2017-09-12 21:54:21 -0700 | [diff] [blame] | 1667 | cdp_display_stats(ol_txrx_soc_handle soc, uint16_t value, |
| 1668 | enum qdf_stats_verbosity_level level) |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 1669 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1670 | if (!soc || !soc->ops) { |
| 1671 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1672 | "%s: Invalid Instance:", __func__); |
| 1673 | QDF_BUG(0); |
| 1674 | return 0; |
| 1675 | } |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 1676 | |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1677 | if (!soc->ops->cmn_drv_ops || |
| 1678 | !soc->ops->cmn_drv_ops->display_stats) |
| 1679 | return 0; |
| 1680 | |
Mohit Khanna | 90d7ebd | 2017-09-12 21:54:21 -0700 | [diff] [blame] | 1681 | return soc->ops->cmn_drv_ops->display_stats(soc, value, level); |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 1682 | } |
Gurumoorthi Gnanasambandhan | ed4bcf8 | 2017-05-24 00:10:59 +0530 | [diff] [blame] | 1683 | |
| 1684 | |
| 1685 | /** |
| 1686 | * cdp_set_pn_check(): function to set pn check |
| 1687 | * @soc: soc handle |
| 1688 | * @sec_type: security type |
| 1689 | * #rx_pn: receive pn |
| 1690 | */ |
| 1691 | static inline int cdp_set_pn_check(ol_txrx_soc_handle soc, |
| 1692 | struct cdp_vdev *vdev, struct cdp_peer *peer_handle, enum cdp_sec_type sec_type, uint32_t *rx_pn) |
| 1693 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1694 | if (!soc || !soc->ops) { |
| 1695 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1696 | "%s: Invalid Instance:", __func__); |
| 1697 | QDF_BUG(0); |
| 1698 | return 0; |
| 1699 | } |
| 1700 | |
| 1701 | if (!soc->ops->cmn_drv_ops || |
| 1702 | !soc->ops->cmn_drv_ops->set_pn_check) |
| 1703 | return 0; |
| 1704 | |
| 1705 | soc->ops->cmn_drv_ops->set_pn_check(vdev, peer_handle, |
Gurumoorthi Gnanasambandhan | ed4bcf8 | 2017-05-24 00:10:59 +0530 | [diff] [blame] | 1706 | sec_type, rx_pn); |
| 1707 | return 0; |
| 1708 | } |
| 1709 | |
Pramod Simha | 6e10cb2 | 2018-06-20 12:05:44 -0700 | [diff] [blame] | 1710 | static inline int cdp_set_key(ol_txrx_soc_handle soc, |
| 1711 | struct cdp_peer *peer_handle, |
| 1712 | bool is_unicast, uint32_t *key) |
| 1713 | { |
| 1714 | if (!soc || !soc->ops) { |
| 1715 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1716 | "%s: Invalid Instance:", __func__); |
| 1717 | QDF_BUG(0); |
| 1718 | return 0; |
| 1719 | } |
| 1720 | |
| 1721 | if (!soc->ops->ctrl_ops || |
| 1722 | !soc->ops->ctrl_ops->set_key) |
| 1723 | return 0; |
| 1724 | |
| 1725 | soc->ops->ctrl_ops->set_key(peer_handle, |
| 1726 | is_unicast, key); |
| 1727 | return 0; |
| 1728 | } |
| 1729 | |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 1730 | /** |
| 1731 | * cdp_update_config_parameters(): function to propagate configuration |
| 1732 | * parameters to datapath |
| 1733 | * @soc: opaque soc handle |
| 1734 | * @cfg: configuration handle |
| 1735 | * |
| 1736 | * Return: status: 0 - Success, non-zero: Failure |
| 1737 | */ |
| 1738 | static inline |
| 1739 | QDF_STATUS cdp_update_config_parameters(ol_txrx_soc_handle soc, |
| 1740 | struct cdp_config_params *cfg) |
| 1741 | { |
| 1742 | struct cdp_soc *psoc = (struct cdp_soc *)soc; |
| 1743 | |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1744 | if (!soc || !soc->ops) { |
| 1745 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1746 | "%s: Invalid Instance:", __func__); |
| 1747 | QDF_BUG(0); |
| 1748 | return 0; |
| 1749 | } |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 1750 | |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 1751 | if (!soc->ops->cmn_drv_ops || |
| 1752 | !soc->ops->cmn_drv_ops->update_config_parameters) |
| 1753 | return QDF_STATUS_SUCCESS; |
| 1754 | |
| 1755 | return soc->ops->cmn_drv_ops->update_config_parameters(psoc, |
| 1756 | cfg); |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 1757 | } |
Santosh Anbu | 2280e86 | 2018-01-03 22:25:53 +0530 | [diff] [blame] | 1758 | |
| 1759 | /** |
| 1760 | * cdp_pdev_get_dp_txrx_handle() - get advanced dp handle from pdev |
| 1761 | * @soc: opaque soc handle |
| 1762 | * @pdev: data path pdev handle |
| 1763 | * |
| 1764 | * Return: opaque dp handle |
| 1765 | */ |
| 1766 | static inline void * |
| 1767 | cdp_pdev_get_dp_txrx_handle(ol_txrx_soc_handle soc, void *pdev) |
| 1768 | { |
| 1769 | if (!soc || !soc->ops) { |
| 1770 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1771 | "%s: Invalid Instance:", __func__); |
| 1772 | QDF_BUG(0); |
| 1773 | return 0; |
| 1774 | } |
| 1775 | |
| 1776 | if (soc->ops->cmn_drv_ops->get_dp_txrx_handle) |
| 1777 | return soc->ops->cmn_drv_ops->get_dp_txrx_handle(pdev); |
| 1778 | |
| 1779 | return 0; |
| 1780 | } |
| 1781 | |
| 1782 | /** |
| 1783 | * cdp_pdev_set_dp_txrx_handle() - set advanced dp handle in pdev |
| 1784 | * @soc: opaque soc handle |
| 1785 | * @pdev: data path pdev handle |
| 1786 | * @dp_hdl: opaque pointer for dp_txrx_handle |
| 1787 | * |
| 1788 | * Return: void |
| 1789 | */ |
| 1790 | static inline void |
| 1791 | cdp_pdev_set_dp_txrx_handle(ol_txrx_soc_handle soc, void *pdev, void *dp_hdl) |
| 1792 | { |
| 1793 | if (!soc || !soc->ops) { |
| 1794 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1795 | "%s: Invalid Instance:", __func__); |
| 1796 | QDF_BUG(0); |
| 1797 | return; |
| 1798 | } |
| 1799 | |
| 1800 | if (!soc->ops->cmn_drv_ops || |
| 1801 | !soc->ops->cmn_drv_ops->set_dp_txrx_handle) |
| 1802 | return; |
| 1803 | |
| 1804 | soc->ops->cmn_drv_ops->set_dp_txrx_handle(pdev, dp_hdl); |
| 1805 | } |
Pamidipati, Vijay | d3478ef | 2018-02-06 23:52:29 +0530 | [diff] [blame] | 1806 | |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 1807 | /* |
Pamidipati, Vijay | d3478ef | 2018-02-06 23:52:29 +0530 | [diff] [blame] | 1808 | * cdp_soc_get_dp_txrx_handle() - get extended dp handle from soc |
| 1809 | * @soc: opaque soc handle |
| 1810 | * |
| 1811 | * Return: opaque extended dp handle |
| 1812 | */ |
| 1813 | static inline void * |
| 1814 | cdp_soc_get_dp_txrx_handle(ol_txrx_soc_handle soc) |
| 1815 | { |
| 1816 | if (!soc || !soc->ops) { |
| 1817 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1818 | "%s: Invalid Instance:", __func__); |
| 1819 | QDF_BUG(0); |
| 1820 | return NULL; |
| 1821 | } |
| 1822 | |
| 1823 | if (soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle) |
| 1824 | return soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle( |
| 1825 | (struct cdp_soc *) soc); |
| 1826 | |
| 1827 | return NULL; |
| 1828 | } |
| 1829 | |
| 1830 | /** |
| 1831 | * cdp_soc_set_dp_txrx_handle() - set advanced dp handle in soc |
| 1832 | * @soc: opaque soc handle |
| 1833 | * @dp_hdl: opaque pointer for dp_txrx_handle |
| 1834 | * |
| 1835 | * Return: void |
| 1836 | */ |
| 1837 | static inline void |
| 1838 | cdp_soc_set_dp_txrx_handle(ol_txrx_soc_handle soc, void *dp_handle) |
| 1839 | { |
| 1840 | if (!soc || !soc->ops) { |
| 1841 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1842 | "%s: Invalid Instance:", __func__); |
| 1843 | QDF_BUG(0); |
| 1844 | return; |
| 1845 | } |
| 1846 | |
| 1847 | if (!soc->ops->cmn_drv_ops || |
| 1848 | !soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle) |
| 1849 | return; |
| 1850 | |
| 1851 | soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle((struct cdp_soc *)soc, |
| 1852 | dp_handle); |
| 1853 | } |
| 1854 | |
| 1855 | /** |
| 1856 | * cdp_tx_send() - enqueue frame for transmission |
| 1857 | * @soc: soc opaque handle |
| 1858 | * @vdev: VAP device |
| 1859 | * @nbuf: nbuf to be enqueued |
| 1860 | * |
| 1861 | * This API is used by Extended Datapath modules to enqueue frame for |
| 1862 | * transmission |
| 1863 | * |
| 1864 | * Return: void |
| 1865 | */ |
| 1866 | static inline void |
| 1867 | cdp_tx_send(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, qdf_nbuf_t nbuf) |
| 1868 | { |
| 1869 | if (!soc || !soc->ops) { |
| 1870 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1871 | "%s: Invalid Instance:", __func__); |
| 1872 | QDF_BUG(0); |
| 1873 | return; |
| 1874 | } |
| 1875 | |
| 1876 | if (!soc->ops->cmn_drv_ops || |
| 1877 | !soc->ops->cmn_drv_ops->tx_send) |
| 1878 | return; |
| 1879 | |
| 1880 | soc->ops->cmn_drv_ops->tx_send(vdev, nbuf); |
| 1881 | } |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 1882 | |
| 1883 | /* |
| 1884 | * cdp_get_pdev_id_frm_pdev() - return pdev_id from pdev |
| 1885 | * @soc: opaque soc handle |
| 1886 | * @pdev: data path pdev handle |
| 1887 | * |
| 1888 | * Return: pdev_id |
| 1889 | */ |
| 1890 | static inline |
| 1891 | uint8_t cdp_get_pdev_id_frm_pdev(ol_txrx_soc_handle soc, |
| 1892 | struct cdp_pdev *pdev) |
| 1893 | { |
| 1894 | if (soc->ops->cmn_drv_ops->txrx_get_pdev_id_frm_pdev) |
| 1895 | return soc->ops->cmn_drv_ops->txrx_get_pdev_id_frm_pdev(pdev); |
| 1896 | return 0; |
| 1897 | } |
| 1898 | |
Vivek Natarajan | 95f004f | 2019-01-10 22:15:46 +0530 | [diff] [blame] | 1899 | /* |
| 1900 | * cdp_get_vow_config_frm_pdev() - return carrier_vow_config from pdev |
| 1901 | * @soc: opaque soc handle |
| 1902 | * @pdev: data path pdev handle |
| 1903 | * |
| 1904 | * Return: carrier_vow_config |
| 1905 | */ |
| 1906 | static inline |
| 1907 | bool cdp_get_vow_config_frm_pdev(ol_txrx_soc_handle soc, |
| 1908 | struct cdp_pdev *pdev) |
| 1909 | { |
| 1910 | if (soc->ops->cmn_drv_ops->txrx_get_vow_config_frm_pdev) |
| 1911 | return soc->ops->cmn_drv_ops->txrx_get_vow_config_frm_pdev( |
| 1912 | pdev); |
| 1913 | return 0; |
| 1914 | } |
| 1915 | |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 1916 | /** |
Adil Saeed Musthafa | 61a2169 | 2018-07-17 20:49:31 -0700 | [diff] [blame] | 1917 | * cdp_pdev_set_chan_noise_floor() - Set channel noise floor to DP layer |
| 1918 | * @soc: opaque soc handle |
| 1919 | * @pdev: data path pdev handle |
| 1920 | * @chan_noise_floor: Channel Noise Floor (in dbM) obtained from control path |
| 1921 | * |
| 1922 | * Return: None |
| 1923 | */ |
| 1924 | static inline |
| 1925 | void cdp_pdev_set_chan_noise_floor(ol_txrx_soc_handle soc, |
| 1926 | struct cdp_pdev *pdev, |
| 1927 | int16_t chan_noise_floor) |
| 1928 | { |
| 1929 | if (soc->ops->cmn_drv_ops->txrx_pdev_set_chan_noise_floor) |
| 1930 | return soc->ops->cmn_drv_ops->txrx_pdev_set_chan_noise_floor( |
| 1931 | pdev, chan_noise_floor); |
| 1932 | } |
| 1933 | |
| 1934 | /** |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 1935 | * cdp_set_nac() - set nac |
| 1936 | * @soc: opaque soc handle |
| 1937 | * @peer: data path peer handle |
| 1938 | * |
| 1939 | */ |
| 1940 | static inline |
| 1941 | void cdp_set_nac(ol_txrx_soc_handle soc, |
| 1942 | struct cdp_peer *peer) |
| 1943 | { |
| 1944 | if (soc->ops->cmn_drv_ops->txrx_set_nac) |
| 1945 | soc->ops->cmn_drv_ops->txrx_set_nac(peer); |
| 1946 | } |
| 1947 | |
| 1948 | /** |
| 1949 | * cdp_set_pdev_tx_capture() - set pdev tx_capture |
| 1950 | * @soc: opaque soc handle |
| 1951 | * @pdev: data path pdev handle |
| 1952 | * @val: value of pdev_tx_capture |
| 1953 | * |
Chaithanya Garrepalli | 7ab76ae | 2018-07-05 14:53:50 +0530 | [diff] [blame] | 1954 | * Return: status: 0 - Success, non-zero: Failure |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 1955 | */ |
| 1956 | static inline |
Chaithanya Garrepalli | 7ab76ae | 2018-07-05 14:53:50 +0530 | [diff] [blame] | 1957 | QDF_STATUS cdp_set_pdev_tx_capture(ol_txrx_soc_handle soc, |
| 1958 | struct cdp_pdev *pdev, int val) |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 1959 | { |
| 1960 | if (soc->ops->cmn_drv_ops->txrx_set_pdev_tx_capture) |
| 1961 | return soc->ops->cmn_drv_ops->txrx_set_pdev_tx_capture(pdev, |
| 1962 | val); |
Chaithanya Garrepalli | 7ab76ae | 2018-07-05 14:53:50 +0530 | [diff] [blame] | 1963 | return QDF_STATUS_SUCCESS; |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 1964 | } |
| 1965 | |
| 1966 | /** |
Debasis Das | a3249bd | 2019-03-01 11:58:22 +0530 | [diff] [blame^] | 1967 | * cdp_set_pdev_pcp_tid_map() - set pdev pcp-tid-map |
| 1968 | * @soc: opaque soc handle |
| 1969 | * @pdev: data path pdev handle |
| 1970 | * @pcp: pcp value |
| 1971 | * @tid: tid value |
| 1972 | * |
| 1973 | * This API is used to configure the pcp-to-tid mapping for a pdev. |
| 1974 | * |
| 1975 | * Return: QDF_STATUS_SUCCESS if value set successfully |
| 1976 | * QDF_STATUS_E_INVAL false if error |
| 1977 | */ |
| 1978 | static inline |
| 1979 | QDF_STATUS cdp_set_pdev_pcp_tid_map(ol_txrx_soc_handle soc, |
| 1980 | struct cdp_pdev *pdev, |
| 1981 | uint32_t pcp, uint32_t tid) |
| 1982 | { |
| 1983 | if (!soc || !soc->ops) { |
| 1984 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 1985 | "%s: Invalid Instance", __func__); |
| 1986 | return QDF_STATUS_E_INVAL; |
| 1987 | } |
| 1988 | |
| 1989 | if (!soc->ops->cmn_drv_ops || |
| 1990 | !soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map) |
| 1991 | return QDF_STATUS_E_INVAL; |
| 1992 | |
| 1993 | return soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map(pdev, pcp, tid); |
| 1994 | } |
| 1995 | |
| 1996 | /** |
| 1997 | * cdp_set_pdev_pcp_tidmap_prty() - set pdev tidmap priority |
| 1998 | * @soc: opaque soc handle |
| 1999 | * @pdev: data path pdev handle |
| 2000 | * @val: priority value |
| 2001 | * |
| 2002 | * This API is used to configure the tidmap priority for a pdev. |
| 2003 | * The tidmap priority decides which mapping, namely DSCP-TID, SVLAN_PCP-TID, |
| 2004 | * CVLAN_PCP-TID will be used. |
| 2005 | * |
| 2006 | * Return: QDF_STATUS_SUCCESS if value set successfully |
| 2007 | * QDF_STATUS_E_INVAL false if error |
| 2008 | */ |
| 2009 | static inline |
| 2010 | QDF_STATUS cdp_set_pdev_tidmap_prty(ol_txrx_soc_handle soc, |
| 2011 | struct cdp_pdev *pdev_handle, |
| 2012 | uint32_t val) |
| 2013 | { |
| 2014 | if (!soc || !soc->ops) { |
| 2015 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 2016 | "%s: Invalid Instance", __func__); |
| 2017 | return QDF_STATUS_E_INVAL; |
| 2018 | } |
| 2019 | |
| 2020 | if (!soc->ops->cmn_drv_ops || |
| 2021 | !soc->ops->cmn_drv_ops->set_pdev_tidmap_prty) |
| 2022 | return QDF_STATUS_E_INVAL; |
| 2023 | |
| 2024 | return soc->ops->cmn_drv_ops->set_pdev_tidmap_prty(pdev_handle, val); |
| 2025 | } |
| 2026 | |
| 2027 | /** |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 2028 | * cdp_get_peer_mac_from_peer_id() - get peer mac addr from peer id |
| 2029 | * @soc: opaque soc handle |
| 2030 | * @pdev: data path pdev handle |
| 2031 | * @peer_id: data path peer id |
| 2032 | * @peer_mac: peer_mac |
| 2033 | * |
| 2034 | * Return: void |
| 2035 | */ |
| 2036 | static inline |
| 2037 | void cdp_get_peer_mac_from_peer_id(ol_txrx_soc_handle soc, |
| 2038 | struct cdp_pdev *pdev_handle, |
| 2039 | uint32_t peer_id, uint8_t *peer_mac) |
| 2040 | { |
| 2041 | if (soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id) |
| 2042 | soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id( |
| 2043 | pdev_handle, peer_id, peer_mac); |
| 2044 | } |
| 2045 | |
| 2046 | /** |
| 2047 | * cdp_vdev_tx_lock() - acquire lock |
| 2048 | * @soc: opaque soc handle |
| 2049 | * @vdev: data path vdev handle |
| 2050 | * |
| 2051 | * Return: void |
| 2052 | */ |
| 2053 | static inline |
| 2054 | void cdp_vdev_tx_lock(ol_txrx_soc_handle soc, |
| 2055 | struct cdp_vdev *vdev) |
| 2056 | { |
| 2057 | if (soc->ops->cmn_drv_ops->txrx_vdev_tx_lock) |
| 2058 | soc->ops->cmn_drv_ops->txrx_vdev_tx_lock(vdev); |
| 2059 | } |
| 2060 | |
| 2061 | /** |
| 2062 | * cdp_vdev_tx_unlock() - release lock |
| 2063 | * @soc: opaque soc handle |
| 2064 | * @vdev: data path vdev handle |
| 2065 | * |
| 2066 | * Return: void |
| 2067 | */ |
| 2068 | static inline |
| 2069 | void cdp_vdev_tx_unlock(ol_txrx_soc_handle soc, |
| 2070 | struct cdp_vdev *vdev) |
| 2071 | { |
| 2072 | if (soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock) |
| 2073 | soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock(vdev); |
| 2074 | } |
| 2075 | |
| 2076 | /** |
| 2077 | * cdp_ath_getstats() - get updated athstats |
| 2078 | * @soc: opaque soc handle |
Chaithanya Garrepalli | 2faa46f | 2018-04-09 12:34:20 +0530 | [diff] [blame] | 2079 | * @dev: dp interface handle |
| 2080 | * @stats: cdp network device stats structure |
| 2081 | * @type: device type pdev/vdev |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 2082 | * |
| 2083 | * Return: void |
| 2084 | */ |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 2085 | static inline void cdp_ath_getstats(ol_txrx_soc_handle soc, |
Chaithanya Garrepalli | 2faa46f | 2018-04-09 12:34:20 +0530 | [diff] [blame] | 2086 | void *dev, struct cdp_dev_stats *stats, |
| 2087 | uint8_t type) |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 2088 | { |
| 2089 | if (soc && soc->ops && soc->ops->cmn_drv_ops->txrx_ath_getstats) |
Chaithanya Garrepalli | 2faa46f | 2018-04-09 12:34:20 +0530 | [diff] [blame] | 2090 | soc->ops->cmn_drv_ops->txrx_ath_getstats(dev, stats, type); |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 2091 | } |
| 2092 | |
| 2093 | /** |
| 2094 | * cdp_set_gid_flag() - set groupid flag |
| 2095 | * @soc: opaque soc handle |
| 2096 | * @pdev: data path pdev handle |
| 2097 | * @mem_status: member status from grp management frame |
| 2098 | * @user_position: user position from grp management frame |
| 2099 | * |
| 2100 | * Return: void |
| 2101 | */ |
| 2102 | static inline |
| 2103 | void cdp_set_gid_flag(ol_txrx_soc_handle soc, |
| 2104 | struct cdp_pdev *pdev, u_int8_t *mem_status, |
| 2105 | u_int8_t *user_position) |
| 2106 | { |
| 2107 | if (soc->ops->cmn_drv_ops->txrx_set_gid_flag) |
| 2108 | soc->ops->cmn_drv_ops->txrx_set_gid_flag(pdev, mem_status, user_position); |
| 2109 | } |
| 2110 | |
| 2111 | /** |
| 2112 | * cdp_fw_supported_enh_stats_version() - returns the fw enhanced stats version |
| 2113 | * @soc: opaque soc handle |
| 2114 | * @pdev: data path pdev handle |
| 2115 | * |
| 2116 | */ |
| 2117 | static inline |
| 2118 | uint32_t cdp_fw_supported_enh_stats_version(ol_txrx_soc_handle soc, |
| 2119 | struct cdp_pdev *pdev) |
| 2120 | { |
| 2121 | if (soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version) |
| 2122 | return soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version(pdev); |
| 2123 | return 0; |
| 2124 | } |
| 2125 | |
| 2126 | /** |
| 2127 | * cdp_get_pdev_id_frm_pdev() - return pdev_id from pdev |
| 2128 | * @soc: opaque soc handle |
| 2129 | * @ni: associated node |
| 2130 | * @force: number of frame in SW queue |
| 2131 | * Return: void |
| 2132 | */ |
| 2133 | static inline |
| 2134 | void cdp_if_mgmt_drain(ol_txrx_soc_handle soc, |
| 2135 | void *ni, int force) |
| 2136 | { |
| 2137 | if (soc->ops->cmn_drv_ops->txrx_if_mgmt_drain) |
| 2138 | soc->ops->cmn_drv_ops->txrx_if_mgmt_drain(ni, force); |
| 2139 | } |
Chaithanya Garrepalli | 2f57279 | 2018-04-11 17:49:28 +0530 | [diff] [blame] | 2140 | |
Chaithanya Garrepalli | 3e93e5f | 2018-09-12 17:02:31 +0530 | [diff] [blame] | 2141 | /* cdp_peer_map_attach() - CDP API to allocate PEER map memory |
| 2142 | * @soc: opaque soc handle |
| 2143 | * @max_peers: number of peers created in FW |
Tallapragada Kalyan | a702362 | 2018-12-03 19:29:52 +0530 | [diff] [blame] | 2144 | * @max_ast_index: max number of AST index supported in FW |
Chaithanya Garrepalli | 3e93e5f | 2018-09-12 17:02:31 +0530 | [diff] [blame] | 2145 | * @peer_map_unmap_v2: flag indicates HTT peer map v2 is enabled in FW |
| 2146 | * |
| 2147 | * |
Chaithanya Garrepalli | 0e2d7fc | 2019-02-15 20:33:10 +0530 | [diff] [blame] | 2148 | * Return: QDF_STATUS |
Chaithanya Garrepalli | 3e93e5f | 2018-09-12 17:02:31 +0530 | [diff] [blame] | 2149 | */ |
Chaithanya Garrepalli | 0e2d7fc | 2019-02-15 20:33:10 +0530 | [diff] [blame] | 2150 | static inline QDF_STATUS |
Chaithanya Garrepalli | 3e93e5f | 2018-09-12 17:02:31 +0530 | [diff] [blame] | 2151 | cdp_peer_map_attach(ol_txrx_soc_handle soc, uint32_t max_peers, |
Tallapragada Kalyan | a702362 | 2018-12-03 19:29:52 +0530 | [diff] [blame] | 2152 | uint32_t max_ast_index, bool peer_map_unmap_v2) |
Chaithanya Garrepalli | 2f57279 | 2018-04-11 17:49:28 +0530 | [diff] [blame] | 2153 | { |
| 2154 | if (soc && soc->ops && soc->ops->cmn_drv_ops && |
| 2155 | soc->ops->cmn_drv_ops->txrx_peer_map_attach) |
Chaithanya Garrepalli | 0e2d7fc | 2019-02-15 20:33:10 +0530 | [diff] [blame] | 2156 | return soc->ops->cmn_drv_ops->txrx_peer_map_attach(soc, |
| 2157 | max_peers, |
| 2158 | max_ast_index, |
| 2159 | peer_map_unmap_v2); |
| 2160 | |
| 2161 | return QDF_STATUS_SUCCESS; |
Chaithanya Garrepalli | 2f57279 | 2018-04-11 17:49:28 +0530 | [diff] [blame] | 2162 | } |
Manjunathappa Prakash | 56023f5 | 2018-03-28 20:05:56 -0700 | [diff] [blame] | 2163 | |
Sravan Kumar Kairam | 5a6f590 | 2018-07-04 17:32:24 +0530 | [diff] [blame] | 2164 | /** |
| 2165 | |
| 2166 | * cdp_pdev_set_ctrl_pdev() - set UMAC ctrl pdev to dp pdev |
| 2167 | * @soc: opaque soc handle |
| 2168 | * @pdev: opaque dp pdev handle |
| 2169 | * @ctrl_pdev: opaque ctrl pdev handle |
| 2170 | * |
| 2171 | * Return: void |
| 2172 | */ |
| 2173 | static inline void |
| 2174 | cdp_pdev_set_ctrl_pdev(ol_txrx_soc_handle soc, struct cdp_pdev *dp_pdev, |
| 2175 | struct cdp_ctrl_objmgr_pdev *ctrl_pdev) |
| 2176 | { |
| 2177 | if (soc && soc->ops && soc->ops->cmn_drv_ops && |
| 2178 | soc->ops->cmn_drv_ops->txrx_pdev_set_ctrl_pdev) |
| 2179 | soc->ops->cmn_drv_ops->txrx_pdev_set_ctrl_pdev(dp_pdev, |
| 2180 | ctrl_pdev); |
| 2181 | } |
| 2182 | |
Pranita Solanke | afcd0f1 | 2018-08-29 22:49:23 +0530 | [diff] [blame] | 2183 | /* cdp_txrx_classify_and_update() - To classify the packet and update stats |
| 2184 | * @soc: opaque soc handle |
| 2185 | * @vdev: opaque dp vdev handle |
| 2186 | * @skb: data |
| 2187 | * @dir: rx or tx packet |
| 2188 | * @nbuf_classify: packet classification object |
| 2189 | * |
| 2190 | * Return: 1 on success else return 0 |
| 2191 | */ |
| 2192 | static inline int |
| 2193 | cdp_txrx_classify_and_update(ol_txrx_soc_handle soc, |
| 2194 | struct cdp_vdev *vdev, qdf_nbuf_t skb, |
| 2195 | enum txrx_direction dir, |
| 2196 | struct ol_txrx_nbuf_classify *nbuf_class) |
| 2197 | { |
| 2198 | if (!soc || !soc->ops) { |
| 2199 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 2200 | "%s: Invalid Instance", __func__); |
| 2201 | QDF_BUG(0); |
| 2202 | return 0; |
| 2203 | } |
| 2204 | |
| 2205 | if (!soc->ops->cmn_drv_ops || |
| 2206 | !soc->ops->cmn_drv_ops->txrx_classify_update) |
| 2207 | return 0; |
| 2208 | |
| 2209 | return soc->ops->cmn_drv_ops->txrx_classify_update(vdev, |
| 2210 | skb, |
| 2211 | dir, nbuf_class); |
| 2212 | } |
| 2213 | |
Akshay Kosigi | a4f6e17 | 2018-09-03 21:42:27 +0530 | [diff] [blame] | 2214 | /** |
| 2215 | * cdp_get_dp_capabilities() - get DP capabilities |
| 2216 | * @soc: opaque soc handle |
| 2217 | * @dp_cap: enum of DP capabilities |
| 2218 | * |
| 2219 | * Return: bool |
| 2220 | */ |
| 2221 | static inline bool |
| 2222 | cdp_get_dp_capabilities(struct cdp_soc_t *soc, enum cdp_capabilities dp_caps) |
| 2223 | { |
| 2224 | if (soc && soc->ops && soc->ops->cmn_drv_ops && |
| 2225 | soc->ops->cmn_drv_ops->get_dp_capabilities) |
| 2226 | return soc->ops->cmn_drv_ops->get_dp_capabilities(soc, dp_caps); |
| 2227 | return false; |
| 2228 | } |
| 2229 | |
Manjunathappa Prakash | 56023f5 | 2018-03-28 20:05:56 -0700 | [diff] [blame] | 2230 | #ifdef RECEIVE_OFFLOAD |
| 2231 | /** |
| 2232 | * cdp_register_rx_offld_flush_cb() - register LRO/GRO flush cb function pointer |
| 2233 | * @soc - data path soc handle |
| 2234 | * @pdev - device instance pointer |
| 2235 | * |
| 2236 | * register rx offload flush callback function pointer |
| 2237 | * |
| 2238 | * return none |
| 2239 | */ |
| 2240 | static inline void cdp_register_rx_offld_flush_cb(ol_txrx_soc_handle soc, |
| 2241 | void (rx_ol_flush_cb)(void *)) |
| 2242 | { |
| 2243 | if (!soc || !soc->ops || !soc->ops->rx_offld_ops) { |
| 2244 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, |
| 2245 | "%s invalid instance", __func__); |
| 2246 | return; |
| 2247 | } |
| 2248 | |
| 2249 | if (soc->ops->rx_offld_ops->register_rx_offld_flush_cb) |
| 2250 | return soc->ops->rx_offld_ops->register_rx_offld_flush_cb( |
| 2251 | rx_ol_flush_cb); |
| 2252 | } |
| 2253 | |
| 2254 | /** |
| 2255 | * cdp_deregister_rx_offld_flush_cb() - deregister Rx offld flush cb function |
| 2256 | * @soc - data path soc handle |
| 2257 | * |
| 2258 | * deregister rx offload flush callback function pointer |
| 2259 | * |
| 2260 | * return none |
| 2261 | */ |
| 2262 | static inline void cdp_deregister_rx_offld_flush_cb(ol_txrx_soc_handle soc) |
| 2263 | { |
| 2264 | if (!soc || !soc->ops || !soc->ops->rx_offld_ops) { |
| 2265 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, |
| 2266 | "%s invalid instance", __func__); |
| 2267 | return; |
| 2268 | } |
| 2269 | |
| 2270 | if (soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb) |
| 2271 | return soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb(); |
| 2272 | } |
| 2273 | #endif /* RECEIVE_OFFLOAD */ |
sumedh baikady | 1f8f319 | 2018-02-20 17:30:32 -0800 | [diff] [blame] | 2274 | |
| 2275 | /** |
| 2276 | * @cdp_set_ba_timeout() - set ba aging timeout per AC |
| 2277 | * |
| 2278 | * @soc - pointer to the soc |
| 2279 | * @value - timeout value in millisec |
| 2280 | * @ac - Access category |
| 2281 | * |
| 2282 | * @return - void |
| 2283 | */ |
| 2284 | static inline void cdp_set_ba_timeout(ol_txrx_soc_handle soc, |
| 2285 | uint8_t ac, uint32_t value) |
| 2286 | { |
| 2287 | if (!soc || !soc->ops) { |
| 2288 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 2289 | "%s: Invalid Instance", __func__); |
| 2290 | QDF_BUG(0); |
| 2291 | return; |
| 2292 | } |
| 2293 | |
| 2294 | if (!soc->ops->cmn_drv_ops || |
| 2295 | !soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout) |
| 2296 | return; |
| 2297 | |
| 2298 | soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout(soc, ac, value); |
| 2299 | } |
| 2300 | |
| 2301 | /** |
| 2302 | * @cdp_get_ba_timeout() - return ba aging timeout per AC |
| 2303 | * |
| 2304 | * @soc - pointer to the soc |
| 2305 | * @ac - access category |
| 2306 | * @value - timeout value in millisec |
| 2307 | * |
| 2308 | * @return - void |
| 2309 | */ |
| 2310 | static inline void cdp_get_ba_timeout(ol_txrx_soc_handle soc, |
| 2311 | uint8_t ac, uint32_t *value) |
| 2312 | { |
| 2313 | if (!soc || !soc->ops) { |
| 2314 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 2315 | "%s: Invalid Instance", __func__); |
| 2316 | QDF_BUG(0); |
| 2317 | return; |
| 2318 | } |
| 2319 | |
| 2320 | if (!soc->ops->cmn_drv_ops || |
| 2321 | !soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout) |
| 2322 | return; |
| 2323 | |
| 2324 | soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout(soc, ac, value); |
| 2325 | } |
jitiphil | 60ac9aa | 2018-10-05 19:54:04 +0530 | [diff] [blame] | 2326 | |
| 2327 | /** |
| 2328 | * cdp_cfg_get() - get cfg for dp enum |
| 2329 | * |
| 2330 | * @soc: pointer to the soc |
| 2331 | * @cfg: cfg enum |
| 2332 | * |
| 2333 | * Return - cfg value |
| 2334 | */ |
| 2335 | static inline uint32_t cdp_cfg_get(ol_txrx_soc_handle soc, enum cdp_dp_cfg cfg) |
| 2336 | { |
| 2337 | if (!soc || !soc->ops) { |
| 2338 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 2339 | "%s: Invalid Instance", __func__); |
| 2340 | return 0; |
| 2341 | } |
| 2342 | |
| 2343 | if (!soc->ops->cmn_drv_ops || !soc->ops->cmn_drv_ops->txrx_get_cfg) |
| 2344 | return 0; |
| 2345 | |
| 2346 | return soc->ops->cmn_drv_ops->txrx_get_cfg(soc, cfg); |
| 2347 | } |
Amir Patel | 256dcbe | 2019-02-26 21:49:24 +0530 | [diff] [blame] | 2348 | |
| 2349 | /** |
| 2350 | * cdp_soc_set_rate_stats_ctx() - set rate stats context in soc |
| 2351 | * @soc: opaque soc handle |
| 2352 | * @ctx: rate stats context |
| 2353 | * |
| 2354 | * Return: void |
| 2355 | */ |
| 2356 | static inline void |
| 2357 | cdp_soc_set_rate_stats_ctx(ol_txrx_soc_handle soc, void *ctx) |
| 2358 | { |
| 2359 | if (!soc || !soc->ops) { |
| 2360 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 2361 | "%s: Invalid Instance:", __func__); |
| 2362 | QDF_BUG(0); |
| 2363 | return; |
| 2364 | } |
| 2365 | |
| 2366 | if (!soc->ops->cmn_drv_ops || |
| 2367 | !soc->ops->cmn_drv_ops->set_rate_stats_ctx) |
| 2368 | return; |
| 2369 | |
| 2370 | soc->ops->cmn_drv_ops->set_rate_stats_ctx((struct cdp_soc_t *)soc, |
| 2371 | ctx); |
| 2372 | } |
| 2373 | |
| 2374 | /** |
| 2375 | * cdp_soc_get_rate_stats_ctx() - get rate stats context in soc |
| 2376 | * @soc: opaque soc handle |
| 2377 | * |
| 2378 | * Return: void |
| 2379 | */ |
| 2380 | static inline void* |
| 2381 | cdp_soc_get_rate_stats_ctx(ol_txrx_soc_handle soc) |
| 2382 | { |
| 2383 | if (!soc || !soc->ops) { |
| 2384 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 2385 | "%s: Invalid Instance:", __func__); |
| 2386 | QDF_BUG(0); |
| 2387 | return NULL; |
| 2388 | } |
| 2389 | |
| 2390 | if (!soc->ops->cmn_drv_ops || |
| 2391 | !soc->ops->cmn_drv_ops->get_rate_stats_ctx) |
| 2392 | return NULL; |
| 2393 | |
| 2394 | return soc->ops->cmn_drv_ops->get_rate_stats_ctx(soc); |
| 2395 | } |
| 2396 | |
| 2397 | /** |
| 2398 | * cdp_peer_flush_rate_stats() - flush peer rate statistics |
| 2399 | * @soc: opaque soc handle |
| 2400 | * @pdev: pdev handle |
| 2401 | * @buf: stats buffer |
| 2402 | */ |
| 2403 | static inline void |
| 2404 | cdp_peer_flush_rate_stats(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, |
| 2405 | void *buf) |
| 2406 | { |
| 2407 | if (!soc || !soc->ops) { |
| 2408 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 2409 | "%s: Invalid Instance:", __func__); |
| 2410 | QDF_BUG(0); |
| 2411 | return; |
| 2412 | } |
| 2413 | |
| 2414 | if (!soc->ops->cmn_drv_ops || |
| 2415 | !soc->ops->cmn_drv_ops->txrx_peer_flush_rate_stats) |
| 2416 | return; |
| 2417 | |
| 2418 | soc->ops->cmn_drv_ops->txrx_peer_flush_rate_stats(soc, pdev, buf); |
| 2419 | } |
| 2420 | |
| 2421 | /** |
| 2422 | * cdp_flush_rate_stats_request() - request flush rate statistics |
| 2423 | * @soc: opaque soc handle |
| 2424 | * @pdev: pdev handle |
| 2425 | */ |
| 2426 | static inline void |
| 2427 | cdp_flush_rate_stats_request(struct cdp_soc_t *soc, struct cdp_pdev *pdev) |
| 2428 | { |
| 2429 | if (!soc || !soc->ops) { |
| 2430 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 2431 | "%s: Invalid Instance:", __func__); |
| 2432 | QDF_BUG(0); |
| 2433 | return; |
| 2434 | } |
| 2435 | |
| 2436 | if (!soc->ops->cmn_drv_ops || |
| 2437 | !soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request) |
| 2438 | return; |
| 2439 | |
| 2440 | soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request(soc, pdev); |
| 2441 | } |
Debasis Das | a3249bd | 2019-03-01 11:58:22 +0530 | [diff] [blame^] | 2442 | |
| 2443 | /** |
| 2444 | * cdp_set_vdev_pcp_tid_map() - set vdev pcp-tid-map |
| 2445 | * @soc: opaque soc handle |
| 2446 | * @vdev: data path vdev handle |
| 2447 | * @pcp: pcp value |
| 2448 | * @tid: tid value |
| 2449 | * |
| 2450 | * This API is used to configure the pcp-to-tid mapping for a pdev. |
| 2451 | * |
| 2452 | * Return: QDF_STATUS_SUCCESS if value set successfully |
| 2453 | * QDF_STATUS_E_INVAL false if error |
| 2454 | */ |
| 2455 | static inline |
| 2456 | QDF_STATUS cdp_set_vdev_pcp_tid_map(ol_txrx_soc_handle soc, |
| 2457 | struct cdp_vdev *vdev_handle, |
| 2458 | uint8_t pcp, uint8_t tid) |
| 2459 | { |
| 2460 | if (!soc || !soc->ops) { |
| 2461 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 2462 | "%s: Invalid Instance", __func__); |
| 2463 | return QDF_STATUS_E_INVAL; |
| 2464 | } |
| 2465 | |
| 2466 | if (!soc->ops->cmn_drv_ops || |
| 2467 | !soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map) |
| 2468 | return QDF_STATUS_E_INVAL; |
| 2469 | |
| 2470 | return soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map(vdev_handle, |
| 2471 | pcp, tid); |
| 2472 | } |
| 2473 | |
| 2474 | /** |
| 2475 | * cdp_set_vdev_tidmap_tbl_id() - set vdev tidmap table id |
| 2476 | * |
| 2477 | * @soc: opaque soc handle |
| 2478 | * @vdev: data path vdev handle |
| 2479 | * @mapid: value of mapid |
| 2480 | * |
| 2481 | * This API is used to configure the table-id of the tid-mapping for a vdev. |
| 2482 | * Table '0' is for using the pdev's pcp-tid mapping and '1' is for using |
| 2483 | * the vdev's pcp-tid mapping. |
| 2484 | * |
| 2485 | * Return: QDF_STATUS_SUCCESS if value set successfully |
| 2486 | * QDF_STATUS_E_INVAL false if error |
| 2487 | */ |
| 2488 | static inline |
| 2489 | QDF_STATUS cdp_set_vdev_tidmap_tbl_id(ol_txrx_soc_handle soc, |
| 2490 | struct cdp_vdev *vdev_handle, |
| 2491 | uint8_t mapid) |
| 2492 | { |
| 2493 | if (!soc || !soc->ops) { |
| 2494 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 2495 | "%s: Invalid Instance", __func__); |
| 2496 | return QDF_STATUS_E_INVAL; |
| 2497 | } |
| 2498 | |
| 2499 | if (!soc->ops->cmn_drv_ops || |
| 2500 | !soc->ops->cmn_drv_ops->set_vdev_tidmap_tbl_id) |
| 2501 | return QDF_STATUS_E_INVAL; |
| 2502 | |
| 2503 | return soc->ops->cmn_drv_ops->set_vdev_tidmap_tbl_id(vdev_handle, |
| 2504 | mapid); |
| 2505 | } |
| 2506 | |
| 2507 | /** |
| 2508 | * cdp_set_vdev_tidmap_prty() - set vdev tidmap priority |
| 2509 | * @soc: opaque soc handle |
| 2510 | * @vdev: data path vdev handle |
| 2511 | * @prio: tidmap priority value |
| 2512 | * |
| 2513 | * This API is used to configure the tidmap priority for a vdev. |
| 2514 | * The tidmap priority decides which mapping, namely DSCP-TID, SVLAN_PCP-TID, |
| 2515 | * CVLAN_PCP-TID will be used. |
| 2516 | * The vdev tidmap priority will be used only when the tidmap_tbl_id is '1'. |
| 2517 | * |
| 2518 | * Return: QDF_STATUS_SUCCESS if value set successfully |
| 2519 | * QDF_STATUS_E_INVAL false if error |
| 2520 | */ |
| 2521 | static inline |
| 2522 | QDF_STATUS cdp_set_vdev_tidmap_prty(ol_txrx_soc_handle soc, |
| 2523 | struct cdp_vdev *vdev_handle, uint8_t prio) |
| 2524 | { |
| 2525 | if (!soc || !soc->ops) { |
| 2526 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 2527 | "%s: Invalid Instance", __func__); |
| 2528 | return QDF_STATUS_E_INVAL; |
| 2529 | } |
| 2530 | |
| 2531 | if (!soc->ops->cmn_drv_ops || |
| 2532 | !soc->ops->cmn_drv_ops->set_vdev_tidmap_prty) |
| 2533 | return QDF_STATUS_E_INVAL; |
| 2534 | |
| 2535 | return soc->ops->cmn_drv_ops->set_vdev_tidmap_prty(vdev_handle, prio); |
| 2536 | } |
Dhanashri Atre | 5b64648 | 2016-03-22 12:22:41 -0700 | [diff] [blame] | 2537 | #endif /* _CDP_TXRX_CMN_H_ */ |