Initial commit
[o-du/l2.git] / src / 5gnrmac / rg_sch_gom.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_gom.c 
28   
29 **********************************************************************/
30
31 /** @file rg_sch_gom.c 
32 @brief This module does processing related to handling of upper interface APIs 
33 invoked by RRM towards MAC.
34 */
35
36 static const char* RLOG_MODULE_NAME="MAC";
37 static int RLOG_MODULE_ID=4096;
38 static int RLOG_FILE_ID=164;
39
40 /* header include files -- defines (.h) */
41 #include "envopt.h"        /* environment options */
42 #include "envdep.h"        /* environment dependent */
43 #include "envind.h"        /* environment independent */
44 #include "gen.h"           /* general layer */
45 #include "ssi.h"           /* system service interface */
46 #include "cm_hash.h"       /* common hash list */
47 #include "cm_mblk.h"       /* common memory link list library */
48 #include "cm_llist.h"      /* common linked list library */
49 #include "cm_err.h"        /* common error */
50 #include "cm_lte.h"        /* common LTE */
51 #include "lrg.h"
52 #include "rgr.h"
53 #include "tfu.h"
54 #include "rg_env.h"
55 #include "rg_sch_inf.h"
56 #include "rg_sch.h"
57 #include "rg_sch_err.h"
58 #include "rl_interface.h"
59 #include "rl_common.h"
60
61 /* header/extern include files (.x) */
62 #include "gen.x"           /* general layer */
63 #include "ssi.x"           /* system service interface */
64 #include "cm5.x"           /* common timers */
65 #include "cm_lib.x"        /* common library */
66 #include "cm_hash.x"       /* common hash list */
67 #include "cm_llist.x"      /* common linked list library */
68 #include "cm_mblk.x"       /* memory management */
69 #include "cm_tkns.x"       /* common tokens */
70 #include "cm_lte.x"        /* common LTE */
71 #include "lrg.x"
72 #include "rgr.x"
73 #include "tfu.x"
74 #include "rg_sch_inf.x"
75 #include "rg_sch.x"
76
77 /* local defines */
78 PRIVATE S16 rgSCHGomHndlCfgReq ARGS((RgSchCb *instCb, SpId spId,
79          RgrCfg  *cfg, RgSchErrInfo *errInfo));
80 PRIVATE S16 rgSCHGomHndlRecfgReq ARGS((RgSchCb *instCb, SpId spId,
81          RgrRecfg  *recfg, RgSchErrInfo *errInfo));
82 PRIVATE S16 rgSCHGomHndlResetReq ARGS((RgSchCb *instCb,SpId spId,RgrRst *reset,
83          RgSchErrInfo  *errInfo));
84 PRIVATE S16 rgSCHGomGetCellIdFrmCfgReq ARGS((RgrCfgReqInfo *rgrCfgReq,
85          CmLteCellId *cellId));
86 PRIVATE S16 rgSCHGomCfgReq ARGS((Region reg, Pool pool, RgSchCb *instCb,
87          SpId spId, RgrCfgTransId transId, RgrCfgReqInfo *cfgReqInfo));
88 PRIVATE S16 rgSCHGomEnqCfgReq ARGS((Region reg, Pool pool, RgSchCellCb *cell,
89          RgrCfgTransId transId, RgrCfgReqInfo *rgrCfgReq));
90 PRIVATE S16 rgSCHGomHndlDelReq ARGS((RgSchCb  *instCb,SpId spId, 
91          RgrDel  *del,RgSchErrInfo  *errInfo));
92 #ifdef LTE_ADV
93 PRIVATE S16 rgSCHGomHndlSCellActDeactReq ARGS((RgSchCb *instCb, SpId spId,
94          RgrSCellActDeactEvnt  *sCellActDeactEvnt, RgSchErrInfo *errInfo, U8 action));
95 #endif /* LTE_ADV */
96 #ifdef EMTC_ENABLE
97 EXTERN S16 rgSchEmtcGetSiWinPerd ARGS((
98 RgSchCellCb   *cell,
99 U16  *siWinSize,
100 U16  *minPeriod 
101 ));
102 extern S16 rgSCHEmtcUtlCalMcsAndNPrb
103 (
104  RgSchCellCb         *cell,
105  U8                  cfgType,
106  MsgLen              msgLen,
107  U8                  siId
108  );
109
110 EXTERN S32 rgSCHEmtcUtlGetAllwdCchTbSzForSI ARGS(
111 (
112 U32 bo
113 ));
114
115 EXTERN Void rgSCHEmtcWarningSiCfg ARGS(
116 (
117 RgSchCellCb             *cell,
118 RgrWarningSiCfgReqInfo  *warningSiCfgReqInfo,
119 U16                     idx
120 ));
121 #endif
122
123
124 /* local typedefs */
125  
126 /* local externs */
127  
128 /* forward references */
129
130 \f
131
132 /**
133  * @brief Handler for config request from RRM to Schedular.
134  *
135  * @details
136  *
137  *     Function: rgSCHGomHndlCfg
138  *     
139  *     This API is called from schedulers UIM and it handles config request
140  *     from RRM to Scheduler.
141  *     
142  *     Processing Steps:
143  *      - If the request is for the inactive cell, 
144  *       - Handle request.Call rgSCHGomCfgReq.
145  *      - Else,
146  *       - Enqueue the request. Call rgSCHGomEnqCfgReq.
147  *         
148  *  @param[in]  Region        reg
149  *  @param[in]  Poll          pool
150  *  @param[in]  RgSchCb       *instCb
151  *  @param[in]  SpId          spId
152  *  @param[in]  RgrCfgTransId transId
153  *  @param[in]  RgrCfgReqInfo *cfgReqInfo
154  *  @return  S16
155  *      -# ROK 
156  *      -# RFAILED 
157  **/
158 #ifdef ANSI
159 PUBLIC S16 rgSCHGomHndlCfg
160 (
161 Region        reg,
162 Pool          pool,
163 RgSchCb       *instCb,
164 SpId          spId,
165 RgrCfgTransId transId,
166 RgrCfgReqInfo *cfgReqInfo
167 )
168 #else
169 PUBLIC S16 rgSCHGomHndlCfg(reg, pool, instCb, spId, transId, cfgReqInfo)
170 Region        reg;
171 Pool          pool;
172 RgSchCb       *instCb;
173 SpId          spId;
174 RgrCfgTransId transId;
175 RgrCfgReqInfo *cfgReqInfo;
176 #endif
177 {
178    S16           ret;
179    CmLteCellId   cellId;
180    RgSchCellCb   *cell = NULLP;    
181    U8            cfmStatus = RGR_CFG_CFM_NOK;
182 #ifdef DEBUGP
183    Inst          inst = (instCb->rgSchInit.inst );
184 #endif
185
186    TRC2(rgSCHGomHndlCfg);
187    /* Apply the configuration for Cell Configuration or Delete */
188    if (cfgReqInfo->action != RGR_RECONFIG)
189    {
190       ret = rgSCHGomCfgReq (reg, pool, instCb, spId, transId, cfgReqInfo);
191       RETVALUE(ret);
192    }
193
194    /* Fetch the cell Id for the recieved request */
195    if((rgSCHGomGetCellIdFrmCfgReq(cfgReqInfo, &cellId)) != ROK)
196    {
197       RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Action.Config Type Error");
198
199       SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
200       cfgReqInfo = NULLP;
201       rgSCHUtlRgrCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); 
202       RETVALUE(RFAILED);
203    }
204    /* Extract the cell and Enquee Config Request */
205    if(NULLP != instCb->rgrSap[spId].cell)
206    {
207       if(cellId != instCb->rgrSap[spId].cell->cellId) 
208       {
209          RLOG_ARG2(L_ERROR,DBG_CELLID,cellId, "Cell with Id %d already exists "
210            "on sap %d", instCb->rgrSap[spId].cell->cellId, spId);  
211
212          SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
213          cfgReqInfo = NULLP;
214          rgSCHUtlRgrCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); 
215          RETVALUE(RFAILED);
216       }
217       cell = instCb->rgrSap[spId].cell;
218
219       /* Enqueue the configuration */
220       ret = rgSCHGomEnqCfgReq(reg, pool, cell, transId, cfgReqInfo);
221       if (ret != ROK)
222       {
223          RLOG_ARG0(L_ERROR,DBG_CELLID,cellId, "rgSCHGomHndlCfg: Enqueuing CfgReq "
224               "Failed ");
225
226          SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
227          cfgReqInfo = NULLP;
228          rgSCHUtlRgrCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); 
229          RETVALUE(RFAILED);
230       }
231
232       RETVALUE(ROK);
233    }
234    SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
235    cfgReqInfo = NULLP;
236    rgSCHUtlRgrCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); 
237    RETVALUE(RFAILED);
238
239 }/* rgSCHGomHndlCfg */
240
241
242 /**
243  * @brief Handler to handle config request from RRM to Scheduler.
244  *
245  * @details
246  *
247  *     Function: rgSCHGomCfgReq
248  *     
249  *     This API handles processing for config request from RRM to Scheduler.
250  *     
251  *     Processing Steps: 
252  *      - If Configuration request, call rgSCHGomHndlCfgReq.
253  *      - Else if Reconfiguration request, call rgSCHGomHndlRecfgReq.
254  *      - If successful, send configuration confirm to RRM.
255  *        Call rgSCHUtlRgrCfgCfm else FAIL.
256  *
257  *  @param[in]  Region        reg
258  *  @param[in]  Poll          pool
259  *  @param[in]  RgSchCb       *instCb
260  *  @param[in]  SpId          spId
261  *  @param[in]  RgrCfgTransId transId
262  *  @param[in]  RgrCfgReqInfo *cfgReqInfo
263  *  @return  S16
264  *      -# ROK 
265  *      -# RFAILED 
266  **/
267 #ifdef ANSI
268 PRIVATE S16 rgSCHGomCfgReq
269 (
270 Region        reg,
271 Pool          pool,
272 RgSchCb       *instCb,
273 SpId          spId,
274 RgrCfgTransId transId,
275 RgrCfgReqInfo *cfgReqInfo
276 )
277 #else
278 PRIVATE S16 rgSCHGomCfgReq(reg, pool, instCb, spId, transId, cfgReqInfo)
279 Region        reg;
280 Pool          pool;
281 RgSchCb       *instCb;
282 SpId          spId;
283 RgrCfgTransId transId;
284 RgrCfgReqInfo *cfgReqInfo;
285 #endif
286 {
287    U8              cfmStatus = RGR_CFG_CFM_OK;
288    S16             ret;
289    RgSchErrInfo    errInfo;
290 #ifdef DEBUGP
291    Inst            inst = (instCb->rgSchInit.inst );
292 #endif
293    TRC2(rgSCHGomCfgReq);
294 #ifdef EMTC_ENABLE
295 printf("\n AT MAC rgSCHGomCfgReq \n");
296 #endif
297
298    /* Process Config/Reconfig/Delete request from RRM */
299    switch (cfgReqInfo->action)
300    {
301       case RGR_CONFIG:
302          {
303             ret = rgSCHGomHndlCfgReq(instCb, spId, 
304                              &cfgReqInfo->u.cfgInfo, &errInfo);
305             break;
306          }
307       case RGR_RECONFIG:
308          {
309             ret = rgSCHGomHndlRecfgReq(instCb, spId, 
310                              &cfgReqInfo->u.recfgInfo, &errInfo);
311             break;
312          }
313       case RGR_RESET:
314          {
315             ret = rgSCHGomHndlResetReq(instCb, spId, 
316                              &cfgReqInfo->u.rstInfo, &errInfo);
317             break;
318          }
319       case RGR_DELETE:
320          {
321             ret = rgSCHGomHndlDelReq(instCb, spId,
322                              &cfgReqInfo->u.delInfo, &errInfo);
323             break;
324          } 
325 #ifdef LTE_ADV
326       case RGR_SCELL_ACT:
327       case RGR_SCELL_DEACT: 
328       case RGR_SCELL_READY: 
329          {
330             ret = rgSCHGomHndlSCellActDeactReq(instCb, spId,
331                              &cfgReqInfo->u.sCellActDeactEvnt, &errInfo, cfgReqInfo->action);
332             break;
333          }
334 #endif /* LTE_ADV */
335       default:
336          {
337             RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "Invalid configuration "
338                "action %d", cfgReqInfo->action);
339             ret = RFAILED;
340          }
341    } /* End of switch */
342
343    if (ret != ROK)
344    {
345       cfmStatus = RGR_CFG_CFM_NOK;
346    }
347
348    SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
349    cfgReqInfo = NULLP;
350 #ifdef EMTC_ENABLE
351 printf("\n AT MAC sending RGR cfg cfm \n");
352 #endif
353
354    /* Send back confirmation status to RRM */   
355    rgSCHUtlRgrCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); 
356 #ifdef EMTC_ENABLE
357 printf("\n AT MAC RGR cfg cfm sent\n");
358 #endif
359
360    RETVALUE(ret);
361 }  /* rgSCHGomCfgReq */
362
363
364 /**
365  * @brief Handler to enqueuing config request from RRM to Scheduler.
366  *
367  * @details
368  *
369  *     Function: rgSCHGomEnqCfgReq
370  *     
371  *     This API enqueues config request from RRM to MAC. 
372  *     
373  *     Processing Steps:
374  *      - Allocate the configuration request element.
375  *      - Copy the contents of the recieved configuration to config request
376  *        element and free the recieved configuration pointer.
377  *      - If the configuration is without activation time,
378  *         - Enqueue the request in crntRgrCfgLst of the cell at the end of 
379  *           the list.
380  *      - Else
381  *         - Enqueue the request in pndngRgrCfgLst of the cell.
382  *         
383  *  @param[in]  Region        reg,
384  *  @param[in]  Pool          pool
385  *  @param[in]  RgSchCellCb   *cell
386  *  @param[in]  RgrCfgTransId transId
387  *  @param[in]  RgrCfgReqInfo *rgrCfgReq
388  *  @return  S16
389  *      -# ROK 
390  *      -# RFAILED 
391  **/
392 #ifdef ANSI
393 PRIVATE S16 rgSCHGomEnqCfgReq
394 (
395 Region        reg,
396 Pool          pool,
397 RgSchCellCb   *cell,
398 RgrCfgTransId transId,
399 RgrCfgReqInfo *rgrCfgReq
400 )
401 #else
402 PRIVATE S16 rgSCHGomEnqCfgReq(reg, pool, cell, transId, rgrCfgReq)
403 Region        reg;
404 Pool          pool;
405 RgSchCellCb   *cell;
406 RgrCfgTransId transId;
407 RgrCfgReqInfo *rgrCfgReq;
408 #endif
409 {
410    S16                ret;
411    U32                sfDiff;
412    RgSchCfgElem       *rgrCfgElem  = NULLP;
413    CmLteTimingInfo    actvTime; 
414    Inst               inst = cell->instIdx;
415
416    TRC2(rgSCHGomEnqCfgReq);
417
418    /* Allocate memory for config Element */
419    ret = rgSCHUtlAllocSBuf(inst, (Data **)&rgrCfgElem, sizeof(RgSchCfgElem));
420    if ((ret != ROK) || ((U8 *)rgrCfgElem == NULLP))
421    {
422       RETVALUE(RFAILED);
423    }
424
425    /* Initialize the configuration element */
426    cmMemcpy((U8*)rgrCfgElem->rgrCfg.transId.trans,(U8*)transId.trans,
427          sizeof(transId.trans));
428    rgrCfgElem->rgrCfg.reg = reg;
429    rgrCfgElem->rgrCfg.pool = pool;
430    rgrCfgElem->rgrCfg.rgrCfgReq = rgrCfgReq;
431    rgrCfgElem->cfgReqLstEnt.prev = NULLP;
432    rgrCfgElem->cfgReqLstEnt.next = NULLP;
433    rgrCfgElem->cfgReqLstEnt.node = (PTR )rgrCfgElem;
434
435    /* Add configuration element to current/pending cfgLst */
436    if (((rgrCfgReq->action == RGR_RECONFIG) &&
437             (rgrCfgReq->u.recfgInfo.recfgType == RGR_CELL_CFG) &&
438             (rgrCfgReq->u.recfgInfo.u.cellRecfg.recfgActvTime.pres == TRUE)))
439
440    {
441       actvTime = 
442          rgrCfgReq->u.recfgInfo.u.cellRecfg.recfgActvTime.actvTime;
443
444       /* Check if the activation time is valid */
445       if (actvTime.sfn >= RGSCH_MAX_SFN 
446             || actvTime.subframe >= RGSCH_NUM_SUB_FRAMES_5G)
447       {
448          RLOG_ARG4(L_ERROR,DBG_CELLID,cell->cellId, "Invalid activation time for RGR "
449            "config request: activation sfn %d activation subframe %d current "
450            "sfn %d current subframe %d", actvTime.sfn, actvTime.subframe, 
451            cell->crntTime.sfn, cell->crntTime.subframe);
452          /* ccpu00117052 - MOD - Passing double pointer
453          for proper NULLP assignment*/
454          rgSCHUtlFreeSBuf(inst, (Data **)&rgrCfgElem, sizeof(*rgrCfgElem));
455          RETVALUE(RFAILED);
456       }
457
458       sfDiff = RGSCH_CALC_SF_DIFF(actvTime, cell->crntTime);
459
460       if (sfDiff > (RGR_ACTV_WIN_SIZE * RGSCH_NUM_SUB_FRAMES_5G))
461       {
462          RLOG_ARG4(L_ERROR,DBG_CELLID,cell->cellId,"Invalid activation time for RGR"
463               " config request: activation sfn %d activation subframe %d "
464               "current sfn %d current subframe %d", actvTime.sfn,
465               actvTime.subframe, cell->crntTime.sfn, cell->crntTime.subframe);
466          /* ccpu00117052 - MOD - Passing double pointer
467          for proper NULLP assignment*/
468          rgSCHUtlFreeSBuf(inst, (Data **)&rgrCfgElem, sizeof(*rgrCfgElem));
469          RETVALUE(RFAILED);
470       }
471
472       if (sfDiff)
473       {
474          /* Add to pending cfgReqLst */
475          rgrCfgElem->actvTime = actvTime; 
476          rgSCHDbmInsPndngRgrCfgElem(cell, rgrCfgElem);
477          /* Cfm to be sent only after applying request */
478          RETVALUE(ROK);
479       }
480    }
481
482    /* Add to current cfgReq list */
483    rgSCHDbmInsCrntRgrCfgElem(cell, rgrCfgElem);
484    /* Cfm to be sent only after applying request */
485    RETVALUE(ROK);
486 }  /* rgSCHGomEnqCfgReq */
487
488
489 /**
490  * @brief Handler for TTI processing for configurations recieved from RRM.
491  *
492  * @details
493  *
494  *     Function: rgSCHGomTtiHndlr
495  *     
496  *     This API does TTI processing for configurations recieved from RRM.
497  *     
498  *     Processing Steps:
499  *      - It dequeues config request from the current configuration list.
500  *        For each config request in the list: 
501  *        - Processes the request. Call rgSCHGomCfgReq.
502  *      - It dequeues config request for the current tti from the pending 
503  *        configuration list. For each config request in the list:
504  *        - Processes the request. Call rgSCHGomCfgReq.
505  *
506  *  @param[in]  RgSchCellCb *cell
507  *  @return  S16
508  *      -# ROK 
509  *      -# RFAILED 
510  **/
511 #ifdef ANSI
512 PUBLIC S16 rgSCHGomTtiHndlr
513 (
514 RgSchCellCb      *cell,
515 SpId             spId
516 )
517 #else
518 PUBLIC S16 rgSCHGomTtiHndlr(cell, spId)
519 RgSchCellCb      *cell;
520 SpId             spId;
521 #endif
522 {
523    RgSchCfgElem       *cfgElem;
524    Inst               inst= cell->instIdx;
525    TRC2(rgSCHGomTtiHndlr);
526
527    /* Dequeue from current config list */
528    while ((cfgElem = rgSCHDbmGetNextCrntRgrCfgElem(cell, NULLP)) != NULLP)
529    {
530       rgSCHDbmDelCrntRgrCfgElem(cell, cfgElem);
531       rgSCHGomCfgReq(cfgElem->rgrCfg.reg,cfgElem->rgrCfg.pool,
532             &rgSchCb[inst], spId, cfgElem->rgrCfg.transId, 
533                                           cfgElem->rgrCfg.rgrCfgReq);
534       /* ccpu00117052 - MOD - Passing double pointer
535       for proper NULLP assignment*/
536       rgSCHUtlFreeSBuf(inst, (Data **)&cfgElem, sizeof(*cfgElem));
537    }
538
539    /* Handle config requests from pending config list */
540    while((cfgElem = rgSCHDbmGetPndngRgrCfgElemByKey(cell, cell->crntTime)) != NULLP)
541    {
542       rgSCHDbmDelPndngRgrCfgElem(cell, cfgElem);
543       rgSCHGomCfgReq(cfgElem->rgrCfg.reg, cfgElem->rgrCfg.pool, 
544             &rgSchCb[inst], spId, cfgElem->rgrCfg.transId, 
545                                           cfgElem->rgrCfg.rgrCfgReq);
546       /* ccpu00117052 - MOD - Passing double pointer
547       for proper NULLP assignment*/
548       rgSCHUtlFreeSBuf(inst, (Data **)&cfgElem, sizeof(*cfgElem));
549    } 
550
551    RETVALUE(ROK);
552 }
553
554
555 /**
556  * @brief Handler to handle configuration request from RRM to MAC.
557  *
558  * @details
559  *
560  *     Function: rgSCHGomHndlCfgReq
561  *     
562  *     This API handles processing for configuration request from RRM to MAC.
563  *     
564  *     - Processing Steps: 
565  *        - Validate configuration request parameters at CFG module. 
566  *          Call rgSCHCfgVldtRgrCellCfg for cell configuration.
567  *        - If validated successfully, send configuration request to CFG.
568  *          Call rgSCHCfgRgrCellCfg else FAIL.
569  *          
570  *  @param[in]  RgSchCb      *instCb
571  *  @param[in]  SpId         spId
572  *  @param[in]  RgrCfg       *cfg
573  *  @param[out] RgSchErrInfo *errInfo
574  *  @return  S16
575  *      -# ROK 
576  *      -# RFAILED 
577  **/
578 #ifdef ANSI
579 PRIVATE S16 rgSCHGomHndlCfgReq
580 (
581 RgSchCb        *instCb,
582 SpId           spId,
583 RgrCfg         *cfg,
584 RgSchErrInfo   *errInfo
585 )
586 #else
587 PRIVATE S16 rgSCHGomHndlCfgReq(instCb, spId, cfg, errInfo)
588 RgSchCb        *instCb;
589 SpId           spId;
590 RgrCfg         *cfg;
591 RgSchErrInfo   *errInfo;
592 #endif
593 {
594    S16          ret;
595    RgSchCellCb  *cell = instCb->rgrSap[spId].cell;
596    Inst         inst = (instCb->rgSchInit.inst );
597    RgSchUeCb    *ue;
598
599    TRC2(rgSCHGomHndlCfgReq);
600
601    errInfo->errType = RGSCHERR_GOM_CFG_REQ;
602    
603    /* Validate and process the configuration request */ 
604    switch (cfg->cfgType)
605    {
606       case RGR_CELL_CFG:
607       {
608          ret = rgSCHCfgVldtRgrCellCfg(inst, &cfg->u.cellCfg, cell, errInfo);
609             if (ret != ROK)
610             {
611                RLOG1(L_ERROR,"Rgr Cell configuration "
612                   "validation FAILED: Cell %d", cfg->u.cellCfg.cellId);
613                RETVALUE(RFAILED);
614             }
615          ret = rgSCHCfgRgrCellCfg(instCb, spId, &cfg->u.cellCfg, errInfo);
616          break;
617       }
618       case RGR_UE_CFG:
619       case RGR_SCELL_UE_CFG:
620       {
621          ret = rgSCHCfgVldtRgrUeCfg(inst, &cfg->u.ueCfg, &cell, errInfo);
622          if (ret != ROK)
623          {
624             RLOG1(L_ERROR,"Ue configuration validation"
625                " FAILED: CRNTI:%d", cfg->u.ueCfg.crnti);
626             RETVALUE(RFAILED);
627          }
628          ret = rgSCHCfgRgrUeCfg(cell, &cfg->u.ueCfg, errInfo);
629          break;
630       }
631       case RGR_LCH_CFG:
632       {
633          ret = rgSCHCfgVldtRgrLcCfg(inst, &cfg->u.lchCfg, &cell, &ue, errInfo);
634          if (ret != ROK)
635          {
636             RLOG1(L_ERROR,"LC configuration validation "
637               "FAILED: LCID:%d", cfg->u.lchCfg.lcId);
638             RETVALUE(RFAILED);
639          }
640          ret = rgSCHCfgRgrLchCfg(cell, ue, &cfg->u.lchCfg, errInfo); 
641          break;
642       }
643       case RGR_LCG_CFG:
644       {
645          ret = rgSCHCfgVldtRgrLcgCfg(inst, &cfg->u.lcgCfg, &cell, &ue, errInfo);
646          if (ret != ROK)
647          {
648             RLOG1(L_ERROR,"LCG configuration validation "
649               "FAILED: LCGID:%d", cfg->u.lcgCfg.ulInfo.lcgId);
650             RETVALUE(RFAILED);
651          }
652          ret = rgSCHCfgRgrLcgCfg(cell, ue, &cfg->u.lcgCfg, errInfo); 
653          break;
654       }
655       case RGR_ENB_CFG:
656       {
657          ret = rgSCHCfgVldtRgrSchedEnbCfg(inst, &cfg->u.schedEnbCfg, errInfo);
658          if (ret != ROK)
659          {
660             RGSCHDBGERR(inst,(rgSchPBuf(inst), "SCH ENB configuration validation "
661               "FAILED: \n" ));
662             RETVALUE(RFAILED);
663          }
664          ret = rgSCHCfgRgrSchedEnbCfg(inst, spId, &cfg->u.schedEnbCfg, errInfo); 
665          break;
666       }
667       default:
668       {
669 #if(ERRCLASS & ERRCLS_INT_PAR)
670             RLOG1(L_ERROR,"Should never come here: "
671                 "cfgType %d", cfg->cfgType);
672 #endif
673             RETVALUE(RFAILED);
674       }
675    }
676    
677    RETVALUE(ret);
678 }  /* rgSCHGomHndlCfgReq */
679
680 #ifdef LTE_ADV
681 /**
682  * @brief Handler to handle re-configuration request from RRM to MAC.
683  *
684  * @details
685  *
686  *     Function: rgSCHGomHndlSCellActDeactReq
687  *     
688  *     This API handles processing for SCell Activation Request from RRM to SCH.
689  *     
690  *     - Processing Steps: 
691  *        - Validate sCell Actication request parameters at CFG module. 
692  *        - If validated successfully, send configuration request to CFG.
693  *        - call activation function for each SCells configured
694  *
695  *  @param[in]  RgSchCb      *instCb
696  *  @param[in]  SpId         spId
697  *  @param[in]  RgrSCellActDeactEvnt  *sCellActDeactEvnt
698  *  @param[in]  U8 action
699  *  @param[out] RgSchErrInfo *errInfo
700  *  @return  S16
701  *      -# ROK 
702  *      -# RFAILED 
703  **/
704 #ifdef ANSI
705 PRIVATE S16 rgSCHGomHndlSCellActDeactReq
706 (
707 RgSchCb               *instCb,
708 SpId                   spId,
709 RgrSCellActDeactEvnt  *sCellActDeactEvnt,
710 RgSchErrInfo          *errInfo,
711 U8                    action
712 )
713 #else
714 PRIVATE S16 rgSCHGomHndlSCellActDeactReq(instCb, spId, sCellActDeactEvnt, errInfo, action)
715 RgSchCb               *instCb;
716 SpId                  spId;
717 RgrSCellActDeactEvnt  *sCellActDeactEvnt; 
718 RgSchErrInfo          *errInfo;
719 U8                    action;
720 #endif
721 {
722    RgSchUeCb    *ue = NULLP;
723    U16          idx = 0;
724    U16          sCellIdx = 0;
725    RgSchCellCb  *cell = instCb->rgrSap[spId].cell;
726    Inst         inst = (instCb->rgSchInit.inst);
727
728    TRC2(rgSCHGomHndlSCellActDeactReq);
729    RGSCHDBGPRM(inst,(rgSchPBuf(inst), "Processing RGR SCell Actication request:"
730                   "%d\n", sCellActDeactEvnt->crnti));
731
732    errInfo->errType = RGSCHERR_GOM_SCELL_REQ;
733
734    /* Fetch the Ue */
735    if ((ue = rgSCHDbmGetUeCb(cell, sCellActDeactEvnt->crnti)) == NULLP)
736    {
737       RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]UE: does not exist\n", 
738             sCellActDeactEvnt->crnti));
739       RETVALUE(RFAILED);
740    }
741    
742    for(idx = 0; idx < sCellActDeactEvnt->numOfSCells; idx++)
743    {
744       sCellIdx = sCellActDeactEvnt->sCellActDeactInfo[idx].sCellIdx;
745
746       if (ROK != (rgSCHSCellTrigActDeact(cell, ue, sCellIdx, action)))
747       {
748             RGSCHDBGERR(inst,(rgSchPBuf(inst), "SCell Actication failed"
749                      "for UE [%d] with SCellIdx [%d]\n", 
750                      sCellActDeactEvnt->crnti, idx));
751             RETVALUE(RFAILED);
752
753       }
754
755    }
756    RGSCHDBGINFO(inst,(rgSchPBuf(inst), "RGR Reconfiguration processed\n"));
757    RETVALUE(ROK);
758 }  /* rgSCHGomHndlSCellActDeactReq */
759
760 #endif /* LTE_ADV */
761 /**
762  * @brief Handler to handle re-configuration request from RRM to MAC.
763  *
764  * @details
765  *
766  *     Function: rgSCHGomHndlRecfgReq
767  *     
768  *     This API handles processing for re-configuration request from RRM to MAC.
769  *     
770  *     - Processing Steps: 
771  *        - Validate re-configuration request parameters at CFG module. 
772  *          Call rgSCHCfgVldtRgrCellRecfg for cell re-configuration.
773  *        - If validated successfully, send configuration request to CFG.
774  *          Call rgSCHCfgRgrCellRecfg else FAIL.
775  *
776  *  @param[in]  RgSchCb      *instCb
777  *  @param[in]  SpId         spId
778  *  @param[in]  RgrRecfg     *recfg
779  *  @param[out] RgSchErrInfo *errInfo
780  *  @return  S16
781  *      -# ROK 
782  *      -# RFAILED 
783  **/
784 #ifdef ANSI
785 PRIVATE S16 rgSCHGomHndlRecfgReq
786 (
787 RgSchCb       *instCb,
788 SpId          spId,
789 RgrRecfg      *recfg,
790 RgSchErrInfo  *errInfo
791 )
792 #else
793 PRIVATE S16 rgSCHGomHndlRecfgReq(instCb, spId, recfg, errInfo)
794 RgSchCb       *instCb;
795 SpId          spId;
796 RgrRecfg      *recfg;
797 RgSchErrInfo  *errInfo;
798 #endif
799 {
800    RgSchUeCb    *ue = NULLP;
801    RgSchDlLcCb  *dlLc = NULLP; /* PURIFY_FIX:UMR */
802    S16          ret; 
803    RgSchCellCb  *cell = instCb->rgrSap[spId].cell;
804    Inst         inst = (instCb->rgSchInit.inst );
805
806    TRC2(rgSCHGomHndlRecfgReq);
807
808    errInfo->errType = RGSCHERR_GOM_RECFG_REQ;
809    
810    /* Validate and process the re-configuration request */
811    switch (recfg->recfgType)
812    {
813       case RGR_CELL_CFG:
814       {
815          ret = rgSCHCfgVldtRgrCellRecfg(inst, &recfg->u.cellRecfg, &cell,
816                errInfo);
817          if (ret != ROK) 
818          {
819             RLOG_ARG0(L_ERROR,DBG_CELLID,recfg->u.cellRecfg.cellId,"Rgr Cell Recfg Validation "
820                      "FAILED");
821             RETVALUE(RFAILED);
822          }
823          ret = rgSCHCfgRgrCellRecfg(cell, &recfg->u.cellRecfg, errInfo);
824          break;
825       }
826       case RGR_UE_CFG:
827       case RGR_SCELL_UE_CFG:
828       {
829          ret = rgSCHCfgVldtRgrUeRecfg(inst, &recfg->u.ueRecfg, &cell, &ue, errInfo);
830          if ( ret != ROK)
831          {
832             RLOG_ARG1(L_ERROR,DBG_CELLID,recfg->u.ueRecfg.cellId,"Ue Recfg Validation FAILED"
833                       "OLD CRNTI:%d",recfg->u.ueRecfg.oldCrnti);
834             RETVALUE(RFAILED);
835          }
836          ret = rgSCHCfgRgrUeRecfg(cell, ue, &recfg->u.ueRecfg, errInfo);
837          break;
838       }
839       case RGR_LCH_CFG:
840       {
841          ret = rgSCHCfgVldtRgrLchRecfg(inst, &recfg->u.lchRecfg, &cell, &ue, 
842                &dlLc, errInfo);
843          if (ret != ROK)
844          {
845             RLOG_ARG1(L_ERROR,DBG_CELLID,recfg->u.lchRecfg.cellId,"Lc Recfg Validation FAILED"
846                       "LCID:%d",recfg->u.lchRecfg.lcId);
847             RETVALUE(RFAILED);
848          }
849          ret = rgSCHCfgRgrLchRecfg(cell, ue, dlLc, &recfg->u.lchRecfg, errInfo);
850          break;
851       }
852       case RGR_LCG_CFG:
853       {
854          ret = rgSCHCfgVldtRgrLcgRecfg(inst, &recfg->u.lcgRecfg, cell, &ue,
855                errInfo);
856          if (ret != ROK)
857          {
858             RLOG_ARG1(L_ERROR,DBG_CELLID,recfg->u.lcgRecfg.cellId, "Lcg Recfg Validation FAILED"
859                       "LCGID:%d",recfg->u.lcgRecfg.ulRecfg.lcgId);
860             RETVALUE(RFAILED);
861          }
862          ret = rgSCHCfgRgrLcgRecfg(cell, ue, &recfg->u.lcgRecfg, errInfo);
863          break;
864       }
865       default:
866       {
867 #if(ERRCLASS & ERRCLS_INT_PAR)
868          RLOG1(L_ERROR,"Should never come here: recfgType %d", recfg->recfgType);
869 #endif
870          RETVALUE(RFAILED);
871       }
872    }
873
874    RETVALUE(ret);
875 }  /* rgSCHGomHndlRecfgReq */
876
877 /**
878  * @brief Handler to handle UE reset request from RRM to Scheduler.
879  *
880  * @details
881  *
882  *     Function: rgSCHGomHndlResetReq
883  *     
884  *     This API handles processing for UE reset request from RRM to Scheduler.
885  *     
886  *     - Processing Steps: 
887  *        - Validate UE reset request parameters at CFG module. 
888  *          Call rgSCHCfgVldtRgrUeReset for UE reset.
889  *        - If validated successfully, send UE reset request to CFG.
890  *          Call rgSCHCfgRgrUeReset else FAIL.
891  *
892  *  @param[in]  RgrRst   *rstInfo
893  *  @param[out] RgSchErrInfo *errInfo
894  *  @return  S16
895  *      -# ROK 
896  *      -# RFAILED 
897  **/
898 #ifdef ANSI
899 PRIVATE S16 rgSCHGomHndlResetReq
900 (
901 RgSchCb       *instCb,
902 SpId          spId,
903 RgrRst        *reset,
904 RgSchErrInfo  *errInfo
905 )
906 #else
907 PRIVATE S16 rgSCHGomHndlResetReq(instCb, spId, reset, errInfo)
908 RgSchCb       *instCb;
909 SpId          spId;
910 RgrRst        *reset;
911 RgSchErrInfo  *errInfo;
912 #endif
913 {
914    S16          ret; 
915    RgSchCellCb  *cell= instCb->rgrSap[spId].cell;
916    Inst         inst = (instCb->rgSchInit.inst );
917    RgSchUeCb    *ue = NULLP;
918
919    TRC2(rgSCHGomHndlResetReq);
920
921
922    errInfo->errType = RGSCHERR_GOM_RESET_REQ;
923    
924    /* Validate and process the UE reset request */
925    ret = rgSCHCfgVldtRgrUeReset(inst, reset, cell, &ue, errInfo);
926    if (ret != ROK) 
927    {
928       RLOG_ARG1(L_ERROR,DBG_CELLID,reset->cellId,"Rgr UE Reset Validation FAILED"
929                "CRNTI:%d",reset->crnti);
930       RETVALUE(RFAILED);
931    }
932    
933    ret = rgSCHCfgRgrUeReset(cell, ue, reset, errInfo);
934    if (ret != ROK) 
935    {
936       RLOG_ARG1(L_ERROR,DBG_CELLID,reset->cellId,"Rgr UE Reset FAILED"
937                "CRNTI:%d",reset->crnti);
938       RETVALUE(RFAILED);
939    }
940
941    RETVALUE(ret);
942 }  /* rgSCHGomHndlResetReq */
943
944
945 /**
946  * @brief Handler for processing Cell/Ue/Logical channel delete request
947  * recieved from RRM.
948  *
949  * @details
950  *
951  *     Function: rgSCHGomHndlDelReq
952  *     
953  *     This API handles processing of delete request from RRM to MAC. 
954  *     
955  *     Processing Steps:
956  *        - Fetch corresponding control block and pass it to CFG module.
957  *        - If control block does not exist, FAIL.
958  *
959  *  @param[in]  RgSchCb      *instCb
960  *  @param[in]  SpId         spId
961  *  @param[in]  RgrDel       *del
962  *  @param[out] RgSchErrInfo *errInfo
963  *  @return  S16
964  *      -# ROK 
965  *      -# RFAILED 
966  **/
967 #ifdef ANSI
968 PRIVATE S16 rgSCHGomHndlDelReq
969 (
970 RgSchCb       *instCb,
971 SpId          spId,
972 RgrDel        *del,
973 RgSchErrInfo  *errInfo
974 )
975 #else
976 PRIVATE S16 rgSCHGomHndlDelReq(instCb, spId, del, errInfo)
977 RgSchCb       *instCb;
978 SpId          spId;
979 RgrDel        *del;
980 RgSchErrInfo  *errInfo;
981 #endif
982 {
983
984    S16       ret;
985 #ifdef DEBUGP
986    Inst      inst = (instCb->rgSchInit.inst);
987 #endif
988    VOLATILE U32     startTime=0;
989
990    TRC2(rgSCHGomHndlDelReq);
991    
992    errInfo->errType = RGSCHERR_GOM_DEL_REQ;
993
994    if(instCb->rgrSap[spId].cell == NULLP)
995    {
996       RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"Cell doesnt exist");
997       RETVALUE(RFAILED); 
998    }
999    
1000    /* Process the delete request */ 
1001    switch (del->delType)
1002    {
1003       case RGR_CELL_CFG:
1004       {
1005          ret = rgSCHCfgRgrCellDel(instCb->rgrSap[spId].cell, del, errInfo);
1006          if(ret == ROK)
1007          {
1008             /* TODO::Needs to be revisited after tti flow CaDev Start */
1009             U8 idx = (U8)((instCb->rgrSap[spId].cell->cellId - instCb->genCfg.startCellId)&(CM_LTE_MAX_CELLS-1));
1010             instCb->cells[idx] = NULLP;
1011             /* CaDev End */
1012             instCb->rgrSap[spId].cell = NULLP;
1013             instCb->tfuSap[spId].cell = NULLP;
1014          }
1015          break;
1016       }
1017       case RGR_UE_CFG:
1018       case RGR_SCELL_UE_CFG:
1019       {
1020
1021          /*starting Task*/
1022          SStartTask(&startTime, PID_SCH_UE_DEL);
1023
1024          ret = rgSCHCfgRgrUeDel(instCb->rgrSap[spId].cell, del, errInfo);
1025
1026          /*stoping Task*/
1027          SStopTask(startTime, PID_SCH_UE_DEL);
1028
1029          break;
1030       }
1031       case RGR_LCH_CFG:
1032       {
1033          ret = rgSCHCfgRgrLcDel(instCb->rgrSap[spId].cell, del, errInfo);
1034          break;
1035       }
1036       case RGR_LCG_CFG:
1037       {
1038          ret = rgSCHCfgRgrLcgDel(instCb->rgrSap[spId].cell, del, errInfo);
1039          break;
1040       }
1041       default:
1042       {
1043 #if(ERRCLASS & ERRCLS_INT_PAR)
1044          RLOG1(L_ERROR,"Should never come here: delType %d", del->delType);
1045 #endif
1046          RETVALUE(RFAILED);
1047       }
1048    }
1049
1050    RETVALUE(ret);
1051 }  /* rgSCHGomHndlDelReq */
1052
1053
1054
1055
1056 /***********************************************************
1057  *
1058  *     Func : rgSCHGomGetCellIdFrmCfgReq
1059  *        
1060  *
1061  *     Desc : 
1062  *     - Processing Steps: 
1063  *        - Retrieves the cell Id for a config request.
1064  *
1065  *  @param[in]  RgrCfgReqInfo *rgrCfgReq
1066  *  @param[out] CmLteCellId   *cellId
1067  *     Ret  : ROK on fetching cellId
1068  *            RFAILED on failure
1069  *
1070  *     Notes: 
1071  *
1072  *     File : rg_sch_gom.c 
1073  *
1074  **********************************************************/
1075 #ifdef ANSI
1076 PRIVATE S16 rgSCHGomGetCellIdFrmCfgReq
1077 (
1078 RgrCfgReqInfo *rgrCfgReq,
1079 CmLteCellId   *cellId
1080 )
1081 #else
1082 PRIVATE S16 rgSCHGomGetCellIdFrmCfgReq(rgrCfgReq, cellId)
1083 RgrCfgReqInfo *rgrCfgReq;
1084 CmLteCellId   *cellId;
1085 #endif
1086 {
1087
1088    TRC2(rgSCHGomGetCellIdFrmCfgReq);
1089
1090
1091    /* Extract CellId depending on the action and Config Type in the Request 
1092     * As of now this function is called for only re configuration so removed
1093     * othe CASES below if needed we can add them*/
1094    switch (rgrCfgReq->action)
1095    {
1096       case RGR_RECONFIG:
1097          {
1098             if (rgrCfgReq->u.recfgInfo.recfgType ==RGR_CELL_CFG)
1099             {
1100                *cellId = rgrCfgReq->u.recfgInfo.u.cellRecfg.cellId;
1101             }
1102             else if ((rgrCfgReq->u.recfgInfo.recfgType ==  RGR_SCELL_UE_CFG) || 
1103                   (rgrCfgReq->u.recfgInfo.recfgType == RGR_UE_CFG))
1104             {
1105                *cellId = rgrCfgReq->u.recfgInfo.u.ueRecfg.cellId;
1106             }
1107             else if (rgrCfgReq->u.recfgInfo.recfgType == RGR_LCH_CFG)
1108             {
1109                *cellId = rgrCfgReq->u.recfgInfo.u.lchRecfg.cellId;
1110             }
1111             else if (rgrCfgReq->u.recfgInfo.recfgType == RGR_LCG_CFG) 
1112             {
1113                *cellId = rgrCfgReq->u.recfgInfo.u.lcgRecfg.cellId;
1114             }
1115             else
1116             {
1117                RETVALUE(RFAILED);
1118             }
1119             break;
1120          }
1121       default:
1122       {
1123          RETVALUE(RFAILED);
1124       }
1125    }  /* End of Switch */
1126
1127    RETVALUE(ROK);
1128 }  /* rgSCHGomGetCellIdFrmCfgReq */
1129
1130 #ifdef RGR_SI_SCH
1131 /**
1132  * @brief Handler to handle SI configuration request from RRM to MAC.
1133  *
1134  * @details
1135  *
1136  *     Function: rgSCHGomHndlSiCfg
1137  *     
1138  *     This API handles processing for SI configuration request from RRM to MAC.
1139  *     
1140  *     - Processing Steps: 
1141  *        - Validate SI configuration request parameters at CFG module. 
1142  *          Call rgSCHCfgVldtSiCfg for SI configuration.
1143  *        - If validated successfully, send configuration request to CFG.
1144  *          Call rgSCHCfgRgrCellCfg else FAIL.
1145  *          
1146  *  @param[in]  Region        reg
1147  *  @param[in]  Pool          pool
1148  *  @param[in]  RgSchCb       *instCb
1149  *  @param[in]  SpId          spId
1150  *  @param[in]  RgrCfgTransId transId
1151  *  @param[in]  RgrSiCfgReqInfo *cfgReqInfo
1152  *  @return  S16
1153  *      -# ROK 
1154  *      -# RFAILED 
1155  **/
1156 #ifdef ANSI
1157 PUBLIC S16 rgSCHGomHndlSiCfg
1158 (
1159 Region        reg,
1160 Pool          pool,
1161 RgSchCb       *instCb,
1162 SpId          spId,
1163 RgrCfgTransId transId,
1164 RgrSiCfgReqInfo *cfgReqInfo
1165 )
1166 #else
1167 PUBLIC S16 rgSCHGomHndlSiCfg(reg, pool, instCb, spId, transId, cfgReqInfo)
1168 Region        reg;
1169 Pool          pool;
1170 RgSchCb       *instCb;
1171 SpId          spId;
1172 RgrCfgTransId transId;
1173 RgrSiCfgReqInfo *cfgReqInfo;
1174 #endif
1175 {
1176    S16          ret;
1177    RgSchCellCb  *cell = instCb->rgrSap[spId].cell;
1178    Inst         inst = (instCb->rgSchInit.inst );
1179    RgSchErrInfo    errInfo;
1180    U8           cfmStatus = RGR_CFG_CFM_NOK;
1181    MsgLen       msgLen = 0, pduLen;
1182    S32          tbSz   = 0;
1183    U8           nPrb   = 0; 
1184    U8           mcs    = 0;
1185
1186    TRC2(rgSCHGomHndlSiCfg);
1187
1188
1189    /* check if cell does not exists */
1190    if (((U8 *)cell == NULLP) || (cell->cellId != cfgReqInfo->cellId))
1191    {
1192       RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Cell Control block does not exist"
1193                );
1194       RGSCH_FREE_MSG(cfgReqInfo->pdu);
1195       SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); 
1196       cfgReqInfo = NULLP;
1197       rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); 
1198       RETVALUE(RFAILED);
1199    }
1200
1201    /*Validate the received SI configuration */
1202    ret = rgSCHCfgVldtRgrSiCfg(inst, cfgReqInfo, cell, &errInfo);
1203    if (ret != ROK)
1204    {
1205       RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Rgr SI configuration "
1206                "validation FAILED");
1207       RGSCH_FREE_MSG(cfgReqInfo->pdu);
1208       SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); 
1209       cfgReqInfo = NULLP;
1210       rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); 
1211       RETVALUE(RFAILED);
1212    }
1213    /*ccpu00140789: Stopping SI scheduling*/
1214    if(RGR_SI_STOP == cfgReqInfo->cfgType)
1215    {
1216       if((cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si != NULLP)&&
1217                       (cell->siCb.siArray[cfgReqInfo->siId-1].si != NULLP))
1218       {
1219          cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si = NULLP;
1220          RGSCH_FREE_MSG(cell->siCb.siArray[cfgReqInfo->siId-1].si);
1221          cell->siCb.siArray[cfgReqInfo->siId-1].si = NULLP;
1222          if(cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si != NULLP)
1223          {
1224             RGSCH_FREE_MSG(cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si);
1225             cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si = NULLP;
1226          }
1227          SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
1228          cfgReqInfo = NULLP;   
1229          cfmStatus = RGR_CFG_CFM_OK;
1230          rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
1231          RETVALUE(ROK); 
1232        }
1233        else
1234        {
1235           SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
1236           cfgReqInfo = NULLP;
1237           rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
1238           RETVALUE(RFAILED); 
1239        }
1240    }
1241
1242    /* Check if the pdu sent from application
1243     * matches a transport block size. if not,
1244     * add padding bytes. This is usually done
1245     * by RRC but since we are bypassing RRC,
1246     * MAC is taking over that responsibility
1247     */
1248    if ( RGR_SI_CFG_TYPE_MIB != cfgReqInfo->cfgType )
1249    {
1250       SFndLenMsg(cfgReqInfo->pdu, &msgLen);
1251
1252       /* check if the application pdu matches a tb size */
1253       tbSz = rgSCHUtlGetAllwdCchTbSz(msgLen*8, &nPrb, &mcs);
1254
1255       if ( tbSz != (msgLen*8) )
1256       {
1257          MsgLen  nmPadBytes = 0;
1258          Data*   padding    = NULLP;
1259
1260          /* need to add padding bytes */
1261          nmPadBytes = (tbSz - (msgLen*8))/8;
1262
1263          if ( SGetSBuf(reg,pool,&padding,nmPadBytes) != ROK)
1264          {
1265             RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Rgr SI configuration "
1266                      "SGetSBuf failed for padding failed");
1267             SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); 
1268             cfgReqInfo = NULLP;
1269             rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, 
1270                                                            cfmStatus); 
1271             RETVALUE(RFAILED);
1272          }
1273
1274          cmMemset((U8*)padding,(U8)0,nmPadBytes);
1275
1276 #ifdef MS_MBUF_CORRUPTION 
1277    MS_BUF_ADD_ALLOC_CALLER();
1278 #endif 
1279          if ( SAddPstMsgMult((Data*)padding,nmPadBytes,cfgReqInfo->pdu) != ROK)
1280          {
1281             RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Rgr SI configuration "
1282                      "Failed to add padding bytes");
1283             SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); 
1284             cfgReqInfo = NULLP;
1285             SPutSBuf(reg, pool, (Data* )padding,(Size)nmPadBytes);
1286             padding = NULLP;
1287             rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, 
1288                                                             cfmStatus); 
1289             RETVALUE(RFAILED);
1290          }
1291          SPutSBuf(reg, pool, (Data* )padding,(Size)nmPadBytes);
1292          padding = NULLP;
1293       }/* if (tbSz != ...*/
1294    }/* if (RGR_SI_CFG_TYPE_SI...*/
1295
1296    /*Set the received pdu at the appropriate place */
1297    switch(cfgReqInfo->cfgType)
1298    {
1299       case RGR_SI_CFG_TYPE_MIB:   /* SI CFG Type MIB */
1300          RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.mib, 
1301                cell->siCb.newSiInfo.mib, 
1302                cfgReqInfo->pdu, cell->siCb.siBitMask, 
1303                RGSCH_SI_MIB_UPD);
1304          break;
1305
1306       case RGR_SI_CFG_TYPE_SIB1_PWS:
1307          {
1308             SFndLenMsg(cfgReqInfo->pdu, &pduLen);
1309             ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen,0);
1310             if (ret != ROK)
1311             {
1312                RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Failed to get MCS and NPRB" 
1313                      "value");
1314                RGSCH_FREE_MSG(cfgReqInfo->pdu);
1315                SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); 
1316                cfgReqInfo = NULLP;
1317                rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, 
1318                      cfmStatus); 
1319                RETVALUE(RFAILED);
1320             }
1321
1322             RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.sib1Info.sib1, 
1323                   cell->siCb.newSiInfo.sib1Info.sib1, 
1324                   cfgReqInfo->pdu, cell->siCb.siBitMask, 
1325                   RGSCH_SI_SIB1_PWS_UPD);
1326          }
1327          break;
1328
1329       case RGR_SI_CFG_TYPE_SIB1:
1330          SFndLenMsg(cfgReqInfo->pdu, &pduLen);
1331          ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen,0);
1332          if (ret != ROK)
1333          {
1334             RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Failed to get MCS and NPRB" 
1335                      "value");
1336             RGSCH_FREE_MSG(cfgReqInfo->pdu);
1337             SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); 
1338             cfgReqInfo = NULLP;
1339             rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, 
1340                                                                  cfmStatus); 
1341             RETVALUE(RFAILED);
1342          }
1343          RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.sib1Info.sib1, 
1344                cell->siCb.newSiInfo.sib1Info.sib1, 
1345                cfgReqInfo->pdu, cell->siCb.siBitMask, 
1346                RGSCH_SI_SIB1_UPD);
1347          break;
1348
1349       case RGR_SI_CFG_TYPE_SI:    /* SI CFG TYPE SI */
1350          SFndLenMsg(cfgReqInfo->pdu, &pduLen);
1351          ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen, 
1352                                                      cfgReqInfo->siId);
1353          if (ret != ROK)
1354          {
1355             RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Failed to get MCS and NPRB" 
1356                      "value");
1357             RGSCH_FREE_MSG(cfgReqInfo->pdu);
1358             SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); 
1359             cfgReqInfo = NULLP;
1360             rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, 
1361                                                                  cfmStatus); 
1362             RETVALUE(RFAILED);
1363          }
1364          /* Si recfg, where numSi changes */
1365          if (cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD) 
1366          {
1367             Buffer **newSiPdu = &cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si;
1368             if(*newSiPdu != NULLP)
1369             {
1370                RGSCH_FREE_MSG(*newSiPdu);
1371             }
1372             *newSiPdu = (Buffer *)cfgReqInfo->pdu;
1373             cell->siCb.siBitMask |= RGSCH_SI_SI_UPD;
1374          }
1375          else /* Initial Si cfg  or si recfg where numSi did not change */
1376          {
1377             U8 bitMask;
1378             /* Initial Si cfg */
1379             if (cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si == NULLP)
1380             {
1381                cell->siCb.siArray[cfgReqInfo->siId-1].si = cfgReqInfo->pdu;
1382                cell->siCb.siArray[cfgReqInfo->siId-1].isWarningSi = FALSE;
1383                bitMask = RGSCH_SI_DFLT;
1384             }
1385             else
1386             {
1387                bitMask = RGSCH_SI_SI_UPD;
1388             }
1389
1390             RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si, 
1391                 cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si, 
1392                 cfgReqInfo->pdu, 
1393                 cell->siCb.siBitMask, bitMask);
1394          }
1395          break;
1396
1397       case RGR_SI_CFG_TYPE_SIB8_CDMA:    /* SI CFG TYPE SIB 8 CDMA */
1398          SFndLenMsg(cfgReqInfo->pdu, &pduLen);
1399          ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen, 
1400                                                      cfgReqInfo->siId);
1401          if (ret != ROK)
1402          {
1403             RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Failed to get MCS and NPRB" 
1404                      "value");
1405             RGSCH_FREE_MSG(cfgReqInfo->pdu);
1406             SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); 
1407             cfgReqInfo = NULLP;
1408             rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, 
1409                                                                  cfmStatus); 
1410             RETVALUE(RFAILED);
1411          }
1412          /* No need to wait for Modification period boundary */
1413          cell->siCb.siArray[cfgReqInfo->siId-1].si = cfgReqInfo->pdu;
1414          RGSCH_SET_SI_INFO(cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si,
1415                cfgReqInfo->pdu);
1416          cell->siCb.siArray[cfgReqInfo->siId-1].isWarningSi = FALSE;
1417          break;
1418       default:
1419          RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Invalid cfgType "
1420                   "parameter value");
1421          RGSCH_FREE_MSG(cfgReqInfo->pdu);
1422          SPutSBuf(reg, pool, (Data *)cfgReqInfo, 
1423                (Size)sizeof(*cfgReqInfo)); 
1424          cfgReqInfo = NULLP;
1425          rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, 
1426                cfmStatus); 
1427          RETVALUE(RFAILED);
1428    }
1429
1430    SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo)); 
1431    cfgReqInfo = NULLP;
1432    cfmStatus = RGR_CFG_CFM_OK;
1433    rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus); 
1434
1435
1436    RETVALUE(ROK);
1437 }  /* rgSCHGomHndlSiCfg */
1438
1439
1440 /**
1441  * @brief Handler to handle Warning SI configuration request from RRM to MAC.
1442  *
1443  * @details
1444  *
1445  *     Function: rgSCHGomHndlWarningSiCfg
1446  *     
1447  *     This API handles processing for Warning SI configuration request from 
1448  *     RRM to MAC.
1449  *     
1450  *          
1451  *  @param[in]  Region        reg
1452  *  @param[in]  Pool          pool
1453  *  @param[in]  RgSchCb       *instCb
1454  *  @param[in]  SpId          spId
1455  *  @param[in]  RgrWarningSiCfgReqInfo  *warningSiCfgReqInfo
1456  *  @return  S16
1457  *      -# ROK 
1458  *      -# RFAILED 
1459  **/
1460 #ifdef ANSI
1461 PUBLIC S16 rgSCHGomHndlWarningSiCfg
1462 (
1463 Region        reg,
1464 Pool          pool,
1465 RgSchCb       *instCb,
1466 SpId          spId,
1467 RgrCfgTransId transId,
1468 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
1469 )
1470 #else
1471 PUBLIC S16 rgSCHGomHndlWarningSiCfg(reg, pool, instCb, spId, transId, 
1472 warningSiCfgReqInfo)
1473 Region        reg;
1474 Pool          pool;
1475 RgSchCb       *instCb;
1476 SpId          spId;
1477 RgrCfgTransId transId;
1478 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo;
1479 #endif
1480 {
1481    RgSchCellCb       *cell = instCb->rgrSap[spId].cell;
1482    U8                 cfmStatus = RGR_CFG_CFM_NOK;
1483    U16                idx;
1484    U8                 siId = warningSiCfgReqInfo->siId; 
1485    U8                 j, mcs=0, nPrb=0;
1486    RgSchWarningSiSeg  *warningSiMsg;
1487    RgSchWarningSiPdu  *pduNode;
1488    CmLList            *node;
1489    MsgLen             msgLen = 0;
1490    Bool               freeNodeFound = FALSE;
1491    U16                siWinSize = 0;
1492    U16                minPeriod = 0;
1493 #ifdef EMTC_ENABLE
1494    U8                 isEmtc = warningSiCfgReqInfo->emtcEnable;
1495 #endif
1496
1497    TRC2(rgSCHGomHndlWarningSiCfg);
1498
1499 #ifdef EMTC_ENABLE
1500    if(TRUE == isEmtc)
1501    {
1502       rgSchEmtcGetSiWinPerd(cell, &siWinSize, &minPeriod);
1503    }
1504    else
1505 #endif
1506    {
1507       siWinSize = cell->siCfg.siWinSize;
1508       minPeriod = cell->siCfg.minPeriodicity;
1509    }
1510    /* check if cell does not exists */
1511    if (((U8 *)cell == NULLP) || 
1512          (cell->cellId != warningSiCfgReqInfo->cellId) ||
1513          (warningSiCfgReqInfo->siId > 
1514           ((minPeriod * 10)/siWinSize)))
1515    {
1516       RLOG_ARG2(L_ERROR,DBG_CELLID,warningSiCfgReqInfo->cellId,"Warning SI Cfg Failed for siId = %d"
1517                 "warning cellID:%d",warningSiCfgReqInfo->siId,warningSiCfgReqInfo->cellId);
1518       rgSCHUtlFreeWarningSiSeg(reg, pool, &warningSiCfgReqInfo->siPduLst);
1519       SPutSBuf(reg, pool, (Data *)warningSiCfgReqInfo, 
1520             sizeof(RgrWarningSiCfgReqInfo)); 
1521       warningSiCfgReqInfo = NULLP;
1522       rgSCHUtlRgrWarningSiCfgCfm(instCb->rgSchInit.inst, spId, siId, transId, 
1523             cfmStatus); 
1524       RETVALUE(RFAILED);
1525    }
1526
1527    /* Search for free index in WarningSi */
1528    for(idx = 0; idx < RGR_MAX_NUM_WARNING_SI; idx++)
1529    {
1530       if((cell->siCb.warningSi[idx].siId == 0 ||
1531                cell->siCb.warningSi[idx].siId == warningSiCfgReqInfo->siId))
1532       {
1533          warningSiMsg = (RgSchWarningSiSeg *)&cell->siCb.warningSi[idx].warningSiMsg; 
1534
1535          /* Search for free SI node */
1536          /* ccpu00136659: CMAS ETWS design changes */
1537          if (warningSiMsg->segLstCp.first == NULLP) /* Free SI Node */
1538          {
1539             warningSiMsg->transId = transId;
1540             pduNode = (RgSchWarningSiPdu *)&cell->siCb.warningSi[idx].
1541                warningSiMsg.pduNode;
1542             CM_LLIST_FIRST_NODE(&warningSiCfgReqInfo->siPduLst, node);
1543             j = 0;
1544
1545             /* Get the PDUs one by one from the received pduLst of warning 
1546              * message and calculate the MCS and nPrb of each pdu once.
1547              * Store the pdu in warningSiMsg pduLst, which will be scheduled 
1548              * later while sending warning message as part of SIB11/SIB12 
1549              */   
1550             while((node != NULLP) && (j < RGR_MAX_WARNING_SI_SEG))
1551
1552             {
1553                pduNode[j].pdu = (Buffer *)node->node;
1554                if(pduNode[j].pdu != NULLP)
1555                {
1556                   SFndLenMsg(pduNode[j].pdu, &msgLen);
1557                   /*Get the nPrb and mcs parametr values */
1558 #ifdef EMTC_ENABLE
1559                   if (rgSCHEmtcUtlGetAllwdCchTbSzForSI(msgLen*8) != (msgLen*8))
1560 #else
1561                   if (rgSCHUtlGetAllwdCchTbSz(msgLen*8, &nPrb, &mcs) != (msgLen*8))
1562 #endif
1563
1564                   {
1565                      RGSCHLOGERROR(cell->instIdx,ERRCLS_INT_PAR,ERG011,
1566                            (ErrVal)msgLen,
1567                            "rgSCHGomHndlWarningSiCfg():msgLen does not match\
1568                            any valid TB Size.");
1569                      RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Warning SI Cfg Failed" 
1570                            "for siId = %d", warningSiCfgReqInfo->siId);
1571                      rgSCHUtlFreeWarningSiSeg(reg, pool, 
1572                            &warningSiCfgReqInfo->siPduLst);
1573                      SPutSBuf(reg, pool, (Data *)warningSiCfgReqInfo, 
1574                            sizeof(RgrWarningSiCfgReqInfo)); 
1575                      warningSiCfgReqInfo = NULLP;
1576                      rgSCHUtlRgrWarningSiCfgCfm(instCb->rgSchInit.inst, spId,
1577                            siId, transId,cfmStatus); 
1578                      RETVALUE(RFAILED);
1579
1580                   }
1581                }
1582                pduNode[j].mcs = mcs;
1583                pduNode[j].nPrb = nPrb;
1584                pduNode[j].msgLen = msgLen;
1585                /* ccpu00136659: CMAS ETWS design changes */
1586                cmLListAdd2Tail(&warningSiMsg->segLstCp, &pduNode[j].lnk);
1587                pduNode[j].lnk.node = (PTR)&pduNode[j];
1588                j++;
1589                node = node->next;
1590             }
1591
1592             /* ccpu00132385-  nodes in received SI config linked list should 
1593              * be freed after processing the config.*/
1594             while(warningSiCfgReqInfo->siPduLst.first != NULLP)
1595             {
1596                node = warningSiCfgReqInfo->siPduLst.first;
1597                cmLListDelFrm(&(warningSiCfgReqInfo->siPduLst), node);
1598                SPutSBuf(reg, pool, (Data *)node,sizeof(CmLList));
1599                node = NULLP;
1600             } 
1601
1602             cell->siCb.warningSi[idx].siId = warningSiCfgReqInfo->siId;
1603             cell->siCb.warningSi[idx].idx = idx;
1604 #ifdef EMTC_ENABLE
1605             if(TRUE == isEmtc)
1606             {
1607                rgSCHEmtcWarningSiCfg(cell,warningSiCfgReqInfo,idx);
1608             }
1609             else
1610 #endif
1611             {
1612                cell->siCb.siArray[warningSiCfgReqInfo->siId-1].si = 
1613                   &cell->siCb.warningSi[idx];
1614                cell->siCb.siArray[warningSiCfgReqInfo->siId-1].isWarningSi =
1615                   TRUE;
1616             }
1617             freeNodeFound = TRUE;
1618             break;
1619          }
1620       }
1621    }
1622
1623    if (freeNodeFound == FALSE)
1624    {
1625       RLOG_ARG0(L_DEBUG,DBG_CELLID,cell->cellId,"No SI Index is free");
1626       rgSCHUtlFreeWarningSiSeg(reg, pool, &warningSiCfgReqInfo->siPduLst);
1627       SPutSBuf(reg, pool, (Data *)warningSiCfgReqInfo, 
1628             sizeof(RgrWarningSiCfgReqInfo)); 
1629       warningSiCfgReqInfo = NULLP;
1630       rgSCHUtlRgrWarningSiCfgCfm(instCb->rgSchInit.inst, spId, siId, transId, 
1631             cfmStatus); 
1632       RETVALUE(RFAILED);
1633    }
1634
1635    SPutSBuf(reg, pool, (Data *)warningSiCfgReqInfo, 
1636          sizeof(RgrWarningSiCfgReqInfo)); 
1637    warningSiCfgReqInfo = NULLP;
1638    RETVALUE(ROK);
1639 }
1640
1641 \f
1642 /**
1643  * @brief Handler to handle SI Stop request from RRM to MAC.
1644  *
1645  * @details
1646  *
1647  *     Function: rgSCHGomHndlWarningSiStopReq
1648  *     
1649  *     This API handles processing for SI stop request from RRM to MAC.
1650  *     
1651  *  @param[in]  Region        reg
1652  *  @param[in]  Pool          pool
1653  *  @param[in]  RgSchCb       *instCb
1654  *  @param[in]  SpId          siId
1655  *  @return  void
1656  **/
1657 #ifdef ANSI
1658 PUBLIC Void rgSCHGomHndlWarningSiStopReq 
1659 (
1660 Region        reg,
1661 Pool          pool,
1662 RgSchCb       *instCb,
1663 U8            siId,
1664 RgrCfgTransId transId,
1665 SpId          spId
1666 )
1667 #else
1668 PUBLIC Void rgSCHGomHndlWarningSiStopReq(reg, pool, instCb, siId, transId, spId)
1669 Region        reg;
1670 Pool          pool;
1671 RgSchCb       *instCb;
1672 U8            siId;
1673 RgrCfgTransId transId;
1674 SpId          spId;
1675 #endif
1676 {
1677    RgSchCellCb        *cell = instCb->rgrSap[spId].cell;
1678    U16                idx;
1679    CmLList            *node;
1680    RgSchWarningSiPdu  *warningSiPdu;
1681    Buffer             *pdu;
1682
1683    TRC3(rgSCHGomHndlWarningSiStopReq)
1684
1685    for(idx = 0; idx < RGR_MAX_NUM_WARNING_SI; idx++)
1686    {
1687       if(cell->siCb.warningSi[idx].siId == siId)
1688       {
1689          if ((cmMemcmp ((U8 *)&cell->siCb.warningSi[idx].warningSiMsg.transId, 
1690                      (U8 *)&transId, sizeof(RgrCfgTransId))) == 0)
1691          {
1692             /* ccpu00136659: CMAS ETWS design changes */
1693             CM_LLIST_FIRST_NODE(&cell->siCb.warningSi[idx].warningSiMsg.segLstCp, node);
1694             while(node != NULLP)
1695             {
1696                /* On receiving the warning stop message, remove one by one
1697                 * each PDU from the warning SI list
1698                 */  
1699                /* ccpu00136659: CMAS ETWS design changes */
1700                node = (CmLList *)&cell->siCb.warningSi[idx].warningSiMsg.segLstCp.first;
1701                warningSiPdu = (RgSchWarningSiPdu *)node->node;
1702                pdu = warningSiPdu->pdu;
1703                cmLListDelFrm(&cell->siCb.warningSi[idx].warningSiMsg.segLstCp, node);
1704                RGSCH_FREE_MSG(pdu);
1705                node = node->next;
1706             }
1707          }
1708       }
1709    }
1710    RETVOID;
1711 }
1712
1713 #endif/*RGR_SI_SCH */
1714 \f
1715 /* LTE_ADV_FLAG_REMOVED_START */
1716
1717 /**
1718  * @brief This function sets the Phigh range for CC users corresponding to the CC Pool
1719  * @details
1720  *
1721  *     Function: rgSchUpdtRNTPInfo
1722  *
1723  *     Invoked by: rgSCHGomHndlLoadInf
1724  *
1725  *  @param[in]  RgSchCellCb*     cell
1726  *  @param[in]  RgSubFrm*     subFrm
1727  *  @param[in]  RgrLoadInfReqInfo   *loadInfReq
1728  *  @return  S16
1729  *
1730  **/
1731 #ifdef ANSI
1732 PUBLIC S16 rgSchUpdtRNTPInfo
1733 (
1734  RgSchCellCb             *cell,
1735  RgSchDlSf               *sf,
1736  RgrLoadInfReqInfo       *loadInfReq
1737  )
1738 #else
1739 PRIVATE Void rgSchUpdtRNTPInfo(cell, sf)
1740    RgSchCellCb             *cell;
1741    RgSchDlSf               *sf;
1742    RgrLoadInfReqInfo       *loadInfReq;
1743
1744 #endif
1745 {
1746    /*  Initialise the variables */
1747    RgSchSFRPoolInfo *sfrCCPool;
1748    CmLListCp   *l;
1749    CmLList     *n;
1750    S16 ret = RFAILED;
1751
1752    TRC2(rgSchUpdtRNTPInfo);
1753
1754    l = &sf->sfrTotalPoolInfo.ccPool;
1755
1756    /*Get the first node from the CC Pool*/
1757    n = cmLListFirst(l);
1758    while(n)
1759    {
1760       sfrCCPool = (RgSchSFRPoolInfo*)n->node;
1761       if (sfrCCPool->poolendRB == loadInfReq->rgrCcPHighEndRb)
1762       {
1763          sfrCCPool->pwrHiCCRange.endRb   = loadInfReq->rgrCcPHighEndRb;
1764          sfrCCPool->pwrHiCCRange.startRb = loadInfReq->rgrCcPHighStartRb;
1765          RETVALUE(ROK);
1766       }
1767       else
1768       {
1769          n = cmLListNext(l);
1770       }
1771    }
1772    RETVALUE(ret);
1773 }
1774 /**
1775  * @brief Handler to handle LOAD INF request from RRM to MAC.
1776  *
1777  * @details
1778  *
1779  *     Function: rgSCHGomHndlLoadInf
1780  *
1781  *     This API handles processing for LOAD INF request from RRM to MAC.
1782  *
1783  *     - Processing Steps:
1784  *        - Validate LOAD INF request parameters at CFG module.
1785  *          Call rgSCHCfgVldtRgrLoadInf for SI configuration.
1786  *        - If validated successfully, send configuration request.
1787  *
1788  *  @param[in]  Region            reg
1789  *  @param[in]  Pool              pool
1790  *  @param[in]  RgSchCb           *instCb
1791  *  @param[in]  SpId              spId
1792  *  @param[in]  RgrCfgTransId     transId
1793  *  @param[in]  RgrLoadInfReqInfo *loadInfReq
1794  *  @return  S16
1795  *      -# ROK
1796  *      -# RFAILED
1797  **/
1798 #ifdef ANSI
1799 PUBLIC S16 rgSCHGomHndlLoadInf
1800 (
1801  Region            reg,
1802  Pool              pool,
1803  RgSchCb           *instCb,
1804  SpId              spId,
1805  RgrCfgTransId     transId,
1806  RgrLoadInfReqInfo *loadInfReq
1807  )
1808 #else
1809 PUBLIC S16 rgSCHGomHndlLoadInf(reg, pool, instCb, spId, transId, loadInfReq)
1810    Region            reg;
1811    Pool              pool;
1812    RgSchCb           *instCb;
1813    SpId              spId;
1814    RgrCfgTransId     transId;
1815    RgrLoadInfReqInfo *loadInfReq;
1816 #endif
1817 {
1818    S16          ret;
1819    RgSchCellCb  *cell = instCb->rgrSap[spId].cell;
1820    Inst         inst  = (instCb->rgSchInit.inst );
1821    RgSchErrInfo errInfo;
1822    U16 i;
1823
1824    TRC2(rgSCHGomHndlLoadInf);
1825
1826
1827    /* check if cell does not exists */
1828    if (((U8 *)cell == NULLP) || (cell->cellId != loadInfReq->cellId))
1829    {
1830       RLOG_ARG1(L_ERROR,DBG_CELLID,loadInfReq->cellId,"Cell Control block does not exist"
1831              "for load cellId:%d",loadInfReq->cellId);
1832       SPutSBuf(reg, pool, (Data *)loadInfReq, (Size)sizeof(*loadInfReq));
1833       RETVALUE(RFAILED);
1834    }
1835
1836    if (cell->lteAdvCb.dsfrCfg.status == RGR_DISABLE)
1837    {
1838       RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHGomHndlLoadInf(): DSFR Feature not enabled");
1839       SPutSBuf(reg, pool, (Data *)loadInfReq, (Size)sizeof(*loadInfReq));
1840       RETVALUE(RFAILED);
1841    }
1842    /* Validate the received LOAD INF Configuration */
1843    ret = rgSCHCfgVldtRgrLoadInf(inst, loadInfReq, cell, &errInfo);
1844    if (ret != ROK)
1845    {
1846       RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"Rgr LOAD INF Configuration "
1847                "validation FAILED");
1848       SPutSBuf(reg, pool, (Data *)loadInfReq, (Size)sizeof(*loadInfReq));
1849       RETVALUE(RFAILED);
1850    }
1851    /* Update the RNTP info rcvd in the respective cell centre pool so that Phigh can be
1852       sent for the UEs scheduled in that particular RB range*/
1853    for(i = 0; i < RGSCH_NUM_DL_SUBFRAMES; i++)
1854    {
1855       if((rgSchUpdtRNTPInfo(cell, cell->subFrms[i], loadInfReq) != ROK))
1856       {
1857          RETVALUE(RFAILED);
1858       }
1859    }
1860
1861    SPutSBuf(reg, pool, (Data *)loadInfReq, (Size)sizeof(*loadInfReq));
1862
1863
1864    RETVALUE(ROK);
1865 }  /* rgSCHGomHndlLoadInf */
1866 /* LTE_ADV_FLAG_REMOVED_END */
1867 \f
1868 /**********************************************************************
1869  
1870          End of file
1871 **********************************************************************/