Moving all common header file into common_def.h file
[o-du/l2.git] / src / 5gnrsch / rg_sch_sc1.c
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 layer
22   
23      Type:     C source file
24   
25      Desc:     C source code for scheduler 1
26   
27      File:     rg_sch_sc1.c
28   
29 **********************************************************************/
30
31 /** @file rg_sch_sc1.c
32 @brief The scheduling functionality is implemented in this file.
33 */
34
35 static const char* RLOG_MODULE_NAME="MAC";
36 static int RLOG_MODULE_ID=4096;
37 static int RLOG_FILE_ID=173;
38
39 /* header include files -- defines (.h) */
40 #include "common_def.h"
41 #include "lrg.h"
42 #include "rgr.h"
43 #include "rgm.h"
44 #include "tfu.h"
45 #include "rg_env.h"
46 #include "rg_sch_inf.h"
47 #include "rg_sch_err.h"
48 #include "rg_sch.h"
49 #include "rg_sch_cmn.h"
50 #include "rg_sch_sc1.h"
51 #include "rl_interface.h"
52 #include "rl_common.h"
53
54 /* header/extern include files (.x) */
55 #include "tfu.x"           /* RGU types */
56 #include "lrg.x"           /* layer management typedefs for MAC */
57 #include "rgr.x"           /* layer management typedefs for MAC */
58 #include "rgm.x"           /* layer management typedefs for MAC */
59 #include "rg_sch_inf.x"    /* typedefs for Scheduler */
60 #include "rg_sch.x"        /* typedefs for Scheduler */
61 #include "rg_sch_cmn.x"
62 #include "rg_sch_sc1.x"    /* typedefs for SC1 Scheduler */
63
64
65
66
67 #ifdef __cplusplus
68 extern "C" {
69 #endif /* __cplusplus */
70
71 /* Functions called from outside */
72 PRIVATE S16 rgSCHSc1RgrDlCellRecfg ARGS((
73 RgSchCellCb             *cell,
74 RgrCellRecfg            *recfg,
75 RgSchErrInfo            *err
76 ));
77
78 /*--------------------------*
79  * DL SCHED STATIC declarations START
80  *---------------------------*/
81 PRIVATE Void rgSCHSc1DlSvcAddToSchd ARGS((
82 RgSchCellCb                *cell,
83 RgSchDlLcCb                *svc
84 ));
85 PRIVATE Void rgSCHSc1DlAdd2UeSchdSvcs ARGS((
86 RgSchCellCb                *cell,
87 RgSchUeCb          *ue,
88 RgSchDlLcCb        *svc
89 ));
90 PRIVATE Void rgSCHSc1DlRmvUeFrmPrioQs ARGS((
91 RgSchCellCb  *cell,
92 RgSchUeCb    *ue
93 ));
94 PRIVATE Void rgSCHSc1DlSuspendUe ARGS((
95 RgSchCellCb  *cell,
96 RgSchUeCb    *ue
97 ));
98 PRIVATE Void rgSCHSc1DlInactvtUe ARGS((
99 RgSchCellCb  *cell,
100 RgSchUeCb    *ue
101 ));
102 PRIVATE Void rgSCHSc1DlProcRmvFrmCellRetx ARGS((
103 RgSchCellCb                *cell,
104 RgSchDlHqProcCb            *hqP
105 ));
106 PRIVATE Void rgSCHSc1DlProcRmvFrmUeRetx ARGS((
107 RgSchCellCb                *cell,
108 RgSchUeCb                  *ue,
109 RgSchDlHqProcCb            *hqP
110 ));
111 PRIVATE Void rgSCHSc1DlMngPrio0SvcPosn ARGS((
112 RgSchCellCb                *cell,
113 RgSchUeCb                  *ue,
114 RgSchDlLcCb                *svc
115 ));
116 PRIVATE Void rgSCHSc1DlMngGbrSvcPosn ARGS((
117 RgSchCellCb                *cell,
118 RgSchUeCb                  *ue,
119 RgSchDlLcCb                *svc
120 ));
121 PRIVATE Void rgSCHSc1DlMngAmbrSvcPosn ARGS((
122 RgSchCellCb                *cell,
123 RgSchUeCb                  *ue,
124 RgSchDlLcCb                *svc
125 ));
126 PRIVATE Void rgSCHSc1DlMngSvcPosn ARGS((
127 RgSchCellCb                *cell,
128 RgSchUeCb                  *ue,
129 RgSchDlLcCb                *svc
130 ));
131 PRIVATE Void rgSCHSc1DlUeAddToSchd ARGS((
132 RgSchCellCb                *cell,
133 RgSchUeCb                  *ue
134 ));
135 PRIVATE Void rgSCHSc1DlTaCmd ARGS((
136 RgSchCellCb           *cell,
137 RgSchCmnDlRbAllocInfo *allocInfo
138 ));
139 PRIVATE Void rgSCHSc1DlInitQueues ARGS((
140 RgSchSc1DlCell *cellDl
141 ));
142 PRIVATE Void rgSCHSc1DlDeinitQueues ARGS((
143 RgSchSc1DlCell *cellDl
144 ));
145 PRIVATE Void rgSCHSc1DlAdd2UeLcsWithData ARGS((
146 RgSchCellCb                *cell,
147 RgSchUeCb                  *ue,
148 RgSchDlLcCb                *svc
149 ));
150 PRIVATE Void rgSCHSc1DlRmFrmUeLcsWithData ARGS((
151 RgSchCellCb                *cell,
152 RgSchUeCb                  *ue,
153 RgSchDlLcCb                *svc
154 ));
155 /*--------------------------*
156  * UL SCHED STATIC declarations START
157  *---------------------------*/
158 PRIVATE Void rgSCHSc1UlPosnUeInQ ARGS((
159 RgSchCellCb         *cell,
160 RgSchUeCb           *ue
161 ));
162 PRIVATE Void rgSCHSc1UlSchdUeTxLst ARGS((
163 RgSchCellCb         *cell,
164 CmLListCp             *ueTxLst,
165 RgSchCmnUlRbAllocInfo *allocInfo,
166 U8                    *remUe
167 ));
168 PRIVATE Void rgSCHSc1DlProcRmvFrmRetx ARGS((
169 RgSchCellCb                *cell,
170 RgSchUeCb                  *ue,
171 RgSchDlHqProcCb            *hqP
172 ));
173 PUBLIC Void rgSCHSc1DlScanUpdPdbPrio ARGS((
174 RgSchCellCb *cell
175 ));
176 PUBLIC S16 rgSCHSc1DlFillFlowCntrlInfo ARGS(( 
177 RgSchCellCb    *cell,
178 RgInfSfAlloc   *sfAlloc
179 ));
180
181 PRIVATE Void rgSCHSc1DlPreSchd ARGS ((
182 RgSchCellCb   *cell
183 ));
184 PRIVATE Void rgSCHSc1DlPstSchd ARGS ((
185  Inst       schInst
186 ));
187 #ifdef __cplusplus
188 }
189 #endif /* __cplusplus */
190
191
192
193
194 /***************** SC1 DL SCHEDULER FUNCTION DEFNs START HERE ********/
195 \f
196 /***********************************************************
197  *
198  *     Func : rgSCHSc1DlUeReset 
199  *        
200  *     Desc : Out of Meas Gap. Reposition the UEs Retx Hq Procs,
201  *            and Svc in respective Prio Qs.
202  *            
203  *
204  *     Ret  : Void 
205  *
206  *     Notes:
207  *
208  *     File : 
209  *
210  **********************************************************/
211 #ifdef ANSI
212 PUBLIC Void rgSCHSc1DlUeReset 
213 (
214 RgSchCellCb    *cell,
215 RgSchUeCb      *ue
216 )
217 #else
218 PUBLIC Void rgSCHSc1DlUeReset(cell, ue)
219 RgSchCellCb    *cell;
220 RgSchUeCb      *ue;
221 #endif
222 {
223    TRC2(rgSCHSc1DlUeReset);
224
225    rgSCHSc1DlSuspendUe(cell, ue);
226
227    RETVOID;
228 }
229
230 \f
231 /***********************************************************
232  *
233  *     Func : rgSCHSc1DlActvtUe
234  *        
235  *     Desc : Out of Meas Gap. Reposition the UEs Retx Hq Procs,
236  *            and Svc in respective Prio Qs.
237  *            
238  *
239  *     Ret  : Void 
240  *
241  *     Notes:
242  *
243  *     File : 
244  *
245  **********************************************************/
246 #ifdef ANSI
247 PUBLIC Void rgSCHSc1DlActvtUe 
248 (
249 RgSchCellCb    *cell,
250 RgSchUeCb      *ue
251 )
252 #else
253 PUBLIC Void rgSCHSc1DlActvtUe(cell, ue)
254 RgSchCellCb    *cell;
255 RgSchUeCb      *ue;
256 #endif
257 {
258    RgSchSc1DlUe    *ueDl = RG_GET_SC1_UE_DL(ue, cell);
259    CmLListCp       *lst;
260    CmLList         *node;
261    RgSchDlHqProcCb *hqP;
262    RgSchDlLcCb     *svc;
263    U8              idx;
264    TRC2(rgSCHSc1DlActvtUe);
265
266    /* Add UE's HqProcs From UERetxLst to CellRetxLst */
267    lst = &ueDl->retxHqProcs;
268    node = lst->first;
269    while(node)
270    {
271       hqP = (RgSchDlHqProcCb *)node->node;
272       node = node->next;
273       rgSCHSc1DlProcRmvFrmUeRetx(cell, ue, hqP);
274       rgSCHSc1DlProcAddToCellRetx(cell, hqP);
275    }
276
277    /* Iterate over all the Services if bo != 0 then add */
278    for (idx = 0; idx < RGSCH_MAX_LC_PER_UE; ++idx)
279    {
280       svc = ue->dl.lcCb[idx];
281       if (svc == NULLP)
282       {
283          continue;
284       }
285       rgSCHSc1DlMngSvcPosn(cell, ue, svc);
286    } 
287
288    /* Add UE to AMBR Prio Q */
289    if (ueDl->ambrSvc)
290    {
291       rgSCHSc1DlUeAddToSchd(cell, ue);
292    }
293
294    RETVOID;
295 }
296
297 \f
298 /***********************************************************
299  *
300  *     Func : rgSCHSc1DlUeRefresh
301  *        
302  *     Desc : Handle 'refresh' for Downlink
303  *            (ie UE's downlink AMBR and downlink GBR LCGs are
304  *            refreshed at this point)
305  *
306  *     Ret  : Void 
307  *
308  *     Notes:
309  *
310  *     File : 
311  *
312  **********************************************************/
313 #ifdef ANSI
314 PUBLIC Void rgSCHSc1DlUeRefresh
315 (
316 RgSchCellCb    *cell,
317 RgSchUeCb      *ue
318 )
319 #else
320 PUBLIC Void rgSCHSc1DlUeRefresh(cell, ue)
321 RgSchCellCb    *cell;
322 RgSchUeCb      *ue;
323 #endif
324 {
325    RgSchSc1DlUe   *ueDl = RG_GET_SC1_UE_DL(ue, cell);
326                            /*cell added as part of CA dev*/
327    RgSchCmnDlSvc *svcCmn;
328    RgSchSc1DlSvc  *svcSc1;
329    CmLListCp   *lst;
330    CmLList     *node;
331    RgSchDlLcCb *svc;
332    TRC2(rgSCHSc1DlUeRefresh);
333
334    if (ue->dl.ambrCfgd)
335    {
336       ueDl->ambr = ue->dl.ambrCfgd;
337    }
338    else
339    {
340       ueDl->ambr = RG_SC1_MAX_DL_AMBR;
341    }
342
343    if (ueDl->ambrSvc != NULLP)
344    {
345       ueDl->effAmbr = RGSCH_MIN(ueDl->ambr, ueDl->ambrSvc->bo);
346       /* Update UEs position in the Queue */
347       rgSCHSc1DlUeAddToSchd(cell, ue);
348    }
349
350    lst = &ueDl->gbrSvcs;
351    node = lst->first;
352    while (node != NULLP)
353    {
354       svc   = (RgSchDlLcCb *)node->node;
355       svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
356       svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
357       node = node->next;
358       svcSc1->gbr   = svcCmn->gbr;
359       svcSc1->mbr   = svcCmn->mbr;
360       /* Update the SVC's positioning in the Queue */
361       rgSCHSc1DlMngGbrSvcPosn(cell, ue, svc);
362    }
363    RETVOID;
364 }
365
366 \f
367 /**
368  * @brief This function removes a HARQ process from the retx
369  *
370  * @details
371  *
372  *     Function: rgSCHSc1DlProcRmvFrmCellRetx
373  *     Purpose:  This function removes a HARQ process from retransmission
374  *               queue. This may be performed when a HARQ ack is successful
375  *               for a retransmission or when the scheduling determines
376  *               to throw out the process due to poor conditions
377  *     
378  *     Invoked by: LIM and Scheduler
379  *     
380  *  @param[in]  RgSchSc1Cb*      cell
381  *  @param[in]  RgDlHqProc*   hqP  
382  *  @return  Void
383  *
384  **/
385 #ifdef ANSI
386 PRIVATE Void rgSCHSc1DlProcRmvFrmCellRetx
387 (
388 RgSchCellCb                *cell,
389 RgSchDlHqProcCb            *hqP
390 )
391 #else
392 PRIVATE Void rgSCHSc1DlProcRmvFrmCellRetx(cell, hqP)
393 RgSchCellCb                *cell;
394 RgSchDlHqProcCb            *hqP;
395 #endif
396 {
397    RgSchSc1DlCell       *cellDl = RG_GET_SC1_CELL_DL(cell);
398    RgSchCmnDlHqProc     *hqProcDl = RG_SCH_CMN_GET_DL_HQP(hqP);
399
400    TRC2(rgSCHSc1DlProcRmvFrmCellRetx);
401
402    if (hqProcDl->retxLnk.node != NULLP)
403    {
404       cmLListDelFrm(&cellDl->retxLst[((RgSchSc1DlHqProc *)\
405                     (hqProcDl->schSpfc))->prio], &(hqProcDl->retxLnk));
406       hqProcDl->retxLnk.node = NULLP;
407    }
408    RETVOID;
409 }
410
411 \f
412 /**
413  * @brief This function removes a HARQ process from the UE retx
414  *
415  * @details
416  *
417  *     Function: rgSCHSc1DlProcRmvFrmUeRetx
418  *     Purpose:  This function removes a HARQ process from UE retransmission
419  *               queue. 
420  *     
421  *     Invoked by: LIM and Scheduler
422  *     
423  *  @param[in]  RgSchUeCb*    ue
424  *  @param[in]  RgDlHqProc*   hqP  
425  *  @return  Void
426  *
427  **/
428 #ifdef ANSI
429 PRIVATE Void rgSCHSc1DlProcRmvFrmUeRetx
430 (
431 RgSchCellCb                *cell,
432 RgSchUeCb                  *ue,
433 RgSchDlHqProcCb            *hqP
434 )
435 #else
436 PRIVATE Void rgSCHSc1DlProcRmvFrmUeRetx(cell, ue, hqP)
437 RgSchCellCb                *cell;
438 RgSchUeCb                  *ue;
439 RgSchDlHqProcCb            *hqP;
440 #endif
441 {
442    RgSchSc1DlUe            *sc1Ue = RG_GET_SC1_UE_DL(ue, cell);
443    RgSchSc1DlHqProc     *hqProcDl = RG_GET_SC1_HQP_DL(hqP);
444
445    TRC2(rgSCHSc1DlProcRmvFrmUeRetx);
446
447    if (hqProcDl->retxLnkUe.node != NULLP)
448    {
449       cmLListDelFrm(&sc1Ue->retxHqProcs,
450                   &(hqProcDl->retxLnkUe));
451       hqProcDl->retxLnkUe.node = NULLP;
452    }
453    RETVOID;
454 }
455
456 \f
457 /**
458  * @brief This function adds a HARQ process for UEs retxLst
459  *
460  * @details
461  *
462  *     Function: rgSCHSc1DlProcAddToUeRetx
463  *     Purpose:  This function adds a HARQ process to UE retransmission
464  *               queue. This is performed when UE is suspended due
465  *               to measurement gap.
466  *     
467  *     Invoked by: HARQ feedback processing
468  *     
469  *  @param[in]  RgSchUeCb*       ue
470  *  @param[in]  RgSchDlHqProc*   hqP  
471  *  @return  Void
472  *
473  **/
474 #ifdef ANSI
475 PRIVATE Void rgSCHSc1DlProcAddToUeRetx
476 (
477 RgSchCellCb                *cell,
478 RgSchUeCb                  *ue,
479 RgSchDlHqProcCb            *hqP
480 )
481 #else
482 PRIVATE Void rgSCHSc1DlProcAddToUeRetx(cell, ue, hqP)
483 RgSchCellCb                *cell;
484 RgSchUeCb                  *ue;
485 RgSchDlHqProcCb            *hqP;
486 #endif
487 {
488    RgSchSc1DlUe            *sc1Ue = RG_GET_SC1_UE_DL(ue, cell);
489    RgSchSc1DlHqProc     *cmnHqDl = RG_GET_SC1_HQP_DL(hqP);
490
491    TRC2(rgSCHSc1DlProcAddToUeRetx);
492
493    cmLListAdd2Tail(&sc1Ue->retxHqProcs, 
494                     &(cmnHqDl->retxLnkUe));
495    cmnHqDl->retxLnkUe.node = (PTR)hqP;
496    RETVOID;
497 }
498
499 \f
500 /**
501  * @brief This function adds a HARQ process for retx
502  *
503  * @details
504  *
505  *     Function: rgSCHSc1DlProcAddToCellRetx
506  *     Purpose:  This function adds a HARQ process to retransmission
507  *               queue. This may be performed when a HARQ ack is
508  *               unsuccessful.
509  *     
510  *     Invoked by: HARQ feedback processing
511  *     
512  *  @param[in]  RgSchCellCb*     cell 
513  *  @param[in]  RgSchDlHqProc*   hqP  
514  *  @return  Void
515  *
516  **/
517 #ifdef ANSI
518 PUBLIC Void rgSCHSc1DlProcAddToCellRetx
519 (
520 RgSchCellCb                *cell,
521 RgSchDlHqProcCb            *hqP
522 )
523 #else
524 PUBLIC Void rgSCHSc1DlProcAddToCellRetx(cell, hqP)
525 RgSchCellCb                *cell;
526 RgSchDlHqProcCb            *hqP;
527 #endif
528 {
529    RgSchSc1DlCell          *sc1CellDl = RG_GET_SC1_CELL_DL(cell);
530    RgSchCmnDlHqProc     *cmnHqDl = RG_SCH_CMN_GET_DL_HQP(hqP);
531
532    TRC2(rgSCHSc1DlProcAddToCellRetx);
533
534    if (!RG_SCH_CMN_DL_IS_UE_ACTIVE(hqP->hqE->ue))
535    {
536       rgSCHSc1DlProcAddToUeRetx(cell, hqP->hqE->ue, hqP);
537       RETVOID;
538    }
539    cmLListAdd2Tail(&sc1CellDl->retxLst[((RgSchSc1DlHqProc *)\
540                   (cmnHqDl->schSpfc))->prio], &(cmnHqDl->retxLnk));
541    cmnHqDl->retxLnk.node = (PTR)hqP;
542    RETVOID;
543 }
544
545 \f
546 /**
547  * @brief This function implements DL RETRANSMISSION allocation
548  *
549  * @details
550  *
551  *     Function: rgSCHSc1DlRetxAlloc
552  *     Purpose:  This function implements downlink scheduler's
553  *               retransmission allocation.
554  *     
555  *     Invoked by: Scheduler
556  *     
557  *  @param[in]  RgSchCellCb           *cell
558  *  @param[in]  RgSchDlSf             *subFrm
559  *  @param[out] RgSchCmnDlRbAllocInfo *allocInfo 
560  *  @return  Void
561  *
562  **/
563 #ifdef ANSI
564 PRIVATE Void rgSCHSc1DlRetxAlloc
565 (
566 RgSchCellCb                *cell,
567 RgSchDlSf                  *subFrm,
568 RgSchCmnDlRbAllocInfo      *allocInfo
569 )
570 #else
571 PRIVATE Void rgSCHSc1DlRetxAlloc(cell, subFrm, allocInfo)
572 RgSchCellCb                *cell;
573 RgSchDlSf                  *subFrm;
574 RgSchCmnDlRbAllocInfo      *allocInfo;
575 #endif
576 {
577    U8                   i;
578    CmLListCp            *retxLst;
579    CmLList              *node;
580    RgSchDlHqProcCb      *hqP;
581    RgSchSc1DlCell       *sc1CellDl;
582    RgSchSc1DlUe         *sc1DlUe;
583    RgSchCmnDlUe         *cmnUeDl;
584 #if (defined(LTEMAC_SPS) || (!defined(LTE_TDD)))
585    CmLteTimingInfo      schdTime;
586 #endif
587    U32                  effBo;
588    RgSchUeCb            *ue = NULLP;
589 #ifdef LTEMAC_HDFDD
590    Bool                 dlAllowed = FALSE;
591 #endif
592    RgSchDlRbAlloc *dlAllocCb;
593    TRC2(rgSCHSc1DlRetxAlloc);
594
595    sc1CellDl = RG_GET_SC1_CELL_DL(cell);
596 #if (defined(LTEMAC_SPS) || (!defined(LTE_TDD)))
597    schdTime = cell->crntTime;
598
599    /* Increment by DL DELTA to determine the time for which scheduling
600     * is done */
601    RGSCH_INCR_SUB_FRAME(schdTime, RG_SCH_CMN_DL_DELTA);
602 #endif
603    for (i = 0; i < RG_SCH_SC1_DL_PRIOS; i++)
604    {
605       retxLst = &sc1CellDl->retxLst[i];
606       /* allocate bw for the retransmission..should be same are previous */
607       /* If CQI gets worse, as we cannot find same TB size for another   */
608       /* MCS, we just remove this from the retransmission queue          */
609       node = retxLst->first;
610       while (node != NULLP)
611       {
612          hqP = (RgSchDlHqProcCb *)node->node;
613          node = node->next;
614          ue = hqP->hqE->ue;
615
616 #ifndef LTE_TDD
617          if((0 == schdTime.slot) || (5 == schdTime.slot))
618          {
619             Bool reTxAllw;
620             rgSCHCmnChkRetxAllowDtx(cell, ue, hqP, &reTxAllw);
621             if(FALSE == reTxAllw)
622             {
623                continue;
624             }
625          }
626 #endif
627 #ifdef LTEMAC_HDFDD
628          if (ue->hdFddEnbld)
629          {
630             rgSCHCmnHdFddChkDlAllow ( cell, ue, &dlAllowed);
631             if (dlAllowed == FALSE)
632             {
633                continue;
634             }
635          }
636 #endif
637          /* This UE is already scheduled for transmission */
638          cmnUeDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
639                    /*cell added as part of CA dev*/
640 #ifdef LTEMAC_SPS
641          if (RG_SCH_CMN_IS_UE_SPS_SCHDLD(ue, cell, schdTime))
642          {
643             continue;
644          }
645 #endif
646          if (RG_SCH_CMN_IS_UE_SCHDLD(ue, cell))
647          {
648             continue;
649          }
650          effBo = 0;
651          /* Extra check: indicate if there is furtherScope for NewTx
652           * addition for a HqProc. This information will
653           * be utilized by common scheduler, in case of SM
654           * UEs with only one of the TBs retransmitting and the 
655           * other TB can be used for clubbing new TX. */
656          sc1DlUe = RG_GET_SC1_UE_DL(ue, cell);
657          dlAllocCb = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, cell);
658          if (sc1DlUe->lcsWithData.first != NULLP)
659          {
660             dlAllocCb->mimoAllocInfo.hasNewTxData = TRUE; 
661          }
662          /* 3.1 MIMO : last parameter changed */
663          if (rgSCHCmnDlAllocRetxRb(cell, subFrm, ue, 0, &effBo, hqP, allocInfo) !=\
664                ROK)
665          {
666             /* SF/RETX Bandwidth expired */
667             RETVOID;
668          }
669          if (effBo == 0)
670          {
671             continue;
672          }
673
674          if ((hqP->tbInfo[0].state == HQ_TB_ACKED)
675             && (hqP->tbInfo[1].state == HQ_TB_ACKED))
676          {
677             rgSCHSc1DlProcRmvFrmCellRetx(cell, hqP);
678             RETVOID;
679          }
680
681          cmnUeDl->proc = hqP;
682          /* 3.1 MIMO moving this call in cmn scheduler */
683          /*rgSCHCmnDlRbInfoAddUeRetx(allocInfo, ue);*/
684       }
685    }
686    RETVOID;
687 }
688
689 /***********************************************************
690  *
691  *     Func : rgSCHSc1RlsHqProc
692  *        
693  *     Desc : Toggles the NDI and releases the harq proc.
694  *
695  *     Ret  : Void
696  *
697  *     Notes: 
698  *
699  *     File : 
700  *
701  **********************************************************/
702 #ifdef ANSI
703 PRIVATE Void rgSCHSc1RlsHqProc
704 (
705 RgSchDlHqProcCb      *hqProc
706 )
707 #else
708 PRIVATE Void rgSCHSc1RlsHqProc(hqProc)
709 RgSchDlHqProcCb      *hqProc;
710 #endif
711 {
712    TRC2(rgSCHSc1RlsHqProc)
713    rgSCHDhmRlsHqProc(hqProc);
714    RETVOID;
715 }
716 \f
717 /**
718  * @brief This function implements dedicated logical channel data scheduling
719  *
720  * @details
721  *
722  *     Function: rgSCHSc1DlDedSvcAlloc 
723  *     Purpose:  This function implements dedicated logical 
724  *               channel data scheduling 
725  *     
726  *     Invoked by: Scheduler
727  *     
728  *  @param[in]  RgSchCellCb            *cell
729  *  @param[in]  RgSchDlSf              *subFrm
730  *  @param[in]  RgSchDlLcCb            *svc
731  *  @param[in]  U32                    bo
732  *  @param[in]  RgSchCmnDlRbAllocInfo  *allocInfo
733  *  @return  S16 
734  *
735  **/
736 #ifdef ANSI
737 PRIVATE S16 rgSCHSc1DlDedSvcAlloc
738 (
739 RgSchCellCb                *cell,
740 RgSchDlSf                  *subFrm,
741 RgSchDlLcCb                *svc,
742 U32                        bo,
743 RgSchCmnDlRbAllocInfo      *allocInfo
744 )
745 #else
746 PRIVATE S16 rgSCHSc1DlDedSvcAlloc(cell, subFrm, svc, bo, allocInfo)
747 RgSchCellCb                *cell;
748 RgSchDlSf                  *subFrm;
749 RgSchDlLcCb                *svc;
750 U32                        bo;
751 RgSchCmnDlRbAllocInfo      *allocInfo;
752 #endif
753 {
754    RgSchUeCb               *ue;
755    RgSchDlHqProcCb         *proc;
756    U16                     rlcHdrEstmt;
757    U32                     effBo;
758    RgSchCmnDlCell          *cmnCellDl = RG_SCH_CMN_GET_DL_CELL(cell);
759    RgSchCmnDlSvc           *svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
760    RgSchSc1DlSvc           *svcSc1;
761    RgSchCmnDlUe            *ueDl;
762    RgSchSc1DlHqProc        *sc1HqDl;
763    RgSchCmnDlHqProc        *cmnHqDl;
764 #ifdef LTEMAC_SPS
765    CmLteTimingInfo      schdTime;
766 #endif
767 #ifdef LTEMAC_HDFDD
768    Bool                 dlAllowed = FALSE;
769 #endif
770    S16                  ret;
771
772    TRC2(rgSCHSc1DlDedSvcAlloc);
773
774    /* Get the UE to which this service belongs to */
775    ue = svc->ue;
776 #ifdef LTEMAC_HDFDD
777       if (ue->hdFddEnbld)
778       {
779          rgSCHCmnHdFddChkDlAllow ( cell, ue, &dlAllowed);
780          if (dlAllowed == FALSE)
781          {
782             RETVALUE(ROK);
783          }
784       }
785 #endif
786    ueDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
787           /*cell added as part of CA dev*/ 
788 #ifdef LTEMAC_SPS
789    schdTime = cell->crntTime;
790
791    /* Increment by DL DELTA to determine the time for which scheduling
792     * is done */
793    RGSCH_INCR_SUB_FRAME(schdTime, RG_SCH_CMN_DL_DELTA);
794    if (RG_SCH_CMN_IS_UE_SPS_SCHDLD(ue, cell, schdTime))
795    {
796       RETVALUE(ROK);
797    }
798 #endif
799    if (RG_SCH_CMN_IS_UE_SCHDLD(ue, cell))
800    {
801       proc = (RgSchDlHqProcCb *)(ueDl->proc);
802       /* This UE is selected for retransmission. Hence no further */
803       /* scheduling may be done for this UE                       */
804       if (RG_SCH_CMN_PROC_SLCTD_FOR_RETX(proc))
805       {
806          RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"CRNTI:%d rgSCHSc1DlDedSvcAlloc():"
807             "Ue retransmitting",ue->ueId);
808          RETVALUE(ROK);
809       }
810       /* UE is scheduled for either other services or TA */
811       sc1HqDl = RG_GET_SC1_HQP_DL(proc);
812       cmnHqDl = RG_SCH_CMN_GET_DL_HQP(proc);
813       if (sc1HqDl->prio > svcCmn->prio)
814       {
815          sc1HqDl->prio = svcCmn->prio;
816       }
817    }
818    else /* First consideration of this UE for scheduling */
819    {
820       if (rgSCHDhmGetAvlHqProc(cell, ue, cmnCellDl->time, &proc) != ROK)
821       {
822          RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "CRNTI:%d rgSCHSc1DlDedSvcAlloc():"
823             " No HARQ Proc available", ue->ueId);
824          RETVALUE(ROK);
825       }
826       sc1HqDl = RG_GET_SC1_HQP_DL(proc);
827       cmnHqDl = RG_SCH_CMN_GET_DL_HQP(proc);
828       cmnHqDl->totBytes = 0;
829       /* Initialize some of the parameters of the HQ proc */
830       sc1HqDl->prio     = svcCmn->prio;
831    }
832
833    /* Including each SDU's header size */
834    RG_SCH_CMN_DL_GET_HDR_EST(svc, rlcHdrEstmt);
835    bo += rlcHdrEstmt;
836    effBo = 0;
837    ret = rgSCHCmnDlAllocTxRb(cell, subFrm, ue, bo, &effBo, proc, allocInfo);
838    if ((ret != ROK) || (effBo == 0))
839    {
840       /* If no allocations so far, meaning proc obtained now */
841       if (cmnHqDl->totBytes == 0)
842       {
843          rgSCHSc1RlsHqProc(proc);
844          /* Added the handling for removing
845           * UE from txHqPLst and resetting outStndAlloc.*/
846          if(proc->reqLnk.node != (PTR)NULLP)
847          {
848             cmLListDelFrm(&allocInfo->dedAlloc.txHqPLst, &proc->reqLnk);
849             proc->reqLnk.node = (PTR)NULLP;
850          }
851          /*Re-set the outstanding alloc information.*/
852          ueDl->outStndAlloc = 0;
853
854          /* ccpu00126519: proc should be set to NULLP in UE's DL scratch pad info as well. */
855          ueDl->proc = NULLP;
856       }
857       RETVALUE(ret);
858    }
859    svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
860    svcSc1->hdrEstimate = rlcHdrEstmt;
861    svcSc1->reqBytes = bo;
862    ueDl->proc = proc;
863    cmnHqDl->totBytes += effBo;
864
865    rgSCHSc1DlAdd2UeSchdSvcs(cell, ue, svc);
866    /* 3.1 MIMO moving this call to cmn scheduler */
867    /*rgSCHCmnDlRbInfoAddUeTx(allocInfo, ue); */
868    RETVALUE(ROK);
869 }
870
871 /**
872  * @brief This function adds a SVC to UE's schdSvcsLst. 
873  *
874  * @details
875  *
876  *     Function: rgSCHSc1DlAdd2UeSchdSvcs
877  *     Purpose:  This function adds a SVC to UE's schdSvcsLst. 
878  *     
879  *     Invoked by: Specific Scheduler 
880  *     
881  *  @param[out] RgSchUeCb          *ue
882  *  @param[in]  RgSchDlLcCb        *svc
883  *  @return  Void
884  *
885  **/
886 #ifdef ANSI
887 PRIVATE Void rgSCHSc1DlAdd2UeSchdSvcs
888 (
889 RgSchCellCb                *cell,
890 RgSchUeCb          *ue,
891 RgSchDlLcCb        *svc
892 )
893 #else
894 PRIVATE Void rgSCHSc1DlAdd2UeSchdSvcs(cell, ue, svc)
895 RgSchCellCb                *cell;
896 RgSchUeCb          *ue;
897 RgSchDlLcCb        *svc;
898 #endif
899 {
900    RgSchSc1DlSvc  *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
901    RgSchSc1DlUe   *ueSc1 = RG_GET_SC1_UE_DL(ue, cell);
902    TRC2(rgSCHSc1DlAdd2UeSchdSvcs);
903
904    /* checking SVC's presence in this lst is unnecessary */
905    cmLListAdd2Tail(&ueSc1->schdSvcs, &svcSc1->schdSvcLnk);
906    svcSc1->schdSvcLnk.node = (PTR)svc;
907    RETVOID;
908 }
909
910 \f
911 /**
912  * @brief This function performs new allocations for UEs
913  *
914  * @details
915  *
916  *     Function: rgSCHSc1DlDedTx
917  *     Purpose:  This function implements scheduler for DL allocation for
918  *               new transmissions of UEs.
919  *               1. It performs across 9 priorities that it supports - 
920  *                   This is from 3GPP specifications
921  *               2. There are known number of GBR/MBR queues
922  *               3. The first queue is highest priority queue and is 
923  *                  satisfied completely prior to any other queues. This
924  *                  queue is for RRC signalling.
925  *               4. Futher GBR/MBR queues are satisfied for GBR and then MBR
926  *               5. Subsequently all other queues are looked at for AMBR
927  *     
928  *     Invoked by: Scheduler
929  *     
930  *  @param[in]  RgSchCellCb*     cell
931  *  @param[in]  RgSchDlSf             *subFrm
932  *  @param[out] RgSchCmnDlRbAllocInfo *allocInfo 
933  *  @return  Void
934  *
935  **/
936 #ifdef ANSI
937 PRIVATE Void rgSCHSc1DlDedTx
938 (
939 RgSchCellCb                *cell,
940 RgSchDlSf                  *subFrm,
941 RgSchCmnDlRbAllocInfo      *allocInfo
942 )
943 #else
944 PRIVATE Void rgSCHSc1DlDedTx(cell, subFrm, allocInfo)
945 RgSchCellCb                *cell;
946 RgSchDlSf                  *subFrm;
947 RgSchCmnDlRbAllocInfo      *allocInfo;
948 #endif
949 {
950    CmLListCp            *lst;
951    CmLList              *node;
952    RgSchUeCb            *ue = NULLP;
953    RgSchDlLcCb          *svc;
954    U8                   i;
955    RgSchSc1DlSvc        *svcSc1;
956    RgSchSc1DlUe         *ueDl;
957    RgSchSc1DlCell       *sc1CellDl = RG_GET_SC1_CELL_DL(cell);
958    
959    TRC2(rgSCHSc1DlDedTx);
960
961    /* Process the first queue that is for RRC signalling and is of */
962    /* highest priority.                                            */
963    lst  = &sc1CellDl->prioLst[0];
964    node = lst->first;
965    while(node != NULLP)
966    {
967       /* Getting service instead of UE */
968       svc   = (RgSchDlLcCb *)node->node;
969       ue = svc->ue;
970       svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
971       node = node->next;
972       if (rgSCHSc1DlDedSvcAlloc(cell, subFrm, svc, svcSc1->bo, allocInfo) != ROK) 
973       {
974          /* sf bw expired */
975          RETVOID;
976       }
977    }
978
979    /* Perform allocation for the GBR transmissions */
980    for(i = RG_SCH_SC1_DL_GBR_PRIO_START; i <= RG_SCH_SC1_DL_GBR_PRIO_END; i++)
981    {
982       lst  = &sc1CellDl->prioLst[i];
983       node = lst->first;
984       while(node != NULLP)
985       {
986          /* Getting service instead of UE */
987          svc   = (RgSchDlLcCb *)node->node;
988          ue = svc->ue;
989          svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
990          node = node->next;
991          if (rgSCHSc1DlDedSvcAlloc(cell, subFrm, svc, svcSc1->effMbr, allocInfo) != ROK) 
992          {
993             /* sf bw expired */
994             RETVOID;
995          }
996       }
997    }
998
999    /* To implement AMBR svc scheduling */
1000    for(i = RG_SCH_SC1_DL_GBR_PRIO_END + 1; i < RG_SCH_SC1_DL_PRIOS; i++)
1001    {
1002       lst  = &sc1CellDl->prioLst[i];
1003       node = lst->first;
1004       while(node != NULLP)
1005       {
1006          ue = (RgSchUeCb *)node->node;
1007          ueDl = RG_GET_SC1_UE_DL(ue, cell);
1008          node = node->next;
1009          /* Get the Curr ambr svc for which allocation is to be made */
1010          svc = ueDl->ambrSvc;
1011          if (rgSCHSc1DlDedSvcAlloc(cell, subFrm, svc, ueDl->effAmbr, allocInfo) != ROK) 
1012          {
1013             /* sf bw expired */
1014             RETVOID;
1015          }
1016       }
1017    }
1018    RETVOID;
1019 }
1020
1021 /**
1022  * @brief scheduling for a cell
1023  *
1024  * @details
1025  *
1026  *     Function : rgSCHSc1DlPreSchd
1027  *
1028  *     Processing Steps:
1029  *     - Nothing to be done in case of RR
1030  *
1031  *  @param[in]  Inst      schInst
1032  *  @return  Void
1033  **/
1034 #ifdef ANSI
1035 PRIVATE Void rgSCHSc1DlPreSchd
1036 (
1037  RgSchCellCb   *cell
1038 )
1039 #else
1040 PUBLIC Void rgSCHSc1DlPreSchd(cell)
1041  RgSchCellCb   *cell;
1042 #endif
1043 {
1044    TRC2(rgSCHSc1DlPreSchd);
1045    
1046    RETVOID;
1047 }
1048 /**
1049  * @brief scheduling for a cell
1050  *
1051  * @details
1052  *
1053  *     Function : rgSCHSc1DlPstSchd
1054  *
1055  *     Processing Steps:
1056  *     - Nothing to be done in case of RR
1057  *
1058  *  @param[in]  Inst      schInst
1059  *  @return  Void
1060  **/
1061 #ifdef ANSI
1062 PRIVATE Void rgSCHSc1DlPstSchd
1063 (
1064  Inst       schInst
1065 )
1066 #else
1067 PUBLIC Void rgSCHSc1DlPstSchd(schInst)
1068  Inst       schInst
1069 #endif
1070 {
1071    TRC2(rgSCHSc1DlPstSchd);
1072    
1073    RETVOID;
1074 }
1075
1076 \f
1077 /**
1078  * @brief This function implements scheduler DL allocation
1079  *
1080  * @details
1081  *
1082  *     Function: rgSCHSc1DlDedNewTx
1083  *     Purpose:  This function implements scheduler for DL allocation for
1084  *               UEs.
1085  *     
1086  *     Invoked by: Scheduler
1087  *     
1088  *  @param[in]  RgSchCellCb           *cell
1089  *  @param[out] RgSchCmnDlRbAllocInfo *allocInfo
1090  *  @return  Void
1091  *
1092  **/
1093 #ifdef ANSI
1094 PRIVATE Void rgSCHSc1DlDedNewTx
1095 (
1096 RgSchCellCb           *cell,
1097 RgSchCmnDlRbAllocInfo *allocInfo
1098 )
1099 #else
1100 PRIVATE Void rgSCHSc1DlDedNewTx(cell, allocInfo)
1101 RgSchCellCb           *cell;
1102 RgSchCmnDlRbAllocInfo *allocInfo;
1103 #endif
1104 {
1105    RgSchDlSf            *subFrm = allocInfo->dedAlloc.dedDlSf;
1106 #ifdef DEBUGP
1107    Inst                 inst = cell->instIdx;
1108 #endif
1109    TRC2(rgSCHSc1DlDedNewTx);
1110    RGSCHDBGPRM(inst, (rgSchPBuf(inst), "rgSCHSc1DlDedNewTx\n"));
1111
1112    /* Now perform the new UE selections */
1113    rgSCHSc1DlDedTx(cell, subFrm, allocInfo);
1114
1115   /* Stack Crash problem for TRACE5 changes. Added the return below */
1116   RETVOID;
1117
1118 }
1119 /**
1120  * @brief This function implements scheduler DL allocation
1121  *
1122  * @details
1123  *
1124  *     Function: rgSCHSc1DlDedRetx
1125  *     Purpose:  This function implements scheduler for DL allocation for
1126  *               UEs.
1127  *     
1128  *     Invoked by: Scheduler
1129  *     
1130  *  @param[in]  RgSchCellCb           *cell
1131  *  @param[out] RgSchCmnDlRbAllocInfo *allocInfo
1132  *  @return  Void
1133  *
1134  **/
1135 #ifdef ANSI
1136 PRIVATE Void rgSCHSc1DlDedRetx
1137 (
1138 RgSchCellCb           *cell,
1139 RgSchCmnDlRbAllocInfo *allocInfo
1140 )
1141 #else
1142 PRIVATE Void rgSCHSc1DlDedRetx(cell, allocInfo)
1143 RgSchCellCb           *cell;
1144 RgSchCmnDlRbAllocInfo *allocInfo;
1145 #endif
1146 {
1147    RgSchDlSf            *subFrm = allocInfo->dedAlloc.dedDlSf;
1148 #ifdef DEBUGP
1149    Inst                 inst = cell->instIdx;
1150 #endif
1151    TRC2(rgSCHSc1DlDedRetx);
1152    RGSCHDBGPRM(inst, (rgSchPBuf(inst), "rgSCHSc1DlDedRetx\n"));
1153
1154    rgSCHSc1DlRetxAlloc(cell, subFrm, allocInfo);
1155
1156    RETVOID;
1157
1158 }
1159
1160
1161 \f
1162 /**
1163  * @brief This function adds a service to scheduler
1164  *
1165  * @details
1166  *
1167  *     Function: rgSCHSc1DlSvcAddToSchd
1168  *     Purpose:  This function adds a service to the list of services
1169  *               based on the priority of the services.
1170  *     
1171  *     Invoked by: BO and Scheduler
1172  *     
1173  *  @param[in]  RgSchCellCb*  cell
1174  *  @param[in]  RgSchUeCb*    ue   
1175  *  @return  Void
1176  *
1177  **/
1178 #ifdef ANSI
1179 PRIVATE Void rgSCHSc1DlSvcAddToSchd
1180 (
1181 RgSchCellCb                *cell,
1182 RgSchDlLcCb                *svc
1183 )
1184 #else
1185 PRIVATE Void rgSCHSc1DlSvcAddToSchd(cell, svc)
1186 RgSchCellCb                *cell;
1187 RgSchDlLcCb                *svc;
1188 #endif
1189 {
1190    CmLListCp            *lst;
1191    CmLList              *node;
1192    RgSchDlLcCb          *lSvc;
1193    RgSchSc1DlSvc        *svcSc1;
1194    RgSchSc1DlSvc        *lSvcSc1;
1195    RgSchSc1DlCell       *sc1CellDl = RG_GET_SC1_CELL_DL(cell);
1196    RgSchCmnDlSvc        *svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
1197
1198    TRC2(rgSCHSc1DlSvcAddToSchd);
1199
1200    svcSc1 = RG_GET_SC1_SVC_DL(svc->ue,svc,cell);
1201    /* The service is already in the scheduler */
1202    if (svcSc1->prioLnk.node != NULLP)
1203    {
1204       RETVOID;
1205    }
1206
1207    /* If the priority = 0, it is the highest priority with infinite */
1208    /* allowance and the priority is time bound and hence just place */
1209    /* it at the end of the queue                                    */
1210    if (svcCmn->prio == 0)
1211    {
1212       lst  = &(sc1CellDl->prioLst[0]);
1213       cmLListAdd2Tail(lst, &svcSc1->prioLnk);
1214       svcSc1->prioLnk.node = (PTR)svc;
1215       /* If a svc is put in to cell wide priority Qs
1216        * then add the same to UE's lcsWithData List */
1217       rgSCHSc1DlAdd2UeLcsWithData(cell, svc->ue, svc);
1218       RETVOID;
1219    }
1220
1221    /* Handle GBR services. We have them of next importance */
1222    /* check changed from .._START to  .._END */
1223    if (svcCmn->prio <= RG_SCH_SC1_DL_GBR_PRIO_END)
1224    {
1225       if (!RG_SC1_SVC_HAS_DATA(svc,cell))
1226          RETVOID;
1227       lst  = &(sc1CellDl->prioLst[svcCmn->prio]);
1228       node = lst->first;
1229       while(node)
1230       {
1231          lSvc = (RgSchDlLcCb *)(node->node);
1232          lSvcSc1 = RG_GET_SC1_SVC_DL(lSvc->ue,lSvc,cell);
1233          if (((svcSc1->effGbr > 0) && 
1234                   (lSvcSc1->effGbr <= svcSc1->effGbr)) ||
1235                ((lSvcSc1->effGbr == 0) && (svcSc1->effMbr > 0) && 
1236                 (lSvcSc1->effMbr <= svcSc1->effMbr)))
1237          {
1238             break;
1239          }
1240          node = node->next;
1241       }
1242       if (node == NULLP)
1243       {
1244          /* We have come to the end of the queue. Let's place it */
1245          /* here irresepctive of effGbr or effMBr                */
1246          cmLListAdd2Tail(lst, &svcSc1->prioLnk);
1247          svcSc1->prioLnk.node = (PTR)svc;
1248       }
1249       else
1250       {
1251          lst->crnt = node;
1252          cmLListInsCrnt(lst, &svcSc1->prioLnk);
1253          svcSc1->prioLnk.node = (PTR)svc;
1254       }
1255       /* If a svc is put in to cell wide priority Qs
1256        * then add the same to UE's lcsWithData List */
1257       rgSCHSc1DlAdd2UeLcsWithData(cell, svc->ue, svc);
1258    }
1259    RETVOID;
1260 }
1261
1262
1263 \f
1264 /**
1265  * @brief This function removes a UE from scheduler Queue
1266  *
1267  * @details
1268  *
1269  *     Function: rgSCHSc1DlUeRmvFrmSchd
1270  *     Purpose:  This function removes a UE from the list of UEs
1271  *               based on the priority of the UEs Current AMBR SVC.
1272  *     
1273  *     Invoked by: BO and Scheduler
1274  *     
1275  *  @param[in]  RgSchCellCb*  cell
1276  *  @param[in]  RgSchUeCb*    ue   
1277  *  @return  Void
1278  *
1279  **/
1280 #ifdef ANSI
1281 PRIVATE Void rgSCHSc1DlUeRmvFrmSchd
1282 (
1283 RgSchCellCb                *cell,
1284 RgSchUeCb                  *ue
1285 )
1286 #else
1287 PRIVATE Void rgSCHSc1DlUeRmvFrmSchd(cell, ue)
1288 RgSchCellCb                *cell;
1289 RgSchUeCb                  *ue;
1290 #endif
1291 {
1292    RgSchSc1DlCell *cellDl = RG_GET_SC1_CELL_DL(cell);
1293    RgSchSc1DlUe   *ueDl = RG_GET_SC1_UE_DL(ue, cell);
1294    CmLListCp   *lst;
1295
1296    TRC2(rgSCHSc1DlUeRmvFrmSchd);
1297
1298    lst  = &cellDl->prioLst[ueDl->prio];
1299    if (ueDl->prioLnk.node != NULLP)
1300    {
1301       cmLListDelFrm(lst, &ueDl->prioLnk);
1302       ueDl->prioLnk.node = (PTR)NULLP;
1303       /* If a svc is removed from cell wide priority Qs
1304        * then remove the same from UE's lcsWithData List */
1305       rgSCHSc1DlRmFrmUeLcsWithData(cell, ue, ueDl->ambrSvc);
1306    }
1307    RETVOID;
1308 }
1309
1310 \f
1311 /**
1312  * @brief This function removes a SVC from UEs AMBR LIST 
1313  *
1314  * @details
1315  *
1316  *     Function: rgSCHSc1DlSvcRmvFrmUeAmbrLst
1317  *     Purpose:  This function removes a SVC from UEs AMBR List.
1318  *     
1319  *     Invoked by: BO and Scheduler
1320  *     
1321  *  @param[in]  RgSchUeCb*    ue   
1322  *  @param[in]  RgSchDlLcCb*  svc
1323  *  @return  Void
1324  *
1325  **/
1326 #ifdef ANSI
1327 PRIVATE Void rgSCHSc1DlSvcRmvFrmUeAmbrLst 
1328 (
1329 RgSchCellCb                *cell,
1330 RgSchUeCb                  *ue,
1331 RgSchDlLcCb                *svc
1332 )
1333 #else
1334 PRIVATE Void rgSCHSc1DlSvcRmvFrmUeAmbrLst(cell, ue, svc)
1335 RgSchCellCb                *cell;
1336 RgSchUeCb                  *ue;
1337 RgSchDlLcCb                *svc;
1338 #endif
1339 {
1340    RgSchSc1DlUe *ueDl = RG_GET_SC1_UE_DL(ue, cell);
1341    RgSchSc1DlSvc *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
1342    CmLListCp            *lst;
1343
1344    TRC2(rgSCHSc1DlSvcRmvFrmUeAmbrLst);
1345
1346    lst  = &ueDl->ambrLst;
1347    if (svcSc1->prioLnk.node != NULLP)
1348    {
1349       cmLListDelFrm(lst, &svcSc1->prioLnk);
1350       svcSc1->prioLnk.node = (PTR)NULLP;
1351    }
1352    RETVOID;
1353 }
1354
1355 \f
1356 /**
1357  * @brief This function adds a SVC to UEs AMBR LIST 
1358  *
1359  * @details
1360  *
1361  *     Function: rgSCHSc1DlSvcAddToUeAmbrLst
1362  *     Purpose:  This function adds a SVC to UEs AMBR List.
1363  *     
1364  *     Invoked by: BO and Scheduler
1365  *     
1366  *  @param[in]  RgSchUeCb*    ue   
1367  *  @param[in]  RgSchDlLcCb*  svc
1368  *  @return  Void
1369  *
1370  **/
1371 #ifdef ANSI
1372 PRIVATE Void rgSCHSc1DlSvcAddToUeAmbrLst 
1373 (
1374 RgSchCellCb                *cell,
1375 RgSchUeCb                  *ue,
1376 RgSchDlLcCb                *svc
1377 )
1378 #else
1379 PRIVATE Void rgSCHSc1DlSvcAddToUeAmbrLst(cell, ue, svc)
1380 RgSchCellCb                *cell;
1381 RgSchUeCb                  *ue;
1382 RgSchDlLcCb                *svc;
1383 #endif
1384 {
1385    RgSchSc1DlUe            *ueDl = RG_GET_SC1_UE_DL(ue, cell);
1386    CmLList              *node;
1387    RgSchDlLcCb          *lsvc;
1388    RgSchSc1DlSvc           *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
1389    RgSchCmnDlSvc        *svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
1390
1391    TRC2(rgSCHSc1DlSvcAddToUeAmbrLst);
1392
1393    /* If svc already present in AMBR List return */
1394    if (svcSc1->prioLnk.node != NULLP)
1395       RETVOID;
1396
1397    node = ueDl->ambrLst.first;
1398    while(node)
1399    {
1400       lsvc = (RgSchDlLcCb *)(node->node);
1401       if (((RgSchCmnDlSvc*)(lsvc->sch))->prio > svcCmn->prio)
1402       {
1403          break;
1404       }
1405       node = node->next;
1406    }
1407    if (node == NULLP)
1408    {
1409       cmLListAdd2Tail(&ueDl->ambrLst, &svcSc1->prioLnk);
1410       svcSc1->prioLnk.node = (PTR)svc;
1411    }
1412    else
1413    {
1414       ueDl->ambrLst.crnt = node;
1415       cmLListInsCrnt(&ueDl->ambrLst, &svcSc1->prioLnk);
1416       svcSc1->prioLnk.node = (PTR)svc;
1417    }
1418    
1419    RETVOID;
1420 }
1421
1422 \f
1423 /**
1424  * @brief This function removes a service from scheduler
1425  *
1426  * @details
1427  *
1428  *     Function: rgSCHSc1DlSvcRmvFrmSchd
1429  *     Purpose:  This function removes the SVC from the scheduler Qs.
1430  *     
1431  *     Invoked by: BO and Scheduler
1432  *     
1433  *  @param[in]  RgSchCellCb*  cell
1434  *  @param[in]  RgSchUeCb*    ue   
1435  *  @return  Void
1436  *
1437  **/
1438 #ifdef ANSI
1439 PRIVATE Void rgSCHSc1DlSvcRmvFrmSchd
1440 (
1441 RgSchCellCb                *cell,
1442 RgSchDlLcCb                *svc
1443 )
1444 #else
1445 PRIVATE Void rgSCHSc1DlSvcRmvFrmSchd(cell, svc)
1446 RgSchCellCb                *cell;
1447 RgSchDlLcCb                *svc;
1448 #endif
1449 {
1450    RgSchSc1DlCell *cellDl = RG_GET_SC1_CELL_DL(cell);
1451    RgSchSc1DlSvc *svcDl = RG_GET_SC1_SVC_DL(svc->ue,svc,cell);
1452    RgSchCmnDlSvc *svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
1453    CmLListCp    *lst;
1454
1455    TRC2(rgSCHSc1DlSvcRmvFrmSchd);
1456
1457    lst = &(cellDl->prioLst[svcCmn->prio]);
1458    if (svcDl->prioLnk.node != NULLP)
1459    {
1460       cmLListDelFrm(lst, &svcDl->prioLnk);
1461       svcDl->prioLnk.node = NULLP;
1462       /* If a svc is removed from cell wide priority Qs
1463        * then remove the same from UE's lcsWithData List */
1464       rgSCHSc1DlRmFrmUeLcsWithData(cell, svc->ue, svc);
1465    }
1466    RETVOID;
1467 }
1468
1469 \f
1470 /**
1471  * @brief This function adds a service to scheduler for a UE
1472  *
1473  * @details
1474  *
1475  *     Function: rgSCHSc1DlSvcAdd
1476  *     Purpose:  This function is made available through a FP for 
1477  *               making scheduler aware of a service added to UE
1478  *     
1479  *     Invoked by: BO and Scheduler
1480  *     
1481  *  @param[in]  RgSchUeCb*        ue   
1482  *  @param[in]  RgSchDlLcCb*      svc   
1483  *  @param[in]  CrgDlLchCfg*   qos
1484  *  @return                    Void 
1485  *
1486  **/
1487 #ifdef ANSI
1488 PRIVATE Void rgSCHSc1DlSvcAdd
1489 (
1490 RgSchCellCb                *cell,
1491 RgSchUeCb               *ue,
1492 RgSchDlLcCb             *svc,
1493 RgrDlLchCfg             *cfg
1494 )
1495 #else
1496 PRIVATE Void rgSCHSc1DlSvcAdd(cell, ue, svc, cfg)
1497 RgSchCellCb                *cell;
1498 RgSchUeCb               *ue;
1499 RgSchDlLcCb             *svc;
1500 RgrDlLchCfg             *cfg;
1501 #endif
1502 {
1503    RgSchSc1DlUe  *ueDl = RG_GET_SC1_UE_DL(ue, cell);
1504    RgSchSc1DlSvc *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
1505    RgSchCmnDlSvc *svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
1506    TRC2(rgSCHSc1DlSvcAdd);
1507
1508    UNUSED(cfg);
1509
1510    if (RG_SCH_CMN_SVC_IS_GBR(svc))
1511    {
1512       svcSc1->gbr   = svcCmn->gbr;
1513       svcSc1->mbr   = svcCmn->mbr;
1514       cmLListAdd2Tail(&ueDl->gbrSvcs, &svcSc1->gbrLnk);
1515       svcSc1->gbrLnk.node = (PTR)svc;
1516    }
1517    RETVOID;
1518 }
1519
1520 \f
1521 /**
1522  * @brief This function deletes a service from scheduler
1523  *
1524  * @details
1525  *
1526  *     Function: rgSCHSc1DlLcRmv
1527  *     Purpose:  This function is made available through a FP for 
1528  *               making scheduler aware of a service being deleted from UE
1529  *     
1530  *     Invoked by: BO and Scheduler
1531  *     
1532  *  @param[in]  RgSchCellCb*  cell
1533  *  @param[in]  RgSchUeCb*    ue   
1534  *  @param[in]  RgSchDlLcCb*  svc   
1535  *  @return  Void
1536  *
1537  **/
1538 #ifdef ANSI
1539 PUBLIC Void rgSCHSc1DlLcRmv
1540 (
1541 RgSchCellCb                *cell,
1542 RgSchUeCb                  *ue,
1543 RgSchDlLcCb                *svc
1544 )
1545 #else
1546 PUBLIC Void rgSCHSc1DlLcRmv(cell, ue, svc)
1547 RgSchCellCb                *cell;
1548 RgSchUeCb                  *ue;
1549 RgSchDlLcCb                *svc;
1550 #endif
1551 {
1552    RgSchSc1DlUe  *ueDl;
1553    RgSchSc1DlSvc *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
1554    RgSchCmnDlSvc *svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
1555
1556    TRC2(rgSCHSc1DlLcRmv);
1557
1558    if (svcSc1 == NULLP)
1559    {
1560       RETVOID;
1561    }
1562    ueDl = RG_GET_SC1_UE_DL(ue, cell);
1563
1564    if (svcCmn->prio == 0)
1565    {
1566       rgSCHSc1DlSvcRmvFrmSchd(cell, svc);
1567    }
1568    else if (RG_SCH_CMN_SVC_IS_GBR(svc))
1569    {
1570       if (svcSc1->gbrLnk.node != NULLP)
1571       {
1572          cmLListDelFrm(&ueDl->gbrSvcs, &svcSc1->gbrLnk);
1573          svcSc1->gbrLnk.node = NULLP;
1574       }
1575       rgSCHSc1DlSvcRmvFrmSchd(cell, svc);
1576    }
1577    else /* if AMBR service */
1578    {
1579       if (ueDl->ambrSvc == svc)
1580       {
1581          rgSCHSc1DlUeRmvFrmSchd(cell, ue);
1582          rgSCHSc1DlSvcRmvFrmUeAmbrLst(cell, ue, svc);
1583          ueDl->ambrSvc = NULLP;
1584          if (ueDl->ambrLst.first != NULLP)
1585          {
1586             ueDl->ambrSvc = (RgSchDlLcCb *)(ueDl->ambrLst.first->node);
1587             ueDl->effAmbr = RGSCH_MIN(ueDl->ambr, svc->bo);
1588             if(ueDl->effAmbr)
1589             {
1590                rgSCHSc1DlUeAddToSchd(cell, ue);
1591             }
1592          }
1593       }
1594       else
1595       {
1596          rgSCHSc1DlSvcRmvFrmUeAmbrLst(cell, ue, svc);
1597       }
1598    }
1599    /* ccpu00117052 - MOD - Passing double pointer
1600    for proper NULLP assignment*/
1601    rgSCHUtlFreeSBuf(cell->instIdx, 
1602          (Data**)(&(RG_SCH_CMN_GET_LC_SCH_SPFC(ue,svc,cell))), (sizeof(RgSchSc1DlSvc)));
1603    RETVOID;
1604 }
1605
1606 /**
1607  * @brief This function is invoked as part of SVC reconfig 
1608  *
1609  * @details
1610  *
1611  *     Function: rgSCHSc1DlSvcMod
1612  *     Purpose:  This function is made available through a FP for 
1613  *               making scheduler aware of a service reconfiguration. 
1614  *     
1615  *     Invoked by: Scheduler
1616  *     
1617  *  @param[in]  RgSchDlLcCb*      svc   
1618  *  @param[in]  CrgLchRecfg*   recfg
1619  *  @return     Void 
1620  *
1621  **/
1622 #ifdef ANSI
1623 PRIVATE Void rgSCHSc1DlSvcMod
1624 (
1625 RgSchCellCb                *cell,
1626 RgSchUeCb                  *ue,
1627 RgSchDlLcCb                *svc,
1628 RgrLchRecfg             *recfg
1629 )
1630 #else
1631 PRIVATE Void rgSCHSc1DlSvcMod(cell,ue,svc, recfg)
1632 RgSchCellCb                *cell;
1633 RgSchUeCb                  *ue;
1634 RgSchDlLcCb                *svc;
1635 RgrLchRecfg             *recfg;
1636 #endif
1637
1638    RgSchSc1DlSvc *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
1639    RgSchCmnDlSvc *svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
1640    TRC2(rgSCHSc1DlSvcMod);
1641
1642    if (RG_SCH_CMN_SVC_IS_GBR(svc))
1643    {
1644       /* Convert the QOS to handle the refresh duration */
1645       svcSc1->gbr   = svcCmn->gbr;
1646       svcSc1->mbr   = svcCmn->mbr;
1647    }
1648    RETVOID;
1649 }
1650
1651 /**
1652  * @brief This function adds UE to scheduler for an AMBR service
1653  *
1654  * @details
1655  *
1656  *     Function: rgSCHSc1DlUeAddToSchd
1657  *     Purpose:  This function adds a UE to scheduler for the AMBR
1658  *               service of highest priority.
1659  *     
1660  *     Invoked by: BO and Scheduler
1661  *     
1662  *  @param[in]  RgSchCellCb*      cell
1663  *  @param[in]  RgSchUeCb*        ue   
1664  *  @return                    Void
1665  *
1666  **/
1667 #ifdef ANSI
1668 PRIVATE Void rgSCHSc1DlUeAddToSchd
1669 (
1670 RgSchCellCb                *cell,
1671 RgSchUeCb                  *ue
1672 )
1673 #else
1674 PRIVATE Void rgSCHSc1DlUeAddToSchd(cell, ue)
1675 RgSchCellCb                *cell;
1676 RgSchUeCb                  *ue;
1677 #endif
1678 {
1679    RgSchSc1DlCell *cellDl = RG_GET_SC1_CELL_DL(cell);
1680    RgSchSc1DlUe   *ueDl = RG_GET_SC1_UE_DL(ue, cell);
1681    RgSchSc1DlUe   *lueDl;
1682    CmLList        *node;
1683    CmLListCp      *lst;
1684    RgSchUeCb                  *nodeUe = NULLP;
1685    TRC2(rgSCHSc1DlUeAddToSchd);
1686
1687    ueDl->prio = ((RgSchCmnDlSvc *)(ueDl->ambrSvc->sch))->prio;
1688    lst  = &cellDl->prioLst[ueDl->prio]; 
1689    /* if UE already in list, remove and
1690     * readjust */
1691    if (ueDl->prioLnk.node != NULLP)
1692    {
1693       cmLListDelFrm(lst, &ueDl->prioLnk);
1694       ueDl->prioLnk.node = NULLP;
1695       /* If a svc is removed from cell wide priority Qs
1696        * then remove the same from UE's lcsWithData List */
1697       rgSCHSc1DlRmFrmUeLcsWithData(cell, ue, ueDl->ambrSvc);
1698    }
1699    node = lst->first;
1700    while(node)
1701    {
1702       nodeUe = (RgSchUeCb *)(node->node);
1703       lueDl = RG_GET_SC1_UE_DL(nodeUe, cell);
1704       if (lueDl->effAmbr < ueDl->effAmbr)
1705          break;
1706       node = node->next;
1707    }
1708    if (node == NULLP)
1709    {
1710       cmLListAdd2Tail(lst, &ueDl->prioLnk);
1711       ueDl->prioLnk.node = (PTR)ue;
1712    }
1713    else
1714    {
1715       lst->crnt = node;
1716       cmLListInsCrnt(lst, &ueDl->prioLnk);
1717       ueDl->prioLnk.node = (PTR)ue;
1718    }
1719    /* If a svc is put in to cell wide priority Qs
1720     * then add the same to UE's lcsWithData List */
1721    rgSCHSc1DlAdd2UeLcsWithData(cell, ue, ueDl->ambrSvc);
1722    RETVOID;
1723 }
1724
1725 \f
1726 /**
1727  * @brief This function implements managing BO for an ABMR service
1728  *
1729  * @details
1730  *
1731  *     Function: rgSCHSc1DlMngAmbrSvcPosn
1732  *     Purpose:  This function should be called whenever there is a 
1733  *               change BO for a AMBR service.
1734  *     
1735  *     Invoked by: BO and Scheduler
1736  *     
1737  *  @param[in]  RgSchCellCb*  cell
1738  *  @param[in]  RgSchUeCb*    ue   
1739  *  @param[in]  RgSchDlLcCb*  svc
1740  *  @return  Void
1741  *
1742  **/
1743 #ifdef ANSI
1744 PRIVATE Void rgSCHSc1DlMngAmbrSvcPosn
1745 (
1746 RgSchCellCb                *cell,
1747 RgSchUeCb                  *ue,
1748 RgSchDlLcCb                *svc
1749 )
1750 #else
1751 PRIVATE Void rgSCHSc1DlMngAmbrSvcPosn(cell, ue, svc)
1752 RgSchCellCb                *cell;
1753 RgSchUeCb                  *ue;
1754 RgSchDlLcCb                *svc;
1755 #endif
1756 {
1757    RgSchSc1DlUe    *ueDl = RG_GET_SC1_UE_DL(ue, cell);
1758    RgSchSc1DlSvc   *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
1759
1760    TRC2(rgSCHSc1DlMngAmbrSvcPosn);
1761
1762    if (svcSc1->bo == 0)
1763    {
1764       if (ueDl->ambrSvc == svc)
1765       {
1766          rgSCHSc1DlUeRmvFrmSchd(cell, ue);
1767          rgSCHSc1DlSvcRmvFrmUeAmbrLst(cell, ue, svc);
1768          ueDl->ambrSvc = NULLP;
1769          if (ueDl->ambrLst.first != NULLP)
1770          {
1771             ueDl->ambrSvc = (RgSchDlLcCb *)(ueDl->ambrLst.first->node);
1772             ueDl->effAmbr = RGSCH_MIN(ueDl->ambr, svcSc1->bo);
1773             if(ueDl->effAmbr)
1774             {
1775                rgSCHSc1DlUeAddToSchd(cell, ue);
1776             }
1777          }
1778       }
1779       else
1780       {
1781          rgSCHSc1DlSvcRmvFrmUeAmbrLst(cell, ue, svc);
1782       }
1783    }
1784    else /* svcSc1->bo != 0 */
1785    {
1786       if (svcSc1->prioLnk.node != NULLP)
1787       {
1788          if (svc == ueDl->ambrSvc)
1789          {
1790             ueDl->effAmbr = RGSCH_MIN(svcSc1->bo, ueDl->ambr);
1791             /* Update UE's position in the scheduler */
1792             if(ueDl->effAmbr)
1793             {
1794                rgSCHSc1DlUeAddToSchd(cell, ue);
1795             }
1796             else
1797             {
1798                rgSCHSc1DlUeRmvFrmSchd(cell, ue);
1799             }
1800          }
1801          RETVOID;
1802       }
1803       rgSCHSc1DlSvcAddToUeAmbrLst(cell, ue, svc);
1804       /* Current ambr svc is always the first node of ambrLst.*/ 
1805       if (ueDl->ambrLst.first->node == (PTR)svc)
1806       {
1807          if(ueDl->ambrSvc != svc)
1808          {
1809             if(ueDl->ambrSvc)
1810             {
1811                rgSCHSc1DlUeRmvFrmSchd(cell, ue);
1812             }
1813             ueDl->ambrSvc = svc;
1814             ueDl->effAmbr = RGSCH_MIN(ueDl->ambr, svcSc1->bo);
1815             if(ueDl->effAmbr)
1816             {
1817                rgSCHSc1DlUeAddToSchd(cell, ue);
1818             }
1819          }
1820       }
1821    }
1822    RETVOID;
1823 }
1824
1825 \f
1826 /**
1827  * @brief This function updates the scheduler with service for a UE
1828  *
1829  * @details
1830  *
1831  *     Function: rgSCHSc1DlLcBoUpd
1832  *     Purpose:  This function should be called whenever there is a 
1833  *               change BO for a service.
1834  *     
1835  *     Invoked by: BO and Scheduler
1836  *     
1837  *  @param[in]  RgSchCellCb*  cell
1838  *  @param[in]  RgSchUeCb*    ue   
1839  *  @param[in]  RgSchDlLcCb*  svc
1840  *  @return  Void
1841  *
1842  **/
1843 #ifdef ANSI
1844 PUBLIC Void rgSCHSc1DlLcBoUpd
1845 (
1846 RgSchCellCb                *cell,
1847 RgSchUeCb                  *ue,
1848 RgSchDlLcCb                *svc
1849 )
1850 #else
1851 PUBLIC Void rgSCHSc1DlLcBoUpd(cell, ue, svc)
1852 RgSchCellCb                *cell;
1853 RgSchUeCb                  *ue;
1854 RgSchDlLcCb                *svc;
1855 #endif
1856 {
1857    RgSchSc1DlSvc   *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
1858    TRC2(rgSCHSc1DlLcBoUpd);
1859
1860    if (svcSc1->bo == svc->bo)
1861    {
1862       RETVOID;
1863    }
1864    svcSc1->bo = svc->bo;
1865    if (!RG_SCH_CMN_DL_IS_UE_ACTIVE(ue))
1866    {
1867       RETVOID;
1868    }
1869    rgSCHSc1DlMngSvcPosn(cell, ue, svc);
1870
1871   /* Stack Crash problem for TRACE5 changes. Added the return below */
1872   RETVOID;
1873
1874 }
1875
1876 \f
1877 /**
1878  * @brief This function updates the scheduler with Prio0 service for a UE
1879  *
1880  * @details
1881  *
1882  *     Function: rgSCHSc1DlMngPrio0SvcPosn 
1883  *     Purpose:  This func shall be triggered whenever there is a
1884  *     change in the "Bo yet to be satisfied" field of the service.
1885  *     Appropriately positions the svc in its prio Q.
1886  *     Removes the SVC from the Q if BO is completely satisfied.
1887  *     
1888  *     Invoked by: BO and Scheduler
1889  *     
1890  *  @param[in]  RgSchCellCb*  cell
1891  *  @param[in]  RgSchUeCb*    ue   
1892  *  @param[in]  RgSchDlLcCb*  svc
1893  *  @return  Void
1894  *
1895  **/
1896 #ifdef ANSI
1897 PRIVATE Void rgSCHSc1DlMngPrio0SvcPosn
1898 (
1899 RgSchCellCb                *cell,
1900 RgSchUeCb                  *ue,
1901 RgSchDlLcCb                *svc
1902 )
1903 #else
1904 PRIVATE Void rgSCHSc1DlMngPrio0SvcPosn(cell, ue, svc)
1905 RgSchCellCb                *cell;
1906 RgSchUeCb                  *ue;
1907 RgSchDlLcCb                *svc;
1908 #endif
1909
1910    RgSchSc1DlSvc *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
1911    TRC2(rgSCHSc1DlMngPrio0SvcPosn);
1912
1913    /* In this priority, we just add or remove to the queue */
1914    if (svcSc1->bo > 0)
1915    {
1916       rgSCHSc1DlSvcAddToSchd(cell, svc);
1917    }
1918    else
1919    {
1920       rgSCHSc1DlSvcRmvFrmSchd(cell, svc);
1921    }
1922    RETVOID;
1923 }
1924
1925 \f
1926 /**
1927  * @brief This function updates the scheduler with GBR service for a UE
1928  *
1929  * @details
1930  *
1931  *     Function: rgSCHSc1DlMngGbrSvcPosn 
1932  *     Purpose:  This func shall be triggered whenever there is a
1933  *     change in the "Bo yet to be satisfied" field of the service.
1934  *     Appropriately positions the svc in its prio Q.
1935  *     Removes the SVC from the Q if BO is completely satisfied.
1936  *     
1937  *     Invoked by: BO and Scheduler
1938  *     
1939  *  @param[in]  RgSchCellCb*  cell
1940  *  @param[in]  RgSchUeCb*    ue   
1941  *  @param[in]  RgSchDlLcCb*  svc
1942  *  @return  Void
1943  *
1944  **/
1945 #ifdef ANSI
1946 PRIVATE Void rgSCHSc1DlMngGbrSvcPosn 
1947 (
1948 RgSchCellCb                *cell,
1949 RgSchUeCb                  *ue,
1950 RgSchDlLcCb                *svc
1951 )
1952 #else
1953 PRIVATE Void rgSCHSc1DlMngGbrSvcPosn(cell, ue, svc)
1954 RgSchCellCb                *cell;
1955 RgSchUeCb                  *ue;
1956 RgSchDlLcCb                *svc;
1957 #endif
1958
1959    RgSchSc1DlSvc *svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
1960    TRC2(rgSCHSc1DlMngGbrSvcPosn);
1961
1962    /* Handle a GBR service. */
1963    svcSc1->effGbr = RGSCH_MIN(svcSc1->bo, svcSc1->gbr);
1964    svcSc1->effMbr = RGSCH_MIN(svcSc1->bo, svcSc1->mbr);
1965    /* Adjust the SVC priority within the queue */
1966    rgSCHSc1DlSvcRmvFrmSchd(cell, svc);
1967    rgSCHSc1DlSvcAddToSchd(cell, svc);
1968    RETVOID;
1969 }
1970
1971 \f
1972 /**
1973  * @brief This function updates the scheduler with service for a UE
1974  *
1975  * @details
1976  *
1977  *     Function: rgSCHSc1DlMngSvcPosn 
1978  *     Purpose:  This func shall be triggered whenever there is a
1979  *     change in the "Bo yet to be satisfied" field of the service.
1980  *     Appropriately positions the svc in its prio Q.
1981  *     Removes the SVC from the Q if BO is completely satisfied.
1982  *     
1983  *     Invoked by: BO and Scheduler
1984  *     
1985  *  @param[in]  RgSchCellCb*  cell
1986  *  @param[in]  RgSchUeCb*    ue   
1987  *  @param[in]  RgSchDlLcCb*  svc
1988  *  @return  Void
1989  *
1990  **/
1991 #ifdef ANSI
1992 PRIVATE Void rgSCHSc1DlMngSvcPosn 
1993 (
1994 RgSchCellCb                *cell,
1995 RgSchUeCb                  *ue,
1996 RgSchDlLcCb                *svc
1997 )
1998 #else
1999 PRIVATE Void rgSCHSc1DlMngSvcPosn(cell, ue, svc)
2000 RgSchCellCb                *cell;
2001 RgSchUeCb                  *ue;
2002 RgSchDlLcCb                *svc;
2003 #endif
2004
2005    RgSchCmnDlSvc *svcCmn = RG_SCH_CMN_GET_DL_SVC(svc);
2006    RgSchSc1DlCell *cellDl = RG_GET_SC1_CELL_DL(cell);
2007    TRC2(rgSCHSc1DlMngSvcPosn);
2008
2009    (cellDl->svcMngFunc[svcCmn->prio])(cell, ue, svc);
2010    RETVOID; 
2011 }
2012
2013 /*--------------------------*
2014  * DL specific functions END
2015  *---------------------------*/
2016
2017
2018 \f
2019 /**
2020  * @brief Scheduler processing on cell configuration
2021  *
2022  * @details
2023  *
2024  *     Function : rgSCHSc1RgrDlCellCfg
2025  *     
2026  *     This function does requisite initialisation 
2027  *     and setup for scheduler1 when a cell is
2028  *     configured
2029  *
2030  *  @param[in]  RgSchCellCb   *cell
2031  *  @param[in]  RgrCellCfg    *cellCfg
2032  *  @param[out] RgSchErrInfo  *err
2033  *  @return  S16
2034  *      -# ROK 
2035  *      -# RFAILED 
2036  **/
2037 #ifdef ANSI
2038 PUBLIC S16 rgSCHSc1RgrDlCellCfg
2039 (
2040 RgSchCellCb   *cell,
2041 RgrCellCfg    *cellCfg,
2042 RgSchErrInfo  *err
2043 )
2044 #else
2045 PUBLIC S16 rgSCHSc1RgrDlCellCfg(cell, cellCfg, err)
2046 RgSchCellCb   *cell;
2047 RgrCellCfg    *cellCfg;
2048 RgSchErrInfo  *err;
2049 #endif
2050 {
2051    S16         ret;
2052    RgSchSc1DlCell *cellDl;
2053
2054    TRC2(rgSCHSc1RgrDlCellCfg);
2055
2056    if((ret = rgSCHUtlAllocSBuf(cell->instIdx, 
2057       (Data**)&(((RgSchCmnCell*)((cell)->sc.sch))->dl.schSpfc), \
2058       (sizeof(RgSchSc1DlCell)))) != ROK)
2059    {
2060       RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,
2061          "Memory allocation FAILED");
2062       err->errCause = RGSCHERR_SCH_SC1_DL_CFG;
2063       RETVALUE(ret);
2064    }
2065
2066    cellDl = RG_GET_SC1_CELL_DL(cell);
2067    /* Now perform downlink Queues related initializations  */
2068    rgSCHSc1DlInitQueues(cellDl);
2069    RETVALUE(ROK);
2070 }  /* rgSCHSc1RgrDlCellCfg */
2071
2072 /***********************************************************
2073  *
2074  *     Func : rgSCHSc1DlDeinitQueues
2075  *        
2076  *     Desc : De-initialise downlink scheduler queues
2077  *
2078  *     Ret  : Void
2079  *
2080  *     Notes: 
2081  *
2082  *     File : 
2083  *
2084  **********************************************************/
2085 #ifdef ANSI
2086 PRIVATE Void rgSCHSc1DlDeinitQueues
2087 (
2088 RgSchSc1DlCell *cellDl
2089 )
2090 #else
2091 PRIVATE Void rgSCHSc1DlDeinitQueues(cellDl)
2092 RgSchSc1DlCell *cellDl;
2093 #endif
2094 {
2095    U8          i;
2096    TRC2(rgSCHSc1DlDeinitQueues);
2097
2098    for (i = 0; i < RG_SC1_DL_NUM_Q; ++i)
2099    {
2100       cmLListInit(&cellDl->prioLst[i]);
2101       cmLListInit(&cellDl->retxLst[i]);
2102    } 
2103    RETVOID;
2104 }
2105
2106
2107 /**
2108  * @brief Scheduler processing for cell delete
2109  *
2110  * @details
2111  *
2112  *     Function : rgSCHSc1DlCellDel
2113  *     
2114  *     This functions de-initialises and frees memory
2115  *     taken up by scheduler1 for the entire cell.
2116  *
2117  *  @param[in]  RgSchCellCb  *cell
2118  *  @return  Void
2119  **/
2120 #ifdef ANSI
2121 PUBLIC Void rgSCHSc1DlCellDel
2122 (
2123 RgSchCellCb  *cell
2124 )
2125 #else
2126 PUBLIC Void rgSCHSc1DlCellDel(cell)
2127 RgSchCellCb  *cell;
2128 #endif
2129 {
2130    TRC2(rgSCHSc1DlCellDel);
2131
2132    if (((RgSchSc1DlCell *)((RgSchCmnCell*)((cell)->sc.sch))->dl.schSpfc) \
2133        == NULLP)
2134    {
2135       RETVOID;
2136    }
2137       
2138    /* Perform the deinit for the DL scheduler */
2139    rgSCHSc1DlDeinitQueues(RG_GET_SC1_CELL_DL(cell));
2140    /* ccpu00117052 - MOD - Passing double pointer
2141    for proper NULLP assignment*/
2142    rgSCHUtlFreeSBuf(cell->instIdx, 
2143       (Data**)(&(((RgSchCmnCell*)((cell)->sc.sch))->dl.schSpfc)),
2144       (sizeof(RgSchSc1DlCell)));
2145    RETVOID;
2146 }  /* rgSCHSc1DlCellDel */
2147
2148 /**
2149  * @brief UE initialisation for scheduler
2150  *
2151  * @details
2152  *
2153  *     Function : rgSCHSc1RgrDlUeCfg
2154  *     
2155  *     This functions intialises UE specific scheduler
2156  *     information
2157  *
2158  *  @param[in]  RgSchCellCb  *cell
2159  *  @param[in]  RgSchUeCb    *ue
2160  *  @param[int] RgrUeCfg     *ueCfg
2161  *  @param[out] RgSchErrInfo *err
2162  *  @return  S16
2163  *      -# ROK 
2164  *      -# RFAILED 
2165  **/
2166 #ifdef ANSI
2167 PUBLIC S16 rgSCHSc1RgrDlUeCfg
2168 (
2169 RgSchCellCb  *cell,
2170 RgSchUeCb    *ue,
2171 RgrUeCfg     *ueCfg,
2172 RgSchErrInfo *err
2173 )
2174 #else
2175 PUBLIC S16 rgSCHSc1RgrDlUeCfg(cell, ue, ueCfg, err)
2176 RgSchCellCb  *cell;
2177 RgSchUeCb    *ue;
2178 RgrUeCfg     *ueCfg;
2179 RgSchErrInfo *err;
2180 #endif
2181 {
2182    RgSchCmnUe         *ueSchCmn = RG_SCH_CMN_GET_UE(ue, cell);
2183    Inst               inst = cell->instIdx;
2184    RgSchSc1DlUe       *ueDl;
2185
2186    TRC2(rgSCHSc1RgrDlUeCfg);
2187
2188    if((rgSCHUtlAllocSBuf(inst, 
2189                (Data**)&(ueSchCmn->dl.schSpfc), (sizeof(RgSchSc1DlUe))) != ROK))
2190    {
2191       RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Memory allocation FAILED"
2192                "CRNTI:%d",ue->ueId);
2193       err->errCause = RGSCHERR_SCH_SC1_DL_CFG;
2194       RETVALUE(RFAILED);
2195    }
2196    ueDl = (RgSchSc1DlUe *)ueSchCmn->dl.schSpfc;
2197    if (ue->dl.ambrCfgd)
2198    {
2199       ueDl->ambr = ue->dl.ambrCfgd;
2200    }
2201    else
2202    {
2203       ueDl->ambr = RG_SC1_MAX_DL_AMBR;
2204    }
2205    cmLListInit(&ueDl->lcsWithData);
2206    cmLListInit(&ueDl->gbrSvcs);
2207    cmLListInit(&ueDl->ambrLst);
2208    cmLListInit(&ueDl->schdSvcs);
2209    cmLListInit(&ueDl->retxHqProcs);
2210    RETVALUE(ROK);
2211 }  /* rgSCHSc1RgrDlUeCfg */
2212
2213
2214 /**
2215  * @brief Dl Harq Entity initialization for SC1
2216  *
2217  * @details
2218  *
2219  *     Function : rgSCHSc1DlUeHqEntInit
2220  *
2221  *     Processing Steps:
2222  *      - Create SC1 related information per Harq Entity
2223  *
2224  *  @param[in]  RgrSchCellCb     *cell
2225  *  @param[in]  RgSchUeCb        *ue
2226  *  @return  S16
2227  *      -# ROK
2228  *      -# RFAILED
2229  **/
2230 #ifdef ANSI
2231 PUBLIC S16 rgSCHSc1DlUeHqEntInit
2232 (
2233  RgSchCellCb      *cell,
2234  RgSchDlHqEnt     *hqEnt
2235  )
2236 #else
2237 PUBLIC S16 rgSCHSc1DlUeHqEntInit(cell, hqEnt)
2238    RgSchCellCb      *cell;
2239    RgSchDlHqEnt     *hqEnt
2240 #endif
2241 {
2242    RgSchSc1DlHqProc   *hqSpcSch;
2243    RgSchDlHqProcCb    *hqP;
2244    U8                 cnt;
2245    TRC2(rgSCHSc1DlUeHqEntInit);
2246    /* making use of hqE->sch for one shot allocation 
2247     * of RgSchSc1DlHqProc structures */
2248    if (rgSCHUtlAllocSBuf(cell->instIdx, 
2249             (Data**)&(hqEnt->sch),
2250             (hqEnt->numHqPrcs * sizeof(RgSchSc1DlHqProc))) != ROK)
2251    {
2252       RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
2253                "Memory allocation FAILED CRNTI:%d",hqEnt->ue->ueId);
2254       RETVALUE(RFAILED);
2255    }
2256    hqSpcSch = (RgSchSc1DlHqProc *)(hqEnt->sch);
2257    for(cnt = 0; cnt < hqEnt->numHqPrcs; cnt++)
2258    {
2259       hqP = &hqEnt->procs[cnt];
2260       ((RgSchCmnDlHqProc *)((hqP)->sch))->schSpfc = \
2261                                                     hqSpcSch++;
2262    }
2263    RETVALUE(ROK);
2264 }
2265
2266 /**
2267  * @brief Dl Harq Entity deletion for Sc1
2268  *
2269  * @details
2270  *
2271  *     Function : rgSCHSc1DlUeHqEntDeInit 
2272  *
2273  *     Processing Steps:
2274  *      - Free SC1 related information per Harq Entity
2275  *
2276  *  @param[in]  RgrSchCellCb     *cell
2277  *  @param[in]  RgSchDlHqEnt     *hqE 
2278  *  @return  Void
2279  **/
2280 #ifdef ANSI
2281 PUBLIC S16 rgSCHSc1DlUeHqEntDeInit 
2282 (
2283 RgSchCellCb      *cell,
2284 RgSchDlHqEnt     *hqE
2285 )
2286 #else
2287 PUBLIC S16 rgSCHSc1DlUeHqEntDeInit(cell, hqE)
2288 RgSchCellCb      *cell;
2289 RgSchDlHqEnt     *hqE;
2290 #endif
2291 {
2292    TRC2(rgSCHSc1DlUeHqEntDeInit);
2293
2294    if(hqE->sch)
2295    {
2296       rgSCHUtlFreeSBuf(cell->instIdx,
2297       (Data**)(&(hqE->sch)),
2298       (hqE->numHqPrcs * sizeof(RgSchSc1DlHqProc)));
2299    }
2300    else
2301    {
2302       RETVALUE(RFAILED);
2303    }
2304    RETVALUE(ROK);
2305 }
2306 /**
2307  * @brief UE reconfiguration for scheduler
2308  *
2309  * @details
2310  *
2311  *     Function : rgSCHSc1RgrDlUeRecfg
2312  *     
2313  *     This functions updates UE specific scheduler
2314  *     information upon UE reconfiguration
2315  *
2316  *  @param[in]  RgSchCellCb  *cell
2317  *  @param[in]  RgSchUeCb    *ue
2318  *  @param[int] RgrUeRecfg   *ueRecfg
2319  *  @param[out] RgSchErrInfo *err
2320  *  @return  S16
2321  *      -# ROK 
2322  *      -# RFAILED 
2323  **/
2324 #ifdef ANSI
2325 PUBLIC S16 rgSCHSc1RgrDlUeRecfg
2326 (
2327 RgSchCellCb  *cell,
2328 RgSchUeCb    *ue,
2329 RgrUeRecfg   *ueRecfg,
2330 RgSchErrInfo *err
2331 )
2332 #else
2333 PUBLIC S16 rgSCHSc1RgrDlUeRecfg(cell, ue, ueRecfg, err)
2334 RgSchCellCb  *cell;
2335 RgSchUeCb    *ue;
2336 RgrUeRecfg   *ueRecfg;
2337 RgSchErrInfo *err;
2338 #endif
2339 {
2340    RgSchSc1DlUe *ueDl     = RG_GET_SC1_UE_DL(ue, cell);
2341    RgSchCmnDlUe *ueCmnDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
2342                            /*cell added as part of CA dev*/
2343    RgSchDlHqEnt          *hqEnt = RG_SCH_CMN_GET_UE_HQE(ue, cell);
2344    TRC2(rgSCHSc1RgrDlUeRecfg);
2345
2346    if (ue->dl.ambrCfgd)
2347    {
2348       ueDl->ambr = ue->dl.ambrCfgd;
2349    }
2350    else
2351    {
2352       ueDl->ambr = RG_SC1_MAX_DL_AMBR;
2353    }
2354
2355    /* Discarding TB2's context from scheduling Queues.
2356     * Since TB2 transmission needs signalling using 
2357     * TM specific formats. And since during this transient
2358     * period of UE TM Recfg, SCH always uses Format 1A,
2359     * the TB2s are discarded. */
2360    if (ueCmnDl->mimoInfo.forceTD & RG_SCH_CMN_TD_TXMODE_RECFG)
2361    {
2362       /* If HqP is in retx queue only for TB2 retx scheduling
2363        * then remove the harp proc from retx Queue */
2364
2365       /* If Hqp is in retx queue for retx allocation of 
2366        * both TB1 and TB2, then reset TB2's state as ACKED */
2367       RgSchDlHqProcCb    *hqP;
2368       Pst                pst;
2369       RgInfRlsHqInfo     *rlsHqBufs = &(cell->rlsHqArr[cell->crntHqIdx]);
2370       U8                 i;
2371
2372       /* Prepare TB2 release information to be sent to MAC */
2373       rlsHqBufs->numUes = 0;
2374       for(i = 0; i < hqEnt->numHqPrcs; i++)
2375       {
2376          hqP = &hqEnt->procs[i];
2377          rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].rnti = ue->ueId;
2378          rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].hqProcId = hqP->procId;
2379          if (hqP->tbInfo[1].state == HQ_TB_NACKED)
2380          {
2381             if (hqP->tbInfo[0].state != HQ_TB_NACKED)
2382             {
2383                /* Remove the HqP from retx Queue.
2384                   Release HqP.*/
2385                rgSCHSc1DlProcRmvFrmCellRetx(cell, hqP);
2386                rgSCHSc1DlProcRmvFrmUeRetx(cell, ue, hqP);
2387             }
2388             rgSCHDhmRlsHqpTb(hqP, 1, TRUE);
2389             rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].tbId[0] = 2;
2390             rlsHqBufs->ueHqInfo[rlsHqBufs->numUes].numOfTBs = 1;
2391          }
2392          rlsHqBufs->numUes++;
2393       }
2394       /* Send the hqProc list for MAC to clear TB1 contents */
2395       if (rlsHqBufs->numUes)
2396       {
2397          rgSCHUtlGetPstToLyr(&pst, &rgSchCb[cell->instIdx], cell->macInst);
2398          RgSchMacRlsHq (&pst, rlsHqBufs);
2399       }
2400    }
2401    RETVALUE(ROK);
2402 }  /* rgSCHSc1RgrDlUeRecfg */
2403
2404 /**
2405  * @brief Removes UEs context from Priority Qs.
2406  *
2407  * @details
2408  *
2409  *     Function : rgSCHSc1DlRmvUeFrmPrioQs
2410  *     
2411  *
2412  *  @param[in]  RgSchCellCb  *cell
2413  *  @param[in]  RgSchUeCb    *ue
2414  *  @return  Void
2415  **/
2416 #ifdef ANSI
2417 PRIVATE Void rgSCHSc1DlRmvUeFrmPrioQs
2418 (
2419 RgSchCellCb  *cell,
2420 RgSchUeCb    *ue
2421 )
2422 #else
2423 PRIVATE Void rgSCHSc1DlRmvUeFrmPrioQs(cell, ue)
2424 RgSchCellCb  *cell;
2425 RgSchUeCb    *ue;
2426 #endif
2427 {
2428    RgSchSc1DlUe         *sc1Ue;
2429    RgSchDlLcCb          *svc;
2430    U32                  idx;
2431
2432    TRC2(rgSCHSc1DlRmvUeFrmPrioQs);
2433
2434    sc1Ue = RG_GET_SC1_UE_DL(ue, cell);
2435
2436    /* Remove UE From DL priority queues */
2437    if (sc1Ue->ambrSvc != NULLP)
2438    {
2439       rgSCHSc1DlUeRmvFrmSchd(cell, ue);
2440    }
2441
2442    for (idx = 0; idx < RGSCH_MAX_LC_PER_UE; ++idx)
2443    {
2444       svc = ue->dl.lcCb[idx];
2445       if (svc == NULLP)
2446       {
2447          continue;
2448       }
2449       rgSCHSc1DlSvcRmvFrmSchd(cell, svc);
2450    }
2451    
2452    RETVOID;
2453 }  /* rgSCHSc1DlRmvUeFrmPrioQs */
2454
2455 /**
2456  * @brief Inactivate UE reason : measgap, acknaprept, poInactv.
2457  *
2458  * @details
2459  *
2460  *     Function : rgSCHSc1DlInactvtUe
2461  *     
2462  *
2463  *  @param[in]  RgSchCellCb  *cell
2464  *  @param[in]  RgSchUeCb    *ue
2465  *  @return  Void
2466  **/
2467 #ifdef ANSI
2468 PRIVATE Void rgSCHSc1DlInactvtUe
2469 (
2470 RgSchCellCb  *cell,
2471 RgSchUeCb    *ue
2472 )
2473 #else
2474 PRIVATE Void rgSCHSc1DlInactvtUe(cell, ue)
2475 RgSchCellCb  *cell;
2476 RgSchUeCb    *ue;
2477 #endif
2478 {
2479    RgSchSc1DlCell       *cellDl = RG_GET_SC1_CELL_DL(cell);
2480    RgSchDlHqProcCb      *hqP;
2481    RgSchCmnDlHqProc     *hqProcDl;
2482    U8                   i;
2483    RgSchDlHqEnt          *hqEnt = RG_SCH_CMN_GET_UE_HQE(ue, cell);
2484
2485    TRC2(rgSCHSc1DlInactvtUe);
2486
2487    /* ccpu00130170: UE related HARQ Procs are cleared only 
2488       if UE's Re-establishment procedure is not in progress*/
2489    if(!(ue->dl.dlInactvMask & RG_HQENT_INACTIVE))
2490    {
2491       /* remove all in use HARQ processes from the subframes.
2492        * Store them in UEs hqProc Lst. Add back to cell's
2493        * retx lst when UE is activated again. */
2494       for(i = 0; i < hqEnt->numHqPrcs; i++)
2495       {
2496          hqP = &hqEnt->procs[i];
2497          hqProcDl = RG_SCH_CMN_GET_DL_HQP(hqP);
2498          /* Remove retx procs from cell's list and 
2499           * add them to UE's List */
2500          if(
2501 #ifdef LTEMAC_SPS
2502             !(RG_SCH_CMN_SPS_DL_IS_SPS_HQP(hqP)) &&
2503 #endif
2504             hqProcDl->retxLnk.node != NULLP)
2505          {
2506             cmLListDelFrm(&cellDl->retxLst[((RgSchSc1DlHqProc *)\
2507                        (hqProcDl->schSpfc))->prio], &(hqProcDl->retxLnk));
2508             hqProcDl->retxLnk.node = NULLP;
2509             rgSCHSc1DlProcAddToUeRetx(cell, ue, hqP);
2510          }
2511       }
2512    }
2513
2514    rgSCHSc1DlRmvUeFrmPrioQs(cell, ue);
2515
2516    RETVOID;
2517 }  /* rgSCHSc1DlInactvtUe */
2518
2519
2520 /**
2521  * @brief UE suspension.
2522  *
2523  * @details
2524  *
2525  *     Function : rgSCHSc1DlSuspendUe 
2526  *     
2527  *     Removes UE, its SVCs and its HqPs from CELL WIDE
2528  *     PrioQs and Retx Qs Respectively.
2529  *
2530  *  @param[in]  RgSchCellCb  *cell
2531  *  @param[in]  RgSchUeCb    *ue
2532  *  @return  Void
2533  **/
2534 #ifdef ANSI
2535 PRIVATE Void rgSCHSc1DlSuspendUe 
2536 (
2537 RgSchCellCb  *cell,
2538 RgSchUeCb    *ue
2539 )
2540 #else
2541 PRIVATE Void rgSCHSc1DlSuspendUe(cell, ue)
2542 RgSchCellCb  *cell;
2543 RgSchUeCb    *ue;
2544 #endif
2545 {
2546    RgSchDlHqProcCb      *hqP;
2547    U8                   i;
2548    U8                   j;
2549    RgSchDlHqEnt          *hqEnt = RG_SCH_CMN_GET_UE_HQE(ue, cell);
2550
2551    TRC2(rgSCHSc1DlSuspendUe);
2552
2553    /* remove all in use HARQ processes from the subframes.
2554     * Store them in UEs hqProc Lst. Add back to cell's
2555     * retx lst when UE is activated again. */
2556    for(i = 0; i < hqEnt->numHqPrcs; i++)
2557    {
2558       hqP = &hqEnt->procs[i];
2559       rgSCHSc1DlProcRmvFrmCellRetx(cell, hqP);
2560       rgSCHSc1DlProcRmvFrmUeRetx(cell, ue, hqP);
2561       /* Removing the Harq Proc from subframes list */
2562       if (hqP->hqPSfLnk.node != NULLP)
2563       {
2564          if (hqP->pdcch )
2565          {
2566             cmLListDelFrm(&hqP->subFrm->pdcchInfo.pdcchs, 
2567                   &hqP->pdcch->lnk);
2568             cmLListAdd2Tail(&cell->pdcchLst, &hqP->pdcch->lnk);
2569             hqP->pdcch = NULLP;
2570          }
2571          /*CA DEV Start */
2572          rgSCHUtlDlHqPTbRmvFrmTx(hqP->subFrm,hqP,0,FALSE);
2573          /*CA DEV End*/ 
2574          for (j = 0; j < 2; j++)
2575          {
2576             if (hqP->tbInfo[j].state == HQ_TB_WAITING)
2577             {
2578               rgSCHDhmRlsHqpTb(hqP, j, TRUE);
2579             }
2580          }
2581       }
2582    }
2583    rgSCHSc1DlRmvUeFrmPrioQs(cell, ue);
2584
2585    RETVOID;
2586 }  /* rgSCHSc1DlSuspendUe */
2587
2588 /***********************************************************
2589  *
2590  *     Func : rgSCHSc1DlScanUpdPdbPrio
2591  *
2592  *     Desc : Increment the pivot and reposition the LCs under the pivot to 
2593  *            new location according to thieir PDB and elapsed time.
2594  *
2595  *     Ret  : Void
2596  *
2597  *     Notes:
2598  *
2599  *     File :
2600  *
2601  **********************************************************/
2602 #ifdef ANSI
2603 PUBLIC Void rgSCHSc1DlScanUpdPdbPrio
2604 (
2605 RgSchCellCb *cell
2606 )
2607 #else
2608 PUBLIC Void rgSCHSc1DlScanUpdPdbPrio (cell)
2609 RgSchCellCb *cell;
2610 #endif
2611 {
2612    TRC2(rgSCHSc1DlScanUpdPdbPrio);
2613    
2614    RETVOID;
2615 }
2616
2617 /**
2618  * @brief Function to update Flow control information 
2619  *        to be sent to MAC.
2620  *
2621  * @details
2622  *
2623  *     Function: rgSCHSc1DlFillFlowCntrlInfo
2624  *
2625  *              update Flow control information 
2626  *
2627  *     Invoked by: 
2628  *         SCHD
2629  *
2630  *     Processing Steps:
2631  *           
2632  *  @param[in] RgSchCellCb       *cell
2633                RgInfSfAlloc    *sfAlloc;
2634  *  @return  S16
2635  *      -# ROK 
2636  **/
2637 #ifdef ANSI
2638 PUBLIC S16 rgSCHSc1DlFillFlowCntrlInfo
2639 (
2640 RgSchCellCb    *cell,
2641 RgInfSfAlloc   *sfAlloc
2642 )
2643 #else
2644 PUBLIC S16 rgSCHSc1DlFillFlowCntrlInfo(cell,sfAlloc)
2645 RgSchCellCb    *cell;
2646 RgInfSfAlloc   *sfAlloc;
2647 #endif
2648 {
2649   TRC2(rgSCHSc1DlFillFlowCntrlInfo);
2650   RETVALUE(ROK);
2651 }
2652 /**
2653  * @brief UE deletion for scheduler
2654  *
2655  * @details
2656  *
2657  *     Function : rgSCHSc1DlUeDel
2658  *     
2659  *     This functions deletes all scheduler information
2660  *     pertaining to a UE
2661  *
2662  *  @param[in]  RgSchCellCb  *cell
2663  *  @param[in]  RgSchUeCb    *ue
2664  *  @return  Void
2665  **/
2666 #ifdef ANSI
2667 PUBLIC Void rgSCHSc1DlUeDel
2668 (
2669 RgSchCellCb  *cell,
2670 RgSchUeCb    *ue
2671 )
2672 #else
2673 PUBLIC Void rgSCHSc1DlUeDel(cell, ue)
2674 RgSchCellCb  *cell;
2675 RgSchUeCb    *ue;
2676 #endif
2677 {
2678    RgSchDlHqEnt          *hqEnt = RG_SCH_CMN_GET_UE_HQE(ue, cell);
2679    RgSchSc1DlUe *sc1DlUe = RG_GET_SC1_UE_DL(ue, cell);
2680
2681    TRC2(rgSCHSc1DlUeDel);
2682
2683    if (sc1DlUe == NULLP)
2684    {
2685       RETVOID;
2686    }
2687    if( hqEnt)
2688    {
2689       /* Remove UEs scheduler context */
2690       rgSCHSc1DlSuspendUe(cell, ue);
2691
2692       /* Free all SC1 specific control blocks */
2693       if (hqEnt->sch != NULLP)
2694       {
2695          /* ccpu00117052 - MOD - Passing double pointer
2696             for proper NULLP assignment*/
2697          rgSCHUtlFreeSBuf(cell->instIdx, 
2698                (Data**)(&(hqEnt->sch)), 
2699                (hqEnt->numHqPrcs * sizeof(RgSchSc1DlHqProc)));
2700       }
2701    }
2702
2703    /* ccpu00117052 - MOD - Passing double pointer
2704    for proper NULLP assignment*/
2705    rgSCHUtlFreeSBuf(cell->instIdx, (Data**)(&sc1DlUe), (sizeof(RgSchSc1DlUe))); 
2706
2707    RETVOID;
2708 }  /* rgSCHSc1DlUeDel */
2709
2710 /**
2711  * @brief Scheduler invocation on Downlink logical channel addition
2712  *
2713  * @details
2714  *
2715  *     Function : rgSCHSc1RgrLcCfg
2716  *     
2717  *     This functions does required processing when a new
2718  *     (dedicated) logical channel is added. 
2719  *
2720  *  @param[in]  RgSchCellCb  *cell
2721  *  @param[in]  RgSchUeCb    *ue
2722  *  @param[in]  RgSchDlLcCb  *dlLc
2723  *  @param[int] RgrLchCfg    *lcCfg
2724  *  @param[out] RgSchErrInfo *err
2725  *  @return  S16
2726  *      -# ROK 
2727  *      -# RFAILED 
2728  **/
2729 #ifdef ANSI
2730 PUBLIC S16 rgSCHSc1RgrLcCfg
2731 (
2732 RgSchCellCb  *cell,
2733 RgSchUeCb    *ue,
2734 RgSchDlLcCb  *dlLc,
2735 RgrLchCfg *lcCfg,
2736 RgSchErrInfo *err
2737 )
2738 #else
2739 PUBLIC S16 rgSCHSc1RgrLcCfg(cell, ue, dlLc, lcCfg, err)
2740 RgSchCellCb  *cell;
2741 RgSchUeCb    *ue;
2742 RgSchDlLcCb  *dlLc;
2743 RgrLchCfg *lcCfg;
2744 RgSchErrInfo *err;
2745 #endif
2746 {
2747    S16      ret;
2748    TRC2(rgSCHSc1RgrLcCfg);
2749
2750    ret = rgSCHUtlAllocSBuf(cell->instIdx, 
2751       (Data**)&(RG_SCH_CMN_GET_LC_SCH_SPFC(ue,dlLc,cell)), \
2752       (sizeof(RgSchSc1DlSvc)));
2753    if (ret != ROK)
2754    {
2755       RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHSc1CrgLcCfg():"
2756       "SCH struct alloc failed CRNTI:%d LCID:%d",ue->ueId,lcCfg->lcId);
2757       err->errCause = RGSCHERR_SCH_SC1_DL_CFG;
2758       RETVALUE(ret);
2759    }
2760
2761    rgSCHSc1DlSvcAdd(cell, ue, dlLc, &lcCfg->dlInfo);
2762    RETVALUE(ROK);
2763 }  /* rgSCHSc1RgrLcCfg */
2764
2765
2766 /**
2767  * @brief Scheduler invocation on logical channel addition
2768  *
2769  * @details
2770  *
2771  *     Function : rgSCHSc1RgrLcRecfg
2772  *     
2773  *     This functions does required processing when an existing
2774  *     (dedicated) logical channel is reconfigured. Assumes lcg
2775  *     pointer in ulLc is set to the old value.
2776  *     Independent of whether new LCG is meant to be configured,
2777  *     the new LCG scheduler info is accessed and possibly modified.
2778  *
2779  *  @param[in]  RgSchCellCb  *cell
2780  *  @param[in]  RgSchUeCb    *ue
2781  *  @param[in]  RgSchDlLcCb  *dlLc
2782  *  @param[int] RgrLchRecfg  *lcRecfg
2783  *  @param[out] RgSchErrInfo *err
2784  *  @return  S16
2785  *      -# ROK 
2786  *      -# RFAILED 
2787  **/
2788 #ifdef ANSI
2789 PUBLIC S16 rgSCHSc1RgrLcRecfg
2790 (
2791 RgSchCellCb  *cell,
2792 RgSchUeCb    *ue,
2793 RgSchDlLcCb  *dlLc,
2794 RgrLchRecfg  *lcRecfg,
2795 RgSchErrInfo *err
2796 )
2797 #else
2798 PUBLIC S16 rgSCHSc1RgrLcRecfg(cell, ue, dlLc, lcRecfg, err)
2799 RgSchCellCb  *cell;
2800 RgSchUeCb    *ue;
2801 RgSchDlLcCb  *dlLc;
2802 RgrLchRecfg  *lcRecfg;
2803 RgSchErrInfo *err;
2804 #endif
2805 {
2806    TRC2(rgSCHSc1RgrLcRecfg);
2807
2808    UNUSED(err);
2809
2810    rgSCHSc1DlSvcMod(cell,ue,dlLc, lcRecfg);
2811
2812    RETVALUE(ROK);
2813 }  /* rgSCHSc1RgrLcRecfg */
2814
2815 \f
2816 /**
2817  * @brief This function handles the reconfiguration of cell 
2818  *
2819  * @details
2820  *
2821  *     Function: rgSCHSc1RgrDlCellRecfg
2822  *     Purpose:  Update the reconfiguration parameters.
2823  *     
2824  *     Invoked by: Scheduler
2825  *     
2826  *  @param[in]  RgSchCellCb*  cell
2827  *  @return  Void
2828  *
2829  **/
2830 #ifdef ANSI
2831 PRIVATE S16 rgSCHSc1RgrDlCellRecfg
2832 (
2833 RgSchCellCb             *cell,
2834 RgrCellRecfg            *recfg,
2835 RgSchErrInfo            *err
2836 )
2837 #else
2838 PRIVATE S16 rgSCHSc1RgrDlCellRecfg(cell, recfg, err)
2839 RgSchCellCb             *cell;
2840 RgrCellRecfg            *recfg;
2841 RgSchErrInfo            *err;
2842 #endif
2843 {
2844    TRC2(rgSCHSc1DlUeReset);
2845    RETVALUE(ROK);
2846 }
2847
2848
2849 \f
2850 /**
2851  * @brief This function implements scheduler DL allocation
2852  *
2853  * @details
2854  *
2855  *     Function: rgSCHSc1DlTaCmd
2856  *     Purpose:  This function implements scheduler for TA cmd alloc for
2857  *               UEs. The hq proc availed as part of this alloc can be used 
2858  *               by the UEs Dedicated CH transmission allocation.
2859  *     
2860  *     Invoked by: Scheduler
2861  *     
2862  *  @param[in]  RgSchCellCb*     cell
2863  *  @param[out] RgSchCmnDlRbAllocInfo *allocInfo 
2864  *  @return  Void
2865  *
2866  **/
2867 #ifdef ANSI
2868 PRIVATE Void rgSCHSc1DlTaCmd
2869 (
2870 RgSchCellCb           *cell,
2871 RgSchCmnDlRbAllocInfo *allocInfo
2872 )
2873 #else
2874 PRIVATE Void rgSCHSc1DlTaCmd(cell, allocInfo)
2875 RgSchCellCb           *cell;
2876 RgSchCmnDlRbAllocInfo *allocInfo;
2877 #endif
2878 {
2879    CmLListCp            *lst;
2880    CmLList              *node;
2881    RgSchDlHqProcCb      *proc;
2882    RgSchUeCb            *ue;
2883    U32                  effBo;
2884    RgSchCmnDlCell       *cellCmnDl = RG_SCH_CMN_GET_DL_CELL(cell);
2885    RgSchCmnDlUe         *cmnUeDl; 
2886    RgSchSc1DlUe         *ueDl;
2887    RgSchCmnDlHqProc     *cmnHqDl;
2888    RgSchDlSf            *subFrm = allocInfo->dedAlloc.dedDlSf;
2889 #ifdef LTEMAC_HDFDD
2890    Bool                 dlAllowed = FALSE;
2891 #endif
2892    TRC2(rgSCHSc1DlTaCmd);
2893
2894    lst  = &cellCmnDl->taLst;
2895    node = lst->first;
2896    while(node)
2897    {
2898       ue = (RgSchUeCb *)node->node;
2899       node = node->next;
2900 #ifdef LTEMAC_HDFDD
2901       if (ue->hdFddEnbld)
2902       {
2903          rgSCHCmnHdFddChkDlAllow ( cell, ue, &dlAllowed);
2904          if (dlAllowed == FALSE)
2905          {
2906             continue;
2907          }
2908       }
2909 #endif
2910       /* If Ue is inactive in DL then ignore */
2911       if (ue->dl.dlInactvMask)
2912       {
2913          continue;
2914       }
2915       cmnUeDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
2916                 /*cell added as part of CA dev*/
2917       ueDl = RG_GET_SC1_UE_DL(ue, cell);
2918
2919       if (rgSCHDhmGetAvlHqProc(cell, ue, cellCmnDl->time, &proc) != ROK)
2920       {
2921          continue;    
2922       }
2923       /* Initialize some of the parameters of the HQ proc */
2924       cmnHqDl = RG_SCH_CMN_GET_DL_HQP(proc);
2925
2926       effBo = 0;
2927       /* 3.1 MIMO */
2928       cmnHqDl->totBytes = 0;
2929       rgSCHCmnDlAllocTxRb(cell, subFrm, ue, RGSCH_TA_SIZE, &effBo, proc, allocInfo);
2930       if (effBo == 0)
2931       {
2932          /* If no allocations so far, meaning proc obtained now */
2933          if (cmnHqDl->totBytes == 0)
2934          {
2935             rgSCHSc1RlsHqProc(proc);
2936             /* Added the handling for removing
2937              * UE from txHqPLst and resetting outStndalloc.*/
2938             if(proc->reqLnk.node != (PTR)NULLP)
2939             {
2940                cmLListDelFrm(&allocInfo->dedAlloc.txHqPLst, &proc->reqLnk);
2941                proc->reqLnk.node = (PTR)NULLP;
2942             }
2943             /*Re-set the outstanding alloc information.*/
2944             cmnUeDl->outStndAlloc = 0;
2945          }
2946          /* Avl BW could not satisfy even TA so break */
2947          break;
2948       }
2949       ueDl->taReqBytes = RGSCH_TA_SIZE;
2950       cmnUeDl->proc = proc;
2951       cmnHqDl->totBytes += effBo;
2952       /* 3.1 MIMO moving this call to cmn scheduler */
2953       /*rgSCHCmnDlRbInfoAddUeTx(allocInfo, ue);*/
2954    }
2955    RETVOID;
2956 }
2957
2958 /**
2959  * @brief Scheduler invocation
2960  *
2961  * @details
2962  *
2963  *     Function: rgSCHSc1DlHndlInActUes
2964  *     Purpose:  The list of inactive UEs present in inactvLst should
2965  *               be removed from the scheduling Qs.
2966  *     
2967  *     Invoked by: Common Scheduler (TTI processing)
2968  *     
2969  *  @param[in]  RgSchCellCb *cell
2970  *  @param[out] CmLListCp   *inactvLst
2971  *  @return  Void
2972  **/
2973 #ifdef ANSI
2974 PUBLIC Void rgSCHSc1DlHndlInActUes
2975 (
2976 RgSchCellCb           *cell,
2977 CmLListCp             *inactvLst
2978 )
2979 #else
2980 PUBLIC Void rgSCHSc1DlHndlInActUes(cell, inactvLst)
2981 RgSchCellCb           *cell;
2982 CmLListCp             *inactvLst;
2983 #endif
2984 {
2985    CmLList   *node;
2986    RgSchUeCb *ue;
2987
2988    TRC2(rgSCHSc1DlHndlInActUes);
2989
2990    node = inactvLst->first;
2991    while(node)
2992    {
2993       ue = (RgSchUeCb *)node->node;
2994       node = node->next;
2995       /* Suspend this UE from further scheduling
2996        * till it is activated again. */
2997       rgSCHSc1DlInactvtUe(cell, ue);
2998    }
2999    RETVOID;
3000 }
3001 \f
3002 /**
3003  * @brief This function initializes all the data for the scheduler
3004  *
3005  * @details
3006  *
3007  *     Function: rgSCHSc1DlInit
3008  *     Purpose:  This function initializes the following information
3009  *               1. Efficiency table
3010  *               2. CQI to table index - It is one row for upto 3 RBs
3011  *                  and another row for greater than 3 RBs
3012  *     
3013  *               currently extended prefix is compiled out.
3014  *     Invoked by: MAC intialization code..may be ActvInit
3015  *     
3016  *  @return  Void
3017  *
3018  **/
3019 #ifdef ANSI
3020 PUBLIC Void rgSCHSc1DlInit
3021 (
3022 RgDlSchdApis *rgSchDlApis
3023 )
3024 #else
3025 PUBLIC Void rgSCHSc1DlInit(rgSchDlApis)
3026 RgDlSchdApis *rgSchDlApis;
3027 #endif
3028 {
3029    TRC2(rgSCHSc1DlInit);
3030    /* Init the function pointers */
3031    rgSchDlApis->rgSCHRgrDlUeCfg        = rgSCHSc1RgrDlUeCfg;
3032    rgSchDlApis->rgSCHRgrDlUeRecfg      = rgSCHSc1RgrDlUeRecfg;
3033    rgSchDlApis->rgSCHFreeDlUe          = rgSCHSc1DlUeDel;
3034    rgSchDlApis->rgSCHRgrDlCellCfg      = rgSCHSc1RgrDlCellCfg;
3035    rgSchDlApis->rgSCHRgrDlCellRecfg    = rgSCHSc1RgrDlCellRecfg; 
3036    rgSchDlApis->rgSCHFreeDlCell        = rgSCHSc1DlCellDel;
3037    rgSchDlApis->rgSCHRgrDlLcCfg        = rgSCHSc1RgrLcCfg;
3038    rgSchDlApis->rgSCHRgrDlLcRecfg      = rgSCHSc1RgrLcRecfg;
3039    rgSchDlApis->rgSCHFreeDlLc          = rgSCHSc1DlLcRmv;
3040    rgSchDlApis->rgSCHDlNewSched        = rgSCHSc1DlDedNewTx;
3041    rgSchDlApis->rgSCHDlPreSched        = rgSCHSc1DlPreSchd;
3042    rgSchDlApis->rgSCHDlPstSched        = rgSCHSc1DlPstSchd;
3043    rgSchDlApis->rgSCHDlRetxSched       = rgSCHSc1DlDedRetx;
3044    rgSchDlApis->rgSCHDlCeSched         = rgSCHSc1DlTaCmd;
3045    rgSchDlApis->rgSCHDlDedBoUpd        = rgSCHSc1DlLcBoUpd;
3046    rgSchDlApis->rgSCHDlProcAddToRetx   = rgSCHSc1DlProcAddToCellRetx;
3047    rgSchDlApis->rgSCHDlAllocFnlz       = rgSCHSc1DlAllocFnlz;
3048    rgSchDlApis->rgSCHDlCqiInd          = rgSCHSc1DlCqiInd;
3049    rgSchDlApis->rgSCHDlUeRefresh       = rgSCHSc1DlUeRefresh;
3050    rgSchDlApis->rgSCHDlUeReset         = rgSCHSc1DlUeReset;
3051    rgSchDlApis->rgSCHDlActvtUe         = rgSCHSc1DlActvtUe;
3052    rgSchDlApis->rgSCHDlInactvtUes      = rgSCHSc1DlHndlInActUes;
3053    rgSchDlApis->rgSCHDlUeHqEntInit     = rgSCHSc1DlUeHqEntInit;
3054    rgSchDlApis->rgSCHDlUeHqEntDeInit   = rgSCHSc1DlUeHqEntDeInit;
3055    rgSchDlApis->rgSCHDlProcRmvFrmRetx  = rgSCHSc1DlProcRmvFrmRetx; 
3056    rgSchDlApis->rgSCHDlTickForPdbTrkng = rgSCHSc1DlScanUpdPdbPrio;
3057    rgSchDlApis->rgSCHDlFillFlwCtrlInfo = rgSCHSc1DlFillFlowCntrlInfo; 
3058
3059    RETVOID;
3060 }
3061
3062
3063
3064
3065 /***********************************************************
3066  *
3067  *     Func : rgSCHSc1DlInitQueues
3068  *        
3069  *     Desc : Initial downlink scheduler queues
3070  *
3071  *     Ret  : Void
3072  *
3073  *     Notes: 
3074  *
3075  *     File : 
3076  *
3077  **********************************************************/
3078 #ifdef ANSI
3079 PRIVATE Void rgSCHSc1DlInitQueues
3080 (
3081 RgSchSc1DlCell *cellDl
3082 )
3083 #else
3084 PRIVATE Void rgSCHSc1DlInitQueues(cellDl)
3085 RgSchSc1DlCell *cellDl;
3086 #endif
3087 {
3088    U8            i;
3089    TRC2(rgSCHSc1DlInitQueues);
3090
3091    for (i = 0; i < RG_SC1_DL_NUM_Q; ++i)
3092    {
3093       cmLListInit(&cellDl->prioLst[i]);
3094       cmLListInit(&cellDl->retxLst[i]);
3095    }
3096    /* Set appropriate "manage svc positioning" function based on
3097     * svc priority as array index */
3098    /* for DCCH svcs */
3099    for (i = 0; i < RG_SCH_SC1_DL_GBR_PRIO_START; i++)
3100    {
3101       cellDl->svcMngFunc[i] = rgSCHSc1DlMngPrio0SvcPosn;
3102    }
3103    /* for GBR svcs */
3104    for (i = RG_SCH_SC1_DL_GBR_PRIO_START; i <= RG_SCH_SC1_DL_GBR_PRIO_END; i++)
3105    {
3106       cellDl->svcMngFunc[i] = rgSCHSc1DlMngGbrSvcPosn;
3107    }
3108    /* for Non-GBR svcs */
3109    for (i = RG_SCH_SC1_DL_GBR_PRIO_END+1; i <= RG_SCH_CMN_MAX_PRIO; i++)
3110    {
3111       cellDl->svcMngFunc[i] = rgSCHSc1DlMngAmbrSvcPosn;
3112    }
3113    RETVOID;
3114 }
3115
3116
3117
3118 \f
3119 /**
3120  * @brief This function Processes the Final Allocations
3121  *        made by the RB Allocator against the requested
3122  *        RETX allocations. 
3123  *
3124  * @details
3125  *
3126  *     Function: rgSCHSc1DlRetxAllocFnlz 
3127  *     Purpose : Remove the Retx Hq Proc from the Cell's
3128  *     Retx list, if allocation is successful.
3129  *     Fill the HqProc and PDCCH and append it to the SubFrm.
3130  *     
3131  *               
3132  *     
3133  *     Invoked by: Common Scheduler 
3134  *     
3135  *  @param[in]  RgSchCellCb           *cell
3136  *  @param[in]  RgSchCmnDlRbAllocInfo *allocInfo
3137  *  @return  Void
3138  *
3139  **/
3140 #ifdef ANSI
3141 PRIVATE Void rgSCHSc1DlRetxAllocFnlz 
3142 (
3143 RgSchCellCb           *cell,
3144 RgSchCmnDlRbAllocInfo *allocInfo
3145 )
3146 #else
3147 PRIVATE Void rgSCHSc1DlRetxAllocFnlz(cell, allocInfo)
3148 RgSchCellCb           *cell;
3149 RgSchCmnDlRbAllocInfo *allocInfo;
3150 #endif
3151 {
3152    CmLList          *node;
3153    RgSchUeCb        *ue;
3154    RgSchDlHqProcCb  *hqP;
3155    RgSchDlRbAlloc *dlAllocCb = NULLP;
3156    TRC2(rgSCHSc1DlRetxAllocFnlz);
3157
3158    node = allocInfo->dedAlloc.schdRetxHqPLst.first;
3159    while(node)
3160    {
3161       hqP = (RgSchDlHqProcCb *)node->node;
3162       ue = hqP->hqE->ue;
3163       node = node->next;
3164       /* Fill PDCCH and assign it to HqP */
3165       dlAllocCb = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, cell);
3166
3167       rgSCHCmnFillHqPPdcch(cell, dlAllocCb, hqP);
3168 #ifdef LTEMAC_HDFDD
3169       if (ue->hdFddEnbld)
3170       {
3171          rgSCHCmnHdFddUpdDLMark(cell, ue);
3172       }
3173 #endif
3174       /* Extra Check: Retain the hqProc in the RETX Queue if one/more
3175        * TBs of the HqProc are yet to be scheduled for RETX.
3176        * Note: Here we are not tracking at TB Level, the priority Q
3177        * to which it belongs to. The retx prio of transmission is still
3178        * being maintained at hqProc level, rather than at TB level */
3179       if ((hqP->tbInfo[0].state != HQ_TB_NACKED) && 
3180             (hqP->tbInfo[1].state != HQ_TB_NACKED)) {
3181          rgSCHSc1DlProcRmvFrmCellRetx(cell, hqP);
3182       }
3183       /* reset the UE allocation Information */
3184       rgSCHCmnDlUeResetTemp(ue, hqP);
3185    }
3186
3187    /* Traverse the nonSchdTxUeLst and reset the UE allocation Info */
3188    node = allocInfo->dedAlloc.nonSchdRetxHqPLst.first;
3189    while(node)
3190    {
3191       hqP = (RgSchDlHqProcCb *)node->node;
3192       ue = hqP->hqE->ue;
3193       node = node->next;
3194       /* reset the UE allocation Information */
3195       rgSCHCmnDlUeResetTemp(ue, hqP);
3196    }
3197    RETVOID;
3198 }
3199
3200 /* 3.1 MIMO Alloc distribution functions being performed
3201  * TB wise */
3202
3203 \f
3204 /***********************************************************
3205  *
3206  *     Func : rgSCHSc1DlSprTxTbDstn 
3207  *        
3208  *     Desc : Perform Actual allocation distribution among
3209  *     UEs schd svcs and TA for a given spare TB "tbInfo" allocation.
3210  *     spare TB allocation is as a result of 1 RETX TB allocation, when
3211  *     conditions are favourable for 2 TB spatial multiplexing.
3212  *
3213  *     Ret  : Void 
3214  *
3215  *     Notes:
3216  *
3217  *     File : 
3218  *
3219  **********************************************************/
3220 #ifdef ANSI
3221 PRIVATE Void rgSCHSc1DlSprTxTbDstn
3222 (
3223 RgSchCellCb    *cell,
3224 RgSchUeCb      *ue,
3225 RgSchDlHqTbCb  *tbInfo,
3226 U32            *effAlloc,
3227 CmLList        **node
3228 )
3229 #else
3230 PRIVATE Void rgSCHSc1DlSprTxTbDstn(cell, ue, tbInfo, effAlloc, node)
3231 RgSchCellCb    *cell;
3232 RgSchUeCb      *ue;
3233 RgSchDlHqTbCb  *tbInfo;
3234 U32            *effAlloc;
3235 CmLList        **node;
3236 #endif
3237 {
3238    RgSchDlLcCb        *svc;
3239    RgSchSc1DlSvc      *svcSc1;
3240    RgSchSc1DlUe       *ueDl = RG_GET_SC1_UE_DL(ue, cell);
3241    U32                bytes;
3242    RgSchLchAllocInfo  lchSchdData;
3243    U32                effBo;
3244    U32                rlcHdrEstmt;
3245
3246    TRC2(rgSCHSc1DlSprTxTbDstn);
3247
3248    while((*node) && (*effAlloc > 0))
3249    {
3250       svc = (RgSchDlLcCb *)(*node)->node;
3251       *node = (*node)->next;
3252       svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
3253       
3254       RG_SCH_CMN_DL_GET_HDR_EST(svc, rlcHdrEstmt);
3255       /* Update the SVC QOS Param */
3256       if (RG_SCH_CMN_SVC_IS_GBR(svc))
3257       {
3258          effBo = svcSc1->effMbr + rlcHdrEstmt;
3259          bytes = RGSCH_MIN(*effAlloc, effBo);
3260          /* Determine How much BO is satisfied */
3261          if (bytes <= rlcHdrEstmt)
3262          {
3263             break; 
3264          }
3265          (svcSc1->bo <= bytes-rlcHdrEstmt)?\
3266            (svcSc1->bo = 0):\
3267            (svcSc1->bo -= bytes-rlcHdrEstmt);
3268          svc->bo = svcSc1->bo;
3269
3270          /* L2_COUNTERS */
3271 #ifdef LTE_L2_MEAS
3272          /* Increment qciActiveLCs once since this LCs buffer will be present
3273             in Harq process */
3274          if (svc->lcType == CM_LTE_LCH_DTCH)
3275          {
3276             ue->qciActiveLCs[svc->qciCb->qci]++;
3277          }
3278
3279          if ((svc->bo == 0) && (svc->lcType == CM_LTE_LCH_DTCH))
3280          {
3281             if (ue->qciActiveLCs[svc->qciCb->qci])
3282             {
3283                ue->qciActiveLCs[svc->qciCb->qci]--;
3284             }
3285             if (!(ue->qciActiveLCs[svc->qciCb->qci]))
3286             {
3287                svc->qciCb->dlUeCount--;
3288             }
3289          }
3290 #endif
3291          (svcSc1->gbr <= bytes)? (svcSc1->gbr = 0):
3292                                     (svcSc1->gbr -= bytes);
3293          (svcSc1->mbr <= bytes)? (svcSc1->mbr = 0):
3294                                     (svcSc1->mbr -= bytes);
3295       }
3296       else if(RG_SCH_CMN_SVC_IS_AMBR(svc))
3297       {
3298          effBo = ueDl->effAmbr + rlcHdrEstmt;
3299          bytes = RGSCH_MIN(*effAlloc, effBo);
3300          /* Determine How much BO is satisfied */
3301          if (bytes <= rlcHdrEstmt)
3302          {
3303             break; 
3304          }
3305          (svcSc1->bo <= bytes-rlcHdrEstmt)?\
3306            (svcSc1->bo = 0):\
3307            (svcSc1->bo -= bytes-rlcHdrEstmt);
3308
3309          (ueDl->ambr <= bytes)? (ueDl->ambr = 0):
3310                                        (ueDl->ambr -= bytes);
3311       }
3312       else /* Prio 0 SVC */
3313       {
3314          effBo = svcSc1->bo + rlcHdrEstmt;
3315          bytes = RGSCH_MIN(*effAlloc, effBo);
3316          /* Determine How much BO is satisfied */
3317          if (bytes <= rlcHdrEstmt)
3318          {
3319             break; 
3320          }
3321          (svcSc1->bo <= bytes-rlcHdrEstmt)?\
3322            (svcSc1->bo = 0):\
3323            (svcSc1->bo -= bytes-rlcHdrEstmt);
3324       }
3325       /* Position the service accordingly */
3326       rgSCHSc1DlMngSvcPosn(cell, svc->ue, svc);
3327       /* Update effAlloc */
3328       *effAlloc -= bytes;
3329
3330       /* Update DHM for this SVC */
3331       lchSchdData.lcId     = svc->lcId;
3332       lchSchdData.schdData = bytes;
3333       rgSCHDhmAddLcData(cell->instIdx, &lchSchdData, tbInfo);
3334    }
3335    RETVOID;
3336 }
3337
3338 \f
3339 /***********************************************************
3340  *
3341  *     Func : rgSCHSc1DlNewTxTbDstn 
3342  *        
3343  *     Desc : Perform Actual allocation distribution among
3344  *     UEs schd svcs and TA for a given TB "tbInfo" allocation.
3345  *     Assumption: TA is given higher priority in Alloc Distribution.
3346  *
3347  *     Ret  : Void 
3348  *
3349  *     Notes:
3350  *
3351  *     File : 
3352  *
3353  **********************************************************/
3354 #ifdef ANSI
3355 PRIVATE Void rgSCHSc1DlNewTxTbDstn 
3356 (
3357 RgSchCellCb    *cell,
3358 RgSchUeCb      *ue,
3359 RgSchDlHqTbCb  *tbInfo,
3360 U32            *effAlloc,
3361 CmLList        **node
3362 )
3363 #else
3364 PRIVATE Void rgSCHSc1DlNewTxTbDstn(cell, ue, tbInfo, effAlloc, node)
3365 RgSchCellCb    *cell;
3366 RgSchUeCb      *ue;
3367 RgSchDlHqTbCb  *tbInfo;
3368 U32            *effAlloc;
3369 CmLList        **node;
3370 #endif
3371 {
3372    RgSchDlLcCb        *svc;
3373    RgSchSc1DlSvc      *svcSc1 = NULLP;
3374    RgSchSc1DlUe       *ueDl = RG_GET_SC1_UE_DL(ue, cell);
3375    U32                bytes;
3376    RgSchLchAllocInfo  lchSchdData;
3377    CmLList            *prev = NULLP;
3378
3379    TRC2(rgSCHSc1DlNewTxTbDstn);
3380
3381    if (ueDl->taReqBytes)
3382    {
3383       if (ueDl->taReqBytes < *effAlloc)
3384       {
3385          /*TA satisfied, hence remove from TA Lst */
3386          rgSCHCmnRmvFrmTaLst(cell, ue);
3387          /* Indicate to DHM that TA has been scheduled */
3388          rgSCHDhmSchdTa(ue, tbInfo);
3389          *effAlloc -= ueDl->taReqBytes;
3390       }
3391       /* Reset the TA Req Bytes Field */
3392       ueDl->taReqBytes = 0;
3393    }
3394    while((*node) && (*effAlloc > 0))
3395    {
3396       svc = (RgSchDlLcCb *)(*node)->node;
3397       prev = *node;
3398       *node = (*node)->next;
3399       svcSc1 = RG_GET_SC1_SVC_DL(ue,svc,cell);
3400       if (*effAlloc > svcSc1->reqBytes)
3401       {
3402          bytes = svcSc1->reqBytes;
3403          if (bytes <= svcSc1->hdrEstimate)
3404          {
3405             break; 
3406          }
3407          /* 3.1 MIMO updating the reqBytes field */
3408          svcSc1->reqBytes = 0;
3409          svcSc1->bo = 0;
3410       }
3411       else
3412       {
3413          bytes = *effAlloc;
3414          if (bytes <= svcSc1->hdrEstimate)
3415          {
3416             break; 
3417          }
3418          /* 3.1 MIMO updating the reqBytes field */
3419          svcSc1->reqBytes -= bytes;
3420          (svcSc1->bo <= bytes-svcSc1->hdrEstimate)?\
3421            (svcSc1->bo = 0):\
3422            (svcSc1->bo -= bytes-svcSc1->hdrEstimate);
3423       }
3424       svc->bo = svcSc1->bo;
3425
3426       /* L2_COUNTERS */
3427 #ifdef LTE_L2_MEAS
3428
3429       /* Increment qciActiveLCs once since this LCs buffer will be present
3430          in Harq process */
3431       if (svc->lcType == CM_LTE_LCH_DTCH)
3432       {
3433          ue->qciActiveLCs[svc->qciCb->qci]++;
3434       }
3435
3436       if ((svc->bo == 0) && (svc->lcType == CM_LTE_LCH_DTCH))
3437       {
3438          if (ue->qciActiveLCs[svc->qciCb->qci])
3439          {
3440             ue->qciActiveLCs[svc->qciCb->qci]--;
3441          }
3442          if (!(ue->qciActiveLCs[svc->qciCb->qci]))
3443          {
3444             svc->qciCb->dlUeCount--;
3445          }
3446       }
3447 #endif
3448
3449       /* Update the SVC QOS Param */
3450       if (RG_SCH_CMN_SVC_IS_GBR(svc))
3451       {
3452          (svcSc1->gbr <= bytes)? (svcSc1->gbr = 0):
3453                                     (svcSc1->gbr -= bytes);
3454          (svcSc1->mbr <= bytes)? (svcSc1->mbr = 0):
3455                                     (svcSc1->mbr -= bytes);
3456       }
3457       else if(RG_SCH_CMN_SVC_IS_AMBR(svc))
3458       {
3459          (ueDl->ambr <= bytes)? (ueDl->ambr = 0):
3460                                        (ueDl->ambr -= bytes);
3461       }
3462       /* Position the service accordingly */
3463       rgSCHSc1DlMngSvcPosn(cell, svc->ue, svc);
3464       /* Update effAlloc */
3465       *effAlloc -= bytes;
3466
3467       /* Update DHM for this SVC */
3468       lchSchdData.lcId     = svc->lcId;
3469       lchSchdData.schdData = bytes;
3470       rgSCHDhmAddLcData(cell->instIdx, &lchSchdData, tbInfo);
3471    }
3472    /* If no more scheduled LCs for TB data distribution
3473     * then distribute the spare TB data among the LCs
3474     * of the UE with non-zero BO. This is effective for 
3475     * schedulers work on LC level priorities rather than
3476     * UE level. */
3477    if ((*node == NULLP) && (svcSc1) && (svcSc1->reqBytes == 0))
3478    {
3479       rgSCHSc1DlSprTxTbDstn(cell, ue, tbInfo, effAlloc,
3480                             &ueDl->lcsWithData.first);
3481       *node = NULLP;
3482       RETVOID;
3483    }
3484    /* make sure node points to the svc not completely
3485     * satisfied.
3486     * make sure if not served completely then 
3487     * the other TB allocation accomodates the same */
3488    *node = prev;
3489    RETVOID;
3490 }
3491
3492
3493 \f
3494 /***********************************************************
3495  *
3496  *     Func : rgSCHSc1DlNewTxUeFnlz 
3497  *        
3498  *     Desc : Perform allocation Distribution from scheduled TB
3499  *            among the list of services considered for scheduling.
3500  *
3501  *     Ret  : Void 
3502  *
3503  *     Notes:
3504  *
3505  *     File : 
3506  *
3507  **********************************************************/
3508 #ifdef ANSI
3509 PRIVATE Void rgSCHSc1DlNewTxUeFnlz 
3510 (
3511 RgSchCellCb    *cell,
3512 RgSchCmnDlRbAllocInfo *allocInfo,
3513 RgSchUeCb      *ue
3514 )
3515 #else
3516 PRIVATE Void rgSCHSc1DlNewTxUeFnlz(cell, allocInfo, ue)
3517 RgSchCellCb    *cell;
3518 RgSchCmnDlRbAllocInfo *allocInfo;
3519 RgSchUeCb      *ue;
3520 #endif
3521 {
3522    CmLList            *node;
3523    RgSchSc1DlUe       *ueDl = RG_GET_SC1_UE_DL(ue, cell);
3524    RgSchCmnDlUe       *cmnUeDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
3525                                  /*cell added as part of CA dev*/
3526    /* 3.1 MIMO Distribute data of each TB across services */
3527    RgSchDlRbAlloc *dlAllocCb = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, cell);
3528    U32                remTb1Bytes = dlAllocCb->tbInfo[0].bytesAlloc;
3529    U32                remTb2Bytes = dlAllocCb->tbInfo[1].bytesAlloc;
3530    U32                effAlloc = 0;
3531    /*ccpu00120365-ADD-added to code to check if second TB is utilized */
3532    U32                tb2Bytes = 0;
3533
3534    TRC2(rgSCHSc1DlNewTxUeFnlz);
3535
3536
3537    /* 3.1 MIMO Consider the allocation of New TX TB for distribution */
3538    /* Handle schd services */
3539    node = ueDl->schdSvcs.first;
3540    if (remTb1Bytes){
3541       effAlloc += remTb1Bytes;
3542       rgSCHSc1DlNewTxTbDstn(cell, ue, &cmnUeDl->proc->tbInfo[0],\
3543             &remTb1Bytes, &node);
3544       /* In the event that TB1 is not completely filled by the DL LCs
3545        * BO, consider the reducing the iMcs for increasing redundancy
3546        * and hence reception quality at UE */
3547       rgSCHCmnRdcImcsTxTb(dlAllocCb, 0, 
3548             dlAllocCb->tbInfo[0].bytesAlloc - remTb1Bytes);
3549    }
3550    
3551    /*ccpu00120365-ADD-assigning value of remTb2Bytes before utilization */
3552    tb2Bytes = remTb2Bytes;
3553    
3554    /* Extra check for a non SM UE allocation */
3555    if (remTb2Bytes){
3556       effAlloc += remTb2Bytes;
3557       rgSCHSc1DlNewTxTbDstn(cell, ue, &cmnUeDl->proc->tbInfo[1],\
3558             &remTb2Bytes, &node);
3559       /* In the event that TB2 is not completely filled by the DL LCs
3560        * BO, consider the reducing the iMcs for increasing redundancy
3561        * and hence reception quality at UE */
3562       rgSCHCmnRdcImcsTxTb(dlAllocCb, 1, 
3563             dlAllocCb->tbInfo[1].bytesAlloc - remTb2Bytes);
3564    }
3565
3566    /* ccpu00120365-ADD-Disable the second TB as the second TB is not
3567     * utilized */
3568    if ( remTb2Bytes && ( tb2Bytes == remTb2Bytes) )
3569    {
3570       dlAllocCb->mimoAllocInfo.precIdxInfo = 0;
3571       dlAllocCb->mimoAllocInfo.numTxLyrs   = 1;
3572       dlAllocCb->tbInfo[1].schdlngForTb    = FALSE;
3573       dlAllocCb->tbInfo[1].isDisabled      = TRUE;
3574    }
3575
3576    if (effAlloc == (remTb1Bytes + remTb2Bytes))
3577    {
3578       /* Allocation such that Nothing could be satisfied */
3579       /* Return the grabbed PDCCH */
3580       rgSCHUtlPdcchPut(cell, &dlAllocCb->dlSf->pdcchInfo, 
3581             dlAllocCb->pdcch);
3582       rgSCHSc1RlsHqProc(cmnUeDl->proc);
3583       RETVOID;
3584    }
3585
3586    /* Fill PDCCH and assign it to HqP */
3587    rgSCHCmnFillHqPPdcch(cell, dlAllocCb, cmnUeDl->proc);
3588
3589    RETVOID;
3590 }
3591
3592 \f
3593 /**
3594  * @brief This function Processes the Final Allocations
3595  *        made by the RB Allocator against the requested
3596  *        New TX allocations. 
3597  *
3598  * @details
3599  *
3600  *     Function: rgSCHSc1DlNewTxAllocFnlz 
3601  *     Purpose : Distribute the allocation among the Scheduled SVCs.
3602  *     Fill pdcch and HqP for UEs will allocations.
3603  *     Release HqP for UE with no allocation.
3604  *
3605  *     Invoked by: Common Scheduler 
3606  *     
3607  *  @param[in]  RgSchCellCb           *cell
3608  *  @param[in]  RgSchCmnDlRbAllocInfo *allocInfo
3609  *  @return  Void
3610  *
3611  **/
3612 #ifdef ANSI
3613 PRIVATE Void rgSCHSc1DlNewTxAllocFnlz 
3614 (
3615 RgSchCellCb           *cell,
3616 RgSchCmnDlRbAllocInfo *allocInfo
3617 )
3618 #else
3619 PRIVATE Void rgSCHSc1DlNewTxAllocFnlz(cell, allocInfo)
3620 RgSchCellCb           *cell;
3621 RgSchCmnDlRbAllocInfo *allocInfo;
3622 #endif
3623 {
3624    CmLList          *node;
3625    RgSchUeCb        *ue;
3626    RgSchCmnDlUe     *cmnUeDl;
3627    RgSchDlHqProcCb  *hqP;
3628    TRC2(rgSCHSc1DlNewTxAllocFnlz);
3629
3630    node = allocInfo->dedAlloc.schdTxHqPLst.first;
3631    while(node)
3632    {
3633       hqP = (RgSchDlHqProcCb *)node->node;
3634       ue = hqP->hqE->ue;
3635       node = node->next;
3636       cmnUeDl = RG_SCH_CMN_GET_DL_UE(ue,cell);
3637                 /*cell added as part of CA dev*/
3638
3639       rgSCHSc1DlNewTxUeFnlz(cell, allocInfo, ue);
3640 #ifdef LTEMAC_HDFDD
3641       if (ue->hdFddEnbld)
3642       {
3643          rgSCHCmnHdFddUpdDLMark(cell, ue);
3644       }
3645 #endif
3646       /* reset the UE allocation Information */
3647       cmLListInit(&((RgSchSc1DlUe *)(cmnUeDl->schSpfc))->schdSvcs);
3648       rgSCHCmnDlUeResetTemp(ue, hqP);
3649    }
3650
3651    /* Traverse the nonSchdTxUeLst and reset the UE allocation Info */
3652    node = allocInfo->dedAlloc.nonSchdTxHqPLst.first;
3653    while(node)
3654    {
3655       hqP = (RgSchDlHqProcCb *)node->node;
3656       ue = hqP->hqE->ue;
3657       node = node->next;
3658       cmnUeDl = RG_SCH_CMN_GET_DL_UE(ue, cell);
3659
3660       /* Release HqProc */
3661       rgSCHSc1RlsHqProc(hqP);
3662       /* reset the UE allocation Information */
3663       cmLListInit(&((RgSchSc1DlUe *)(cmnUeDl->schSpfc))->schdSvcs);
3664       rgSCHCmnDlUeResetTemp(ue, hqP);
3665    }
3666    RETVOID;
3667 }
3668
3669 /* 3.1 Added new function to handle TX+RETX alloc fnlz'n */
3670 \f
3671 /**
3672  * @brief This function Processes the Final Allocations
3673  *        made by the RB Allocator against the requested
3674  *        RETX+New TX allocations. The NewTx TB allocation
3675  *        is considered for distribution among LCs.
3676  *
3677  * @details
3678  *
3679  *     Function: rgSCHSc1DlRetxNewTxAllocFnlz 
3680  *     Purpose : 1. Reached here due to 1 RETX TB allocation for a 
3681  *                  SM UE, which is capable to accomodate a newTX
3682  *                  in the other TB.
3683  *               2. Distribute NewTX TB allocation among the
3684  *                  SVCs present in lcsWithData list of UE.
3685  *
3686  *
3687  *     Invoked by: Common Scheduler 
3688  *     
3689  *  @param[in]  RgSchCellCb           *cell
3690  *  @param[in]  RgSchCmnDlRbAllocInfo *cellAllocInfo
3691  *  @return  Void
3692  *
3693  **/
3694 #ifdef ANSI
3695 PRIVATE Void rgSCHSc1DlRetxNewTxAllocFnlz 
3696 (
3697 RgSchCellCb           *cell,
3698 RgSchCmnDlRbAllocInfo *cellAllocInfo
3699 )
3700 #else
3701 PRIVATE Void rgSCHSc1DlRetxNewTxAllocFnlz(cell, cellAllocInfo)
3702 RgSchCellCb           *cell;
3703 RgSchCmnDlRbAllocInfo *cellAllocInfo;
3704 #endif
3705 {
3706    CmLList          *node;
3707    RgSchUeCb        *ue;
3708    RgSchSc1DlUe     *sc1DlUe;
3709    RgSchDlHqProcCb  *hqP;
3710    RgSchDlHqTbCb    *newTxTbInfo;
3711    U32              effAlloc;
3712    U32              remTbBytes;
3713    RgSchDlRbAlloc   *ueAllocInfo; 
3714    RgSchDlRbAlloc *dlAllocCb;
3715
3716    TRC2(rgSCHSc1DlRetxNewTxAllocFnlz);
3717    
3718    node = cellAllocInfo->dedAlloc.schdTxRetxHqPLst.first;
3719    while(node)
3720    {
3721       hqP = (RgSchDlHqProcCb *)node->node;
3722       ue = hqP->hqE->ue;
3723       node = node->next;
3724       sc1DlUe = RG_GET_SC1_UE_DL(ue, cell);
3725       ueAllocInfo = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, cell);
3726       dlAllocCb = RG_SCH_CMN_GET_ALLOCCB_FRM_UE(ue, cell);
3727       /* Index 0 of ueAllocInfo->tbInfo will always hold the 
3728        * RETX TB and index 1 will hold the NewTX TB in case of
3729        * RETX+TX allocation. */
3730       newTxTbInfo = ueAllocInfo->tbInfo[1].tbCb;
3731       effAlloc = remTbBytes  =  ueAllocInfo->tbInfo[1].bytesAlloc;
3732       rgSCHSc1DlSprTxTbDstn(cell, ue, newTxTbInfo,\
3733                      &remTbBytes, &(sc1DlUe->lcsWithData.first));
3734       /* Trying to reduce mcs of TX TB to increase reception quality at UE.
3735        * In case of RETX+TX allocation, TX TB allocation was irrespective
3736        * of actual requirement by UE, hence in case if consumption is 
3737        * less than allocation, consider reducing the iMcs of this TX TB. */
3738       rgSCHCmnRdcImcsTxTb(dlAllocCb, 1, effAlloc - remTbBytes);
3739       /* 3.1 MIMO Remove/Retain from/in cell RETX List */
3740       rgSCHSc1DlProcRmvFrmCellRetx(cell, hqP);
3741       /* Fill PDCCH and assign it to HqP */
3742       rgSCHCmnFillHqPPdcch(cell, dlAllocCb, hqP);
3743 #ifdef LTEMAC_HDFDD
3744       if (ue->hdFddEnbld)
3745       {
3746          rgSCHCmnHdFddUpdDLMark(cell, ue);
3747       }
3748 #endif
3749       /* reset the UE allocation Information */
3750       rgSCHCmnDlUeResetTemp(ue, hqP);
3751    }
3752
3753    /* Traverse the nonSchdTxRetxHqPLst and reset the UE allocation Info */
3754    node = cellAllocInfo->dedAlloc.nonSchdTxRetxHqPLst.first;
3755    while(node)
3756    {
3757       hqP = (RgSchDlHqProcCb *)node->node;
3758       ue = hqP->hqE->ue;
3759       node = node->next;
3760       /* reset the UE allocation Information */
3761       rgSCHCmnDlUeResetTemp(ue, hqP);
3762    }
3763 }
3764
3765 \f
3766 /**
3767  * @brief This function Processes the Final Allocations
3768  *        made by the RB Allocator against the requested. 
3769  *
3770  * @details
3771  *
3772  *     Function: rgSCHSc1DlAllocFnlz
3773  *     Purpose:  This function Processes the Final Allocations
3774  *               made by the RB Allocator against the requested. 
3775  *               1. Loop through scheduled TX and RETX lists.
3776  *                  Fill in the corresponding PDCCH and HqProcs.
3777  *                  In case of TX If actual Alloc < requested, then perform
3778  *                     an appropriate distribution among the schdSvcs.
3779  *                     If TA is satisfied, then remove UE from TA Lst.
3780  *               2. Loop through UnScheduled TX and RETX Lists.
3781  *                  Release grabbed HqProcs.
3782  *                  Put back SVCs from schdSvcsLst to their corresponding Qs.
3783  *               
3784  *     
3785  *     Invoked by: Common Scheduler 
3786  *     
3787  *  @param[in]  RgSchCellCb           *cell
3788  *  @param[in]  RgSchCmnDlRbAllocInfo *allocInfo
3789  *  @return  Void
3790  *
3791  **/
3792 #ifdef ANSI
3793 PUBLIC Void rgSCHSc1DlAllocFnlz
3794 (
3795 RgSchCellCb           *cell,
3796 RgSchCmnDlRbAllocInfo *allocInfo
3797 )
3798 #else
3799 PUBLIC Void rgSCHSc1DlAllocFnlz(cell, allocInfo)
3800 RgSchCellCb           *cell;
3801 RgSchCmnDlRbAllocInfo *allocInfo;
3802 #endif
3803 {
3804    TRC2(rgSCHSc1DlAllocFnlz);
3805
3806    rgSCHSc1DlRetxAllocFnlz(cell, allocInfo);
3807
3808    rgSCHSc1DlNewTxAllocFnlz(cell, allocInfo);
3809
3810    /*3.1 MIMO new Function added to handle TX+RETX 
3811     * harq process scheduling finalization */
3812    rgSCHSc1DlRetxNewTxAllocFnlz(cell, allocInfo);
3813    RETVOID;
3814 }
3815
3816
3817 \f
3818 /**
3819  * @brief This function Updates the DL CQI for the UE. 
3820  *
3821  * @details
3822  *
3823  *     Function: rgSCHSc1DlCqiInd 
3824  *     Purpose:  Updates the DL CQI for the UE
3825  *     
3826  *     Invoked by: Common Scheduler. SC1 does nothing.
3827  *     
3828  *  @param[in]  RgSchCellCb        *cell
3829  *  @param[in]  RgSchUeCb          *ue
3830  *  @param[in]  TfuDlCqiRpt        *dlCqiRpt
3831  *  @return  Void
3832  *
3833  **/
3834 #ifdef ANSI
3835 PUBLIC Void rgSCHSc1DlCqiInd
3836 (
3837 RgSchCellCb        *cell,
3838 RgSchUeCb          *ue,
3839 Bool               isPucchInfo,
3840 Void               *dlCqi
3841 )
3842 #else
3843 PUBLIC Void rgSCHSc1DlCqiInd(cell, ue, isPucchInfo, dlCqi)
3844 RgSchCellCb        *cell;
3845 RgSchUeCb          *ue;
3846 Bool               isPucchInfo;
3847 Void               *dlCqi;
3848 #endif
3849 {
3850    TRC2(rgSCHSc1DlCqiInd);
3851    RETVOID;
3852 }
3853
3854 \f
3855 /**
3856  * @brief This function adds a service to UE's list of lcsWithData. 
3857  *
3858  * @details
3859  *
3860  *     Function: rgSCHSc1DlAdd2UeLcsWithData
3861  *     Purpose:  1. This is to maintain a snapshot view of the 
3862  *               DL SVCs distributions among the cellwide priority
3863  *               queues. 
3864  *               2. This snapshot view is maintained in the order 
3865  *               of priority of the SVCs with in UE.
3866  *               3. Addition of SVC to a cellwide priority Queue
3867  *                  triggers this function.
3868  *     
3869  *     Invoked by: Functions of DL SC1 which add SVC or UE(for ambr svc)
3870  *                 to cellwide priority Queues.
3871  *     
3872  *  @param[in]  RgSchUeCb*    ue   
3873  *  @param[in]  RgSchDlLcCb*  svc 
3874  *  @return  Void
3875  *
3876  **/
3877 #ifdef ANSI
3878 PRIVATE Void rgSCHSc1DlAdd2UeLcsWithData
3879 (
3880 RgSchCellCb                *cell,
3881 RgSchUeCb                  *ue,
3882 RgSchDlLcCb                *svc
3883 )
3884 #else
3885 PRIVATE Void rgSCHSc1DlAdd2UeLcsWithData(cell, ue, svc)
3886 RgSchCellCb                *cell;
3887 RgSchUeCb                  *ue;
3888 RgSchDlLcCb                *svc;
3889 #endif
3890 {
3891    CmLListCp            *lst;
3892    CmLList              *node;
3893    RgSchCmnDlSvc        *cmnDlSvc = RG_SCH_CMN_GET_DL_SVC(svc);
3894    RgSchSc1DlSvc        *sc1DlSvc = RG_GET_SC1_SVC_DL(ue,svc,cell);
3895    RgSchSc1DlUe         *sc1DlUe  = RG_GET_SC1_UE_DL(ue, cell);
3896    RgSchCmnDlSvc        *cmnDlLstSvc;
3897
3898    TRC2(rgSCHSc1DlAdd2UeLcsWithData);
3899    
3900    lst  = &(sc1DlUe->lcsWithData);
3901    node = lst->first;
3902    while(node)
3903    {
3904       cmnDlLstSvc = RG_SCH_CMN_GET_DL_SVC(((RgSchDlLcCb *)(node->node)));
3905       if (cmnDlSvc->prio <= cmnDlLstSvc->prio)
3906       {
3907          break;
3908       }
3909       node = node->next;
3910    }
3911    if (node == NULLP)
3912    {
3913       cmLListAdd2Tail(lst, &sc1DlSvc->lcWithDataLnk);
3914       sc1DlSvc->lcWithDataLnk.node = (PTR)svc;
3915    }
3916    else
3917    {
3918       lst->crnt = node;
3919       cmLListInsCrnt(lst, &sc1DlSvc->lcWithDataLnk);
3920       sc1DlSvc->lcWithDataLnk.node = (PTR)svc;
3921    }
3922    RETVOID;
3923 }
3924
3925 \f
3926 /**
3927  * @brief This function adds a service to UE's list of lcsWithData. 
3928  *
3929  * @details
3930  *
3931  *     Function: rgSCHSc1DlRmFrmUeLcsWithData
3932  *     Purpose:  1. This is to maintain a snapshot view of the 
3933  *               DL SVCs distributions among the cellwide priority
3934  *               queues. 
3935  *               2. This snapshot view is maintained in the order 
3936  *               of priority of the SVCs with in UE.
3937  *               3. Addition of SVC to a cellwide priority Queue
3938  *                  triggers this function.
3939  *     
3940  *     Invoked by: Functions of DL SC1 which add SVC or UE(for ambr svc)
3941  *                 to cellwide priority Queues.
3942  *     
3943  *  @param[in]  RgSchUeCb*    ue   
3944  *  @param[in]  RgSchDlLcCb*  svc 
3945  *  @return  Void
3946  *
3947  **/
3948 #ifdef ANSI
3949 PRIVATE Void rgSCHSc1DlRmFrmUeLcsWithData
3950 (
3951 RgSchCellCb                *cell,
3952 RgSchUeCb                  *ue,
3953 RgSchDlLcCb                *svc
3954 )
3955 #else
3956 PRIVATE Void rgSCHSc1DlRmFrmUeLcsWithData(cell, ue, svc)
3957 RgSchCellCb                *cell;
3958 RgSchUeCb                  *ue;
3959 RgSchDlLcCb                *svc;
3960 #endif
3961 {
3962    RgSchSc1DlSvc        *sc1DlSvc = RG_GET_SC1_SVC_DL(ue,svc,cell);
3963    RgSchSc1DlUe         *sc1DlUe  = RG_GET_SC1_UE_DL(ue, cell);
3964
3965    TRC2(rgSCHSc1DlRmFrmUeLcsWithData);
3966    
3967    cmLListDelFrm(&(sc1DlUe->lcsWithData), &sc1DlSvc->lcWithDataLnk);
3968    sc1DlSvc->lcWithDataLnk.node = NULLP;
3969    RETVOID;
3970 }
3971 /***************** SC1 DL SCHEDULER FUNCTION DEFNs END HERE ****************/
3972
3973 /***************************************************************************/
3974
3975 /***************** SC1 UL SCHEDULER FUNCTION DEFNs START HERE **************/
3976
3977 /*--------------------------*
3978  * UL specific functions START
3979  *---------------------------*/
3980
3981 /**
3982  * @brief UE Lc Config for RR 
3983  *
3984  * @details
3985  *
3986  *     Function : rgSCHSc1UlLchCfg
3987  *
3988  *     Processing Steps:  Dummy function
3989  *
3990  *  @param[in]  RgrSchCellCb     *cell
3991  *  @param[in]  RgSchUeCb        *ue
3992  *  @param[in]  RgrLchCfg        *cfg 
3993  *  @param[in]  RgSchErrInfo     *err 
3994  *  @return  S16
3995  *      -# ROK
3996  **/
3997 PUBLIC S16 rgSCHSc1UlLchCfg 
3998 (
3999 RgSchCellCb      *cell,
4000 RgSchUeCb        *ue,
4001 RgrLchCfg        *cfg,
4002 RgSchErrInfo     *err
4003 )
4004 {
4005    RETVALUE(ROK);
4006 }
4007 /**
4008  * @brief UE Lc Reconfig for RR 
4009  *
4010  * @details
4011  *
4012  *     Function : rgSCHSc1UlLchRecfg
4013  *
4014  *     Processing Steps:  Dummy function
4015  *
4016  *  @param[in]  RgrSchCellCb     *cell
4017  *  @param[in]  RgSchUeCb        *ue
4018  *  @param[in]  RgrLchRecfg      *recfg 
4019  *  @param[in]  RgSchErrInfo     *err 
4020  *  @return  S16
4021  *      -# ROK
4022  **/
4023 PUBLIC S16 rgSCHSc1UlLchRecfg 
4024 (
4025 RgSchCellCb      *cell,
4026 RgSchUeCb        *ue,
4027 RgrLchRecfg      *recfg,
4028 RgSchErrInfo     *err
4029 )
4030 {
4031    RETVALUE(ROK);
4032 }
4033 /**
4034  * @brief LC deletion for PFS
4035  *
4036  * @details
4037  *
4038  *     Function : rgSCHSc1UlLchDel
4039  *
4040  *     Processing Steps: Dummy function
4041  *
4042  *  @param[in]  RgrSchCellCb     *cell
4043  *  @param[in]  RgSchUeCb        *ue
4044  *  @param[in]  CmLteLcId        lcId
4045  *  @return  S16
4046  *      -# ROK
4047  **/
4048 #ifdef ANSI
4049 PUBLIC S16 rgSCHSc1UlLchDel
4050 (
4051 RgSchCellCb      *cell,
4052 RgSchUeCb        *ue,
4053 CmLteLcId        lcId,
4054 U8               lcgId
4055 )
4056 #else
4057 PUBLIC S16 rgSCHRrUlLchDel(cell, ue, lcId, lcgId)
4058 RgSchCellCb      *cell;
4059 RgSchUeCb        *ue;
4060 CmLteLcId        lcId;
4061 U8               lcgId;
4062 #endif
4063 {
4064   RETVALUE (ROK);
4065 }
4066 \f
4067 /**
4068  * @brief This function initializes all the data for the scheduler
4069  *
4070  * @details
4071  *
4072  *     Function: rgSCHSc1UlInit
4073  *     Purpose:  This function initializes the following information
4074  *               1. Efficiency table
4075  *               2. CQI to table index - It is one row for upto 3 RBs
4076  *                  and another row for greater than 3 RBs
4077  *     
4078  *               currently extended prefix is compiled out.
4079  *     Invoked by: MAC intialization code..may be ActvInit
4080  *     
4081  *  @return  Void
4082  *
4083  **/
4084 #ifdef ANSI
4085 PUBLIC Void rgSCHSc1UlInit
4086 (
4087 RgUlSchdApis *rgSchUlApis
4088 )
4089 #else
4090 PUBLIC Void rgSCHSc1UlInit(rgSchUlApis)
4091 RgUlSchdApis *rgSchUlApis;
4092 #endif
4093 {
4094    TRC2(rgSCHSc1UlInit);
4095    /* Init the function pointers */
4096    rgSchUlApis->rgSCHRgrUlUeCfg     = rgSCHSc1RgrUlUeCfg;
4097    rgSchUlApis->rgSCHRgrUlUeRecfg   = rgSCHSc1RgrUlUeRecfg;
4098    rgSchUlApis->rgSCHFreeUlUe       = rgSCHSc1UlUeDel;
4099    rgSchUlApis->rgSCHRgrUlCellCfg   = rgSCHSc1RgrUlCellCfg;
4100    rgSchUlApis->rgSCHRgrUlCellRecfg = rgSCHSc1RgrUlCellRecfg; 
4101    rgSchUlApis->rgSCHFreeUlCell     = rgSCHSc1UlCellDel;
4102    rgSchUlApis->rgSCHRgrUlLcCfg     = rgSCHSc1UlLchCfg;
4103    rgSchUlApis->rgSCHRgrUlLcRecfg   = rgSCHSc1UlLchRecfg;
4104    rgSchUlApis->rgSCHRgrUlLcgCfg    = rgSCHSc1RgrLcgCfg;
4105    rgSchUlApis->rgSCHRgrUlLcgRecfg  = rgSCHSc1RgrLcgRecfg;
4106    rgSchUlApis->rgSCHFreeUlLcg      = rgSCHSc1LcgDel;
4107    rgSchUlApis->rgSCHRgrUlLchDel    = rgSCHSc1UlLchDel;
4108    rgSchUlApis->rgSCHUlSched        = rgSCHSc1UlSched;
4109    rgSchUlApis->rgSCHUpdBsrShort    = rgSCHSc1UpdBsrShort;
4110    rgSchUlApis->rgSCHUpdBsrTrunc    = rgSCHSc1UpdBsrTrunc;
4111    rgSchUlApis->rgSCHUpdBsrLong     = rgSCHSc1UpdBsrLong;
4112    rgSchUlApis->rgSCHContResUlGrant = rgSCHSc1ContResUlGrant;
4113    rgSchUlApis->rgSCHSrRcvd         = rgSCHSc1SrRcvd;
4114    rgSchUlApis->rgSCHUlCqiInd       = rgSCHSc1UlCqiInd;
4115    rgSchUlApis->rgSCHUlUeRefresh    = rgSCHSc1UlUeRefresh;
4116    rgSchUlApis->rgSCHUlAllocFnlz    = rgSCHSc1UlAllocFnlz;
4117    rgSchUlApis->rgSCHUlInactvtUes   = rgSCHSc1UlHndlInActUes;
4118    rgSchUlApis->rgSCHUlActvtUe      = rgSCHSc1UlActvtUe;
4119    rgSchUlApis->rgSCHUlUeReset      = rgSCHSc1UlUeReset;
4120    rgSchUlApis->rgSCHRgrUlLcgUpd    = rgSCHSc1UlLcgUpd;
4121    RETVOID;
4122 }
4123
4124 /**
4125  * @brief UE initialisation for scheduler
4126  *
4127  * @details
4128  *
4129  *     Function : rgSCHSc1RgrUlUeCfg
4130  *     
4131  *     This functions intialises UE specific scheduler
4132  *     information
4133  *
4134  *  @param[in]  RgSchCellCb  *cell
4135  *  @param[in]  RgSchUeCb    *ue
4136  *  @param[int] RgrUeCfg     *ueCfg
4137  *  @param[out] RgSchErrInfo *err
4138  *  @return  S16
4139  *      -# ROK 
4140  *      -# RFAILED 
4141  **/
4142 #ifdef ANSI
4143 PUBLIC S16 rgSCHSc1RgrUlUeCfg
4144 (
4145 RgSchCellCb  *cell,
4146 RgSchUeCb    *ue,
4147 RgrUeCfg     *ueCfg,
4148 RgSchErrInfo *err
4149 )
4150 #else
4151 PUBLIC S16 rgSCHSc1RgrUlUeCfg(cell, ue, ueCfg, err)
4152 RgSchCellCb  *cell;
4153 RgSchUeCb    *ue;
4154 RgrUeCfg     *ueCfg;
4155 RgSchErrInfo *err;
4156 #endif
4157 {
4158   
4159    RgSchCmnUe *ueSchCmn = RG_SCH_CMN_GET_UE(ue, cell);
4160    TRC2(rgSCHSc1RgrUlUeCfg);
4161
4162    if(rgSCHUtlAllocSBuf(cell->instIdx, 
4163       (Data**)&(ueSchCmn->ul.schSpfc), (sizeof(RgSchSc1UlUe))) != ROK)
4164    {
4165       RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
4166       "Memory allocation FAILED CRNTI:%d",ue->ueId);
4167       err->errCause = RGSCHERR_SCH_SC1_UL_CFG;
4168       RETVALUE(RFAILED);
4169    }
4170
4171    RETVALUE(ROK);
4172 }  /* rgSCHSc1RgrUlUeCfg */
4173
4174 /**
4175  * @brief UE reconfiguration for scheduler
4176  *
4177  * @details
4178  *
4179  *     Function : rgSCHSc1RgrUlUeRecfg
4180  *     
4181  *     This functions updates UE specific scheduler
4182  *     information upon UE reconfiguration
4183  *
4184  *  @param[in]  RgSchCellCb  *cell
4185  *  @param[in]  RgSchUeCb    *ue
4186  *  @param[int] RgrUeRecfg   *ueRecfg
4187  *  @param[out] RgSchErrInfo *err
4188  *  @return  S16
4189  *      -# ROK 
4190  *      -# RFAILED 
4191  **/
4192 #ifdef ANSI
4193 PUBLIC S16 rgSCHSc1RgrUlUeRecfg
4194 (
4195 RgSchCellCb  *cell,
4196 RgSchUeCb    *ue,
4197 RgrUeRecfg   *ueRecfg,
4198 RgSchErrInfo *err
4199 )
4200 #else
4201 PUBLIC S16 rgSCHSc1RgrUlUeRecfg(cell, ue, ueRecfg, err)
4202 RgSchCellCb  *cell;
4203 RgSchUeCb    *ue;
4204 RgrUeRecfg   *ueRecfg;
4205 RgSchErrInfo *err;
4206 #endif
4207 {
4208    TRC2(rgSCHSc1RgrUlUeRecfg);
4209    RETVALUE(ROK);
4210 }  /* rgSCHSc1RgrUeRecfg */
4211
4212 /**
4213  * @brief UE deletion for scheduler
4214  *
4215  * @details
4216  *
4217  *     Function : rgSCHSc1UlUeDel
4218  *     
4219  *     This functions deletes all scheduler information
4220  *     pertaining to a UE
4221  *
4222  *  @param[in]  RgSchCellCb  *cell
4223  *  @param[in]  RgSchUeCb    *ue
4224  *  @return  Void
4225  **/
4226 #ifdef ANSI
4227 PUBLIC Void rgSCHSc1UlUeDel
4228 (
4229 RgSchCellCb  *cell,
4230 RgSchUeCb    *ue
4231 )
4232 #else
4233 PUBLIC Void rgSCHSc1UlUeDel(cell, ue)
4234 RgSchCellCb  *cell;
4235 RgSchUeCb    *ue;
4236 #endif
4237 {
4238    RgSchSc1UlCell *cellUl = RG_GET_SC1_CELL_UL(cell);
4239    RgSchSc1UlUe   *ueUl   = RG_GET_SC1_UE_UL(ue, cell);
4240    
4241    TRC2(rgSCHSc1UlUeDel);
4242
4243    if (ueUl == NULLP)
4244    {
4245       RETVOID;
4246    }
4247    if(ueUl->txLnk.node)
4248    {
4249       cmLListDelFrm(&(cellUl->ueTxLst[ueUl->qId]), &(ueUl->txLnk));
4250       ueUl->txLnk.node = NULLP;
4251    }
4252    if(ueUl->contResLnk.node)
4253    {
4254       cmLListDelFrm(&(cellUl->contResLst), &(ueUl->contResLnk));
4255       ueUl->contResLnk.node = NULLP;
4256    }
4257    /* ccpu00117052 - MOD - Passing double pointer
4258    for proper NULLP assignment*/
4259    rgSCHUtlFreeSBuf(cell->instIdx,
4260       (Data**)(&(ueUl)), (sizeof(RgSchSc1UlUe)));
4261
4262    RETVOID;
4263 }  /* rgSCHSc1UlUeDel */
4264
4265 /**
4266  * @brief UE Reset for scheduler
4267  *
4268  * @details
4269  *
4270  *     Function : rgSCHSc1UlUeReset
4271  *     
4272  *     Remove this UE from all Scheduling Priority Qs
4273  *
4274  *  @param[in]  RgSchCellCb  *cell
4275  *  @param[in]  RgSchUeCb    *ue
4276  *  @return  Void
4277  **/
4278 #ifdef ANSI
4279 PUBLIC Void rgSCHSc1UlUeReset 
4280 (
4281 RgSchCellCb  *cell,
4282 RgSchUeCb    *ue
4283 )
4284 #else
4285 PUBLIC Void rgSCHSc1UlUeReset(cell, ue)
4286 RgSchCellCb  *cell;
4287 RgSchUeCb    *ue;
4288 #endif
4289 {
4290    RgSchSc1UlCell *cellUl = RG_GET_SC1_CELL_UL(cell);
4291    RgSchSc1UlUe   *ueUl   = RG_GET_SC1_UE_UL(ue, cell);
4292    
4293    TRC2(rgSCHSc1UlUeReset);
4294
4295    ueUl->srRcvd = FALSE;
4296
4297    if(ueUl->txLnk.node)
4298    {
4299       cmLListDelFrm(&(cellUl->ueTxLst[ueUl->qId]), &(ueUl->txLnk));
4300       ueUl->txLnk.node = NULLP;
4301    }
4302    if(ueUl->contResLnk.node)
4303    {
4304       cmLListDelFrm(&(cellUl->contResLst), &(ueUl->contResLnk));
4305       ueUl->contResLnk.node = NULLP;
4306    }
4307    RETVOID;
4308 }  /* rgSCHSc1UlUeReset */
4309
4310 \f
4311 /**
4312  * @brief Scheduler processing on cell configuration
4313  *
4314  * @details
4315  *
4316  *     Function : rgSCHSc1RgrUlCellCfg
4317  *     
4318  *     This function does requisite initialisation 
4319  *     and setup for scheduler1 when a cell is
4320  *     configured
4321  *
4322  *  @param[in]  RgSchCellCb   *cell
4323  *  @param[in]  RgrCellCfg    *cellCfg
4324  *  @param[out] RgSchErrInfo  *err
4325  *  @return  S16
4326  *      -# ROK 
4327  *      -# RFAILED 
4328  **/
4329 #ifdef ANSI
4330 PUBLIC S16 rgSCHSc1RgrUlCellCfg
4331 (
4332 RgSchCellCb   *cell,
4333 RgrCellCfg    *cellCfg,
4334 RgSchErrInfo  *err
4335 )
4336 #else
4337 PUBLIC S16 rgSCHSc1RgrUlCellCfg(cell, cellCfg, err)
4338 RgSchCellCb   *cell;
4339 RgrCellCfg    *cellCfg;
4340 RgSchErrInfo  *err;
4341 #endif
4342 {
4343    RgSchSc1UlCell     *cellUl; 
4344
4345    TRC2(rgSCHSc1RgrUlCellCfg);
4346
4347    if((rgSCHUtlAllocSBuf(cell->instIdx, 
4348       (Data**)&(((RgSchCmnCell*)((cell)->sc.sch))->ul.schSpfc), \
4349       (sizeof(RgSchSc1UlCell))) != ROK))
4350    {
4351       RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,
4352       "Memory allocation FAILED");
4353       err->errCause = RGSCHERR_SCH_SC1_UL_CFG;
4354       RETVALUE(RFAILED);
4355    }
4356    cellUl = RG_GET_SC1_CELL_UL(cell);
4357    cmLListInit(&cellUl->contResLst);
4358    cmLListInit(&cellUl->ueTxLst[0]);
4359    cmLListInit(&cellUl->ueTxLst[1]);
4360
4361    RETVALUE(ROK);
4362 }  /* rgSCHSc1RgrUlCellCfg */
4363
4364 \f
4365 /**
4366  * @brief This function handles the reconfiguration of cell 
4367  *
4368  * @details
4369  *
4370  *     Function: rgSCHSc1RgrUlCellRecfg
4371  *     Purpose:  Update the reconfiguration parameters.
4372  *     
4373  *     Invoked by: Scheduler
4374  *     
4375  *  @param[in]  RgSchCellCb*  cell
4376  *  @return  Void
4377  *
4378  **/
4379 #ifdef ANSI
4380 PUBLIC S16 rgSCHSc1RgrUlCellRecfg
4381 (
4382 RgSchCellCb             *cell,
4383 RgrCellRecfg            *recfg,
4384 RgSchErrInfo            *err
4385 )
4386 #else
4387 PUBLIC S16 rgSCHSc1RgrUlCellRecfg(cell, recfg, err)
4388 RgSchCellCb             *cell;
4389 RgrCellRecfg            *recfg;
4390 RgSchErrInfo            *err;
4391 #endif
4392 {
4393    TRC2(rgSCHSc1RgrUlCellRecfg);
4394    RETVALUE(ROK);
4395 }
4396
4397 /**
4398  * @brief Scheduler processing for cell delete
4399  *
4400  * @details
4401  *
4402  *     Function : rgSCHSc1UlCellDel
4403  *     
4404  *     This functions de-initialises and frees memory
4405  *     taken up by scheduler1 for the entire cell.
4406  *
4407  *  @param[in]  RgSchCellCb  *cell
4408  *  @return  Void
4409  **/
4410 #ifdef ANSI
4411 PUBLIC Void rgSCHSc1UlCellDel
4412 (
4413 RgSchCellCb  *cell
4414 )
4415 #else
4416 PUBLIC Void rgSCHSc1UlCellDel(cell)
4417 RgSchCellCb  *cell;
4418 #endif
4419 {
4420    RgSchSc1UlCell *cellUl = RG_GET_SC1_CELL_UL(cell);
4421
4422    TRC2(rgSCHSc1UlCellDel);
4423
4424    if (cellUl == NULLP)
4425    {
4426       RETVOID;
4427    }
4428    /* ccpu00117052 - MOD - Passing double pointer
4429    for proper NULLP assignment*/
4430    rgSCHUtlFreeSBuf(cell->instIdx,
4431       (Data**)(&(cellUl)), (sizeof(RgSchSc1UlCell)));
4432
4433    RETVOID;
4434 }  /* rgSCHSc1UlCellDel */
4435
4436 /**
4437  * @brief Scheduler invocation on logical channel Group addition
4438  *
4439  * @details
4440  *
4441  *     Function : rgSCHSc1RgrLcgCfg
4442  *     
4443  *     This functions does required processing when a new
4444  *     (dedicated) logical channel is added. Assumes lcg
4445  *     pointer in ulLc is set.
4446  *
4447  *  @param[in]  RgSchCellCb  *cell
4448  *  @param[in]  RgSchUeCb    *ue
4449  *  @param[in]  RgSchLcgCb   *lcg
4450  *  @param[int] RgrLcgCfg    *lcgCfg
4451  *  @param[out] RgSchErrInfo *err
4452  *  @return  S16
4453  *      -# ROK 
4454  *      -# RFAILED 
4455  **/
4456 #ifdef ANSI
4457 PUBLIC S16 rgSCHSc1RgrLcgCfg
4458 (
4459 RgSchCellCb  *cell,
4460 RgSchUeCb    *ue,
4461 RgSchLcgCb   *lcg,
4462 RgrLcgCfg    *lcgCfg,
4463 RgSchErrInfo *err
4464 )
4465 #else
4466 PUBLIC S16 rgSCHSc1RgrLcgCfg(cell, ue, lcg, lcgCfg, err)
4467 RgSchCellCb  *cell;
4468 RgSchUeCb    *ue;
4469 RgSchLcgCb   *lcg;
4470 RgrLcgCfg    *lcgCfg;
4471 RgSchErrInfo *err;
4472 #endif
4473 {
4474    TRC2(rgSCHSc1RgrLcgCfg);
4475    RETVALUE(ROK);
4476 }  /* rgSCHSc1RgrLcgCfg */
4477
4478 /**
4479  * @brief Scheduler invocation on logical channel addition
4480  *
4481  * @details
4482  *
4483  *     Function : rgSCHSc1RgrLcgRecfg
4484  *     
4485  *     This functions does required processing when an existing
4486  *     (dedicated) logical channel is reconfigured. Assumes lcg
4487  *     pointer in ulLc is set to the old value.
4488  *     Independent of whether new LCG is meant to be configured,
4489  *     the new LCG scheduler info is accessed and possibly modified.
4490  *
4491  *  @param[in]  RgSchCellCb  *cell,
4492  *  @param[in]  RgSchUeCb    *ue,
4493  *  @param[in]  RgSchLcgCb   *lcg,
4494  *  @param[in]  RgrLcgRecfg  *reCfg,
4495  *  @param[out] RgSchErrInfo *err
4496  *  @return  S16
4497  *      -# ROK 
4498  *      -# RFAILED 
4499  **/
4500 #ifdef ANSI
4501 PUBLIC S16 rgSCHSc1RgrLcgRecfg
4502 (
4503 RgSchCellCb  *cell,
4504 RgSchUeCb    *ue,
4505 RgSchLcgCb   *lcg,
4506 RgrLcgRecfg  *reCfg,
4507 RgSchErrInfo *err
4508 )
4509 #else
4510 PUBLIC S16 rgSCHSc1RgrLcgRecfg(cell, ue, lcg, reCfg, err)
4511 RgSchCellCb  *cell;
4512 RgSchUeCb    *ue;
4513 RgSchLcgCb   *lcg;
4514 RgrLcgRecfg  *reCfg;
4515 RgSchErrInfo *err;
4516 #endif
4517 {
4518    TRC2(rgSCHSc1RgrLcgRecfg);
4519    RETVALUE(ROK);
4520 }  /* rgSCHSc1RgrLcgRecfg */
4521
4522 /***********************************************************
4523  *
4524  *     Func : rgSCHSc1LcgDel
4525  *        
4526  *     Desc : Scheduler handling for a (dedicated)
4527  *             uplink lcg being deleted
4528  *
4529  *     Ret  : 
4530  *
4531  *     Notes: 
4532  *
4533  *     File : 
4534  *
4535  **********************************************************/
4536 #ifdef ANSI
4537 PUBLIC Void rgSCHSc1LcgDel
4538 (
4539 RgSchCellCb   *cell,
4540 RgSchUeCb     *ue,
4541 RgSchLcgCb    *lcg
4542 )
4543 #else
4544 PUBLIC Void rgSCHSc1LcgDel(cell, ue, lcg)
4545 RgSchCellCb   *cell;
4546 RgSchUeCb     *ue;
4547 RgSchLcgCb    *lcg;
4548 #endif
4549 {
4550    TRC2(rgSCHSc1LcgDel);
4551    rgSCHSc1UlPosnUeInQ(cell, ue);
4552    RETVOID;
4553 }
4554
4555 /**
4556  * @brief Perform alloction for this UE 
4557  *
4558  * @details
4559  *
4560  *     Function : rgSCHSc1UlSchdUe
4561  *
4562  *     Processing Steps: cater to as much as UE needs, with 
4563  *     a limitation on maxBits per scheduling instance(per TTI)
4564  *     per UE. Return failure, if UE is not considered 
4565  *     for scheduling (case, where it is already selected for a
4566  *     retransmission).
4567  *                   
4568  *
4569  *  @param[in]  RgSchUeCb        *ue
4570  *  @return  Void
4571  **/
4572 #ifdef ANSI
4573 PRIVATE Void rgSCHSc1UlSchdUe
4574 (
4575 RgSchUeCb         *ue,
4576 RgSchCellCb       *cell
4577 )
4578 #else
4579 PRIVATE Void rgSCHSc1UlSchdUe(ue,cell)
4580 RgSchUeCb         *ue;
4581 RgSchCellCb       *cell;
4582 #endif
4583 {
4584    RgSchCmnUlUe      *cmnUlUe = RG_SCH_CMN_GET_UL_UE(ue, cell);
4585                                 /*cell added as part of CA dev*/
4586    RgSchSc1UlUe      *ulUe    = RG_GET_SC1_UE_UL(ue, cell);
4587
4588    TRC2(rgSCHSc1UlSchdUe);
4589
4590    if(ulUe->srRcvd == TRUE)
4591    {
4592       cmnUlUe->alloc.reqBytes = RGSCH_MAX(RG_SCH_CMN_UL_SR_BYTES, \
4593                                 ue->ul.effBsr);
4594       RETVOID;
4595    }
4596
4597    cmnUlUe->alloc.reqBytes = ue->ul.effBsr;
4598
4599    RETVOID;
4600 }
4601
4602 /**
4603  * @brief Scheduler invocation
4604  *
4605  * @details
4606  *
4607  *     Function: rgSCHSc1UlSchdForDataTrans
4608  *     Purpose:  Uplink Scheduling for UE data Transmission.
4609  *
4610  *     
4611  *     Invoked by: Scheduler
4612  *     
4613  *  @param[in]  RgSchCellCb           *cell
4614  *  @param[out] RgSchCmnUlRbAllocInfo *allocInfo 
4615  *  @param[in] U8                     remUe 
4616  *  @return Void 
4617  **/
4618 #ifdef ANSI
4619 PRIVATE Void rgSCHSc1UlSchdForDataTrans
4620 (
4621 RgSchCellCb           *cell,
4622 RgSchCmnUlRbAllocInfo *allocInfo,
4623 U8                    remUe
4624 )
4625 #else
4626 PRIVATE Void rgSCHSc1UlSchdForDataTrans(cell, allocInfo, remUe)
4627 RgSchCellCb           *cell;
4628 RgSchCmnUlRbAllocInfo *allocInfo;
4629 U8                    remUe;
4630 #endif
4631 {
4632    RgSchSc1UlCell    *sc1UlCell  = RG_GET_SC1_CELL_UL(cell);
4633
4634    TRC2(rgSCHSc1UlSchdForDataTrans);
4635
4636    if (remUe == 0)
4637    {
4638       RETVOID;
4639    }
4640    /* Allocate UEs with LCG0 data pending */
4641    rgSCHSc1UlSchdUeTxLst(cell, &sc1UlCell->ueTxLst[0], allocInfo, &remUe);
4642
4643    if (remUe == 0)
4644    {
4645       RETVOID;
4646    }
4647    /* Allocate UEs with other LCGs data pending */
4648    rgSCHSc1UlSchdUeTxLst(cell, &sc1UlCell->ueTxLst[1], allocInfo, &remUe);
4649
4650    RETVOID;
4651 }
4652
4653 /**
4654  * @brief Scheduler invocation
4655  *
4656  * @details
4657  *
4658  *     Function: rgSCHSc1UlSchdUeTxLst
4659  *     Purpose:  Uplink Scheduling for UE data Transmission.
4660  *
4661  *     
4662  *     Invoked by: Scheduler
4663  *     
4664  *  @param[in]  CmLListCp             *ueTxLst
4665  *  @param[out] RgSchCmnUlRbAllocInfo *allocInfo 
4666  *  @param[in] U8                     *remUe 
4667  *  @return Void 
4668  **/
4669 #ifdef ANSI
4670 PRIVATE Void rgSCHSc1UlSchdUeTxLst
4671 (
4672 RgSchCellCb           *cell,
4673 CmLListCp             *ueTxLst,
4674 RgSchCmnUlRbAllocInfo *allocInfo,
4675 U8                    *remUe
4676 )
4677 #else
4678 PRIVATE Void rgSCHSc1UlSchdUeTxLst(cell, ueTxLst, allocInfo, remUe)
4679 RgSchCellCb           *cell;
4680 CmLListCp             *ueTxLst;
4681 RgSchCmnUlRbAllocInfo *allocInfo;
4682 U8                    *remUe;
4683 #endif
4684 {
4685    RgSchUeCb         *ue;
4686    CmLList           *node;
4687 #ifdef LTEMAC_HDFDD
4688    Bool              ulAllowed = FALSE;
4689 #endif
4690
4691    TRC2(rgSCHSc1UlSchdUeTxLst);
4692
4693    node = ueTxLst->first;
4694    while ((node) && (*remUe))
4695    {
4696       ue = (RgSchUeCb *)node->node;
4697       node = node->next;
4698 #ifdef LTEMAC_HDFDD
4699       if (ue->hdFddEnbld)
4700       {
4701          rgSCHCmnHdFddChkUlAllow (cell, ue, &ulAllowed);
4702          if (ulAllowed == FALSE)
4703          {
4704             continue;
4705          }
4706       }
4707 #endif
4708
4709       if (RG_SCH_CMN_IS_UL_UE_RETX(ue, cell))
4710       {
4711          /* UE already scheduled in this subframe (for retx) 
4712           * OR is inactive for UL Transmission.*/
4713          continue;
4714       }
4715       /* Added support for SPS*/
4716 #ifdef LTEMAC_SPS
4717          else if (RG_SCH_CMN_IS_SPS_SCHD(ue, cell))
4718          {
4719             /*-- Already Scheduled by SPS --*/
4720            continue;
4721          }
4722 #endif
4723
4724       rgSCHSc1UlSchdUe(ue,cell);/*cell added as part of CA dev*/
4725
4726       rgSCHCmnUlAdd2UeLst(cell, allocInfo, ue);
4727
4728       --(*remUe);
4729    }
4730
4731    RETVOID;
4732 }
4733
4734 /**
4735  * @brief Scheduler invocation
4736  *
4737  * @details
4738  *
4739  *     Function: rgSCHSc1UlSchdForContRes
4740  *     Purpose:  Uplink Scheduling for Contention Resolution.
4741  *
4742  *     
4743  *     Invoked by: Scheduler
4744  *     
4745  *  @param[in]  RgSchCellCb           *cell
4746  *  @param[out] RgSchCmnUlRbAllocInfo *allocInfo 
4747  *  @param[out] U8                    *remUe 
4748  *  @return Void 
4749  **/
4750 #ifdef ANSI
4751 PRIVATE Void rgSCHSc1UlSchdForContRes
4752 (
4753 RgSchCellCb           *cell,
4754 RgSchCmnUlRbAllocInfo *allocInfo,
4755 U8                    *remUe
4756 )
4757 #else
4758 PRIVATE Void rgSCHSc1UlSchdForContRes(cell, allocInfo, remUe)
4759 RgSchCellCb           *cell;
4760 RgSchCmnUlRbAllocInfo *allocInfo;
4761 U8                    *remUe;
4762 #endif
4763 {
4764    RgSchSc1UlCell    *sc1UlCell  = RG_GET_SC1_CELL_UL(cell);
4765    RgSchUeCb         *ue;
4766    CmLList           *node;
4767    RgSchCmnUlUe      *cmnUlUe;
4768 #ifdef LTEMAC_HDFDD
4769    Bool                 ulAllowed = FALSE;
4770 #endif
4771
4772    TRC2(rgSCHSc1UlSchdForContRes);
4773
4774    node = sc1UlCell->contResLst.first;
4775    while ((node) && (*remUe))
4776    {
4777       ue = (RgSchUeCb *)node->node;
4778       cmnUlUe = RG_SCH_CMN_GET_UL_UE(ue, cell);
4779                 /*cell added as part of CA dev*/
4780       node = node->next;
4781 #ifdef LTEMAC_HDFDD
4782       if (ue->hdFddEnbld)
4783       {
4784          rgSCHCmnHdFddChkUlAllow (cell, ue,  &ulAllowed);
4785          if (ulAllowed == FALSE)
4786          {
4787             continue;
4788          }
4789       }
4790 #endif
4791       if (RG_SCH_CMN_IS_UL_UE_RETX(ue, cell))
4792       {
4793          /* UE already scheduled in this subframe (for retx) 
4794           * OR is inactive for UL Transmission.*/
4795          continue;
4796       }
4797       cmnUlUe->alloc.reqBytes = RG_SCH_CMN_MAX_UL_CONTRES_GRNT;
4798       rgSCHCmnUlAdd2CntResLst(allocInfo, ue);
4799       --(*remUe);
4800       /* Node removal deferred to ULAllocFinalization */
4801    }
4802
4803    RETVOID;
4804 }
4805
4806 /**
4807  * @brief Scheduler invocation
4808  *
4809  * @details
4810  *
4811  *     Function: rgSCHSc1UlNewTx
4812  *     Purpose:  Uplink Scheduling for New Transmissions.
4813  *
4814  *     
4815  *     Invoked by: Scheduler
4816  *     
4817  *  @param[in]  RgSchCellCb           *cell
4818  *  @param[out] RgSchCmnUlRbAllocInfo *allocInfo 
4819  *  @return Void 
4820  **/
4821 #ifdef ANSI
4822 PRIVATE Void rgSCHSc1UlNewTx
4823 (
4824 RgSchCellCb           *cell,
4825 RgSchCmnUlRbAllocInfo *allocInfo
4826 )
4827 #else
4828 PRIVATE Void rgSCHSc1UlNewTx(cell, allocInfo)
4829 RgSchCellCb           *cell;
4830 RgSchCmnUlRbAllocInfo *allocInfo;
4831 #endif
4832 {
4833    RgSchCmnUlCell  *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
4834    U8               remUe = cellUl->maxUeNewTxPerTti;
4835
4836    TRC2(rgSCHSc1UlNewTx);
4837
4838    rgSCHSc1UlSchdForContRes(cell, allocInfo, &remUe);
4839    rgSCHSc1UlSchdForDataTrans(cell, allocInfo, remUe);
4840    RETVOID;
4841 }
4842
4843 /**
4844  * @brief Scheduler invocation
4845  *
4846  * @details
4847  *
4848  *     Function: rgSCHSc1UlSched
4849  *     Purpose:  This function implements an UL scheduler for LTE. This is
4850  *               made available as a function pointer to be called
4851  *               at the time of TTI processing by the MAC.
4852  *     
4853  *     Invoked by: Common Scheduler (TTI processing)
4854  *     
4855  *  @param[in]  RgSchCellCb           *cell
4856  *  @param[out] RgSchCmnUlRbAllocInfo *allocInfo 
4857  *  @return Void 
4858  **/
4859 #ifdef ANSI
4860 PUBLIC Void rgSCHSc1UlSched 
4861 (
4862 RgSchCellCb           *cell,
4863 RgSchCmnUlRbAllocInfo *allocInfo
4864 )
4865 #else
4866 PUBLIC Void rgSCHSc1UlSched(cell, allocInfo)
4867 RgSchCellCb           *cell;
4868 RgSchCmnUlRbAllocInfo *allocInfo;
4869 #endif
4870 {
4871    TRC2(rgSCHSc1UlSched);
4872    rgSCHSc1UlNewTx(cell, allocInfo);
4873    RETVOID;
4874 }
4875
4876 /**
4877  * @brief UEs Buffer Status Has changed so reposition it. 
4878  *
4879  * @details
4880  *
4881  *     Function : rgSCHSc1UlInsUeInQ 
4882  *     
4883  *     In UE in the list in Descending order of effBsr.
4884  *     
4885  *
4886  *  @param[in]  CmLListCp    *lst
4887  *  @param[in]  RgSchUeCb    *ue
4888  *  @return  Void 
4889  **/
4890 #ifdef ANSI
4891 PRIVATE Void rgSCHSc1UlInsUeInQ 
4892 (
4893 CmLListCp           *lst,
4894 RgSchUeCb           *ue,
4895 RgSchCellCb         *cell
4896 )
4897 #else
4898 PRIVATE Void rgSCHSc1UlInsUeInQ(lst, ue, cell)
4899 CmLListCp           *lst;
4900 RgSchUeCb           *ue;
4901 RgSchCellCb         *cell;
4902 #endif
4903 {
4904                               /*cell added as part of CA dev*/
4905    RgSchSc1UlUe    *ueUl    = RG_GET_SC1_UE_UL(ue, cell);
4906    RgSchUeCb       *lUe;
4907    CmLList         *node;
4908
4909    TRC2(rgSCHSc1UlInsUeInQ);
4910
4911    node = lst->first;
4912    while(node)
4913    {
4914       lUe = (RgSchUeCb *)(node->node);
4915       if (lUe->ul.effBsr <= ue->ul.effBsr)
4916       {
4917          break;
4918       }
4919       node = node->next;
4920    }
4921    if (node == NULLP)
4922    {
4923       /* We have come to the end of the queue, so Append */
4924       cmLListAdd2Tail(lst, &ueUl->txLnk);
4925       ueUl->txLnk.node = (PTR)ue;
4926    }
4927    else
4928    {
4929       lst->crnt = node;
4930       cmLListInsCrnt(lst, &ueUl->txLnk);
4931       ueUl->txLnk.node = (PTR)ue;
4932    }
4933
4934    RETVOID;
4935 }
4936 /**
4937  * @brief UEs Buffer Status Has changed so reposition it. 
4938  *
4939  * @details
4940  *
4941  *     Function : rgSCHSc1UlPosnUeInQ
4942  *     
4943  *     -Ues bs value for its LCG has changed, due to either 
4944  *     allocation or BSR report OR the effUeBR, i.e the byteRate
4945  *     has changed due to some allocation, so add/reposition/remove
4946  *     it from Qs based on this new bs and/or effUeBR value.
4947  *     -If UE has non-zero lcg0 bs value, but the byteRate is 
4948  *     consumed totally, UE is still schedulable for this control data. 
4949  *     -If UE's LCG0 has pending bs then position this UE in 
4950  *     ueTxLst[0].
4951  *     -If Ue has pending BSR to be satisfied, but lcg0's BS
4952  *     is 0, then position it in ueTxLst[1].
4953  *     -In any of these 2 Qs, insertion is such that UEs are
4954  *     positioned in Descending order of their Pending BS.
4955  *     
4956  *
4957  *  @param[in]  RgSchCellCb  *cell
4958  *  @param[in]  RgSchUeCb    *ue
4959  *  @return  Void 
4960  **/
4961 #ifdef ANSI
4962 PRIVATE Void rgSCHSc1UlPosnUeInQ 
4963 (
4964 RgSchCellCb         *cell,
4965 RgSchUeCb           *ue
4966 )
4967 #else
4968 PRIVATE Void rgSCHSc1UlPosnUeInQ(cell, ue)
4969 RgSchCellCb         *cell;
4970 RgSchUeCb           *ue;
4971 #endif
4972 {
4973    RgSchSc1UlUe    *ueUl   = RG_GET_SC1_UE_UL(ue, cell);
4974                               /*cell added as part of CA dev*/
4975    RgSchSc1UlCell  *cellUl = RG_GET_SC1_CELL_UL(cell);
4976    RgSchCmnLcg     *cmnLcg0 = RG_SCH_CMN_GET_UL_LCG(&ue->ul.lcgArr[0]);
4977    CmLListCp       *lst;
4978
4979    TRC2(rgSCHSc1UlPosnUeInQ);
4980
4981    if (!RG_SCH_CMN_UL_IS_UE_ACTIVE(ue))
4982    {
4983       RETVOID;
4984    }
4985                      
4986    /* Remove the UE from its existing position */
4987    if (ueUl->txLnk.node)
4988    {
4989       cmLListDelFrm(&(cellUl->ueTxLst[ueUl->qId]), &(ueUl->txLnk));
4990       ueUl->txLnk.node = (PTR)NULLP;
4991    }
4992    /* If UE has still bs left for scheduling 
4993     * then reposition it */
4994    if ((ue->ul.effBsr > 0) || (ueUl->srRcvd == TRUE))
4995    {
4996       /* Select the Queue where UE would be Placed */
4997       if (cmnLcg0->bs > 0)
4998       {
4999          lst = &cellUl->ueTxLst[0];
5000          ueUl->qId = 0;
5001       }
5002       else
5003       {
5004          lst = &cellUl->ueTxLst[1];
5005          ueUl->qId = 1;
5006       }
5007       /* Insert the UE in the Q */
5008       rgSCHSc1UlInsUeInQ(lst, ue, cell);/*cell added as part of CA dev*/ 
5009    }
5010 #ifdef RGR_V1
5011    else if(ue->ul.totalBsr != 0)
5012    {
5013       if (ue->bsrTmr.tmrEvnt != TMR_NONE)
5014       {
5015          rgSCHTmrStopTmr(cell, ue->bsrTmr.tmrEvnt, ue); 
5016       }
5017       if (ue->ul.bsrTmrCfg.isPrdBsrTmrPres)
5018       {
5019          rgSCHTmrStartTmr(cell, ue, RG_SCH_TMR_BSR, 
5020                ue->ul.bsrTmrCfg.prdBsrTmr);
5021       }
5022    }
5023 #endif
5024
5025    RETVOID;
5026 }
5027
5028 /**
5029  * @brief Short BSR update
5030  *
5031  * @details
5032  *
5033  *     Function : rgSCHSc1UpdBsrShort
5034  *     
5035  *     This functions does requisite updates to handle short BSR reporting
5036  *
5037  *  @param[in]  RgSchCellCb  *cell
5038  *  @param[in]  RgSchUeCb    *ue
5039  *  @param[in]  RgSchLcgCb   *lcg
5040  *  @param[in]  U8           bsr
5041  *  @return  Void
5042  **/
5043 #ifdef ANSI
5044 PUBLIC Void rgSCHSc1UpdBsrShort
5045 (
5046 RgSchCellCb  *cell,
5047 RgSchUeCb    *ue,
5048 RgSchLcgCb   *lcg,
5049 U8           bsr
5050 )
5051 #else
5052 PUBLIC Void rgSCHSc1UpdBsrShort(cell, ue, lcg, bsr)
5053 RgSchCellCb  *cell;
5054 RgSchUeCb    *ue;
5055 RgSchLcgCb   *lcg;
5056 U8           bsr;
5057 #endif
5058 {
5059    TRC2(rgSCHSc1UpdBsrShort);
5060    rgSCHSc1UlPosnUeInQ(cell, ue);
5061    RETVOID;
5062 }  /* rgSCHSc1UpdBsrShort */
5063
5064 /**
5065  * @brief Truncated BSR update
5066  *
5067  * @details
5068  *
5069  *     Function : rgSCHSc1UpdBsrTrunc
5070  *     
5071  *     This functions does required updates to handle truncated BSR report
5072  *     
5073  *           
5074  *  @param[in]  RgSchCellCb  *cell
5075  *  @param[in]  RgSchUeCb    *ue
5076  *  @param[in]  RgSchLcgCb   *lcg
5077  *  @param[in]  U8           bsr
5078  *  @return  Void 
5079  **/
5080 #ifdef ANSI
5081 PUBLIC Void rgSCHSc1UpdBsrTrunc
5082 (
5083 RgSchCellCb  *cell,
5084 RgSchUeCb    *ue,
5085 RgSchLcgCb   *lcg,
5086 U8           bsr
5087 )
5088 #else
5089 PUBLIC Void rgSCHSc1UpdBsrTrunc(cell, ue, lcg, bsr)
5090 RgSchCellCb  *cell;
5091 RgSchUeCb    *ue;
5092 RgSchLcgCb   *lcg;
5093 U8           bsr;
5094 #endif
5095 {
5096    TRC2(rgSCHSc1UpdBsrTrunc);
5097    rgSCHSc1UlPosnUeInQ(cell, ue);
5098    RETVOID;
5099 }  /* rgSCHSc1UpdBsrTrunc */
5100
5101 /**
5102  * @brief Long BSR update
5103  *
5104  * @details
5105  *
5106  *     Function : rgSCHSc1UpdBsrLong
5107  *
5108  *     - Update UE's position within/across uplink scheduling queues
5109  *
5110  *
5111  *  @param[in]  RgSchCellCb  *cell
5112  *  @param[in]  RgSchUeCb    *ue
5113  *  @param[in]  U8 bsArr[]
5114  *  @return  Void 
5115  **/
5116 #ifdef ANSI
5117 PUBLIC Void rgSCHSc1UpdBsrLong
5118 (
5119 RgSchCellCb  *cell,
5120 RgSchUeCb    *ue,
5121 U8           *bsArr
5122 )
5123 #else
5124 PUBLIC Void rgSCHSc1UpdBsrLong(cell, ue, bsArr)
5125 RgSchCellCb  *cell;
5126 RgSchUeCb    *ue;
5127 U8           *bsArr;
5128 #endif
5129 {
5130    TRC2(rgSCHSc1UpdBsrLong);
5131    rgSCHSc1UlPosnUeInQ(cell, ue);
5132    RETVOID;
5133 }  /* rgSCHSc1UpdBsrLong */
5134
5135 /**
5136  * @brief UL grant for contention resolution
5137  *
5138  * @details
5139  *
5140  *     Function : rgSCHSc1ContResUlGrant
5141  *     
5142  *     Add UE to another queue specifically for CRNTI based contention
5143  *     resolution
5144  *     
5145  *           
5146  *  @param[in]  RgSchCellCb  *cell
5147  *  @param[in]  RgSchUeCb    *ue
5148  *  @return Void 
5149  **/
5150 #ifdef ANSI
5151 PUBLIC Void rgSCHSc1ContResUlGrant
5152 (
5153 RgSchCellCb  *cell,
5154 RgSchUeCb    *ue
5155 )
5156 #else
5157 PUBLIC Void rgSCHSc1ContResUlGrant(cell, ue)
5158 RgSchCellCb  *cell;
5159 RgSchUeCb    *ue;
5160 #endif
5161 {
5162    RgSchSc1UlUe    *ueUl   = RG_GET_SC1_UE_UL(ue, cell);
5163    RgSchSc1UlCell  *cellUl = RG_GET_SC1_CELL_UL(cell);
5164
5165    TRC2(rgSCHSc1ContResUlGrant);
5166
5167    if (ueUl->contResLnk.node)
5168    {
5169       RETVOID;
5170    }
5171
5172    /* Remove the UE from other Qs */
5173    if(ueUl->txLnk.node)
5174    {
5175       cmLListDelFrm(&(cellUl->ueTxLst[ueUl->qId]), &(ueUl->txLnk));
5176       ueUl->txLnk.node = NULLP;
5177    }
5178
5179    cmLListAdd2Tail(&cellUl->contResLst, &ueUl->contResLnk);
5180    ueUl->contResLnk.node = (PTR)ue;
5181    RETVOID;
5182 }  /* rgSCHSc1ContResUlGrant */
5183
5184 /**
5185  * @brief SR reception handling
5186  *
5187  * @details
5188  *
5189  *     Function : rgSCHSc1SrRcvd
5190  *     Shift the UE with SrInd in to the lcgO queue.
5191  *
5192  *
5193  *  @param[in]  RgSchCellCb  *cell
5194  *  @param[in]  RgSchUeCb    *ue
5195  *  @return  Void
5196  **/
5197 #ifdef ANSI
5198 PUBLIC Void rgSCHSc1SrRcvd
5199 (
5200 RgSchCellCb  *cell,
5201 RgSchUeCb    *ue
5202 )
5203 #else
5204 PUBLIC Void rgSCHSc1SrRcvd(cell, ue)
5205 RgSchCellCb  *cell;
5206 RgSchUeCb    *ue;
5207 #endif
5208 {
5209    RgSchSc1UlUe    *ulUe    = RG_GET_SC1_UE_UL(ue, cell);
5210    RgSchSc1UlCell  *ulCell  = RG_GET_SC1_CELL_UL(cell);
5211
5212    TRC2(rgSCHSc1SrRcvd);
5213
5214    ulUe->srRcvd = TRUE;
5215
5216    if (ulUe->txLnk.node != NULLP)
5217    {
5218       if (ulUe->qId == 0)
5219       {
5220          /* Already present in lcg0 Q */
5221          RETVOID;
5222       }
5223       cmLListDelFrm(&(ulCell->ueTxLst[ulUe->qId]), &(ulUe->txLnk));
5224    }
5225    /* Adding the UE to the LCG0 list for SR IND */
5226    cmLListAdd2Tail(&ulCell->ueTxLst[0], &ulUe->txLnk);
5227    ulUe->txLnk.node = (PTR)ue;
5228    ulUe->qId = 0;
5229
5230    RETVOID;
5231 }  /* rgSCHSc1SrRcvd */
5232
5233 /**
5234  * @brief Indication of UL CQI
5235  *
5236  * @details
5237  *
5238  *     Function : rgSCHSc1UlCqiInd 
5239  *
5240  *     - Common Scheduler. SC1 does nothing. 
5241  *
5242  *  @param[in]  RgSchCellCb         *cell
5243  *  @param[in]  RgSchUeCb           *ue
5244  *  @param[in]  TfuUlCqiRpt         *ulCqiInfo
5245  *  @return  Void
5246  **/
5247 #ifdef ANSI
5248 PUBLIC Void rgSCHSc1UlCqiInd
5249 (
5250 RgSchCellCb          *cell,
5251 RgSchUeCb            *ue,
5252 TfuUlCqiRpt          *ulCqiInfo
5253 )
5254 #else
5255 PUBLIC Void rgSCHSc1UlCqiInd(cell, ue, ulCqiInfo)
5256 RgSchCellCb          *cell;
5257 RgSchUeCb            *ue;
5258 TfuUlCqiRpt          *ulCqiInfo;
5259 #endif
5260 {
5261    TRC2(rgSCHSc1UlCqiInd);
5262
5263   /* Stack Crash problem for TRACE5 changes. Added the return below */
5264   RETVOID;
5265
5266 }
5267
5268 /**
5269  * @brief UL Lcg received data updation
5270  *
5271  * @details
5272  *
5273  *     Function : rgSCHSc1UlLcgUpd
5274  *
5275  *     Processing Steps:Sc1 Does nothing
5276  *
5277  *  @param[in]  RgSchCellCb         *cell
5278  *  @param[in]  RgSchUeCb          *ue
5279  *  @param[in]  RgInfUeDatInd      *datInd
5280  *  @return  S16
5281  **/
5282 #ifdef ANSI
5283 PUBLIC S16 rgSCHSc1UlLcgUpd
5284 (
5285 RgSchCellCb         *cell,
5286 RgSchUeCb           *ue,
5287 RgInfUeDatInd       *datInd
5288 )
5289 #else
5290 PUBLIC S16 rgSCHSc1UlLcgUpd(cell, ue)
5291 RgSchCellCb         *cell;
5292 RgSchUeCb           *ue;
5293 RgInfUeDatInd       *datInd;
5294 #endif
5295 {
5296
5297    TRC2(rgSCHSc1UlLcgUpd);
5298
5299    RETVALUE(ROK);  
5300 }
5301
5302 \f
5303 /***********************************************************
5304  *
5305  *     Func : rgSCHSc1UlUeRefresh
5306  *        
5307  *     Desc : Handle 'refresh' for uplink part of a UE
5308  *            (ie UE's uplink AMBR and uplink GBR LCGs are
5309  *            refreshed at this point)
5310  *
5311  *     Ret  : 
5312  *
5313  *     Notes:
5314  *
5315  *     File : 
5316  *
5317  **********************************************************/
5318 #ifdef ANSI
5319 PUBLIC Void rgSCHSc1UlUeRefresh
5320 (
5321 RgSchCellCb    *cell,
5322 RgSchUeCb      *ue
5323 )
5324 #else
5325 PUBLIC Void rgSCHSc1UlUeRefresh(cell, ue)
5326 RgSchCellCb    *cell;
5327 RgSchUeCb      *ue;
5328 #endif
5329 {
5330    TRC2(rgSCHSc1UlUeRefresh);
5331    rgSCHSc1UlPosnUeInQ(cell, ue);
5332    RETVOID;
5333 }
5334
5335 /**
5336  * @brief This function Processes the Final Allocations
5337  *        made by the RB Allocator against the requested
5338  *        UE data Trans Allocations. 
5339  *
5340  * @details
5341  *
5342  *     Function: rgSCHSc1UlDatTransAllocFnlz
5343  *     Purpose:  This function Processes the Final Allocations
5344  *               made by the RB Allocator against the requested
5345  *               UE data Trans Allocations . 
5346  *     
5347  *     Invoked by: Scheduler 
5348  *     
5349  *  @param[in]  RgSchCellCb           *cell
5350  *  @param[in]  RgSchCmnDlRbAllocInfo *allocInfo
5351  *  @return  Void
5352  *
5353  **/
5354 #ifdef ANSI
5355 PRIVATE Void rgSCHSc1UlDatTransAllocFnlz
5356 (
5357 RgSchCellCb           *cell,
5358 RgSchCmnUlRbAllocInfo *allocInfo
5359 )
5360 #else
5361 PRIVATE Void rgSCHSc1UlDatTransAllocFnlz(cell, allocInfo)
5362 RgSchCellCb           *cell;
5363 RgSchCmnUlRbAllocInfo *allocInfo;
5364 #endif
5365 {
5366    RgSchSc1UlUe         *ueUl;
5367    RgSchUeCb         *ue;
5368    CmLList           *node;
5369    RgSchDrxUeCb      *drxUe    = NULLP;
5370    CmLListCp         ulInactvLst; /* list of UE's becoming UL-inactive */
5371    TRC2(rgSCHSc1UlDatTransAllocFnlz);
5372
5373    cmLListInit(&ulInactvLst);
5374    node = allocInfo->schdUeLst.first;
5375    while(node)
5376    {
5377       ue   = (RgSchUeCb *)node->node;
5378       node = node->next;
5379       ueUl = RG_GET_SC1_UE_UL(ue, cell);
5380
5381       if (ue->isDrxEnabled)
5382       {
5383          if(ueUl->srRcvd == TRUE)
5384          {
5385             drxUe = RG_SCH_DRX_GET_UE(ue);
5386             drxUe->drxUlInactvMask  |= RG_SCH_DRX_SR_BITMASK;
5387
5388             if(!RG_SCH_DRX_UL_IS_UE_ACTIVE(drxUe))
5389             {
5390                ue->ul.ulInactvMask |= RG_DRX_INACTIVE;
5391                /* Add to Ul inactive List */
5392                ue->ulDrxInactvLnk.node  = (PTR)ue;
5393                cmLListAdd2Tail(&ulInactvLst,&(ue->ulDrxInactvLnk));
5394             }
5395             drxUe->srRcvd = FALSE;
5396          }
5397       }
5398       /* Reset no matter */
5399       ueUl->srRcvd = FALSE;
5400       /* Reposition UE in Qs */
5401       rgSCHSc1UlPosnUeInQ(cell, ue);
5402 #ifdef LTEMAC_HDFDD
5403       if (ue->hdFddEnbld)
5404       {
5405          rgSCHCmnHdFddUpdULMark (cell,ue);
5406       }
5407 #endif
5408       /* reset the UE UL allocation Information */
5409       rgSCHCmnUlUeResetTemp(cell, ue);
5410    }
5411    rgSCHSc1UlHndlInActUes(cell, &ulInactvLst);
5412    node = allocInfo->nonSchdUeLst.first;
5413    while(node)
5414    {
5415       ue   = (RgSchUeCb *)node->node;
5416       node = node->next;
5417       /* reset the UE UL allocation Information */
5418       rgSCHCmnUlUeResetTemp(cell, ue);
5419    }
5420
5421    RETVOID;
5422 }
5423
5424 /**
5425  * @brief This function Processes the Final Allocations
5426  *        made by the RB Allocator against the requested
5427  *        cont res Allocations. 
5428  *
5429  * @details
5430  *
5431  *     Function: rgSCHSc1UlContResAllocFnlz
5432  *     Purpose:  This function Processes the Final Allocations
5433  *               made by the RB Allocator against the requested
5434  *               cont res Allocations . 
5435  *     
5436  *     Invoked by: Scheduler 
5437  *     
5438  *  @param[in]  RgSchCellCb           *cell
5439  *  @param[in]  RgSchCmnDlRbAllocInfo *allocInfo
5440  *  @return  Void
5441  *
5442  **/
5443 #ifdef ANSI
5444 PRIVATE Void rgSCHSc1UlContResAllocFnlz
5445 (
5446 RgSchCellCb           *cell,
5447 RgSchCmnUlRbAllocInfo *allocInfo
5448 )
5449 #else
5450 PRIVATE Void rgSCHSc1UlContResAllocFnlz(cell, allocInfo)
5451 RgSchCellCb           *cell;
5452 RgSchCmnUlRbAllocInfo *allocInfo;
5453 #endif
5454 {
5455    RgSchSc1UlCell    *sc1UlCell  = RG_GET_SC1_CELL_UL(cell);
5456    RgSchSc1UlUe      *ueUl;
5457    RgSchUeCb         *ue;
5458    CmLList           *node;
5459    TRC2(rgSCHSc1UlContResAllocFnlz);
5460
5461    node = allocInfo->schdContResLst.first;
5462    while(node)
5463    {
5464       ue   = (RgSchUeCb *)node->node;
5465       node = node->next;
5466 #ifdef LTEMAC_HDFDD
5467       if (ue->hdFddEnbld)
5468       {
5469          rgSCHCmnHdFddUpdULMark (cell,ue);
5470       }
5471 #endif
5472       ueUl = RG_GET_SC1_UE_UL(ue, cell);
5473
5474       /* Remove UE from Cont Res Q */ 
5475       cmLListDelFrm(&sc1UlCell->contResLst,
5476       &ueUl->contResLnk);
5477       ueUl->contResLnk.node = NULLP;
5478       /* reset the UE UL allocation Information */
5479       rgSCHCmnUlUeResetTemp(cell, ue);
5480    }
5481
5482    node = allocInfo->nonSchdContResLst.first;
5483    while(node)
5484    {
5485       ue   = (RgSchUeCb *)node->node;
5486       node = node->next;
5487       /* reset the UE UL allocation Information */
5488       rgSCHCmnUlUeResetTemp(cell, ue);
5489    }
5490
5491    RETVOID;
5492 }
5493
5494 /**
5495  * @brief This function Processes the Final Allocations
5496  *        made by the RB Allocator against the requested. 
5497  *
5498  * @details
5499  *
5500  *     Function: rgSCHSc1UlAllocFnlz
5501  *     Purpose:  This function Processes the Final Allocations
5502  *               made by the RB Allocator against the requested. 
5503  *     
5504  *     Invoked by: Common Scheduler 
5505  *     
5506  *  @param[in]  RgSchCellCb           *cell
5507  *  @param[in]  RgSchCmnDlRbAllocInfo *allocInfo
5508  *  @return  Void
5509  *
5510  **/
5511 #ifdef ANSI
5512 PUBLIC Void rgSCHSc1UlAllocFnlz
5513 (
5514 RgSchCellCb           *cell,
5515 RgSchCmnUlRbAllocInfo *allocInfo
5516 )
5517 #else
5518 PUBLIC Void rgSCHSc1UlAllocFnlz(cell, allocInfo)
5519 RgSchCellCb           *cell;
5520 RgSchCmnUlRbAllocInfo *allocInfo;
5521 #endif
5522 {
5523    TRC2(rgSCHSc1UlAllocFnlz);
5524
5525    rgSCHSc1UlContResAllocFnlz(cell, allocInfo);
5526    rgSCHSc1UlDatTransAllocFnlz(cell, allocInfo);
5527
5528    RETVOID;
5529 }
5530
5531 \f
5532 /**
5533  * @brief Scheduler invocation
5534  *
5535  * @details
5536  *
5537  *     Function: rgSCHSc1UlActvtUe 
5538  *     Purpose:  Put back the UE in to appropriate Qs.
5539  *     
5540  *     Invoked by: Common Scheduler 
5541  *     
5542  *  @param[in]  RgSchCellCb *cell
5543  *  @param[in]  RgSchUeCb   *ue
5544  *  @return  Void
5545  **/
5546 #ifdef ANSI
5547 PUBLIC Void rgSCHSc1UlActvtUe 
5548 (
5549 RgSchCellCb    *cell,
5550 RgSchUeCb      *ue
5551 )
5552 #else
5553 PUBLIC Void rgSCHSc1UlActvtUe(cell, ue)
5554 RgSchCellCb    *cell;
5555 RgSchUeCb      *ue;
5556 #endif
5557 {
5558    TRC2(rgSCHSc1UlActvtUe);
5559
5560    rgSCHSc1UlPosnUeInQ(cell, ue);
5561    RETVOID;
5562 }
5563
5564 /**
5565  * @brief Scheduler invocation
5566  *
5567  * @details
5568  *
5569  *     Function: rgSCHSc1UlHndlInActUes
5570  *     Purpose:  The list of inactive UEs present in inactvLst should
5571  *               be removed from the scheduling Qs.
5572  *               But store the information pertaining to which Qs,
5573  *               were they belonging to. This information shall be used 
5574  *               to put them back in appropriate Qs when their Activation
5575  *               is initiated.
5576  *     
5577  *     Invoked by: Common Scheduler (TTI processing)
5578  *     
5579  *  @param[in]  RgSchCellCb *cell
5580  *  @param[out] CmLListCp   *inactvLst
5581  *  @return  Void
5582  **/
5583 #ifdef ANSI
5584 PUBLIC Void rgSCHSc1UlHndlInActUes
5585 (
5586 RgSchCellCb           *cell,
5587 CmLListCp             *inactvLst
5588 )
5589 #else
5590 PUBLIC Void rgSCHSc1UlHndlInActUes(cell, inactvLst)
5591 RgSchCellCb           *cell;
5592 CmLListCp             *inactvLst;
5593 #endif
5594 {
5595    RgSchUeCb    *ue;
5596    RgSchSc1UlUe    *ulUe;
5597    RgSchSc1UlCell  *cellUl  = RG_GET_SC1_CELL_UL(cell);
5598    CmLList      *node = inactvLst->first;
5599
5600    TRC2(rgSCHSc1UlHndlInActUes);
5601
5602    while (node)
5603    {
5604       ue = (RgSchUeCb *)node->node;
5605       node = node->next;
5606       ulUe = RG_GET_SC1_UE_UL(ue, cell);
5607       if(ulUe->txLnk.node)
5608       {
5609          cmLListDelFrm(&(cellUl->ueTxLst[ulUe->qId]), &(ulUe->txLnk));
5610          /* This is required as lcg bs might change during
5611           * inactivity to activity. So we need to recompute 
5612           * its position. */
5613          ulUe->txLnk.node = NULLP;
5614       }
5615       /* Do not remove UE from contResLst */
5616    }
5617    RETVOID;
5618 }
5619 /**
5620  * @brief Scheduler invocation
5621  *
5622  * @details
5623  *
5624  *     Function: rgSCHSc1DlProcRmvFrmRetx
5625  *     Purpose:  To remove the Harq process from the cell and from the UE 
5626  *                retransmission list
5627  *     
5628  *     Invoked by: Common Scheduler (TTI processing)
5629  *     
5630  *  @param[in]  RgSchCellCb *cell
5631  *  @param[in]  RgSchUeCb   *ue;
5632  *  @param[in] RgSchDlHqProcCb  *hqP
5633  *  @return  Void
5634  **/
5635
5636 #ifdef ANSI
5637 PUBLIC Void rgSCHSc1DlProcRmvFrmRetx(
5638 RgSchCellCb                *cell,
5639 RgSchUeCb                  *ue,
5640 RgSchDlHqProcCb            *hqP
5641 )
5642 #else
5643 PUBLIC Void rgSCHSc1DlProcRmvFrmRetx(cell, ue, hqP)
5644 RgSchCellCb                *cell;
5645 RgSchUeCb                  *ue;
5646 RgSchDlHqProcCb            *hqP;
5647 #endif
5648 {
5649    TRC2(rgSCHSc1DlProcRmvFrmRetx);
5650    /* Remove the HqP from retx Queue.
5651    Release HqP.*/
5652    rgSCHSc1DlProcRmvFrmCellRetx(cell, hqP);
5653    rgSCHSc1DlProcRmvFrmUeRetx(cell, ue, hqP);
5654    RETVOID;
5655 }
5656
5657
5658
5659 \f
5660 /**********************************************************************
5661  
5662          End of file
5663 **********************************************************************/