Siddarth Poddar | b2011f6 | 2016-04-27 20:45:42 +0530 | [diff] [blame] | 1 | /* |
Nirav Shah | eb017be | 2018-02-15 11:20:58 +0530 | [diff] [blame^] | 2 | * Copyright (c) 2012-2013, 2016-2018 The Linux Foundation. All rights reserved. |
Siddarth Poddar | b2011f6 | 2016-04-27 20:45:42 +0530 | [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_tx_sched.h |
| 30 | * @brief API definitions for the tx scheduler module within the data SW. |
| 31 | */ |
| 32 | #ifndef _OL_TX_SCHED__H_ |
| 33 | #define _OL_TX_SCHED__H_ |
| 34 | |
| 35 | #include <qdf_types.h> |
| 36 | |
| 37 | enum ol_tx_queue_action { |
| 38 | OL_TX_ENQUEUE_FRAME, |
| 39 | OL_TX_DELETE_QUEUE, |
| 40 | OL_TX_PAUSE_QUEUE, |
| 41 | OL_TX_UNPAUSE_QUEUE, |
| 42 | OL_TX_DISCARD_FRAMES, |
| 43 | }; |
| 44 | |
| 45 | struct ol_tx_sched_notify_ctx_t { |
| 46 | int event; |
| 47 | struct ol_tx_frms_queue_t *txq; |
| 48 | union { |
| 49 | int ext_tid; |
| 50 | struct ol_txrx_msdu_info_t *tx_msdu_info; |
| 51 | } info; |
| 52 | int frames; |
| 53 | int bytes; |
| 54 | }; |
| 55 | |
| 56 | #if defined(CONFIG_HL_SUPPORT) |
| 57 | |
| 58 | void |
| 59 | ol_tx_sched_notify( |
| 60 | struct ol_txrx_pdev_t *pdev, |
| 61 | struct ol_tx_sched_notify_ctx_t *ctx); |
| 62 | |
| 63 | void |
| 64 | ol_tx_sched(struct ol_txrx_pdev_t *pdev); |
| 65 | |
| 66 | u_int16_t |
| 67 | ol_tx_sched_discard_select( |
| 68 | struct ol_txrx_pdev_t *pdev, |
| 69 | u_int16_t frms, |
| 70 | ol_tx_desc_list *tx_descs, |
| 71 | bool force); |
| 72 | |
| 73 | void * |
| 74 | ol_tx_sched_attach(struct ol_txrx_pdev_t *pdev); |
| 75 | |
| 76 | void |
| 77 | ol_tx_sched_detach(struct ol_txrx_pdev_t *pdev); |
| 78 | |
| 79 | void ol_tx_sched_stats_display(struct ol_txrx_pdev_t *pdev); |
| 80 | |
| 81 | void ol_tx_sched_cur_state_display(struct ol_txrx_pdev_t *pdev); |
| 82 | |
| 83 | void ol_tx_sched_stats_clear(struct ol_txrx_pdev_t *pdev); |
| 84 | |
Nirav Shah | eb017be | 2018-02-15 11:20:58 +0530 | [diff] [blame^] | 85 | void |
| 86 | ol_txrx_set_wmm_param(struct cdp_pdev *data_pdev, |
| 87 | struct ol_tx_wmm_param_t wmm_param); |
| 88 | |
Siddarth Poddar | b2011f6 | 2016-04-27 20:45:42 +0530 | [diff] [blame] | 89 | #else |
| 90 | |
| 91 | static inline void |
| 92 | ol_tx_sched_notify( |
| 93 | struct ol_txrx_pdev_t *pdev, |
| 94 | struct ol_tx_sched_notify_ctx_t *ctx) |
| 95 | { |
Siddarth Poddar | b2011f6 | 2016-04-27 20:45:42 +0530 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | static inline void |
| 99 | ol_tx_sched(struct ol_txrx_pdev_t *pdev) |
| 100 | { |
Siddarth Poddar | b2011f6 | 2016-04-27 20:45:42 +0530 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | static inline u_int16_t |
| 104 | ol_tx_sched_discard_select( |
| 105 | struct ol_txrx_pdev_t *pdev, |
| 106 | u_int16_t frms, |
| 107 | ol_tx_desc_list *tx_descs, |
| 108 | bool force) |
| 109 | { |
| 110 | return 0; |
| 111 | } |
| 112 | |
| 113 | static inline void * |
| 114 | ol_tx_sched_attach(struct ol_txrx_pdev_t *pdev) |
| 115 | { |
| 116 | return NULL; |
| 117 | } |
| 118 | |
| 119 | static inline void |
| 120 | ol_tx_sched_detach(struct ol_txrx_pdev_t *pdev) |
| 121 | { |
Siddarth Poddar | b2011f6 | 2016-04-27 20:45:42 +0530 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | static inline void ol_tx_sched_stats_display(struct ol_txrx_pdev_t *pdev) |
| 125 | { |
Siddarth Poddar | b2011f6 | 2016-04-27 20:45:42 +0530 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | static inline void ol_tx_sched_cur_state_display(struct ol_txrx_pdev_t *pdev) |
| 129 | { |
Siddarth Poddar | b2011f6 | 2016-04-27 20:45:42 +0530 | [diff] [blame] | 130 | } |
| 131 | |
| 132 | static inline void ol_tx_sched_stats_clear(struct ol_txrx_pdev_t *pdev) |
| 133 | { |
Siddarth Poddar | b2011f6 | 2016-04-27 20:45:42 +0530 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | #endif /* defined(CONFIG_HL_SUPPORT) */ |
| 137 | |
| 138 | #if defined(CONFIG_HL_SUPPORT) || defined(TX_CREDIT_RECLAIM_SUPPORT) |
| 139 | /* |
| 140 | * HL needs to keep track of the amount of credit available to download |
| 141 | * tx frames to the target - the download scheduler decides when to |
| 142 | * download frames, and which frames to download, based on the credit |
| 143 | * availability. |
| 144 | * LL systems that use TX_CREDIT_RECLAIM_SUPPORT also need to keep track |
| 145 | * of the target_tx_credit, to determine when to poll for tx completion |
| 146 | * messages. |
| 147 | */ |
| 148 | |
| 149 | static inline void |
| 150 | ol_tx_target_credit_adjust(int factor, |
| 151 | struct ol_txrx_pdev_t *pdev, |
| 152 | qdf_nbuf_t msdu) |
| 153 | { |
| 154 | qdf_atomic_add(factor * htt_tx_msdu_credit(msdu), |
| 155 | &pdev->target_tx_credit); |
| 156 | } |
| 157 | |
| 158 | static inline void ol_tx_target_credit_decr(struct ol_txrx_pdev_t *pdev, |
| 159 | qdf_nbuf_t msdu) |
| 160 | { |
| 161 | ol_tx_target_credit_adjust(-1, pdev, msdu); |
| 162 | } |
| 163 | |
| 164 | static inline void ol_tx_target_credit_incr(struct ol_txrx_pdev_t *pdev, |
| 165 | qdf_nbuf_t msdu) |
| 166 | { |
| 167 | ol_tx_target_credit_adjust(1, pdev, msdu); |
| 168 | } |
| 169 | #else |
| 170 | /* |
| 171 | * LL does not need to keep track of target credit. |
| 172 | * Since the host tx descriptor pool size matches the target's, |
| 173 | * we know the target has space for the new tx frame if the host's |
| 174 | * tx descriptor allocation succeeded. |
| 175 | */ |
| 176 | static inline void |
| 177 | ol_tx_target_credit_adjust(int factor, |
| 178 | struct ol_txrx_pdev_t *pdev, |
| 179 | qdf_nbuf_t msdu) |
| 180 | { |
Siddarth Poddar | b2011f6 | 2016-04-27 20:45:42 +0530 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | static inline void ol_tx_target_credit_decr(struct ol_txrx_pdev_t *pdev, |
| 184 | qdf_nbuf_t msdu) |
| 185 | { |
Siddarth Poddar | b2011f6 | 2016-04-27 20:45:42 +0530 | [diff] [blame] | 186 | } |
| 187 | |
| 188 | static inline void ol_tx_target_credit_incr(struct ol_txrx_pdev_t *pdev, |
| 189 | qdf_nbuf_t msdu) |
| 190 | { |
Siddarth Poddar | b2011f6 | 2016-04-27 20:45:42 +0530 | [diff] [blame] | 191 | } |
| 192 | #endif |
| 193 | #endif /* _OL_TX_SCHED__H_ */ |