1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
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 #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
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 *******************************************************************************/
19 /************************************************************************
25 Desc: C source code for Entry point fucntions
29 **********************************************************************/
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.
36 static const char* RLOG_MODULE_NAME="MAC";
37 static int RLOG_MODULE_ID=4096;
38 static int RLOG_FILE_ID=164;
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 */
55 #include "rg_sch_inf.h"
57 #include "rg_sch_err.h"
58 #include "rl_interface.h"
59 #include "rl_common.h"
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 */
74 #include "rg_sch_inf.x"
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));
93 PRIVATE S16 rgSCHGomHndlSCellActDeactReq ARGS((RgSchCb *instCb, SpId spId,
94 RgrSCellActDeactEvnt *sCellActDeactEvnt, RgSchErrInfo *errInfo, U8 action));
97 EXTERN S16 rgSchEmtcGetSiWinPerd ARGS((
102 extern S16 rgSCHEmtcUtlCalMcsAndNPrb
110 EXTERN S32 rgSCHEmtcUtlGetAllwdCchTbSzForSI ARGS(
115 EXTERN Void rgSCHEmtcWarningSiCfg ARGS(
118 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo,
128 /* forward references */
133 * @brief Handler for config request from RRM to Schedular.
137 * Function: rgSCHGomHndlCfg
139 * This API is called from schedulers UIM and it handles config request
140 * from RRM to Scheduler.
143 * - If the request is for the inactive cell,
144 * - Handle request.Call rgSCHGomCfgReq.
146 * - Enqueue the request. Call rgSCHGomEnqCfgReq.
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
159 PUBLIC S16 rgSCHGomHndlCfg
165 RgrCfgTransId transId,
166 RgrCfgReqInfo *cfgReqInfo
169 PUBLIC S16 rgSCHGomHndlCfg(reg, pool, instCb, spId, transId, cfgReqInfo)
174 RgrCfgTransId transId;
175 RgrCfgReqInfo *cfgReqInfo;
180 RgSchCellCb *cell = NULLP;
181 U8 cfmStatus = RGR_CFG_CFM_NOK;
183 Inst inst = (instCb->rgSchInit.inst );
186 TRC2(rgSCHGomHndlCfg);
187 /* Apply the configuration for Cell Configuration or Delete */
188 if (cfgReqInfo->action != RGR_RECONFIG)
190 ret = rgSCHGomCfgReq (reg, pool, instCb, spId, transId, cfgReqInfo);
194 /* Fetch the cell Id for the recieved request */
195 if((rgSCHGomGetCellIdFrmCfgReq(cfgReqInfo, &cellId)) != ROK)
197 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Action.Config Type Error");
199 SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
201 rgSCHUtlRgrCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
204 /* Extract the cell and Enquee Config Request */
205 if(NULLP != instCb->rgrSap[spId].cell)
207 if(cellId != instCb->rgrSap[spId].cell->cellId)
209 RLOG_ARG2(L_ERROR,DBG_CELLID,cellId, "Cell with Id %d already exists "
210 "on sap %d", instCb->rgrSap[spId].cell->cellId, spId);
212 SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
214 rgSCHUtlRgrCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
217 cell = instCb->rgrSap[spId].cell;
219 /* Enqueue the configuration */
220 ret = rgSCHGomEnqCfgReq(reg, pool, cell, transId, cfgReqInfo);
223 RLOG_ARG0(L_ERROR,DBG_CELLID,cellId, "rgSCHGomHndlCfg: Enqueuing CfgReq "
226 SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
228 rgSCHUtlRgrCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
234 SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
236 rgSCHUtlRgrCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
239 }/* rgSCHGomHndlCfg */
243 * @brief Handler to handle config request from RRM to Scheduler.
247 * Function: rgSCHGomCfgReq
249 * This API handles processing for config request from RRM to Scheduler.
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.
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
268 PRIVATE S16 rgSCHGomCfgReq
274 RgrCfgTransId transId,
275 RgrCfgReqInfo *cfgReqInfo
278 PRIVATE S16 rgSCHGomCfgReq(reg, pool, instCb, spId, transId, cfgReqInfo)
283 RgrCfgTransId transId;
284 RgrCfgReqInfo *cfgReqInfo;
287 U8 cfmStatus = RGR_CFG_CFM_OK;
289 RgSchErrInfo errInfo;
291 Inst inst = (instCb->rgSchInit.inst );
293 TRC2(rgSCHGomCfgReq);
295 printf("\n AT MAC rgSCHGomCfgReq \n");
298 /* Process Config/Reconfig/Delete request from RRM */
299 switch (cfgReqInfo->action)
303 ret = rgSCHGomHndlCfgReq(instCb, spId,
304 &cfgReqInfo->u.cfgInfo, &errInfo);
309 ret = rgSCHGomHndlRecfgReq(instCb, spId,
310 &cfgReqInfo->u.recfgInfo, &errInfo);
315 ret = rgSCHGomHndlResetReq(instCb, spId,
316 &cfgReqInfo->u.rstInfo, &errInfo);
321 ret = rgSCHGomHndlDelReq(instCb, spId,
322 &cfgReqInfo->u.delInfo, &errInfo);
327 case RGR_SCELL_DEACT:
328 case RGR_SCELL_READY:
330 ret = rgSCHGomHndlSCellActDeactReq(instCb, spId,
331 &cfgReqInfo->u.sCellActDeactEvnt, &errInfo, cfgReqInfo->action);
337 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "Invalid configuration "
338 "action %d", cfgReqInfo->action);
341 } /* End of switch */
345 cfmStatus = RGR_CFG_CFM_NOK;
348 SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
351 printf("\n AT MAC sending RGR cfg cfm \n");
354 /* Send back confirmation status to RRM */
355 rgSCHUtlRgrCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
357 printf("\n AT MAC RGR cfg cfm sent\n");
361 } /* rgSCHGomCfgReq */
365 * @brief Handler to enqueuing config request from RRM to Scheduler.
369 * Function: rgSCHGomEnqCfgReq
371 * This API enqueues config request from RRM to MAC.
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
381 * - Enqueue the request in pndngRgrCfgLst of the cell.
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
393 PRIVATE S16 rgSCHGomEnqCfgReq
398 RgrCfgTransId transId,
399 RgrCfgReqInfo *rgrCfgReq
402 PRIVATE S16 rgSCHGomEnqCfgReq(reg, pool, cell, transId, rgrCfgReq)
406 RgrCfgTransId transId;
407 RgrCfgReqInfo *rgrCfgReq;
412 RgSchCfgElem *rgrCfgElem = NULLP;
413 CmLteTimingInfo actvTime;
414 Inst inst = cell->instIdx;
416 TRC2(rgSCHGomEnqCfgReq);
418 /* Allocate memory for config Element */
419 ret = rgSCHUtlAllocSBuf(inst, (Data **)&rgrCfgElem, sizeof(RgSchCfgElem));
420 if ((ret != ROK) || ((U8 *)rgrCfgElem == NULLP))
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;
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)))
442 rgrCfgReq->u.recfgInfo.u.cellRecfg.recfgActvTime.actvTime;
444 /* Check if the activation time is valid */
445 if (actvTime.sfn >= RGSCH_MAX_SFN
446 || actvTime.subframe >= RGSCH_NUM_SUB_FRAMES_5G)
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));
458 sfDiff = RGSCH_CALC_SF_DIFF(actvTime, cell->crntTime);
460 if (sfDiff > (RGR_ACTV_WIN_SIZE * RGSCH_NUM_SUB_FRAMES_5G))
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));
474 /* Add to pending cfgReqLst */
475 rgrCfgElem->actvTime = actvTime;
476 rgSCHDbmInsPndngRgrCfgElem(cell, rgrCfgElem);
477 /* Cfm to be sent only after applying request */
482 /* Add to current cfgReq list */
483 rgSCHDbmInsCrntRgrCfgElem(cell, rgrCfgElem);
484 /* Cfm to be sent only after applying request */
486 } /* rgSCHGomEnqCfgReq */
490 * @brief Handler for TTI processing for configurations recieved from RRM.
494 * Function: rgSCHGomTtiHndlr
496 * This API does TTI processing for configurations recieved from RRM.
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.
506 * @param[in] RgSchCellCb *cell
512 PUBLIC S16 rgSCHGomTtiHndlr
518 PUBLIC S16 rgSCHGomTtiHndlr(cell, spId)
523 RgSchCfgElem *cfgElem;
524 Inst inst= cell->instIdx;
525 TRC2(rgSCHGomTtiHndlr);
527 /* Dequeue from current config list */
528 while ((cfgElem = rgSCHDbmGetNextCrntRgrCfgElem(cell, NULLP)) != NULLP)
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));
539 /* Handle config requests from pending config list */
540 while((cfgElem = rgSCHDbmGetPndngRgrCfgElemByKey(cell, cell->crntTime)) != NULLP)
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));
556 * @brief Handler to handle configuration request from RRM to MAC.
560 * Function: rgSCHGomHndlCfgReq
562 * This API handles processing for configuration request from RRM to MAC.
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.
570 * @param[in] RgSchCb *instCb
571 * @param[in] SpId spId
572 * @param[in] RgrCfg *cfg
573 * @param[out] RgSchErrInfo *errInfo
579 PRIVATE S16 rgSCHGomHndlCfgReq
584 RgSchErrInfo *errInfo
587 PRIVATE S16 rgSCHGomHndlCfgReq(instCb, spId, cfg, errInfo)
591 RgSchErrInfo *errInfo;
595 RgSchCellCb *cell = instCb->rgrSap[spId].cell;
596 Inst inst = (instCb->rgSchInit.inst );
599 TRC2(rgSCHGomHndlCfgReq);
601 errInfo->errType = RGSCHERR_GOM_CFG_REQ;
603 /* Validate and process the configuration request */
604 switch (cfg->cfgType)
608 ret = rgSCHCfgVldtRgrCellCfg(inst, &cfg->u.cellCfg, cell, errInfo);
611 RLOG1(L_ERROR,"Rgr Cell configuration "
612 "validation FAILED: Cell %d", cfg->u.cellCfg.cellId);
615 ret = rgSCHCfgRgrCellCfg(instCb, spId, &cfg->u.cellCfg, errInfo);
619 case RGR_SCELL_UE_CFG:
621 ret = rgSCHCfgVldtRgrUeCfg(inst, &cfg->u.ueCfg, &cell, errInfo);
624 RLOG1(L_ERROR,"Ue configuration validation"
625 " FAILED: CRNTI:%d", cfg->u.ueCfg.crnti);
628 ret = rgSCHCfgRgrUeCfg(cell, &cfg->u.ueCfg, errInfo);
633 ret = rgSCHCfgVldtRgrLcCfg(inst, &cfg->u.lchCfg, &cell, &ue, errInfo);
636 RLOG1(L_ERROR,"LC configuration validation "
637 "FAILED: LCID:%d", cfg->u.lchCfg.lcId);
640 ret = rgSCHCfgRgrLchCfg(cell, ue, &cfg->u.lchCfg, errInfo);
645 ret = rgSCHCfgVldtRgrLcgCfg(inst, &cfg->u.lcgCfg, &cell, &ue, errInfo);
648 RLOG1(L_ERROR,"LCG configuration validation "
649 "FAILED: LCGID:%d", cfg->u.lcgCfg.ulInfo.lcgId);
652 ret = rgSCHCfgRgrLcgCfg(cell, ue, &cfg->u.lcgCfg, errInfo);
657 ret = rgSCHCfgVldtRgrSchedEnbCfg(inst, &cfg->u.schedEnbCfg, errInfo);
660 RGSCHDBGERR(inst,(rgSchPBuf(inst), "SCH ENB configuration validation "
664 ret = rgSCHCfgRgrSchedEnbCfg(inst, spId, &cfg->u.schedEnbCfg, errInfo);
669 #if(ERRCLASS & ERRCLS_INT_PAR)
670 RLOG1(L_ERROR,"Should never come here: "
671 "cfgType %d", cfg->cfgType);
678 } /* rgSCHGomHndlCfgReq */
682 * @brief Handler to handle re-configuration request from RRM to MAC.
686 * Function: rgSCHGomHndlSCellActDeactReq
688 * This API handles processing for SCell Activation Request from RRM to SCH.
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
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
705 PRIVATE S16 rgSCHGomHndlSCellActDeactReq
709 RgrSCellActDeactEvnt *sCellActDeactEvnt,
710 RgSchErrInfo *errInfo,
714 PRIVATE S16 rgSCHGomHndlSCellActDeactReq(instCb, spId, sCellActDeactEvnt, errInfo, action)
717 RgrSCellActDeactEvnt *sCellActDeactEvnt;
718 RgSchErrInfo *errInfo;
722 RgSchUeCb *ue = NULLP;
725 RgSchCellCb *cell = instCb->rgrSap[spId].cell;
726 Inst inst = (instCb->rgSchInit.inst);
728 TRC2(rgSCHGomHndlSCellActDeactReq);
729 RGSCHDBGPRM(inst,(rgSchPBuf(inst), "Processing RGR SCell Actication request:"
730 "%d\n", sCellActDeactEvnt->crnti));
732 errInfo->errType = RGSCHERR_GOM_SCELL_REQ;
735 if ((ue = rgSCHDbmGetUeCb(cell, sCellActDeactEvnt->crnti)) == NULLP)
737 RGSCHDBGERRNEW(inst, (rgSchPBuf(inst), "[%d]UE: does not exist\n",
738 sCellActDeactEvnt->crnti));
742 for(idx = 0; idx < sCellActDeactEvnt->numOfSCells; idx++)
744 sCellIdx = sCellActDeactEvnt->sCellActDeactInfo[idx].sCellIdx;
746 if (ROK != (rgSCHSCellTrigActDeact(cell, ue, sCellIdx, action)))
748 RGSCHDBGERR(inst,(rgSchPBuf(inst), "SCell Actication failed"
749 "for UE [%d] with SCellIdx [%d]\n",
750 sCellActDeactEvnt->crnti, idx));
756 RGSCHDBGINFO(inst,(rgSchPBuf(inst), "RGR Reconfiguration processed\n"));
758 } /* rgSCHGomHndlSCellActDeactReq */
762 * @brief Handler to handle re-configuration request from RRM to MAC.
766 * Function: rgSCHGomHndlRecfgReq
768 * This API handles processing for re-configuration request from RRM to MAC.
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.
776 * @param[in] RgSchCb *instCb
777 * @param[in] SpId spId
778 * @param[in] RgrRecfg *recfg
779 * @param[out] RgSchErrInfo *errInfo
785 PRIVATE S16 rgSCHGomHndlRecfgReq
790 RgSchErrInfo *errInfo
793 PRIVATE S16 rgSCHGomHndlRecfgReq(instCb, spId, recfg, errInfo)
797 RgSchErrInfo *errInfo;
800 RgSchUeCb *ue = NULLP;
801 RgSchDlLcCb *dlLc = NULLP; /* PURIFY_FIX:UMR */
803 RgSchCellCb *cell = instCb->rgrSap[spId].cell;
804 Inst inst = (instCb->rgSchInit.inst );
806 TRC2(rgSCHGomHndlRecfgReq);
808 errInfo->errType = RGSCHERR_GOM_RECFG_REQ;
810 /* Validate and process the re-configuration request */
811 switch (recfg->recfgType)
815 ret = rgSCHCfgVldtRgrCellRecfg(inst, &recfg->u.cellRecfg, &cell,
819 RLOG_ARG0(L_ERROR,DBG_CELLID,recfg->u.cellRecfg.cellId,"Rgr Cell Recfg Validation "
823 ret = rgSCHCfgRgrCellRecfg(cell, &recfg->u.cellRecfg, errInfo);
827 case RGR_SCELL_UE_CFG:
829 ret = rgSCHCfgVldtRgrUeRecfg(inst, &recfg->u.ueRecfg, &cell, &ue, errInfo);
832 RLOG_ARG1(L_ERROR,DBG_CELLID,recfg->u.ueRecfg.cellId,"Ue Recfg Validation FAILED"
833 "OLD CRNTI:%d",recfg->u.ueRecfg.oldCrnti);
836 ret = rgSCHCfgRgrUeRecfg(cell, ue, &recfg->u.ueRecfg, errInfo);
841 ret = rgSCHCfgVldtRgrLchRecfg(inst, &recfg->u.lchRecfg, &cell, &ue,
845 RLOG_ARG1(L_ERROR,DBG_CELLID,recfg->u.lchRecfg.cellId,"Lc Recfg Validation FAILED"
846 "LCID:%d",recfg->u.lchRecfg.lcId);
849 ret = rgSCHCfgRgrLchRecfg(cell, ue, dlLc, &recfg->u.lchRecfg, errInfo);
854 ret = rgSCHCfgVldtRgrLcgRecfg(inst, &recfg->u.lcgRecfg, cell, &ue,
858 RLOG_ARG1(L_ERROR,DBG_CELLID,recfg->u.lcgRecfg.cellId, "Lcg Recfg Validation FAILED"
859 "LCGID:%d",recfg->u.lcgRecfg.ulRecfg.lcgId);
862 ret = rgSCHCfgRgrLcgRecfg(cell, ue, &recfg->u.lcgRecfg, errInfo);
867 #if(ERRCLASS & ERRCLS_INT_PAR)
868 RLOG1(L_ERROR,"Should never come here: recfgType %d", recfg->recfgType);
875 } /* rgSCHGomHndlRecfgReq */
878 * @brief Handler to handle UE reset request from RRM to Scheduler.
882 * Function: rgSCHGomHndlResetReq
884 * This API handles processing for UE reset request from RRM to Scheduler.
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.
892 * @param[in] RgrRst *rstInfo
893 * @param[out] RgSchErrInfo *errInfo
899 PRIVATE S16 rgSCHGomHndlResetReq
904 RgSchErrInfo *errInfo
907 PRIVATE S16 rgSCHGomHndlResetReq(instCb, spId, reset, errInfo)
911 RgSchErrInfo *errInfo;
915 RgSchCellCb *cell= instCb->rgrSap[spId].cell;
916 Inst inst = (instCb->rgSchInit.inst );
917 RgSchUeCb *ue = NULLP;
919 TRC2(rgSCHGomHndlResetReq);
922 errInfo->errType = RGSCHERR_GOM_RESET_REQ;
924 /* Validate and process the UE reset request */
925 ret = rgSCHCfgVldtRgrUeReset(inst, reset, cell, &ue, errInfo);
928 RLOG_ARG1(L_ERROR,DBG_CELLID,reset->cellId,"Rgr UE Reset Validation FAILED"
929 "CRNTI:%d",reset->crnti);
933 ret = rgSCHCfgRgrUeReset(cell, ue, reset, errInfo);
936 RLOG_ARG1(L_ERROR,DBG_CELLID,reset->cellId,"Rgr UE Reset FAILED"
937 "CRNTI:%d",reset->crnti);
942 } /* rgSCHGomHndlResetReq */
946 * @brief Handler for processing Cell/Ue/Logical channel delete request
951 * Function: rgSCHGomHndlDelReq
953 * This API handles processing of delete request from RRM to MAC.
956 * - Fetch corresponding control block and pass it to CFG module.
957 * - If control block does not exist, FAIL.
959 * @param[in] RgSchCb *instCb
960 * @param[in] SpId spId
961 * @param[in] RgrDel *del
962 * @param[out] RgSchErrInfo *errInfo
968 PRIVATE S16 rgSCHGomHndlDelReq
973 RgSchErrInfo *errInfo
976 PRIVATE S16 rgSCHGomHndlDelReq(instCb, spId, del, errInfo)
980 RgSchErrInfo *errInfo;
986 Inst inst = (instCb->rgSchInit.inst);
988 VOLATILE U32 startTime=0;
990 TRC2(rgSCHGomHndlDelReq);
992 errInfo->errType = RGSCHERR_GOM_DEL_REQ;
994 if(instCb->rgrSap[spId].cell == NULLP)
996 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"Cell doesnt exist");
1000 /* Process the delete request */
1001 switch (del->delType)
1005 ret = rgSCHCfgRgrCellDel(instCb->rgrSap[spId].cell, del, errInfo);
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;
1012 instCb->rgrSap[spId].cell = NULLP;
1013 instCb->tfuSap[spId].cell = NULLP;
1018 case RGR_SCELL_UE_CFG:
1022 SStartTask(&startTime, PID_SCH_UE_DEL);
1024 ret = rgSCHCfgRgrUeDel(instCb->rgrSap[spId].cell, del, errInfo);
1027 SStopTask(startTime, PID_SCH_UE_DEL);
1033 ret = rgSCHCfgRgrLcDel(instCb->rgrSap[spId].cell, del, errInfo);
1038 ret = rgSCHCfgRgrLcgDel(instCb->rgrSap[spId].cell, del, errInfo);
1043 #if(ERRCLASS & ERRCLS_INT_PAR)
1044 RLOG1(L_ERROR,"Should never come here: delType %d", del->delType);
1051 } /* rgSCHGomHndlDelReq */
1056 /***********************************************************
1058 * Func : rgSCHGomGetCellIdFrmCfgReq
1062 * - Processing Steps:
1063 * - Retrieves the cell Id for a config request.
1065 * @param[in] RgrCfgReqInfo *rgrCfgReq
1066 * @param[out] CmLteCellId *cellId
1067 * Ret : ROK on fetching cellId
1068 * RFAILED on failure
1072 * File : rg_sch_gom.c
1074 **********************************************************/
1076 PRIVATE S16 rgSCHGomGetCellIdFrmCfgReq
1078 RgrCfgReqInfo *rgrCfgReq,
1082 PRIVATE S16 rgSCHGomGetCellIdFrmCfgReq(rgrCfgReq, cellId)
1083 RgrCfgReqInfo *rgrCfgReq;
1084 CmLteCellId *cellId;
1088 TRC2(rgSCHGomGetCellIdFrmCfgReq);
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)
1098 if (rgrCfgReq->u.recfgInfo.recfgType ==RGR_CELL_CFG)
1100 *cellId = rgrCfgReq->u.recfgInfo.u.cellRecfg.cellId;
1102 else if ((rgrCfgReq->u.recfgInfo.recfgType == RGR_SCELL_UE_CFG) ||
1103 (rgrCfgReq->u.recfgInfo.recfgType == RGR_UE_CFG))
1105 *cellId = rgrCfgReq->u.recfgInfo.u.ueRecfg.cellId;
1107 else if (rgrCfgReq->u.recfgInfo.recfgType == RGR_LCH_CFG)
1109 *cellId = rgrCfgReq->u.recfgInfo.u.lchRecfg.cellId;
1111 else if (rgrCfgReq->u.recfgInfo.recfgType == RGR_LCG_CFG)
1113 *cellId = rgrCfgReq->u.recfgInfo.u.lcgRecfg.cellId;
1125 } /* End of Switch */
1128 } /* rgSCHGomGetCellIdFrmCfgReq */
1132 * @brief Handler to handle SI configuration request from RRM to MAC.
1136 * Function: rgSCHGomHndlSiCfg
1138 * This API handles processing for SI configuration request from RRM to MAC.
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.
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
1157 PUBLIC S16 rgSCHGomHndlSiCfg
1163 RgrCfgTransId transId,
1164 RgrSiCfgReqInfo *cfgReqInfo
1167 PUBLIC S16 rgSCHGomHndlSiCfg(reg, pool, instCb, spId, transId, cfgReqInfo)
1172 RgrCfgTransId transId;
1173 RgrSiCfgReqInfo *cfgReqInfo;
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;
1186 TRC2(rgSCHGomHndlSiCfg);
1189 /* check if cell does not exists */
1190 if (((U8 *)cell == NULLP) || (cell->cellId != cfgReqInfo->cellId))
1192 RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Cell Control block does not exist"
1194 RGSCH_FREE_MSG(cfgReqInfo->pdu);
1195 SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
1197 rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
1201 /*Validate the received SI configuration */
1202 ret = rgSCHCfgVldtRgrSiCfg(inst, cfgReqInfo, cell, &errInfo);
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));
1210 rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
1213 /*ccpu00140789: Stopping SI scheduling*/
1214 if(RGR_SI_STOP == cfgReqInfo->cfgType)
1216 if((cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si != NULLP)&&
1217 (cell->siCb.siArray[cfgReqInfo->siId-1].si != NULLP))
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)
1224 RGSCH_FREE_MSG(cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si);
1225 cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si = NULLP;
1227 SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
1229 cfmStatus = RGR_CFG_CFM_OK;
1230 rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
1235 SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
1237 rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
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
1248 if ( RGR_SI_CFG_TYPE_MIB != cfgReqInfo->cfgType )
1250 SFndLenMsg(cfgReqInfo->pdu, &msgLen);
1252 /* check if the application pdu matches a tb size */
1253 tbSz = rgSCHUtlGetAllwdCchTbSz(msgLen*8, &nPrb, &mcs);
1255 if ( tbSz != (msgLen*8) )
1257 MsgLen nmPadBytes = 0;
1258 Data* padding = NULLP;
1260 /* need to add padding bytes */
1261 nmPadBytes = (tbSz - (msgLen*8))/8;
1263 if ( SGetSBuf(reg,pool,&padding,nmPadBytes) != ROK)
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));
1269 rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId,
1274 cmMemset((U8*)padding,(U8)0,nmPadBytes);
1276 #ifdef MS_MBUF_CORRUPTION
1277 MS_BUF_ADD_ALLOC_CALLER();
1279 if ( SAddPstMsgMult((Data*)padding,nmPadBytes,cfgReqInfo->pdu) != ROK)
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));
1285 SPutSBuf(reg, pool, (Data* )padding,(Size)nmPadBytes);
1287 rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId,
1291 SPutSBuf(reg, pool, (Data* )padding,(Size)nmPadBytes);
1293 }/* if (tbSz != ...*/
1294 }/* if (RGR_SI_CFG_TYPE_SI...*/
1296 /*Set the received pdu at the appropriate place */
1297 switch(cfgReqInfo->cfgType)
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,
1306 case RGR_SI_CFG_TYPE_SIB1_PWS:
1308 SFndLenMsg(cfgReqInfo->pdu, &pduLen);
1309 ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen,0);
1312 RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Failed to get MCS and NPRB"
1314 RGSCH_FREE_MSG(cfgReqInfo->pdu);
1315 SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
1317 rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId,
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);
1329 case RGR_SI_CFG_TYPE_SIB1:
1330 SFndLenMsg(cfgReqInfo->pdu, &pduLen);
1331 ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen,0);
1334 RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Failed to get MCS and NPRB"
1336 RGSCH_FREE_MSG(cfgReqInfo->pdu);
1337 SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
1339 rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId,
1343 RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.sib1Info.sib1,
1344 cell->siCb.newSiInfo.sib1Info.sib1,
1345 cfgReqInfo->pdu, cell->siCb.siBitMask,
1349 case RGR_SI_CFG_TYPE_SI: /* SI CFG TYPE SI */
1350 SFndLenMsg(cfgReqInfo->pdu, &pduLen);
1351 ret = rgSCHUtlCalMcsAndNPrb(cell, cfgReqInfo->cfgType, pduLen,
1355 RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Failed to get MCS and NPRB"
1357 RGSCH_FREE_MSG(cfgReqInfo->pdu);
1358 SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
1360 rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId,
1364 /* Si recfg, where numSi changes */
1365 if (cell->siCb.siBitMask & RGSCH_SI_SICFG_UPD)
1367 Buffer **newSiPdu = &cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si;
1368 if(*newSiPdu != NULLP)
1370 RGSCH_FREE_MSG(*newSiPdu);
1372 *newSiPdu = (Buffer *)cfgReqInfo->pdu;
1373 cell->siCb.siBitMask |= RGSCH_SI_SI_UPD;
1375 else /* Initial Si cfg or si recfg where numSi did not change */
1378 /* Initial Si cfg */
1379 if (cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si == NULLP)
1381 cell->siCb.siArray[cfgReqInfo->siId-1].si = cfgReqInfo->pdu;
1382 cell->siCb.siArray[cfgReqInfo->siId-1].isWarningSi = FALSE;
1383 bitMask = RGSCH_SI_DFLT;
1387 bitMask = RGSCH_SI_SI_UPD;
1390 RGSCHCHKNUPDSIPDU(cell->siCb.crntSiInfo.siInfo[cfgReqInfo->siId-1].si,
1391 cell->siCb.newSiInfo.siInfo[cfgReqInfo->siId-1].si,
1393 cell->siCb.siBitMask, bitMask);
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,
1403 RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Failed to get MCS and NPRB"
1405 RGSCH_FREE_MSG(cfgReqInfo->pdu);
1406 SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
1408 rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId,
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,
1416 cell->siCb.siArray[cfgReqInfo->siId-1].isWarningSi = FALSE;
1419 RLOG_ARG0(L_ERROR,DBG_CELLID,cfgReqInfo->cellId,"Invalid cfgType "
1421 RGSCH_FREE_MSG(cfgReqInfo->pdu);
1422 SPutSBuf(reg, pool, (Data *)cfgReqInfo,
1423 (Size)sizeof(*cfgReqInfo));
1425 rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId,
1430 SPutSBuf(reg, pool, (Data *)cfgReqInfo, (Size)sizeof(*cfgReqInfo));
1432 cfmStatus = RGR_CFG_CFM_OK;
1433 rgSCHUtlRgrSiCfgCfm(instCb->rgSchInit.inst, spId, transId, cfmStatus);
1437 } /* rgSCHGomHndlSiCfg */
1441 * @brief Handler to handle Warning SI configuration request from RRM to MAC.
1445 * Function: rgSCHGomHndlWarningSiCfg
1447 * This API handles processing for Warning SI configuration request from
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
1461 PUBLIC S16 rgSCHGomHndlWarningSiCfg
1467 RgrCfgTransId transId,
1468 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
1471 PUBLIC S16 rgSCHGomHndlWarningSiCfg(reg, pool, instCb, spId, transId,
1472 warningSiCfgReqInfo)
1477 RgrCfgTransId transId;
1478 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo;
1481 RgSchCellCb *cell = instCb->rgrSap[spId].cell;
1482 U8 cfmStatus = RGR_CFG_CFM_NOK;
1484 U8 siId = warningSiCfgReqInfo->siId;
1485 U8 j, mcs=0, nPrb=0;
1486 RgSchWarningSiSeg *warningSiMsg;
1487 RgSchWarningSiPdu *pduNode;
1490 Bool freeNodeFound = FALSE;
1494 U8 isEmtc = warningSiCfgReqInfo->emtcEnable;
1497 TRC2(rgSCHGomHndlWarningSiCfg);
1502 rgSchEmtcGetSiWinPerd(cell, &siWinSize, &minPeriod);
1507 siWinSize = cell->siCfg.siWinSize;
1508 minPeriod = cell->siCfg.minPeriodicity;
1510 /* check if cell does not exists */
1511 if (((U8 *)cell == NULLP) ||
1512 (cell->cellId != warningSiCfgReqInfo->cellId) ||
1513 (warningSiCfgReqInfo->siId >
1514 ((minPeriod * 10)/siWinSize)))
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,
1527 /* Search for free index in WarningSi */
1528 for(idx = 0; idx < RGR_MAX_NUM_WARNING_SI; idx++)
1530 if((cell->siCb.warningSi[idx].siId == 0 ||
1531 cell->siCb.warningSi[idx].siId == warningSiCfgReqInfo->siId))
1533 warningSiMsg = (RgSchWarningSiSeg *)&cell->siCb.warningSi[idx].warningSiMsg;
1535 /* Search for free SI node */
1536 /* ccpu00136659: CMAS ETWS design changes */
1537 if (warningSiMsg->segLstCp.first == NULLP) /* Free SI Node */
1539 warningSiMsg->transId = transId;
1540 pduNode = (RgSchWarningSiPdu *)&cell->siCb.warningSi[idx].
1541 warningSiMsg.pduNode;
1542 CM_LLIST_FIRST_NODE(&warningSiCfgReqInfo->siPduLst, node);
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
1550 while((node != NULLP) && (j < RGR_MAX_WARNING_SI_SEG))
1553 pduNode[j].pdu = (Buffer *)node->node;
1554 if(pduNode[j].pdu != NULLP)
1556 SFndLenMsg(pduNode[j].pdu, &msgLen);
1557 /*Get the nPrb and mcs parametr values */
1559 if (rgSCHEmtcUtlGetAllwdCchTbSzForSI(msgLen*8) != (msgLen*8))
1561 if (rgSCHUtlGetAllwdCchTbSz(msgLen*8, &nPrb, &mcs) != (msgLen*8))
1565 RGSCHLOGERROR(cell->instIdx,ERRCLS_INT_PAR,ERG011,
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);
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];
1592 /* ccpu00132385- nodes in received SI config linked list should
1593 * be freed after processing the config.*/
1594 while(warningSiCfgReqInfo->siPduLst.first != NULLP)
1596 node = warningSiCfgReqInfo->siPduLst.first;
1597 cmLListDelFrm(&(warningSiCfgReqInfo->siPduLst), node);
1598 SPutSBuf(reg, pool, (Data *)node,sizeof(CmLList));
1602 cell->siCb.warningSi[idx].siId = warningSiCfgReqInfo->siId;
1603 cell->siCb.warningSi[idx].idx = idx;
1607 rgSCHEmtcWarningSiCfg(cell,warningSiCfgReqInfo,idx);
1612 cell->siCb.siArray[warningSiCfgReqInfo->siId-1].si =
1613 &cell->siCb.warningSi[idx];
1614 cell->siCb.siArray[warningSiCfgReqInfo->siId-1].isWarningSi =
1617 freeNodeFound = TRUE;
1623 if (freeNodeFound == FALSE)
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,
1635 SPutSBuf(reg, pool, (Data *)warningSiCfgReqInfo,
1636 sizeof(RgrWarningSiCfgReqInfo));
1637 warningSiCfgReqInfo = NULLP;
1643 * @brief Handler to handle SI Stop request from RRM to MAC.
1647 * Function: rgSCHGomHndlWarningSiStopReq
1649 * This API handles processing for SI stop request from RRM to MAC.
1651 * @param[in] Region reg
1652 * @param[in] Pool pool
1653 * @param[in] RgSchCb *instCb
1654 * @param[in] SpId siId
1658 PUBLIC Void rgSCHGomHndlWarningSiStopReq
1664 RgrCfgTransId transId,
1668 PUBLIC Void rgSCHGomHndlWarningSiStopReq(reg, pool, instCb, siId, transId, spId)
1673 RgrCfgTransId transId;
1677 RgSchCellCb *cell = instCb->rgrSap[spId].cell;
1680 RgSchWarningSiPdu *warningSiPdu;
1683 TRC3(rgSCHGomHndlWarningSiStopReq)
1685 for(idx = 0; idx < RGR_MAX_NUM_WARNING_SI; idx++)
1687 if(cell->siCb.warningSi[idx].siId == siId)
1689 if ((cmMemcmp ((U8 *)&cell->siCb.warningSi[idx].warningSiMsg.transId,
1690 (U8 *)&transId, sizeof(RgrCfgTransId))) == 0)
1692 /* ccpu00136659: CMAS ETWS design changes */
1693 CM_LLIST_FIRST_NODE(&cell->siCb.warningSi[idx].warningSiMsg.segLstCp, node);
1694 while(node != NULLP)
1696 /* On receiving the warning stop message, remove one by one
1697 * each PDU from the warning SI list
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);
1713 #endif/*RGR_SI_SCH */
1715 /* LTE_ADV_FLAG_REMOVED_START */
1718 * @brief This function sets the Phigh range for CC users corresponding to the CC Pool
1721 * Function: rgSchUpdtRNTPInfo
1723 * Invoked by: rgSCHGomHndlLoadInf
1725 * @param[in] RgSchCellCb* cell
1726 * @param[in] RgSubFrm* subFrm
1727 * @param[in] RgrLoadInfReqInfo *loadInfReq
1732 PUBLIC S16 rgSchUpdtRNTPInfo
1736 RgrLoadInfReqInfo *loadInfReq
1739 PRIVATE Void rgSchUpdtRNTPInfo(cell, sf)
1742 RgrLoadInfReqInfo *loadInfReq;
1746 /* Initialise the variables */
1747 RgSchSFRPoolInfo *sfrCCPool;
1752 TRC2(rgSchUpdtRNTPInfo);
1754 l = &sf->sfrTotalPoolInfo.ccPool;
1756 /*Get the first node from the CC Pool*/
1757 n = cmLListFirst(l);
1760 sfrCCPool = (RgSchSFRPoolInfo*)n->node;
1761 if (sfrCCPool->poolendRB == loadInfReq->rgrCcPHighEndRb)
1763 sfrCCPool->pwrHiCCRange.endRb = loadInfReq->rgrCcPHighEndRb;
1764 sfrCCPool->pwrHiCCRange.startRb = loadInfReq->rgrCcPHighStartRb;
1775 * @brief Handler to handle LOAD INF request from RRM to MAC.
1779 * Function: rgSCHGomHndlLoadInf
1781 * This API handles processing for LOAD INF request from RRM to MAC.
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.
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
1799 PUBLIC S16 rgSCHGomHndlLoadInf
1805 RgrCfgTransId transId,
1806 RgrLoadInfReqInfo *loadInfReq
1809 PUBLIC S16 rgSCHGomHndlLoadInf(reg, pool, instCb, spId, transId, loadInfReq)
1814 RgrCfgTransId transId;
1815 RgrLoadInfReqInfo *loadInfReq;
1819 RgSchCellCb *cell = instCb->rgrSap[spId].cell;
1820 Inst inst = (instCb->rgSchInit.inst );
1821 RgSchErrInfo errInfo;
1824 TRC2(rgSCHGomHndlLoadInf);
1827 /* check if cell does not exists */
1828 if (((U8 *)cell == NULLP) || (cell->cellId != loadInfReq->cellId))
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));
1836 if (cell->lteAdvCb.dsfrCfg.status == RGR_DISABLE)
1838 RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "rgSCHGomHndlLoadInf(): DSFR Feature not enabled");
1839 SPutSBuf(reg, pool, (Data *)loadInfReq, (Size)sizeof(*loadInfReq));
1842 /* Validate the received LOAD INF Configuration */
1843 ret = rgSCHCfgVldtRgrLoadInf(inst, loadInfReq, cell, &errInfo);
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));
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++)
1855 if((rgSchUpdtRNTPInfo(cell, cell->subFrms[i], loadInfReq) != ROK))
1861 SPutSBuf(reg, pool, (Data *)loadInfReq, (Size)sizeof(*loadInfReq));
1865 } /* rgSCHGomHndlLoadInf */
1866 /* LTE_ADV_FLAG_REMOVED_END */
1868 /**********************************************************************
1871 **********************************************************************/