Initial commit
[o-du/l2.git] / src / 5gnrmac / rg_sch_sc1.x
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17 *******************************************************************************/
18
19 /**********************************************************************
20  
21     Name:   LTE MAC SC1 scheduler
22  
23     Type:   C include file
24  
25     Desc:   Defines required by SC1 scheduler
26  
27     File:   rg_sch_sc1.x
28  
29 **********************************************************************/
30 /** @file rg_sch_sc1.x
31 @brief This file contains data structures for the SC1 scheduler.
32 */
33  
34 #ifndef __RGSCHSC1X__
35 #define __RGSCHSC1X__
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif /* __cplusplus */
40
41
42 typedef Void (*RgSchSc1SvcMngFunc) ARGS((RgSchCellCb *cell, RgSchUeCb *ue, RgSchDlLcCb *svc));
43
44 /**
45   * @brief
46   * Cell specific downlink scheduling information for Scheduler type 1.
47   */
48 typedef struct rgSc1DlCell
49 {
50    CmLListCp          prioLst[RG_SC1_DL_NUM_Q];   /*!< Priority queues */
51    CmLListCp          retxLst[RG_SC1_DL_NUM_Q];   /*!< Retransmission queues */
52    RgSchSc1SvcMngFunc svcMngFunc[RG_SC1_DL_NUM_Q]; /*!< Function for managing
53                                                         services */
54 } RgSchSc1DlCell;
55
56 /**
57   * @brief
58   * Cell specific uplink scheduling information for Scheduler type 1.
59   */
60 typedef struct rgSc1UlCell
61 {
62    CmLListCp     contResLst;/*!< UEs with pending UL alloc for msg4 */
63    CmLListCp     ueTxLst[2];/*!< Queue for UEs Ded Data Trans
64                              *   ueTxLst[0] for signalling and
65                              *   ueTxLst[1] for other data */
66 } RgSchSc1UlCell;
67
68 /**
69   * @brief
70   * Uplink information for scheduler per UE.
71   */
72 typedef struct rgSc1UlUe
73 {
74    CmLList      txLnk;      /* Lnk to one of Transmission Queues */
75    CmLList      contResLnk; /* Lnk to one of Cont Res Queue */
76    Bool         srRcvd;     /* TRUE if SR reported is yet to be satisfied */
77    U8           qId;        /* Id of the Tx Q to which this UE belongs */
78 } RgSchSc1UlUe;
79
80 /**
81   * @brief
82   * Downlink information for scheduler per UE.
83   */
84 typedef struct rgSc1DlUe
85 {
86    CmLList           prioLnk; /*!< To link UE into priority queues */
87    CmLListCp         gbrSvcs; /*!< List of GBR services */
88    U8                prio;    /*!< Current priority of UE for DL */
89    CmLListCp         ambrLst; /*!< To maintain services per priority for a UE */
90    RgSchDlLcCb       *ambrSvc;/*!< Points to the current AMBR service */
91    U32               ambr;    /*!< UE's Remaining AMBR */
92    U32               effAmbr; /*!< min(svc->bo, ambr)*/
93    CmLListCp         schdSvcs; /*!< List of services for which 
94                                  allocation requested */
95    U8                taReqBytes;/*!< Set to the Number of bytes Requested for TA
96                                   allocation */
97    CmLListCp         retxHqProcs; /*!< List of RETX Hq Procs in suspension */
98    CmLListCp         lcsWithData; /*!< List of services with non-zero effBo */
99 } RgSchSc1DlUe;
100
101 /**
102   * @brief
103   * Downlink HARQ information for SC1 scheduler per UE.
104   */
105 typedef struct rgSc1DlHqProc {
106    CmLList        retxLnkUe; /*!< To link retransmitting HARQ processes in ue */
107    U8             cqi;     /*!< CQI at which the allocation was made */
108    U8             prio;    /*!< Priority of the allocation */
109 }RgSchSc1DlHqProc;
110
111 /**
112   * @brief
113   * Downlink service information for SC1 scheduler per UE.
114   */
115 typedef  struct rgSc1DlSvc {
116    U32          gbr;     /*!< Pending GBR to be satisfied     */
117    U32          mbr;     /*!< Pending MBR to be satisfied     */
118    U32          bo;      /*!< BO yet to be satisfied */
119    U32          effGbr;  /*!< GBR/BO, lower of the two        */
120    U32          effMbr;  /*!< MBR/BO, lower of the two        */
121    CmLList      gbrLnk;  /*!< used to maintain svcs to be refreshed */
122    CmLList      prioLnk; /*!< Used to queue up services on UE */
123    CmLList      schdSvcLnk; /*!< Used to queue up services on UE 
124                              * scheduled svcs list */
125    U32          reqBytes; /*!< Set to number of bytes Req for Allocation */
126    U16          hdrEstimate; /*!< RLC Hdr est computed during SVC allocn */
127    CmLList      lcWithDataLnk;/*!< Used to maintain svc in ue's 
128                                *   lcsWithData List */
129 } RgSchSc1DlSvc;
130
131
132 EXTERN Void rgSCHSc1DlLcRmv ARGS((
133 RgSchCellCb                *cell,
134 RgSchUeCb                  *ue,
135 RgSchDlLcCb                *svc
136 ));
137 EXTERN Void rgSCHSc1DlLcBoUpd ARGS((
138 RgSchCellCb                *cell,
139 RgSchUeCb                  *ue,
140 RgSchDlLcCb                *svc
141 ));
142 EXTERN Void rgSCHSc1DlProcAddToCellRetx ARGS((
143 RgSchCellCb                *cell,
144 RgSchDlHqProcCb            *hqP
145 ));
146 EXTERN Void rgSCHSc1DlAllocFnlz ARGS((
147 RgSchCellCb           *cell,
148 RgSchCmnDlRbAllocInfo *allocInfo
149 ));
150 EXTERN Void rgSCHSc1UlAllocFnlz ARGS((
151 RgSchCellCb           *cell,
152 RgSchCmnUlRbAllocInfo *allocInfo
153 ));
154 EXTERN Void rgSCHSc1UlCqiInd ARGS((
155 RgSchCellCb          *cell,
156 RgSchUeCb            *ue,
157 TfuUlCqiRpt          *ulCqiInfo
158 ));
159 EXTERN S16 rgSCHSc1UlLcgUpd ARGS((
160 RgSchCellCb         *cell,
161 RgSchUeCb           *ue,
162 RgInfUeDatInd       *datInd
163 ));
164
165 EXTERN Void rgSCHSc1DlCqiInd ARGS((
166 RgSchCellCb        *cell,
167 RgSchUeCb          *ue,
168 Bool               isPucchInfo,
169 Void               *dlCqi
170 ));
171 EXTERN Void rgSCHSc1UlUeRefresh ARGS((
172 RgSchCellCb    *cell,
173 RgSchUeCb      *ue
174 ));
175 EXTERN Void rgSCHSc1UlUeReset ARGS((
176 RgSchCellCb    *cell,
177 RgSchUeCb      *ue
178 ));
179 EXTERN Void rgSCHSc1DlUeRefresh ARGS((
180 RgSchCellCb    *cell,
181 RgSchUeCb      *ue
182 ));
183 EXTERN Void rgSCHSc1DlHndlInActUes ARGS((
184 RgSchCellCb           *cell,
185 CmLListCp             *inactvLst
186 ));
187 EXTERN Void rgSCHSc1UlHndlInActUes ARGS((
188 RgSchCellCb           *cell,
189 CmLListCp             *inactvLst
190 ));
191 EXTERN Void rgSCHSc1UlActvtUe ARGS((
192 RgSchCellCb    *cell,
193 RgSchUeCb      *ue
194 ));
195 EXTERN Void rgSCHSc1DlActvtUe ARGS((
196 RgSchCellCb    *cell,
197 RgSchUeCb      *ue
198 ));
199 EXTERN Void rgSCHSc1DlInit ARGS((
200 RgDlSchdApis *apis
201 ));
202 EXTERN Void rgSCHSc1UlInit ARGS((
203 RgUlSchdApis *apis
204 ));
205 EXTERN S16 rgSCHSc1RgrUlCellCfg ARGS((
206 RgSchCellCb   *cell,
207 RgrCellCfg    *cellCfg,
208 RgSchErrInfo  *err
209 ));
210 EXTERN S16 rgSCHSc1RgrDlCellCfg ARGS((
211 RgSchCellCb   *cell,
212 RgrCellCfg    *cellCfg,
213 RgSchErrInfo  *err
214 ));
215 EXTERN Void rgSCHSc1UlCellDel ARGS((
216 RgSchCellCb     *cell
217 ));
218 EXTERN Void rgSCHSc1DlCellDel ARGS((
219 RgSchCellCb     *cell
220 ));
221 EXTERN S16 rgSCHSc1RgrUlUeCfg ARGS((
222 RgSchCellCb  *cell,
223 RgSchUeCb    *ue,
224 RgrUeCfg     *ueCfg,
225 RgSchErrInfo *err
226 ));
227 EXTERN S16 rgSCHSc1RgrDlUeCfg ARGS((
228 RgSchCellCb  *cell,
229 RgSchUeCb    *ue,
230 RgrUeCfg     *ueCfg,
231 RgSchErrInfo *err
232 ));
233 EXTERN S16 rgSCHSc1RgrUlUeRecfg ARGS((
234 RgSchCellCb  *cell,
235 RgSchUeCb    *ue,
236 RgrUeRecfg   *ueRecfg,
237 RgSchErrInfo *err
238 ));
239 EXTERN S16 rgSCHSc1RgrDlUeRecfg ARGS((
240 RgSchCellCb  *cell,
241 RgSchUeCb    *ue,
242 RgrUeRecfg   *ueRecfg,
243 RgSchErrInfo *err
244 ));
245 EXTERN Void rgSCHSc1UlUeDel ARGS((
246 RgSchCellCb  *cell,
247 RgSchUeCb    *ue
248 ));
249 EXTERN Void rgSCHSc1DlUeDel ARGS((
250 RgSchCellCb  *cell,
251 RgSchUeCb    *ue
252 ));
253 EXTERN S16 rgSCHSc1RgrLcCfg ARGS((
254 RgSchCellCb  *cell,
255 RgSchUeCb    *ue,
256 RgSchDlLcCb  *dlLc,
257 RgrLchCfg *lcCfg,
258 RgSchErrInfo *err
259 ));
260 EXTERN S16 rgSCHSc1RgrLcgCfg ARGS((
261 RgSchCellCb  *cell,
262 RgSchUeCb    *ue,
263 RgSchLcgCb   *lcg,
264 RgrLcgCfg    *lcgCfg,
265 RgSchErrInfo *err
266 ));
267 EXTERN S16 rgSCHSc1RgrLcRecfg ARGS((
268 RgSchCellCb  *cell,
269 RgSchUeCb    *ue,
270 RgSchDlLcCb  *dlLc,
271 RgrLchRecfg  *lcRecfg,
272 RgSchErrInfo *err
273 ));
274 EXTERN S16 rgSCHSc1RgrLcgRecfg ARGS((
275 RgSchCellCb  *cell,
276 RgSchUeCb    *ue,
277 RgSchLcgCb   *lcg,
278 RgrLcgRecfg  *reCfg,
279 RgSchErrInfo *err
280 ));
281 EXTERN Void rgSCHSc1LcgDel ARGS((
282 RgSchCellCb   *cell,
283 RgSchUeCb     *ue,
284 RgSchLcgCb    *lcg
285 ));
286 EXTERN Void rgSCHSc1UpdBsrShort ARGS((
287 RgSchCellCb  *cell,
288 RgSchUeCb    *ue,
289 RgSchLcgCb   *lcg,
290 U8           bsr
291 ));
292 EXTERN Void rgSCHSc1UpdBsrTrunc ARGS((
293 RgSchCellCb  *cell,
294 RgSchUeCb    *ue,
295 RgSchLcgCb   *lcg,
296 U8           bsr
297 ));
298 EXTERN Void rgSCHSc1UpdBsrLong ARGS((
299 RgSchCellCb  *cell,
300 RgSchUeCb    *ue,
301 U8 bsArr[]
302 ));
303 EXTERN Void rgSCHSc1ContResUlGrant ARGS((
304 RgSchCellCb  *cell,
305 RgSchUeCb    *ue
306 ));
307 EXTERN Void rgSCHSc1SrRcvd ARGS((
308 RgSchCellCb  *cell,
309 RgSchUeCb    *ue
310 ));
311 EXTERN Void rgSCHSc1UlSched ARGS((
312 RgSchCellCb           *cell,
313 RgSchCmnUlRbAllocInfo *allocInfo
314 ));
315 EXTERN Void rgSCHSc1DlSched ARGS((
316 RgSchCellCb           *cell,
317 RgSchCmnDlRbAllocInfo *allocInfo
318 ));
319 EXTERN S16 rgSCHSc1RgrUlCellRecfg ARGS((
320 RgSchCellCb             *cell,
321 RgrCellRecfg            *recfg,
322 RgSchErrInfo            *err
323 ));
324 EXTERN Void rgSCHSc1DlUeReset ARGS((
325 RgSchCellCb    *cell,
326 RgSchUeCb      *ue
327 ));
328
329 EXTERN S16 rgSCHSc1DlUeHqEntInit ARGS((
330 RgSchCellCb      *cell,
331 RgSchDlHqEnt     *hqEnt
332 ));
333
334 EXTERN S16 rgSCHSc1DlUeHqEntDeInit ARGS((
335 RgSchCellCb      *cell,
336 RgSchDlHqEnt     *hqE
337 ));
338
339 EXTERN S16 rgSCHSc1UlLchCfg ARGS((
340 RgSchCellCb      *cell,
341 RgSchUeCb        *ue,
342 RgrLchCfg        *cfg,
343 RgSchErrInfo     *err
344 ));
345
346 EXTERN S16 rgSCHSc1UlLchRecfg ARGS((
347 RgSchCellCb      *cell,
348 RgSchUeCb        *ue,
349 RgrLchRecfg      *recfg,
350 RgSchErrInfo     *err
351 ));
352
353 EXTERN S16 rgSCHSc1UlLchDel ARGS((
354 RgSchCellCb      *cell,
355 RgSchUeCb        *ue,
356 CmLteLcId        lcId,
357 U8               lcgId
358 ));
359 #ifdef __cplusplus
360 }
361 #endif /* __cplusplus */
362 #endif /* __RGSCHSC1X__ */
363
364 \f
365 /**********************************************************************
366          End of file
367 **********************************************************************/