blob: 2068c095cf31125df9f2f93a2df8b97299b03ead [file] [log] [blame]
Siddarth Poddarb2011f62016-04-27 20:45:42 +05301/*
Nirav Shaheb017be2018-02-15 11:20:58 +05302 * Copyright (c) 2012-2013, 2016-2018 The Linux Foundation. All rights reserved.
Siddarth Poddarb2011f62016-04-27 20:45:42 +05303 *
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
37enum 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
45struct 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
58void
59ol_tx_sched_notify(
60 struct ol_txrx_pdev_t *pdev,
61 struct ol_tx_sched_notify_ctx_t *ctx);
62
63void
64ol_tx_sched(struct ol_txrx_pdev_t *pdev);
65
66u_int16_t
67ol_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
73void *
74ol_tx_sched_attach(struct ol_txrx_pdev_t *pdev);
75
76void
77ol_tx_sched_detach(struct ol_txrx_pdev_t *pdev);
78
79void ol_tx_sched_stats_display(struct ol_txrx_pdev_t *pdev);
80
81void ol_tx_sched_cur_state_display(struct ol_txrx_pdev_t *pdev);
82
83void ol_tx_sched_stats_clear(struct ol_txrx_pdev_t *pdev);
84
Nirav Shaheb017be2018-02-15 11:20:58 +053085void
86ol_txrx_set_wmm_param(struct cdp_pdev *data_pdev,
87 struct ol_tx_wmm_param_t wmm_param);
88
Siddarth Poddarb2011f62016-04-27 20:45:42 +053089#else
90
91static inline void
92ol_tx_sched_notify(
93 struct ol_txrx_pdev_t *pdev,
94 struct ol_tx_sched_notify_ctx_t *ctx)
95{
Siddarth Poddarb2011f62016-04-27 20:45:42 +053096}
97
98static inline void
99ol_tx_sched(struct ol_txrx_pdev_t *pdev)
100{
Siddarth Poddarb2011f62016-04-27 20:45:42 +0530101}
102
103static inline u_int16_t
104ol_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
113static inline void *
114ol_tx_sched_attach(struct ol_txrx_pdev_t *pdev)
115{
116 return NULL;
117}
118
119static inline void
120ol_tx_sched_detach(struct ol_txrx_pdev_t *pdev)
121{
Siddarth Poddarb2011f62016-04-27 20:45:42 +0530122}
123
124static inline void ol_tx_sched_stats_display(struct ol_txrx_pdev_t *pdev)
125{
Siddarth Poddarb2011f62016-04-27 20:45:42 +0530126}
127
128static inline void ol_tx_sched_cur_state_display(struct ol_txrx_pdev_t *pdev)
129{
Siddarth Poddarb2011f62016-04-27 20:45:42 +0530130}
131
132static inline void ol_tx_sched_stats_clear(struct ol_txrx_pdev_t *pdev)
133{
Siddarth Poddarb2011f62016-04-27 20:45:42 +0530134}
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
149static inline void
150ol_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
158static 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
164static 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 */
176static inline void
177ol_tx_target_credit_adjust(int factor,
178 struct ol_txrx_pdev_t *pdev,
179 qdf_nbuf_t msdu)
180{
Siddarth Poddarb2011f62016-04-27 20:45:42 +0530181}
182
183static inline void ol_tx_target_credit_decr(struct ol_txrx_pdev_t *pdev,
184 qdf_nbuf_t msdu)
185{
Siddarth Poddarb2011f62016-04-27 20:45:42 +0530186}
187
188static inline void ol_tx_target_credit_incr(struct ol_txrx_pdev_t *pdev,
189 qdf_nbuf_t msdu)
190{
Siddarth Poddarb2011f62016-04-27 20:45:42 +0530191}
192#endif
193#endif /* _OL_TX_SCHED__H_ */