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
104 S16 RgMiLrgSchCntrlReq
106 Pst *pst, /* post structure */
107 RgMngmt *cntrl /* control structure */
110 S16 RgMiLrgSchCntrlReq(pst, cntrl)
111 Pst *pst; /* post structure */
112 RgMngmt *cntrl; /* control structure */
115 S16 ret = ROK; /* return value */
119 Inst inst = (pst->dstInst - SCH_INST_START); /* Scheduler instance Id */
121 /* Fill the post structure for sending the confirmation */
122 SchFillCfmPst(pst, &cfmPst, cntrl);
124 /* Initialize the cfg cfm structure
125 if (SGetSBuf(cfmPst.region, cfmPst.pool, (Data **)&cfm, sizeof(RgMngmt))
128 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Memory Unavailable for Confirmation");
129 SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt));
132 memset(&cfm, 0, sizeof(RgMngmt));
139 cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
140 cfm.t.cntrl.action = cntrl->t.cntrl.action;
141 cfm.t.cntrl.subAction = cntrl->t.cntrl.subAction;
143 /* Check if General Config Done*/
144 if(rgSchCb[inst].rgSchInit.cfgDone != TRUE)
146 cfm.cfm.status = LCM_PRIM_NOK;
147 cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
148 cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
149 RgMiLrgSchCntrlCfm(&cfmPst, &cfm);
150 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Gen Cfg not done.");
151 /* SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); */
155 /* General Config done, process the Control request */
156 switch(cntrl->hdr.elmId.elmnt)
159 rgSCHLmmGenCntrl(cntrl, &cfm, &cfmPst);
163 rgSCHLmmSapCntrl(cntrl, &cfm, &cfmPst);
166 cfm.cfm.status = LCM_PRIM_NOK;
167 cfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL;
168 RgMiLrgSchCntrlCfm(&cfmPst, &cfm);
169 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "invalid elmnt=%d",
170 cntrl->hdr.elmId.elmnt);
173 /* SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); */
175 }/*-- RgMiLrgSchCntrlReq --*/
179 * @brief Layer Manager L2 Measurement request handler.
183 * Function : RgMiLrgSchL2MeasReq
185 * This function handles the control
186 * measurement request received from the Layer Manager.
188 * @param[in] Pst *pst, the post structure
189 * @param[in] LrgSchMeasReqInfo *measInfo, measurement request info
194 S16 RgMiLrgSchL2MeasReq
196 Pst *pst, /* post structure */
197 LrgSchMeasReqInfo *measInfo /* Meas Req Info */
200 S16 RgMiLrgSchL2MeasReq(pst, measInfo)
201 Pst *pst; /* post structure */
202 LrgSchMeasReqInfo *measInfo; /* Meas Req Info */
209 RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
210 #if (ERRCLASS & ERRCLS_ADD_RES)
214 RgSchL2MeasCb *measCb = NULLP;
216 Inst inst = (pst->dstInst - SCH_INST_START); /* Scheduler instance Id */
223 /* Find the cellCb using cellId in measInfo. Iterate through all cells
224 * in rgrsapCb in RgschCb */
226 for (idx = 0; idx < instCb->numSaps; idx++)
228 if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
230 /* got the cell break the loop */
231 cell = instCb->rgrSap[idx].cell;
235 /* If no cellCb return Err with Invalid Cell Id */
238 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
239 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_CELLID);
240 rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE);
241 RLOG_ARG2(L_ERROR,DBG_INSTID,inst,
242 "Meas req Failed.Invalid Cell Id errType(%d) errCause(%d)",
243 err.errType, err.errCause);
246 /* Validate for Meas Types */
247 if ( (ret = rgSCHUtlValidateMeasReq(cell, measInfo, &err)) != ROK)
249 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
250 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_MEASTYPE);
251 rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE);
252 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
253 "Meas req Failed.Invalid Measurement Type"
254 "errCasue(%d) errType(%d)", err.errType, err.errCause);
257 /* Iterate through all meas requests in l2mList in cellCb */
258 #if (ERRCLASS & ERRCLS_ADD_RES)
259 lnk = cell->l2mList.first;
262 /* Get the MeasCb : RgSchL2MeasCb */
263 measCb = (RgSchL2MeasCb *)lnk->node;
265 if (measCb->measReq.hdr.transId == measInfo->hdr.transId)
267 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
268 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_DUP_TRANSID);
269 rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE);
270 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
271 "Meas req Failed.Dublicate TransId"
272 "errType(%d) errCause(%d)", err.errType, err.errCause);
277 /* Call L2M Function to store Meas req */
278 ret = rgSchL2mMeasReq(cell, measInfo, err);
281 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
282 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_L2MEAS_FAILED);
283 rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE);
284 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
285 "Meas req Failed.errType(%d) errCause(%d)",
286 err.errType, err.errCause);
290 } /* -- RRgMiLrgSchL2MeasReq-- */
293 * @brief Layer Manager L2 Measurement Stop request handler.
297 * Function : RgMiLrgSchL2MeasStopReq
299 * This function handles the control
300 * measurement stop request received from the Layer Manager.
302 * @param[in] Pst *pst, the post structure
303 * @param[in] LrgSchMeasReqInfo *measInfo, measurement stop request info
308 S16 RgMiLrgSchL2MeasStopReq
310 Pst *pst, /* post structure */
311 LrgSchMeasStopReqInfo *measInfo /* Meas Req Info */
314 S16 RgMiLrgSchL2MeasStopReq(pst, measInfo)
315 Pst *pst; /* post structure */
316 LrgSchMeasStopReqInfo *measInfo; /* Meas Req Info */
320 RgSchCellCb *cell = NULLP;
321 RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
322 CmLList *node = NULLP;
323 RgSchL2MeasCb *measCb = NULLP;
324 LrgSchMeasCfmInfo measCfm;
327 for (idx = 0; idx < instCb->numSaps; idx++)
329 if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
331 /* got the cell break the loop */
332 cell = instCb->rgrSap[idx].cell;
338 RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId,
339 "Stop req Failed.Invalid Cell Id ");
342 memset(&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
343 node = cell->l2mList.first;
346 measCb = (RgSchL2MeasCb *)(node)->node;
349 cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
350 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,
351 sizeof(RgSchL2MeasCb));
354 if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
356 RgInfL2MeasStopReq measStopReq;
358 memset(&measStopReq, 0, sizeof(RgInfL2MeasStopReq));
359 measStopReq.transId = measInfo->hdr.transId;
360 measStopReq.measType = measInfo->measType;
361 /* measReq.timePrd = measInfo->timePrd; */
362 measStopReq.cellId = measInfo->cellId;
363 rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst);
364 RgSchMacL2MeasStop(&pstMac,&measStopReq);
368 RgMiLrgSchL2MeasStopCfm(&(rgSchCb[cell->instIdx].rgSchInit.lmPst),
372 }/*RgMiLrgSchL2MeasStopReq*/
374 * @brief Layer Manager L2 Measurement request handler.
375 * for Send l2 measurement req
378 * Function : RgMiLrgSchL2MeasSendReq
380 * This function handles the control
381 * measurement send request received from the Layer Manager.
383 * @param[in] Pst *pst, the post structure
384 * @param[in] LrgSchMeasReqInfo *measInfo, measurement stop request info
389 S16 RgMiLrgSchL2MeasSendReq
391 Pst *pst, /* post structure */
392 LrgSchMeasSndReqInfo *measInfo /* Meas Req Info */
395 S16 RgMiLrgSchL2MeasSendReq(pst, measInfo)
396 Pst *pst; /* post structure */
397 LrgSchMeasSndReqInfo *measInfo; /* Meas Req Info */
402 RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
406 for (idx = 0; idx < instCb->numSaps; idx++)
408 if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
410 /* got the cell break the loop */
411 cell = instCb->rgrSap[idx].cell;
417 RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId,
418 "Send req Failed.Invalid Cell Id");
422 if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
424 RgInfL2MeasSndReq measSndReq;
426 memset(&measSndReq, 0, sizeof(RgInfL2MeasSndReq));
427 measSndReq.transId = measInfo->hdr.transId;
428 measSndReq.measType = measInfo->measType;
429 measSndReq.timePrd = measInfo->timePrd;
430 measSndReq.cellId = measInfo->cellId;
431 rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst);
432 RgSchMacL2MeasSend(&pstMac, &measSndReq);
436 cell->sndL2Meas = TRUE;
440 }/*RgMiLrgSchL2MeasSendReq*/
441 #endif /* LTE_L2_MEAS */
446 /************* RGR Interface ****************/
448 * @brief API for bind request from RRM towards MAC.
452 * Function: RgUiRgrBndReq
454 * This API is invoked by RRM towards MAC to bind RGR SAP.
455 * These API validates the Pst, spId, suId and sends the bind confirm to
459 * @param[in] Pst *pst
460 * @param[in] SuId suId
461 * @param[in] SpId spId
474 S16 RgUiRgrBndReq(pst, suId, spId)
481 Pst tmpPst; /* Temporary Post Structure */
482 Inst instId = pst->dstInst-SCH_INST_START;
483 RgUstaDgn dgn; /* Alarm diagnostics structure */
485 tmpPst.prior = pst->prior;
486 tmpPst.route = pst->route;
487 tmpPst.selector = pst->selector;
488 tmpPst.region = rgSchCb[instId].rgSchInit.region;
489 tmpPst.pool = rgSchCb[instId].rgSchInit.pool;
490 tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId;
491 tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent;
492 tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + SCH_INST_START;
493 tmpPst.event = EVTNONE;
494 tmpPst.dstProcId = pst->srcProcId;
495 tmpPst.dstEnt = pst->srcEnt;
496 tmpPst.dstInst = pst->srcInst;
498 if(spId < rgSchCb[instId].numSaps)
500 /* Check the state of the SAP */
501 switch (rgSchCb[instId].rgrSap[spId].sapSta.sapState)
503 /* This case might not be needed if SAP not configured then it will go
504 * to else of above if condition */
505 case LRG_UNBND: /* SAP is not bound */
506 RLOG0(L_DEBUG,"SAP Not yet bound");
507 rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_BND;
508 rgSchCb[instId].rgrSap[spId].sapCfg.suId = suId;
509 /* Send Bind Confirm with status as SUCCESS */
510 ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK);
511 /*Indicate to Layer manager */
512 rgSCHUtlFillDgnParams(instId, &dgn, LRG_USTA_DGNVAL_MEM);
513 ret = rgSCHLmmStaInd(instId, LCM_CATEGORY_INTERFACE,
514 LRG_EVENT_RGRSAP_ENB, LCM_CAUSE_UNKNOWN, &dgn);
516 case LRG_BND: /* SAP is already bound*/
517 RLOG0(L_DEBUG,"SAP is already bound");
518 ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK);
520 default: /* Should Never Enter here */
521 #if (ERRCLASS & ERRCLS_ADD_RES)
522 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001,
523 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
524 "Invalid SAP State:RgUiRrgBndReq failed\n");
526 ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_NOK);
532 #if (ERRCLASS & ERRCLS_ADD_RES)
533 /* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state
534 to spId to avoid seg fault due to invalid sapID */
535 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002,
536 (ErrVal)spId, "Invalid SAP Id:RgUiRrgBndReq failed\n");
538 ret = RgUiRgrBndCfm(&tmpPst, suId, CM_BND_NOK);
541 } /* RgUiRgrBndReq */
544 * @brief API for unbind request from RRM towards MAC.
548 * Function: RgUiRgrUbndReq
550 * This API is invoked by RRM towards MAC to unbind RGR SAP.
551 * These API validates the Pst, spId, suId and transfers the unbind request
552 * specific information to corresponding ownership module (GOM) API.
555 * @param[in] Pst *pst
556 * @param[in] SuId suId
557 * @param[in] Reason reason
570 S16 RgUiRgrUbndReq(pst, spId, reason)
576 Inst instId = pst->dstInst-SCH_INST_START;
578 /* SAP Id validation */
579 if (spId < rgSchCb[instId].numSaps)
581 switch(rgSchCb[instId].rgrSap[spId].sapSta.sapState)
583 case LRG_BND: /* SAP is already bound*/
584 RLOG0(L_DEBUG,"SAP is already bound");
585 /* setting SAP state to UN BOUND */
586 rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_UNBND;
589 #if (ERRCLASS & ERRCLS_ADD_RES)
590 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003,
591 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
592 "Invalid SAP State: RgUiRgrUbndReq failed\n");
599 #if (ERRCLASS & ERRCLS_ADD_RES)
600 RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004,
601 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
602 "Invalid SAP Id:RgUiRgrUbndReq failed\n");
607 } /* RgUiRgrUbndReq */
611 * @brief API for SI configuration request from RRM towards MAC.
615 * Function: RgUiRgrSiCfgReq
617 * This API is invoked by RRM towards MAC to configure SI at MAC.
618 * These API validates the Pst, spId, suId and transfers the
619 * config request specific information to corresponding ownership
623 * @param[in] Pst *pst
624 * @param[in] SpId spId
625 * @param[in] RgrCfgTransId transId
626 * @param[in] RgrSiCfgReqInfo *cfgReqInfo
636 RgrCfgTransId transId,
637 RgrSiCfgReqInfo *cfgReqInfo
640 S16 RgUiRgrSiCfgReq(pst, spId, transId, cfgReqInfo)
643 RgrCfgTransId transId;
644 RgrSiCfgReqInfo *cfgReqInfo;
648 uint8_t cfmStatus = RGR_CFG_CFM_NOK;
649 uint8_t prntTrans[RGR_CFG_TRANSID_SIZE+1];
650 Inst instId = pst->dstInst-SCH_INST_START;
652 memcpy(prntTrans, transId.trans, RGR_CFG_TRANSID_SIZE);
653 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
656 if (cfgReqInfo == NULLP)
658 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
660 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
664 if (spId < rgSchCb[instId].numSaps)
666 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
668 #if (ERRCLASS & ERRCLS_ADD_RES)
669 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007,
670 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
671 "Invalid SAP State: RgUiRgrSiCfgReq failed\n");
673 SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
674 (Size)sizeof(*cfgReqInfo));
675 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
681 #if (ERRCLASS & ERRCLS_ADD_RES)
682 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008,
683 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
684 "Invalid SAP Id:RgUiRgrSiCfgReq failed\n");
686 SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
687 (Size)sizeof(*cfgReqInfo));
688 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
692 /* Handle configuration */
694 if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable)
696 ret = rgSCHGomEmtcHndlSiCfg(pst->region, pst->pool,
697 &rgSchCb[instId], spId, transId,
702 ret = rgSCHGomHndlSiCfg(pst->region, pst->pool,
703 &rgSchCb[instId], spId, transId,
707 ret = rgSCHGomHndlSiCfg(pst->region, pst->pool,
708 &rgSchCb[instId], spId, transId,
713 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"RgUiRgrSiCfgReq:"
714 "Configuration Request Handling Failed");
719 } /* RgUiRgrSiCfgReq */
723 * @brief API for Warning SI configuration request from RRM towards MAC.
727 * Function: RgUiRgrWarningSiCfgReq
729 * This API is invoked by RRM towards MAC to configure SI at MAC.
730 * These API validates the Pst, spId, suId and transfers the
731 * config request specific information to corresponding ownership
735 * @param[in] Pst *pst
736 * @param[in] SpId spId
737 * @param[in] RgrCfgTransId transId
738 * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
744 S16 RgUiRgrWarningSiCfgReq
748 RgrCfgTransId transId,
749 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
752 S16 RgUiRgrWarningSiCfgReq(pst, spId, transId, warningSiCfgReqInfo)
755 RgrCfgTransId transId;
756 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo;
759 Inst instId = pst->dstInst-SCH_INST_START;
761 uint8_t cfmStatus = RGR_CFG_CFM_NOK;
762 uint8_t prntTrans[RGR_CFG_TRANSID_SIZE+1];
764 memcpy(prntTrans, transId.trans, RGR_CFG_TRANSID_SIZE);
765 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
769 if (warningSiCfgReqInfo == NULLP)
771 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
773 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, 0, transId, cfmStatus);
777 if (spId < rgSchCb[instId].numSaps)
779 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
781 #if (ERRCLASS & ERRCLS_ADD_RES)
782 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG023,
783 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
784 "Invalid SAP State: warningSiCfgReqInfo failed\n");
786 rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool,
787 &warningSiCfgReqInfo->siPduLst);
788 SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
789 sizeof(RgrWarningSiCfgReqInfo));
790 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId,
797 #if (ERRCLASS & ERRCLS_ADD_RES)
798 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG024,
799 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
800 "Invalid SAP Id:warningSiCfgReqInfo failed\n");
802 rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool,
803 &warningSiCfgReqInfo->siPduLst);
804 SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
805 sizeof(RgrWarningSiCfgReqInfo));
806 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId,
811 /* Handle configuration */
813 if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable)
815 ret = rgSCHGomEmtcHndlWarningSiCfg(pst->region, pst->pool,
816 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
820 ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool,
821 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
824 ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool,
825 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
829 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,
830 "Configuration Request Handling Failed");
839 * @brief API for Warning SI Stop request from RRM towards MAC.
843 * Function: RgUiRgrWarningSiStopReq
845 * This API is invoked by RRM towards MAC to Stop warning SI at MAC.
846 * These API validates the Pst, spId, suId and transfers the
847 * stop request specific information to corresponding ownership
851 * @param[in] Pst *pst
852 * @param[in] SpId spId
853 * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
859 S16 RgUiRgrWarningSiStopReq
863 RgrCfgTransId transId,
867 S16 RgUiRgrWarningSiStopReq(pst,spId, transId, siId)
870 RgrCfgTransId transId;
874 Inst instId = pst->dstInst-SCH_INST_START;
876 if (spId < rgSchCb[instId].numSaps)
878 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
880 #if (ERRCLASS & ERRCLS_ADD_RES)
881 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG025,
882 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
883 "Invalid SAP State: RgUiRgrWarningSiStopReq failed\n");
890 #if (ERRCLASS & ERRCLS_ADD_RES)
891 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG026,
892 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
893 "Invalid SAP Id:RgUiRgrWarningSiStopReq failed\n");
898 rgSCHGomHndlWarningSiStopReq(pst->region, pst->pool,
899 &rgSchCb[instId], siId, transId, spId);
903 #endif /*RGR_SI_SCH */
905 /* LTE_ADV_FLAG_REMOVED_START */
908 * @brief API for LOAD INF request from RRM towards MAC.
912 * Function: RgUiRgrLoadInfReq
914 * This API is invoked by RRM towards MAC to configure LOAD INF Parameters at MAC.
915 * These API validates the Pst, spId, suId and transfers the
916 * LOAD INF request to corresponding ownership
920 * @param[in] Pst *pst
921 * @param[in] SpId spId
922 * @param[in] RgrCfgTransId transId
923 * @param[in] RgrLoadInfReqInfo *loadInfReq
929 S16 RgUiRgrLoadInfReq
933 RgrCfgTransId transId,
934 RgrLoadInfReqInfo *loadInfReq
937 S16 RgUiRgrLoadInfReq(pst, spId, transId, loadInfReq)
940 RgrCfgTransId transId;
941 RgrLoadInfReqInfo *loadInfReq;
945 uint8_t prntTrans[RGR_CFG_TRANSID_SIZE+1];
946 Inst instId = pst->dstInst-SCH_INST_START;
948 memcpy(prntTrans, transId.trans, RGR_CFG_TRANSID_SIZE);
949 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
952 if (loadInfReq == NULLP)
954 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
959 if (spId < rgSchCb[instId].numSaps)
961 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
963 #if (ERRCLASS & ERRCLS_ADD_RES)
964 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007,
965 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
966 "Invalid SAP State: RgUiRgrLoadInfReq failed\n");
968 SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq,
969 (Size)sizeof(*loadInfReq));
975 #if (ERRCLASS & ERRCLS_ADD_RES)
976 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008,
977 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
978 "Invalid SAP Id:RgUiRgrLoadInfReq failed\n");
980 SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq,
981 (Size)sizeof(*loadInfReq));
985 /* Handle configuration */
986 ret = rgSCHGomHndlLoadInf(pst->region, pst->pool,
987 &rgSchCb[(pst->dstInst - SCH_INST_START)], spId, transId,
991 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,
992 "Configuration Request Handling Failed");
997 } /* RgUiRgrLoadInfReq */
998 /* LTE_ADV_FLAG_REMOVED_END */
1000 /************** MAC SCH Interface **************/
1002 * @brief Function for updating dedicated channel BO at scheduler from MAC.
1006 * Function : rgMacSchDedBoUpdtReq
1008 * This function shall be invoked whenever MAC gets staRsp from RLC
1009 * Scheduler shall update BO in its dedicated logical channel control block.
1011 * @param[in] Pst* pst
1012 * @param[in] S16 cellSapId
1013 * @param[in] RgInfDedBoRpt *boRpt
1018 S16 RgMacSchDedBoUpdtReq
1021 RgInfDedBoRpt *boRpt
1024 S16 RgMacSchDedBoUpdtReq(pst, boRpt)
1026 RgInfDedBoRpt *boRpt;
1036 Inst inst = (pst->dstInst - SCH_INST_START);
1037 S16 cellSapId = boRpt->cellSapId;
1040 RLOG_ARG2(L_DEBUG,DBG_CELLID,boRpt->cellId,"rgMacSchDedBoUpdtReq():"
1041 " boRpt->rnti = %u boRpt->lcId = %u",boRpt->rnti, boRpt->lcId);
1043 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1044 * it doesnt exist */
1045 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1048 if (cell->cellId != boRpt->cellId)
1050 /* Handle Cell fetch failure */
1051 RGSCHLOGERROR(inst, ERRCLS_INT_PAR,ERG009,(ErrVal)boRpt->cellId,
1052 "rgMacSchDedBoUpdtReq(): Invalid cell Id");
1057 /* Update Bo in the given logical channel of the UE */
1058 if ((ue = rgSCHDbmGetUeCb(cell, boRpt->rnti)) != NULLP)
1061 /* Honor BO Reports only from PCELL */
1063 if (cell != ue->cell)
1068 if ((dlLc = rgSCHDbmGetDlDedLcCb(ue, boRpt->lcId)) != NULLP)
1071 if(dlLc->lcType == CM_LTE_LCH_DTCH)
1073 if((dlLc->bo == 0) &&(boRpt->bo != 0))
1076 if(!(ue->qciActiveLCs[dlLc->qciCb->qci]))
1078 dlLc->qciCb->dlUeCount++;
1080 ue->qciActiveLCs[dlLc->qciCb->qci]++;
1082 else if((dlLc->bo != 0) && (boRpt->bo == 0) && (dlLc->qciCb->dlUeCount))
1084 /* UE is inactive */
1085 if (ue->qciActiveLCs[dlLc->qciCb->qci])
1087 ue->qciActiveLCs[dlLc->qciCb->qci]--;
1088 if (!(ue->qciActiveLCs[dlLc->qciCb->qci]))
1090 dlLc->qciCb->dlUeCount--;
1097 dlUe = RG_SCH_CMN_GET_DL_UE(ue, cell);
1098 if (boRpt->bo > dlLc->bo)
1100 dlUe->boReported += (boRpt->bo - dlLc->bo);
1104 if (boRpt->bo > dlLc->bo)
1106 ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlBo += ((boRpt->bo - dlLc->bo)<<3);
1109 /* RLC provides cumulative BO for each LC.
1110 * Reduce the left out unscheduled bo from total bo and
1111 * update the new BO to the total bo */
1112 if(ue->totalBo >= dlLc->bo)
1114 ue->totalBo -= dlLc->bo;
1118 ue->totalBo = 0; /* this case should not arise
1119 * Resetting for safety */
1122 ue->totalBo += boRpt->bo;
1123 dlLc->bo = boRpt->bo;
1124 dlLc->oldestSduArrTime = boRpt->oldestSduArrTime;
1125 dlLc->staPduBo = boRpt->staPduBo;
1127 dlLc->setMaxUlPrio = boRpt->setMaxUlPrio;
1128 dlLc->setMaxDlPrio = boRpt->setMaxDlPrio;
1129 /* Update the scheduler */
1130 rgSCHUtlDlDedBoUpd(cell, ue, dlLc);
1136 } /* end of rgMacSchDedBoUpdtReq */
1140 * @brief Function for updating common channel BO at scheduler from MAC.
1144 * Function : RgMacSchCmnBoUpdtReq
1146 * This function shall be invoked whenever MAC gets staRsp from RLC
1147 * Scheduler shall update BO in its common logical channel control block.
1149 * @param[in] Pst* pst
1150 * @param[in] S16 cellSapId
1151 * @param[in] RgInfCmnBoRpt *boRpt
1156 S16 RgMacSchCmnBoUpdtReq
1159 RgInfCmnBoRpt *boRpt
1162 S16 RgMacSchCmnBoUpdtReq(pst, boRpt)
1164 RgInfCmnBoRpt *boRpt;
1168 Inst inst = (pst->dstInst - SCH_INST_START);
1169 S16 cellSapId = boRpt->cellSapId;
1172 /* No need to chk for cell being NULL as MAC would not have found instance if
1173 * it doesnt exist */
1174 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1175 if (cell->cellId != boRpt->cellId)
1177 RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():"
1178 "Invalid boRpt cell Id:%d",boRpt->cellId);
1182 /* handle status response on CCCH */
1183 if(boRpt->lcId == cell->dlCcchId)
1185 RLOG_ARG0(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():"
1186 " BO update for CCCH");
1187 rgSCHUtlHndlCcchBoUpdt(cell, boRpt);
1191 rgSCHUtlHndlBcchPcchBoUpdt(cell, boRpt);
1195 } /* end of RgMacSchCmnBoUpdtReq */
1196 /*Fix: start: Inform UE delete to scheduler*/
1198 * @brief This API is used to send data indication to Scheduler instance from MAC.
1202 * Function : rgMacSchUeDelInd
1204 * This function shall be invoked whenever MAC gets Ue delete request.
1207 * @param[in] Pst* pst
1208 * @param[in] RgInfUeDelInd *ueDelInd
1213 S16 RgMacSchUeDelInd
1216 RgInfUeDelInd *ueDelInd
1219 S16 RgMacSchUeDelInd(pst, ueDelInd)
1221 RgInfUeDelInd *ueDelInd;
1225 Inst inst = (pst->dstInst - SCH_INST_START);
1226 S16 cellSapId = ueDelInd->cellSapId;
1228 RgSchRntiLnk *rntiLnk=NULL;
1230 if (rgSchCb[inst].rgrSap == NULLP || rgSchCb[inst].rgrSap[cellSapId].cell == NULLP)
1232 RLOG_ARG0(L_ERROR,DBG_CELLID,ueDelInd->cellId,"rgrSap or cell is not configured");
1235 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1237 if (cell->cellId != ueDelInd->cellId)
1239 /* Handle Cell fetch failure */
1240 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1241 "rgMacSchUeDelInd(): Invalid ueDelInd cell Id:%d",
1247 CM_LLIST_FIRST_NODE(&cell->rntiDb.rntiGuardPool, tmp);
1251 rntiLnk = (RgSchRntiLnk *)(tmp->node);
1252 if(rntiLnk->rnti == ueDelInd->rnti)
1254 cmLListDelFrm(&cell->rntiDb.rntiGuardPool, tmp);
1256 rgSCHDbmRlsRnti(cell, rntiLnk);
1257 RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId,
1258 "RNTI:%d Released from the Guard pool(%ld)",
1259 ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count);
1263 CM_LLIST_NEXT_NODE(&cell->rntiDb.rntiGuardPool, tmp);
1267 rgEmtcMacSchUeDelInd(cell,ueDelInd);
1272 /* Fix : syed HO UE does not have a valid ue->rntiLnk */
1273 RLOG_ARG2(L_INFO,DBG_CELLID,ueDelInd->cellId,"HO CRNTI:%d not present in the"
1274 "Guard Pool:%ld", ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count);
1278 } /* rgMacSchUeDelInd */
1279 /*Fix: end: Inform UE delete to scheduler*/
1281 * @brief This API is used to send data indication to Scheduler instance from MAC.
1285 * Function : rgMacSchSfRecpInd
1287 * This function shall be invoked whenever MAC gets datInd on TFU
1288 * Scheduler shall act on the CEs and data that are received as part of
1291 * @param[in] Pst* pst
1292 * @param[in] S16 cellSapId
1293 * @param[in] CmLteRnti rnti
1294 * @param[in] DatIndInfo *datInd
1299 S16 RgMacSchSfRecpInd
1302 RgInfSfDatInd *subfrmInfo
1305 S16 RgMacSchSfRecpInd(pst, subfrmInfo)
1307 RgInfSfDatInd *subfrmInfo;
1313 RgInfUeDatInd *datInd;
1315 Inst inst = (pst->dstInst - SCH_INST_START);
1319 S16 cellSapId = subfrmInfo->cellSapId;
1320 RgrUeStaIndInfo *ueStaInd;
1323 RgSchCmnUlUeSpsInfo *ulSpsUe ;
1331 uint16_t datIndActQci = 0;
1332 uint16_t combDatIndActQci = 0; /* Prev and Latest Dat Ind combined */
1333 uint16_t tempUeActQci = 0; /* UE specific Active QCIs */
1334 uint16_t diffBits = 0;
1338 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1339 * it doesnt exist */
1340 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1342 /* lnkLst assignment */
1343 lnkLst = &(subfrmInfo->ueLst);
1345 CM_LLIST_FIRST_NODE(lnkLst, tmp);
1347 while((NULLP != tmp) && ((RgInfUeDatInd *)tmp->node != NULLP))
1353 datInd = (RgInfUeDatInd *)tmp->node;
1354 rnti = datInd->rnti;
1356 /* We shall try and find
1357 * out the RaCb based on the following -
1358 * 1. If the incoming PDU contained a CCCH SDU i.e. this is message 3.
1359 * 2. If the incoming PDU contained a CRNTI control element, i.e. we should
1360 * have a ueCb also for this
1363 /* It could be that a non-msg3 pdu contains a CRNTI Control element. We
1364 * should check for CRNTI CE and if it exists the UECb must exist, also an
1365 * if the CRNTI in the CE and the one with which the message came in are
1366 * different we shall look for an raCb as well.
1368 if (datInd->ceInfo.bitMask & RGSCH_CRNTI_CE_PRSNT)
1370 /* SR_RACH_STATS : CRNTI CE*/
1373 if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT)
1375 RGSCH_FREE_MEM(subfrmInfo);
1376 err.errType = RGSCHERR_TOM_DATIND;
1377 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1378 "Received MSG3 with CRNTI:%d and also CCCH ",
1379 datInd->ceInfo.ces.cRnti);
1382 ue = rgSCHDbmGetUeCb (cell, datInd->ceInfo.ces.cRnti);
1385 /* SR_RACH_STATS : CRNTI CE UECB NOT FOUND*/
1386 rgNumCrntiCeCrntiNotFound++;
1387 /* ccpu00141318 - Removed condition for SPS rnti checking*/
1388 RGSCH_FREE_MEM(subfrmInfo);
1389 err.errType = RGSCHERR_TOM_DATIND;
1390 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Received MSG3 "
1391 "with CRNTI:%d unable to find ueCb",
1392 datInd->ceInfo.ces.cRnti);
1396 if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue,
1397 rnti, datInd, &err)) != ROK)
1399 RGSCH_FREE_MEM(subfrmInfo);
1400 err.errType = RGSCHERR_TOM_DATIND;
1401 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Processing for MSG3 failed for CRNTI:%d",
1407 rgSCHUtlHdlCrntiCE (cell, ue);
1409 ret = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&ueStaInd,
1410 sizeof(RgrUeStaIndInfo));
1413 ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD;
1416 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue);
1417 if(ulSpsUe->isUlSpsActv)
1419 ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD_IN_SPS_ACTIVE;
1420 ue->ul.ulSpsCfg.isLcSRMaskEnab = FALSE;
1423 ret = rgSCHUtlFillSndUeStaInd(cell, ue, ueStaInd);
1426 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1427 "Could not Send Ue Sta Ind UEID:%d",ue->ueId);
1430 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1432 } /* end of CRNTI based message */
1433 else if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT)
1435 /* SR_RACH_STATS : CCCH SDU */
1437 /* SR_RACH_STATS : CCCH SDU RACB NOT FOUND*/
1438 if (NULLP == rgSCHDbmGetRaCb (cell, rnti))
1440 rgNumCCCHSduCrntiNotFound++;
1443 if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue,
1444 rnti, datInd, &err)) != ROK)
1446 RGSCH_FREE_MEM(subfrmInfo);
1447 err.errType = RGSCHERR_TOM_DATIND;
1448 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Processing for MSG3 failed for CRNTI:%d",
1453 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1455 } /* end of Msg3 processing */
1459 ue = rgSCHDbmGetUeCb (cell, datInd->rnti);
1463 if((ue = rgSCHDbmGetSpsUeCb (cell, datInd->rnti)) == NULLP)
1466 RGSCH_FREE_MEM(subfrmInfo);
1467 err.errType = RGSCHERR_TOM_DATIND;
1468 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the UE CB for CRNTI:%d",
1476 /* The LCs for which data is received at MAC is provided to SCH.
1477 This information is used to estimate the Active LCs at UE
1478 since estimates based on only BSR is not accurate */
1479 if (datInd->ceInfo.bitMask & RGSCH_ACTIVE_LC_PRSNT)
1482 /* Compose a Bitmask with for the QCI's for which Data
1484 for (lcCount = 0; lcCount < RGINF_MAX_NUM_DED_LC; lcCount++)
1486 if ((datInd->ceInfo.ulActLCs[lcCount] == TRUE) && (TRUE == ue->ul.lcCb[lcCount].isValid))
1488 datIndActQci |= (1 << (ue->ul.lcCb[lcCount].qciCb->qci -1));
1491 if (ue->ulActiveLCs && ue->lastDatIndLCs)
1493 /* Combine previous Dat Ind and current Dat Ind to
1494 estimate active LCs at UE */
1495 combDatIndActQci = ue->lastDatIndLCs | datIndActQci;
1496 tempUeActQci = ue->ulActiveLCs;
1497 ue->ulActiveLCs = combDatIndActQci;
1498 diffBits = combDatIndActQci ^ tempUeActQci;
1504 if (0x1 & tempUeActQci)
1506 /* An active QCI has become inactive */
1507 cell->qciArray[qci].ulUeCount--;
1511 /* An Inactive QCI has become active */
1512 cell->qciArray[qci].ulUeCount++;
1519 ue->lastDatIndLCs = datIndActQci;
1523 #endif /* LTE_L2_MEAS */
1524 /* Just copy the timing information from the dat indication into the one
1525 * stored in the UE CB, will be later utilized to handle Timing advance
1528 if ((ret = rgSCHUtlUpdSch (subfrmInfo, cell, ue, datInd, &err)) != ROK)
1530 RGSCH_FREE_MEM(subfrmInfo);
1531 err.errType = RGSCHERR_TOM_DATIND;
1532 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to handle Data"
1533 " Indication for UEID:%d",ue->ueId);
1537 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1540 /* update the UL PRB usage for all GBR QCIs*/
1541 for (idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++)
1543 cell->prbUsage.qciPrbRpts[idx].ulTotPrbUsed += subfrmInfo->qcisUlPrbCnt[idx];
1547 /* chk if Sch needs to dealloc datInd after unpk */
1548 RGSCH_FREE_MEM(subfrmInfo);
1550 } /* rgMacSchSfRecpInd */
1554 * @brief Function to handle relInd from MAC for a UE
1558 * Function: RgMacSchSpsRelInd
1560 * Handler for processing relInd for UL SPS of a UE
1567 * @param[in] Pst *pst
1568 * @param[in] RgInfSpsRelInfo *relInfo
1574 S16 RgMacSchSpsRelInd
1577 RgInfSpsRelInfo *relInfo
1580 S16 RgMacSchSpsRelInd(pst, relInfo)
1582 RgInfSpsRelInfo *relInfo;
1587 Inst inst = (pst->dstInst - SCH_INST_START);
1590 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1591 * it doesnt exist */
1592 cell = rgSchCb[inst].rgrSap[relInfo->cellSapId].cell;
1594 if ((ue = rgSCHDbmGetUeCb(cell, relInfo->cRnti)) == NULLP)
1596 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1597 "No Ue exists with CRNTI:%d",relInfo->cRnti);
1601 if ((rgSCHUtlSpsRelInd(cell, ue, relInfo->isExplRel)) != ROK)
1603 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1604 "RelInd processing for CRNTI:%d failed",relInfo->cRnti);
1608 } /* end of RgMacSchSpsRelInd */
1609 #endif /* LTEMAC_SPS */
1614 * @brief Function to handle L2MeasCfm from MAC
1618 * Function: RgMacSchL2MeasCfm
1620 * Handler for processing L2 measurement confirm
1627 * @param[in] Pst *pst
1628 * @param[in] RgInfL2MeasCfm *measCfm
1634 S16 RgMacSchL2MeasCfm
1637 RgInfL2MeasCfm *measCfm
1640 S16 RgMacSchL2MeasCfm(pst, measCfm)
1642 RgInfL2MeasCfm *measCfm;
1645 RgSchCellCb *cell = NULLP;
1646 Inst inst = (pst->dstInst - SCH_INST_START);
1648 RgSchL2MeasCb *measCb = NULLP;
1649 RgSchCb *instCb = &rgSchCb[inst];
1651 LrgSchMeasCfmInfo schMeasCfm;
1653 uint8_t idx1; /*LTE_L2_MEAS_PHASE2*/
1656 /* Find the cellCb using cellId in measInfo. Iterate through all cells
1657 * in rgrsapCb in RgschCb */
1658 for (idx = 0; idx < instCb->numSaps; idx++)
1660 if ( instCb->rgrSap[idx].cell->cellId == measCfm->cellId)
1662 /* got the cell break the loop */
1663 cell = instCb->rgrSap[idx].cell;
1667 /* If no cellCb return Err with Invalid Cell Id */
1670 RLOG_ARG0(L_ERROR,DBG_CELLID,measCfm->cellId,
1671 "Meas Cfm Failed.Invalid Cell Id");
1676 /* Iterate through all meas requests in l2mList in cellCb */
1677 lnk = cell->l2mList.first;
1680 /* Get the MeasCb : RgSchL2MeasCb */
1681 measCb = (RgSchL2MeasCb *)lnk->node;
1683 if (measCb->measReq.hdr.transId == measCfm->transId)
1688 if ( measCb == NULLP )
1694 if(measCfm->cfm.status != LCM_PRIM_OK)
1696 for (idx = 0; idx < measCb->measReq.avgPrbQciUl.numQci; idx++)
1698 qciVal = measCb->measReq.avgPrbQciUl.qci[idx];
1699 cell->qciArray[qciVal].qci = 0;
1701 /* Delete this measCb, send the negative confirmation to
1703 cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
1704 /* ccpu00117052 - MOD - Passing double pointer
1705 for proper NULLP assignment*/
1706 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb, sizeof(RgSchL2MeasCb));
1707 memset(&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo));
1708 schMeasCfm.measType = measCfm->measType;
1709 schMeasCfm.cfm = measCfm->cfm;
1710 schMeasCfm.hdr.transId = measCfm->transId;
1711 schMeasCfm.cellId = measCfm->cellId;
1712 RgMiLrgSchL2MeasCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm);
1715 for(idx = 0; idx < measCfm->u.prbCfm.numQci; idx++)
1717 measCb->avgPrbQciUl.prbUsage[idx].prbUsage = measCfm->u.prbCfm.prbUsage[idx].prbUsage;
1718 measCb->avgPrbQciUl.prbUsage[idx].qciValue = measCfm->u.prbCfm.prbUsage[idx].qciValue;
1719 /*LTE_L2_MEAS_PHASE2*/
1720 qciVal1 = measCfm->u.prbCfm.prbUsage[idx].qciValue;
1721 for(idx1=0;idx1<measCb->measReq.avgPrbQciUl.numQci;idx1++)
1723 if(measCb->measReq.avgPrbQciUl.qci[idx1] == qciVal1)
1728 if(idx1 == measCb->measReq.avgPrbQciUl.numQci)
1730 measCb->measReq.avgPrbQciUl.qci[measCb->measReq.avgPrbQciUl.numQci++] = qciVal1;
1733 measCb->avgPrbQciUl.numQci = measCfm->u.prbCfm.numQci;
1734 measCb->cfmRcvd = TRUE;
1735 cell->sndL2Meas = TRUE;
1737 } /* end of RgMacSchL2MeasCfm */
1740 * @brief Function to handle L2MeasStopCfm from MAC
1744 * Function: RgMacSchL2MeasStopCfm
1746 * Handler for processing L2 measurement confirm
1753 * @param[in] Pst *pst
1754 * @param[in] RgInfL2MeasCfm *measCfm
1760 S16 RgMacSchL2MeasStopCfm
1763 RgInfL2MeasCfm *measCfm
1766 S16 RgMacSchL2MeasStopCfm(pst, measCfm)
1768 RgInfL2MeasCfm *measCfm;
1771 LrgSchMeasCfmInfo schMeasCfm;
1772 Inst inst = (pst->dstInst - SCH_INST_START);
1773 RgSchCb *instCb = &rgSchCb[inst];
1775 memset(&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo));
1776 schMeasCfm.measType = measCfm->measType;
1777 schMeasCfm.cfm = measCfm->cfm;
1778 schMeasCfm.hdr.transId = measCfm->transId;
1779 schMeasCfm.cellId = measCfm->cellId;
1780 RgMiLrgSchL2MeasStopCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm);
1785 /************** TFU Interface *************/
1788 * @brief Bind confirm API for TFU SAP on scheduler instance.
1792 * Function : RgLiTfuSchBndCfm
1794 * This API is invoked by PHY to confirm TFU SAP bind.
1797 * @param[in] Pst *pst
1798 * @param[in] SuId suId
1799 * @param[in] uint8_t status
1805 S16 RgLiTfuSchBndCfm
1812 S16 RgLiTfuSchBndCfm(pst, suId, status)
1819 RgSchLowSapCb *tfuSap;
1820 Inst instId = pst->dstInst - SCH_INST_START;
1822 if(suId >= rgSchCb[instId].numSaps)
1824 RLOG_ARG0(L_ERROR,DBG_INSTID,instId, "Incorrect SuId");
1827 /* Lets validate suId first */
1828 tfuSap = &(rgSchCb[instId].tfuSap[suId]);
1830 if (suId != tfuSap->sapCfg.suId)
1832 RLOG_ARG2(L_ERROR,DBG_INSTID,instId, "Incorrect SuId. Configured (%d)"
1833 "Recieved (%d)", tfuSap->sapCfg.suId, suId);
1836 ret = rgSCHLmmBndCfm (pst, suId, status);
1838 } /* RgLiTfuSchBndCfm */
1841 * @brief Random Access Request indication from PHY.
1845 * Function : RgLiTfuRaReqInd
1847 * This API is invoked by PHY to send Random Access Request to Scheduler.
1848 * This API contains information for Random Access Request including
1849 * raRnti, list of associated RAPIDs and related information.
1851 * @param[in] Pst *pst
1852 * @param[in] SuId suId
1853 * @param[in] TfuRaReqIndInfo *raReqInd
1863 TfuRaReqIndInfo *raReqInd
1866 S16 RgLiTfuRaReqInd(pst, suId, raReqInd)
1869 TfuRaReqIndInfo *raReqInd;
1873 Inst inst = pst->dstInst-SCH_INST_START;
1875 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
1877 RLOG_ARG1(L_ERROR,DBG_INSTID,inst,"SAP Validation failed SuId(%d)", suId);
1878 /* Free up the memory for the request structure */
1879 RGSCH_FREE_MEM(raReqInd);
1883 if(raReqInd == NULLP)
1885 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"Invalid input pointer for raReqInd Failed");
1889 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
1891 RLOG_ARG0(L_ERROR,DBG_CELLID,raReqInd->cellId,"No cell exists");
1895 ret = rgSCHTomRaReqInd(rgSchCb[inst].tfuSap[suId].cell, raReqInd);
1896 /* Free up the memory for the request structure */
1897 RGSCH_FREE_MEM(raReqInd);
1898 /*SPutSBuf (pst->region, pst->pool, (Data *)raReqInd,
1899 sizeof(TfuRaReqIndInfo)); */
1901 } /* RgLiTfuRaReqInd */
1904 * @brief Uplink CQI indication from PHY.
1908 * Function : RgLiTfuUlCqiInd
1910 * This API is invoked by PHY to send Uplink CQI to Scheduler.
1911 * This API contains Uplink CQI information reported per UE.
1913 * @param[in] Pst *pst
1914 * @param[in] SuId suId
1915 * @param[in] TfuUlCqiIndInfo *ulCqiInd
1925 TfuUlCqiIndInfo *ulCqiInd
1928 S16 RgLiTfuUlCqiInd(pst, suId, ulCqiInd)
1931 TfuUlCqiIndInfo *ulCqiInd;
1935 Inst inst = pst->dstInst-SCH_INST_START;
1937 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
1939 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
1940 /* Free up the memory for the request structure */
1941 RGSCH_FREE_MEM(ulCqiInd);
1945 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
1947 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
1948 /* Free up the memory for the request structure */
1949 RGSCH_FREE_MEM(ulCqiInd);
1952 ret = rgSCHTomUlCqiInd (rgSchCb[inst].tfuSap[suId].cell, ulCqiInd);
1953 /* Free up the memory for the request structure */
1954 RGSCH_FREE_MEM(ulCqiInd);
1956 } /* RgLiTfuUlCqiInd */
1959 * @brief PUCCH power adjustment indication.
1963 * Function : RgLiTfuPucchDeltaPwrInd
1965 * This API is invoked by PHY to send PUCCH power adjustment
1968 * @param[in] Pst *pst
1969 * @param[in] SuId suId
1970 * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
1976 S16 RgLiTfuPucchDeltaPwrInd
1980 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
1983 S16 RgLiTfuPucchDeltaPwrInd(pst, suId, pucchDeltaPwr)
1986 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr;
1990 Inst inst = pst->dstInst-SCH_INST_START;
1992 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
1994 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
1995 /* Free up the memory for the request structure */
1996 RGSCH_FREE_MEM(pucchDeltaPwr);
2000 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2002 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2005 ret = rgSCHTomPucchDeltaPwrInd (rgSchCb[inst].tfuSap[suId].cell, pucchDeltaPwr);
2006 /* Free up the memory for the request structure */
2007 RGSCH_FREE_MEM(pucchDeltaPwr);
2009 } /* RgLiTfuPucchDeltaPwrInd */
2013 * @brief HARQ ACK indication from PHY for Downlink transmissions.
2017 * Function : RgLiTfuHqInd
2019 * This API is invoked by PHY to send HARQ ACK information to Scheduler
2020 * on recieving HARQ ACK/NACK from UEs.
2021 * This API contains HARQ ACK information recieved by PHY for downlink
2024 * @param[in] Pst *pst
2025 * @param[in] SuId suId
2026 * @param[in] TfuHqIndInfo *harqAckInd
2036 TfuHqIndInfo *harqAckInd
2039 S16 RgLiTfuHqInd(pst, suId, harqAckInd)
2042 TfuHqIndInfo *harqAckInd;
2046 Inst inst = (pst->dstInst - SCH_INST_START);
2050 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2052 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2053 RGSCH_FREE_MEM(harqAckInd);
2057 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2059 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2064 /* Now call the TOM (Tfu ownership module) primitive to process further */
2065 ret = rgSCHTomHarqAckInd (rgSchCb[inst].tfuSap[suId].cell, harqAckInd);
2066 /* Free up the memory for the request structure */
2067 RGSCH_FREE_MEM(harqAckInd);
2069 } /* RgLiTfuHqInd */
2073 * @brief Scheduling request(SR) indication from PHY for an UE.
2077 * Function : RgLiTfuSrInd
2079 * This API is invoked by PHY to send Scheduling request information to
2080 * Scheduler on recieving SR from a list of UEs.
2081 * This API contains scheduling request information recieved by PHY for UEs.
2083 * @param[in] Pst *pst
2084 * @param[in] SuId suId
2085 * @param[in] TfuSrIndInfo *srInd
2098 S16 RgLiTfuSrInd(pst, suId, srInd)
2101 TfuSrIndInfo *srInd;
2105 Inst inst = pst->dstInst-SCH_INST_START;
2108 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2110 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"() SAP Validation failed");
2111 RGSCH_FREE_MEM(srInd);
2115 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2117 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"RgLiTfuSrInd()No cell exists");
2121 /* Now call the TOM (Tfu ownership module) primitive to process further */
2122 ret = rgSCHTomSrInd (rgSchCb[inst].tfuSap[suId].cell, srInd);
2123 /* Free up the memory for the request structure */
2124 RGSCH_FREE_MEM(srInd);
2126 } /* RgLiTfuSrInd */
2130 * @brief Downlink CQI indication from PHY for an UE.
2134 * Function : RgLiTfuDlCqiInd
2136 * This API is invoked by PHY to send Downlink CQI indication to Scheduler
2137 * on recieving downlink CQI from UE.
2138 * This API contains downlink CQI information recieved by PHY for an UE.
2140 * @param[in] Pst *pst
2141 * @param[in] SuId suId
2142 * @param[in] TfuDlCqiIndInfo *dlCqiInd
2152 TfuDlCqiIndInfo *dlCqiInd
2155 S16 RgLiTfuDlCqiInd(pst, suId, dlCqiInd)
2158 TfuDlCqiIndInfo *dlCqiInd;
2162 Inst inst = pst->dstInst-SCH_INST_START;
2164 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2166 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed");
2167 /* Free up the memory for the request structure */
2168 RGSCH_FREE_MEM(dlCqiInd);
2172 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2174 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2177 ret = rgSCHTomDlCqiInd (rgSchCb[inst].tfuSap[suId].cell, dlCqiInd);
2178 /* Free up the memory for the request structure */
2179 RGSCH_FREE_MEM(dlCqiInd);
2181 } /* RgLiTfuDlCqiInd */
2185 * @brief Raw CQI indication from PHY for an UE.
2189 * Function : RgLiTfuRawCqiInd
2191 * This API is invoked by PHY to send Raw CQI indication to Scheduler
2192 * on receiving Raw CQI from UE.
2193 * This API contains Raw CQI information recieved by PHY for an UE.
2195 * @param[in] Pst *pst
2196 * @param[in] SuId suId
2197 * @param[in] TfuRawCqiIndInfo *rawCqiInd
2203 S16 RgLiTfuRawCqiInd
2207 TfuRawCqiIndInfo *rawCqiInd
2210 S16 RgLiTfuRawCqiInd(pst, suId, rawCqiInd)
2213 TfuRawCqiIndInfo *rawCqiInd;
2217 Inst inst = pst->dstInst-SCH_INST_START;
2220 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2222 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2223 /* Free up the memory for the request structure */
2224 RGSCH_FREE_MEM(rawCqiInd);
2228 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2230 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," No cell exists");
2234 ret = rgSCHTomRawCqiInd (rgSchCb[inst].tfuSap[suId].cell, rawCqiInd);
2235 /* Free up the memory for the request structure */
2236 RGSCH_FREE_MEM(rawCqiInd);
2238 } /* RgLiTfuRawCqiInd */
2241 * @brief SRS indication from PHY for an UE.
2245 * Function : RgLiTfuSrsInd
2247 * This API is invoked by PHY to send UL SRS indication to Scheduler
2248 * on receiving a SRS from UE.
2249 * This API contains SRS information recieved by PHY for an UE.
2251 * @param[in] Pst *pst
2252 * @param[in] SuId suId
2253 * @param[in] TfuSrsIndInfo *srsInd
2263 TfuSrsIndInfo *srsInd
2266 S16 RgLiTfuSrsInd(pst, suId, srsInd)
2269 TfuSrsIndInfo *srsInd;
2273 Inst inst = pst->dstInst-SCH_INST_START;
2275 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2277 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed");
2278 /* Free up the memory for the request structure */
2279 RGSCH_FREE_MEM(srsInd);
2283 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2285 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2288 ret = rgSCHTomSrsInd (rgSchCb[inst].tfuSap[suId].cell, srsInd);
2289 /* Free up the memory for the request structure */
2290 RGSCH_FREE_MEM(srsInd);
2292 } /* RgLiTfuSrsInd */
2297 * @brief DOA indication from PHY for an UE.
2301 * Function : RgLiTfuDoaInd
2303 * This API is invoked by PHY to send Direction Of Arrival to Scheduler
2304 * on calculating DOA at PHYSICAL LAYER for an UE.
2305 * This API contains DOA information calculated by PHY for an UE.
2307 * @param[in] Pst *pst
2308 * @param[in] SuId suId
2309 * @param[in] TfuDoaIndInfo *doaInd
2319 TfuDoaIndInfo *doaInd
2322 S16 RgLiTfuDoaInd(pst, suId, doaInd)
2325 TfuDoaIndInfo *doaInd;
2329 Inst inst = pst->dstInst-SCH_INST_START;
2331 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2333 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2334 /* Free up the memory for the request structure */
2335 RGSCH_FREE_MEM(doaInd);
2339 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2341 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2344 ret = rgSCHTomDoaInd (rgSchCb[inst].tfuSap[suId].cell, doaInd);
2345 /* Free up the memory for the request structure */
2346 RGSCH_FREE_MEM(doaInd);
2348 } /* RgLiTfuDlCqiInd */
2351 * @brief CRC indication from PHY.
2355 * Function : RgLiTfuCrcInd
2357 * This API is invoked by PHY to give CRC indication to scheduler.
2359 * @param[in] Pst *pst
2360 * @param[in] SuId suId
2361 * @param[in] TfuCrcIndInfo *crcInd
2371 TfuCrcIndInfo *crcInd
2374 S16 RgLiTfuCrcInd (pst, suId, crcInd)
2377 TfuCrcIndInfo *crcInd;
2381 Inst inst = pst->dstInst-SCH_INST_START;
2383 #ifdef XEON_SPECIFIC_CHANGES
2384 struct timeval start6, end6;
2385 gettimeofday(&start6, NULL);
2388 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2390 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2391 RGSCH_FREE_MEM(crcInd);
2395 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2397 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2402 /* Now call the TOM (Tfu ownership module) primitive to process further */
2403 ret = rgSCHTomCrcInd(rgSchCb[inst].tfuSap[suId].cell, crcInd);
2404 /* Free up the memory for the request structure */
2405 RGSCH_FREE_MEM(crcInd);
2406 #ifdef XEON_SPECIFIC_CHANGES
2407 gettimeofday(&end6, NULL);
2410 } /* RgLiTfuCrcInd */
2413 * @brief Timing Advance indication from PHY.
2417 * Function : RgLiTfuTimingAdvInd
2419 * This API is invoked by PHY to indicate timing advance to Scheduler for
2422 * @param[in] Pst *pst
2423 * @param[in] SuId suId
2424 * @param[in] TfuTimingAdvIndInfo *timingAdvInd
2430 S16 RgLiTfuTimingAdvInd
2434 TfuTimingAdvIndInfo *timingAdvInd
2437 S16 RgLiTfuTimingAdvInd(pst, suId, timingAdvInd)
2440 TfuTimingAdvIndInfo *timingAdvInd;
2444 Inst inst = pst->dstInst-SCH_INST_START;
2446 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2448 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2449 /* Free up the memory for the request structure */
2450 RGSCH_FREE_MEM(timingAdvInd);
2454 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2456 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2459 /* Now call the TOM (Tfu ownership module) primitive to process further */
2460 ret = rgSCHTomTimingAdvInd(rgSchCb[inst].tfuSap[suId].cell, timingAdvInd);
2461 /* Free up the memory for the request structure */
2462 RGSCH_FREE_MEM(timingAdvInd);
2464 } /* RgLiTfuTimingAdvInd */
2466 /************* RGM Interface ****************/
2468 * @brief API for bind request from RRM towards MAC.
2472 * Function: RgUiRgmBndReq
2474 * This API is invoked by RRM towards MAC to bind RGM SAP.
2475 * These API validates the Pst, spId, suId and sends the bind confirm to
2479 * @param[in] Pst *pst
2480 * @param[in] SuId suId
2481 * @param[in] SpId spId
2494 S16 RgUiRgmBndReq(pst, suId, spId)
2501 Pst tmpPst; /* Temporary Post Structure */
2502 Inst instId = pst->dstInst-SCH_INST_START;
2504 tmpPst.prior = pst->prior;
2505 tmpPst.route = pst->route;
2506 tmpPst.selector = pst->selector;
2507 tmpPst.region = rgSchCb[instId].rgSchInit.region;
2508 tmpPst.pool = rgSchCb[instId].rgSchInit.pool;
2510 tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId;
2511 tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent;
2512 tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + SCH_INST_START;
2514 tmpPst.event = EVTNONE;
2516 tmpPst.dstProcId = pst->srcProcId;
2517 tmpPst.dstEnt = pst->srcEnt;
2518 tmpPst.dstInst = pst->srcInst;
2520 /*TODO remove follo statement*/
2521 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND;
2523 if(spId < rgSchCb[instId].numSaps)
2525 /* Check the state of the SAP */
2526 switch (rgSchCb[instId].rgmSap[spId].sapSta.sapState)
2528 /* This case might not be needed if SAP not configured then it will go
2529 * to else of above if condition */
2530 case LRG_UNBND: /* SAP is not bound */
2531 RLOG0(L_DEBUG,"SAP is not yet bound");
2532 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_BND;
2533 rgSchCb[instId].rgmSap[spId].sapCfg.suId = suId;
2534 /* Send Bind Confirm with status as SUCCESS */
2535 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK);
2536 /*Indicate to Layer manager */
2538 case LRG_BND: /* SAP is already bound*/
2539 RLOG0(L_DEBUG,"SAP is already bound");
2540 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK);
2542 default: /* Should Never Enter here */
2543 #if (ERRCLASS & ERRCLS_ADD_RES)
2544 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001,
2545 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2546 "Invalid SAP State:RgUiRgmBndReq failed\n");
2548 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_NOK);
2554 #if (ERRCLASS & ERRCLS_ADD_RES)
2555 /* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state
2556 to spId to avoid seg fault due to invalid sapID */
2557 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002,
2558 (ErrVal)spId, "Invalid SAP Id:RgUiRrmBndReq failed\n");
2560 ret = RgUiRgmBndCfm(&tmpPst, suId, CM_BND_NOK);
2563 } /* RgUiRgmBndReq */
2566 * @brief API for unbind request from RRM towards MAC.
2570 * Function: RgUiRgmUbndReq
2572 * This API is invoked by RRM towards MAC to unbind RGM SAP.
2573 * These API validates the Pst, spId, suId and transfers the unbind request
2574 * specific information to corresponding ownership module (GOM) API.
2577 * @param[in] Pst *pst
2578 * @param[in] SuId suId
2579 * @param[in] Reason reason
2592 S16 RgUiRgmUbndReq(pst, spId, reason)
2598 Inst instId = pst->dstInst-SCH_INST_START;
2600 /* SAP Id validation */
2601 if (spId < rgSchCb[instId].numSaps)
2603 switch(rgSchCb[instId].rgmSap[spId].sapSta.sapState)
2605 case LRG_BND: /* SAP is already bound*/
2606 /* setting SAP state to UN BOUND */
2607 RLOG0(L_DEBUG,"SAP is already bound");
2608 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND;
2611 #if (ERRCLASS & ERRCLS_ADD_RES)
2612 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003,
2613 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2614 "Invalid SAP State: RgUiRgmUbndReq failed\n");
2621 #if (ERRCLASS & ERRCLS_ADD_RES)
2622 RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004,
2623 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2624 "Invalid SAP Id:RgUiRgmUbndReq failed\n");
2629 } /* RgUiRgmUbndReq */
2633 * @brief API for start or stop PRB reporting from RRM towards MAC.
2637 * Function: RgUiRgmCfgPrbRprt
2639 * This API is invoked by RRM towards MAC to start or stop calculating
2640 * Average PRB usage in downlink and uplink. The average PRB usage will
2641 * be reported to RRM based on confiured periodicity.
2644 * @param[in] Pst *pst
2645 * @param[in] SuId suId
2646 * @param[in] SpId spId
2652 S16 RgUiRgmCfgPrbRprt
2656 RgmPrbRprtCfg *prbRprtCfg
2659 S16 RgUiRgmCfgPrbRprt(pst, spId, prbRprtCfg)
2662 RgmPrbRprtCfg *prbRprtCfg;
2667 RgSchPrbUsage *prbUsage;
2668 Inst inst = (pst->dstInst - SCH_INST_START);
2670 cell = rgSchCb[inst].rgmSap[spId].cell;
2671 prbUsage = &cell->prbUsage;
2672 prbUsage->prbRprtEnabld = prbRprtCfg->bConfigType;
2673 prbUsage->rprtPeriod = prbRprtCfg->usPrbAvgPeriodicty;
2674 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, prbUsage->startTime, 1);
2676 /* clear the qciPrbRpts for all GBR QCIs */
2677 memset(&prbUsage->qciPrbRpts[0], 0,
2678 (RGM_MAX_QCI_REPORTS * sizeof(RgSchQciPrbUsage)));
2680 RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId,
2681 "RgUiRgmCfgPrbRprt config type %d with the report period %d",
2682 prbUsage->prbRprtEnabld,prbUsage->rprtPeriod);
2684 /* ccpu00134393 : mem leak fix */
2685 SPutSBuf(pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
2690 * @brief ERROR INDICATION from PHY for the i failed unlicensed Scell transmission.
2694 * Function : RgLiTfuErrInd
2696 * This API is invoked by PHY to send ERROR INDICATION to scheduler
2697 * Currently invoked in the cases when the Unlicensed SCell transmission
2699 * This API contains the Cell and subframe information for which the
2700 * transmission failed.
2702 * @param[in] Pst *pst
2703 * @param[in] SuId suId
2704 * @param[in] TfuErrIndInfo *errIndInfo
2714 TfuErrIndInfo *errInd
2717 S16 RgLiTfuErrInd(pst, suId, errInd)
2720 TfuErrIndInfo *errInd;
2725 Inst inst = (pst->dstInst - SCH_INST_START);
2729 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2732 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2736 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2738 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2744 /* Now call the TOM (Tfu ownership module) primitive to process further */
2745 ret = rgSCHLaaErrInd(rgSchCb[inst].tfuSap[suId].cell, errInd);
2748 } /* RgLiTfuErrInd */
2752 /**********************************************************************
2755 **********************************************************************/