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 **********************************************************************/
32 @brief This file implements the schedulers main access to MAC layer code.
35 static const char* RLOG_MODULE_NAME="MAC";
36 static int RLOG_FILE_ID=185;
37 static int RLOG_MODULE_ID=4096;
39 /* header include files -- defines (.h) */
40 #include "common_def.h"
46 #include "rg_sch_inf.h"
48 #include "rg_sch_err.h"
49 #include "rg_sch_cmn.h"
50 #include "rl_interface.h"
51 #include "rl_common.h"
53 /* header/extern include files (.x) */
54 #include "tfu.x" /* TFU types */
55 #include "lrg.x" /* layer management typedefs for MAC */
56 #include "rgr.x" /* layer management typedefs for MAC */
57 #include "rgm.x" /* layer management typedefs for MAC */
58 #include "rg_sch_inf.x" /* typedefs for Scheduler */
59 #include "rg_sch.x" /* typedefs for Scheduler */
60 #include "rg_sch_cmn.x"
63 S16 rgEmtcMacSchUeDelInd ARGS((RgSchCellCb *cell,RgInfUeDelInd *ueDelInd));
64 S16 rgSCHGomEmtcHndlSiCfg ARGS((
69 RgrCfgTransId transId,
70 RgrSiCfgReqInfo *cfgReqInfo
72 S16 rgSCHGomEmtcHndlWarningSiCfg ARGS((
77 RgrCfgTransId transId,
78 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
82 /************** LRG Interface ****************/
85 * @brief Layer Manager Control request handler.
89 * Function : RgMiLrgSchCntrlReq
91 * This function handles the control
92 * request received from the Layer Manager.
93 * -# Based on cntrl->hdr.elmId.elmnt, cntrl->t.cntrl.action
94 * and cntrl->t.cntrl.subAction, it performs the appropriate control action
95 * of SAP (enable/disable) and layer shutdown.
96 * -# Invokes the RgMiLrgSchCntrlCfm to send back the confirmation to LM.
98 * @param[in] Pst *pst, the post structure
99 * @param[in] RgMngmt *cntrl, the control parameter's structure
103 S16 RgMiLrgSchCntrlReq
105 Pst *pst, /* post structure */
106 RgMngmt *cntrl /* control structure */
109 S16 ret = ROK; /* return value */
113 Inst inst = (pst->dstInst - SCH_INST_START); /* Scheduler instance Id */
115 /* Fill the post structure for sending the confirmation */
116 SchFillCfmPst(pst, &cfmPst, cntrl);
118 /* Initialize the cfg cfm structure
119 if (SGetSBuf(cfmPst.region, cfmPst.pool, (Data **)&cfm, sizeof(RgMngmt))
122 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Memory Unavailable for Confirmation");
123 SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt));
126 memset(&cfm, 0, sizeof(RgMngmt));
133 cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
134 cfm.t.cntrl.action = cntrl->t.cntrl.action;
135 cfm.t.cntrl.subAction = cntrl->t.cntrl.subAction;
137 /* Check if General Config Done*/
138 if(rgSchCb[inst].rgSchInit.cfgDone != TRUE)
140 cfm.cfm.status = LCM_PRIM_NOK;
141 cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
142 cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
143 RgMiLrgSchCntrlCfm(&cfmPst, &cfm);
144 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Gen Cfg not done.");
145 /* SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); */
149 /* General Config done, process the Control request */
150 switch(cntrl->hdr.elmId.elmnt)
153 rgSCHLmmGenCntrl(cntrl, &cfm, &cfmPst);
157 rgSCHLmmSapCntrl(cntrl, &cfm, &cfmPst);
160 cfm.cfm.status = LCM_PRIM_NOK;
161 cfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL;
162 RgMiLrgSchCntrlCfm(&cfmPst, &cfm);
163 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "invalid elmnt=%d",
164 cntrl->hdr.elmId.elmnt);
167 /* SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); */
169 }/*-- RgMiLrgSchCntrlReq --*/
173 * @brief Layer Manager L2 Measurement request handler.
177 * Function : RgMiLrgSchL2MeasReq
179 * This function handles the control
180 * measurement request received from the Layer Manager.
182 * @param[in] Pst *pst, the post structure
183 * @param[in] LrgSchMeasReqInfo *measInfo, measurement request info
187 S16 RgMiLrgSchL2MeasReq
189 Pst *pst, /* post structure */
190 LrgSchMeasReqInfo *measInfo /* Meas Req Info */
197 RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
198 #if (ERRCLASS & ERRCLS_ADD_RES)
202 RgSchL2MeasCb *measCb = NULLP;
204 Inst inst = (pst->dstInst - SCH_INST_START); /* Scheduler instance Id */
211 /* Find the cellCb using cellId in measInfo. Iterate through all cells
212 * in rgrsapCb in RgschCb */
214 for (idx = 0; idx < instCb->numSaps; idx++)
216 if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
218 /* got the cell break the loop */
219 cell = instCb->rgrSap[idx].cell;
223 /* If no cellCb return Err with Invalid Cell Id */
226 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
227 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_CELLID);
228 rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE);
229 RLOG_ARG2(L_ERROR,DBG_INSTID,inst,
230 "Meas req Failed.Invalid Cell Id errType(%d) errCause(%d)",
231 err.errType, err.errCause);
234 /* Validate for Meas Types */
235 if ( (ret = rgSCHUtlValidateMeasReq(cell, measInfo, &err)) != ROK)
237 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
238 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_MEASTYPE);
239 rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE);
240 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
241 "Meas req Failed.Invalid Measurement Type"
242 "errCasue(%d) errType(%d)", err.errType, err.errCause);
245 /* Iterate through all meas requests in l2mList in cellCb */
246 #if (ERRCLASS & ERRCLS_ADD_RES)
247 lnk = cell->l2mList.first;
250 /* Get the MeasCb : RgSchL2MeasCb */
251 measCb = (RgSchL2MeasCb *)lnk->node;
253 if (measCb->measReq.hdr.transId == measInfo->hdr.transId)
255 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
256 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_DUP_TRANSID);
257 rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE);
258 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
259 "Meas req Failed.Dublicate TransId"
260 "errType(%d) errCause(%d)", err.errType, err.errCause);
265 /* Call L2M Function to store Meas req */
266 ret = rgSchL2mMeasReq(cell, measInfo, err);
269 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
270 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_L2MEAS_FAILED);
271 rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE);
272 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
273 "Meas req Failed.errType(%d) errCause(%d)",
274 err.errType, err.errCause);
278 } /* -- RRgMiLrgSchL2MeasReq-- */
281 * @brief Layer Manager L2 Measurement Stop request handler.
285 * Function : RgMiLrgSchL2MeasStopReq
287 * This function handles the control
288 * measurement stop request received from the Layer Manager.
290 * @param[in] Pst *pst, the post structure
291 * @param[in] LrgSchMeasReqInfo *measInfo, measurement stop request info
295 S16 RgMiLrgSchL2MeasStopReq
297 Pst *pst, /* post structure */
298 LrgSchMeasStopReqInfo *measInfo /* Meas Req Info */
302 RgSchCellCb *cell = NULLP;
303 RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
304 CmLList *node = NULLP;
305 RgSchL2MeasCb *measCb = NULLP;
306 LrgSchMeasCfmInfo measCfm;
309 for (idx = 0; idx < instCb->numSaps; idx++)
311 if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
313 /* got the cell break the loop */
314 cell = instCb->rgrSap[idx].cell;
320 RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId,
321 "Stop req Failed.Invalid Cell Id ");
324 memset(&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
325 node = cell->l2mList.first;
328 measCb = (RgSchL2MeasCb *)(node)->node;
331 cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
332 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,
333 sizeof(RgSchL2MeasCb));
336 if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
338 RgInfL2MeasStopReq measStopReq;
340 memset(&measStopReq, 0, sizeof(RgInfL2MeasStopReq));
341 measStopReq.transId = measInfo->hdr.transId;
342 measStopReq.measType = measInfo->measType;
343 /* measReq.timePrd = measInfo->timePrd; */
344 measStopReq.cellId = measInfo->cellId;
345 rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst);
346 RgSchMacL2MeasStop(&pstMac,&measStopReq);
350 RgMiLrgSchL2MeasStopCfm(&(rgSchCb[cell->instIdx].rgSchInit.lmPst),
354 }/*RgMiLrgSchL2MeasStopReq*/
356 * @brief Layer Manager L2 Measurement request handler.
357 * for Send l2 measurement req
360 * Function : RgMiLrgSchL2MeasSendReq
362 * This function handles the control
363 * measurement send request received from the Layer Manager.
365 * @param[in] Pst *pst, the post structure
366 * @param[in] LrgSchMeasReqInfo *measInfo, measurement stop request info
370 S16 RgMiLrgSchL2MeasSendReq
372 Pst *pst, /* post structure */
373 LrgSchMeasSndReqInfo *measInfo /* Meas Req Info */
378 RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
382 for (idx = 0; idx < instCb->numSaps; idx++)
384 if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
386 /* got the cell break the loop */
387 cell = instCb->rgrSap[idx].cell;
393 RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId,
394 "Send req Failed.Invalid Cell Id");
398 if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
400 RgInfL2MeasSndReq measSndReq;
402 memset(&measSndReq, 0, sizeof(RgInfL2MeasSndReq));
403 measSndReq.transId = measInfo->hdr.transId;
404 measSndReq.measType = measInfo->measType;
405 measSndReq.timePrd = measInfo->timePrd;
406 measSndReq.cellId = measInfo->cellId;
407 rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst);
408 RgSchMacL2MeasSend(&pstMac, &measSndReq);
412 cell->sndL2Meas = TRUE;
416 }/*RgMiLrgSchL2MeasSendReq*/
417 #endif /* LTE_L2_MEAS */
422 /************* RGR Interface ****************/
424 * @brief API for bind request from RRM towards MAC.
428 * Function: RgUiRgrBndReq
430 * This API is invoked by RRM towards MAC to bind RGR SAP.
431 * These API validates the Pst, spId, suId and sends the bind confirm to
435 * @param[in] Pst *pst
436 * @param[in] SuId suId
437 * @param[in] SpId spId
442 S16 RgUiRgrBndReq(Pst *pst, SuId suId, SpId spId)
445 Pst tmpPst; /* Temporary Post Structure */
446 Inst instId = pst->dstInst-SCH_INST_START;
447 RgUstaDgn dgn; /* Alarm diagnostics structure */
449 tmpPst.prior = pst->prior;
450 tmpPst.route = pst->route;
451 tmpPst.selector = pst->selector;
452 tmpPst.region = rgSchCb[instId].rgSchInit.region;
453 tmpPst.pool = rgSchCb[instId].rgSchInit.pool;
454 tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId;
455 tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent;
456 tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + SCH_INST_START;
457 tmpPst.event = EVTNONE;
458 tmpPst.dstProcId = pst->srcProcId;
459 tmpPst.dstEnt = pst->srcEnt;
460 tmpPst.dstInst = pst->srcInst;
462 if(spId < rgSchCb[instId].numSaps)
464 /* Check the state of the SAP */
465 switch (rgSchCb[instId].rgrSap[spId].sapSta.sapState)
467 /* This case might not be needed if SAP not configured then it will go
468 * to else of above if condition */
469 case LRG_UNBND: /* SAP is not bound */
470 RLOG0(L_DEBUG,"SAP Not yet bound");
471 rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_BND;
472 rgSchCb[instId].rgrSap[spId].sapCfg.suId = suId;
473 /* Send Bind Confirm with status as SUCCESS */
474 ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK);
475 /*Indicate to Layer manager */
476 rgSCHUtlFillDgnParams(instId, &dgn, LRG_USTA_DGNVAL_MEM);
477 ret = rgSCHLmmStaInd(instId, LCM_CATEGORY_INTERFACE,
478 LRG_EVENT_RGRSAP_ENB, LCM_CAUSE_UNKNOWN, &dgn);
480 case LRG_BND: /* SAP is already bound*/
481 RLOG0(L_DEBUG,"SAP is already bound");
482 ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK);
484 default: /* Should Never Enter here */
485 #if (ERRCLASS & ERRCLS_ADD_RES)
486 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001,
487 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
488 "Invalid SAP State:RgUiRrgBndReq failed\n");
490 ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_NOK);
496 #if (ERRCLASS & ERRCLS_ADD_RES)
497 /* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state
498 to spId to avoid seg fault due to invalid sapID */
499 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002,
500 (ErrVal)spId, "Invalid SAP Id:RgUiRrgBndReq failed\n");
502 ret = RgUiRgrBndCfm(&tmpPst, suId, CM_BND_NOK);
505 } /* RgUiRgrBndReq */
508 * @brief API for unbind request from RRM towards MAC.
512 * Function: RgUiRgrUbndReq
514 * This API is invoked by RRM towards MAC to unbind RGR SAP.
515 * These API validates the Pst, spId, suId and transfers the unbind request
516 * specific information to corresponding ownership module (GOM) API.
519 * @param[in] Pst *pst
520 * @param[in] SuId suId
521 * @param[in] Reason reason
526 S16 RgUiRgrUbndReq(Pst *pst,SpId spId,Reason reason)
528 Inst instId = pst->dstInst-SCH_INST_START;
530 /* SAP Id validation */
531 if (spId < rgSchCb[instId].numSaps)
533 switch(rgSchCb[instId].rgrSap[spId].sapSta.sapState)
535 case LRG_BND: /* SAP is already bound*/
536 RLOG0(L_DEBUG,"SAP is already bound");
537 /* setting SAP state to UN BOUND */
538 rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_UNBND;
541 #if (ERRCLASS & ERRCLS_ADD_RES)
542 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003,
543 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
544 "Invalid SAP State: RgUiRgrUbndReq failed\n");
551 #if (ERRCLASS & ERRCLS_ADD_RES)
552 RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004,
553 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
554 "Invalid SAP Id:RgUiRgrUbndReq failed\n");
559 } /* RgUiRgrUbndReq */
563 * @brief API for SI configuration request from RRM towards MAC.
567 * Function: RgUiRgrSiCfgReq
569 * This API is invoked by RRM towards MAC to configure SI at MAC.
570 * These API validates the Pst, spId, suId and transfers the
571 * config request specific information to corresponding ownership
575 * @param[in] Pst *pst
576 * @param[in] SpId spId
577 * @param[in] RgrCfgTransId transId
578 * @param[in] RgrSiCfgReqInfo *cfgReqInfo
583 S16 RgUiRgrSiCfgReq(Pst *pst, SpId spId,RgrCfgTransId transId,RgrSiCfgReqInfo *cfgReqInfo)
586 uint8_t cfmStatus = RGR_CFG_CFM_NOK;
587 uint8_t prntTrans[RGR_CFG_TRANSID_SIZE+1];
588 Inst instId = pst->dstInst-SCH_INST_START;
590 memcpy(prntTrans, transId.trans, RGR_CFG_TRANSID_SIZE);
591 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
594 if (cfgReqInfo == NULLP)
596 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
598 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
602 if (spId < rgSchCb[instId].numSaps)
604 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
606 #if (ERRCLASS & ERRCLS_ADD_RES)
607 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007,
608 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
609 "Invalid SAP State: RgUiRgrSiCfgReq failed\n");
611 SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
612 (Size)sizeof(*cfgReqInfo));
613 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
619 #if (ERRCLASS & ERRCLS_ADD_RES)
620 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008,
621 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
622 "Invalid SAP Id:RgUiRgrSiCfgReq failed\n");
624 SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
625 (Size)sizeof(*cfgReqInfo));
626 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
630 /* Handle configuration */
632 if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable)
634 ret = rgSCHGomEmtcHndlSiCfg(pst->region, pst->pool,
635 &rgSchCb[instId], spId, transId,
640 ret = rgSCHGomHndlSiCfg(pst->region, pst->pool,
641 &rgSchCb[instId], spId, transId,
645 ret = rgSCHGomHndlSiCfg(pst->region, pst->pool,
646 &rgSchCb[instId], spId, transId,
651 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"RgUiRgrSiCfgReq:"
652 "Configuration Request Handling Failed");
657 } /* RgUiRgrSiCfgReq */
661 * @brief API for Warning SI configuration request from RRM towards MAC.
665 * Function: RgUiRgrWarningSiCfgReq
667 * This API is invoked by RRM towards MAC to configure SI at MAC.
668 * These API validates the Pst, spId, suId and transfers the
669 * config request specific information to corresponding ownership
673 * @param[in] Pst *pst
674 * @param[in] SpId spId
675 * @param[in] RgrCfgTransId transId
676 * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
681 S16 RgUiRgrWarningSiCfgReq(Pst *pst, SpId spId,RgrCfgTransId transId,RgrWarningSiCfgReqInfo *warningSiCfgReqInfo)
683 Inst instId = pst->dstInst-SCH_INST_START;
685 uint8_t cfmStatus = RGR_CFG_CFM_NOK;
686 uint8_t prntTrans[RGR_CFG_TRANSID_SIZE+1];
688 memcpy(prntTrans, transId.trans, RGR_CFG_TRANSID_SIZE);
689 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
691 if (warningSiCfgReqInfo == NULLP)
693 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
695 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, 0, transId, cfmStatus);
699 if (spId < rgSchCb[instId].numSaps)
701 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
703 #if (ERRCLASS & ERRCLS_ADD_RES)
704 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG023,
705 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
706 "Invalid SAP State: warningSiCfgReqInfo failed\n");
708 rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool,
709 &warningSiCfgReqInfo->siPduLst);
710 SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
711 sizeof(RgrWarningSiCfgReqInfo));
712 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId,
719 #if (ERRCLASS & ERRCLS_ADD_RES)
720 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG024,
721 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
722 "Invalid SAP Id:warningSiCfgReqInfo failed\n");
724 rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool,
725 &warningSiCfgReqInfo->siPduLst);
726 SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
727 sizeof(RgrWarningSiCfgReqInfo));
728 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId,
733 /* Handle configuration */
735 if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable)
737 ret = rgSCHGomEmtcHndlWarningSiCfg(pst->region, pst->pool,
738 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
742 ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool,
743 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
746 ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool,
747 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
751 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,
752 "Configuration Request Handling Failed");
761 * @brief API for Warning SI Stop request from RRM towards MAC.
765 * Function: RgUiRgrWarningSiStopReq
767 * This API is invoked by RRM towards MAC to Stop warning SI at MAC.
768 * These API validates the Pst, spId, suId and transfers the
769 * stop request specific information to corresponding ownership
773 * @param[in] Pst *pst
774 * @param[in] SpId spId
775 * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
780 S16 RgUiRgrWarningSiStopReq(Pst *pst,SpId spId,RgrCfgTransId transId,uint8_t siId)
782 Inst instId = pst->dstInst-SCH_INST_START;
784 if (spId < rgSchCb[instId].numSaps)
786 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
788 #if (ERRCLASS & ERRCLS_ADD_RES)
789 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG025,
790 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
791 "Invalid SAP State: RgUiRgrWarningSiStopReq failed\n");
798 #if (ERRCLASS & ERRCLS_ADD_RES)
799 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG026,
800 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
801 "Invalid SAP Id:RgUiRgrWarningSiStopReq failed\n");
806 rgSCHGomHndlWarningSiStopReq(pst->region, pst->pool,
807 &rgSchCb[instId], siId, transId, spId);
811 #endif /*RGR_SI_SCH */
813 /* LTE_ADV_FLAG_REMOVED_START */
816 * @brief API for LOAD INF request from RRM towards MAC.
820 * Function: RgUiRgrLoadInfReq
822 * This API is invoked by RRM towards MAC to configure LOAD INF Parameters at MAC.
823 * These API validates the Pst, spId, suId and transfers the
824 * LOAD INF request to corresponding ownership
828 * @param[in] Pst *pst
829 * @param[in] SpId spId
830 * @param[in] RgrCfgTransId transId
831 * @param[in] RgrLoadInfReqInfo *loadInfReq
836 S16 RgUiRgrLoadInfReq(Pst *pst, SpId spId, RgrCfgTransId transId,RgrLoadInfReqInfo *loadInfReq)
839 uint8_t prntTrans[RGR_CFG_TRANSID_SIZE+1];
840 Inst instId = pst->dstInst-SCH_INST_START;
842 memcpy(prntTrans, transId.trans, RGR_CFG_TRANSID_SIZE);
843 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
846 if (loadInfReq == NULLP)
848 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
853 if (spId < rgSchCb[instId].numSaps)
855 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
857 #if (ERRCLASS & ERRCLS_ADD_RES)
858 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007,
859 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
860 "Invalid SAP State: RgUiRgrLoadInfReq failed\n");
862 SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq,
863 (Size)sizeof(*loadInfReq));
869 #if (ERRCLASS & ERRCLS_ADD_RES)
870 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008,
871 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
872 "Invalid SAP Id:RgUiRgrLoadInfReq failed\n");
874 SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq,
875 (Size)sizeof(*loadInfReq));
879 /* Handle configuration */
880 ret = rgSCHGomHndlLoadInf(pst->region, pst->pool,
881 &rgSchCb[(pst->dstInst - SCH_INST_START)], spId, transId,
885 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,
886 "Configuration Request Handling Failed");
891 } /* RgUiRgrLoadInfReq */
892 /* LTE_ADV_FLAG_REMOVED_END */
894 /************** MAC SCH Interface **************/
896 * @brief Function for updating dedicated channel BO at scheduler from MAC.
900 * Function : rgMacSchDedBoUpdtReq
902 * This function shall be invoked whenever MAC gets staRsp from RLC
903 * Scheduler shall update BO in its dedicated logical channel control block.
905 * @param[in] Pst* pst
906 * @param[in] S16 cellSapId
907 * @param[in] RgInfDedBoRpt *boRpt
911 S16 RgMacSchDedBoUpdtReq(Pst* pst,RgInfDedBoRpt *boRpt)
919 Inst inst = (pst->dstInst - SCH_INST_START);
920 S16 cellSapId = boRpt->cellSapId;
922 RLOG_ARG2(L_DEBUG,DBG_CELLID,boRpt->cellId,"rgMacSchDedBoUpdtReq():"
923 " boRpt->rnti = %u boRpt->lcId = %u",boRpt->rnti, boRpt->lcId);
925 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
927 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
930 if (cell->cellId != boRpt->cellId)
932 /* Handle Cell fetch failure */
933 RGSCHLOGERROR(inst, ERRCLS_INT_PAR,ERG009,(ErrVal)boRpt->cellId,
934 "rgMacSchDedBoUpdtReq(): Invalid cell Id");
939 /* Update Bo in the given logical channel of the UE */
940 if ((ue = rgSCHDbmGetUeCb(cell, boRpt->rnti)) != NULLP)
943 /* Honor BO Reports only from PCELL */
945 if (cell != ue->cell)
950 if ((dlLc = rgSCHDbmGetDlDedLcCb(ue, boRpt->lcId)) != NULLP)
953 if(dlLc->lcType == CM_LTE_LCH_DTCH)
955 if((dlLc->bo == 0) &&(boRpt->bo != 0))
958 if(!(ue->qciActiveLCs[dlLc->qciCb->qci]))
960 dlLc->qciCb->dlUeCount++;
962 ue->qciActiveLCs[dlLc->qciCb->qci]++;
964 else if((dlLc->bo != 0) && (boRpt->bo == 0) && (dlLc->qciCb->dlUeCount))
967 if (ue->qciActiveLCs[dlLc->qciCb->qci])
969 ue->qciActiveLCs[dlLc->qciCb->qci]--;
970 if (!(ue->qciActiveLCs[dlLc->qciCb->qci]))
972 dlLc->qciCb->dlUeCount--;
979 dlUe = RG_SCH_CMN_GET_DL_UE(ue, cell);
980 if (boRpt->bo > dlLc->bo)
982 dlUe->boReported += (boRpt->bo - dlLc->bo);
986 if (boRpt->bo > dlLc->bo)
988 ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlBo += ((boRpt->bo - dlLc->bo)<<3);
991 /* RLC provides cumulative BO for each LC.
992 * Reduce the left out unscheduled bo from total bo and
993 * update the new BO to the total bo */
994 if(ue->totalBo >= dlLc->bo)
996 ue->totalBo -= dlLc->bo;
1000 ue->totalBo = 0; /* this case should not arise
1001 * Resetting for safety */
1004 ue->totalBo += boRpt->bo;
1005 dlLc->bo = boRpt->bo;
1006 dlLc->oldestSduArrTime = boRpt->oldestSduArrTime;
1007 dlLc->staPduBo = boRpt->staPduBo;
1009 dlLc->setMaxUlPrio = boRpt->setMaxUlPrio;
1010 dlLc->setMaxDlPrio = boRpt->setMaxDlPrio;
1011 /* Update the scheduler */
1012 rgSCHUtlDlDedBoUpd(cell, ue, dlLc);
1018 } /* end of rgMacSchDedBoUpdtReq */
1022 * @brief Function for updating common channel BO at scheduler from MAC.
1026 * Function : RgMacSchCmnBoUpdtReq
1028 * This function shall be invoked whenever MAC gets staRsp from RLC
1029 * Scheduler shall update BO in its common logical channel control block.
1031 * @param[in] Pst* pst
1032 * @param[in] S16 cellSapId
1033 * @param[in] RgInfCmnBoRpt *boRpt
1037 S16 RgMacSchCmnBoUpdtReq(Pst* pst,RgInfCmnBoRpt *boRpt)
1040 Inst inst = (pst->dstInst - SCH_INST_START);
1041 S16 cellSapId = boRpt->cellSapId;
1044 /* No need to chk for cell being NULL as MAC would not have found instance if
1045 * it doesnt exist */
1046 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1047 if (cell->cellId != boRpt->cellId)
1049 RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():"
1050 "Invalid boRpt cell Id:%d",boRpt->cellId);
1054 /* handle status response on CCCH */
1055 if(boRpt->lcId == cell->dlCcchId)
1057 RLOG_ARG0(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():"
1058 " BO update for CCCH");
1059 rgSCHUtlHndlCcchBoUpdt(cell, boRpt);
1063 rgSCHUtlHndlBcchPcchBoUpdt(cell, boRpt);
1067 } /* end of RgMacSchCmnBoUpdtReq */
1068 /*Fix: start: Inform UE delete to scheduler*/
1070 * @brief This API is used to send data indication to Scheduler instance from MAC.
1074 * Function : rgMacSchUeDelInd
1076 * This function shall be invoked whenever MAC gets Ue delete request.
1079 * @param[in] Pst* pst
1080 * @param[in] RgInfUeDelInd *ueDelInd
1084 S16 RgMacSchUeDelInd(Pst* pst,RgInfUeDelInd *ueDelInd)
1087 Inst inst = (pst->dstInst - SCH_INST_START);
1088 S16 cellSapId = ueDelInd->cellSapId;
1090 RgSchRntiLnk *rntiLnk=NULL;
1092 if (rgSchCb[inst].rgrSap == NULLP || rgSchCb[inst].rgrSap[cellSapId].cell == NULLP)
1094 RLOG_ARG0(L_ERROR,DBG_CELLID,ueDelInd->cellId,"rgrSap or cell is not configured");
1097 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1099 if (cell->cellId != ueDelInd->cellId)
1101 /* Handle Cell fetch failure */
1102 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1103 "rgMacSchUeDelInd(): Invalid ueDelInd cell Id:%d",
1109 CM_LLIST_FIRST_NODE(&cell->rntiDb.rntiGuardPool, tmp);
1113 rntiLnk = (RgSchRntiLnk *)(tmp->node);
1114 if(rntiLnk->rnti == ueDelInd->rnti)
1116 cmLListDelFrm(&cell->rntiDb.rntiGuardPool, tmp);
1118 rgSCHDbmRlsRnti(cell, rntiLnk);
1119 RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId,
1120 "RNTI:%d Released from the Guard pool(%ld)",
1121 ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count);
1125 CM_LLIST_NEXT_NODE(&cell->rntiDb.rntiGuardPool, tmp);
1129 rgEmtcMacSchUeDelInd(cell,ueDelInd);
1134 /* Fix : syed HO UE does not have a valid ue->rntiLnk */
1135 RLOG_ARG2(L_INFO,DBG_CELLID,ueDelInd->cellId,"HO CRNTI:%d not present in the"
1136 "Guard Pool:%ld", ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count);
1140 } /* rgMacSchUeDelInd */
1141 /*Fix: end: Inform UE delete to scheduler*/
1143 * @brief This API is used to send data indication to Scheduler instance from MAC.
1147 * Function : rgMacSchSfRecpInd
1149 * This function shall be invoked whenever MAC gets datInd on TFU
1150 * Scheduler shall act on the CEs and data that are received as part of
1153 * @param[in] Pst* pst
1154 * @param[in] S16 cellSapId
1155 * @param[in] CmLteRnti rnti
1156 * @param[in] DatIndInfo *datInd
1160 S16 RgMacSchSfRecpInd(Pst* pst,RgInfSfDatInd *subfrmInfo)
1165 RgInfUeDatInd *datInd;
1167 Inst inst = (pst->dstInst - SCH_INST_START);
1171 S16 cellSapId = subfrmInfo->cellSapId;
1172 RgrUeStaIndInfo *ueStaInd;
1175 RgSchCmnUlUeSpsInfo *ulSpsUe ;
1183 uint16_t datIndActQci = 0;
1184 uint16_t combDatIndActQci = 0; /* Prev and Latest Dat Ind combined */
1185 uint16_t tempUeActQci = 0; /* UE specific Active QCIs */
1186 uint16_t diffBits = 0;
1190 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1191 * it doesnt exist */
1192 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1194 /* lnkLst assignment */
1195 lnkLst = &(subfrmInfo->ueLst);
1197 CM_LLIST_FIRST_NODE(lnkLst, tmp);
1199 while((NULLP != tmp) && ((RgInfUeDatInd *)tmp->node != NULLP))
1205 datInd = (RgInfUeDatInd *)tmp->node;
1206 rnti = datInd->rnti;
1208 /* We shall try and find
1209 * out the RaCb based on the following -
1210 * 1. If the incoming PDU contained a CCCH SDU i.e. this is message 3.
1211 * 2. If the incoming PDU contained a CRNTI control element, i.e. we should
1212 * have a ueCb also for this
1215 /* It could be that a non-msg3 pdu contains a CRNTI Control element. We
1216 * should check for CRNTI CE and if it exists the UECb must exist, also an
1217 * if the CRNTI in the CE and the one with which the message came in are
1218 * different we shall look for an raCb as well.
1220 if (datInd->ceInfo.bitMask & RGSCH_CRNTI_CE_PRSNT)
1222 /* SR_RACH_STATS : CRNTI CE*/
1225 if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT)
1227 RGSCH_FREE_MEM(subfrmInfo);
1228 err.errType = RGSCHERR_TOM_DATIND;
1229 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1230 "Received MSG3 with CRNTI:%d and also CCCH ",
1231 datInd->ceInfo.ces.cRnti);
1234 ue = rgSCHDbmGetUeCb (cell, datInd->ceInfo.ces.cRnti);
1237 /* SR_RACH_STATS : CRNTI CE UECB NOT FOUND*/
1238 rgNumCrntiCeCrntiNotFound++;
1239 /* ccpu00141318 - Removed condition for SPS rnti checking*/
1240 RGSCH_FREE_MEM(subfrmInfo);
1241 err.errType = RGSCHERR_TOM_DATIND;
1242 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Received MSG3 "
1243 "with CRNTI:%d unable to find ueCb",
1244 datInd->ceInfo.ces.cRnti);
1248 if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue,
1249 rnti, datInd, &err)) != ROK)
1251 RGSCH_FREE_MEM(subfrmInfo);
1252 err.errType = RGSCHERR_TOM_DATIND;
1253 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Processing for MSG3 failed for CRNTI:%d",
1259 rgSCHUtlHdlCrntiCE (cell, ue);
1261 ret = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&ueStaInd,
1262 sizeof(RgrUeStaIndInfo));
1265 ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD;
1268 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue);
1269 if(ulSpsUe->isUlSpsActv)
1271 ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD_IN_SPS_ACTIVE;
1272 ue->ul.ulSpsCfg.isLcSRMaskEnab = FALSE;
1275 ret = rgSCHUtlFillSndUeStaInd(cell, ue, ueStaInd);
1278 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1279 "Could not Send Ue Sta Ind UEID:%d",ue->ueId);
1282 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1284 } /* end of CRNTI based message */
1285 else if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT)
1287 /* SR_RACH_STATS : CCCH SDU */
1289 /* SR_RACH_STATS : CCCH SDU RACB NOT FOUND*/
1290 if (NULLP == rgSCHDbmGetRaCb (cell, rnti))
1292 rgNumCCCHSduCrntiNotFound++;
1295 if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue,
1296 rnti, datInd, &err)) != ROK)
1298 RGSCH_FREE_MEM(subfrmInfo);
1299 err.errType = RGSCHERR_TOM_DATIND;
1300 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Processing for MSG3 failed for CRNTI:%d",
1305 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1307 } /* end of Msg3 processing */
1311 ue = rgSCHDbmGetUeCb (cell, datInd->rnti);
1315 if((ue = rgSCHDbmGetSpsUeCb (cell, datInd->rnti)) == NULLP)
1318 RGSCH_FREE_MEM(subfrmInfo);
1319 err.errType = RGSCHERR_TOM_DATIND;
1320 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the UE CB for CRNTI:%d",
1328 /* The LCs for which data is received at MAC is provided to SCH.
1329 This information is used to estimate the Active LCs at UE
1330 since estimates based on only BSR is not accurate */
1331 if (datInd->ceInfo.bitMask & RGSCH_ACTIVE_LC_PRSNT)
1334 /* Compose a Bitmask with for the QCI's for which Data
1336 for (lcCount = 0; lcCount < RGINF_MAX_NUM_DED_LC; lcCount++)
1338 if ((datInd->ceInfo.ulActLCs[lcCount] == TRUE) && (TRUE == ue->ul.lcCb[lcCount].isValid))
1340 datIndActQci |= (1 << (ue->ul.lcCb[lcCount].qciCb->qci -1));
1343 if (ue->ulActiveLCs && ue->lastDatIndLCs)
1345 /* Combine previous Dat Ind and current Dat Ind to
1346 estimate active LCs at UE */
1347 combDatIndActQci = ue->lastDatIndLCs | datIndActQci;
1348 tempUeActQci = ue->ulActiveLCs;
1349 ue->ulActiveLCs = combDatIndActQci;
1350 diffBits = combDatIndActQci ^ tempUeActQci;
1356 if (0x1 & tempUeActQci)
1358 /* An active QCI has become inactive */
1359 cell->qciArray[qci].ulUeCount--;
1363 /* An Inactive QCI has become active */
1364 cell->qciArray[qci].ulUeCount++;
1371 ue->lastDatIndLCs = datIndActQci;
1375 #endif /* LTE_L2_MEAS */
1376 /* Just copy the timing information from the dat indication into the one
1377 * stored in the UE CB, will be later utilized to handle Timing advance
1380 if ((ret = rgSCHUtlUpdSch (subfrmInfo, cell, ue, datInd, &err)) != ROK)
1382 RGSCH_FREE_MEM(subfrmInfo);
1383 err.errType = RGSCHERR_TOM_DATIND;
1384 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to handle Data"
1385 " Indication for UEID:%d",ue->ueId);
1389 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1392 /* update the UL PRB usage for all GBR QCIs*/
1393 for (idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++)
1395 cell->prbUsage.qciPrbRpts[idx].ulTotPrbUsed += subfrmInfo->qcisUlPrbCnt[idx];
1399 /* chk if Sch needs to dealloc datInd after unpk */
1400 RGSCH_FREE_MEM(subfrmInfo);
1402 } /* rgMacSchSfRecpInd */
1406 * @brief Function to handle relInd from MAC for a UE
1410 * Function: RgMacSchSpsRelInd
1412 * Handler for processing relInd for UL SPS of a UE
1419 * @param[in] Pst *pst
1420 * @param[in] RgInfSpsRelInfo *relInfo
1425 S16 RgMacSchSpsRelInd(Pst *pst,RgInfSpsRelInfo *relInfo)
1429 Inst inst = (pst->dstInst - SCH_INST_START);
1432 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1433 * it doesnt exist */
1434 cell = rgSchCb[inst].rgrSap[relInfo->cellSapId].cell;
1436 if ((ue = rgSCHDbmGetUeCb(cell, relInfo->cRnti)) == NULLP)
1438 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1439 "No Ue exists with CRNTI:%d",relInfo->cRnti);
1443 if ((rgSCHUtlSpsRelInd(cell, ue, relInfo->isExplRel)) != ROK)
1445 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1446 "RelInd processing for CRNTI:%d failed",relInfo->cRnti);
1450 } /* end of RgMacSchSpsRelInd */
1451 #endif /* LTEMAC_SPS */
1456 * @brief Function to handle L2MeasCfm from MAC
1460 * Function: RgMacSchL2MeasCfm
1462 * Handler for processing L2 measurement confirm
1469 * @param[in] Pst *pst
1470 * @param[in] RgInfL2MeasCfm *measCfm
1475 S16 RgMacSchL2MeasCfm(Pst *pst, RgInfL2MeasCfm *measCfm)
1477 RgSchCellCb *cell = NULLP;
1478 Inst inst = (pst->dstInst - SCH_INST_START);
1480 RgSchL2MeasCb *measCb = NULLP;
1481 RgSchCb *instCb = &rgSchCb[inst];
1483 LrgSchMeasCfmInfo schMeasCfm;
1485 uint8_t idx1; /*LTE_L2_MEAS_PHASE2*/
1488 /* Find the cellCb using cellId in measInfo. Iterate through all cells
1489 * in rgrsapCb in RgschCb */
1490 for (idx = 0; idx < instCb->numSaps; idx++)
1492 if ( instCb->rgrSap[idx].cell->cellId == measCfm->cellId)
1494 /* got the cell break the loop */
1495 cell = instCb->rgrSap[idx].cell;
1499 /* If no cellCb return Err with Invalid Cell Id */
1502 RLOG_ARG0(L_ERROR,DBG_CELLID,measCfm->cellId,
1503 "Meas Cfm Failed.Invalid Cell Id");
1508 /* Iterate through all meas requests in l2mList in cellCb */
1509 lnk = cell->l2mList.first;
1512 /* Get the MeasCb : RgSchL2MeasCb */
1513 measCb = (RgSchL2MeasCb *)lnk->node;
1515 if (measCb->measReq.hdr.transId == measCfm->transId)
1520 if ( measCb == NULLP )
1526 if(measCfm->cfm.status != LCM_PRIM_OK)
1528 for (idx = 0; idx < measCb->measReq.avgPrbQciUl.numQci; idx++)
1530 qciVal = measCb->measReq.avgPrbQciUl.qci[idx];
1531 cell->qciArray[qciVal].qci = 0;
1533 /* Delete this measCb, send the negative confirmation to
1535 cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
1536 /* ccpu00117052 - MOD - Passing double pointer
1537 for proper NULLP assignment*/
1538 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb, sizeof(RgSchL2MeasCb));
1539 memset(&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo));
1540 schMeasCfm.measType = measCfm->measType;
1541 schMeasCfm.cfm = measCfm->cfm;
1542 schMeasCfm.hdr.transId = measCfm->transId;
1543 schMeasCfm.cellId = measCfm->cellId;
1544 RgMiLrgSchL2MeasCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm);
1547 for(idx = 0; idx < measCfm->u.prbCfm.numQci; idx++)
1549 measCb->avgPrbQciUl.prbUsage[idx].prbUsage = measCfm->u.prbCfm.prbUsage[idx].prbUsage;
1550 measCb->avgPrbQciUl.prbUsage[idx].qciValue = measCfm->u.prbCfm.prbUsage[idx].qciValue;
1551 /*LTE_L2_MEAS_PHASE2*/
1552 qciVal1 = measCfm->u.prbCfm.prbUsage[idx].qciValue;
1553 for(idx1=0;idx1<measCb->measReq.avgPrbQciUl.numQci;idx1++)
1555 if(measCb->measReq.avgPrbQciUl.qci[idx1] == qciVal1)
1560 if(idx1 == measCb->measReq.avgPrbQciUl.numQci)
1562 measCb->measReq.avgPrbQciUl.qci[measCb->measReq.avgPrbQciUl.numQci++] = qciVal1;
1565 measCb->avgPrbQciUl.numQci = measCfm->u.prbCfm.numQci;
1566 measCb->cfmRcvd = TRUE;
1567 cell->sndL2Meas = TRUE;
1569 } /* end of RgMacSchL2MeasCfm */
1572 * @brief Function to handle L2MeasStopCfm from MAC
1576 * Function: RgMacSchL2MeasStopCfm
1578 * Handler for processing L2 measurement confirm
1585 * @param[in] Pst *pst
1586 * @param[in] RgInfL2MeasCfm *measCfm
1591 S16 RgMacSchL2MeasStopCfm(Pst *pst,RgInfL2MeasCfm *measCfm)
1593 LrgSchMeasCfmInfo schMeasCfm;
1594 Inst inst = (pst->dstInst - SCH_INST_START);
1595 RgSchCb *instCb = &rgSchCb[inst];
1597 memset(&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo));
1598 schMeasCfm.measType = measCfm->measType;
1599 schMeasCfm.cfm = measCfm->cfm;
1600 schMeasCfm.hdr.transId = measCfm->transId;
1601 schMeasCfm.cellId = measCfm->cellId;
1602 RgMiLrgSchL2MeasStopCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm);
1607 /************** TFU Interface *************/
1610 * @brief Bind confirm API for TFU SAP on scheduler instance.
1614 * Function : RgLiTfuSchBndCfm
1616 * This API is invoked by PHY to confirm TFU SAP bind.
1619 * @param[in] Pst *pst
1620 * @param[in] SuId suId
1621 * @param[in] uint8_t status
1626 S16 RgLiTfuSchBndCfm (Pst *pst,SuId suId, uint8_t status)
1629 RgSchLowSapCb *tfuSap;
1630 Inst instId = pst->dstInst - SCH_INST_START;
1632 if(suId >= rgSchCb[instId].numSaps)
1634 RLOG_ARG0(L_ERROR,DBG_INSTID,instId, "Incorrect SuId");
1637 /* Lets validate suId first */
1638 tfuSap = &(rgSchCb[instId].tfuSap[suId]);
1640 if (suId != tfuSap->sapCfg.suId)
1642 RLOG_ARG2(L_ERROR,DBG_INSTID,instId, "Incorrect SuId. Configured (%d)"
1643 "Recieved (%d)", tfuSap->sapCfg.suId, suId);
1646 ret = rgSCHLmmBndCfm (pst, suId, status);
1648 } /* RgLiTfuSchBndCfm */
1651 * @brief Random Access Request indication from PHY.
1655 * Function : RgLiTfuRaReqInd
1657 * This API is invoked by PHY to send Random Access Request to Scheduler.
1658 * This API contains information for Random Access Request including
1659 * raRnti, list of associated RAPIDs and related information.
1661 * @param[in] Pst *pst
1662 * @param[in] SuId suId
1663 * @param[in] TfuRaReqIndInfo *raReqInd
1668 S16 RgLiTfuRaReqInd(Pst *pst,SuId suId, TfuRaReqIndInfo *raReqInd)
1671 Inst inst = pst->dstInst-SCH_INST_START;
1673 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
1675 RLOG_ARG1(L_ERROR,DBG_INSTID,inst,"SAP Validation failed SuId(%d)", suId);
1676 /* Free up the memory for the request structure */
1677 RGSCH_FREE_MEM(raReqInd);
1681 if(raReqInd == NULLP)
1683 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"Invalid input pointer for raReqInd Failed");
1687 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
1689 RLOG_ARG0(L_ERROR,DBG_CELLID,raReqInd->cellId,"No cell exists");
1693 ret = rgSCHTomRaReqInd(rgSchCb[inst].tfuSap[suId].cell, raReqInd);
1694 /* Free up the memory for the request structure */
1695 RGSCH_FREE_MEM(raReqInd);
1696 /*SPutSBuf (pst->region, pst->pool, (Data *)raReqInd,
1697 sizeof(TfuRaReqIndInfo)); */
1699 } /* RgLiTfuRaReqInd */
1702 * @brief Uplink CQI indication from PHY.
1706 * Function : RgLiTfuUlCqiInd
1708 * This API is invoked by PHY to send Uplink CQI to Scheduler.
1709 * This API contains Uplink CQI information reported per UE.
1711 * @param[in] Pst *pst
1712 * @param[in] SuId suId
1713 * @param[in] TfuUlCqiIndInfo *ulCqiInd
1718 S16 RgLiTfuUlCqiInd(Pst *pst, SuId suId, TfuUlCqiIndInfo *ulCqiInd)
1721 Inst inst = pst->dstInst-SCH_INST_START;
1723 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
1725 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
1726 /* Free up the memory for the request structure */
1727 RGSCH_FREE_MEM(ulCqiInd);
1731 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
1733 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
1734 /* Free up the memory for the request structure */
1735 RGSCH_FREE_MEM(ulCqiInd);
1738 ret = rgSCHTomUlCqiInd (rgSchCb[inst].tfuSap[suId].cell, ulCqiInd);
1739 /* Free up the memory for the request structure */
1740 RGSCH_FREE_MEM(ulCqiInd);
1742 } /* RgLiTfuUlCqiInd */
1745 * @brief PUCCH power adjustment indication.
1749 * Function : RgLiTfuPucchDeltaPwrInd
1751 * This API is invoked by PHY to send PUCCH power adjustment
1754 * @param[in] Pst *pst
1755 * @param[in] SuId suId
1756 * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
1761 S16 RgLiTfuPucchDeltaPwrInd(Pst *pst,SuId suId,TfuPucchDeltaPwrIndInfo *pucchDeltaPwr)
1764 Inst inst = pst->dstInst-SCH_INST_START;
1766 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
1768 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
1769 /* Free up the memory for the request structure */
1770 RGSCH_FREE_MEM(pucchDeltaPwr);
1774 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
1776 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
1779 ret = rgSCHTomPucchDeltaPwrInd (rgSchCb[inst].tfuSap[suId].cell, pucchDeltaPwr);
1780 /* Free up the memory for the request structure */
1781 RGSCH_FREE_MEM(pucchDeltaPwr);
1783 } /* RgLiTfuPucchDeltaPwrInd */
1787 * @brief HARQ ACK indication from PHY for Downlink transmissions.
1791 * Function : RgLiTfuHqInd
1793 * This API is invoked by PHY to send HARQ ACK information to Scheduler
1794 * on recieving HARQ ACK/NACK from UEs.
1795 * This API contains HARQ ACK information recieved by PHY for downlink
1798 * @param[in] Pst *pst
1799 * @param[in] SuId suId
1800 * @param[in] TfuHqIndInfo *harqAckInd
1805 S16 RgLiTfuHqInd(Pst *pst, SuId suId, TfuHqIndInfo *harqAckInd)
1808 Inst inst = (pst->dstInst - SCH_INST_START);
1812 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
1814 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
1815 RGSCH_FREE_MEM(harqAckInd);
1819 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
1821 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
1826 /* Now call the TOM (Tfu ownership module) primitive to process further */
1827 ret = rgSCHTomHarqAckInd (rgSchCb[inst].tfuSap[suId].cell, harqAckInd);
1828 /* Free up the memory for the request structure */
1829 RGSCH_FREE_MEM(harqAckInd);
1831 } /* RgLiTfuHqInd */
1835 * @brief Scheduling request(SR) indication from PHY for an UE.
1839 * Function : RgLiTfuSrInd
1841 * This API is invoked by PHY to send Scheduling request information to
1842 * Scheduler on recieving SR from a list of UEs.
1843 * This API contains scheduling request information recieved by PHY for UEs.
1845 * @param[in] Pst *pst
1846 * @param[in] SuId suId
1847 * @param[in] TfuSrIndInfo *srInd
1852 S16 RgLiTfuSrInd(Pst *pst, SuId suId, TfuSrIndInfo *srInd)
1855 Inst inst = pst->dstInst-SCH_INST_START;
1858 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
1860 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"() SAP Validation failed");
1861 RGSCH_FREE_MEM(srInd);
1865 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
1867 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"RgLiTfuSrInd()No cell exists");
1871 /* Now call the TOM (Tfu ownership module) primitive to process further */
1872 ret = rgSCHTomSrInd (rgSchCb[inst].tfuSap[suId].cell, srInd);
1873 /* Free up the memory for the request structure */
1874 RGSCH_FREE_MEM(srInd);
1876 } /* RgLiTfuSrInd */
1880 * @brief Downlink CQI indication from PHY for an UE.
1884 * Function : RgLiTfuDlCqiInd
1886 * This API is invoked by PHY to send Downlink CQI indication to Scheduler
1887 * on recieving downlink CQI from UE.
1888 * This API contains downlink CQI information recieved by PHY for an UE.
1890 * @param[in] Pst *pst
1891 * @param[in] SuId suId
1892 * @param[in] TfuDlCqiIndInfo *dlCqiInd
1897 S16 RgLiTfuDlCqiInd(Pst *pst, SuId suId, TfuDlCqiIndInfo *dlCqiInd)
1900 Inst inst = pst->dstInst-SCH_INST_START;
1902 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
1904 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed");
1905 /* Free up the memory for the request structure */
1906 RGSCH_FREE_MEM(dlCqiInd);
1910 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
1912 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
1915 ret = rgSCHTomDlCqiInd (rgSchCb[inst].tfuSap[suId].cell, dlCqiInd);
1916 /* Free up the memory for the request structure */
1917 RGSCH_FREE_MEM(dlCqiInd);
1919 } /* RgLiTfuDlCqiInd */
1923 * @brief Raw CQI indication from PHY for an UE.
1927 * Function : RgLiTfuRawCqiInd
1929 * This API is invoked by PHY to send Raw CQI indication to Scheduler
1930 * on receiving Raw CQI from UE.
1931 * This API contains Raw CQI information recieved by PHY for an UE.
1933 * @param[in] Pst *pst
1934 * @param[in] SuId suId
1935 * @param[in] TfuRawCqiIndInfo *rawCqiInd
1940 S16 RgLiTfuRawCqiInd(Pst *pst, SuId suId, TfuRawCqiIndInfo *rawCqiInd)
1943 Inst inst = pst->dstInst-SCH_INST_START;
1946 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
1948 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
1949 /* Free up the memory for the request structure */
1950 RGSCH_FREE_MEM(rawCqiInd);
1954 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
1956 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," No cell exists");
1960 ret = rgSCHTomRawCqiInd (rgSchCb[inst].tfuSap[suId].cell, rawCqiInd);
1961 /* Free up the memory for the request structure */
1962 RGSCH_FREE_MEM(rawCqiInd);
1964 } /* RgLiTfuRawCqiInd */
1967 * @brief SRS indication from PHY for an UE.
1971 * Function : RgLiTfuSrsInd
1973 * This API is invoked by PHY to send UL SRS indication to Scheduler
1974 * on receiving a SRS from UE.
1975 * This API contains SRS information recieved by PHY for an UE.
1977 * @param[in] Pst *pst
1978 * @param[in] SuId suId
1979 * @param[in] TfuSrsIndInfo *srsInd
1984 S16 RgLiTfuSrsInd(Pst *pst, SuId suId, TfuSrsIndInfo *srsInd)
1987 Inst inst = pst->dstInst-SCH_INST_START;
1989 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
1991 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed");
1992 /* Free up the memory for the request structure */
1993 RGSCH_FREE_MEM(srsInd);
1997 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
1999 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2002 ret = rgSCHTomSrsInd (rgSchCb[inst].tfuSap[suId].cell, srsInd);
2003 /* Free up the memory for the request structure */
2004 RGSCH_FREE_MEM(srsInd);
2006 } /* RgLiTfuSrsInd */
2011 * @brief DOA indication from PHY for an UE.
2015 * Function : RgLiTfuDoaInd
2017 * This API is invoked by PHY to send Direction Of Arrival to Scheduler
2018 * on calculating DOA at PHYSICAL LAYER for an UE.
2019 * This API contains DOA information calculated by PHY for an UE.
2021 * @param[in] Pst *pst
2022 * @param[in] SuId suId
2023 * @param[in] TfuDoaIndInfo *doaInd
2028 S16 RgLiTfuDoaInd(Pst *pst, SuId suId, TfuDoaIndInfo *doaInd)
2031 Inst inst = pst->dstInst-SCH_INST_START;
2033 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2035 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2036 /* Free up the memory for the request structure */
2037 RGSCH_FREE_MEM(doaInd);
2041 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2043 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2046 ret = rgSCHTomDoaInd (rgSchCb[inst].tfuSap[suId].cell, doaInd);
2047 /* Free up the memory for the request structure */
2048 RGSCH_FREE_MEM(doaInd);
2050 } /* RgLiTfuDlCqiInd */
2053 * @brief CRC indication from PHY.
2057 * Function : RgLiTfuCrcInd
2059 * This API is invoked by PHY to give CRC indication to scheduler.
2061 * @param[in] Pst *pst
2062 * @param[in] SuId suId
2063 * @param[in] TfuCrcIndInfo *crcInd
2068 S16 RgLiTfuCrcInd(Pst *pst, SuId suId, TfuCrcIndInfo *crcInd)
2071 Inst inst = pst->dstInst-SCH_INST_START;
2073 #ifdef XEON_SPECIFIC_CHANGES
2074 struct timeval start6, end6;
2075 gettimeofday(&start6, NULL);
2078 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2080 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2081 RGSCH_FREE_MEM(crcInd);
2085 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2087 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2092 /* Now call the TOM (Tfu ownership module) primitive to process further */
2093 ret = rgSCHTomCrcInd(rgSchCb[inst].tfuSap[suId].cell, crcInd);
2094 /* Free up the memory for the request structure */
2095 RGSCH_FREE_MEM(crcInd);
2096 #ifdef XEON_SPECIFIC_CHANGES
2097 gettimeofday(&end6, NULL);
2100 } /* RgLiTfuCrcInd */
2103 * @brief Timing Advance indication from PHY.
2107 * Function : RgLiTfuTimingAdvInd
2109 * This API is invoked by PHY to indicate timing advance to Scheduler for
2112 * @param[in] Pst *pst
2113 * @param[in] SuId suId
2114 * @param[in] TfuTimingAdvIndInfo *timingAdvInd
2119 S16 RgLiTfuTimingAdvInd(Pst *pst, SuId suId, TfuTimingAdvIndInfo *timingAdvInd)
2122 Inst inst = pst->dstInst-SCH_INST_START;
2124 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2126 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2127 /* Free up the memory for the request structure */
2128 RGSCH_FREE_MEM(timingAdvInd);
2132 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2134 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2137 /* Now call the TOM (Tfu ownership module) primitive to process further */
2138 ret = rgSCHTomTimingAdvInd(rgSchCb[inst].tfuSap[suId].cell, timingAdvInd);
2139 /* Free up the memory for the request structure */
2140 RGSCH_FREE_MEM(timingAdvInd);
2142 } /* RgLiTfuTimingAdvInd */
2144 /************* RGM Interface ****************/
2146 * @brief API for bind request from RRM towards MAC.
2150 * Function: RgUiRgmBndReq
2152 * This API is invoked by RRM towards MAC to bind RGM SAP.
2153 * These API validates the Pst, spId, suId and sends the bind confirm to
2157 * @param[in] Pst *pst
2158 * @param[in] SuId suId
2159 * @param[in] SpId spId
2164 S16 RgUiRgmBndReq(Pst *pst,SuId suId,SpId spId)
2167 Pst tmpPst; /* Temporary Post Structure */
2168 Inst instId = pst->dstInst-SCH_INST_START;
2170 tmpPst.prior = pst->prior;
2171 tmpPst.route = pst->route;
2172 tmpPst.selector = pst->selector;
2173 tmpPst.region = rgSchCb[instId].rgSchInit.region;
2174 tmpPst.pool = rgSchCb[instId].rgSchInit.pool;
2176 tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId;
2177 tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent;
2178 tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + SCH_INST_START;
2180 tmpPst.event = EVTNONE;
2182 tmpPst.dstProcId = pst->srcProcId;
2183 tmpPst.dstEnt = pst->srcEnt;
2184 tmpPst.dstInst = pst->srcInst;
2186 /*TODO remove follo statement*/
2187 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND;
2189 if(spId < rgSchCb[instId].numSaps)
2191 /* Check the state of the SAP */
2192 switch (rgSchCb[instId].rgmSap[spId].sapSta.sapState)
2194 /* This case might not be needed if SAP not configured then it will go
2195 * to else of above if condition */
2196 case LRG_UNBND: /* SAP is not bound */
2197 RLOG0(L_DEBUG,"SAP is not yet bound");
2198 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_BND;
2199 rgSchCb[instId].rgmSap[spId].sapCfg.suId = suId;
2200 /* Send Bind Confirm with status as SUCCESS */
2201 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK);
2202 /*Indicate to Layer manager */
2204 case LRG_BND: /* SAP is already bound*/
2205 RLOG0(L_DEBUG,"SAP is already bound");
2206 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK);
2208 default: /* Should Never Enter here */
2209 #if (ERRCLASS & ERRCLS_ADD_RES)
2210 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001,
2211 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2212 "Invalid SAP State:RgUiRgmBndReq failed\n");
2214 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_NOK);
2220 #if (ERRCLASS & ERRCLS_ADD_RES)
2221 /* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state
2222 to spId to avoid seg fault due to invalid sapID */
2223 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002,
2224 (ErrVal)spId, "Invalid SAP Id:RgUiRrmBndReq failed\n");
2226 ret = RgUiRgmBndCfm(&tmpPst, suId, CM_BND_NOK);
2229 } /* RgUiRgmBndReq */
2232 * @brief API for unbind request from RRM towards MAC.
2236 * Function: RgUiRgmUbndReq
2238 * This API is invoked by RRM towards MAC to unbind RGM SAP.
2239 * These API validates the Pst, spId, suId and transfers the unbind request
2240 * specific information to corresponding ownership module (GOM) API.
2243 * @param[in] Pst *pst
2244 * @param[in] SuId suId
2245 * @param[in] Reason reason
2250 S16 RgUiRgmUbndReq(Pst *pst,SpId spId,Reason reason)
2252 Inst instId = pst->dstInst-SCH_INST_START;
2254 /* SAP Id validation */
2255 if (spId < rgSchCb[instId].numSaps)
2257 switch(rgSchCb[instId].rgmSap[spId].sapSta.sapState)
2259 case LRG_BND: /* SAP is already bound*/
2260 /* setting SAP state to UN BOUND */
2261 RLOG0(L_DEBUG,"SAP is already bound");
2262 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND;
2265 #if (ERRCLASS & ERRCLS_ADD_RES)
2266 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003,
2267 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2268 "Invalid SAP State: RgUiRgmUbndReq failed\n");
2275 #if (ERRCLASS & ERRCLS_ADD_RES)
2276 RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004,
2277 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2278 "Invalid SAP Id:RgUiRgmUbndReq failed\n");
2283 } /* RgUiRgmUbndReq */
2287 * @brief API for start or stop PRB reporting from RRM towards MAC.
2291 * Function: RgUiRgmCfgPrbRprt
2293 * This API is invoked by RRM towards MAC to start or stop calculating
2294 * Average PRB usage in downlink and uplink. The average PRB usage will
2295 * be reported to RRM based on confiured periodicity.
2298 * @param[in] Pst *pst
2299 * @param[in] SuId suId
2300 * @param[in] SpId spId
2305 S16 RgUiRgmCfgPrbRprt(Pst *pst, SpId spId,RgmPrbRprtCfg *prbRprtCfg)
2309 RgSchPrbUsage *prbUsage;
2310 Inst inst = (pst->dstInst - SCH_INST_START);
2312 cell = rgSchCb[inst].rgmSap[spId].cell;
2313 prbUsage = &cell->prbUsage;
2314 prbUsage->prbRprtEnabld = prbRprtCfg->bConfigType;
2315 prbUsage->rprtPeriod = prbRprtCfg->usPrbAvgPeriodicty;
2316 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, prbUsage->startTime, 1);
2318 /* clear the qciPrbRpts for all GBR QCIs */
2319 memset(&prbUsage->qciPrbRpts[0], 0,
2320 (RGM_MAX_QCI_REPORTS * sizeof(RgSchQciPrbUsage)));
2322 RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId,
2323 "RgUiRgmCfgPrbRprt config type %d with the report period %d",
2324 prbUsage->prbRprtEnabld,prbUsage->rprtPeriod);
2326 /* ccpu00134393 : mem leak fix */
2327 SPutSBuf(pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
2332 * @brief ERROR INDICATION from PHY for the i failed unlicensed Scell transmission.
2336 * Function : RgLiTfuErrInd
2338 * This API is invoked by PHY to send ERROR INDICATION to scheduler
2339 * Currently invoked in the cases when the Unlicensed SCell transmission
2341 * This API contains the Cell and subframe information for which the
2342 * transmission failed.
2344 * @param[in] Pst *pst
2345 * @param[in] SuId suId
2346 * @param[in] TfuErrIndInfo *errIndInfo
2351 S16 RgLiTfuErrInd(Pst *pst, SuId suId, TfuErrIndInfo *errInd)
2355 Inst inst = (pst->dstInst - SCH_INST_START);
2359 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2362 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2366 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2368 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2374 /* Now call the TOM (Tfu ownership module) primitive to process further */
2375 ret = rgSCHLaaErrInd(rgSchCb[inst].tfuSap[suId].cell, errInd);
2378 } /* RgLiTfuErrInd */
2382 /**********************************************************************
2385 **********************************************************************/