Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | /** |
| 28 | * @file cdp_txrx_ctrl.h |
| 29 | * @brief Define the host data path control API functions |
| 30 | * called by the host control SW and the OS interface module |
| 31 | */ |
| 32 | |
| 33 | #ifndef _CDP_TXRX_CTRL_H_ |
| 34 | #define _CDP_TXRX_CTRL_H_ |
| 35 | /* TODO: adf need to be replaced with qdf */ |
| 36 | /* |
| 37 | * Cleanups -- Might need cleanup |
| 38 | */ |
| 39 | #if !QCA_OL_TX_PDEV_LOCK && QCA_NSS_PLATFORM || \ |
| 40 | (defined QCA_PARTNER_PLATFORM && QCA_PARTNER_SUPPORT_FAST_TX) |
| 41 | #define VAP_TX_SPIN_LOCK(_x) spin_lock(_x) |
| 42 | #define VAP_TX_SPIN_UNLOCK(_x) spin_unlock(_x) |
| 43 | #else /* QCA_OL_TX_PDEV_LOCK */ |
| 44 | #define VAP_TX_SPIN_LOCK(_x) |
| 45 | #define VAP_TX_SPIN_UNLOCK(_x) |
| 46 | #endif /* QCA_OL_TX_PDEV_LOCK */ |
| 47 | |
| 48 | #if QCA_OL_TX_PDEV_LOCK |
| 49 | void ol_ll_pdev_tx_lock(void *); |
| 50 | void ol_ll_pdev_tx_unlock(void *); |
| 51 | #define OL_TX_LOCK(_x) ol_ll_pdev_tx_lock(_x) |
| 52 | #define OL_TX_UNLOCK(_x) ol_ll_pdev_tx_unlock(_x) |
| 53 | |
| 54 | #define OL_TX_PDEV_LOCK(_x) qdf_spin_lock_bh(_x) |
| 55 | #define OL_TX_PDEV_UNLOCK(_x) qdf_spin_unlock_bh(_x) |
| 56 | #else |
| 57 | #define OL_TX_PDEV_LOCK(_x) |
| 58 | #define OL_TX_PDEV_UNLOCK(_x) |
| 59 | |
| 60 | #define OL_TX_LOCK(_x) |
| 61 | #define OL_TX_UNLOCK(_x) |
| 62 | #endif /* QCA_OL_TX_PDEV_LOCK */ |
| 63 | |
| 64 | #if !QCA_OL_TX_PDEV_LOCK |
| 65 | #define OL_TX_FLOW_CTRL_LOCK(_x) qdf_spin_lock_bh(_x) |
| 66 | #define OL_TX_FLOW_CTRL_UNLOCK(_x) qdf_spin_unlock_bh(_x) |
| 67 | |
| 68 | #define OL_TX_DESC_LOCK(_x) qdf_spin_lock_bh(_x) |
| 69 | #define OL_TX_DESC_UNLOCK(_x) qdf_spin_unlock_bh(_x) |
| 70 | |
| 71 | #define OSIF_VAP_TX_LOCK(_x) spin_lock(&((_x)->tx_lock)) |
| 72 | #define OSIF_VAP_TX_UNLOCK(_x) spin_unlock(&((_x)->tx_lock)) |
| 73 | |
| 74 | #define OL_TX_PEER_LOCK(_x, _id) qdf_spin_lock_bh(&((_x)->peer_lock[_id])) |
| 75 | #define OL_TX_PEER_UNLOCK(_x, _id) qdf_spin_unlock_bh(&((_x)->peer_lock[_id])) |
| 76 | |
| 77 | #define OL_TX_PEER_UPDATE_LOCK(_x, _id) \ |
| 78 | qdf_spin_lock_bh(&((_x)->peer_lock[_id])) |
| 79 | #define OL_TX_PEER_UPDATE_UNLOCK(_x, _id) \ |
| 80 | qdf_spin_unlock_bh(&((_x)->peer_lock[_id])) |
| 81 | |
| 82 | #else |
| 83 | #define OSIF_VAP_TX_LOCK(_x) ol_ll_pdev_tx_lock((_x)->iv_txrx_handle) |
| 84 | #define OSIF_VAP_TX_UNLOCK(_x) ol_ll_pdev_tx_unlock((_x)->iv_txrx_handle) |
| 85 | |
| 86 | #define OL_TX_FLOW_CTRL_LOCK(_x) |
| 87 | #define OL_TX_FLOW_CTRL_UNLOCK(_x) |
| 88 | |
| 89 | #define OL_TX_DESC_LOCK(_x) |
| 90 | #define OL_TX_DESC_UNLOCK(_x) |
| 91 | |
| 92 | #define OL_TX_PEER_LOCK(_x, _id) |
| 93 | #define OL_TX_PEER_UNLOCK(_x, _id) |
| 94 | |
| 95 | #define OL_TX_PEER_UPDATE_LOCK(_x, _id) qdf_spin_lock_bh(&((_x)->tx_lock)) |
| 96 | #define OL_TX_PEER_UPDATE_UNLOCK(_x, _id) qdf_spin_unlock_bh(&((_x)->tx_lock)) |
| 97 | |
| 98 | #endif /* !QCA_OL_TX_PDEV_LOCK */ |
| 99 | |
| 100 | |
| 101 | extern int ol_txrx_is_target_ar900b(ol_txrx_vdev_handle vdev); |
| 102 | #define OL_TXRX_IS_TARGET_AR900B(vdev) ol_txrx_is_target_ar900b(vdev) |
| 103 | |
| 104 | |
| 105 | /* WIN */ |
| 106 | int |
| 107 | ol_txrx_mempools_attach(ol_pdev_handle ctrl_pdev); |
| 108 | int |
| 109 | ol_txrx_set_filter_neighbour_peers( |
| 110 | ol_txrx_pdev_handle pdev, |
| 111 | u_int32_t val); |
| 112 | /** |
| 113 | * @brief set the safemode of the device |
| 114 | * @details |
| 115 | * This flag is used to bypass the encrypt and decrypt processes when send and |
| 116 | * receive packets. It works like open AUTH mode, HW will treate all packets |
| 117 | * as non-encrypt frames because no key installed. For rx fragmented frames, |
| 118 | * it bypasses all the rx defragmentaion. |
| 119 | * |
| 120 | * @param vdev - the data virtual device object |
| 121 | * @param val - the safemode state |
| 122 | * @return - void |
| 123 | */ |
| 124 | |
| 125 | void |
| 126 | ol_txrx_set_safemode( |
| 127 | ol_txrx_vdev_handle vdev, |
| 128 | u_int32_t val); |
| 129 | /** |
| 130 | * @brief configure the drop unencrypted frame flag |
| 131 | * @details |
| 132 | * Rx related. When set this flag, all the unencrypted frames |
| 133 | * received over a secure connection will be discarded |
| 134 | * |
| 135 | * @param vdev - the data virtual device object |
| 136 | * @param val - flag |
| 137 | * @return - void |
| 138 | */ |
| 139 | void |
| 140 | ol_txrx_set_drop_unenc( |
| 141 | ol_txrx_vdev_handle vdev, |
| 142 | u_int32_t val); |
| 143 | |
| 144 | |
| 145 | /** |
| 146 | * @brief set the Tx encapsulation type of the VDEV |
| 147 | * @details |
| 148 | * This will be used to populate the HTT desc packet type field during Tx |
| 149 | * |
| 150 | * @param vdev - the data virtual device object |
| 151 | * @param val - the Tx encap type |
| 152 | * @return - void |
| 153 | */ |
| 154 | void |
| 155 | ol_txrx_set_tx_encap_type( |
| 156 | ol_txrx_vdev_handle vdev, |
| 157 | enum htt_pkt_type val); |
| 158 | |
| 159 | /** |
| 160 | * @brief set the Rx decapsulation type of the VDEV |
| 161 | * @details |
| 162 | * This will be used to configure into firmware and hardware which format to |
| 163 | * decap all Rx packets into, for all peers under the VDEV. |
| 164 | * |
| 165 | * @param vdev - the data virtual device object |
| 166 | * @param val - the Rx decap mode |
| 167 | * @return - void |
| 168 | */ |
| 169 | void |
| 170 | ol_txrx_set_vdev_rx_decap_type( |
| 171 | ol_txrx_vdev_handle vdev, |
| 172 | enum htt_pkt_type val); |
| 173 | |
| 174 | /** |
| 175 | * @brief get the Rx decapsulation type of the VDEV |
| 176 | * |
| 177 | * @param vdev - the data virtual device object |
| 178 | * @return - the Rx decap type |
| 179 | */ |
| 180 | enum htt_pkt_type |
| 181 | ol_txrx_get_vdev_rx_decap_type(ol_txrx_vdev_handle vdev); |
| 182 | |
| 183 | /* Is this similar to ol_txrx_peer_state_update() in MCL */ |
| 184 | /** |
| 185 | * @brief Update the authorize peer object at association time |
| 186 | * @details |
| 187 | * For the host-based implementation of rate-control, it |
| 188 | * updates the peer/node-related parameters within rate-control |
| 189 | * context of the peer at association. |
| 190 | * |
| 191 | * @param peer - pointer to the node's object |
| 192 | * @authorize - either to authorize or unauthorize peer |
| 193 | * |
| 194 | * @return none |
| 195 | */ |
| 196 | void |
| 197 | ol_txrx_peer_authorize(struct ol_txrx_peer_t *peer, u_int32_t authorize); |
| 198 | |
| 199 | bool |
| 200 | ol_txrx_set_inact_params(ol_txrx_pdev_handle pdev, |
| 201 | u_int16_t inact_check_interval, |
| 202 | u_int16_t inact_normal, |
| 203 | u_int16_t inact_overload); |
| 204 | bool |
| 205 | ol_txrx_start_inact_timer( |
| 206 | ol_txrx_pdev_handle pdev, |
| 207 | bool enable); |
| 208 | |
| 209 | /** |
| 210 | * @brief Set the overload status of the radio |
| 211 | * @details |
| 212 | * Set the overload status of the radio, updating the inactivity |
| 213 | * threshold and inactivity count for each node. |
| 214 | * |
| 215 | * @param pdev - the data physical device object |
| 216 | * @param overload - whether the radio is overloaded or not |
| 217 | */ |
| 218 | void |
| 219 | ol_txrx_set_overload( |
| 220 | ol_txrx_pdev_handle pdev, |
| 221 | bool overload); |
| 222 | /** |
| 223 | * @brief Check the inactivity status of the peer/node |
| 224 | * |
| 225 | * @param peer - pointer to the node's object |
| 226 | * @return true if the node is inactive; otherwise return false |
| 227 | */ |
| 228 | bool |
| 229 | ol_txrx_peer_is_inact(ol_txrx_peer_handle peer); |
| 230 | |
| 231 | /** |
| 232 | * @brief Mark inactivity status of the peer/node |
| 233 | * @details |
| 234 | * If it becomes active, reset inactivity count to reload value; |
| 235 | * if the inactivity status changed, notify umac band steering. |
| 236 | * |
| 237 | * @param peer - pointer to the node's object |
| 238 | * @param inactive - whether the node is inactive or not |
| 239 | */ |
| 240 | void |
| 241 | ol_txrx_mark_peer_inact( |
| 242 | ol_txrx_peer_handle peer, |
| 243 | bool inactive); |
| 244 | |
| 245 | |
| 246 | /* Should be ol_txrx_ctrl_api.h */ |
| 247 | void ol_txrx_set_mesh_mode(ol_txrx_vdev_handle vdev, u_int32_t val); |
| 248 | |
| 249 | void ol_tx_flush_buffers(struct ol_txrx_vdev_t *vdev); |
| 250 | |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 251 | #endif |