xref: /wlan-driver/qcacld-3.0/core/dp/txrx/ol_tx_sched.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2012-2013, 2016-2019 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  *
4*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
5*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
6*5113495bSYour Name  * above copyright notice and this permission notice appear in all
7*5113495bSYour Name  * copies.
8*5113495bSYour Name  *
9*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
17*5113495bSYour Name  */
18*5113495bSYour Name 
19*5113495bSYour Name /**
20*5113495bSYour Name  * @file ol_tx_sched.h
21*5113495bSYour Name  * @brief API definitions for the tx scheduler module within the data SW.
22*5113495bSYour Name  */
23*5113495bSYour Name #ifndef _OL_TX_SCHED__H_
24*5113495bSYour Name #define _OL_TX_SCHED__H_
25*5113495bSYour Name 
26*5113495bSYour Name #include <qdf_types.h>
27*5113495bSYour Name 
28*5113495bSYour Name enum ol_tx_queue_action {
29*5113495bSYour Name 	OL_TX_ENQUEUE_FRAME,
30*5113495bSYour Name 	OL_TX_DELETE_QUEUE,
31*5113495bSYour Name 	OL_TX_PAUSE_QUEUE,
32*5113495bSYour Name 	OL_TX_UNPAUSE_QUEUE,
33*5113495bSYour Name 	OL_TX_DISCARD_FRAMES,
34*5113495bSYour Name };
35*5113495bSYour Name 
36*5113495bSYour Name struct ol_tx_sched_notify_ctx_t {
37*5113495bSYour Name 	int event;
38*5113495bSYour Name 	struct ol_tx_frms_queue_t *txq;
39*5113495bSYour Name 	union {
40*5113495bSYour Name 		int ext_tid;
41*5113495bSYour Name 		struct ol_txrx_msdu_info_t *tx_msdu_info;
42*5113495bSYour Name 	} info;
43*5113495bSYour Name 	int frames;
44*5113495bSYour Name 	int bytes;
45*5113495bSYour Name };
46*5113495bSYour Name 
47*5113495bSYour Name #if defined(CONFIG_HL_SUPPORT)
48*5113495bSYour Name 
49*5113495bSYour Name void
50*5113495bSYour Name ol_tx_sched_notify(
51*5113495bSYour Name 		struct ol_txrx_pdev_t *pdev,
52*5113495bSYour Name 		struct ol_tx_sched_notify_ctx_t *ctx);
53*5113495bSYour Name 
54*5113495bSYour Name void
55*5113495bSYour Name ol_tx_sched(struct ol_txrx_pdev_t *pdev);
56*5113495bSYour Name 
57*5113495bSYour Name u_int16_t
58*5113495bSYour Name ol_tx_sched_discard_select(
59*5113495bSYour Name 		struct ol_txrx_pdev_t *pdev,
60*5113495bSYour Name 		u_int16_t frms,
61*5113495bSYour Name 		ol_tx_desc_list *tx_descs,
62*5113495bSYour Name 		bool force);
63*5113495bSYour Name 
64*5113495bSYour Name void *
65*5113495bSYour Name ol_tx_sched_attach(struct ol_txrx_pdev_t *pdev);
66*5113495bSYour Name 
67*5113495bSYour Name void
68*5113495bSYour Name ol_tx_sched_detach(struct ol_txrx_pdev_t *pdev);
69*5113495bSYour Name 
70*5113495bSYour Name void ol_tx_sched_stats_display(struct ol_txrx_pdev_t *pdev);
71*5113495bSYour Name 
72*5113495bSYour Name void ol_tx_sched_cur_state_display(struct ol_txrx_pdev_t *pdev);
73*5113495bSYour Name 
74*5113495bSYour Name void ol_tx_sched_stats_clear(struct ol_txrx_pdev_t *pdev);
75*5113495bSYour Name 
76*5113495bSYour Name void
77*5113495bSYour Name ol_txrx_set_wmm_param(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
78*5113495bSYour Name 		      struct ol_tx_wmm_param_t wmm_param);
79*5113495bSYour Name 
80*5113495bSYour Name #else
81*5113495bSYour Name 
82*5113495bSYour Name static inline void
ol_tx_sched_notify(struct ol_txrx_pdev_t * pdev,struct ol_tx_sched_notify_ctx_t * ctx)83*5113495bSYour Name ol_tx_sched_notify(
84*5113495bSYour Name 		struct ol_txrx_pdev_t *pdev,
85*5113495bSYour Name 		struct ol_tx_sched_notify_ctx_t *ctx)
86*5113495bSYour Name {
87*5113495bSYour Name }
88*5113495bSYour Name 
89*5113495bSYour Name static inline void
ol_tx_sched(struct ol_txrx_pdev_t * pdev)90*5113495bSYour Name ol_tx_sched(struct ol_txrx_pdev_t *pdev)
91*5113495bSYour Name {
92*5113495bSYour Name }
93*5113495bSYour Name 
94*5113495bSYour Name static inline u_int16_t
ol_tx_sched_discard_select(struct ol_txrx_pdev_t * pdev,u_int16_t frms,ol_tx_desc_list * tx_descs,bool force)95*5113495bSYour Name ol_tx_sched_discard_select(
96*5113495bSYour Name 		struct ol_txrx_pdev_t *pdev,
97*5113495bSYour Name 		u_int16_t frms,
98*5113495bSYour Name 		ol_tx_desc_list *tx_descs,
99*5113495bSYour Name 		bool force)
100*5113495bSYour Name {
101*5113495bSYour Name 	return 0;
102*5113495bSYour Name }
103*5113495bSYour Name 
104*5113495bSYour Name static inline void *
ol_tx_sched_attach(struct ol_txrx_pdev_t * pdev)105*5113495bSYour Name ol_tx_sched_attach(struct ol_txrx_pdev_t *pdev)
106*5113495bSYour Name {
107*5113495bSYour Name 	return NULL;
108*5113495bSYour Name }
109*5113495bSYour Name 
110*5113495bSYour Name static inline void
ol_tx_sched_detach(struct ol_txrx_pdev_t * pdev)111*5113495bSYour Name ol_tx_sched_detach(struct ol_txrx_pdev_t *pdev)
112*5113495bSYour Name {
113*5113495bSYour Name }
114*5113495bSYour Name 
ol_tx_sched_stats_display(struct ol_txrx_pdev_t * pdev)115*5113495bSYour Name static inline void ol_tx_sched_stats_display(struct ol_txrx_pdev_t *pdev)
116*5113495bSYour Name {
117*5113495bSYour Name }
118*5113495bSYour Name 
ol_tx_sched_cur_state_display(struct ol_txrx_pdev_t * pdev)119*5113495bSYour Name static inline void ol_tx_sched_cur_state_display(struct ol_txrx_pdev_t *pdev)
120*5113495bSYour Name {
121*5113495bSYour Name }
122*5113495bSYour Name 
ol_tx_sched_stats_clear(struct ol_txrx_pdev_t * pdev)123*5113495bSYour Name static inline void ol_tx_sched_stats_clear(struct ol_txrx_pdev_t *pdev)
124*5113495bSYour Name {
125*5113495bSYour Name }
126*5113495bSYour Name 
127*5113495bSYour Name #endif /* defined(CONFIG_HL_SUPPORT) */
128*5113495bSYour Name 
129*5113495bSYour Name #if defined(CONFIG_HL_SUPPORT) || defined(TX_CREDIT_RECLAIM_SUPPORT)
130*5113495bSYour Name /*
131*5113495bSYour Name  * HL needs to keep track of the amount of credit available to download
132*5113495bSYour Name  * tx frames to the target - the download scheduler decides when to
133*5113495bSYour Name  * download frames, and which frames to download, based on the credit
134*5113495bSYour Name  * availability.
135*5113495bSYour Name  * LL systems that use TX_CREDIT_RECLAIM_SUPPORT also need to keep track
136*5113495bSYour Name  * of the target_tx_credit, to determine when to poll for tx completion
137*5113495bSYour Name  * messages.
138*5113495bSYour Name  */
139*5113495bSYour Name 
140*5113495bSYour Name static inline void
ol_tx_target_credit_adjust(int factor,struct ol_txrx_pdev_t * pdev,qdf_nbuf_t msdu)141*5113495bSYour Name ol_tx_target_credit_adjust(int factor,
142*5113495bSYour Name 			   struct ol_txrx_pdev_t *pdev,
143*5113495bSYour Name 			   qdf_nbuf_t msdu)
144*5113495bSYour Name {
145*5113495bSYour Name 	qdf_atomic_add(factor * htt_tx_msdu_credit(msdu),
146*5113495bSYour Name 		       &pdev->target_tx_credit);
147*5113495bSYour Name }
148*5113495bSYour Name 
ol_tx_target_credit_decr(struct ol_txrx_pdev_t * pdev,qdf_nbuf_t msdu)149*5113495bSYour Name static inline void ol_tx_target_credit_decr(struct ol_txrx_pdev_t *pdev,
150*5113495bSYour Name 					    qdf_nbuf_t msdu)
151*5113495bSYour Name {
152*5113495bSYour Name 	ol_tx_target_credit_adjust(-1, pdev, msdu);
153*5113495bSYour Name }
154*5113495bSYour Name 
ol_tx_target_credit_incr(struct ol_txrx_pdev_t * pdev,qdf_nbuf_t msdu)155*5113495bSYour Name static inline void ol_tx_target_credit_incr(struct ol_txrx_pdev_t *pdev,
156*5113495bSYour Name 					    qdf_nbuf_t msdu)
157*5113495bSYour Name {
158*5113495bSYour Name 	ol_tx_target_credit_adjust(1, pdev, msdu);
159*5113495bSYour Name }
160*5113495bSYour Name 
161*5113495bSYour Name #ifdef QCA_TX_PADDING_CREDIT_SUPPORT
162*5113495bSYour Name 
163*5113495bSYour Name #define MIN_TX_PAD_CREDIT_THRESH        4
164*5113495bSYour Name #define MAX_TX_PAD_CREDIT_THRESH        5
165*5113495bSYour Name 
166*5113495bSYour Name #endif /* QCA_TX_PADDING_CREDIT_SUPPORT */
167*5113495bSYour Name 
168*5113495bSYour Name #else
169*5113495bSYour Name /*
170*5113495bSYour Name  * LL does not need to keep track of target credit.
171*5113495bSYour Name  * Since the host tx descriptor pool size matches the target's,
172*5113495bSYour Name  * we know the target has space for the new tx frame if the host's
173*5113495bSYour Name  * tx descriptor allocation succeeded.
174*5113495bSYour Name  */
175*5113495bSYour Name static inline void
ol_tx_target_credit_adjust(int factor,struct ol_txrx_pdev_t * pdev,qdf_nbuf_t msdu)176*5113495bSYour Name ol_tx_target_credit_adjust(int factor,
177*5113495bSYour Name 			   struct ol_txrx_pdev_t *pdev,
178*5113495bSYour Name 			   qdf_nbuf_t msdu)
179*5113495bSYour Name {
180*5113495bSYour Name }
181*5113495bSYour Name 
ol_tx_target_credit_decr(struct ol_txrx_pdev_t * pdev,qdf_nbuf_t msdu)182*5113495bSYour Name static inline void ol_tx_target_credit_decr(struct ol_txrx_pdev_t *pdev,
183*5113495bSYour Name 					    qdf_nbuf_t msdu)
184*5113495bSYour Name {
185*5113495bSYour Name }
186*5113495bSYour Name 
ol_tx_target_credit_incr(struct ol_txrx_pdev_t * pdev,qdf_nbuf_t msdu)187*5113495bSYour Name static inline void ol_tx_target_credit_incr(struct ol_txrx_pdev_t *pdev,
188*5113495bSYour Name 					    qdf_nbuf_t msdu)
189*5113495bSYour Name {
190*5113495bSYour Name }
191*5113495bSYour Name 
192*5113495bSYour Name #endif
193*5113495bSYour Name #endif /* _OL_TX_SCHED__H_ */
194