Adding release file
[o-du/l2.git] / src / 5gnrmac / rg_sch.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 Entry point fucntions
26   
27      File:     rg_sch.c
28   
29 **********************************************************************/
30
31 /** @file rg_sch.c
32 @brief This file implements the schedulers main access to MAC layer code.
33 */
34
35 static const char* RLOG_MODULE_NAME="MAC";
36 static int RLOG_FILE_ID=185;
37 static int RLOG_MODULE_ID=4096;
38
39 /* header include files -- defines (.h) */
40 #include "envopt.h"        /* environment options */
41 #include "envdep.h"        /* environment dependent */
42 #include "envind.h"        /* environment independent */
43 #include "gen.h"           /* general layer */
44 #include "ssi.h"           /* system service interface */
45 #include "cm_hash.h"       /* common hash list */
46 #include "cm_llist.h"      /* common linked list library */
47 #include "cm_err.h"        /* common error */
48 #include "cm_lte.h"        /* common LTE */
49 #include "lrg.h"
50 #include "rgr.h"
51 #include "tfu.h"
52 #include "rgm.h"
53 #include "rg_env.h"
54 #include "rg_sch_inf.h"
55 #include "rg_sch.h"
56 #include "rg_sch_err.h"
57 #include "rg_sch_cmn.h"
58 #include "rl_interface.h"
59 #include "rl_common.h"
60
61 /* header/extern include files (.x) */
62 #include "gen.x"           /* general layer typedefs */
63 #include "ssi.x"           /* system services typedefs */
64 #include "cm5.x"           /* common timers */
65 #include "cm_hash.x"       /* common hash list */
66 #include "cm_lib.x"        /* common library */
67 #include "cm_llist.x"      /* common linked list */
68 #include "cm_mblk.x"       /* memory management */
69 #include "cm_tkns.x"       /* common tokens */
70 #include "cm_lte.x"       /* common tokens */
71 #include "tfu.x"           /* TFU types */
72 #include "lrg.x"           /* layer management typedefs for MAC */
73 #include "rgr.x"           /* layer management typedefs for MAC */
74 #include "rgm.x"           /* layer management typedefs for MAC */
75 #include "rg_sch_inf.x"         /* typedefs for Scheduler */
76 #include "rg_sch.x"        /* typedefs for Scheduler */
77 #include "rg_sch_cmn.x"
78
79 #ifdef EMTC_ENABLE
80 EXTERN S16 rgEmtcMacSchUeDelInd ARGS((RgSchCellCb *cell,RgInfUeDelInd *ueDelInd));
81 EXTERN S16 rgSCHGomEmtcHndlSiCfg ARGS((
82 Region        reg,
83 Pool          pool,
84 RgSchCb       *instCb,
85 SpId          spId,
86 RgrCfgTransId transId,
87 RgrSiCfgReqInfo *cfgReqInfo
88 ));
89 EXTERN S16 rgSCHGomEmtcHndlWarningSiCfg ARGS((
90 Region        reg,
91 Pool          pool,
92 RgSchCb       *instCb,
93 SpId          spId,
94 RgrCfgTransId transId,
95 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
96 ));
97 #endif
98 /* local defines */
99 /************** LRG Interface ****************/
100 /**
101  * @brief Layer Manager Configuration request handler. 
102  *
103  * @details
104  *
105  *     Function : RgMiLrgSchCfgReq
106  *     
107  *     This function handles the configuration
108  *     request received at scheduler instance from the Layer Manager.
109  *     -# Based on the cfg->hdr.elmId.elmnt value it invokes one of the
110  *        functions rgHdlGenCfg() or rgHdlSapCfg().
111  *     -# Invokes RgMiLrgSchCfgCfm() to send back the confirmation to the LM.
112  *     
113  *  @param[in]  Pst *pst, the post structure     
114  *  @param[in]  RgMngmt *cfg, the configuration parameter's structure
115  *  @return  S16
116  *      -# ROK
117  **/
118 #ifdef ANSI
119 PUBLIC S16 RgMiLrgSchCfgReq
120 (
121 Pst      *pst,    /* post structure  */
122 RgMngmt  *cfg     /* config structure  */
123 )
124 #else
125 PUBLIC S16 RgMiLrgSchCfgReq(pst, cfg)
126 Pst      *pst;    /* post structure  */
127 RgMngmt  *cfg;    /* config structure  */
128 #endif    
129 {
130    U16       ret = LCM_PRIM_OK;
131    U16       reason = LCM_REASON_NOT_APPL;
132    RgMngmt   cfm;
133    Pst       cfmPst;
134 #ifdef DEBUGP
135    Inst      inst = (pst->dstInst  - RGSCH_INST_START);
136 #endif
137
138    TRC3(RgMiLrgSchCfgReq)
139    
140
141    //if(pst->dstInst < RGSCH_INST_START)
142    //{
143       RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Invalid inst ID");
144       RLOG_ARG2(L_DEBUG,DBG_INSTID,inst, "RgMiLrgSchCfgReq(): "
145                         "pst->dstInst=%d RGSCH_INST_START=%d", pst->dstInst,RGSCH_INST_START); 
146       //RETVALUE(ROK);
147    //}
148
149    /* Fill the post structure for sending the confirmation */
150    rgSCHLmmFillCfmPst(pst, &cfmPst, cfg);
151
152    /* Initialize the cfg cfm structure 
153    if (SGetSBuf(cfmPst.region, cfmPst.pool, (Data **)&cfm, sizeof(RgMngmt))
154       != ROK)
155    {
156       RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Memory Unavailable for Confirmation");
157       RETVALUE(ROK);
158    } */
159    cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
160
161 #ifdef LMINT3
162    cfm.hdr.transId =
163       cfg->hdr.transId;
164 #endif
165
166    cfm.hdr.elmId.elmnt = cfg->hdr.elmId.elmnt;
167    switch(cfg->hdr.elmId.elmnt)
168    {
169       case STSCHINST:
170          reason = rgSCHLmmInstCfg(&cfg->t.cfg,pst->dstInst );
171          break;
172       default:
173          ret = LCM_PRIM_NOK;
174          reason = LCM_REASON_INVALID_ELMNT;
175          RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "Invalid Elmnt=%d", cfg->hdr.elmId.elmnt);
176          break;
177    }
178
179    if (reason != LCM_REASON_NOT_APPL)
180    {
181       ret = LCM_PRIM_NOK;
182    }
183
184    cfm.cfm.status = ret;
185    cfm.cfm.reason = reason;
186
187    RgMiLrgSchCfgCfm(&cfmPst, &cfm);
188    /*   SPutSBuf(pst->region, pst->pool, (Data *)cfg, sizeof(RgMngmt)); */
189    
190    RETVALUE(ROK);
191 }/*-- RgMiLrgSchCfgReq --*/
192
193 \f
194 /**
195  * @brief Layer Manager Control request handler. 
196  *
197  * @details
198  *
199  *     Function : RgMiLrgSchCntrlReq
200  *     
201  *     This function handles the control
202  *     request received from the Layer Manager.
203  *      -# Based on cntrl->hdr.elmId.elmnt, cntrl->t.cntrl.action
204  *      and cntrl->t.cntrl.subAction, it performs the appropriate control action
205  *      of SAP (enable/disable) and layer shutdown.
206  *      -# Invokes the RgMiLrgSchCntrlCfm to send back the confirmation to LM.
207  *     
208  *  @param[in]  Pst *pst, the post structure     
209  *  @param[in]  RgMngmt *cntrl, the control parameter's structure
210  *  @return  S16
211  *      -# ROK
212  **/
213 #ifdef ANSI
214 PUBLIC S16 RgMiLrgSchCntrlReq
215 (
216 Pst      *pst,    /* post structure  */
217 RgMngmt  *cntrl   /* control structure  */
218 )
219 #else
220 PUBLIC S16 RgMiLrgSchCntrlReq(pst, cntrl)
221 Pst      *pst;    /* post structure  */
222 RgMngmt  *cntrl;  /* control structure  */
223 #endif    
224 {
225    S16       ret = ROK;            /* return value */
226    Pst       cfmPst;
227    RgMngmt   cfm;
228    
229    Inst      inst = (pst->dstInst - RGSCH_INST_START); /* Scheduler instance Id */
230    TRC3(RgMiLrgSchCntrlReq)
231    
232
233    /* Fill the post structure for sending the confirmation */
234    rgSCHLmmFillCfmPst(pst, &cfmPst, cntrl);
235
236    /* Initialize the cfg cfm structure 
237    if (SGetSBuf(cfmPst.region, cfmPst.pool, (Data **)&cfm, sizeof(RgMngmt))
238       != ROK)
239    {
240       RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Memory Unavailable for Confirmation");
241       SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt));
242       RETVALUE(ROK);
243    } */
244    cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
245
246 #ifdef LMINT3
247    cfm.hdr.transId =
248       cntrl->hdr.transId;
249 #endif
250
251    cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
252    cfm.t.cntrl.action = cntrl->t.cntrl.action;
253    cfm.t.cntrl.subAction = cntrl->t.cntrl.subAction;
254
255    /* Check if General Config Done*/
256    if(rgSchCb[inst].rgSchInit.cfgDone != TRUE)
257    {
258       cfm.cfm.status = LCM_PRIM_NOK;
259       cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
260       cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
261       RgMiLrgSchCntrlCfm(&cfmPst, &cfm);
262       RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Gen Cfg not done.");
263       /*      SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); */
264       RETVALUE(ROK);
265    }
266
267    /* General Config done, process the Control request */   
268    switch(cntrl->hdr.elmId.elmnt)
269    {
270       case STGEN:
271          rgSCHLmmGenCntrl(cntrl, &cfm, &cfmPst);
272          break;
273       case STTFUSAP:
274       case STRGRSAP:
275          rgSCHLmmSapCntrl(cntrl, &cfm, &cfmPst);
276          break;
277       default:
278          cfm.cfm.status = LCM_PRIM_NOK;
279          cfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL;
280          RgMiLrgSchCntrlCfm(&cfmPst, &cfm);
281          RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "invalid elmnt=%d",
282                   cntrl->hdr.elmId.elmnt);
283          break;
284    }
285    /*   SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); */
286    RETVALUE(ret);
287 }/*-- RgMiLrgSchCntrlReq --*/
288
289 #ifdef LTE_L2_MEAS
290 /**
291  * @brief Layer Manager L2 Measurement request handler. 
292  *
293  * @details
294  *
295  *     Function : RgMiLrgSchL2MeasReq
296  *     
297  *     This function handles the control
298  *     measurement request received from the Layer Manager.
299  *     
300  *  @param[in]  Pst *pst, the post structure     
301  *  @param[in]  LrgSchMeasReqInfo *measInfo, measurement request info
302  *  @return  S16
303  *      -# ROK
304  **/
305 #ifdef ANSI
306 PUBLIC S16 RgMiLrgSchL2MeasReq
307 (
308 Pst               *pst,     /* post structure  */
309 LrgSchMeasReqInfo *measInfo /* Meas Req Info */
310 )
311 #else
312 PUBLIC S16 RgMiLrgSchL2MeasReq(pst, measInfo)
313    Pst               *pst;     /* post structure  */
314    LrgSchMeasReqInfo *measInfo; /* Meas Req Info */
315 #endif    
316 {
317    Pst                 cfmPst;
318    RgSchCellCb         *cell;
319    RgSchErrInfo        err;
320    S16                 ret = ROK; 
321    RgSchCb             *instCb =  &rgSchCb[(pst->dstInst - RGSCH_INST_START)];
322 #if (ERRCLASS & ERRCLS_ADD_RES) 
323    CmLList             *lnk;
324 #endif
325    U32                 idx;
326    RgSchL2MeasCb       *measCb = NULLP;
327 #ifdef DEBUGP
328    Inst      inst = (pst->dstInst - RGSCH_INST_START); /* Scheduler instance Id */
329 #endif
330
331    err.errType  = 0;
332    err.errCause = 0;
333
334    TRC3(RgMiLrgSchL2MeasReq)
335
336
337    /* Find the cellCb using cellId in measInfo. Iterate through all cells
338     * in rgrsapCb in RgschCb */
339    cell = NULLP;
340    for (idx = 0; idx < instCb->numSaps; idx++)
341    {
342       if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
343       {
344          /* got the cell break the loop */
345          cell = instCb->rgrSap[idx].cell;
346          break;
347       }
348    }
349    /* If no cellCb return Err with Invalid Cell Id */
350    if (cell == NULLP)
351    {
352       rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
353       RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_CELLID);
354       rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE);
355       RLOG_ARG2(L_ERROR,DBG_INSTID,inst, 
356                "Meas req Failed.Invalid Cell Id errType(%d) errCause(%d)",
357                err.errType, err.errCause);
358       RETVALUE(RFAILED);
359    }
360    /* Validate for Meas Types */
361    if ( (ret = rgSCHUtlValidateMeasReq(cell, measInfo, &err)) != ROK)
362    {
363       rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
364       RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_MEASTYPE);
365       rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE);
366       RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
367                "Meas req Failed.Invalid Measurement Type"
368                "errCasue(%d) errType(%d)", err.errType, err.errCause);
369       RETVALUE(RFAILED);
370    }
371    /* Iterate through all meas requests in l2mList in cellCb */
372 #if (ERRCLASS & ERRCLS_ADD_RES) 
373    lnk = cell->l2mList.first;
374    while(lnk != NULLP)
375    {
376       /* Get the MeasCb : RgSchL2MeasCb */
377       measCb = (RgSchL2MeasCb *)lnk->node;
378       lnk = lnk->next;
379       if (measCb->measReq.hdr.transId == measInfo->hdr.transId)
380       {
381          rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
382          RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_DUP_TRANSID);
383          rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE);
384          RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
385                   "Meas req Failed.Dublicate TransId"
386                   "errType(%d) errCause(%d)", err.errType, err.errCause);
387          RETVALUE(RFAILED);
388       }
389    }
390 #endif
391    /* Call L2M Function to store Meas req */
392    ret = rgSchL2mMeasReq(cell, measInfo, err);
393    if (ret != ROK)
394    {
395       rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
396       RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_L2MEAS_FAILED);
397       rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE);
398       RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId, 
399                "Meas req Failed.errType(%d) errCause(%d)",
400                err.errType, err.errCause);
401       RETVALUE(RFAILED);
402    }
403    RETVALUE(ret);
404 } /* -- RRgMiLrgSchL2MeasReq-- */
405
406 /**
407  * @brief Layer Manager L2 Measurement Stop request handler. 
408  *
409  * @details
410  *
411  *     Function : RgMiLrgSchL2MeasStopReq
412  *     
413  *     This function handles the control
414  *     measurement stop request received from the Layer Manager.
415  *     
416  *  @param[in]  Pst *pst, the post structure     
417  *  @param[in]  LrgSchMeasReqInfo *measInfo, measurement stop request info
418  *  @return  S16
419  *      -# ROK
420  **/
421 #ifdef ANSI
422 PUBLIC S16 RgMiLrgSchL2MeasStopReq
423 (
424 Pst               *pst,     /* post structure  */
425 LrgSchMeasStopReqInfo *measInfo /* Meas Req Info */
426 )
427 #else
428 PUBLIC S16 RgMiLrgSchL2MeasStopReq(pst, measInfo)
429    Pst               *pst;     /* post structure  */
430    LrgSchMeasStopReqInfo *measInfo; /* Meas Req Info */
431 #endif
432 {
433    S16                 ret = ROK;
434    RgSchCellCb         *cell = NULLP;
435    RgSchCb             *instCb =  &rgSchCb[(pst->dstInst - RGSCH_INST_START)];
436    CmLList             *node = NULLP;
437    RgSchL2MeasCb       *measCb = NULLP;
438    LrgSchMeasCfmInfo measCfm;
439    U8                  idx;
440
441
442    TRC3(RgMiLrgSchL2MeasStopReq)
443
444
445    for (idx = 0; idx < instCb->numSaps; idx++)
446    {
447       if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
448       {
449          /* got the cell break the loop */
450          cell = instCb->rgrSap[idx].cell;
451          break;
452       }
453    }
454    if (cell == NULLP)
455    {
456       RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId,
457                "Stop req Failed.Invalid Cell Id ");
458       RETVALUE(RFAILED);
459    }
460    cmMemset((U8 *)&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
461    node = cell->l2mList.first;
462    while(node != NULLP)
463    {
464       measCb = (RgSchL2MeasCb *)(node)->node;
465
466       node = (node)->next;
467       cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
468       rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,
469             sizeof(RgSchL2MeasCb));    
470    }
471
472    if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
473    {
474       RgInfL2MeasStopReq measStopReq;
475       Pst               pstMac;
476       cmMemset((U8 *)&measStopReq, 0, sizeof(RgInfL2MeasStopReq));
477       measStopReq.transId  = measInfo->hdr.transId;
478       measStopReq.measType = measInfo->measType;
479       /* measReq.timePrd  = measInfo->timePrd; */
480       measStopReq.cellId   = measInfo->cellId;
481       rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst);
482       RgSchMacL2MeasStop(&pstMac,&measStopReq);
483    }
484    else
485    { 
486       RgMiLrgSchL2MeasStopCfm(&(rgSchCb[cell->instIdx].rgSchInit.lmPst),
487             &measCfm);
488    }
489    RETVALUE(ret);
490 }/*RgMiLrgSchL2MeasStopReq*/
491 /**
492  * @brief Layer Manager L2 Measurement request handler. 
493  *        for Send l2 measurement req
494  * @details
495  *
496  *     Function : RgMiLrgSchL2MeasSendReq
497  *     
498  *     This function handles the control
499  *     measurement send request received from the Layer Manager.
500  *     
501  *  @param[in]  Pst *pst, the post structure     
502  *  @param[in]  LrgSchMeasReqInfo *measInfo, measurement stop request info
503  *  @return  S16
504  *      -# ROK
505  **/
506 #ifdef ANSI
507 PUBLIC S16 RgMiLrgSchL2MeasSendReq
508 (
509 Pst               *pst,     /* post structure  */
510 LrgSchMeasSndReqInfo *measInfo /* Meas Req Info */
511 )
512 #else
513 PUBLIC S16 RgMiLrgSchL2MeasSendReq(pst, measInfo)
514    Pst               *pst;     /* post structure  */
515    LrgSchMeasSndReqInfo *measInfo; /* Meas Req Info */
516 #endif
517 {
518    S16                 ret = ROK;
519    RgSchCellCb         *cell;
520    RgSchCb             *instCb =  &rgSchCb[(pst->dstInst - RGSCH_INST_START)];
521    U8                  idx;
522
523    TRC3(RgMiLrgSchL2MeasSendReq)
524
525
526
527    cell = NULLP;
528    for (idx = 0; idx < instCb->numSaps; idx++)
529    {
530       if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
531       {
532          /* got the cell break the loop */
533          cell = instCb->rgrSap[idx].cell;
534          break;
535       }
536    }
537    if (cell == NULLP)
538    {
539       RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId,
540                "Send req Failed.Invalid Cell Id");
541       RETVALUE(RFAILED);
542    }
543
544    if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
545    {
546       RgInfL2MeasSndReq measSndReq;
547       Pst               pstMac;
548       cmMemset((U8 *)&measSndReq, 0, sizeof(RgInfL2MeasSndReq));
549       measSndReq.transId  = measInfo->hdr.transId;
550       measSndReq.measType = measInfo->measType;
551       measSndReq.timePrd  = measInfo->timePrd;
552       measSndReq.cellId   = measInfo->cellId;
553       rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst);
554       RgSchMacL2MeasSend(&pstMac, &measSndReq);
555    }
556    else
557    { 
558       cell->sndL2Meas = TRUE;
559    }
560
561    RETVALUE(ret);
562 }/*RgMiLrgSchL2MeasSendReq*/
563 #endif /* LTE_L2_MEAS */
564
565
566
567
568 /************* RGR  Interface ****************/
569 /**
570  * @brief API for bind request from RRM towards MAC. 
571  *
572  * @details
573  *
574  *     Function: RgUiRgrBndReq
575  *     
576  *     This API is invoked by RRM towards MAC to bind RGR SAP. 
577  *     These API validates the Pst, spId, suId and sends the bind confirm to
578  *     RRM.
579  *
580  *           
581  *  @param[in]  Pst   *pst
582  *  @param[in]  SuId  suId
583  *  @param[in]  SpId  spId
584  *  @return  S16
585  *      -# ROK 
586  *      -# RFAILED 
587  **/
588 #ifdef ANSI
589 PUBLIC S16 RgUiRgrBndReq
590 (
591  Pst   *pst, 
592  SuId  suId,
593  SpId  spId
594  )
595 #else
596 PUBLIC S16 RgUiRgrBndReq(pst, suId, spId)
597    Pst   *pst; 
598    SuId  suId;
599    SpId  spId;
600 #endif
601 {
602    S16       ret = ROK;
603    Pst       tmpPst;   /* Temporary Post Structure */
604    Inst      instId = pst->dstInst-RGSCH_INST_START;
605    RgUstaDgn dgn;      /* Alarm diagnostics structure */
606
607    TRC3(RgUiRgrBndReq)
608
609
610    tmpPst.prior       = pst->prior;
611    tmpPst.route       = pst->route;
612    tmpPst.selector    = pst->selector;
613    tmpPst.region      = rgSchCb[instId].rgSchInit.region;
614    tmpPst.pool        = rgSchCb[instId].rgSchInit.pool;
615    tmpPst.srcProcId   = rgSchCb[instId].rgSchInit.procId;
616    tmpPst.srcEnt      = rgSchCb[instId].rgSchInit.ent;
617    tmpPst.srcInst     = rgSchCb[instId].rgSchInit.inst + RGSCH_INST_START;
618    tmpPst.event       = EVTNONE;
619    tmpPst.dstProcId   = pst->srcProcId;
620    tmpPst.dstEnt      = pst->srcEnt;
621    tmpPst.dstInst     = pst->srcInst;
622
623    if(spId < rgSchCb[instId].numSaps)
624    {
625       /* Check the state of the SAP */
626       switch (rgSchCb[instId].rgrSap[spId].sapSta.sapState)
627       {
628          /* This case might not be needed if SAP not configured then it will go
629           * to else of above if condition */
630          case LRG_UNBND: /* SAP is not bound */
631             RLOG0(L_DEBUG,"SAP Not yet bound");
632             rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_BND;
633             rgSchCb[instId].rgrSap[spId].sapCfg.suId = suId;
634             /* Send Bind Confirm with status as SUCCESS */
635             ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK);
636             /*Indicate to Layer manager  */
637             rgSCHUtlFillDgnParams(instId, &dgn, LRG_USTA_DGNVAL_MEM); 
638             ret = rgSCHLmmStaInd(instId, LCM_CATEGORY_INTERFACE,
639                   LRG_EVENT_RGRSAP_ENB, LCM_CAUSE_UNKNOWN, &dgn);
640             break;
641          case LRG_BND: /* SAP is already bound*/
642             RLOG0(L_DEBUG,"SAP is already bound");
643             ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK);
644             break;
645          default: /* Should Never Enter here */
646 #if (ERRCLASS & ERRCLS_ADD_RES) 
647             RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001, 
648                   (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
649                   "Invalid SAP State:RgUiRrgBndReq failed\n");
650 #endif
651             ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_NOK);
652             break;
653       }
654    }
655    else
656    {
657 #if (ERRCLASS & ERRCLS_ADD_RES)      
658       /* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state 
659          to spId to avoid seg fault due to invalid sapID */
660       RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002,
661             (ErrVal)spId, "Invalid SAP Id:RgUiRrgBndReq failed\n");
662 #endif
663       ret = RgUiRgrBndCfm(&tmpPst, suId, CM_BND_NOK);
664    }
665    RETVALUE(ret);
666 }  /* RgUiRgrBndReq */
667
668 /**
669  * @brief API for unbind request from RRM towards MAC. 
670  *
671  * @details
672  *
673  *     Function: RgUiRgrUbndReq
674  *     
675  *     This API is invoked by RRM towards MAC to unbind RGR SAP. 
676  *     These API validates the Pst, spId, suId and transfers the unbind request 
677  *     specific information to corresponding ownership module (GOM) API.
678  *
679  *           
680  *  @param[in]  Pst    *pst
681  *  @param[in]  SuId   suId
682  *  @param[in]  Reason reason
683  *  @return  S16
684  *      -# ROK 
685  *      -# RFAILED 
686  **/
687 #ifdef ANSI
688 PUBLIC S16 RgUiRgrUbndReq
689 (
690  Pst    *pst,
691  SpId   spId,
692  Reason reason
693  )
694 #else
695 PUBLIC S16 RgUiRgrUbndReq(pst, spId, reason)
696    Pst    *pst; 
697    SpId   spId;
698    Reason reason;
699 #endif
700 {
701    Inst instId = pst->dstInst-RGSCH_INST_START;
702    TRC3(RgUiRgrUbndReq)
703
704
705    /* SAP Id validation */
706    if (spId < rgSchCb[instId].numSaps)
707    {
708       switch(rgSchCb[instId].rgrSap[spId].sapSta.sapState)
709       {
710          case LRG_BND: /* SAP is already bound*/
711             RLOG0(L_DEBUG,"SAP is already bound");
712             /* setting SAP state to UN BOUND */
713             rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_UNBND;
714             break;
715          default:
716 #if (ERRCLASS & ERRCLS_ADD_RES)      
717             RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003,
718                   (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
719                   "Invalid SAP State: RgUiRgrUbndReq failed\n");
720 #endif
721             RETVALUE(RFAILED);
722       }
723    }
724    else
725    {
726 #if (ERRCLASS & ERRCLS_ADD_RES)      
727       RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004, 
728             (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
729             "Invalid SAP Id:RgUiRgrUbndReq failed\n");
730 #endif
731       RETVALUE(RFAILED);
732    }
733    RETVALUE(ROK);
734 }  /* RgUiRgrUbndReq */
735
736 /**
737  * @brief API for configuration request from RRM towards MAC. 
738  *
739  * @details
740  *
741  *     Function: RgUiRgrCfgReq
742  *     
743  *     This API is invoked by RRM towards MAC to configure MAC. 
744  *     These API validates the Pst, spId, suId and transfers the config request 
745  *     specific information to corresponding ownership module (GOM) API.
746  *
747  *           
748  *  @param[in]  Pst           *pst
749  *  @param[in]  SpId          spId
750  *  @param[in]  RgrCfgTransId transId
751  *  @param[in]  RgrCfgReqInfo *cfgReqInfo
752  *  @return  S16
753  *      -# ROK 
754  *      -# RFAILED 
755  **/
756 #ifdef ANSI
757 PUBLIC S16 RgUiRgrCfgReq
758 (
759  Pst           *pst, 
760  SpId          spId,
761  RgrCfgTransId transId,
762  RgrCfgReqInfo *cfgReqInfo
763  )
764 #else
765 PUBLIC S16 RgUiRgrCfgReq(pst, spId, transId, cfgReqInfo)
766    Pst           *pst; 
767    SpId          spId;
768    RgrCfgTransId transId;
769    RgrCfgReqInfo *cfgReqInfo;
770 #endif
771 {
772
773    S16       ret       = ROK;
774    U8        cfmStatus = 0x00ff;
775    U8        prntTrans[RGR_CFG_TRANSID_SIZE+1];
776    Inst      instId = pst->dstInst-RGSCH_INST_START;
777
778    TRC3(RgUiRgrCfgReq);
779
780    cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
781    prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
782
783
784    if (cfgReqInfo == NULLP)
785    {
786       RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer is NULL");
787       rgSCHUtlRgrCfgCfm(instId, spId, transId, cfmStatus); 
788       RETVALUE(RFAILED);
789    }
790
791    if (spId < rgSchCb[instId].numSaps)
792    {
793       switch(rgSchCb[instId].rgrSap[spId].sapSta.sapState)
794       {
795          case LRG_BND: /* SAP is already bound */
796             RLOG0(L_DEBUG,"SAP is already bound");
797             break;
798          default: /* Should never reach here */
799 #if (ERRCLASS & ERRCLS_ADD_RES)      
800             RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG005, 
801                   (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
802                   "Invalid SAP State: RgUiRgrCfgReq failed\n");
803 #endif
804             SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
805                   (Size)sizeof(*cfgReqInfo));
806             rgSCHUtlRgrCfgCfm(instId, spId, transId, cfmStatus); 
807             RETVALUE(RFAILED);
808       }
809    }
810    else
811    {
812 #if (ERRCLASS & ERRCLS_ADD_RES)      
813       RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG006,
814             (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
815             "Invalid SAP Id:RgUiRgrCfgReq failed\n");
816 #endif
817       SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
818             (Size)sizeof(*cfgReqInfo));
819       rgSCHUtlRgrCfgCfm(instId, spId, transId, cfmStatus); 
820       RETVALUE(RFAILED);
821    }
822
823    /* Handle configuration */
824    ret = rgSCHGomHndlCfg(pst->region, pst->pool,
825          &rgSchCb[instId], spId, transId, 
826          cfgReqInfo);
827    if (ret != ROK)
828    {
829       RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Configuration Request Handling Failed");
830       RETVALUE(RFAILED);
831    }
832
833    RETVALUE(ROK);
834 }  /* RgUiRgrCfgReq */
835
836 #ifdef RGR_SI_SCH
837 /**
838  * @brief API for SI configuration request from RRM towards MAC. 
839  *
840  * @details
841  *
842  *     Function: RgUiRgrSiCfgReq
843  *     
844  *     This API is invoked by RRM towards MAC to configure SI at MAC. 
845  *     These API validates the Pst, spId, suId and transfers the 
846  *     config request specific information to corresponding ownership 
847  *     module (GOM) API.
848  *
849  *           
850  *  @param[in]  Pst           *pst
851  *  @param[in]  SpId          spId
852  *  @param[in]  RgrCfgTransId transId
853  *  @param[in]  RgrSiCfgReqInfo *cfgReqInfo
854  *  @return  S16
855  *      -# ROK 
856  *      -# RFAILED 
857  **/
858 #ifdef ANSI
859 PUBLIC S16 RgUiRgrSiCfgReq
860 (
861 Pst           *pst, 
862 SpId          spId,
863 RgrCfgTransId transId,
864 RgrSiCfgReqInfo *cfgReqInfo
865 )
866 #else
867 PUBLIC S16 RgUiRgrSiCfgReq(pst, spId, transId, cfgReqInfo)
868 Pst           *pst; 
869 SpId          spId;
870 RgrCfgTransId transId;
871 RgrSiCfgReqInfo *cfgReqInfo;
872 #endif
873 {
874    S16       ret       = ROK;
875    U8        cfmStatus = RGR_CFG_CFM_NOK;
876    U8        prntTrans[RGR_CFG_TRANSID_SIZE+1];
877    Inst      instId = pst->dstInst-RGSCH_INST_START;
878
879    TRC2(RgUiRgrSiCfgReq);
880
881    cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
882    prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
883
884
885    if (cfgReqInfo == NULLP)
886    {
887       RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
888                    "is NULL");
889       rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus); 
890       RETVALUE(RFAILED);
891    }
892
893    if (spId < rgSchCb[instId].numSaps)
894    {
895       if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
896       {
897 #if (ERRCLASS & ERRCLS_ADD_RES)      
898          RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007, 
899                   (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
900                   "Invalid SAP State: RgUiRgrSiCfgReq failed\n");
901 #endif
902          SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
903                                           (Size)sizeof(*cfgReqInfo));
904          rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus); 
905          RETVALUE(RFAILED);
906       }
907    }
908    else
909    {
910 #if (ERRCLASS & ERRCLS_ADD_RES)      
911       RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008,
912             (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
913             "Invalid SAP Id:RgUiRgrSiCfgReq failed\n");
914 #endif
915       SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
916                                    (Size)sizeof(*cfgReqInfo));
917       rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus); 
918       RETVALUE(RFAILED);
919    }
920
921    /* Handle configuration */
922 #ifdef EMTC_ENABLE
923 if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable)
924 {
925    ret = rgSCHGomEmtcHndlSiCfg(pst->region, pst->pool,
926             &rgSchCb[instId], spId, transId, 
927                         cfgReqInfo);
928 }
929 else
930 {
931    ret = rgSCHGomHndlSiCfg(pst->region, pst->pool,
932             &rgSchCb[instId], spId, transId, 
933                         cfgReqInfo);
934 }
935  #else
936    ret = rgSCHGomHndlSiCfg(pst->region, pst->pool,
937             &rgSchCb[instId], spId, transId, 
938                         cfgReqInfo);
939  #endif
940    if (ret != ROK)
941    {
942       RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"RgUiRgrSiCfgReq:"
943                    "Configuration Request Handling Failed");
944       RETVALUE(RFAILED);
945    }
946
947    RETVALUE(ROK);
948 }  /* RgUiRgrSiCfgReq */
949
950 \f
951 /**
952  * @brief API for Warning SI configuration request from RRM towards MAC. 
953  *
954  * @details
955  *
956  *     Function: RgUiRgrWarningSiCfgReq
957  *     
958  *     This API is invoked by RRM towards MAC to configure SI at MAC. 
959  *     These API validates the Pst, spId, suId and transfers the 
960  *     config request specific information to corresponding ownership 
961  *     module (GOM) API.
962  *
963  *           
964  *  @param[in]  Pst           *pst
965  *  @param[in]  SpId          spId
966  *  @param[in]  RgrCfgTransId transId
967  *  @param[in]  RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
968  *  @return  S16
969  *      -# ROK 
970  *      -# RFAILED 
971  **/
972 #ifdef ANSI
973 PUBLIC S16 RgUiRgrWarningSiCfgReq
974 (
975 Pst           *pst, 
976 SpId          spId,
977 RgrCfgTransId transId,
978 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
979 )
980 #else
981 PUBLIC S16 RgUiRgrWarningSiCfgReq(pst, spId, transId, warningSiCfgReqInfo)
982 Pst           *pst; 
983 SpId          spId;
984 RgrCfgTransId transId;
985 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo;
986 #endif
987 {
988    Inst     instId = pst->dstInst-RGSCH_INST_START;
989    S16      ret    = ROK;
990    U8       cfmStatus = RGR_CFG_CFM_NOK;
991    U8       prntTrans[RGR_CFG_TRANSID_SIZE+1];
992
993    TRC2(RgUiRgrWarningSiCfgReq);
994
995    cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
996    prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
997
998
999
1000    if (warningSiCfgReqInfo == NULLP)
1001    {
1002       RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
1003                "is NULL");
1004       rgSCHUtlRgrWarningSiCfgCfm(instId, spId, 0, transId, cfmStatus);
1005       RETVALUE(RFAILED);
1006    }
1007
1008    if (spId < rgSchCb[instId].numSaps)
1009    {
1010       if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
1011       {
1012 #if (ERRCLASS & ERRCLS_ADD_RES)      
1013          RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG023, 
1014                (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
1015                "Invalid SAP State: warningSiCfgReqInfo failed\n");
1016 #endif
1017          rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool, 
1018                &warningSiCfgReqInfo->siPduLst);
1019          SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
1020                sizeof(RgrWarningSiCfgReqInfo));
1021          rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId, 
1022                transId, cfmStatus);
1023          RETVALUE(RFAILED);
1024       }
1025    }
1026    else
1027    {
1028 #if (ERRCLASS & ERRCLS_ADD_RES)      
1029       RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG024,
1030             (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
1031             "Invalid SAP Id:warningSiCfgReqInfo failed\n");
1032 #endif
1033       rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool, 
1034             &warningSiCfgReqInfo->siPduLst);
1035       SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
1036             sizeof(RgrWarningSiCfgReqInfo));
1037       rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId, 
1038             transId, cfmStatus);
1039       RETVALUE(RFAILED);
1040    }
1041
1042    /* Handle configuration */
1043 #ifdef EMTC_ENABLE
1044 if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable)
1045 {
1046    ret = rgSCHGomEmtcHndlWarningSiCfg(pst->region, pst->pool,
1047          &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
1048 }
1049 else
1050 {
1051    ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool,
1052          &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
1053 }
1054 #else
1055    ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool,
1056          &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
1057 #endif
1058    if(ret != ROK)
1059    {
1060       RLOG_ARG0(L_ERROR,DBG_INSTID,instId,
1061                "Configuration Request Handling Failed");
1062       RETVALUE(RFAILED);
1063    }
1064
1065    RETVALUE(ROK);
1066 }
1067
1068 \f
1069 /**
1070  * @brief API for Warning SI Stop  request from RRM towards MAC. 
1071  *
1072  * @details
1073  *
1074  *     Function: RgUiRgrWarningSiStopReq
1075  *     
1076  *     This API is invoked by RRM towards MAC to Stop warning SI at MAC. 
1077  *     These API validates the Pst, spId, suId and transfers the 
1078  *     stop request specific information to corresponding ownership 
1079  *     module (GOM) API.
1080  *
1081  *           
1082  *  @param[in]  Pst           *pst
1083  *  @param[in]  SpId          spId
1084  *  @param[in]  RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
1085  *  @return  S16
1086  *      -# ROK 
1087  *      -# RFAILED 
1088  **/
1089 #ifdef ANSI
1090 PUBLIC S16 RgUiRgrWarningSiStopReq
1091 (
1092 Pst           *pst,
1093 SpId          spId,
1094 RgrCfgTransId transId,
1095 U8            siId
1096 )
1097 #else
1098 PUBLIC S16 RgUiRgrWarningSiStopReq(pst,spId, transId, siId)
1099 Pst           *pst;
1100 SpId          spId;
1101 RgrCfgTransId transId;
1102 U8            siId;
1103 #endif
1104 {         
1105    Inst         instId = pst->dstInst-RGSCH_INST_START;
1106
1107    TRC3(RgUiRgrWarningSiStopReq)
1108
1109
1110
1111    if (spId < rgSchCb[instId].numSaps)
1112    {
1113       if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
1114       {
1115 #if (ERRCLASS & ERRCLS_ADD_RES)      
1116          RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG025, 
1117                (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
1118                "Invalid SAP State: RgUiRgrWarningSiStopReq failed\n");
1119 #endif
1120          RETVALUE(RFAILED);
1121       }
1122    }
1123    else
1124    {
1125 #if (ERRCLASS & ERRCLS_ADD_RES)      
1126       RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG026,
1127             (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
1128             "Invalid SAP Id:RgUiRgrWarningSiStopReq failed\n");
1129 #endif
1130       RETVALUE(RFAILED);
1131    }
1132
1133    rgSCHGomHndlWarningSiStopReq(pst->region, pst->pool,
1134          &rgSchCb[instId], siId, transId, spId);
1135
1136    RETVALUE(ROK);
1137 }
1138 #endif /*RGR_SI_SCH */
1139
1140 /* LTE_ADV_FLAG_REMOVED_START */
1141
1142 /**
1143  * @brief API for LOAD INF request from RRM towards MAC.
1144  *
1145  * @details
1146  *
1147  *     Function: RgUiRgrLoadInfReq
1148  *
1149  *     This API is invoked by RRM towards MAC to configure LOAD INF Parameters at MAC.
1150  *     These API validates the Pst, spId, suId and transfers the
1151  *     LOAD INF request to corresponding ownership
1152  *     module (GOM) API.
1153  *
1154  *
1155  *  @param[in]  Pst               *pst
1156  *  @param[in]  SpId              spId
1157  *  @param[in]  RgrCfgTransId     transId
1158  *  @param[in]  RgrLoadInfReqInfo *loadInfReq
1159  *  @return  S16
1160  *      -# ROK
1161  *      -# RFAILED
1162  **/
1163 #ifdef ANSI
1164 PUBLIC S16 RgUiRgrLoadInfReq
1165 (
1166  Pst               *pst,
1167  SpId              spId,
1168  RgrCfgTransId     transId,
1169  RgrLoadInfReqInfo *loadInfReq
1170  )
1171 #else
1172 PUBLIC S16 RgUiRgrLoadInfReq(pst, spId, transId, loadInfReq)
1173    Pst               *pst;
1174    SpId              spId;
1175    RgrCfgTransId     transId;
1176    RgrLoadInfReqInfo *loadInfReq;
1177 #endif
1178 {
1179    S16       ret       = ROK;
1180    U8        prntTrans[RGR_CFG_TRANSID_SIZE+1];
1181    Inst      instId = pst->dstInst-RGSCH_INST_START;
1182
1183    TRC2(RgUiRgrLoadInfReq);
1184
1185    cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
1186    prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
1187
1188
1189    if (loadInfReq == NULLP)
1190    {
1191       RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
1192                "is NULL");
1193       RETVALUE(RFAILED);
1194    }
1195
1196    if (spId < rgSchCb[instId].numSaps)
1197    {
1198       if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
1199       {
1200 #if (ERRCLASS & ERRCLS_ADD_RES)
1201          RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007, 
1202                (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
1203                "Invalid SAP State: RgUiRgrLoadInfReq failed\n");
1204 #endif
1205          SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq,
1206                (Size)sizeof(*loadInfReq));
1207          RETVALUE(RFAILED);
1208       }
1209    }
1210    else
1211    {
1212 #if (ERRCLASS & ERRCLS_ADD_RES)
1213       RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008,
1214             (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
1215             "Invalid SAP Id:RgUiRgrLoadInfReq failed\n");
1216 #endif
1217       SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq,
1218             (Size)sizeof(*loadInfReq));
1219       RETVALUE(RFAILED);
1220    }
1221
1222    /* Handle configuration */
1223    ret = rgSCHGomHndlLoadInf(pst->region, pst->pool,
1224          &rgSchCb[(pst->dstInst - RGSCH_INST_START)], spId, transId, 
1225          loadInfReq);
1226    if (ret != ROK)
1227    {
1228       RLOG_ARG0(L_ERROR,DBG_INSTID,instId,
1229                "Configuration Request Handling Failed");
1230       RETVALUE(RFAILED);
1231    }
1232
1233    RETVALUE(ROK);
1234 }  /* RgUiRgrLoadInfReq */
1235 /* LTE_ADV_FLAG_REMOVED_END */
1236
1237 /************** MAC SCH Interface **************/ 
1238 /**
1239  * @brief Function for updating dedicated channel BO at scheduler from MAC.
1240  *
1241  * @details
1242  *
1243  *     Function : rgMacSchDedBoUpdtReq
1244  *     
1245  *     This function shall be invoked whenever MAC gets staRsp from RLC
1246  *     Scheduler shall update BO in its dedicated logical channel control block.
1247  *           
1248  *  @param[in] Pst*           pst
1249  *  @param[in] S16            cellSapId
1250  *  @param[in] RgInfDedBoRpt  *boRpt
1251  *  @return  S16
1252  *      -# ROK 
1253  **/
1254 #ifdef ANSI
1255 PUBLIC S16 RgMacSchDedBoUpdtReq
1256 (
1257 Pst*           pst,
1258 RgInfDedBoRpt  *boRpt
1259 )
1260 #else
1261 PUBLIC S16 RgMacSchDedBoUpdtReq(pst, boRpt)
1262 Pst*           pst;
1263 RgInfDedBoRpt  *boRpt;
1264 #endif
1265 {
1266    RgSchCellCb   *cell;
1267    RgSchUeCb     *ue;
1268 #ifdef SCH_STATS
1269       RgSchCmnDlUe  *dlUe;
1270 #endif
1271
1272
1273    Inst          inst = (pst->dstInst - RGSCH_INST_START);
1274    S16           cellSapId = boRpt->cellSapId;
1275
1276    TRC3(RgMacSchDedBoUpdtReq)
1277 /*
1278    RLOG_ARG2(L_DEBUG,DBG_CELLID,boRpt->cellId,"rgMacSchDedBoUpdtReq():"
1279             " boRpt->rnti = %u  boRpt->lcId = %u",boRpt->rnti, boRpt->lcId);
1280 */
1281    /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1282     * it doesnt exist */
1283    cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1284
1285 #ifndef NO_ERRCLS
1286    if (cell->cellId != boRpt->cellId)
1287    {
1288       /* Handle Cell fetch failure */
1289       RGSCHLOGERROR(inst, ERRCLS_INT_PAR,ERG009,(ErrVal)boRpt->cellId,
1290                             "rgMacSchDedBoUpdtReq(): Invalid cell Id");
1291       RETVALUE(RFAILED);
1292    }
1293 #endif
1294
1295    /* Update Bo in the given logical channel of the UE */
1296    if ((ue = rgSCHDbmGetUeCb(cell, boRpt->rnti)) != NULLP)
1297    {
1298       RgSchDlLcCb   *dlLc;
1299       /* Honor BO Reports only from PCELL */
1300 #ifdef LTE_ADV
1301       if (cell != ue->cell)
1302       {
1303          RETVALUE(RFAILED);
1304       }
1305 #endif
1306       if ((dlLc = rgSCHDbmGetDlDedLcCb(ue, boRpt->lcId)) != NULLP)
1307       {
1308 #ifdef LTE_L2_MEAS
1309          if(dlLc->lcType == CM_LTE_LCH_DTCH)
1310          {
1311             if((dlLc->bo == 0) &&(boRpt->bo != 0))
1312             {
1313                /* UE is active */
1314                if(!(ue->qciActiveLCs[dlLc->qciCb->qci]))
1315                {
1316                   dlLc->qciCb->dlUeCount++;
1317                }
1318                ue->qciActiveLCs[dlLc->qciCb->qci]++;
1319             }
1320             else if((dlLc->bo != 0) && (boRpt->bo == 0) && (dlLc->qciCb->dlUeCount))
1321             {
1322                /* UE is inactive */
1323                if (ue->qciActiveLCs[dlLc->qciCb->qci])
1324                {
1325                   ue->qciActiveLCs[dlLc->qciCb->qci]--;
1326                   if (!(ue->qciActiveLCs[dlLc->qciCb->qci]))
1327                   {
1328                      dlLc->qciCb->dlUeCount--;
1329                   }
1330                }
1331             }
1332         }
1333 #endif
1334 #ifdef SCH_STATS
1335          dlUe = RG_SCH_CMN_GET_DL_UE(ue, cell);
1336          if (boRpt->bo > dlLc->bo)
1337          {
1338             dlUe->boReported += (boRpt->bo - dlLc->bo);
1339          }
1340 #endif
1341 #ifdef TENB_STATS
1342          if (boRpt->bo > dlLc->bo)
1343          {
1344             ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlBo += ((boRpt->bo - dlLc->bo)<<3);
1345          }
1346 #endif
1347          /* RLC provides cumulative BO for each LC.
1348           * Reduce the left out unscheduled bo from total bo and 
1349           * update the new BO to the total bo */
1350          if(ue->totalBo >= dlLc->bo)
1351          {
1352             ue->totalBo -= dlLc->bo;
1353          }
1354          else
1355          {
1356             ue->totalBo = 0; /* this case should not arise
1357                              * Resetting for safety */
1358          }
1359
1360          ue->totalBo +=  boRpt->bo;
1361          dlLc->bo = boRpt->bo;
1362          dlLc->oldestSduArrTime = boRpt->oldestSduArrTime;
1363          dlLc->staPduBo = boRpt->staPduBo;
1364          
1365          dlLc->setMaxUlPrio = boRpt->setMaxUlPrio;
1366          dlLc->setMaxDlPrio = boRpt->setMaxDlPrio;
1367          /* Update the scheduler */
1368          rgSCHUtlDlDedBoUpd(cell, ue, dlLc);
1369          RETVALUE(ROK);
1370       }
1371    }
1372    RETVALUE(RFAILED);
1373
1374 } /* end of rgMacSchDedBoUpdtReq */
1375
1376
1377 /**
1378  * @brief Function for updating common channel BO at scheduler from MAC.
1379  *
1380  * @details
1381  *
1382  *     Function : RgMacSchCmnBoUpdtReq
1383  *     
1384  *     This function shall be invoked whenever MAC gets staRsp from RLC
1385  *     Scheduler shall update BO in its common logical channel control block.
1386  *           
1387  *  @param[in] Pst*            pst
1388  *  @param[in] S16             cellSapId
1389  *  @param[in] RgInfCmnBoRpt  *boRpt
1390  *  @return  S16
1391  *      -# ROK 
1392  **/
1393 #ifdef ANSI
1394 PUBLIC S16 RgMacSchCmnBoUpdtReq
1395 (
1396 Pst*           pst,
1397 RgInfCmnBoRpt  *boRpt
1398 )
1399 #else
1400 PUBLIC S16 RgMacSchCmnBoUpdtReq(pst, boRpt)
1401 Pst*           pst;
1402 RgInfCmnBoRpt  *boRpt;
1403 #endif
1404 {
1405    RgSchCellCb   *cell;
1406    Inst          inst = (pst->dstInst - RGSCH_INST_START);
1407    S16           cellSapId = boRpt->cellSapId;
1408
1409    TRC3(RgMacSchCmnBoUpdtReq)
1410
1411    /* No need to chk for cell being NULL as MAC would not have found instance if
1412     * it doesnt exist */
1413    cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1414    if (cell->cellId != boRpt->cellId)
1415    {
1416       RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():"
1417                "Invalid boRpt cell Id:%d",boRpt->cellId);
1418       RETVALUE(RFAILED);
1419    }
1420
1421    /* handle status response on CCCH */
1422    if(boRpt->lcId == cell->dlCcchId)
1423    {
1424       RLOG_ARG0(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():"
1425                " BO update for CCCH");
1426       rgSCHUtlHndlCcchBoUpdt(cell, boRpt); 
1427    }
1428    else
1429    {
1430       rgSCHUtlHndlBcchPcchBoUpdt(cell, boRpt); 
1431    }
1432    
1433    RETVALUE(ROK);
1434 } /* end of RgMacSchCmnBoUpdtReq */
1435 /*Fix: start: Inform UE delete to scheduler*/
1436 /**
1437  * @brief This API is used to send data indication to Scheduler instance from MAC.
1438  *
1439  * @details
1440  *
1441  *     Function : rgMacSchUeDelInd
1442  *     
1443  *     This function shall be invoked whenever MAC gets Ue delete request. 
1444  *      
1445  *           
1446  *  @param[in] Pst*            pst
1447  *  @param[in] RgInfUeDelInd   *ueDelInd
1448  *  @return  S16
1449  *      -# ROK 
1450  **/
1451 #ifdef ANSI
1452 PUBLIC S16 RgMacSchUeDelInd
1453 (
1454 Pst*             pst,
1455 RgInfUeDelInd    *ueDelInd
1456 )
1457 #else
1458 PUBLIC S16 RgMacSchUeDelInd(pst, ueDelInd)
1459 Pst*             pst;
1460 RgInfUeDelInd    *ueDelInd;
1461 #endif
1462 {
1463    RgSchCellCb       *cell;
1464    Inst              inst = (pst->dstInst - RGSCH_INST_START);
1465    S16               cellSapId = ueDelInd->cellSapId;
1466    CmLList           *tmp;
1467    RgSchRntiLnk      *rntiLnk=NULL;
1468    
1469    TRC3(RgMacSchUeDelInd)
1470
1471    if (rgSchCb[inst].rgrSap == NULLP || rgSchCb[inst].rgrSap[cellSapId].cell == NULLP)
1472    {
1473       RLOG_ARG0(L_ERROR,DBG_CELLID,ueDelInd->cellId,"rgrSap or cell is not configured");
1474       RETVALUE(ROK);
1475    }
1476    cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1477 #ifndef NO_ERRCLS
1478    if (cell->cellId != ueDelInd->cellId)
1479    {
1480       /* Handle Cell fetch failure */
1481       RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1482                         "rgMacSchUeDelInd(): Invalid ueDelInd cell Id:%d",
1483                          ueDelInd->cellId);
1484       RETVALUE(ROK);
1485    }
1486 #endif
1487       
1488    CM_LLIST_FIRST_NODE(&cell->rntiDb.rntiGuardPool, tmp);
1489
1490    while(tmp)
1491    {
1492       rntiLnk = (RgSchRntiLnk *)(tmp->node);
1493       if(rntiLnk->rnti == ueDelInd->rnti)
1494       {
1495          cmLListDelFrm(&cell->rntiDb.rntiGuardPool, tmp);
1496          tmp->node = NULLP;
1497          rgSCHDbmRlsRnti(cell, rntiLnk);
1498          RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId,
1499                   "RNTI:%d Released from the Guard pool(%ld)",
1500                   ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count);
1501          
1502          break;
1503       }
1504       CM_LLIST_NEXT_NODE(&cell->rntiDb.rntiGuardPool, tmp);
1505    }
1506
1507 #ifdef EMTC_ENABLE
1508  rgEmtcMacSchUeDelInd(cell,ueDelInd);  
1509 #endif
1510
1511    if(tmp == NULLP)
1512    {
1513       /* Fix : syed HO UE does not have a valid ue->rntiLnk */
1514       RLOG_ARG2(L_INFO,DBG_CELLID,ueDelInd->cellId,"HO CRNTI:%d not present in the"
1515            "Guard Pool:%ld", ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count);
1516    } 
1517    
1518    RETVALUE(ROK);
1519 }  /* rgMacSchUeDelInd */
1520 /*Fix: end: Inform UE delete to scheduler*/
1521 /**
1522  * @brief This API is used to send data indication to Scheduler instance from MAC.
1523  *
1524  * @details
1525  *
1526  *     Function : rgMacSchSfRecpInd
1527  *     
1528  *     This function shall be invoked whenever MAC gets datInd on TFU
1529  *     Scheduler shall act on the CEs and data that are received as part of
1530  *     datInd.
1531  *           
1532  *  @param[in] Pst*            pst
1533  *  @param[in] S16             cellSapId
1534  *  @param[in] CmLteRnti       rnti
1535  *  @param[in] DatIndInfo      *datInd
1536  *  @return  S16
1537  *      -# ROK 
1538  **/
1539 #ifdef ANSI
1540 PUBLIC S16 RgMacSchSfRecpInd
1541 (
1542 Pst*             pst,
1543 RgInfSfDatInd    *subfrmInfo
1544 )
1545 #else
1546 PUBLIC S16 RgMacSchSfRecpInd(pst, subfrmInfo)
1547 Pst*             pst;
1548 RgInfSfDatInd    *subfrmInfo;
1549 #endif
1550 {
1551    S16               ret = RFAILED;
1552    RgSchErrInfo      err;
1553    RgSchUeCb         *ue;
1554    RgInfUeDatInd     *datInd;
1555    RgSchCellCb       *cell;
1556    Inst              inst = (pst->dstInst - RGSCH_INST_START);
1557    CmLteRnti         rnti;
1558    CmLListCp         *lnkLst;
1559    CmLList           *tmp;
1560    S16               cellSapId = subfrmInfo->cellSapId;
1561    RgrUeStaIndInfo   *ueStaInd;
1562 #ifdef RG_UNUSED
1563 //#ifdef LTEMAC_SPS
1564    RgSchCmnUlUeSpsInfo   *ulSpsUe ;
1565 #endif
1566    /* RRM_RBC_X */
1567    U32                   idx;
1568    /* RRM_RBC_Y */
1569    
1570 #ifdef LTE_L2_MEAS
1571    U8               qci;
1572    U16              datIndActQci = 0;
1573    U16              combDatIndActQci = 0; /* Prev and Latest Dat Ind combined */
1574    U16              tempUeActQci = 0; /* UE specific Active QCIs */
1575    U16              diffBits = 0;
1576    U8               lcCount;
1577 #endif
1578    TRC3(RgMacSchSfRecpInd)
1579
1580    /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1581     * it doesnt exist */
1582    cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1583
1584    /* lnkLst assignment */
1585    lnkLst = &(subfrmInfo->ueLst);
1586
1587    CM_LLIST_FIRST_NODE(lnkLst, tmp);
1588
1589    while((NULLP != tmp) && ((RgInfUeDatInd *)tmp->node != NULLP))
1590    {
1591       ue = NULLP;
1592 #ifdef LTE_L2_MEAS
1593       qci = 0;
1594 #endif
1595       datInd   = (RgInfUeDatInd *)tmp->node;
1596       rnti     = datInd->rnti;
1597
1598       /* We shall try and find
1599        * out the RaCb based on the following - 
1600        * 1. If the incoming PDU contained a CCCH SDU i.e. this is message 3.
1601        * 2. If the incoming PDU contained a CRNTI control element, i.e. we should
1602        * have a ueCb also for this 
1603        */
1604       
1605       /* It could be that a non-msg3 pdu contains a CRNTI Control element. We
1606        * should check for CRNTI CE and if it exists the UECb must exist, also an
1607        * if the CRNTI in the CE and the one with which the message came in are
1608        * different we shall look for an raCb as well. 
1609        */
1610       if (datInd->ceInfo.bitMask & RGSCH_CRNTI_CE_PRSNT)
1611       {
1612          /* SR_RACH_STATS : CRNTI CE*/
1613          rgNumMsg3CrntiCE++;
1614
1615          if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT)
1616          {
1617             RGSCH_FREE_MEM(subfrmInfo);
1618             err.errType = RGSCHERR_TOM_DATIND;
1619             RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1620                       "Received MSG3 with CRNTI:%d and also CCCH ", 
1621                      datInd->ceInfo.ces.cRnti);
1622             RETVALUE(RFAILED);
1623          }
1624          ue = rgSCHDbmGetUeCb (cell, datInd->ceInfo.ces.cRnti);
1625          if (ue == NULLP)
1626          {
1627             /* SR_RACH_STATS : CRNTI CE UECB NOT FOUND*/
1628             rgNumCrntiCeCrntiNotFound++;
1629             /* ccpu00141318 - Removed condition for SPS rnti checking*/
1630             RGSCH_FREE_MEM(subfrmInfo);
1631             err.errType = RGSCHERR_TOM_DATIND;
1632             RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Received MSG3 "
1633                      "with CRNTI:%d unable to find ueCb", 
1634                      datInd->ceInfo.ces.cRnti);
1635             RETVALUE(RFAILED);
1636          }
1637
1638          if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue, 
1639                rnti, datInd, &err)) != ROK)
1640          { 
1641             RGSCH_FREE_MEM(subfrmInfo);
1642             err.errType = RGSCHERR_TOM_DATIND;
1643             RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Processing for MSG3 failed for CRNTI:%d", 
1644                      datInd->rnti);
1645             RETVALUE(RFAILED);
1646          }
1647          
1648 #ifdef LTEMAC_SPS
1649          rgSCHUtlHdlCrntiCE (cell, ue);
1650 #endif
1651          ret = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&ueStaInd,
1652                                   sizeof(RgrUeStaIndInfo));
1653          if(ret == ROK)
1654          {
1655             ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD;
1656 #ifdef RG_UNUSED
1657 //#ifdef LTEMAC_SPS
1658             ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue);
1659             if(ulSpsUe->isUlSpsActv)
1660             {
1661                ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD_IN_SPS_ACTIVE;
1662                ue->ul.ulSpsCfg.isLcSRMaskEnab = FALSE;
1663             }
1664 #endif
1665             ret = rgSCHUtlFillSndUeStaInd(cell, ue, ueStaInd);
1666             if(ret != ROK)
1667             {
1668                RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1669                    "Could not Send Ue Sta Ind UEID:%d",ue->ueId);
1670             }
1671          }
1672          CM_LLIST_NEXT_NODE(lnkLst, tmp);
1673          continue;
1674       } /* end of CRNTI based message */
1675       else if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT)
1676       {
1677          /* SR_RACH_STATS : CCCH SDU */
1678          rgNumMsg3CCCHSdu++;
1679          /* SR_RACH_STATS : CCCH SDU RACB NOT FOUND*/
1680          if (NULLP == rgSCHDbmGetRaCb (cell, rnti))
1681          {
1682             rgNumCCCHSduCrntiNotFound++;
1683          }
1684
1685          if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue, 
1686                rnti, datInd, &err)) != ROK)
1687          { 
1688             RGSCH_FREE_MEM(subfrmInfo);
1689             err.errType = RGSCHERR_TOM_DATIND;
1690             RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Processing for MSG3 failed for CRNTI:%d", 
1691                      datInd->rnti);
1692             RETVALUE(RFAILED);
1693          }
1694          /* fix */
1695           CM_LLIST_NEXT_NODE(lnkLst, tmp);
1696           continue;
1697       } /* end of Msg3 processing */
1698
1699       if (ue == NULLP)
1700       {
1701          ue = rgSCHDbmGetUeCb (cell, datInd->rnti);
1702          if (ue == NULLP)
1703          {
1704 #ifdef LTEMAC_SPS 
1705          if((ue = rgSCHDbmGetSpsUeCb (cell, datInd->rnti)) == NULLP)
1706 #endif
1707             {
1708                RGSCH_FREE_MEM(subfrmInfo);
1709                err.errType = RGSCHERR_TOM_DATIND;
1710                RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the UE CB for CRNTI:%d", 
1711                datInd->rnti);
1712                RETVALUE(RFAILED);
1713             }
1714          }
1715       }
1716 /* L2_COUNTERS */
1717 #ifdef LTE_L2_MEAS
1718       /* The LCs for which data is received at MAC is provided to SCH.
1719          This information is used to estimate the Active LCs at UE
1720          since estimates based on only BSR is not accurate */
1721       if (datInd->ceInfo.bitMask & RGSCH_ACTIVE_LC_PRSNT)
1722       {
1723       
1724         /* Compose a Bitmask with for the QCI's for which Data
1725            is received */
1726         for (lcCount = 0; lcCount < RGINF_MAX_NUM_DED_LC; lcCount++)
1727         {
1728            if ((datInd->ceInfo.ulActLCs[lcCount] == TRUE) && (TRUE == ue->ul.lcCb[lcCount].isValid))
1729            {
1730               datIndActQci |= (1 << (ue->ul.lcCb[lcCount].qciCb->qci -1));
1731            }
1732         }
1733         if (ue->ulActiveLCs && ue->lastDatIndLCs)
1734         {
1735            /* Combine previous Dat Ind and current Dat Ind to
1736               estimate active LCs at UE */
1737            combDatIndActQci = ue->lastDatIndLCs | datIndActQci;
1738            tempUeActQci = ue->ulActiveLCs;
1739            ue->ulActiveLCs = combDatIndActQci;
1740            diffBits = combDatIndActQci ^ tempUeActQci;
1741            while (diffBits)
1742            {
1743               qci++;
1744               if (0x1 & diffBits)
1745               {
1746                  if (0x1 & tempUeActQci)
1747                  {
1748                     /* An active QCI has become inactive */
1749                     cell->qciArray[qci].ulUeCount--;
1750                  }
1751                  else
1752                  {
1753                     /* An Inactive QCI has become active */
1754                     cell->qciArray[qci].ulUeCount++;
1755                  }
1756               }
1757               diffBits >>= 1;
1758               tempUeActQci >>= 1;
1759            }
1760         }
1761         ue->lastDatIndLCs = datIndActQci;
1762       
1763       }
1764
1765 #endif /* LTE_L2_MEAS */
1766       /* Just copy the timing information from the dat indication into the one
1767        * stored in the UE CB, will be later utilized to handle Timing advance 
1768        */
1769
1770       if ((ret = rgSCHUtlUpdSch (subfrmInfo, cell, ue, datInd, &err)) != ROK)
1771       {
1772          RGSCH_FREE_MEM(subfrmInfo);
1773          err.errType = RGSCHERR_TOM_DATIND;
1774          RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to handle Data"
1775                    " Indication for UEID:%d",ue->ueId);
1776          RETVALUE(RFAILED);
1777       }
1778
1779       CM_LLIST_NEXT_NODE(lnkLst, tmp);
1780    }
1781    /* RRM_RBC_X */
1782    /* update the UL PRB usage for all GBR QCIs*/
1783    for (idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++)
1784    {
1785       cell->prbUsage.qciPrbRpts[idx].ulTotPrbUsed += subfrmInfo->qcisUlPrbCnt[idx];
1786    }
1787    /* RRM_RBC_Y */
1788
1789    /* chk if Sch needs to dealloc datInd after unpk */
1790    RGSCH_FREE_MEM(subfrmInfo);
1791    RETVALUE(ret);
1792 }  /* rgMacSchSfRecpInd */
1793
1794 #ifdef LTEMAC_SPS
1795 /**
1796  * @brief Function to handle relInd from MAC for a UE
1797  *
1798  * @details
1799  *
1800  *     Function: RgMacSchSpsRelInd
1801  *
1802  *     Handler for processing relInd for UL SPS of a UE
1803  *
1804  *     Invoked by: 
1805  *         MAC
1806  *
1807  *     Processing Steps:
1808  *           
1809  *  @param[in] Pst               *pst
1810  *  @param[in] RgInfSpsRelInfo   *relInfo
1811  *  @return  S16
1812  *      -# ROK 
1813  *      -# RFAILED 
1814  **/
1815 #ifdef ANSI
1816 PUBLIC S16 RgMacSchSpsRelInd
1817 (
1818 Pst                *pst, 
1819 RgInfSpsRelInfo    *relInfo
1820 )
1821 #else
1822 PUBLIC S16 RgMacSchSpsRelInd(pst, relInfo)
1823 Pst                *pst;
1824 RgInfSpsRelInfo    *relInfo;
1825 #endif
1826 {
1827    RgSchUeCb       *ue;
1828    RgSchCellCb     *cell;
1829    Inst            inst = (pst->dstInst - RGSCH_INST_START);
1830
1831    TRC2(RgMacSchSpsRelInd);
1832
1833    /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1834     * it doesnt exist */
1835    cell = rgSchCb[inst].rgrSap[relInfo->cellSapId].cell;
1836
1837    if ((ue = rgSCHDbmGetUeCb(cell, relInfo->cRnti)) == NULLP)
1838    {
1839       RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, 
1840            "No Ue exists with CRNTI:%d",relInfo->cRnti);
1841       RETVALUE(RFAILED);
1842    }
1843
1844    if ((rgSCHUtlSpsRelInd(cell, ue, relInfo->isExplRel)) != ROK)
1845    {
1846       RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, 
1847            "RelInd processing for CRNTI:%d failed",relInfo->cRnti);
1848       RETVALUE(RFAILED);
1849    }
1850    RETVALUE(ROK);
1851 } /* end of RgMacSchSpsRelInd */
1852 #endif /* LTEMAC_SPS */
1853
1854 #ifdef LTE_L2_MEAS
1855
1856 /**
1857  * @brief Function to handle L2MeasCfm from MAC
1858  *
1859  * @details
1860  *
1861  *     Function: RgMacSchL2MeasCfm
1862  *
1863  *     Handler for processing L2 measurement confirm 
1864  *
1865  *     Invoked by: 
1866  *         MAC
1867  *
1868  *     Processing Steps:
1869  *           
1870  *  @param[in] Pst               *pst
1871  *  @param[in] RgInfL2MeasCfm    *measCfm
1872  *  @return  S16
1873  *      -# ROK 
1874  *      -# RFAILED 
1875  **/
1876 #ifdef ANSI
1877 PUBLIC S16 RgMacSchL2MeasCfm
1878 (
1879 Pst                *pst, 
1880 RgInfL2MeasCfm     *measCfm
1881 )
1882 #else
1883 PUBLIC S16 RgMacSchL2MeasCfm(pst, measCfm)
1884 Pst                *pst;
1885 RgInfL2MeasCfm     *measCfm;
1886 #endif
1887 {
1888    RgSchCellCb       *cell = NULLP;
1889    Inst              inst = (pst->dstInst - RGSCH_INST_START);
1890    CmLList           *lnk;
1891    RgSchL2MeasCb     *measCb = NULLP;
1892    RgSchCb           *instCb =  &rgSchCb[inst];
1893    U32               idx;
1894    LrgSchMeasCfmInfo schMeasCfm;
1895    U8                qciVal;
1896    U8                idx1; /*LTE_L2_MEAS_PHASE2*/ 
1897    U8                qciVal1;
1898    TRC2(RgMacSchL2MeasCfm);
1899
1900    /* Find the cellCb using cellId in measInfo. Iterate through all cells
1901     * in rgrsapCb in RgschCb */
1902    for (idx = 0; idx < instCb->numSaps; idx++)
1903    {
1904       if ( instCb->rgrSap[idx].cell->cellId == measCfm->cellId)
1905       {
1906          /* got the cell break the loop */
1907          cell = instCb->rgrSap[idx].cell;
1908          break;
1909       }
1910    }
1911    /* If no cellCb return Err with Invalid Cell Id */
1912    if (cell == NULLP)
1913    {
1914       RLOG_ARG0(L_ERROR,DBG_CELLID,measCfm->cellId,
1915                   "Meas Cfm Failed.Invalid Cell Id");
1916       RETVALUE(RFAILED);
1917    }
1918    
1919
1920    /* Iterate through all meas requests in l2mList in cellCb */
1921    lnk = cell->l2mList.first;
1922    while(lnk != NULLP)
1923    {
1924       /* Get the MeasCb : RgSchL2MeasCb */
1925       measCb = (RgSchL2MeasCb *)lnk->node;
1926       lnk = lnk->next;
1927       if (measCb->measReq.hdr.transId == measCfm->transId)
1928       {
1929          break;
1930       }
1931    }
1932    if ( measCb == NULLP )
1933    {
1934       RETVALUE( RFAILED );
1935    }
1936
1937
1938    if(measCfm->cfm.status != LCM_PRIM_OK)
1939    {
1940       for (idx = 0; idx < measCb->measReq.avgPrbQciUl.numQci; idx++)
1941       {
1942         qciVal = measCb->measReq.avgPrbQciUl.qci[idx];
1943         cell->qciArray[qciVal].qci = 0;
1944       }
1945       /* Delete this measCb, send the negative confirmation to
1946        * stack manager */
1947       cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
1948       /* ccpu00117052 - MOD - Passing double pointer
1949          for proper NULLP assignment*/
1950       rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb, sizeof(RgSchL2MeasCb));
1951       cmMemset((U8 *)&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo));
1952       schMeasCfm.measType     = measCfm->measType;
1953       schMeasCfm.cfm          = measCfm->cfm;
1954       schMeasCfm.hdr.transId  = measCfm->transId;
1955       schMeasCfm.cellId       = measCfm->cellId;
1956       RgMiLrgSchL2MeasCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm);
1957       RETVALUE(ROK);
1958    }
1959    for(idx = 0; idx < measCfm->u.prbCfm.numQci; idx++)
1960    {
1961       measCb->avgPrbQciUl.prbUsage[idx].prbUsage = measCfm->u.prbCfm.prbUsage[idx].prbUsage;
1962       measCb->avgPrbQciUl.prbUsage[idx].qciValue = measCfm->u.prbCfm.prbUsage[idx].qciValue;
1963       /*LTE_L2_MEAS_PHASE2*/
1964       qciVal1 = measCfm->u.prbCfm.prbUsage[idx].qciValue;
1965       for(idx1=0;idx1<measCb->measReq.avgPrbQciUl.numQci;idx1++)
1966       {
1967          if(measCb->measReq.avgPrbQciUl.qci[idx1] == qciVal1)
1968          {
1969             break;
1970          }
1971       }
1972       if(idx1 == measCb->measReq.avgPrbQciUl.numQci)
1973       {
1974          measCb->measReq.avgPrbQciUl.qci[measCb->measReq.avgPrbQciUl.numQci++] = qciVal1;
1975       }
1976    }
1977    measCb->avgPrbQciUl.numQci = measCfm->u.prbCfm.numQci;
1978    measCb->cfmRcvd = TRUE;
1979    cell->sndL2Meas = TRUE;
1980    RETVALUE(ROK);
1981 } /* end of RgMacSchL2MeasCfm */
1982
1983 /**
1984  * @brief Function to handle L2MeasStopCfm from MAC
1985  *
1986  * @details
1987  *
1988  *     Function: RgMacSchL2MeasStopCfm
1989  *
1990  *     Handler for processing L2 measurement confirm 
1991  *
1992  *     Invoked by: 
1993  *         MAC
1994  *
1995  *     Processing Steps:
1996  *           
1997  *  @param[in] Pst               *pst
1998  *  @param[in] RgInfL2MeasCfm    *measCfm
1999  *  @return  S16
2000  *      -# ROK 
2001  *      -# RFAILED 
2002  **/
2003 #ifdef ANSI
2004 PUBLIC S16 RgMacSchL2MeasStopCfm
2005 (
2006 Pst                *pst,
2007 RgInfL2MeasCfm     *measCfm
2008 )
2009 #else
2010 PUBLIC S16 RgMacSchL2MeasStopCfm(pst, measCfm)
2011 Pst                *pst;
2012 RgInfL2MeasCfm     *measCfm;
2013 #endif
2014 {
2015    LrgSchMeasCfmInfo schMeasCfm;
2016    Inst              inst = (pst->dstInst - RGSCH_INST_START);
2017    RgSchCb           *instCb =  &rgSchCb[inst];
2018
2019    TRC2(RgMacSchL2MeasStopCfm);
2020
2021    cmMemset((U8 *)&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo));
2022    schMeasCfm.measType     = measCfm->measType;
2023    schMeasCfm.cfm          = measCfm->cfm;
2024    schMeasCfm.hdr.transId  = measCfm->transId;
2025    schMeasCfm.cellId       = measCfm->cellId;
2026    RgMiLrgSchL2MeasStopCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm);
2027    RETVALUE(ROK);
2028 }
2029 #endif
2030
2031 /************** TFU Interface *************/
2032
2033 /**
2034  * @brief Bind confirm API for TFU SAP on scheduler instance. 
2035  *
2036  * @details
2037  *
2038  *     Function : RgLiTfuSchBndCfm
2039  *      
2040  *      This API is invoked by PHY to confirm TFU SAP bind. 
2041  *     
2042  *           
2043  *  @param[in]  Pst   *pst 
2044  *  @param[in]  SuId  suId 
2045  *  @param[in]  U8    status
2046  *  @return  S16
2047  *      -# ROK 
2048  *      -# RFAILED 
2049  **/
2050 #ifdef ANSI
2051 PUBLIC S16 RgLiTfuSchBndCfm 
2052 (
2053 Pst     *pst,
2054 SuId    suId, 
2055 U8      status
2056 )
2057 #else
2058 PUBLIC S16 RgLiTfuSchBndCfm(pst, suId, status)
2059 Pst     *pst; 
2060 SuId    suId; 
2061 U8      status;
2062 #endif
2063 {
2064    S16 ret;
2065    RgSchLowSapCb  *tfuSap;
2066    Inst  instId = pst->dstInst - RGSCH_INST_START;
2067
2068    TRC3(RgLiTfuSchBndCfm);
2069
2070
2071    if(suId >= rgSchCb[instId].numSaps)
2072    {
2073       RLOG_ARG0(L_ERROR,DBG_INSTID,instId, "Incorrect SuId");
2074       RETVALUE(RFAILED);
2075    }
2076    /* Lets validate suId first */
2077    tfuSap = &(rgSchCb[instId].tfuSap[suId]);
2078
2079    if (suId != tfuSap->sapCfg.suId)
2080    {
2081       RLOG_ARG2(L_ERROR,DBG_INSTID,instId, "Incorrect SuId. Configured (%d)"
2082             "Recieved (%d)", tfuSap->sapCfg.suId, suId);
2083       RETVALUE(RFAILED);
2084    }
2085    ret = rgSCHLmmBndCfm (pst, suId, status);
2086    RETVALUE(ret);
2087 }  /* RgLiTfuSchBndCfm */
2088
2089 /**
2090  * @brief Random Access Request indication from PHY.
2091  *
2092  * @details
2093  *
2094  *     Function : RgLiTfuRaReqInd
2095  *      
2096  *      This API is invoked by PHY to send Random Access Request to Scheduler.
2097  *      This API contains information for Random Access Request including 
2098  *      raRnti, list of associated RAPIDs and related information.
2099  *           
2100  *  @param[in]  Pst              *pst 
2101  *  @param[in]  SuId             suId 
2102  *  @param[in]  TfuRaReqIndInfo  *raReqInd
2103  *  @return  S16
2104  *      -# ROK 
2105  *      -# RFAILED 
2106  **/
2107 #ifdef ANSI
2108 PUBLIC S16 RgLiTfuRaReqInd
2109 (
2110 Pst              *pst, 
2111 SuId             suId, 
2112 TfuRaReqIndInfo  *raReqInd
2113 )
2114 #else
2115 PUBLIC S16 RgLiTfuRaReqInd(pst, suId, raReqInd)
2116 Pst              *pst; 
2117 SuId             suId; 
2118 TfuRaReqIndInfo  *raReqInd;
2119 #endif
2120 {
2121    S16   ret;
2122    Inst  inst = pst->dstInst-RGSCH_INST_START;
2123
2124    TRC3(RgLiTfuRaReqInd);
2125
2126    if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2127    {
2128       RLOG_ARG1(L_ERROR,DBG_INSTID,inst,"SAP Validation failed SuId(%d)", suId);
2129       /* Free up the memory for the request structure */
2130       RGSCH_FREE_MEM(raReqInd);
2131       RETVALUE(ret);
2132    }
2133
2134    if(raReqInd == NULLP)
2135    {
2136       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"Invalid input pointer for raReqInd Failed");
2137       RETVALUE(RFAILED);
2138    }
2139
2140    if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2141    {
2142       RLOG_ARG0(L_ERROR,DBG_CELLID,raReqInd->cellId,"No cell exists");
2143       RETVALUE(RFAILED);
2144    }
2145
2146    ret = rgSCHTomRaReqInd(rgSchCb[inst].tfuSap[suId].cell, raReqInd);
2147    /* Free up the memory for the request structure */
2148    RGSCH_FREE_MEM(raReqInd);
2149    /*SPutSBuf (pst->region, pst->pool, (Data *)raReqInd,
2150          sizeof(TfuRaReqIndInfo)); */
2151    RETVALUE(ret);
2152 }  /* RgLiTfuRaReqInd */
2153
2154 /**
2155  * @brief Uplink CQI indication from PHY.
2156  *
2157  * @details
2158  *
2159  *     Function : RgLiTfuUlCqiInd
2160  *      
2161  *      This API is invoked by PHY to send Uplink CQI to Scheduler.
2162  *      This API contains Uplink CQI information reported per UE.
2163  *           
2164  *  @param[in]  Pst               *pst 
2165  *  @param[in]  SuId              suId 
2166  *  @param[in]  TfuUlCqiIndInfo   *ulCqiInd
2167  *  @return  S16
2168  *      -# ROK 
2169  *      -# RFAILED 
2170  **/
2171 #ifdef ANSI
2172 PUBLIC S16 RgLiTfuUlCqiInd
2173 (
2174 Pst              *pst, 
2175 SuId             suId, 
2176 TfuUlCqiIndInfo  *ulCqiInd
2177 )
2178 #else
2179 PUBLIC S16 RgLiTfuUlCqiInd(pst, suId, ulCqiInd)
2180 Pst              *pst; 
2181 SuId             suId; 
2182 TfuUlCqiIndInfo  *ulCqiInd;
2183 #endif
2184 {
2185    S16   ret;
2186    Inst  inst = pst->dstInst-RGSCH_INST_START;
2187
2188    TRC3(RgLiTfuUlCqiInd);
2189
2190    if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2191    {
2192       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2193       /* Free up the memory for the request structure */
2194       RGSCH_FREE_MEM(ulCqiInd);
2195       RETVALUE(ret);
2196    }
2197
2198    if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2199    {
2200       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2201       /* Free up the memory for the request structure */
2202       RGSCH_FREE_MEM(ulCqiInd);
2203       RETVALUE(RFAILED);
2204    }
2205    ret = rgSCHTomUlCqiInd (rgSchCb[inst].tfuSap[suId].cell, ulCqiInd);
2206    /* Free up the memory for the request structure */
2207    RGSCH_FREE_MEM(ulCqiInd);
2208    RETVALUE(ret);
2209 }  /* RgLiTfuUlCqiInd */
2210
2211 /**
2212  * @brief PUCCH power adjustment indication.
2213  *
2214  * @details
2215  *
2216  *     Function : RgLiTfuPucchDeltaPwrInd
2217  *
2218  *      This API is invoked by PHY to send PUCCH power adjustment
2219  *      indication.
2220  *
2221  *  @param[in]  Pst                     *pst 
2222  *  @param[in]  SuId                    suId 
2223  *  @param[in]  TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
2224  *  @return  S16
2225  *      -# ROK 
2226  *      -# RFAILED 
2227  **/
2228 #ifdef ANSI
2229 PUBLIC S16 RgLiTfuPucchDeltaPwrInd
2230 (
2231 Pst                     *pst,
2232 SuId                    suId,
2233 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
2234 )
2235 #else
2236 PUBLIC S16 RgLiTfuPucchDeltaPwrInd(pst, suId, pucchDeltaPwr)
2237 Pst                     *pst;
2238 SuId                    suId;
2239 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr;
2240 #endif
2241 {
2242    S16   ret;
2243    Inst  inst = pst->dstInst-RGSCH_INST_START;
2244
2245    TRC3(RgLiTfuPucchDeltaPwrInd);
2246
2247    if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2248    {
2249       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2250       /* Free up the memory for the request structure */
2251       RGSCH_FREE_MEM(pucchDeltaPwr);
2252       RETVALUE(ret);
2253    }
2254
2255    if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2256    {
2257       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2258       RETVALUE(RFAILED);
2259    }
2260    ret = rgSCHTomPucchDeltaPwrInd (rgSchCb[inst].tfuSap[suId].cell, pucchDeltaPwr);
2261    /* Free up the memory for the request structure */
2262    RGSCH_FREE_MEM(pucchDeltaPwr);
2263    RETVALUE(ret);
2264 }  /* RgLiTfuPucchDeltaPwrInd */
2265
2266
2267 /**
2268  * @brief HARQ ACK indication from PHY for Downlink transmissions.
2269  *
2270  * @details
2271  *
2272  *     Function : RgLiTfuHqInd
2273  *      
2274  *      This API is invoked by PHY to send HARQ ACK information to Scheduler
2275  *      on recieving HARQ ACK/NACK from UEs.
2276  *      This API contains HARQ ACK information recieved by PHY for downlink
2277  *      transmissions.
2278  *           
2279  *  @param[in]  Pst                *pst
2280  *  @param[in]  SuId               suId 
2281  *  @param[in]  TfuHqIndInfo       *harqAckInd
2282  *  @return  S16
2283  *      -# ROK 
2284  *      -# RFAILED 
2285  **/
2286 #ifdef ANSI
2287 PUBLIC S16 RgLiTfuHqInd
2288 (
2289 Pst                *pst, 
2290 SuId               suId, 
2291 TfuHqIndInfo       *harqAckInd
2292 )
2293 #else
2294 PUBLIC S16 RgLiTfuHqInd(pst, suId, harqAckInd)
2295 Pst                *pst; 
2296 SuId               suId; 
2297 TfuHqIndInfo       *harqAckInd;
2298 #endif
2299 {
2300    S16   ret;
2301    Inst  inst = (pst->dstInst - RGSCH_INST_START);
2302
2303    TRC3(RgLiTfuHqInd);
2304
2305 #ifndef NO_ERRCLS
2306    if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2307    {
2308       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2309       RGSCH_FREE_MEM(harqAckInd);
2310       RETVALUE(ret);
2311    }
2312
2313    if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2314    {
2315       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2316       RETVALUE(RFAILED);
2317    }
2318 #endif
2319
2320    /* Now call the TOM (Tfu ownership module) primitive to process further */
2321    ret = rgSCHTomHarqAckInd (rgSchCb[inst].tfuSap[suId].cell, harqAckInd);
2322    /* Free up the memory for the request structure */
2323    RGSCH_FREE_MEM(harqAckInd);
2324    RETVALUE(ret);
2325 }  /* RgLiTfuHqInd */
2326
2327
2328 /**
2329  * @brief Scheduling request(SR) indication from PHY for an UE.
2330  *
2331  * @details
2332  *
2333  *     Function : RgLiTfuSrInd
2334  *      
2335  *      This API is invoked by PHY to send Scheduling request information to
2336  *      Scheduler on recieving SR from a list of UEs.
2337  *      This API contains scheduling request information recieved by PHY for UEs.
2338  *           
2339  *  @param[in]  Pst           *pst
2340  *  @param[in]  SuId          suId 
2341  *  @param[in]  TfuSrIndInfo  *srInd
2342  *  @return  S16
2343  *      -# ROK 
2344  *      -# RFAILED 
2345  **/
2346 #ifdef ANSI
2347 PUBLIC S16 RgLiTfuSrInd
2348 (
2349 Pst                *pst, 
2350 SuId               suId, 
2351 TfuSrIndInfo       *srInd
2352 )
2353 #else 
2354 PUBLIC S16 RgLiTfuSrInd(pst, suId, srInd)
2355 Pst                *pst; 
2356 SuId               suId; 
2357 TfuSrIndInfo       *srInd;
2358 #endif
2359 {
2360    S16   ret;
2361    Inst  inst = pst->dstInst-RGSCH_INST_START;
2362
2363    TRC3(RgLiTfuSrInd);
2364
2365 #ifndef NO_ERRCLS
2366    if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2367    {
2368       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"() SAP Validation failed");
2369       RGSCH_FREE_MEM(srInd);
2370       RETVALUE(ret);
2371    }
2372
2373    if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2374    {
2375       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"RgLiTfuSrInd()No cell exists");
2376       RETVALUE(RFAILED);
2377    }
2378 #endif
2379    /* Now call the TOM (Tfu ownership module) primitive to process further */
2380    ret = rgSCHTomSrInd (rgSchCb[inst].tfuSap[suId].cell, srInd);
2381    /* Free up the memory for the request structure */
2382    RGSCH_FREE_MEM(srInd);
2383    RETVALUE(ret);
2384 }  /* RgLiTfuSrInd */
2385
2386
2387 /**
2388  * @brief Downlink CQI indication from PHY for an UE.
2389  *
2390  * @details
2391  *
2392  *     Function : RgLiTfuDlCqiInd
2393  *      
2394  *      This API is invoked by PHY to send Downlink CQI indication to Scheduler
2395  *      on recieving downlink CQI from UE.
2396  *      This API contains downlink CQI information recieved by PHY for an UE.
2397  *           
2398  *  @param[in]  Pst              *pst
2399  *  @param[in]  SuId             suId 
2400  *  @param[in]  TfuDlCqiIndInfo  *dlCqiInd
2401  *  @return  S16
2402  *      -# ROK 
2403  *      -# RFAILED 
2404  **/
2405 #ifdef ANSI
2406 PUBLIC S16 RgLiTfuDlCqiInd
2407 (
2408 Pst                *pst, 
2409 SuId               suId, 
2410 TfuDlCqiIndInfo    *dlCqiInd
2411 )
2412 #else
2413 PUBLIC S16 RgLiTfuDlCqiInd(pst, suId, dlCqiInd)
2414 Pst                *pst; 
2415 SuId               suId; 
2416 TfuDlCqiIndInfo    *dlCqiInd;
2417 #endif
2418 {
2419    S16   ret;
2420    Inst  inst = pst->dstInst-RGSCH_INST_START;
2421
2422    TRC3(RgLiTfuDlCqiInd);
2423
2424    if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2425    {
2426       RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed");
2427       /* Free up the memory for the request structure */
2428       RGSCH_FREE_MEM(dlCqiInd);
2429       RETVALUE(ret);
2430    }
2431
2432    if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2433    {
2434       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2435       RETVALUE(RFAILED);
2436    }
2437    ret = rgSCHTomDlCqiInd (rgSchCb[inst].tfuSap[suId].cell, dlCqiInd);
2438    /* Free up the memory for the request structure */
2439    RGSCH_FREE_MEM(dlCqiInd);
2440    RETVALUE(ret);
2441 }  /* RgLiTfuDlCqiInd */
2442 #ifdef TFU_UPGRADE
2443
2444 /**
2445  * @brief Raw CQI indication from PHY for an UE.
2446  *
2447  * @details
2448  *
2449  *     Function : RgLiTfuRawCqiInd
2450  *      
2451  *      This API is invoked by PHY to send Raw CQI indication to Scheduler
2452  *      on receiving Raw CQI from UE.
2453  *      This API contains Raw CQI information recieved by PHY for an UE.
2454  *           
2455  *  @param[in]  Pst              *pst
2456  *  @param[in]  SuId             suId 
2457  *  @param[in]  TfuRawCqiIndInfo  *rawCqiInd
2458  *  @return  S16
2459  *      -# ROK 
2460  *      -# RFAILED 
2461  **/
2462 #ifdef ANSI
2463 PUBLIC S16 RgLiTfuRawCqiInd
2464 (
2465 Pst                *pst, 
2466 SuId               suId, 
2467 TfuRawCqiIndInfo    *rawCqiInd
2468 )
2469 #else
2470 PUBLIC S16 RgLiTfuRawCqiInd(pst, suId, rawCqiInd)
2471 Pst                *pst; 
2472 SuId               suId; 
2473 TfuRawCqiIndInfo    *rawCqiInd;
2474 #endif
2475 {
2476    S16   ret;
2477    Inst  inst = pst->dstInst-RGSCH_INST_START;
2478
2479    TRC3(RgLiTfuRawCqiInd);
2480
2481 #ifdef NO_ERRCLS
2482    if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2483    {
2484       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2485       /* Free up the memory for the request structure */
2486       RGSCH_FREE_MEM(rawCqiInd);
2487       RETVALUE(ret);
2488    }
2489
2490    if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2491    {
2492       RLOG_ARG0(L_ERROR,DBG_INSTID,inst," No cell exists");
2493       RETVALUE(RFAILED);
2494    }
2495 #endif
2496    ret = rgSCHTomRawCqiInd (rgSchCb[inst].tfuSap[suId].cell, rawCqiInd);
2497    /* Free up the memory for the request structure */
2498    RGSCH_FREE_MEM(rawCqiInd);
2499    RETVALUE(ret);
2500 }  /* RgLiTfuRawCqiInd */
2501
2502 /**
2503  * @brief SRS indication from PHY for an UE.
2504  *
2505  * @details
2506  *
2507  *     Function : RgLiTfuSrsInd
2508  *      
2509  *      This API is invoked by PHY to send UL SRS indication to Scheduler
2510  *      on receiving a SRS from UE.
2511  *      This API contains SRS information recieved by PHY for an UE.
2512  *           
2513  *  @param[in]  Pst              *pst
2514  *  @param[in]  SuId             suId 
2515  *  @param[in]  TfuSrsIndInfo  *srsInd
2516  *  @return  S16
2517  *      -# ROK 
2518  *      -# RFAILED 
2519  **/
2520 #ifdef ANSI
2521 PUBLIC S16 RgLiTfuSrsInd
2522 (
2523 Pst                *pst, 
2524 SuId               suId, 
2525 TfuSrsIndInfo    *srsInd
2526 )
2527 #else
2528 PUBLIC S16 RgLiTfuSrsInd(pst, suId, srsInd)
2529 Pst                *pst; 
2530 SuId               suId; 
2531 TfuSrsIndInfo    *srsInd;
2532 #endif
2533 {
2534    S16   ret;
2535    Inst  inst = pst->dstInst-RGSCH_INST_START;
2536
2537    TRC3(RgLiTfuSrsInd);
2538
2539    if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2540    {
2541       RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed");
2542       /* Free up the memory for the request structure */
2543       RGSCH_FREE_MEM(srsInd);
2544       RETVALUE(ret);
2545    }
2546
2547    if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2548    {
2549       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2550       RETVALUE(RFAILED);
2551    }
2552    ret = rgSCHTomSrsInd (rgSchCb[inst].tfuSap[suId].cell, srsInd);
2553    /* Free up the memory for the request structure */
2554    RGSCH_FREE_MEM(srsInd);
2555    RETVALUE(ret);
2556 }  /* RgLiTfuSrsInd */
2557
2558 #endif 
2559
2560 /**
2561  * @brief DOA indication from PHY for an UE.
2562  *
2563  * @details
2564  *
2565  *     Function : RgLiTfuDoaInd
2566  *      
2567  *      This API is invoked by PHY to send Direction Of Arrival to Scheduler
2568  *      on calculating DOA at PHYSICAL LAYER for an UE.
2569  *      This API contains DOA information calculated by PHY for an UE.
2570  *           
2571  *  @param[in]  Pst              *pst
2572  *  @param[in]  SuId             suId 
2573  *  @param[in]  TfuDoaIndInfo    *doaInd
2574  *  @return  S16
2575  *      -# ROK 
2576  *      -# RFAILED 
2577  **/
2578 #ifdef ANSI
2579 PUBLIC S16 RgLiTfuDoaInd 
2580 (
2581 Pst                *pst, 
2582 SuId               suId, 
2583 TfuDoaIndInfo      *doaInd
2584 )
2585 #else
2586 PUBLIC S16 RgLiTfuDoaInd(pst, suId, doaInd)
2587 Pst                *pst; 
2588 SuId               suId; 
2589 TfuDoaIndInfo      *doaInd;
2590 #endif
2591 {
2592    S16   ret;
2593    Inst  inst = pst->dstInst-RGSCH_INST_START;
2594
2595    TRC2(RgLiTfuDoaInd);
2596
2597    if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2598    {
2599       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2600       /* Free up the memory for the request structure */
2601       RGSCH_FREE_MEM(doaInd);
2602       RETVALUE(ret);
2603    }
2604
2605    if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2606    {
2607       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2608       RETVALUE(RFAILED);
2609    }
2610    ret = rgSCHTomDoaInd (rgSchCb[inst].tfuSap[suId].cell, doaInd);
2611    /* Free up the memory for the request structure */
2612    RGSCH_FREE_MEM(doaInd);
2613    RETVALUE(ret);
2614 }  /* RgLiTfuDlCqiInd */
2615
2616 /**
2617  * @brief CRC indication from PHY.
2618  *
2619  * @details
2620  *
2621  *     Function : RgLiTfuCrcInd
2622  *      
2623  *      This API is invoked by PHY to give CRC indication to scheduler.
2624  *           
2625  *  @param[in]  Pst               *pst
2626  *  @param[in]  SuId              suId 
2627  *  @param[in]  TfuCrcIndInfo *crcInd
2628  *  @return  S16
2629  *      -# ROK 
2630  *      -# RFAILED 
2631  **/
2632 #ifdef ANSI
2633 PUBLIC S16 RgLiTfuCrcInd
2634 (
2635 Pst                *pst, 
2636 SuId               suId, 
2637 TfuCrcIndInfo  *crcInd
2638 )
2639 #else
2640 PUBLIC S16 RgLiTfuCrcInd (pst, suId, crcInd)
2641 Pst                *pst; 
2642 SuId               suId; 
2643 TfuCrcIndInfo  *crcInd;
2644 #endif
2645 {
2646    S16              ret;
2647    Inst             inst      = pst->dstInst-RGSCH_INST_START;
2648
2649    TRC3(RgLiTfuCrcInd);
2650 #ifdef XEON_SPECIFIC_CHANGES
2651 struct timeval start6, end6;
2652 gettimeofday(&start6, NULL);
2653 #endif
2654 #ifndef NO_ERRCLS
2655    if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2656    {
2657       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2658       RGSCH_FREE_MEM(crcInd);
2659       RETVALUE(ret);
2660    }
2661
2662    if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2663    {
2664       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2665       RETVALUE(RFAILED);
2666    }
2667 #endif
2668
2669    /* Now call the TOM (Tfu ownership module) primitive to process further */
2670    ret = rgSCHTomCrcInd(rgSchCb[inst].tfuSap[suId].cell, crcInd);
2671    /* Free up the memory for the request structure */
2672    RGSCH_FREE_MEM(crcInd);
2673 #ifdef XEON_SPECIFIC_CHANGES
2674 gettimeofday(&end6, NULL);
2675 #endif
2676    RETVALUE(ret);
2677 }  /* RgLiTfuCrcInd */
2678
2679 /**
2680  * @brief Timing Advance indication from PHY.
2681  *
2682  * @details
2683  *
2684  *     Function : RgLiTfuTimingAdvInd
2685  *      
2686  *      This API is invoked by PHY to indicate timing advance to Scheduler for
2687  *       an UE.
2688  *           
2689  *  @param[in]  Pst                  *pst
2690  *  @param[in]  SuId                 suId 
2691  *  @param[in]  TfuTimingAdvIndInfo  *timingAdvInd
2692  *  @return  S16
2693  *      -# ROK 
2694  *      -# RFAILED 
2695  **/
2696 #ifdef ANSI
2697 PUBLIC S16 RgLiTfuTimingAdvInd
2698 (
2699 Pst                  *pst, 
2700 SuId                 suId, 
2701 TfuTimingAdvIndInfo  *timingAdvInd
2702 )
2703 #else
2704 PUBLIC S16 RgLiTfuTimingAdvInd(pst, suId, timingAdvInd)
2705 Pst                  *pst; 
2706 SuId                 suId; 
2707 TfuTimingAdvIndInfo  *timingAdvInd;
2708 #endif
2709 {
2710    S16   ret;
2711    Inst  inst = pst->dstInst-RGSCH_INST_START;
2712
2713    TRC3(RgLiTfuTimingAdvInd);
2714
2715    if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2716    {
2717       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2718       /* Free up the memory for the request structure */
2719       RGSCH_FREE_MEM(timingAdvInd);
2720       RETVALUE(ret);
2721    }
2722
2723    if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2724    {
2725       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2726       RETVALUE(RFAILED);
2727    }
2728    /* Now call the TOM (Tfu ownership module) primitive to process further */
2729    ret = rgSCHTomTimingAdvInd(rgSchCb[inst].tfuSap[suId].cell, timingAdvInd);
2730    /* Free up the memory for the request structure */
2731    RGSCH_FREE_MEM(timingAdvInd);
2732    RETVALUE(ret);
2733 }  /* RgLiTfuTimingAdvInd */
2734
2735
2736 /**
2737  * @brief Transmission time interval indication from PHY.
2738  *
2739  * @details
2740  *
2741  *     Function : RgLiTfuSchTtiInd 
2742  *      
2743  *      This API is invoked by PHY to indicate TTI indication to Scheduler for
2744  *      a cell.
2745  *           
2746  *  @param[in]  Pst            *pst
2747  *  @param[in]  SuId           suId 
2748  *  @param[in]  TfuTtiIndInfo  *ttiInd
2749  *  @return  S16
2750  *      -# ROK 
2751  *      -# RFAILED 
2752  **/
2753 #ifdef ANSI
2754 PUBLIC S16 RgLiTfuSchTtiInd 
2755 (
2756 Pst                 *pst, 
2757 SuId                suId, 
2758 TfuTtiIndInfo       *ttiInd
2759 )
2760 #else
2761 PUBLIC S16 RgLiTfuSchTtiInd(pst, suId, ttiInd)
2762 Pst                 *pst; 
2763 SuId                suId; 
2764 TfuTtiIndInfo       *ttiInd;
2765 #endif
2766 {
2767    S16   ret = ROK;
2768    Inst  inst = pst->dstInst-RGSCH_INST_START;
2769
2770    TRC3(RgLiTfuSchTtiInd);
2771
2772    
2773    /* Removing the validation with every TTI - for optimization */
2774 #ifndef NO_ERRCLS 
2775    if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2776    {
2777       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2778       RETVALUE(ret);
2779    }
2780 #endif
2781    /* Moved check for cell outside ERRCLS*/
2782
2783    /* Now call the TOM (Tfu ownership module) primitive to process further */
2784    rgSCHTomTtiInd(ttiInd, inst);
2785
2786    RETVALUE(ret);
2787 }  /* RgLiTfuSchTtiInd */
2788
2789 /************* RGM  Interface ****************/
2790 /**
2791  * @brief API for bind request from RRM towards MAC. 
2792  *
2793  * @details
2794  *
2795  *     Function: RgUiRgmBndReq
2796  *     
2797  *     This API is invoked by RRM towards MAC to bind RGM SAP. 
2798  *     These API validates the Pst, spId, suId and sends the bind confirm to
2799  *     RRM.
2800  *
2801  *           
2802  *  @param[in]  Pst   *pst
2803  *  @param[in]  SuId  suId
2804  *  @param[in]  SpId  spId
2805  *  @return  S16
2806  *      -# ROK 
2807  *      -# RFAILED 
2808  **/
2809 #ifdef ANSI
2810 PUBLIC S16 RgUiRgmBndReq
2811 (
2812 Pst   *pst, 
2813 SuId  suId,
2814 SpId  spId
2815 )
2816 #else
2817 PUBLIC S16 RgUiRgmBndReq(pst, suId, spId)
2818 Pst   *pst; 
2819 SuId  suId;
2820 SpId  spId;
2821 #endif
2822 {
2823    S16       ret = ROK;
2824    Pst       tmpPst;   /* Temporary Post Structure */
2825    Inst      instId = pst->dstInst-RGSCH_INST_START;
2826
2827    TRC3(RgUiRgmBndReq)
2828    
2829    
2830    tmpPst.prior       = pst->prior;
2831    tmpPst.route       = pst->route;
2832    tmpPst.selector    = pst->selector;
2833    tmpPst.region      = rgSchCb[instId].rgSchInit.region;
2834    tmpPst.pool        = rgSchCb[instId].rgSchInit.pool;
2835
2836    tmpPst.srcProcId   = rgSchCb[instId].rgSchInit.procId;
2837    tmpPst.srcEnt      = rgSchCb[instId].rgSchInit.ent;
2838    tmpPst.srcInst     = rgSchCb[instId].rgSchInit.inst + RGSCH_INST_START;
2839
2840    tmpPst.event       = EVTNONE;
2841
2842    tmpPst.dstProcId   = pst->srcProcId;
2843    tmpPst.dstEnt      = pst->srcEnt;
2844    tmpPst.dstInst     = pst->srcInst;
2845
2846    /*TODO remove follo statement*/
2847    rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND;
2848
2849    if(spId < rgSchCb[instId].numSaps)
2850    {
2851       /* Check the state of the SAP */
2852       switch (rgSchCb[instId].rgmSap[spId].sapSta.sapState)
2853       {
2854          /* This case might not be needed if SAP not configured then it will go
2855           * to else of above if condition */
2856          case LRG_UNBND: /* SAP is not bound */
2857                  RLOG0(L_DEBUG,"SAP is not yet bound");
2858             rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_BND;
2859             rgSchCb[instId].rgmSap[spId].sapCfg.suId = suId;
2860             /* Send Bind Confirm with status as SUCCESS */
2861             ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK);
2862              /*Indicate to Layer manager  */
2863             break;
2864          case LRG_BND: /* SAP is already bound*/
2865                  RLOG0(L_DEBUG,"SAP is already bound");
2866             ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK);
2867             break;
2868          default: /* Should Never Enter here */
2869 #if (ERRCLASS & ERRCLS_ADD_RES) 
2870             RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001, 
2871                  (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2872                   "Invalid SAP State:RgUiRgmBndReq failed\n");
2873 #endif
2874             ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_NOK);
2875             break;
2876       }
2877    }
2878    else
2879    {
2880 #if (ERRCLASS & ERRCLS_ADD_RES)      
2881 /* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state 
2882    to spId to avoid seg fault due to invalid sapID */
2883       RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002,
2884             (ErrVal)spId, "Invalid SAP Id:RgUiRrmBndReq failed\n");
2885 #endif
2886       ret = RgUiRgmBndCfm(&tmpPst, suId, CM_BND_NOK);
2887    }
2888    RETVALUE(ret);
2889 }  /* RgUiRgmBndReq */
2890
2891 /**
2892  * @brief API for unbind request from RRM towards MAC. 
2893  *
2894  * @details
2895  *
2896  *     Function: RgUiRgmUbndReq
2897  *     
2898  *     This API is invoked by RRM towards MAC to unbind RGM SAP. 
2899  *     These API validates the Pst, spId, suId and transfers the unbind request 
2900  *     specific information to corresponding ownership module (GOM) API.
2901  *
2902  *           
2903  *  @param[in]  Pst    *pst
2904  *  @param[in]  SuId   suId
2905  *  @param[in]  Reason reason
2906  *  @return  S16
2907  *      -# ROK 
2908  *      -# RFAILED 
2909  **/
2910 #ifdef ANSI
2911 PUBLIC S16 RgUiRgmUbndReq
2912 (
2913 Pst    *pst,
2914 SpId   spId,
2915 Reason reason
2916 )
2917 #else
2918 PUBLIC S16 RgUiRgmUbndReq(pst, spId, reason)
2919 Pst    *pst; 
2920 SpId   spId;
2921 Reason reason;
2922 #endif
2923 {
2924    Inst instId = pst->dstInst-RGSCH_INST_START;
2925    TRC3(RgUiRgmUbndReq)
2926    
2927
2928    /* SAP Id validation */
2929    if (spId < rgSchCb[instId].numSaps)
2930    {
2931       switch(rgSchCb[instId].rgmSap[spId].sapSta.sapState)
2932       {
2933          case LRG_BND: /* SAP is already bound*/
2934             /* setting SAP state to UN BOUND */
2935                  RLOG0(L_DEBUG,"SAP is already bound");
2936             rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND;
2937             break;
2938          default:
2939 #if (ERRCLASS & ERRCLS_ADD_RES)      
2940             RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003,
2941                    (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2942                   "Invalid SAP State: RgUiRgmUbndReq failed\n");
2943 #endif
2944             RETVALUE(RFAILED);
2945       }
2946    }
2947    else
2948    {
2949 #if (ERRCLASS & ERRCLS_ADD_RES)      
2950       RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004, 
2951             (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2952             "Invalid SAP Id:RgUiRgmUbndReq failed\n");
2953 #endif
2954       RETVALUE(RFAILED);
2955    }
2956    RETVALUE(ROK);
2957 }  /* RgUiRgmUbndReq */
2958
2959
2960 /**
2961  * @brief API for start or stop PRB reporting from RRM towards MAC. 
2962  *
2963  * @details
2964  *
2965  *     Function: RgUiRgmCfgPrbRprt
2966  *     
2967  *     This API is invoked by RRM towards MAC to start or stop calculating
2968  *     Average PRB usage in downlink and uplink. The average PRB usage will
2969  *     be reported to RRM based on confiured periodicity.
2970  *
2971  *           
2972  *  @param[in]  Pst   *pst
2973  *  @param[in]  SuId  suId
2974  *  @param[in]  SpId  spId
2975  *  @return  S16
2976  *      -# ROK 
2977  *      -# RFAILED 
2978  **/
2979 #ifdef ANSI
2980 PUBLIC S16 RgUiRgmCfgPrbRprt
2981 (
2982 Pst   *pst, 
2983 SpId  spId,
2984 RgmPrbRprtCfg   *prbRprtCfg
2985 )
2986 #else
2987 PUBLIC S16 RgUiRgmCfgPrbRprt(pst, spId, prbRprtCfg)
2988 Pst   *pst; 
2989 SpId  spId;
2990 RgmPrbRprtCfg   *prbRprtCfg;
2991 #endif
2992 {
2993 /* Initalize*/
2994    RgSchCellCb   *cell;
2995    RgSchPrbUsage *prbUsage;
2996    Inst          inst = (pst->dstInst  - RGSCH_INST_START);
2997
2998    TRC2(RgUiRgmCfgPrbRprt);
2999    cell = rgSchCb[inst].rgmSap[spId].cell;
3000    prbUsage = &cell->prbUsage;
3001    prbUsage->prbRprtEnabld = prbRprtCfg->bConfigType;
3002    prbUsage->rprtPeriod = prbRprtCfg->usPrbAvgPeriodicty;
3003    RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, prbUsage->startTime, 1);
3004
3005    /* clear the qciPrbRpts for all GBR QCIs */
3006    cmMemset((U8*)&prbUsage->qciPrbRpts[0], 0, 
3007              (RGM_MAX_QCI_REPORTS * sizeof(RgSchQciPrbUsage)));
3008
3009    RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId,
3010              "RgUiRgmCfgPrbRprt config type %d with the report period %d",
3011              prbUsage->prbRprtEnabld,prbUsage->rprtPeriod);
3012
3013    /* ccpu00134393 : mem leak fix */
3014       SPutSBuf(pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
3015   
3016    RETVALUE(ROK);
3017 }
3018 /**
3019  * @brief ERROR INDICATION from PHY for the i failed unlicensed Scell transmission. 
3020  *
3021  * @details
3022  *
3023  *     Function : RgLiTfuErrInd
3024  *      
3025  *      This API is invoked by PHY to send ERROR INDICATION to scheduler 
3026  *      Currently invoked in the cases when the Unlicensed SCell transmission
3027  *      fails.
3028  *      This API contains the Cell and subframe information for which the
3029  *      transmission failed. 
3030  *           
3031  *  @param[in]  Pst                *pst
3032  *  @param[in]  SuId               suId 
3033  *  @param[in]  TfuErrIndInfo      *errIndInfo 
3034  *  @return  S16
3035  *      -# ROK 
3036  *      -# RFAILED 
3037  **/
3038 #ifdef ANSI
3039 PUBLIC S16 RgLiTfuErrInd
3040 (
3041 Pst                *pst, 
3042 SuId               suId, 
3043 TfuErrIndInfo       *errInd
3044 )
3045 #else
3046 PUBLIC S16 RgLiTfuErrInd(pst, suId, errInd)
3047 Pst                *pst; 
3048 SuId               suId; 
3049 TfuErrIndInfo       *errInd;
3050 #endif
3051 {
3052    S16   ret = ROK;
3053 #ifdef LTE_ADV
3054    Inst  inst = (pst->dstInst - RGSCH_INST_START);
3055 #endif
3056
3057    TRC3(RgLiTfuErrInd);
3058
3059 #ifndef NO_ERRCLS
3060    if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
3061    {
3062
3063       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
3064       RETVALUE(ret);
3065    }
3066
3067    if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
3068    {
3069       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
3070       RETVALUE(RFAILED);
3071    }
3072 #endif
3073
3074 #ifdef LTE_ADV
3075    /* Now call the TOM (Tfu ownership module) primitive to process further */
3076    ret = rgSCHLaaErrInd(rgSchCb[inst].tfuSap[suId].cell, errInd);
3077 #endif
3078    RETVALUE(ret);
3079 }  /* RgLiTfuErrInd */
3080
3081
3082 \f
3083 /**********************************************************************
3084  
3085          End of file
3086 **********************************************************************/