Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 1 | /* |
Padma Raghunathan | fe453df | 2019-10-08 10:35:06 +0530 | [diff] [blame] | 2 | * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 3 | * |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
Yun Park | 29f74f1 | 2017-04-03 08:42:21 -0700 | [diff] [blame] | 19 | /** |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 20 | * @file cdp_txrx_ctrl.h |
| 21 | * @brief Define the host data path control API functions |
| 22 | * called by the host control SW and the OS interface module |
| 23 | */ |
| 24 | |
| 25 | #ifndef _CDP_TXRX_CTRL_H_ |
| 26 | #define _CDP_TXRX_CTRL_H_ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 27 | #include "cdp_txrx_handle.h" |
Pratik Gandhi | 7846150 | 2018-02-05 17:22:41 +0530 | [diff] [blame] | 28 | #include "cdp_txrx_cmn_struct.h" |
Karunakar Dasineni | 142f9ba | 2019-03-19 23:04:59 -0700 | [diff] [blame] | 29 | #include "cdp_txrx_cmn.h" |
Pratik Gandhi | 7846150 | 2018-02-05 17:22:41 +0530 | [diff] [blame] | 30 | #include "cdp_txrx_ops.h" |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 31 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 32 | static inline int cdp_is_target_ar900b |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 33 | (ol_txrx_soc_handle soc, struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 34 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 35 | if (!soc || !soc->ops) { |
| 36 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 37 | "%s: Invalid Instance:", __func__); |
| 38 | QDF_BUG(0); |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | if (!soc->ops->ctrl_ops || |
| 43 | !soc->ops->ctrl_ops->txrx_is_target_ar900b) |
| 44 | return 0; |
| 45 | |
| 46 | return soc->ops->ctrl_ops->txrx_is_target_ar900b(vdev); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 47 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 48 | |
| 49 | |
| 50 | /* WIN */ |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 51 | static inline int |
| 52 | cdp_mempools_attach(ol_txrx_soc_handle soc, void *ctrl_pdev) |
| 53 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 54 | if (!soc || !soc->ops) { |
| 55 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 56 | "%s: Invalid Instance:", __func__); |
| 57 | QDF_BUG(0); |
| 58 | return 0; |
| 59 | } |
| 60 | |
| 61 | if (!soc->ops->ctrl_ops || |
| 62 | !soc->ops->ctrl_ops->txrx_mempools_attach) |
| 63 | return 0; |
| 64 | |
| 65 | return soc->ops->ctrl_ops->txrx_mempools_attach(ctrl_pdev); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 66 | } |
| 67 | |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 68 | /** |
| 69 | * @brief set filter neighbour peers |
| 70 | * @details |
| 71 | * This defines interface function to set neighbour peer filtering. |
| 72 | * |
| 73 | * @param soc - the pointer to soc object |
| 74 | * @param pdev - the pointer physical device object |
| 75 | * @param val - the enable/disable value |
| 76 | * @return - int |
| 77 | */ |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 78 | static inline int |
| 79 | cdp_set_filter_neighbour_peers(ol_txrx_soc_handle soc, |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 80 | struct cdp_pdev *pdev, u_int32_t val) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 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); |
| 86 | return 0; |
| 87 | } |
| 88 | |
| 89 | if (!soc->ops->ctrl_ops || |
| 90 | !soc->ops->ctrl_ops->txrx_set_filter_neighbour_peers) |
| 91 | return 0; |
| 92 | |
| 93 | return soc->ops->ctrl_ops->txrx_set_filter_neighbour_peers |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 94 | (pdev, val); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 95 | } |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 96 | |
| 97 | /** |
| 98 | * @brief update the neighbour peer addresses |
| 99 | * @details |
| 100 | * This defines interface function to update neighbour peers addresses |
| 101 | * which needs to be filtered |
| 102 | * |
| 103 | * @param soc - the pointer to soc object |
Chaithanya Garrepalli | 95fc62f | 2018-07-24 18:52:27 +0530 | [diff] [blame] | 104 | * @param vdev - the pointer to vdev |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 105 | * @param cmd - add/del entry into peer table |
| 106 | * @param macaddr - the address of neighbour peer |
| 107 | * @return - int |
| 108 | */ |
| 109 | static inline int |
| 110 | cdp_update_filter_neighbour_peers(ol_txrx_soc_handle soc, |
Chaithanya Garrepalli | 95fc62f | 2018-07-24 18:52:27 +0530 | [diff] [blame] | 111 | struct cdp_vdev *vdev, uint32_t cmd, uint8_t *macaddr) |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 112 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 113 | if (!soc || !soc->ops) { |
| 114 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 115 | "%s: Invalid Instance:", __func__); |
| 116 | QDF_BUG(0); |
| 117 | return 0; |
| 118 | } |
| 119 | |
| 120 | if (!soc->ops->ctrl_ops || |
| 121 | !soc->ops->ctrl_ops->txrx_update_filter_neighbour_peers) |
| 122 | return 0; |
| 123 | |
| 124 | return soc->ops->ctrl_ops->txrx_update_filter_neighbour_peers |
Chaithanya Garrepalli | 95fc62f | 2018-07-24 18:52:27 +0530 | [diff] [blame] | 125 | (vdev, cmd, macaddr); |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 126 | } |
| 127 | |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 128 | /** |
| 129 | * @brief set the safemode of the device |
| 130 | * @details |
| 131 | * This flag is used to bypass the encrypt and decrypt processes when send and |
| 132 | * receive packets. It works like open AUTH mode, HW will treate all packets |
| 133 | * as non-encrypt frames because no key installed. For rx fragmented frames, |
| 134 | * it bypasses all the rx defragmentaion. |
| 135 | * |
| 136 | * @param vdev - the data virtual device object |
| 137 | * @param val - the safemode state |
| 138 | * @return - void |
| 139 | */ |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 140 | static inline void |
| 141 | cdp_set_safemode(ol_txrx_soc_handle soc, |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 142 | struct cdp_vdev *vdev, u_int32_t val) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 143 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 144 | if (!soc || !soc->ops) { |
| 145 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 146 | "%s: Invalid Instance:", __func__); |
| 147 | QDF_BUG(0); |
| 148 | return; |
| 149 | } |
| 150 | |
| 151 | if (!soc->ops->ctrl_ops || |
| 152 | !soc->ops->ctrl_ops->txrx_set_safemode) |
| 153 | return; |
| 154 | |
| 155 | soc->ops->ctrl_ops->txrx_set_safemode(vdev, val); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 156 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 157 | /** |
| 158 | * @brief configure the drop unencrypted frame flag |
| 159 | * @details |
| 160 | * Rx related. When set this flag, all the unencrypted frames |
| 161 | * received over a secure connection will be discarded |
| 162 | * |
| 163 | * @param vdev - the data virtual device object |
| 164 | * @param val - flag |
| 165 | * @return - void |
| 166 | */ |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 167 | static inline void |
| 168 | cdp_set_drop_unenc(ol_txrx_soc_handle soc, |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 169 | struct cdp_vdev *vdev, u_int32_t val) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 170 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 171 | if (!soc || !soc->ops) { |
| 172 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 173 | "%s: Invalid Instance:", __func__); |
| 174 | QDF_BUG(0); |
| 175 | return; |
| 176 | } |
| 177 | |
| 178 | if (!soc->ops->ctrl_ops || |
| 179 | !soc->ops->ctrl_ops->txrx_set_drop_unenc) |
| 180 | return; |
| 181 | |
| 182 | soc->ops->ctrl_ops->txrx_set_drop_unenc(vdev, val); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 183 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 184 | |
| 185 | |
| 186 | /** |
| 187 | * @brief set the Tx encapsulation type of the VDEV |
| 188 | * @details |
| 189 | * This will be used to populate the HTT desc packet type field during Tx |
| 190 | * |
| 191 | * @param vdev - the data virtual device object |
Nandha Kishore Easwaran | fb0a7e5 | 2017-02-03 21:18:49 +0530 | [diff] [blame] | 192 | * @param val - the Tx encap type (htt_cmn_pkt_type) |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 193 | * @return - void |
| 194 | */ |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 195 | static inline void |
| 196 | cdp_set_tx_encap_type(ol_txrx_soc_handle soc, |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 197 | struct cdp_vdev *vdev, enum htt_cmn_pkt_type val) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 198 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 199 | if (!soc || !soc->ops) { |
| 200 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 201 | "%s: Invalid Instance:", __func__); |
| 202 | QDF_BUG(0); |
| 203 | return; |
| 204 | } |
| 205 | |
| 206 | if (!soc->ops->ctrl_ops || |
| 207 | !soc->ops->ctrl_ops->txrx_set_tx_encap_type) |
| 208 | return; |
| 209 | |
| 210 | soc->ops->ctrl_ops->txrx_set_tx_encap_type(vdev, val); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 211 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 212 | |
| 213 | /** |
| 214 | * @brief set the Rx decapsulation type of the VDEV |
| 215 | * @details |
| 216 | * This will be used to configure into firmware and hardware which format to |
| 217 | * decap all Rx packets into, for all peers under the VDEV. |
| 218 | * |
| 219 | * @param vdev - the data virtual device object |
Nandha Kishore Easwaran | fb0a7e5 | 2017-02-03 21:18:49 +0530 | [diff] [blame] | 220 | * @param val - the Rx decap mode (htt_cmn_pkt_type) |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 221 | * @return - void |
| 222 | */ |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 223 | static inline void |
| 224 | cdp_set_vdev_rx_decap_type(ol_txrx_soc_handle soc, |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 225 | struct cdp_vdev *vdev, enum htt_cmn_pkt_type val) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 226 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 227 | if (!soc || !soc->ops) { |
| 228 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 229 | "%s: Invalid Instance:", __func__); |
| 230 | QDF_BUG(0); |
| 231 | return; |
| 232 | } |
| 233 | |
| 234 | if (!soc->ops->ctrl_ops || |
| 235 | !soc->ops->ctrl_ops->txrx_set_vdev_rx_decap_type) |
| 236 | return; |
| 237 | |
| 238 | soc->ops->ctrl_ops->txrx_set_vdev_rx_decap_type |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 239 | (vdev, val); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 240 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 241 | |
| 242 | /** |
| 243 | * @brief get the Rx decapsulation type of the VDEV |
| 244 | * |
| 245 | * @param vdev - the data virtual device object |
Nandha Kishore Easwaran | fb0a7e5 | 2017-02-03 21:18:49 +0530 | [diff] [blame] | 246 | * @return - the Rx decap type (htt_cmn_pkt_type) |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 247 | */ |
Nandha Kishore Easwaran | fb0a7e5 | 2017-02-03 21:18:49 +0530 | [diff] [blame] | 248 | static inline enum htt_cmn_pkt_type |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 249 | cdp_get_vdev_rx_decap_type(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 250 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 251 | if (!soc || !soc->ops) { |
| 252 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 253 | "%s: Invalid Instance:", __func__); |
| 254 | QDF_BUG(0); |
| 255 | return 0; |
| 256 | } |
| 257 | |
| 258 | if (!soc->ops->ctrl_ops || |
| 259 | !soc->ops->ctrl_ops->txrx_get_vdev_rx_decap_type) |
| 260 | return 0; |
| 261 | |
| 262 | return soc->ops->ctrl_ops->txrx_get_vdev_rx_decap_type(vdev); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 263 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 264 | |
Tallapragada Kalyan | fd1edcc | 2017-03-07 19:34:29 +0530 | [diff] [blame] | 265 | /** |
| 266 | * @brief set the Reo Destination ring for the pdev |
| 267 | * @details |
| 268 | * This will be used to configure the Reo Destination ring for this pdev. |
| 269 | * |
| 270 | * @param soc - pointer to the soc |
| 271 | * @param pdev - the data physical device object |
| 272 | * @param val - the Reo destination ring index (1 to 4) |
| 273 | * @return - void |
| 274 | */ |
| 275 | static inline void |
| 276 | cdp_set_pdev_reo_dest(ol_txrx_soc_handle soc, |
| 277 | struct cdp_pdev *pdev, enum cdp_host_reo_dest_ring val) |
| 278 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 279 | if (!soc || !soc->ops) { |
| 280 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 281 | "%s: Invalid Instance:", __func__); |
| 282 | QDF_BUG(0); |
| 283 | return; |
| 284 | } |
| 285 | |
| 286 | if (!soc->ops->ctrl_ops || |
| 287 | !soc->ops->ctrl_ops->txrx_set_pdev_reo_dest) |
| 288 | return; |
| 289 | |
| 290 | soc->ops->ctrl_ops->txrx_set_pdev_reo_dest |
Tallapragada Kalyan | fd1edcc | 2017-03-07 19:34:29 +0530 | [diff] [blame] | 291 | (pdev, val); |
Tallapragada Kalyan | fd1edcc | 2017-03-07 19:34:29 +0530 | [diff] [blame] | 292 | } |
| 293 | |
| 294 | /** |
| 295 | * @brief get the Reo Destination ring for the pdev |
| 296 | * |
| 297 | * @param soc - pointer to the soc |
| 298 | * @param pdev - the data physical device object |
| 299 | * @return - the Reo destination ring index (1 to 4), 0 if not supported. |
| 300 | */ |
| 301 | static inline enum cdp_host_reo_dest_ring |
| 302 | cdp_get_pdev_reo_dest(ol_txrx_soc_handle soc, struct cdp_pdev *pdev) |
| 303 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 304 | if (!soc || !soc->ops) { |
| 305 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 306 | "%s: Invalid Instance:", __func__); |
| 307 | QDF_BUG(0); |
| 308 | return cdp_host_reo_dest_ring_unknown; |
| 309 | } |
| 310 | |
| 311 | if (!soc->ops->ctrl_ops || |
| 312 | !soc->ops->ctrl_ops->txrx_get_pdev_reo_dest) |
| 313 | return cdp_host_reo_dest_ring_unknown; |
| 314 | |
| 315 | return soc->ops->ctrl_ops->txrx_get_pdev_reo_dest(pdev); |
Tallapragada Kalyan | fd1edcc | 2017-03-07 19:34:29 +0530 | [diff] [blame] | 316 | } |
| 317 | |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 318 | /* Is this similar to ol_txrx_peer_state_update() in MCL */ |
| 319 | /** |
| 320 | * @brief Update the authorize peer object at association time |
| 321 | * @details |
| 322 | * For the host-based implementation of rate-control, it |
| 323 | * updates the peer/node-related parameters within rate-control |
| 324 | * context of the peer at association. |
| 325 | * |
| 326 | * @param peer - pointer to the node's object |
| 327 | * @authorize - either to authorize or unauthorize peer |
| 328 | * |
| 329 | * @return none |
| 330 | */ |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 331 | static inline void |
| 332 | cdp_peer_authorize(ol_txrx_soc_handle soc, |
c_cgodav | bd5b3c2 | 2017-06-07 12:31:40 +0530 | [diff] [blame] | 333 | struct cdp_peer *peer, u_int32_t authorize) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 334 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 335 | if (!soc || !soc->ops) { |
| 336 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 337 | "%s: Invalid Instance:", __func__); |
| 338 | QDF_BUG(0); |
| 339 | return; |
| 340 | } |
| 341 | |
| 342 | if (!soc->ops->ctrl_ops || |
| 343 | !soc->ops->ctrl_ops->txrx_peer_authorize) |
| 344 | return; |
| 345 | |
| 346 | soc->ops->ctrl_ops->txrx_peer_authorize |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 347 | (peer, authorize); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 348 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 349 | |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 350 | /* Should be ol_txrx_ctrl_api.h */ |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 351 | static inline void cdp_set_mesh_mode |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 352 | (ol_txrx_soc_handle soc, struct cdp_vdev *vdev, u_int32_t val) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 353 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 354 | if (!soc || !soc->ops) { |
| 355 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 356 | "%s: Invalid Instance:", __func__); |
| 357 | QDF_BUG(0); |
| 358 | return; |
| 359 | } |
| 360 | |
| 361 | if (!soc->ops->ctrl_ops || |
| 362 | !soc->ops->ctrl_ops->txrx_set_mesh_mode) |
| 363 | return; |
| 364 | |
| 365 | soc->ops->ctrl_ops->txrx_set_mesh_mode(vdev, val); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 366 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 367 | |
Venkateswara Swamy Bandaru | ec4f8e6 | 2017-03-07 11:04:28 +0530 | [diff] [blame] | 368 | /** |
| 369 | * @brief set mesh rx filter |
| 370 | * @details based on the bits enabled in the filter packets has to be dropped. |
| 371 | * |
| 372 | * @param soc - pointer to the soc |
| 373 | * @param vdev - the data virtual device object |
| 374 | * @param val - value to be set |
| 375 | * @return - void |
| 376 | */ |
| 377 | static inline |
| 378 | void cdp_set_mesh_rx_filter(ol_txrx_soc_handle soc, |
| 379 | struct cdp_vdev *vdev, uint32_t val) |
| 380 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 381 | if (!soc || !soc->ops) { |
| 382 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 383 | "%s: Invalid Instance:", __func__); |
| 384 | QDF_BUG(0); |
| 385 | return; |
| 386 | } |
| 387 | |
| 388 | if (!soc->ops->ctrl_ops || |
| 389 | !soc->ops->ctrl_ops->txrx_set_mesh_rx_filter) |
| 390 | return; |
| 391 | |
| 392 | soc->ops->ctrl_ops->txrx_set_mesh_rx_filter(vdev, val); |
Venkateswara Swamy Bandaru | ec4f8e6 | 2017-03-07 11:04:28 +0530 | [diff] [blame] | 393 | } |
| 394 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 395 | static inline void cdp_tx_flush_buffers |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 396 | (ol_txrx_soc_handle soc, struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 397 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 398 | if (!soc || !soc->ops) { |
| 399 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 400 | "%s: Invalid Instance:", __func__); |
| 401 | QDF_BUG(0); |
| 402 | return; |
| 403 | } |
| 404 | |
| 405 | if (!soc->ops->ctrl_ops || |
| 406 | !soc->ops->ctrl_ops->tx_flush_buffers) |
| 407 | return; |
| 408 | |
| 409 | soc->ops->ctrl_ops->tx_flush_buffers(vdev); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 410 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 411 | |
phadiman | 4213e9c | 2018-10-29 12:50:02 +0530 | [diff] [blame] | 412 | static inline uint32_t cdp_txrx_get_vdev_param(ol_txrx_soc_handle soc, |
| 413 | struct cdp_vdev *vdev, |
| 414 | enum cdp_vdev_param_type type) |
| 415 | { |
| 416 | if (!soc || !soc->ops) { |
| 417 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 418 | "%s: Invalid Instance:", __func__); |
| 419 | QDF_BUG(0); |
| 420 | return -1; |
| 421 | } |
| 422 | |
| 423 | if (!soc->ops->ctrl_ops || |
| 424 | !soc->ops->ctrl_ops->txrx_get_vdev_param) { |
| 425 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 426 | "%s: callback not registered:", __func__); |
| 427 | return -1; |
| 428 | } |
| 429 | |
| 430 | return soc->ops->ctrl_ops->txrx_get_vdev_param(vdev, type); |
| 431 | } |
| 432 | |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 433 | static inline void cdp_txrx_set_vdev_param(ol_txrx_soc_handle soc, |
| 434 | struct cdp_vdev *vdev, enum cdp_vdev_param_type type, |
| 435 | uint32_t val) |
| 436 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 437 | if (!soc || !soc->ops) { |
| 438 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 439 | "%s: Invalid Instance:", __func__); |
| 440 | QDF_BUG(0); |
| 441 | return; |
| 442 | } |
| 443 | |
| 444 | if (!soc->ops->ctrl_ops || |
| 445 | !soc->ops->ctrl_ops->txrx_set_vdev_param) |
| 446 | return; |
| 447 | |
| 448 | soc->ops->ctrl_ops->txrx_set_vdev_param(vdev, type, val); |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 449 | } |
| 450 | |
| 451 | static inline void |
| 452 | cdp_peer_set_nawds(ol_txrx_soc_handle soc, |
c_cgodav | bd5b3c2 | 2017-06-07 12:31:40 +0530 | [diff] [blame] | 453 | struct cdp_peer *peer, uint8_t value) |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 454 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 455 | if (!soc || !soc->ops) { |
| 456 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 457 | "%s: Invalid Instance:", __func__); |
| 458 | QDF_BUG(0); |
| 459 | return; |
| 460 | } |
| 461 | |
| 462 | if (!soc->ops->ctrl_ops || |
| 463 | !soc->ops->ctrl_ops->txrx_peer_set_nawds) |
| 464 | return; |
| 465 | |
| 466 | soc->ops->ctrl_ops->txrx_peer_set_nawds |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 467 | (peer, value); |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 468 | } |
Nandha Kishore Easwaran | 2668994 | 2017-04-17 16:52:46 +0530 | [diff] [blame] | 469 | |
Varsha Mishra | 6e1760c | 2019-07-27 22:51:42 +0530 | [diff] [blame] | 470 | #ifdef QCA_MULTIPASS_SUPPORT |
| 471 | static inline void |
| 472 | cdp_peer_set_vlan_id(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, |
| 473 | uint8_t *peer_mac, uint8_t vlan_id) |
| 474 | { |
| 475 | if (!soc || !soc->ops) { |
| 476 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 477 | "%s: Invalid Instance:", __func__); |
| 478 | QDF_BUG(0); |
| 479 | return; |
| 480 | } |
| 481 | |
| 482 | if (!soc->ops->ctrl_ops || |
| 483 | !soc->ops->ctrl_ops->txrx_peer_set_vlan_id) |
| 484 | return; |
| 485 | |
| 486 | soc->ops->ctrl_ops->txrx_peer_set_vlan_id(soc, vdev, peer_mac, vlan_id); |
| 487 | } |
| 488 | #endif |
| 489 | |
Chaithanya Garrepalli | 7ab76ae | 2018-07-05 14:53:50 +0530 | [diff] [blame] | 490 | /** |
| 491 | * cdp_txrx_set_pdev_param() - set pdev parameter |
| 492 | * @soc: opaque soc handle |
| 493 | * @pdev: data path pdev handle |
| 494 | * @type: param type |
| 495 | * @val: value of pdev_tx_capture |
| 496 | * |
| 497 | * Return: status: 0 - Success, non-zero: Failure |
| 498 | */ |
| 499 | static inline QDF_STATUS cdp_txrx_set_pdev_param(ol_txrx_soc_handle soc, |
| 500 | struct cdp_pdev *pdev, |
| 501 | enum cdp_pdev_param_type type, |
Kai Chen | 99efa0d | 2019-08-20 17:51:27 -0700 | [diff] [blame] | 502 | uint32_t val) |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 503 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 504 | if (!soc || !soc->ops) { |
| 505 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 506 | "%s: Invalid Instance:", __func__); |
| 507 | QDF_BUG(0); |
Chaithanya Garrepalli | 7ab76ae | 2018-07-05 14:53:50 +0530 | [diff] [blame] | 508 | return QDF_STATUS_SUCCESS; |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 509 | } |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 510 | |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 511 | if (!soc->ops->ctrl_ops || |
| 512 | !soc->ops->ctrl_ops->txrx_set_pdev_param) |
Chaithanya Garrepalli | 7ab76ae | 2018-07-05 14:53:50 +0530 | [diff] [blame] | 513 | return QDF_STATUS_SUCCESS; |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 514 | |
Chaithanya Garrepalli | 7ab76ae | 2018-07-05 14:53:50 +0530 | [diff] [blame] | 515 | return soc->ops->ctrl_ops->txrx_set_pdev_param |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 516 | (pdev, type, val); |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 517 | } |
| 518 | |
Nandha Kishore Easwaran | 2668994 | 2017-04-17 16:52:46 +0530 | [diff] [blame] | 519 | /** |
Keyur Parekh | c28f839 | 2018-11-21 02:50:56 -0800 | [diff] [blame] | 520 | * cdp_enable_peer_based_pktlog()- Set flag in peer structure |
| 521 | * |
| 522 | * @soc: pointer to the soc |
| 523 | * @pdev: the data physical device object |
| 524 | * @enable: enable or disable peer based filter based pktlog |
| 525 | * @peer_macaddr: Mac address of peer which needs to be |
| 526 | * filtered |
| 527 | * |
| 528 | * This function will set flag in peer structure if peer based filtering |
| 529 | * is enabled for pktlog |
| 530 | * |
| 531 | * Return: int |
| 532 | */ |
| 533 | static inline int |
| 534 | cdp_enable_peer_based_pktlog(ol_txrx_soc_handle soc, |
| 535 | struct cdp_pdev *pdev, char *peer_macaddr, |
| 536 | uint8_t enable) |
| 537 | { |
| 538 | if (!soc || !soc->ops) { |
| 539 | QDF_TRACE_ERROR(QDF_MODULE_ID_DP, |
| 540 | "%s invalid instance", __func__); |
| 541 | QDF_BUG(0); |
| 542 | return 0; |
| 543 | } |
| 544 | |
| 545 | if (!soc->ops->ctrl_ops || |
| 546 | !soc->ops->ctrl_ops->enable_peer_based_pktlog) |
| 547 | return 0; |
| 548 | |
| 549 | return soc->ops->ctrl_ops->enable_peer_based_pktlog |
| 550 | (pdev, peer_macaddr, enable); |
| 551 | } |
| 552 | |
| 553 | /** |
Varsha Mishra | a331e6e | 2019-03-11 12:16:14 +0530 | [diff] [blame] | 554 | * cdp_calculate_delay_stats()- get rx delay stats |
| 555 | * |
| 556 | * @soc: pointer to the soc |
| 557 | * @vdev: vdev handle |
| 558 | * @nbuf: nbuf which is passed |
| 559 | * |
| 560 | * This function will calculate rx delay statistics. |
| 561 | */ |
| 562 | static inline void |
| 563 | cdp_calculate_delay_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, |
| 564 | qdf_nbuf_t nbuf) |
| 565 | { |
| 566 | if (!soc || !soc->ops) { |
| 567 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 568 | "%s: Invalid Instance:", __func__); |
| 569 | QDF_BUG(0); |
| 570 | return; |
| 571 | } |
| 572 | |
| 573 | if (!soc->ops->ctrl_ops || |
| 574 | !soc->ops->ctrl_ops->calculate_delay_stats) { |
| 575 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 576 | "%s: callback not registered:", __func__); |
| 577 | return; |
| 578 | } |
| 579 | |
| 580 | return soc->ops->ctrl_ops->calculate_delay_stats(vdev, nbuf); |
| 581 | } |
| 582 | |
| 583 | /** |
Nandha Kishore Easwaran | 2668994 | 2017-04-17 16:52:46 +0530 | [diff] [blame] | 584 | * @brief Subscribe to a specified WDI event. |
| 585 | * @details |
| 586 | * This function adds the provided wdi_event_subscribe object to a list of |
| 587 | * subscribers for the specified WDI event. |
| 588 | * When the event in question happens, each subscriber for the event will |
| 589 | * have their callback function invoked. |
| 590 | * The order in which callback functions from multiple subscribers are |
| 591 | * invoked is unspecified. |
| 592 | * |
| 593 | * @param soc - pointer to the soc |
| 594 | * @param pdev - the data physical device object |
| 595 | * @param event_cb_sub - the callback and context for the event subscriber |
| 596 | * @param event - which event's notifications are being subscribed to |
| 597 | * @return - int |
| 598 | */ |
| 599 | static inline int |
| 600 | cdp_wdi_event_sub(ol_txrx_soc_handle soc, |
| 601 | struct cdp_pdev *pdev, void *event_cb_sub, uint32_t event) |
| 602 | { |
Venkata Sharath Chandra Manchala | 78e6478 | 2018-01-18 14:22:07 -0800 | [diff] [blame] | 603 | |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 604 | if (!soc || !soc->ops) { |
| 605 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
Nandha Kishore Easwaran | 2668994 | 2017-04-17 16:52:46 +0530 | [diff] [blame] | 606 | "%s invalid instance", __func__); |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 607 | QDF_BUG(0); |
Nandha Kishore Easwaran | 2668994 | 2017-04-17 16:52:46 +0530 | [diff] [blame] | 608 | return 0; |
| 609 | } |
| 610 | |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 611 | if (!soc->ops->ctrl_ops || |
| 612 | !soc->ops->ctrl_ops->txrx_wdi_event_sub) |
| 613 | return 0; |
| 614 | |
| 615 | return soc->ops->ctrl_ops->txrx_wdi_event_sub |
Nandha Kishore Easwaran | 2668994 | 2017-04-17 16:52:46 +0530 | [diff] [blame] | 616 | (pdev, event_cb_sub, event); |
Nandha Kishore Easwaran | 2668994 | 2017-04-17 16:52:46 +0530 | [diff] [blame] | 617 | } |
| 618 | |
| 619 | /** |
| 620 | * @brief Unsubscribe from a specified WDI event. |
| 621 | * @details |
| 622 | * This function removes the provided event subscription object from the |
| 623 | * list of subscribers for its event. |
| 624 | * This function shall only be called if there was a successful prior call |
| 625 | * to event_sub() on the same wdi_event_subscribe object. |
| 626 | * |
| 627 | * @param soc - pointer to the soc |
| 628 | * @param pdev - the data physical device object |
| 629 | * @param event_cb_sub - the callback and context for the event subscriber |
| 630 | * @param event - which event's notifications are being subscribed to |
| 631 | * @return - int |
| 632 | */ |
| 633 | static inline int |
| 634 | cdp_wdi_event_unsub(ol_txrx_soc_handle soc, |
| 635 | struct cdp_pdev *pdev, void *event_cb_sub, uint32_t event) |
| 636 | { |
Venkata Sharath Chandra Manchala | 78e6478 | 2018-01-18 14:22:07 -0800 | [diff] [blame] | 637 | |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 638 | if (!soc || !soc->ops) { |
| 639 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
Nandha Kishore Easwaran | 2668994 | 2017-04-17 16:52:46 +0530 | [diff] [blame] | 640 | "%s invalid instance", __func__); |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 641 | QDF_BUG(0); |
Nandha Kishore Easwaran | 2668994 | 2017-04-17 16:52:46 +0530 | [diff] [blame] | 642 | return 0; |
| 643 | } |
| 644 | |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 645 | if (!soc->ops->ctrl_ops || |
| 646 | !soc->ops->ctrl_ops->txrx_wdi_event_unsub) |
| 647 | return 0; |
| 648 | |
| 649 | return soc->ops->ctrl_ops->txrx_wdi_event_unsub |
Nandha Kishore Easwaran | 2668994 | 2017-04-17 16:52:46 +0530 | [diff] [blame] | 650 | (pdev, event_cb_sub, event); |
Nandha Kishore Easwaran | 2668994 | 2017-04-17 16:52:46 +0530 | [diff] [blame] | 651 | } |
c_cgodav | bd5b3c2 | 2017-06-07 12:31:40 +0530 | [diff] [blame] | 652 | |
| 653 | /** |
| 654 | * @brief Get security type from the from peer. |
| 655 | * @details |
| 656 | * This function gets the Security information from the peer handler. |
| 657 | * The security information is got from the rx descriptor and filled in |
| 658 | * to the peer handler. |
| 659 | * |
| 660 | * @param soc - pointer to the soc |
| 661 | * @param peer - peer handler |
| 662 | * @param sec_idx - mcast or ucast frame type. |
| 663 | * @return - int |
| 664 | */ |
| 665 | static inline int |
| 666 | cdp_get_sec_type(ol_txrx_soc_handle soc, struct cdp_peer *peer, uint8_t sec_idx) |
| 667 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 668 | if (!soc || !soc->ops) { |
| 669 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
c_cgodav | bd5b3c2 | 2017-06-07 12:31:40 +0530 | [diff] [blame] | 670 | "%s invalid instance", __func__); |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 671 | QDF_BUG(0); |
c_cgodav | bd5b3c2 | 2017-06-07 12:31:40 +0530 | [diff] [blame] | 672 | return A_ERROR; |
| 673 | } |
| 674 | |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 675 | if (!soc->ops->ctrl_ops || |
| 676 | !soc->ops->ctrl_ops->txrx_get_sec_type) |
| 677 | return A_ERROR; |
c_cgodav | bd5b3c2 | 2017-06-07 12:31:40 +0530 | [diff] [blame] | 678 | |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 679 | return soc->ops->ctrl_ops->txrx_get_sec_type |
| 680 | (peer, sec_idx); |
c_cgodav | bd5b3c2 | 2017-06-07 12:31:40 +0530 | [diff] [blame] | 681 | } |
Kiran Venkatappa | e2f4335 | 2017-08-23 22:14:44 +0530 | [diff] [blame] | 682 | |
| 683 | /** |
| 684 | * cdp_set_mgmt_tx_power(): function to set tx power for mgmt frames |
| 685 | * @vdev_handle: vdev handle |
| 686 | * @subtype_index: subtype |
| 687 | * @tx_power: Tx power |
| 688 | * Return: None |
| 689 | */ |
| 690 | static inline int cdp_set_mgmt_tx_power(ol_txrx_soc_handle soc, |
| 691 | struct cdp_vdev *vdev, uint8_t subtype, uint8_t tx_power) |
| 692 | { |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 693 | if (!soc || !soc->ops) { |
| 694 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 695 | "%s: Invalid Instance:", __func__); |
| 696 | QDF_BUG(0); |
| 697 | return 0; |
| 698 | } |
Kiran Venkatappa | e2f4335 | 2017-08-23 22:14:44 +0530 | [diff] [blame] | 699 | |
Venkata Sharath Chandra Manchala | aa62ae7 | 2017-10-20 00:00:54 -0700 | [diff] [blame] | 700 | if (!soc->ops->ctrl_ops || |
| 701 | !soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev) |
| 702 | return 0; |
| 703 | |
| 704 | soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev(vdev, |
| 705 | subtype, tx_power); |
Kiran Venkatappa | e2f4335 | 2017-08-23 22:14:44 +0530 | [diff] [blame] | 706 | return 0; |
| 707 | } |
Venkata Sharath Chandra Manchala | 09adf53 | 2017-11-03 14:44:35 -0700 | [diff] [blame] | 708 | |
| 709 | static inline void * |
| 710 | cdp_get_pldev(ol_txrx_soc_handle soc, |
| 711 | struct cdp_pdev *pdev) |
| 712 | { |
| 713 | if (!soc || !soc->ops) { |
| 714 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, |
| 715 | "%s invalid instance", __func__); |
| 716 | QDF_BUG(0); |
| 717 | return NULL; |
| 718 | } |
| 719 | |
| 720 | if (!soc->ops->ctrl_ops || !soc->ops->ctrl_ops->txrx_get_pldev) |
| 721 | return NULL; |
| 722 | |
| 723 | return soc->ops->ctrl_ops->txrx_get_pldev(pdev); |
| 724 | } |
| 725 | |
Padma Raghunathan | fe453df | 2019-10-08 10:35:06 +0530 | [diff] [blame] | 726 | #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE) |
| 727 | /** |
| 728 | * cdp_cfr_filter() - Configure Host RX monitor status ring for CFR |
| 729 | * @soc: SOC TXRX handle |
| 730 | * @pdev_id: ID of the physical device object |
| 731 | * @enable: Enable or disable CFR |
| 732 | * @filter_val: Flag to select filter for monitor mode |
| 733 | */ |
| 734 | static inline void |
| 735 | cdp_cfr_filter(ol_txrx_soc_handle soc, |
| 736 | uint8_t pdev_id, |
| 737 | bool enable, |
| 738 | struct cdp_monitor_filter *filter_val) |
| 739 | { |
| 740 | if (!soc || !soc->ops) { |
| 741 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, |
| 742 | "%s invalid instance", __func__); |
| 743 | QDF_BUG(0); |
| 744 | return; |
| 745 | } |
| 746 | |
| 747 | if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_cfr_filter) |
| 748 | return; |
| 749 | |
| 750 | soc->ops->cfr_ops->txrx_cfr_filter(soc, pdev_id, enable, filter_val); |
| 751 | } |
| 752 | #endif |
| 753 | |
Sumeet Rao | 511db29 | 2019-07-22 11:42:48 -0700 | [diff] [blame] | 754 | #if defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(WLAN_RX_PKT_CAPTURE_ENH) |
| 755 | /** |
| 756 | * cdp_update_peer_pkt_capture_params() - Sets Rx & Tx Capture params for a peer |
| 757 | * @soc: SOC TXRX handle |
| 758 | * @pdev: CDP pdev pointer |
| 759 | * @is_rx_pkt_cap_enable: enable/disable rx pkt capture for this peer |
| 760 | * @is_tx_pkt_cap_enable: enable/disable tx pkt capture for this peer |
| 761 | * @peer_mac: MAC address of peer for which pkt_cap is to be enabled/disabled |
| 762 | * |
| 763 | * Return: Success when matching peer is found & flags are set, error otherwise |
| 764 | */ |
| 765 | static inline QDF_STATUS |
| 766 | cdp_update_peer_pkt_capture_params(ol_txrx_soc_handle soc, |
| 767 | struct cdp_pdev *pdev, |
| 768 | bool is_rx_pkt_cap_enable, |
| 769 | bool is_tx_pkt_cap_enable, |
| 770 | uint8_t *peer_mac) |
| 771 | { |
| 772 | if (!soc || !soc->ops) { |
| 773 | dp_err("Invalid SOC instance"); |
| 774 | QDF_BUG(0); |
| 775 | return QDF_STATUS_E_FAILURE; |
| 776 | } |
| 777 | |
| 778 | if (!soc->ops->ctrl_ops || |
| 779 | !soc->ops->ctrl_ops->txrx_update_peer_pkt_capture_params) |
| 780 | return QDF_STATUS_E_FAILURE; |
| 781 | |
| 782 | return soc->ops->ctrl_ops->txrx_update_peer_pkt_capture_params |
| 783 | (pdev, is_rx_pkt_cap_enable, is_tx_pkt_cap_enable, |
| 784 | peer_mac); |
| 785 | } |
| 786 | #endif /* WLAN_TX_PKT_CAPTURE_ENH || WLAN_RX_PKT_CAPTURE_ENH */ |
| 787 | |
Karunakar Dasineni | 142f9ba | 2019-03-19 23:04:59 -0700 | [diff] [blame] | 788 | #ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG |
| 789 | /** |
| 790 | * cdp_update_pdev_rx_protocol_tag() - wrapper function to set the protocol |
| 791 | * tag in CDP layer from cfg layer |
| 792 | * @soc: SOC TXRX handle |
| 793 | * @pdev: CDP pdev pointer |
| 794 | * @protocol_mask: Bitmap for protocol for which tagging is enabled |
| 795 | * @protocol_type: Protocol type for which the tag should be update |
| 796 | * @tag: Actual tag value for the given prototype |
| 797 | * Return: Returns QDF_STATUS_SUCCESS/FAILURE |
| 798 | */ |
| 799 | static inline QDF_STATUS |
| 800 | cdp_update_pdev_rx_protocol_tag(ol_txrx_soc_handle soc, |
| 801 | struct cdp_pdev *pdev, uint32_t protocol_mask, |
| 802 | uint16_t protocol_type, uint16_t tag) |
| 803 | { |
| 804 | if (!soc || !soc->ops) { |
| 805 | dp_err("Invalid SOC instance"); |
| 806 | QDF_BUG(0); |
| 807 | return QDF_STATUS_E_FAILURE; |
| 808 | } |
| 809 | |
| 810 | if (!soc->ops->ctrl_ops || |
| 811 | !soc->ops->ctrl_ops->txrx_update_pdev_rx_protocol_tag) |
| 812 | return QDF_STATUS_E_FAILURE; |
| 813 | |
| 814 | return soc->ops->ctrl_ops->txrx_update_pdev_rx_protocol_tag |
| 815 | (pdev, protocol_mask, protocol_type, tag); |
| 816 | } |
| 817 | |
| 818 | #ifdef WLAN_SUPPORT_RX_TAG_STATISTICS |
| 819 | /** |
| 820 | * cdp_dump_pdev_rx_protocol_tag_stats() - wrapper function to dump the protocol |
| 821 | tag statistics for given or all protocols |
| 822 | * @soc: SOC TXRX handle |
| 823 | * @pdev: CDP pdev pointer |
| 824 | * @protocol_type: Protocol type for which the tag should be update |
| 825 | * Return: Returns QDF_STATUS_SUCCESS/FAILURE |
| 826 | */ |
| 827 | static inline QDF_STATUS |
| 828 | cdp_dump_pdev_rx_protocol_tag_stats(ol_txrx_soc_handle soc, |
| 829 | struct cdp_pdev *pdev, |
| 830 | uint16_t protocol_type) |
| 831 | { |
| 832 | if (!soc || !soc->ops) { |
| 833 | dp_err("Invalid SOC instance"); |
| 834 | QDF_BUG(0); |
| 835 | return QDF_STATUS_E_FAILURE; |
| 836 | } |
| 837 | |
| 838 | if (!soc->ops->ctrl_ops || |
| 839 | !soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats) |
| 840 | return QDF_STATUS_E_FAILURE; |
| 841 | |
| 842 | soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats(pdev, |
| 843 | protocol_type); |
| 844 | return QDF_STATUS_SUCCESS; |
| 845 | } |
| 846 | #endif /* WLAN_SUPPORT_RX_TAG_STATISTICS */ |
| 847 | #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */ |
| 848 | |
Soumya Bhat | bc719e6 | 2018-02-18 18:21:25 +0530 | [diff] [blame] | 849 | #ifdef ATH_SUPPORT_NAC_RSSI |
| 850 | /** |
| 851 | * cdp_vdev_config_for_nac_rssi(): To invoke dp callback for nac rssi config |
| 852 | * @soc: soc pointer |
| 853 | * @vdev: vdev pointer |
| 854 | * @nac_cmd: specfies nac_rss config action add, del, list |
| 855 | * @bssid: Neighbour bssid |
| 856 | * @client_macaddr: Non-Associated client MAC |
| 857 | * @chan_num: channel number to scan |
| 858 | * |
| 859 | * Return: QDF_STATUS |
| 860 | */ |
| 861 | static inline QDF_STATUS cdp_vdev_config_for_nac_rssi(ol_txrx_soc_handle soc, |
| 862 | struct cdp_vdev *vdev, enum cdp_nac_param_cmd nac_cmd, |
| 863 | char *bssid, char *client_macaddr, uint8_t chan_num) |
| 864 | { |
| 865 | if (!soc || !soc->ops) { |
| 866 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, |
| 867 | "%s invalid instance", __func__); |
| 868 | QDF_BUG(0); |
| 869 | return QDF_STATUS_E_FAILURE; |
| 870 | } |
| 871 | |
| 872 | if (!soc->ops->ctrl_ops || |
| 873 | !soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi) |
| 874 | return QDF_STATUS_E_FAILURE; |
| 875 | |
| 876 | return soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi(vdev, |
| 877 | nac_cmd, bssid, client_macaddr, chan_num); |
| 878 | } |
Chaithanya Garrepalli | 95fc62f | 2018-07-24 18:52:27 +0530 | [diff] [blame] | 879 | |
| 880 | /* |
| 881 | * cdp_vdev_get_neighbour_rssi(): To invoke dp callback to get rssi value of nac |
| 882 | * @soc: soc pointer |
| 883 | * @vdev: vdev pointer |
| 884 | * @macaddr: Non-Associated client MAC |
| 885 | * @rssi: rssi |
| 886 | * |
| 887 | * Return: QDF_STATUS |
| 888 | */ |
| 889 | static inline QDF_STATUS cdp_vdev_get_neighbour_rssi(ol_txrx_soc_handle soc, |
| 890 | struct cdp_vdev *vdev, |
| 891 | char *macaddr, |
| 892 | uint8_t *rssi) |
| 893 | { |
| 894 | if (!soc || !soc->ops) { |
| 895 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, |
| 896 | "%s invalid instance", __func__); |
| 897 | QDF_BUG(0); |
| 898 | return QDF_STATUS_E_FAILURE; |
| 899 | } |
| 900 | |
| 901 | if (!soc->ops->ctrl_ops || |
| 902 | !soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi) |
| 903 | return QDF_STATUS_E_FAILURE; |
| 904 | |
| 905 | return soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi(vdev, macaddr, |
| 906 | rssi); |
| 907 | } |
Soumya Bhat | bc719e6 | 2018-02-18 18:21:25 +0530 | [diff] [blame] | 908 | #endif |
Sumeet Rao | c4fa4df | 2019-07-05 02:11:19 -0700 | [diff] [blame] | 909 | |
| 910 | #ifdef WLAN_SUPPORT_RX_FLOW_TAG |
| 911 | /** |
| 912 | * cdp_set_rx_flow_tag() - wrapper function to set the flow |
| 913 | * tag in CDP layer from cfg layer |
| 914 | * @soc: SOC TXRX handle |
| 915 | * @pdev: CDP pdev pointer |
| 916 | * @flow_info: Flow 5-tuple, along with tag, if any, that needs to added/deleted |
| 917 | * |
| 918 | * Return: Success when add/del operation is successful, error otherwise |
| 919 | */ |
| 920 | static inline QDF_STATUS |
| 921 | cdp_set_rx_flow_tag(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, |
| 922 | struct cdp_rx_flow_info *flow_info) |
| 923 | { |
| 924 | if (!soc || !soc->ops) { |
| 925 | dp_err("Invalid SOC instance"); |
| 926 | QDF_BUG(0); |
| 927 | return QDF_STATUS_E_FAILURE; |
| 928 | } |
| 929 | |
| 930 | if (!soc->ops->ctrl_ops || |
| 931 | !soc->ops->ctrl_ops->txrx_set_rx_flow_tag) |
| 932 | return QDF_STATUS_E_FAILURE; |
| 933 | |
| 934 | return soc->ops->ctrl_ops->txrx_set_rx_flow_tag(pdev, flow_info); |
| 935 | } |
| 936 | |
| 937 | /** |
| 938 | * cdp_dump_rx_flow_tag_stats() - wrapper function to dump the flow |
| 939 | * tag statistics for given flow |
| 940 | * @soc: SOC TXRX handle |
| 941 | * @pdev: CDP pdev pointer |
| 942 | * @flow_info: Flow tuple for which we want to print the statistics |
| 943 | * |
| 944 | * Return: Success when flow is found and stats are printed, error otherwise |
| 945 | */ |
| 946 | static inline QDF_STATUS |
| 947 | cdp_dump_rx_flow_tag_stats(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, |
| 948 | struct cdp_rx_flow_info *flow_info) |
| 949 | { |
| 950 | if (!soc || !soc->ops) { |
| 951 | dp_err("Invalid SOC instance"); |
| 952 | QDF_BUG(0); |
| 953 | return QDF_STATUS_E_FAILURE; |
| 954 | } |
| 955 | |
| 956 | if (!soc->ops->ctrl_ops || |
| 957 | !soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats) |
| 958 | return QDF_STATUS_E_FAILURE; |
| 959 | |
| 960 | return soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats(pdev, flow_info); |
| 961 | } |
| 962 | #endif /* WLAN_SUPPORT_RX_FLOW_TAG */ |
| 963 | #endif /* _CDP_TXRX_CTRL_H_ */ |