Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Yu Wang | 053d3e7 | 2017-02-08 18:48:24 +0800 | [diff] [blame] | 2 | * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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 | /** |
| 29 | * @file ol_txrx_htt_api.h |
| 30 | * @brief Define the host data API functions called by the host HTT SW. |
| 31 | */ |
| 32 | #ifndef _OL_TXRX_HTT_API__H_ |
| 33 | #define _OL_TXRX_HTT_API__H_ |
| 34 | |
| 35 | #include <htt.h> /* HTT_TX_COMPL_IND_STAT */ |
| 36 | #include <athdefs.h> /* A_STATUS */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 37 | #include <qdf_nbuf.h> /* qdf_nbuf_t */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 38 | |
Dhanashri Atre | 12a0839 | 2016-02-17 13:10:34 -0800 | [diff] [blame] | 39 | #include <cdp_txrx_cmn.h> /* ol_txrx_pdev_handle */ |
Leo Chang | 9872676 | 2016-10-28 11:07:18 -0700 | [diff] [blame] | 40 | #include <ol_defines.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 41 | |
Kai Liu | 0c2b5e5 | 2016-10-24 16:25:46 +0800 | [diff] [blame] | 42 | #ifdef CONFIG_HL_SUPPORT |
| 43 | static inline uint16_t *ol_tx_msdu_id_storage(qdf_nbuf_t msdu) |
| 44 | { |
Yu Wang | 053d3e7 | 2017-02-08 18:48:24 +0800 | [diff] [blame] | 45 | return (uint16_t *) (&QDF_NBUF_CB_TX_DESC_ID(msdu)); |
Kai Liu | 0c2b5e5 | 2016-10-24 16:25:46 +0800 | [diff] [blame] | 46 | |
| 47 | } |
| 48 | #else |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 49 | static inline uint16_t *ol_tx_msdu_id_storage(qdf_nbuf_t msdu) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 50 | { |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 51 | qdf_assert(qdf_nbuf_headroom(msdu) >= (sizeof(uint16_t) * 2 - 1)); |
| 52 | return (uint16_t *) (((qdf_size_t) (qdf_nbuf_head(msdu) + 1)) & ~0x1); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 53 | } |
Kai Liu | 0c2b5e5 | 2016-10-24 16:25:46 +0800 | [diff] [blame] | 54 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 55 | /** |
| 56 | * @brief Tx MSDU download completion for a LL system |
| 57 | * @details |
| 58 | * Release the reference to the downloaded tx descriptor. |
| 59 | * In the unlikely event that the reference count is zero, free |
| 60 | * the tx descriptor and tx frame. |
| 61 | * |
| 62 | * @param pdev - (abstract) pointer to the txrx physical device |
| 63 | * @param status - indication of whether the download succeeded |
| 64 | * @param msdu - the downloaded tx frame |
| 65 | * @param msdu_id - the txrx ID of the tx frame - this is used for |
| 66 | * locating the frame's tx descriptor |
| 67 | */ |
| 68 | void |
| 69 | ol_tx_download_done_ll(void *pdev, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 70 | A_STATUS status, qdf_nbuf_t msdu, uint16_t msdu_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 71 | |
| 72 | /** |
| 73 | * @brief Tx MSDU download completion for HL system without tx completion msgs |
| 74 | * @details |
| 75 | * Free the tx descriptor and tx frame. |
| 76 | * Invoke the HL tx download scheduler. |
| 77 | * |
| 78 | * @param pdev - (abstract) pointer to the txrx physical device |
| 79 | * @param status - indication of whether the download succeeded |
| 80 | * @param msdu - the downloaded tx frame |
| 81 | * @param msdu_id - the txrx ID of the tx frame - this is used for |
| 82 | * locating the frame's tx descriptor |
| 83 | */ |
| 84 | void |
| 85 | ol_tx_download_done_hl_free(void *pdev, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 86 | A_STATUS status, qdf_nbuf_t msdu, uint16_t msdu_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 87 | |
| 88 | /** |
| 89 | * @brief Tx MSDU download completion for HL system with tx completion msgs |
| 90 | * @details |
| 91 | * Release the reference to the downloaded tx descriptor. |
| 92 | * In the unlikely event that the reference count is zero, free |
| 93 | * the tx descriptor and tx frame. |
| 94 | * Optionally, invoke the HL tx download scheduler. (It is probable that |
| 95 | * the HL tx download scheduler would operate in response to tx completion |
| 96 | * messages rather than download completion events.) |
| 97 | * |
| 98 | * @param pdev - (abstract) pointer to the txrx physical device |
| 99 | * @param status - indication of whether the download succeeded |
| 100 | * @param msdu - the downloaded tx frame |
| 101 | * @param msdu_id - the txrx ID of the tx frame - this is used for |
| 102 | * locating the frame's tx descriptor |
| 103 | */ |
| 104 | void |
| 105 | ol_tx_download_done_hl_retain(void *pdev, |
| 106 | A_STATUS status, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 107 | qdf_nbuf_t msdu, uint16_t msdu_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 108 | |
| 109 | /* |
| 110 | * For now, make the host HTT -> host txrx tx completion status |
| 111 | * match the target HTT -> host HTT tx completion status, so no |
| 112 | * translation is needed. |
| 113 | */ |
| 114 | /* |
| 115 | * host-only statuses use a different part of the number space |
| 116 | * than host-target statuses |
| 117 | */ |
| 118 | #define HTT_HOST_ONLY_STATUS_CODE_START 128 |
| 119 | enum htt_tx_status { |
| 120 | /* ok - successfully sent + acked */ |
| 121 | htt_tx_status_ok = HTT_TX_COMPL_IND_STAT_OK, |
| 122 | |
| 123 | /* discard - not sent (congestion control) */ |
| 124 | htt_tx_status_discard = HTT_TX_COMPL_IND_STAT_DISCARD, |
| 125 | |
| 126 | /* no_ack - sent, but no ack */ |
| 127 | htt_tx_status_no_ack = HTT_TX_COMPL_IND_STAT_NO_ACK, |
| 128 | |
| 129 | /* download_fail - host could not deliver the tx frame to target */ |
| 130 | htt_tx_status_download_fail = HTT_HOST_ONLY_STATUS_CODE_START, |
| 131 | }; |
| 132 | |
| 133 | /** |
| 134 | * @brief Process a tx completion message sent by the target. |
| 135 | * @details |
| 136 | * When the target is done transmitting a tx frame (either because |
| 137 | * the frame was sent + acknowledged, or because the target gave up) |
| 138 | * it sends a tx completion message to the host. |
| 139 | * This notification function is used regardless of whether the |
| 140 | * transmission succeeded or not; the status argument indicates whether |
| 141 | * the transmission succeeded. |
| 142 | * This tx completion message indicates via the descriptor ID which |
| 143 | * tx frames were completed, and indicates via the status whether the |
| 144 | * frames were transmitted successfully. |
| 145 | * The host frees the completed descriptors / frames (updating stats |
| 146 | * in the process). |
| 147 | * |
| 148 | * @param pdev - the data physical device that sent the tx frames |
| 149 | * (registered with HTT as a context pointer during attach time) |
| 150 | * @param num_msdus - how many MSDUs are referenced by the tx completion |
| 151 | * message |
| 152 | * @param status - whether transmission was successful |
| 153 | * @param tx_msdu_id_iterator - abstract method of finding the IDs for the |
| 154 | * individual MSDUs referenced by the tx completion message, via the |
| 155 | * htt_tx_compl_desc_id API function |
| 156 | */ |
| 157 | void |
| 158 | ol_tx_completion_handler(ol_txrx_pdev_handle pdev, |
| 159 | int num_msdus, |
| 160 | enum htt_tx_status status, void *tx_msdu_id_iterator); |
| 161 | |
| 162 | void ol_tx_credit_completion_handler(ol_txrx_pdev_handle pdev, int credits); |
| 163 | |
Siddarth Poddar | 1df1cd8 | 2016-04-27 17:32:21 +0530 | [diff] [blame] | 164 | struct rate_report_t { |
| 165 | u_int16_t id; |
| 166 | u_int16_t phy:4; |
| 167 | u_int32_t rate; |
| 168 | }; |
| 169 | |
| 170 | #if defined(CONFIG_HL_SUPPORT) && defined(QCA_BAD_PEER_TX_FLOW_CL) |
| 171 | |
| 172 | /** |
| 173 | * @brief Process a link status report for all peers. |
| 174 | * @details |
| 175 | * The ol_txrx_peer_link_status_handler function performs basic peer link |
| 176 | * status analysis |
| 177 | * |
| 178 | * According to the design, there are 3 kinds of peers which will be |
| 179 | * treated differently: |
| 180 | * 1) normal: not do any flow control for the peer |
| 181 | * 2) limited: will apply flow control for the peer, but frames are allowed |
| 182 | * to send |
| 183 | * 3) paused: will apply flow control for the peer, no frame is allowed |
| 184 | * to send |
| 185 | * |
| 186 | * @param pdev - the data physical device that sent the tx frames |
| 187 | * @param status - the number of peers need to be handled |
| 188 | * @param peer_link_report - the link status dedail message |
| 189 | */ |
| 190 | void |
| 191 | ol_txrx_peer_link_status_handler( |
| 192 | ol_txrx_pdev_handle pdev, |
| 193 | u_int16_t peer_num, |
| 194 | struct rate_report_t *peer_link_status); |
| 195 | |
| 196 | |
| 197 | #else |
| 198 | static inline void ol_txrx_peer_link_status_handler( |
| 199 | ol_txrx_pdev_handle pdev, |
| 200 | u_int16_t peer_num, |
| 201 | struct rate_report_t *peer_link_status) |
| 202 | { |
Siddarth Poddar | 1df1cd8 | 2016-04-27 17:32:21 +0530 | [diff] [blame] | 203 | } |
| 204 | #endif |
| 205 | |
| 206 | |
| 207 | #ifdef FEATURE_HL_GROUP_CREDIT_FLOW_CONTROL |
| 208 | |
| 209 | /** |
| 210 | * ol_txrx_update_tx_queue_groups() - update vdev tx queue group if |
| 211 | * vdev id mask and ac mask is not matching |
| 212 | * @pdev: the data physical device |
| 213 | * @group_id: TXQ group id |
| 214 | * @credit: TXQ group credit count |
| 215 | * @absolute: TXQ group absolute |
| 216 | * @vdev_id_mask: TXQ vdev group id mask |
| 217 | * @ac_mask: TQX access category mask |
| 218 | * |
| 219 | * Return: None |
| 220 | */ |
| 221 | void |
| 222 | ol_txrx_update_tx_queue_groups( |
| 223 | ol_txrx_pdev_handle pdev, |
| 224 | u_int8_t group_id, |
| 225 | int32_t credit, |
| 226 | u_int8_t absolute, |
| 227 | u_int32_t vdev_id_mask, |
| 228 | u_int32_t ac_mask |
| 229 | ); |
| 230 | |
| 231 | /** |
| 232 | * ol_tx_desc_update_group_credit() - update group credits for txq group |
| 233 | * @pdev: the data physical device |
| 234 | * @tx_desc_id: desc id of tx completion message |
| 235 | * @credit: number of credits to update |
| 236 | * @absolute: absolute value |
| 237 | * @status: tx completion message status |
| 238 | * |
| 239 | * Return: None |
| 240 | */ |
| 241 | void |
| 242 | ol_tx_desc_update_group_credit( |
| 243 | ol_txrx_pdev_handle pdev, |
| 244 | u_int16_t tx_desc_id, |
| 245 | int credit, u_int8_t absolute, enum htt_tx_status status); |
| 246 | |
| 247 | #ifdef DEBUG_HL_LOGGING |
| 248 | |
| 249 | /** |
| 250 | * ol_tx_update_group_credit_stats() - update group credits stats for txq groups |
| 251 | * @pdev: the data physical device |
| 252 | * |
| 253 | * Return: None |
| 254 | */ |
| 255 | void |
| 256 | ol_tx_update_group_credit_stats(ol_txrx_pdev_handle pdev); |
| 257 | |
| 258 | /** |
| 259 | * ol_tx_dump_group_credit_stats() - dump group credits stats for txq groups |
| 260 | * @pdev: the data physical device |
| 261 | * |
| 262 | * Return: None |
| 263 | */ |
| 264 | void |
| 265 | ol_tx_dump_group_credit_stats(ol_txrx_pdev_handle pdev); |
| 266 | |
| 267 | /** |
| 268 | * ol_tx_clear_group_credit_stats() - clear group credits stats for txq groups |
| 269 | * @pdev: the data physical device |
| 270 | * |
| 271 | * Return: None |
| 272 | */ |
| 273 | void |
| 274 | ol_tx_clear_group_credit_stats(ol_txrx_pdev_handle pdev); |
| 275 | #else |
| 276 | |
| 277 | static inline void ol_tx_update_group_credit_stats(ol_txrx_pdev_handle pdev) |
| 278 | { |
Siddarth Poddar | 1df1cd8 | 2016-04-27 17:32:21 +0530 | [diff] [blame] | 279 | } |
| 280 | |
| 281 | static inline void ol_tx_dump_group_credit_stats(ol_txrx_pdev_handle pdev) |
| 282 | { |
Siddarth Poddar | 1df1cd8 | 2016-04-27 17:32:21 +0530 | [diff] [blame] | 283 | } |
| 284 | |
| 285 | static inline void ol_tx_clear_group_credit_stats(ol_txrx_pdev_handle pdev) |
| 286 | { |
Siddarth Poddar | 1df1cd8 | 2016-04-27 17:32:21 +0530 | [diff] [blame] | 287 | } |
| 288 | #endif |
| 289 | |
| 290 | #else |
| 291 | static inline void |
| 292 | ol_tx_desc_update_group_credit( |
| 293 | ol_txrx_pdev_handle pdev, |
| 294 | u_int16_t tx_desc_id, |
| 295 | int credit, u_int8_t absolute, enum htt_tx_status status) |
| 296 | { |
Siddarth Poddar | 1df1cd8 | 2016-04-27 17:32:21 +0530 | [diff] [blame] | 297 | } |
| 298 | #endif |
| 299 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 300 | /** |
| 301 | * @brief Init the total amount of target credit. |
| 302 | * @details |
| 303 | * |
| 304 | * @param pdev - the data physical device that sent the tx frames |
| 305 | * @param credit_delta - how much to increment the target's tx credit by |
| 306 | */ |
| 307 | void ol_tx_target_credit_init(struct ol_txrx_pdev_t *pdev, int credit_delta); |
| 308 | |
| 309 | /** |
| 310 | * @brief Process a tx completion message for a single MSDU. |
| 311 | * @details |
| 312 | * The ol_tx_single_completion_handler function performs the same tx |
| 313 | * completion processing as the ol_tx_completion_handler, but for a |
| 314 | * single frame. |
| 315 | * ol_tx_completion_handler is optimized to handle batch completions |
| 316 | * as efficiently as possible; in contrast ol_tx_single_completion_handler |
| 317 | * handles single frames as simply and generally as possible. |
| 318 | * Thus, this ol_tx_single_completion_handler function is suitable for |
| 319 | * intermittent usage, such as for tx mgmt frames. |
| 320 | * |
| 321 | * @param pdev - the data physical device that sent the tx frames |
| 322 | * @param status - whether transmission was successful |
| 323 | * @param tx_msdu_id - ID of the frame which completed transmission |
| 324 | */ |
| 325 | void |
| 326 | ol_tx_single_completion_handler(ol_txrx_pdev_handle pdev, |
| 327 | enum htt_tx_status status, uint16_t tx_desc_id); |
| 328 | |
| 329 | /** |
| 330 | * @brief Update the amount of target credit. |
| 331 | * @details |
| 332 | * When the target finishes with an old transmit frame, it can use the |
| 333 | * space that was occupied by the old tx frame to store a new tx frame. |
| 334 | * This function is used to inform the txrx layer, where the HL tx download |
| 335 | * scheduler resides, about such updates to the target's tx credit. |
| 336 | * This credit update is done explicitly, rather than having the txrx layer |
| 337 | * update the credit count itself inside the ol_tx_completion handler |
| 338 | * function. This provides HTT with the flexibility to limit the rate of |
| 339 | * downloads from the TXRX layer's download scheduler, by controlling how |
| 340 | * much credit the download scheduler gets, and also provides the flexibility |
| 341 | * to account for a change in the tx memory pool size within the target. |
| 342 | * This function is only used for HL systems; in LL systems, each tx frame |
| 343 | * is assumed to use exactly one credit (for its target-side tx descriptor), |
| 344 | * and any rate limiting is managed within the target. |
| 345 | * |
| 346 | * @param pdev - the data physical device that sent the tx frames |
| 347 | * @param credit_delta - how much to increment the target's tx credit by |
| 348 | */ |
| 349 | void ol_tx_target_credit_update(struct ol_txrx_pdev_t *pdev, int credit_delta); |
| 350 | |
| 351 | /** |
| 352 | * @brief Process an rx indication message sent by the target. |
| 353 | * @details |
| 354 | * The target sends a rx indication message to the host as a |
| 355 | * notification that there are new rx frames available for the |
| 356 | * host to process. |
| 357 | * The HTT host layer locates the rx descriptors and rx frames |
| 358 | * associated with the indication, and calls this function to |
| 359 | * invoke the rx data processing on the new frames. |
| 360 | * (For LL, the rx descriptors and frames are delivered directly |
| 361 | * to the host via MAC DMA, while for HL the rx descriptor and |
| 362 | * frame for individual frames are combined with the rx indication |
| 363 | * message.) |
| 364 | * All MPDUs referenced by a rx indication message belong to the |
| 365 | * same peer-TID. |
| 366 | * |
| 367 | * @param pdev - the data physical device that received the frames |
| 368 | * (registered with HTT as a context pointer during attach time) |
| 369 | * @param rx_ind_msg - the network buffer holding the rx indication message |
| 370 | * (For HL, this netbuf also holds the rx desc and rx payload, but |
| 371 | * the data SW is agnostic to whether the desc and payload are |
| 372 | * piggybacked with the rx indication message.) |
| 373 | * @param peer_id - which peer sent this rx data |
| 374 | * @param tid - what (extended) traffic type the rx data is |
| 375 | * @param num_mpdu_ranges - how many ranges of MPDUs does the message describe. |
| 376 | * Each MPDU within the range has the same rx status. |
| 377 | */ |
| 378 | void |
| 379 | ol_rx_indication_handler(ol_txrx_pdev_handle pdev, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 380 | qdf_nbuf_t rx_ind_msg, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 381 | uint16_t peer_id, uint8_t tid, int num_mpdu_ranges); |
| 382 | |
| 383 | /** |
| 384 | * @brief Process an rx fragment indication message sent by the target. |
| 385 | * @details |
| 386 | * The target sends a rx fragment indication message to the host as a |
| 387 | * notification that there are new rx fragment available for the |
| 388 | * host to process. |
| 389 | * The HTT host layer locates the rx descriptors and rx fragment |
| 390 | * associated with the indication, and calls this function to |
| 391 | * invoke the rx fragment data processing on the new fragment. |
| 392 | * |
| 393 | * @param pdev - the data physical device that received the frames |
Yun Park | 50e8ab4 | 2017-04-05 07:40:54 -0700 | [diff] [blame] | 394 | * (registered with HTT as a context pointer during attach time) |
| 395 | * @param rx_frag_ind_msg - the network buffer holding the rx fragment |
| 396 | * indication message |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 397 | * @param peer_id - which peer sent this rx data |
| 398 | * @param tid - what (extended) traffic type the rx data is |
| 399 | */ |
| 400 | void ol_rx_frag_indication_handler(ol_txrx_pdev_handle pdev, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 401 | qdf_nbuf_t rx_frag_ind_msg, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 402 | uint16_t peer_id, uint8_t tid); |
| 403 | |
| 404 | /** |
| 405 | * @brief Process rx offload deliver indication message sent by the target. |
| 406 | * @details |
| 407 | * When the target exits offload mode, target delivers packets that it has |
| 408 | * held in its memory to the host using this message. |
| 409 | * Low latency case: |
| 410 | * The message contains the number of MSDUs that are being delivered by the |
| 411 | * target to the host. The packet itself resides in host ring along with some |
| 412 | * metadata describing the peer id, vdev id, tid, FW desc and length of |
| 413 | * the packet being delivered. |
| 414 | * Hight letency case: |
| 415 | * The message itself contains the payload of the MSDU being delivered by |
| 416 | * the target to the host. The message also contains meta data describing |
| 417 | * the packet such as peer id, vdev id, tid, FW desc and length of the packet |
| 418 | * being delivered. Refer to htt.h for the exact structure of the message. |
| 419 | * @param pdev - the data physical device that received the frame. |
| 420 | * @param msg - offload deliver indication message |
| 421 | * @param msdu_cnt - number of MSDUs being delivred. |
| 422 | */ |
| 423 | void |
| 424 | ol_rx_offload_deliver_ind_handler(ol_txrx_pdev_handle pdev, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 425 | qdf_nbuf_t msg, int msdu_cnt); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 426 | |
| 427 | /** |
| 428 | * @brief Process a peer map message sent by the target. |
| 429 | * @details |
| 430 | * Each time the target allocates a new peer ID, it will inform the |
| 431 | * host via the "peer map" message. This function processes that |
| 432 | * message. The host data SW looks for a peer object whose MAC address |
| 433 | * matches the MAC address specified in the peer map message, and then |
| 434 | * sets up a mapping between the peer ID specified in the message and |
| 435 | * the peer object that was found. |
| 436 | * |
| 437 | * @param pdev - data physical device handle |
| 438 | * (registered with HTT as a context pointer during attach time) |
| 439 | * @param peer_id - ID generated by the target to refer to the peer in question |
| 440 | * The target may create multiple IDs for a single peer. |
| 441 | * @param vdev_id - Reference to the virtual device the peer is associated with |
| 442 | * @param peer_mac_addr - MAC address of the peer in question |
| 443 | * @param tx_ready - whether transmits to this peer can be done already, or |
| 444 | * need to wait for a call to peer_tx_ready (only applies to HL systems) |
| 445 | */ |
| 446 | void |
| 447 | ol_rx_peer_map_handler(ol_txrx_pdev_handle pdev, |
| 448 | uint16_t peer_id, |
| 449 | uint8_t vdev_id, uint8_t *peer_mac_addr, int tx_ready); |
| 450 | |
| 451 | /** |
| 452 | * @brief notify the host that the target is ready to transmit to a new peer. |
| 453 | * @details |
| 454 | * Some targets can immediately accept tx frames for a new peer, as soon as |
| 455 | * the peer's association completes. Other target need a short setup time |
| 456 | * before they are ready to accept tx frames for the new peer. |
| 457 | * If the target needs time for setup, it will provide a peer_tx_ready |
| 458 | * message when it is done with the setup. This function forwards this |
| 459 | * notification from the target to the host's tx queue manager. |
| 460 | * This function only applies for HL systems, in which the host determines |
| 461 | * which peer a given tx frame is for, and stores the tx frames in queues. |
| 462 | * |
| 463 | * @param pdev - data physical device handle |
| 464 | * (registered with HTT as a context pointer during attach time) |
| 465 | * @param peer_id - ID for the new peer which can now accept tx frames |
| 466 | */ |
| 467 | void ol_txrx_peer_tx_ready_handler(ol_txrx_pdev_handle pdev, uint16_t peer_id); |
| 468 | |
| 469 | /** |
| 470 | * @brief Process a peer unmap message sent by the target. |
| 471 | * @details |
| 472 | * Each time the target frees a peer ID, it will inform the host via the |
| 473 | * "peer unmap" message. This function processes that message. |
| 474 | * The host data SW uses the peer ID from the message to find the peer |
| 475 | * object from peer_map[peer_id], then invalidates peer_map[peer_id] |
| 476 | * (by setting it to NULL), and checks whether there are any remaining |
| 477 | * references to the peer object. If not, the function deletes the |
| 478 | * peer object. |
| 479 | * |
| 480 | * @param pdev - data physical device handle |
| 481 | * (registered with HTT as a context pointer during attach time) |
| 482 | * @param peer_id - ID that is being freed. |
| 483 | * The target may create multiple IDs for a single peer. |
| 484 | */ |
| 485 | void ol_rx_peer_unmap_handler(ol_txrx_pdev_handle pdev, uint16_t peer_id); |
| 486 | |
| 487 | /** |
| 488 | * @brief Process a security indication message sent by the target. |
| 489 | * @details |
| 490 | * When a key is assigned to a peer, the target will inform the host |
| 491 | * with a security indication message. |
| 492 | * The host remembers the security type, and infers whether a rx PN |
| 493 | * check is needed. |
| 494 | * |
| 495 | * @param pdev - data physical device handle |
| 496 | * @param peer_id - which peer the security info is for |
| 497 | * @param sec_type - which type of security / key the peer is using |
| 498 | * @param is_unicast - whether security spec is for a unicast or multicast key |
| 499 | * @param michael_key - key used for TKIP MIC (if sec_type == TKIP) |
| 500 | * @param rx_pn - RSC used for WAPI PN replay check (if sec_type == WAPI) |
| 501 | */ |
| 502 | void |
| 503 | ol_rx_sec_ind_handler(ol_txrx_pdev_handle pdev, |
| 504 | uint16_t peer_id, |
| 505 | enum htt_sec_type sec_type, |
| 506 | int is_unicast, uint32_t *michael_key, uint32_t *rx_pn); |
| 507 | |
| 508 | /** |
| 509 | * @brief Process an ADDBA message sent by the target. |
| 510 | * @details |
| 511 | * When the target notifies the host of an ADDBA event for a specified |
| 512 | * peer-TID, the host will set up the rx reordering state for the peer-TID. |
| 513 | * Specifically, the host will create a rx reordering array whose length |
| 514 | * is based on the window size specified in the ADDBA. |
| 515 | * |
| 516 | * @param pdev - data physical device handle |
| 517 | * (registered with HTT as a context pointer during attach time) |
| 518 | * @param peer_id - which peer the ADDBA event is for |
| 519 | * @param tid - which traffic ID within the peer the ADDBA event is for |
| 520 | * @param win_sz - how many sequence numbers are in the ARQ block ack window |
| 521 | * set up by the ADDBA event |
| 522 | * @param start_seq_num - the initial value of the sequence number during the |
| 523 | * block ack agreement, as specified by the ADDBA request. |
| 524 | * @param failed - indicate whether the target's ADDBA setup succeeded: |
| 525 | * 0 -> success, 1 -> fail |
| 526 | */ |
| 527 | void |
| 528 | ol_rx_addba_handler(ol_txrx_pdev_handle pdev, |
| 529 | uint16_t peer_id, |
| 530 | uint8_t tid, |
| 531 | uint8_t win_sz, uint16_t start_seq_num, uint8_t failed); |
| 532 | |
| 533 | /** |
| 534 | * @brief Process a DELBA message sent by the target. |
| 535 | * @details |
| 536 | * When the target notifies the host of a DELBA event for a specified |
| 537 | * peer-TID, the host will clean up the rx reordering state for the peer-TID. |
| 538 | * Specifically, the host will remove the rx reordering array, and will |
| 539 | * set the reorder window size to be 1 (stop and go ARQ). |
| 540 | * |
| 541 | * @param pdev - data physical device handle |
| 542 | * (registered with HTT as a context pointer during attach time) |
| 543 | * @param peer_id - which peer the ADDBA event is for |
| 544 | * @param tid - which traffic ID within the peer the ADDBA event is for |
| 545 | */ |
| 546 | void |
| 547 | ol_rx_delba_handler(ol_txrx_pdev_handle pdev, uint16_t peer_id, uint8_t tid); |
| 548 | |
| 549 | enum htt_rx_flush_action { |
| 550 | htt_rx_flush_release, |
| 551 | htt_rx_flush_discard, |
| 552 | }; |
| 553 | |
| 554 | /** |
| 555 | * @brief Process a rx reorder flush message sent by the target. |
| 556 | * @details |
| 557 | * The target's rx reorder logic can send a flush indication to the |
| 558 | * host's rx reorder buffering either as a flush IE within a rx |
| 559 | * indication message, or as a standalone rx reorder flush message. |
| 560 | * This ol_rx_flush_handler function processes the standalone rx |
| 561 | * reorder flush message from the target. |
| 562 | * The flush message specifies a range of sequence numbers whose |
| 563 | * rx frames are flushed. |
| 564 | * Some sequence numbers within the specified range may not have |
| 565 | * rx frames; the host needs to check for each sequence number in |
| 566 | * the specified range whether there are rx frames held for that |
| 567 | * sequence number. |
| 568 | * |
| 569 | * @param pdev - data physical device handle |
| 570 | * (registered with HTT as a context pointer during attach time) |
| 571 | * @param peer_id - which peer's rx data is being flushed |
| 572 | * @param tid - which traffic ID within the peer has the rx data being flushed |
| 573 | * @param seq_num_start - Which sequence number within the rx reordering |
| 574 | * buffer the flushing should start with. |
| 575 | * This is the LSBs of the 802.11 sequence number. |
| 576 | * This sequence number is masked with the rounded-to-power-of-two |
| 577 | * window size to generate a reorder buffer index. |
| 578 | * The flush includes this initial sequence number. |
| 579 | * @param seq_num_end - Which sequence number within the rx reordering |
| 580 | * buffer the flushing should stop at. |
| 581 | * This is the LSBs of the 802.11 sequence number. |
| 582 | * This sequence number is masked with the rounded-to-power-of-two |
| 583 | * window size to generate a reorder buffer index. |
| 584 | * The flush excludes this final sequence number. |
| 585 | * @param action - whether to release or discard the rx frames |
| 586 | */ |
| 587 | void |
| 588 | ol_rx_flush_handler(ol_txrx_pdev_handle pdev, |
| 589 | uint16_t peer_id, |
| 590 | uint8_t tid, |
| 591 | uint16_t seq_num_start, |
| 592 | uint16_t seq_num_end, enum htt_rx_flush_action action); |
| 593 | |
| 594 | /** |
| 595 | * @brief Process a rx pn indication message |
| 596 | * @details |
| 597 | * When the peer is configured to get PN checking done in target, |
| 598 | * the target instead of sending reorder flush/release messages |
| 599 | * sends PN indication messages which contain the start and end |
| 600 | * sequence numbers to be flushed/released along with the sequence |
| 601 | * numbers of MPDUs that failed the PN check in target. |
| 602 | * |
| 603 | * @param pdev - data physical device handle |
| 604 | * (registered with HTT as a context pointer during attach time) |
| 605 | * @param peer_id - which peer's rx data is being flushed |
| 606 | * @param tid - which traffic ID within the peer |
| 607 | * @param seq_num_start - Which sequence number within the rx reordering |
| 608 | * buffer to start with. |
| 609 | * This is the LSBs of the 802.11 sequence number. |
| 610 | * This sequence number is masked with the rounded-to-power-of-two |
| 611 | * window size to generate a reorder buffer index. |
| 612 | * This is the initial sequence number. |
| 613 | * @param seq_num_end - Which sequence number within the rx reordering |
| 614 | * buffer to stop at. |
| 615 | * This is the LSBs of the 802.11 sequence number. |
| 616 | * This sequence number is masked with the rounded-to-power-of-two |
| 617 | * window size to generate a reorder buffer index. |
| 618 | * The processing stops right before this sequence number |
| 619 | * @param pn_ie_cnt - Indicates the number of PN information elements. |
| 620 | * @param pn_ie - Pointer to the array of PN information elements. Each |
| 621 | * PN information element contains the LSBs of the 802.11 sequence number |
| 622 | * of the MPDU that failed the PN checking in target. |
| 623 | */ |
| 624 | void |
| 625 | ol_rx_pn_ind_handler(ol_txrx_pdev_handle pdev, |
| 626 | uint16_t peer_id, |
| 627 | uint8_t tid, |
| 628 | int seq_num_start, |
| 629 | int seq_num_end, uint8_t pn_ie_cnt, uint8_t *pn_ie); |
| 630 | |
| 631 | /** |
| 632 | * @brief Process a stats message sent by the target. |
| 633 | * @details |
| 634 | * The host can request target for stats. |
| 635 | * The target sends the stats to the host via a confirmation message. |
| 636 | * This ol_txrx_fw_stats_handler function processes the confirmation message. |
| 637 | * Currently, this processing consists of copying the stats from the message |
| 638 | * buffer into the txrx pdev object, and waking the sleeping host context |
| 639 | * that requested the stats. |
| 640 | * |
| 641 | * @param pdev - data physical device handle |
| 642 | * (registered with HTT as a context pointer during attach time) |
| 643 | * @param cookie - Value echoed from the cookie in the stats request |
| 644 | * message. This allows the host SW to find the stats request object. |
| 645 | * (Currently, this cookie is unused.) |
| 646 | * @param stats_info_list - stats confirmation message contents, containing |
| 647 | * a list of the stats requested from the target |
| 648 | */ |
| 649 | void |
| 650 | ol_txrx_fw_stats_handler(ol_txrx_pdev_handle pdev, |
| 651 | uint64_t cookie, uint8_t *stats_info_list); |
| 652 | |
| 653 | /** |
| 654 | * @brief Process a tx inspect message sent by the target. |
| 655 | * @details: |
| 656 | * TODO: update |
| 657 | * This tx inspect message indicates via the descriptor ID |
| 658 | * which tx frames are to be inspected by host. The host |
| 659 | * re-injects the packet back to the host for a number of |
| 660 | * cases. |
| 661 | * |
| 662 | * @param pdev - the data physical device that sent the tx frames |
| 663 | * (registered with HTT as a context pointer during attach time) |
| 664 | * @param num_msdus - how many MSDUs are referenced by the tx completion |
| 665 | * message |
| 666 | * @param tx_msdu_id_iterator - abstract method of finding the IDs for the |
| 667 | * individual MSDUs referenced by the tx completion message, via the |
| 668 | * htt_tx_compl_desc_id API function |
| 669 | */ |
| 670 | void |
| 671 | ol_tx_inspect_handler(ol_txrx_pdev_handle pdev, |
| 672 | int num_msdus, void *tx_desc_id_iterator); |
| 673 | |
| 674 | /** |
| 675 | * @brief Get the UAPSD mask. |
| 676 | * @details |
| 677 | * This function will return the UAPSD TID mask. |
| 678 | * |
| 679 | * @param txrx_pdev - pointer to the txrx pdev object |
| 680 | * @param peer_id - PeerID. |
| 681 | * @return uapsd mask value |
| 682 | */ |
| 683 | uint8_t |
| 684 | ol_txrx_peer_uapsdmask_get(struct ol_txrx_pdev_t *txrx_pdev, uint16_t peer_id); |
| 685 | |
| 686 | /** |
| 687 | * @brief Get the Qos Capable. |
| 688 | * @details |
| 689 | * This function will return the txrx_peer qos_capable. |
| 690 | * |
| 691 | * @param txrx_pdev - pointer to the txrx pdev object |
| 692 | * @param peer_id - PeerID. |
| 693 | * @return qos_capable value |
| 694 | */ |
| 695 | uint8_t |
| 696 | ol_txrx_peer_qoscapable_get(struct ol_txrx_pdev_t *txrx_pdev, uint16_t peer_id); |
| 697 | |
| 698 | /** |
| 699 | * @brief Process an rx indication message sent by the target. |
| 700 | * @details |
| 701 | * The target sends a rx indication message to the host as a |
| 702 | * notification that there are new rx frames available for the |
| 703 | * host to process. |
| 704 | * The HTT host layer locates the rx descriptors and rx frames |
| 705 | * associated with the indication, and calls this function to |
| 706 | * invoke the rx data processing on the new frames. |
| 707 | * All MPDUs referenced by a rx indication message belong to the |
| 708 | * same peer-TID. The frames indicated have been re-ordered by |
| 709 | * the target. |
| 710 | * |
| 711 | * @param pdev - the data physical device that received the frames |
| 712 | * (registered with HTT as a context pointer during attach time) |
| 713 | * @param rx_ind_msg - the network buffer holding the rx indication message |
| 714 | * @param peer_id - which peer sent this rx data |
| 715 | * @param tid - what (extended) traffic type the rx data is |
| 716 | * @param is_offload - is this an offload indication? |
| 717 | */ |
| 718 | void |
| 719 | ol_rx_in_order_indication_handler(ol_txrx_pdev_handle pdev, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 720 | qdf_nbuf_t rx_ind_msg, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 721 | uint16_t peer_id, |
| 722 | uint8_t tid, uint8_t is_offload); |
| 723 | |
Siddarth Poddar | 1df1cd8 | 2016-04-27 17:32:21 +0530 | [diff] [blame] | 724 | #ifdef FEATURE_HL_GROUP_CREDIT_FLOW_CONTROL |
| 725 | |
| 726 | /** |
| 727 | * ol_tx_get_max_tx_groups_supported() - get max TCQ groups supported |
| 728 | * @pdev: the data physical device that received the frames |
| 729 | * |
| 730 | * Return: number of max groups supported |
| 731 | */ |
| 732 | u_int32_t ol_tx_get_max_tx_groups_supported(struct ol_txrx_pdev_t *pdev); |
| 733 | #else |
| 734 | |
| 735 | static inline u_int32_t |
| 736 | ol_tx_get_max_tx_groups_supported(struct ol_txrx_pdev_t *pdev) |
| 737 | { |
| 738 | return 0; |
| 739 | } |
| 740 | #endif |
| 741 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 742 | #endif /* _OL_TXRX_HTT_API__H_ */ |