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 EXTERN S16 rgEmtcMacSchUeDelInd ARGS((RgSchCellCb *cell,RgInfUeDelInd *ueDelInd));
64 EXTERN S16 rgSCHGomEmtcHndlSiCfg ARGS((
69 RgrCfgTransId transId,
70 RgrSiCfgReqInfo *cfgReqInfo
72 EXTERN 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 PUBLIC S16 RgMiLrgSchCntrlReq
106 Pst *pst, /* post structure */
107 RgMngmt *cntrl /* control structure */
110 PUBLIC 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 */
120 TRC3(RgMiLrgSchCntrlReq)
123 /* Fill the post structure for sending the confirmation */
124 SchFillCfmPst(pst, &cfmPst, cntrl);
126 /* Initialize the cfg cfm structure
127 if (SGetSBuf(cfmPst.region, cfmPst.pool, (Data **)&cfm, sizeof(RgMngmt))
130 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Memory Unavailable for Confirmation");
131 SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt));
134 cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
141 cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
142 cfm.t.cntrl.action = cntrl->t.cntrl.action;
143 cfm.t.cntrl.subAction = cntrl->t.cntrl.subAction;
145 /* Check if General Config Done*/
146 if(rgSchCb[inst].rgSchInit.cfgDone != TRUE)
148 cfm.cfm.status = LCM_PRIM_NOK;
149 cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
150 cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
151 RgMiLrgSchCntrlCfm(&cfmPst, &cfm);
152 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Gen Cfg not done.");
153 /* SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); */
157 /* General Config done, process the Control request */
158 switch(cntrl->hdr.elmId.elmnt)
161 rgSCHLmmGenCntrl(cntrl, &cfm, &cfmPst);
165 rgSCHLmmSapCntrl(cntrl, &cfm, &cfmPst);
168 cfm.cfm.status = LCM_PRIM_NOK;
169 cfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL;
170 RgMiLrgSchCntrlCfm(&cfmPst, &cfm);
171 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "invalid elmnt=%d",
172 cntrl->hdr.elmId.elmnt);
175 /* SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); */
177 }/*-- RgMiLrgSchCntrlReq --*/
181 * @brief Layer Manager L2 Measurement request handler.
185 * Function : RgMiLrgSchL2MeasReq
187 * This function handles the control
188 * measurement request received from the Layer Manager.
190 * @param[in] Pst *pst, the post structure
191 * @param[in] LrgSchMeasReqInfo *measInfo, measurement request info
196 PUBLIC S16 RgMiLrgSchL2MeasReq
198 Pst *pst, /* post structure */
199 LrgSchMeasReqInfo *measInfo /* Meas Req Info */
202 PUBLIC S16 RgMiLrgSchL2MeasReq(pst, measInfo)
203 Pst *pst; /* post structure */
204 LrgSchMeasReqInfo *measInfo; /* Meas Req Info */
211 RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
212 #if (ERRCLASS & ERRCLS_ADD_RES)
216 RgSchL2MeasCb *measCb = NULLP;
218 Inst inst = (pst->dstInst - SCH_INST_START); /* Scheduler instance Id */
224 TRC3(RgMiLrgSchL2MeasReq)
227 /* Find the cellCb using cellId in measInfo. Iterate through all cells
228 * in rgrsapCb in RgschCb */
230 for (idx = 0; idx < instCb->numSaps; idx++)
232 if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
234 /* got the cell break the loop */
235 cell = instCb->rgrSap[idx].cell;
239 /* If no cellCb return Err with Invalid Cell Id */
242 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
243 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_CELLID);
244 rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE);
245 RLOG_ARG2(L_ERROR,DBG_INSTID,inst,
246 "Meas req Failed.Invalid Cell Id errType(%d) errCause(%d)",
247 err.errType, err.errCause);
250 /* Validate for Meas Types */
251 if ( (ret = rgSCHUtlValidateMeasReq(cell, measInfo, &err)) != ROK)
253 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
254 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_MEASTYPE);
255 rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE);
256 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
257 "Meas req Failed.Invalid Measurement Type"
258 "errCasue(%d) errType(%d)", err.errType, err.errCause);
261 /* Iterate through all meas requests in l2mList in cellCb */
262 #if (ERRCLASS & ERRCLS_ADD_RES)
263 lnk = cell->l2mList.first;
266 /* Get the MeasCb : RgSchL2MeasCb */
267 measCb = (RgSchL2MeasCb *)lnk->node;
269 if (measCb->measReq.hdr.transId == measInfo->hdr.transId)
271 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
272 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_DUP_TRANSID);
273 rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE);
274 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
275 "Meas req Failed.Dublicate TransId"
276 "errType(%d) errCause(%d)", err.errType, err.errCause);
281 /* Call L2M Function to store Meas req */
282 ret = rgSchL2mMeasReq(cell, measInfo, err);
285 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
286 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_L2MEAS_FAILED);
287 rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE);
288 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
289 "Meas req Failed.errType(%d) errCause(%d)",
290 err.errType, err.errCause);
294 } /* -- RRgMiLrgSchL2MeasReq-- */
297 * @brief Layer Manager L2 Measurement Stop request handler.
301 * Function : RgMiLrgSchL2MeasStopReq
303 * This function handles the control
304 * measurement stop request received from the Layer Manager.
306 * @param[in] Pst *pst, the post structure
307 * @param[in] LrgSchMeasReqInfo *measInfo, measurement stop request info
312 PUBLIC S16 RgMiLrgSchL2MeasStopReq
314 Pst *pst, /* post structure */
315 LrgSchMeasStopReqInfo *measInfo /* Meas Req Info */
318 PUBLIC S16 RgMiLrgSchL2MeasStopReq(pst, measInfo)
319 Pst *pst; /* post structure */
320 LrgSchMeasStopReqInfo *measInfo; /* Meas Req Info */
324 RgSchCellCb *cell = NULLP;
325 RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
326 CmLList *node = NULLP;
327 RgSchL2MeasCb *measCb = NULLP;
328 LrgSchMeasCfmInfo measCfm;
332 TRC3(RgMiLrgSchL2MeasStopReq)
335 for (idx = 0; idx < instCb->numSaps; idx++)
337 if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
339 /* got the cell break the loop */
340 cell = instCb->rgrSap[idx].cell;
346 RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId,
347 "Stop req Failed.Invalid Cell Id ");
350 cmMemset((U8 *)&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
351 node = cell->l2mList.first;
354 measCb = (RgSchL2MeasCb *)(node)->node;
357 cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
358 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,
359 sizeof(RgSchL2MeasCb));
362 if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
364 RgInfL2MeasStopReq measStopReq;
366 cmMemset((U8 *)&measStopReq, 0, sizeof(RgInfL2MeasStopReq));
367 measStopReq.transId = measInfo->hdr.transId;
368 measStopReq.measType = measInfo->measType;
369 /* measReq.timePrd = measInfo->timePrd; */
370 measStopReq.cellId = measInfo->cellId;
371 rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst);
372 RgSchMacL2MeasStop(&pstMac,&measStopReq);
376 RgMiLrgSchL2MeasStopCfm(&(rgSchCb[cell->instIdx].rgSchInit.lmPst),
380 }/*RgMiLrgSchL2MeasStopReq*/
382 * @brief Layer Manager L2 Measurement request handler.
383 * for Send l2 measurement req
386 * Function : RgMiLrgSchL2MeasSendReq
388 * This function handles the control
389 * measurement send request received from the Layer Manager.
391 * @param[in] Pst *pst, the post structure
392 * @param[in] LrgSchMeasReqInfo *measInfo, measurement stop request info
397 PUBLIC S16 RgMiLrgSchL2MeasSendReq
399 Pst *pst, /* post structure */
400 LrgSchMeasSndReqInfo *measInfo /* Meas Req Info */
403 PUBLIC S16 RgMiLrgSchL2MeasSendReq(pst, measInfo)
404 Pst *pst; /* post structure */
405 LrgSchMeasSndReqInfo *measInfo; /* Meas Req Info */
410 RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
413 TRC3(RgMiLrgSchL2MeasSendReq)
418 for (idx = 0; idx < instCb->numSaps; idx++)
420 if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
422 /* got the cell break the loop */
423 cell = instCb->rgrSap[idx].cell;
429 RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId,
430 "Send req Failed.Invalid Cell Id");
434 if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
436 RgInfL2MeasSndReq measSndReq;
438 cmMemset((U8 *)&measSndReq, 0, sizeof(RgInfL2MeasSndReq));
439 measSndReq.transId = measInfo->hdr.transId;
440 measSndReq.measType = measInfo->measType;
441 measSndReq.timePrd = measInfo->timePrd;
442 measSndReq.cellId = measInfo->cellId;
443 rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst);
444 RgSchMacL2MeasSend(&pstMac, &measSndReq);
448 cell->sndL2Meas = TRUE;
452 }/*RgMiLrgSchL2MeasSendReq*/
453 #endif /* LTE_L2_MEAS */
458 /************* RGR Interface ****************/
460 * @brief API for bind request from RRM towards MAC.
464 * Function: RgUiRgrBndReq
466 * This API is invoked by RRM towards MAC to bind RGR SAP.
467 * These API validates the Pst, spId, suId and sends the bind confirm to
471 * @param[in] Pst *pst
472 * @param[in] SuId suId
473 * @param[in] SpId spId
479 PUBLIC S16 RgUiRgrBndReq
486 PUBLIC S16 RgUiRgrBndReq(pst, suId, spId)
493 Pst tmpPst; /* Temporary Post Structure */
494 Inst instId = pst->dstInst-SCH_INST_START;
495 RgUstaDgn dgn; /* Alarm diagnostics structure */
500 tmpPst.prior = pst->prior;
501 tmpPst.route = pst->route;
502 tmpPst.selector = pst->selector;
503 tmpPst.region = rgSchCb[instId].rgSchInit.region;
504 tmpPst.pool = rgSchCb[instId].rgSchInit.pool;
505 tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId;
506 tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent;
507 tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + SCH_INST_START;
508 tmpPst.event = EVTNONE;
509 tmpPst.dstProcId = pst->srcProcId;
510 tmpPst.dstEnt = pst->srcEnt;
511 tmpPst.dstInst = pst->srcInst;
513 if(spId < rgSchCb[instId].numSaps)
515 /* Check the state of the SAP */
516 switch (rgSchCb[instId].rgrSap[spId].sapSta.sapState)
518 /* This case might not be needed if SAP not configured then it will go
519 * to else of above if condition */
520 case LRG_UNBND: /* SAP is not bound */
521 RLOG0(L_DEBUG,"SAP Not yet bound");
522 rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_BND;
523 rgSchCb[instId].rgrSap[spId].sapCfg.suId = suId;
524 /* Send Bind Confirm with status as SUCCESS */
525 ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK);
526 /*Indicate to Layer manager */
527 rgSCHUtlFillDgnParams(instId, &dgn, LRG_USTA_DGNVAL_MEM);
528 ret = rgSCHLmmStaInd(instId, LCM_CATEGORY_INTERFACE,
529 LRG_EVENT_RGRSAP_ENB, LCM_CAUSE_UNKNOWN, &dgn);
531 case LRG_BND: /* SAP is already bound*/
532 RLOG0(L_DEBUG,"SAP is already bound");
533 ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK);
535 default: /* Should Never Enter here */
536 #if (ERRCLASS & ERRCLS_ADD_RES)
537 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001,
538 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
539 "Invalid SAP State:RgUiRrgBndReq failed\n");
541 ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_NOK);
547 #if (ERRCLASS & ERRCLS_ADD_RES)
548 /* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state
549 to spId to avoid seg fault due to invalid sapID */
550 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002,
551 (ErrVal)spId, "Invalid SAP Id:RgUiRrgBndReq failed\n");
553 ret = RgUiRgrBndCfm(&tmpPst, suId, CM_BND_NOK);
556 } /* RgUiRgrBndReq */
559 * @brief API for unbind request from RRM towards MAC.
563 * Function: RgUiRgrUbndReq
565 * This API is invoked by RRM towards MAC to unbind RGR SAP.
566 * These API validates the Pst, spId, suId and transfers the unbind request
567 * specific information to corresponding ownership module (GOM) API.
570 * @param[in] Pst *pst
571 * @param[in] SuId suId
572 * @param[in] Reason reason
578 PUBLIC S16 RgUiRgrUbndReq
585 PUBLIC S16 RgUiRgrUbndReq(pst, spId, reason)
591 Inst instId = pst->dstInst-SCH_INST_START;
595 /* SAP Id validation */
596 if (spId < rgSchCb[instId].numSaps)
598 switch(rgSchCb[instId].rgrSap[spId].sapSta.sapState)
600 case LRG_BND: /* SAP is already bound*/
601 RLOG0(L_DEBUG,"SAP is already bound");
602 /* setting SAP state to UN BOUND */
603 rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_UNBND;
606 #if (ERRCLASS & ERRCLS_ADD_RES)
607 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003,
608 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
609 "Invalid SAP State: RgUiRgrUbndReq failed\n");
616 #if (ERRCLASS & ERRCLS_ADD_RES)
617 RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004,
618 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
619 "Invalid SAP Id:RgUiRgrUbndReq failed\n");
624 } /* RgUiRgrUbndReq */
628 * @brief API for SI configuration request from RRM towards MAC.
632 * Function: RgUiRgrSiCfgReq
634 * This API is invoked by RRM towards MAC to configure SI at MAC.
635 * These API validates the Pst, spId, suId and transfers the
636 * config request specific information to corresponding ownership
640 * @param[in] Pst *pst
641 * @param[in] SpId spId
642 * @param[in] RgrCfgTransId transId
643 * @param[in] RgrSiCfgReqInfo *cfgReqInfo
649 PUBLIC S16 RgUiRgrSiCfgReq
653 RgrCfgTransId transId,
654 RgrSiCfgReqInfo *cfgReqInfo
657 PUBLIC S16 RgUiRgrSiCfgReq(pst, spId, transId, cfgReqInfo)
660 RgrCfgTransId transId;
661 RgrSiCfgReqInfo *cfgReqInfo;
665 U8 cfmStatus = RGR_CFG_CFM_NOK;
666 U8 prntTrans[RGR_CFG_TRANSID_SIZE+1];
667 Inst instId = pst->dstInst-SCH_INST_START;
669 TRC2(RgUiRgrSiCfgReq);
671 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
672 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
675 if (cfgReqInfo == NULLP)
677 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
679 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
683 if (spId < rgSchCb[instId].numSaps)
685 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
687 #if (ERRCLASS & ERRCLS_ADD_RES)
688 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007,
689 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
690 "Invalid SAP State: RgUiRgrSiCfgReq failed\n");
692 SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
693 (Size)sizeof(*cfgReqInfo));
694 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
700 #if (ERRCLASS & ERRCLS_ADD_RES)
701 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008,
702 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
703 "Invalid SAP Id:RgUiRgrSiCfgReq failed\n");
705 SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
706 (Size)sizeof(*cfgReqInfo));
707 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
711 /* Handle configuration */
713 if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable)
715 ret = rgSCHGomEmtcHndlSiCfg(pst->region, pst->pool,
716 &rgSchCb[instId], spId, transId,
721 ret = rgSCHGomHndlSiCfg(pst->region, pst->pool,
722 &rgSchCb[instId], spId, transId,
726 ret = rgSCHGomHndlSiCfg(pst->region, pst->pool,
727 &rgSchCb[instId], spId, transId,
732 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"RgUiRgrSiCfgReq:"
733 "Configuration Request Handling Failed");
738 } /* RgUiRgrSiCfgReq */
742 * @brief API for Warning SI configuration request from RRM towards MAC.
746 * Function: RgUiRgrWarningSiCfgReq
748 * This API is invoked by RRM towards MAC to configure SI at MAC.
749 * These API validates the Pst, spId, suId and transfers the
750 * config request specific information to corresponding ownership
754 * @param[in] Pst *pst
755 * @param[in] SpId spId
756 * @param[in] RgrCfgTransId transId
757 * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
763 PUBLIC S16 RgUiRgrWarningSiCfgReq
767 RgrCfgTransId transId,
768 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
771 PUBLIC S16 RgUiRgrWarningSiCfgReq(pst, spId, transId, warningSiCfgReqInfo)
774 RgrCfgTransId transId;
775 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo;
778 Inst instId = pst->dstInst-SCH_INST_START;
780 U8 cfmStatus = RGR_CFG_CFM_NOK;
781 U8 prntTrans[RGR_CFG_TRANSID_SIZE+1];
783 TRC2(RgUiRgrWarningSiCfgReq);
785 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
786 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
790 if (warningSiCfgReqInfo == NULLP)
792 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
794 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, 0, transId, cfmStatus);
798 if (spId < rgSchCb[instId].numSaps)
800 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
802 #if (ERRCLASS & ERRCLS_ADD_RES)
803 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG023,
804 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
805 "Invalid SAP State: warningSiCfgReqInfo failed\n");
807 rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool,
808 &warningSiCfgReqInfo->siPduLst);
809 SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
810 sizeof(RgrWarningSiCfgReqInfo));
811 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId,
818 #if (ERRCLASS & ERRCLS_ADD_RES)
819 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG024,
820 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
821 "Invalid SAP Id:warningSiCfgReqInfo failed\n");
823 rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool,
824 &warningSiCfgReqInfo->siPduLst);
825 SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
826 sizeof(RgrWarningSiCfgReqInfo));
827 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId,
832 /* Handle configuration */
834 if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable)
836 ret = rgSCHGomEmtcHndlWarningSiCfg(pst->region, pst->pool,
837 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
841 ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool,
842 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
845 ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool,
846 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
850 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,
851 "Configuration Request Handling Failed");
860 * @brief API for Warning SI Stop request from RRM towards MAC.
864 * Function: RgUiRgrWarningSiStopReq
866 * This API is invoked by RRM towards MAC to Stop warning SI at MAC.
867 * These API validates the Pst, spId, suId and transfers the
868 * stop request specific information to corresponding ownership
872 * @param[in] Pst *pst
873 * @param[in] SpId spId
874 * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
880 PUBLIC S16 RgUiRgrWarningSiStopReq
884 RgrCfgTransId transId,
888 PUBLIC S16 RgUiRgrWarningSiStopReq(pst,spId, transId, siId)
891 RgrCfgTransId transId;
895 Inst instId = pst->dstInst-SCH_INST_START;
897 TRC3(RgUiRgrWarningSiStopReq)
901 if (spId < rgSchCb[instId].numSaps)
903 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
905 #if (ERRCLASS & ERRCLS_ADD_RES)
906 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG025,
907 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
908 "Invalid SAP State: RgUiRgrWarningSiStopReq failed\n");
915 #if (ERRCLASS & ERRCLS_ADD_RES)
916 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG026,
917 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
918 "Invalid SAP Id:RgUiRgrWarningSiStopReq failed\n");
923 rgSCHGomHndlWarningSiStopReq(pst->region, pst->pool,
924 &rgSchCb[instId], siId, transId, spId);
928 #endif /*RGR_SI_SCH */
930 /* LTE_ADV_FLAG_REMOVED_START */
933 * @brief API for LOAD INF request from RRM towards MAC.
937 * Function: RgUiRgrLoadInfReq
939 * This API is invoked by RRM towards MAC to configure LOAD INF Parameters at MAC.
940 * These API validates the Pst, spId, suId and transfers the
941 * LOAD INF request to corresponding ownership
945 * @param[in] Pst *pst
946 * @param[in] SpId spId
947 * @param[in] RgrCfgTransId transId
948 * @param[in] RgrLoadInfReqInfo *loadInfReq
954 PUBLIC S16 RgUiRgrLoadInfReq
958 RgrCfgTransId transId,
959 RgrLoadInfReqInfo *loadInfReq
962 PUBLIC S16 RgUiRgrLoadInfReq(pst, spId, transId, loadInfReq)
965 RgrCfgTransId transId;
966 RgrLoadInfReqInfo *loadInfReq;
970 U8 prntTrans[RGR_CFG_TRANSID_SIZE+1];
971 Inst instId = pst->dstInst-SCH_INST_START;
973 TRC2(RgUiRgrLoadInfReq);
975 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
976 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
979 if (loadInfReq == NULLP)
981 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
986 if (spId < rgSchCb[instId].numSaps)
988 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
990 #if (ERRCLASS & ERRCLS_ADD_RES)
991 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007,
992 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
993 "Invalid SAP State: RgUiRgrLoadInfReq failed\n");
995 SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq,
996 (Size)sizeof(*loadInfReq));
1002 #if (ERRCLASS & ERRCLS_ADD_RES)
1003 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008,
1004 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
1005 "Invalid SAP Id:RgUiRgrLoadInfReq failed\n");
1007 SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq,
1008 (Size)sizeof(*loadInfReq));
1012 /* Handle configuration */
1013 ret = rgSCHGomHndlLoadInf(pst->region, pst->pool,
1014 &rgSchCb[(pst->dstInst - SCH_INST_START)], spId, transId,
1018 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,
1019 "Configuration Request Handling Failed");
1024 } /* RgUiRgrLoadInfReq */
1025 /* LTE_ADV_FLAG_REMOVED_END */
1027 /************** MAC SCH Interface **************/
1029 * @brief Function for updating dedicated channel BO at scheduler from MAC.
1033 * Function : rgMacSchDedBoUpdtReq
1035 * This function shall be invoked whenever MAC gets staRsp from RLC
1036 * Scheduler shall update BO in its dedicated logical channel control block.
1038 * @param[in] Pst* pst
1039 * @param[in] S16 cellSapId
1040 * @param[in] RgInfDedBoRpt *boRpt
1045 PUBLIC S16 RgMacSchDedBoUpdtReq
1048 RgInfDedBoRpt *boRpt
1051 PUBLIC S16 RgMacSchDedBoUpdtReq(pst, boRpt)
1053 RgInfDedBoRpt *boRpt;
1063 Inst inst = (pst->dstInst - SCH_INST_START);
1064 S16 cellSapId = boRpt->cellSapId;
1066 TRC3(RgMacSchDedBoUpdtReq)
1068 RLOG_ARG2(L_DEBUG,DBG_CELLID,boRpt->cellId,"rgMacSchDedBoUpdtReq():"
1069 " boRpt->rnti = %u boRpt->lcId = %u",boRpt->rnti, boRpt->lcId);
1071 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1072 * it doesnt exist */
1073 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1076 if (cell->cellId != boRpt->cellId)
1078 /* Handle Cell fetch failure */
1079 RGSCHLOGERROR(inst, ERRCLS_INT_PAR,ERG009,(ErrVal)boRpt->cellId,
1080 "rgMacSchDedBoUpdtReq(): Invalid cell Id");
1085 /* Update Bo in the given logical channel of the UE */
1086 if ((ue = rgSCHDbmGetUeCb(cell, boRpt->rnti)) != NULLP)
1089 /* Honor BO Reports only from PCELL */
1091 if (cell != ue->cell)
1096 if ((dlLc = rgSCHDbmGetDlDedLcCb(ue, boRpt->lcId)) != NULLP)
1099 if(dlLc->lcType == CM_LTE_LCH_DTCH)
1101 if((dlLc->bo == 0) &&(boRpt->bo != 0))
1104 if(!(ue->qciActiveLCs[dlLc->qciCb->qci]))
1106 dlLc->qciCb->dlUeCount++;
1108 ue->qciActiveLCs[dlLc->qciCb->qci]++;
1110 else if((dlLc->bo != 0) && (boRpt->bo == 0) && (dlLc->qciCb->dlUeCount))
1112 /* UE is inactive */
1113 if (ue->qciActiveLCs[dlLc->qciCb->qci])
1115 ue->qciActiveLCs[dlLc->qciCb->qci]--;
1116 if (!(ue->qciActiveLCs[dlLc->qciCb->qci]))
1118 dlLc->qciCb->dlUeCount--;
1125 dlUe = RG_SCH_CMN_GET_DL_UE(ue, cell);
1126 if (boRpt->bo > dlLc->bo)
1128 dlUe->boReported += (boRpt->bo - dlLc->bo);
1132 if (boRpt->bo > dlLc->bo)
1134 ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlBo += ((boRpt->bo - dlLc->bo)<<3);
1137 /* RLC provides cumulative BO for each LC.
1138 * Reduce the left out unscheduled bo from total bo and
1139 * update the new BO to the total bo */
1140 if(ue->totalBo >= dlLc->bo)
1142 ue->totalBo -= dlLc->bo;
1146 ue->totalBo = 0; /* this case should not arise
1147 * Resetting for safety */
1150 ue->totalBo += boRpt->bo;
1151 dlLc->bo = boRpt->bo;
1152 dlLc->oldestSduArrTime = boRpt->oldestSduArrTime;
1153 dlLc->staPduBo = boRpt->staPduBo;
1155 dlLc->setMaxUlPrio = boRpt->setMaxUlPrio;
1156 dlLc->setMaxDlPrio = boRpt->setMaxDlPrio;
1157 /* Update the scheduler */
1158 rgSCHUtlDlDedBoUpd(cell, ue, dlLc);
1164 } /* end of rgMacSchDedBoUpdtReq */
1168 * @brief Function for updating common channel BO at scheduler from MAC.
1172 * Function : RgMacSchCmnBoUpdtReq
1174 * This function shall be invoked whenever MAC gets staRsp from RLC
1175 * Scheduler shall update BO in its common logical channel control block.
1177 * @param[in] Pst* pst
1178 * @param[in] S16 cellSapId
1179 * @param[in] RgInfCmnBoRpt *boRpt
1184 PUBLIC S16 RgMacSchCmnBoUpdtReq
1187 RgInfCmnBoRpt *boRpt
1190 PUBLIC S16 RgMacSchCmnBoUpdtReq(pst, boRpt)
1192 RgInfCmnBoRpt *boRpt;
1196 Inst inst = (pst->dstInst - SCH_INST_START);
1197 S16 cellSapId = boRpt->cellSapId;
1199 TRC3(RgMacSchCmnBoUpdtReq)
1201 /* No need to chk for cell being NULL as MAC would not have found instance if
1202 * it doesnt exist */
1203 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1204 if (cell->cellId != boRpt->cellId)
1206 RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():"
1207 "Invalid boRpt cell Id:%d",boRpt->cellId);
1211 /* handle status response on CCCH */
1212 if(boRpt->lcId == cell->dlCcchId)
1214 RLOG_ARG0(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():"
1215 " BO update for CCCH");
1216 rgSCHUtlHndlCcchBoUpdt(cell, boRpt);
1220 rgSCHUtlHndlBcchPcchBoUpdt(cell, boRpt);
1224 } /* end of RgMacSchCmnBoUpdtReq */
1225 /*Fix: start: Inform UE delete to scheduler*/
1227 * @brief This API is used to send data indication to Scheduler instance from MAC.
1231 * Function : rgMacSchUeDelInd
1233 * This function shall be invoked whenever MAC gets Ue delete request.
1236 * @param[in] Pst* pst
1237 * @param[in] RgInfUeDelInd *ueDelInd
1242 PUBLIC S16 RgMacSchUeDelInd
1245 RgInfUeDelInd *ueDelInd
1248 PUBLIC S16 RgMacSchUeDelInd(pst, ueDelInd)
1250 RgInfUeDelInd *ueDelInd;
1254 Inst inst = (pst->dstInst - SCH_INST_START);
1255 S16 cellSapId = ueDelInd->cellSapId;
1257 RgSchRntiLnk *rntiLnk=NULL;
1259 TRC3(RgMacSchUeDelInd)
1261 if (rgSchCb[inst].rgrSap == NULLP || rgSchCb[inst].rgrSap[cellSapId].cell == NULLP)
1263 RLOG_ARG0(L_ERROR,DBG_CELLID,ueDelInd->cellId,"rgrSap or cell is not configured");
1266 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1268 if (cell->cellId != ueDelInd->cellId)
1270 /* Handle Cell fetch failure */
1271 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1272 "rgMacSchUeDelInd(): Invalid ueDelInd cell Id:%d",
1278 CM_LLIST_FIRST_NODE(&cell->rntiDb.rntiGuardPool, tmp);
1282 rntiLnk = (RgSchRntiLnk *)(tmp->node);
1283 if(rntiLnk->rnti == ueDelInd->rnti)
1285 cmLListDelFrm(&cell->rntiDb.rntiGuardPool, tmp);
1287 rgSCHDbmRlsRnti(cell, rntiLnk);
1288 RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId,
1289 "RNTI:%d Released from the Guard pool(%ld)",
1290 ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count);
1294 CM_LLIST_NEXT_NODE(&cell->rntiDb.rntiGuardPool, tmp);
1298 rgEmtcMacSchUeDelInd(cell,ueDelInd);
1303 /* Fix : syed HO UE does not have a valid ue->rntiLnk */
1304 RLOG_ARG2(L_INFO,DBG_CELLID,ueDelInd->cellId,"HO CRNTI:%d not present in the"
1305 "Guard Pool:%ld", ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count);
1309 } /* rgMacSchUeDelInd */
1310 /*Fix: end: Inform UE delete to scheduler*/
1312 * @brief This API is used to send data indication to Scheduler instance from MAC.
1316 * Function : rgMacSchSfRecpInd
1318 * This function shall be invoked whenever MAC gets datInd on TFU
1319 * Scheduler shall act on the CEs and data that are received as part of
1322 * @param[in] Pst* pst
1323 * @param[in] S16 cellSapId
1324 * @param[in] CmLteRnti rnti
1325 * @param[in] DatIndInfo *datInd
1330 PUBLIC S16 RgMacSchSfRecpInd
1333 RgInfSfDatInd *subfrmInfo
1336 PUBLIC S16 RgMacSchSfRecpInd(pst, subfrmInfo)
1338 RgInfSfDatInd *subfrmInfo;
1344 RgInfUeDatInd *datInd;
1346 Inst inst = (pst->dstInst - SCH_INST_START);
1350 S16 cellSapId = subfrmInfo->cellSapId;
1351 RgrUeStaIndInfo *ueStaInd;
1354 RgSchCmnUlUeSpsInfo *ulSpsUe ;
1362 U16 datIndActQci = 0;
1363 U16 combDatIndActQci = 0; /* Prev and Latest Dat Ind combined */
1364 U16 tempUeActQci = 0; /* UE specific Active QCIs */
1368 TRC3(RgMacSchSfRecpInd)
1370 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1371 * it doesnt exist */
1372 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1374 /* lnkLst assignment */
1375 lnkLst = &(subfrmInfo->ueLst);
1377 CM_LLIST_FIRST_NODE(lnkLst, tmp);
1379 while((NULLP != tmp) && ((RgInfUeDatInd *)tmp->node != NULLP))
1385 datInd = (RgInfUeDatInd *)tmp->node;
1386 rnti = datInd->rnti;
1388 /* We shall try and find
1389 * out the RaCb based on the following -
1390 * 1. If the incoming PDU contained a CCCH SDU i.e. this is message 3.
1391 * 2. If the incoming PDU contained a CRNTI control element, i.e. we should
1392 * have a ueCb also for this
1395 /* It could be that a non-msg3 pdu contains a CRNTI Control element. We
1396 * should check for CRNTI CE and if it exists the UECb must exist, also an
1397 * if the CRNTI in the CE and the one with which the message came in are
1398 * different we shall look for an raCb as well.
1400 if (datInd->ceInfo.bitMask & RGSCH_CRNTI_CE_PRSNT)
1402 /* SR_RACH_STATS : CRNTI CE*/
1405 if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT)
1407 RGSCH_FREE_MEM(subfrmInfo);
1408 err.errType = RGSCHERR_TOM_DATIND;
1409 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1410 "Received MSG3 with CRNTI:%d and also CCCH ",
1411 datInd->ceInfo.ces.cRnti);
1414 ue = rgSCHDbmGetUeCb (cell, datInd->ceInfo.ces.cRnti);
1417 /* SR_RACH_STATS : CRNTI CE UECB NOT FOUND*/
1418 rgNumCrntiCeCrntiNotFound++;
1419 /* ccpu00141318 - Removed condition for SPS rnti checking*/
1420 RGSCH_FREE_MEM(subfrmInfo);
1421 err.errType = RGSCHERR_TOM_DATIND;
1422 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Received MSG3 "
1423 "with CRNTI:%d unable to find ueCb",
1424 datInd->ceInfo.ces.cRnti);
1428 if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue,
1429 rnti, datInd, &err)) != ROK)
1431 RGSCH_FREE_MEM(subfrmInfo);
1432 err.errType = RGSCHERR_TOM_DATIND;
1433 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Processing for MSG3 failed for CRNTI:%d",
1439 rgSCHUtlHdlCrntiCE (cell, ue);
1441 ret = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&ueStaInd,
1442 sizeof(RgrUeStaIndInfo));
1445 ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD;
1448 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue);
1449 if(ulSpsUe->isUlSpsActv)
1451 ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD_IN_SPS_ACTIVE;
1452 ue->ul.ulSpsCfg.isLcSRMaskEnab = FALSE;
1455 ret = rgSCHUtlFillSndUeStaInd(cell, ue, ueStaInd);
1458 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1459 "Could not Send Ue Sta Ind UEID:%d",ue->ueId);
1462 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1464 } /* end of CRNTI based message */
1465 else if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT)
1467 /* SR_RACH_STATS : CCCH SDU */
1469 /* SR_RACH_STATS : CCCH SDU RACB NOT FOUND*/
1470 if (NULLP == rgSCHDbmGetRaCb (cell, rnti))
1472 rgNumCCCHSduCrntiNotFound++;
1475 if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue,
1476 rnti, datInd, &err)) != ROK)
1478 RGSCH_FREE_MEM(subfrmInfo);
1479 err.errType = RGSCHERR_TOM_DATIND;
1480 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Processing for MSG3 failed for CRNTI:%d",
1485 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1487 } /* end of Msg3 processing */
1491 ue = rgSCHDbmGetUeCb (cell, datInd->rnti);
1495 if((ue = rgSCHDbmGetSpsUeCb (cell, datInd->rnti)) == NULLP)
1498 RGSCH_FREE_MEM(subfrmInfo);
1499 err.errType = RGSCHERR_TOM_DATIND;
1500 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the UE CB for CRNTI:%d",
1508 /* The LCs for which data is received at MAC is provided to SCH.
1509 This information is used to estimate the Active LCs at UE
1510 since estimates based on only BSR is not accurate */
1511 if (datInd->ceInfo.bitMask & RGSCH_ACTIVE_LC_PRSNT)
1514 /* Compose a Bitmask with for the QCI's for which Data
1516 for (lcCount = 0; lcCount < RGINF_MAX_NUM_DED_LC; lcCount++)
1518 if ((datInd->ceInfo.ulActLCs[lcCount] == TRUE) && (TRUE == ue->ul.lcCb[lcCount].isValid))
1520 datIndActQci |= (1 << (ue->ul.lcCb[lcCount].qciCb->qci -1));
1523 if (ue->ulActiveLCs && ue->lastDatIndLCs)
1525 /* Combine previous Dat Ind and current Dat Ind to
1526 estimate active LCs at UE */
1527 combDatIndActQci = ue->lastDatIndLCs | datIndActQci;
1528 tempUeActQci = ue->ulActiveLCs;
1529 ue->ulActiveLCs = combDatIndActQci;
1530 diffBits = combDatIndActQci ^ tempUeActQci;
1536 if (0x1 & tempUeActQci)
1538 /* An active QCI has become inactive */
1539 cell->qciArray[qci].ulUeCount--;
1543 /* An Inactive QCI has become active */
1544 cell->qciArray[qci].ulUeCount++;
1551 ue->lastDatIndLCs = datIndActQci;
1555 #endif /* LTE_L2_MEAS */
1556 /* Just copy the timing information from the dat indication into the one
1557 * stored in the UE CB, will be later utilized to handle Timing advance
1560 if ((ret = rgSCHUtlUpdSch (subfrmInfo, cell, ue, datInd, &err)) != ROK)
1562 RGSCH_FREE_MEM(subfrmInfo);
1563 err.errType = RGSCHERR_TOM_DATIND;
1564 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to handle Data"
1565 " Indication for UEID:%d",ue->ueId);
1569 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1572 /* update the UL PRB usage for all GBR QCIs*/
1573 for (idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++)
1575 cell->prbUsage.qciPrbRpts[idx].ulTotPrbUsed += subfrmInfo->qcisUlPrbCnt[idx];
1579 /* chk if Sch needs to dealloc datInd after unpk */
1580 RGSCH_FREE_MEM(subfrmInfo);
1582 } /* rgMacSchSfRecpInd */
1586 * @brief Function to handle relInd from MAC for a UE
1590 * Function: RgMacSchSpsRelInd
1592 * Handler for processing relInd for UL SPS of a UE
1599 * @param[in] Pst *pst
1600 * @param[in] RgInfSpsRelInfo *relInfo
1606 PUBLIC S16 RgMacSchSpsRelInd
1609 RgInfSpsRelInfo *relInfo
1612 PUBLIC S16 RgMacSchSpsRelInd(pst, relInfo)
1614 RgInfSpsRelInfo *relInfo;
1619 Inst inst = (pst->dstInst - SCH_INST_START);
1621 TRC2(RgMacSchSpsRelInd);
1623 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1624 * it doesnt exist */
1625 cell = rgSchCb[inst].rgrSap[relInfo->cellSapId].cell;
1627 if ((ue = rgSCHDbmGetUeCb(cell, relInfo->cRnti)) == NULLP)
1629 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1630 "No Ue exists with CRNTI:%d",relInfo->cRnti);
1634 if ((rgSCHUtlSpsRelInd(cell, ue, relInfo->isExplRel)) != ROK)
1636 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1637 "RelInd processing for CRNTI:%d failed",relInfo->cRnti);
1641 } /* end of RgMacSchSpsRelInd */
1642 #endif /* LTEMAC_SPS */
1647 * @brief Function to handle L2MeasCfm from MAC
1651 * Function: RgMacSchL2MeasCfm
1653 * Handler for processing L2 measurement confirm
1660 * @param[in] Pst *pst
1661 * @param[in] RgInfL2MeasCfm *measCfm
1667 PUBLIC S16 RgMacSchL2MeasCfm
1670 RgInfL2MeasCfm *measCfm
1673 PUBLIC S16 RgMacSchL2MeasCfm(pst, measCfm)
1675 RgInfL2MeasCfm *measCfm;
1678 RgSchCellCb *cell = NULLP;
1679 Inst inst = (pst->dstInst - SCH_INST_START);
1681 RgSchL2MeasCb *measCb = NULLP;
1682 RgSchCb *instCb = &rgSchCb[inst];
1684 LrgSchMeasCfmInfo schMeasCfm;
1686 U8 idx1; /*LTE_L2_MEAS_PHASE2*/
1688 TRC2(RgMacSchL2MeasCfm);
1690 /* Find the cellCb using cellId in measInfo. Iterate through all cells
1691 * in rgrsapCb in RgschCb */
1692 for (idx = 0; idx < instCb->numSaps; idx++)
1694 if ( instCb->rgrSap[idx].cell->cellId == measCfm->cellId)
1696 /* got the cell break the loop */
1697 cell = instCb->rgrSap[idx].cell;
1701 /* If no cellCb return Err with Invalid Cell Id */
1704 RLOG_ARG0(L_ERROR,DBG_CELLID,measCfm->cellId,
1705 "Meas Cfm Failed.Invalid Cell Id");
1710 /* Iterate through all meas requests in l2mList in cellCb */
1711 lnk = cell->l2mList.first;
1714 /* Get the MeasCb : RgSchL2MeasCb */
1715 measCb = (RgSchL2MeasCb *)lnk->node;
1717 if (measCb->measReq.hdr.transId == measCfm->transId)
1722 if ( measCb == NULLP )
1724 RETVALUE( RFAILED );
1728 if(measCfm->cfm.status != LCM_PRIM_OK)
1730 for (idx = 0; idx < measCb->measReq.avgPrbQciUl.numQci; idx++)
1732 qciVal = measCb->measReq.avgPrbQciUl.qci[idx];
1733 cell->qciArray[qciVal].qci = 0;
1735 /* Delete this measCb, send the negative confirmation to
1737 cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
1738 /* ccpu00117052 - MOD - Passing double pointer
1739 for proper NULLP assignment*/
1740 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb, sizeof(RgSchL2MeasCb));
1741 cmMemset((U8 *)&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo));
1742 schMeasCfm.measType = measCfm->measType;
1743 schMeasCfm.cfm = measCfm->cfm;
1744 schMeasCfm.hdr.transId = measCfm->transId;
1745 schMeasCfm.cellId = measCfm->cellId;
1746 RgMiLrgSchL2MeasCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm);
1749 for(idx = 0; idx < measCfm->u.prbCfm.numQci; idx++)
1751 measCb->avgPrbQciUl.prbUsage[idx].prbUsage = measCfm->u.prbCfm.prbUsage[idx].prbUsage;
1752 measCb->avgPrbQciUl.prbUsage[idx].qciValue = measCfm->u.prbCfm.prbUsage[idx].qciValue;
1753 /*LTE_L2_MEAS_PHASE2*/
1754 qciVal1 = measCfm->u.prbCfm.prbUsage[idx].qciValue;
1755 for(idx1=0;idx1<measCb->measReq.avgPrbQciUl.numQci;idx1++)
1757 if(measCb->measReq.avgPrbQciUl.qci[idx1] == qciVal1)
1762 if(idx1 == measCb->measReq.avgPrbQciUl.numQci)
1764 measCb->measReq.avgPrbQciUl.qci[measCb->measReq.avgPrbQciUl.numQci++] = qciVal1;
1767 measCb->avgPrbQciUl.numQci = measCfm->u.prbCfm.numQci;
1768 measCb->cfmRcvd = TRUE;
1769 cell->sndL2Meas = TRUE;
1771 } /* end of RgMacSchL2MeasCfm */
1774 * @brief Function to handle L2MeasStopCfm from MAC
1778 * Function: RgMacSchL2MeasStopCfm
1780 * Handler for processing L2 measurement confirm
1787 * @param[in] Pst *pst
1788 * @param[in] RgInfL2MeasCfm *measCfm
1794 PUBLIC S16 RgMacSchL2MeasStopCfm
1797 RgInfL2MeasCfm *measCfm
1800 PUBLIC S16 RgMacSchL2MeasStopCfm(pst, measCfm)
1802 RgInfL2MeasCfm *measCfm;
1805 LrgSchMeasCfmInfo schMeasCfm;
1806 Inst inst = (pst->dstInst - SCH_INST_START);
1807 RgSchCb *instCb = &rgSchCb[inst];
1809 TRC2(RgMacSchL2MeasStopCfm);
1811 cmMemset((U8 *)&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo));
1812 schMeasCfm.measType = measCfm->measType;
1813 schMeasCfm.cfm = measCfm->cfm;
1814 schMeasCfm.hdr.transId = measCfm->transId;
1815 schMeasCfm.cellId = measCfm->cellId;
1816 RgMiLrgSchL2MeasStopCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm);
1821 /************** TFU Interface *************/
1824 * @brief Bind confirm API for TFU SAP on scheduler instance.
1828 * Function : RgLiTfuSchBndCfm
1830 * This API is invoked by PHY to confirm TFU SAP bind.
1833 * @param[in] Pst *pst
1834 * @param[in] SuId suId
1835 * @param[in] U8 status
1841 PUBLIC S16 RgLiTfuSchBndCfm
1848 PUBLIC S16 RgLiTfuSchBndCfm(pst, suId, status)
1855 RgSchLowSapCb *tfuSap;
1856 Inst instId = pst->dstInst - SCH_INST_START;
1858 TRC3(RgLiTfuSchBndCfm);
1861 if(suId >= rgSchCb[instId].numSaps)
1863 RLOG_ARG0(L_ERROR,DBG_INSTID,instId, "Incorrect SuId");
1866 /* Lets validate suId first */
1867 tfuSap = &(rgSchCb[instId].tfuSap[suId]);
1869 if (suId != tfuSap->sapCfg.suId)
1871 RLOG_ARG2(L_ERROR,DBG_INSTID,instId, "Incorrect SuId. Configured (%d)"
1872 "Recieved (%d)", tfuSap->sapCfg.suId, suId);
1875 ret = rgSCHLmmBndCfm (pst, suId, status);
1877 } /* RgLiTfuSchBndCfm */
1880 * @brief Random Access Request indication from PHY.
1884 * Function : RgLiTfuRaReqInd
1886 * This API is invoked by PHY to send Random Access Request to Scheduler.
1887 * This API contains information for Random Access Request including
1888 * raRnti, list of associated RAPIDs and related information.
1890 * @param[in] Pst *pst
1891 * @param[in] SuId suId
1892 * @param[in] TfuRaReqIndInfo *raReqInd
1898 PUBLIC S16 RgLiTfuRaReqInd
1902 TfuRaReqIndInfo *raReqInd
1905 PUBLIC S16 RgLiTfuRaReqInd(pst, suId, raReqInd)
1908 TfuRaReqIndInfo *raReqInd;
1912 Inst inst = pst->dstInst-SCH_INST_START;
1914 TRC3(RgLiTfuRaReqInd);
1916 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
1918 RLOG_ARG1(L_ERROR,DBG_INSTID,inst,"SAP Validation failed SuId(%d)", suId);
1919 /* Free up the memory for the request structure */
1920 RGSCH_FREE_MEM(raReqInd);
1924 if(raReqInd == NULLP)
1926 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"Invalid input pointer for raReqInd Failed");
1930 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
1932 RLOG_ARG0(L_ERROR,DBG_CELLID,raReqInd->cellId,"No cell exists");
1936 ret = rgSCHTomRaReqInd(rgSchCb[inst].tfuSap[suId].cell, raReqInd);
1937 /* Free up the memory for the request structure */
1938 RGSCH_FREE_MEM(raReqInd);
1939 /*SPutSBuf (pst->region, pst->pool, (Data *)raReqInd,
1940 sizeof(TfuRaReqIndInfo)); */
1942 } /* RgLiTfuRaReqInd */
1945 * @brief Uplink CQI indication from PHY.
1949 * Function : RgLiTfuUlCqiInd
1951 * This API is invoked by PHY to send Uplink CQI to Scheduler.
1952 * This API contains Uplink CQI information reported per UE.
1954 * @param[in] Pst *pst
1955 * @param[in] SuId suId
1956 * @param[in] TfuUlCqiIndInfo *ulCqiInd
1962 PUBLIC S16 RgLiTfuUlCqiInd
1966 TfuUlCqiIndInfo *ulCqiInd
1969 PUBLIC S16 RgLiTfuUlCqiInd(pst, suId, ulCqiInd)
1972 TfuUlCqiIndInfo *ulCqiInd;
1976 Inst inst = pst->dstInst-SCH_INST_START;
1978 TRC3(RgLiTfuUlCqiInd);
1980 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
1982 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
1983 /* Free up the memory for the request structure */
1984 RGSCH_FREE_MEM(ulCqiInd);
1988 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
1990 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
1991 /* Free up the memory for the request structure */
1992 RGSCH_FREE_MEM(ulCqiInd);
1995 ret = rgSCHTomUlCqiInd (rgSchCb[inst].tfuSap[suId].cell, ulCqiInd);
1996 /* Free up the memory for the request structure */
1997 RGSCH_FREE_MEM(ulCqiInd);
1999 } /* RgLiTfuUlCqiInd */
2002 * @brief PUCCH power adjustment indication.
2006 * Function : RgLiTfuPucchDeltaPwrInd
2008 * This API is invoked by PHY to send PUCCH power adjustment
2011 * @param[in] Pst *pst
2012 * @param[in] SuId suId
2013 * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
2019 PUBLIC S16 RgLiTfuPucchDeltaPwrInd
2023 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
2026 PUBLIC S16 RgLiTfuPucchDeltaPwrInd(pst, suId, pucchDeltaPwr)
2029 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr;
2033 Inst inst = pst->dstInst-SCH_INST_START;
2035 TRC3(RgLiTfuPucchDeltaPwrInd);
2037 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2039 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2040 /* Free up the memory for the request structure */
2041 RGSCH_FREE_MEM(pucchDeltaPwr);
2045 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2047 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2050 ret = rgSCHTomPucchDeltaPwrInd (rgSchCb[inst].tfuSap[suId].cell, pucchDeltaPwr);
2051 /* Free up the memory for the request structure */
2052 RGSCH_FREE_MEM(pucchDeltaPwr);
2054 } /* RgLiTfuPucchDeltaPwrInd */
2058 * @brief HARQ ACK indication from PHY for Downlink transmissions.
2062 * Function : RgLiTfuHqInd
2064 * This API is invoked by PHY to send HARQ ACK information to Scheduler
2065 * on recieving HARQ ACK/NACK from UEs.
2066 * This API contains HARQ ACK information recieved by PHY for downlink
2069 * @param[in] Pst *pst
2070 * @param[in] SuId suId
2071 * @param[in] TfuHqIndInfo *harqAckInd
2077 PUBLIC S16 RgLiTfuHqInd
2081 TfuHqIndInfo *harqAckInd
2084 PUBLIC S16 RgLiTfuHqInd(pst, suId, harqAckInd)
2087 TfuHqIndInfo *harqAckInd;
2091 Inst inst = (pst->dstInst - SCH_INST_START);
2096 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2098 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2099 RGSCH_FREE_MEM(harqAckInd);
2103 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2105 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2110 /* Now call the TOM (Tfu ownership module) primitive to process further */
2111 ret = rgSCHTomHarqAckInd (rgSchCb[inst].tfuSap[suId].cell, harqAckInd);
2112 /* Free up the memory for the request structure */
2113 RGSCH_FREE_MEM(harqAckInd);
2115 } /* RgLiTfuHqInd */
2119 * @brief Scheduling request(SR) indication from PHY for an UE.
2123 * Function : RgLiTfuSrInd
2125 * This API is invoked by PHY to send Scheduling request information to
2126 * Scheduler on recieving SR from a list of UEs.
2127 * This API contains scheduling request information recieved by PHY for UEs.
2129 * @param[in] Pst *pst
2130 * @param[in] SuId suId
2131 * @param[in] TfuSrIndInfo *srInd
2137 PUBLIC S16 RgLiTfuSrInd
2144 PUBLIC S16 RgLiTfuSrInd(pst, suId, srInd)
2147 TfuSrIndInfo *srInd;
2151 Inst inst = pst->dstInst-SCH_INST_START;
2156 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2158 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"() SAP Validation failed");
2159 RGSCH_FREE_MEM(srInd);
2163 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2165 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"RgLiTfuSrInd()No cell exists");
2169 /* Now call the TOM (Tfu ownership module) primitive to process further */
2170 ret = rgSCHTomSrInd (rgSchCb[inst].tfuSap[suId].cell, srInd);
2171 /* Free up the memory for the request structure */
2172 RGSCH_FREE_MEM(srInd);
2174 } /* RgLiTfuSrInd */
2178 * @brief Downlink CQI indication from PHY for an UE.
2182 * Function : RgLiTfuDlCqiInd
2184 * This API is invoked by PHY to send Downlink CQI indication to Scheduler
2185 * on recieving downlink CQI from UE.
2186 * This API contains downlink CQI information recieved by PHY for an UE.
2188 * @param[in] Pst *pst
2189 * @param[in] SuId suId
2190 * @param[in] TfuDlCqiIndInfo *dlCqiInd
2196 PUBLIC S16 RgLiTfuDlCqiInd
2200 TfuDlCqiIndInfo *dlCqiInd
2203 PUBLIC S16 RgLiTfuDlCqiInd(pst, suId, dlCqiInd)
2206 TfuDlCqiIndInfo *dlCqiInd;
2210 Inst inst = pst->dstInst-SCH_INST_START;
2212 TRC3(RgLiTfuDlCqiInd);
2214 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2216 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed");
2217 /* Free up the memory for the request structure */
2218 RGSCH_FREE_MEM(dlCqiInd);
2222 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2224 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2227 ret = rgSCHTomDlCqiInd (rgSchCb[inst].tfuSap[suId].cell, dlCqiInd);
2228 /* Free up the memory for the request structure */
2229 RGSCH_FREE_MEM(dlCqiInd);
2231 } /* RgLiTfuDlCqiInd */
2235 * @brief Raw CQI indication from PHY for an UE.
2239 * Function : RgLiTfuRawCqiInd
2241 * This API is invoked by PHY to send Raw CQI indication to Scheduler
2242 * on receiving Raw CQI from UE.
2243 * This API contains Raw CQI information recieved by PHY for an UE.
2245 * @param[in] Pst *pst
2246 * @param[in] SuId suId
2247 * @param[in] TfuRawCqiIndInfo *rawCqiInd
2253 PUBLIC S16 RgLiTfuRawCqiInd
2257 TfuRawCqiIndInfo *rawCqiInd
2260 PUBLIC S16 RgLiTfuRawCqiInd(pst, suId, rawCqiInd)
2263 TfuRawCqiIndInfo *rawCqiInd;
2267 Inst inst = pst->dstInst-SCH_INST_START;
2269 TRC3(RgLiTfuRawCqiInd);
2272 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2274 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2275 /* Free up the memory for the request structure */
2276 RGSCH_FREE_MEM(rawCqiInd);
2280 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2282 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," No cell exists");
2286 ret = rgSCHTomRawCqiInd (rgSchCb[inst].tfuSap[suId].cell, rawCqiInd);
2287 /* Free up the memory for the request structure */
2288 RGSCH_FREE_MEM(rawCqiInd);
2290 } /* RgLiTfuRawCqiInd */
2293 * @brief SRS indication from PHY for an UE.
2297 * Function : RgLiTfuSrsInd
2299 * This API is invoked by PHY to send UL SRS indication to Scheduler
2300 * on receiving a SRS from UE.
2301 * This API contains SRS information recieved by PHY for an UE.
2303 * @param[in] Pst *pst
2304 * @param[in] SuId suId
2305 * @param[in] TfuSrsIndInfo *srsInd
2311 PUBLIC S16 RgLiTfuSrsInd
2315 TfuSrsIndInfo *srsInd
2318 PUBLIC S16 RgLiTfuSrsInd(pst, suId, srsInd)
2321 TfuSrsIndInfo *srsInd;
2325 Inst inst = pst->dstInst-SCH_INST_START;
2327 TRC3(RgLiTfuSrsInd);
2329 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2331 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed");
2332 /* Free up the memory for the request structure */
2333 RGSCH_FREE_MEM(srsInd);
2337 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2339 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2342 ret = rgSCHTomSrsInd (rgSchCb[inst].tfuSap[suId].cell, srsInd);
2343 /* Free up the memory for the request structure */
2344 RGSCH_FREE_MEM(srsInd);
2346 } /* RgLiTfuSrsInd */
2351 * @brief DOA indication from PHY for an UE.
2355 * Function : RgLiTfuDoaInd
2357 * This API is invoked by PHY to send Direction Of Arrival to Scheduler
2358 * on calculating DOA at PHYSICAL LAYER for an UE.
2359 * This API contains DOA information calculated by PHY for an UE.
2361 * @param[in] Pst *pst
2362 * @param[in] SuId suId
2363 * @param[in] TfuDoaIndInfo *doaInd
2369 PUBLIC S16 RgLiTfuDoaInd
2373 TfuDoaIndInfo *doaInd
2376 PUBLIC S16 RgLiTfuDoaInd(pst, suId, doaInd)
2379 TfuDoaIndInfo *doaInd;
2383 Inst inst = pst->dstInst-SCH_INST_START;
2385 TRC2(RgLiTfuDoaInd);
2387 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2389 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2390 /* Free up the memory for the request structure */
2391 RGSCH_FREE_MEM(doaInd);
2395 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2397 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2400 ret = rgSCHTomDoaInd (rgSchCb[inst].tfuSap[suId].cell, doaInd);
2401 /* Free up the memory for the request structure */
2402 RGSCH_FREE_MEM(doaInd);
2404 } /* RgLiTfuDlCqiInd */
2407 * @brief CRC indication from PHY.
2411 * Function : RgLiTfuCrcInd
2413 * This API is invoked by PHY to give CRC indication to scheduler.
2415 * @param[in] Pst *pst
2416 * @param[in] SuId suId
2417 * @param[in] TfuCrcIndInfo *crcInd
2423 PUBLIC S16 RgLiTfuCrcInd
2427 TfuCrcIndInfo *crcInd
2430 PUBLIC S16 RgLiTfuCrcInd (pst, suId, crcInd)
2433 TfuCrcIndInfo *crcInd;
2437 Inst inst = pst->dstInst-SCH_INST_START;
2439 TRC3(RgLiTfuCrcInd);
2440 #ifdef XEON_SPECIFIC_CHANGES
2441 struct timeval start6, end6;
2442 gettimeofday(&start6, NULL);
2445 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2447 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2448 RGSCH_FREE_MEM(crcInd);
2452 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2454 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2459 /* Now call the TOM (Tfu ownership module) primitive to process further */
2460 ret = rgSCHTomCrcInd(rgSchCb[inst].tfuSap[suId].cell, crcInd);
2461 /* Free up the memory for the request structure */
2462 RGSCH_FREE_MEM(crcInd);
2463 #ifdef XEON_SPECIFIC_CHANGES
2464 gettimeofday(&end6, NULL);
2467 } /* RgLiTfuCrcInd */
2470 * @brief Timing Advance indication from PHY.
2474 * Function : RgLiTfuTimingAdvInd
2476 * This API is invoked by PHY to indicate timing advance to Scheduler for
2479 * @param[in] Pst *pst
2480 * @param[in] SuId suId
2481 * @param[in] TfuTimingAdvIndInfo *timingAdvInd
2487 PUBLIC S16 RgLiTfuTimingAdvInd
2491 TfuTimingAdvIndInfo *timingAdvInd
2494 PUBLIC S16 RgLiTfuTimingAdvInd(pst, suId, timingAdvInd)
2497 TfuTimingAdvIndInfo *timingAdvInd;
2501 Inst inst = pst->dstInst-SCH_INST_START;
2503 TRC3(RgLiTfuTimingAdvInd);
2505 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2507 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2508 /* Free up the memory for the request structure */
2509 RGSCH_FREE_MEM(timingAdvInd);
2513 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2515 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2518 /* Now call the TOM (Tfu ownership module) primitive to process further */
2519 ret = rgSCHTomTimingAdvInd(rgSchCb[inst].tfuSap[suId].cell, timingAdvInd);
2520 /* Free up the memory for the request structure */
2521 RGSCH_FREE_MEM(timingAdvInd);
2523 } /* RgLiTfuTimingAdvInd */
2525 /************* RGM Interface ****************/
2527 * @brief API for bind request from RRM towards MAC.
2531 * Function: RgUiRgmBndReq
2533 * This API is invoked by RRM towards MAC to bind RGM SAP.
2534 * These API validates the Pst, spId, suId and sends the bind confirm to
2538 * @param[in] Pst *pst
2539 * @param[in] SuId suId
2540 * @param[in] SpId spId
2546 PUBLIC S16 RgUiRgmBndReq
2553 PUBLIC S16 RgUiRgmBndReq(pst, suId, spId)
2560 Pst tmpPst; /* Temporary Post Structure */
2561 Inst instId = pst->dstInst-SCH_INST_START;
2566 tmpPst.prior = pst->prior;
2567 tmpPst.route = pst->route;
2568 tmpPst.selector = pst->selector;
2569 tmpPst.region = rgSchCb[instId].rgSchInit.region;
2570 tmpPst.pool = rgSchCb[instId].rgSchInit.pool;
2572 tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId;
2573 tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent;
2574 tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + SCH_INST_START;
2576 tmpPst.event = EVTNONE;
2578 tmpPst.dstProcId = pst->srcProcId;
2579 tmpPst.dstEnt = pst->srcEnt;
2580 tmpPst.dstInst = pst->srcInst;
2582 /*TODO remove follo statement*/
2583 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND;
2585 if(spId < rgSchCb[instId].numSaps)
2587 /* Check the state of the SAP */
2588 switch (rgSchCb[instId].rgmSap[spId].sapSta.sapState)
2590 /* This case might not be needed if SAP not configured then it will go
2591 * to else of above if condition */
2592 case LRG_UNBND: /* SAP is not bound */
2593 RLOG0(L_DEBUG,"SAP is not yet bound");
2594 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_BND;
2595 rgSchCb[instId].rgmSap[spId].sapCfg.suId = suId;
2596 /* Send Bind Confirm with status as SUCCESS */
2597 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK);
2598 /*Indicate to Layer manager */
2600 case LRG_BND: /* SAP is already bound*/
2601 RLOG0(L_DEBUG,"SAP is already bound");
2602 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK);
2604 default: /* Should Never Enter here */
2605 #if (ERRCLASS & ERRCLS_ADD_RES)
2606 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001,
2607 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2608 "Invalid SAP State:RgUiRgmBndReq failed\n");
2610 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_NOK);
2616 #if (ERRCLASS & ERRCLS_ADD_RES)
2617 /* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state
2618 to spId to avoid seg fault due to invalid sapID */
2619 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002,
2620 (ErrVal)spId, "Invalid SAP Id:RgUiRrmBndReq failed\n");
2622 ret = RgUiRgmBndCfm(&tmpPst, suId, CM_BND_NOK);
2625 } /* RgUiRgmBndReq */
2628 * @brief API for unbind request from RRM towards MAC.
2632 * Function: RgUiRgmUbndReq
2634 * This API is invoked by RRM towards MAC to unbind RGM SAP.
2635 * These API validates the Pst, spId, suId and transfers the unbind request
2636 * specific information to corresponding ownership module (GOM) API.
2639 * @param[in] Pst *pst
2640 * @param[in] SuId suId
2641 * @param[in] Reason reason
2647 PUBLIC S16 RgUiRgmUbndReq
2654 PUBLIC S16 RgUiRgmUbndReq(pst, spId, reason)
2660 Inst instId = pst->dstInst-SCH_INST_START;
2661 TRC3(RgUiRgmUbndReq)
2664 /* SAP Id validation */
2665 if (spId < rgSchCb[instId].numSaps)
2667 switch(rgSchCb[instId].rgmSap[spId].sapSta.sapState)
2669 case LRG_BND: /* SAP is already bound*/
2670 /* setting SAP state to UN BOUND */
2671 RLOG0(L_DEBUG,"SAP is already bound");
2672 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND;
2675 #if (ERRCLASS & ERRCLS_ADD_RES)
2676 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003,
2677 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2678 "Invalid SAP State: RgUiRgmUbndReq failed\n");
2685 #if (ERRCLASS & ERRCLS_ADD_RES)
2686 RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004,
2687 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2688 "Invalid SAP Id:RgUiRgmUbndReq failed\n");
2693 } /* RgUiRgmUbndReq */
2697 * @brief API for start or stop PRB reporting from RRM towards MAC.
2701 * Function: RgUiRgmCfgPrbRprt
2703 * This API is invoked by RRM towards MAC to start or stop calculating
2704 * Average PRB usage in downlink and uplink. The average PRB usage will
2705 * be reported to RRM based on confiured periodicity.
2708 * @param[in] Pst *pst
2709 * @param[in] SuId suId
2710 * @param[in] SpId spId
2716 PUBLIC S16 RgUiRgmCfgPrbRprt
2720 RgmPrbRprtCfg *prbRprtCfg
2723 PUBLIC S16 RgUiRgmCfgPrbRprt(pst, spId, prbRprtCfg)
2726 RgmPrbRprtCfg *prbRprtCfg;
2731 RgSchPrbUsage *prbUsage;
2732 Inst inst = (pst->dstInst - SCH_INST_START);
2734 TRC2(RgUiRgmCfgPrbRprt);
2735 cell = rgSchCb[inst].rgmSap[spId].cell;
2736 prbUsage = &cell->prbUsage;
2737 prbUsage->prbRprtEnabld = prbRprtCfg->bConfigType;
2738 prbUsage->rprtPeriod = prbRprtCfg->usPrbAvgPeriodicty;
2739 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, prbUsage->startTime, 1);
2741 /* clear the qciPrbRpts for all GBR QCIs */
2742 cmMemset((U8*)&prbUsage->qciPrbRpts[0], 0,
2743 (RGM_MAX_QCI_REPORTS * sizeof(RgSchQciPrbUsage)));
2745 RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId,
2746 "RgUiRgmCfgPrbRprt config type %d with the report period %d",
2747 prbUsage->prbRprtEnabld,prbUsage->rprtPeriod);
2749 /* ccpu00134393 : mem leak fix */
2750 SPutSBuf(pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
2755 * @brief ERROR INDICATION from PHY for the i failed unlicensed Scell transmission.
2759 * Function : RgLiTfuErrInd
2761 * This API is invoked by PHY to send ERROR INDICATION to scheduler
2762 * Currently invoked in the cases when the Unlicensed SCell transmission
2764 * This API contains the Cell and subframe information for which the
2765 * transmission failed.
2767 * @param[in] Pst *pst
2768 * @param[in] SuId suId
2769 * @param[in] TfuErrIndInfo *errIndInfo
2775 PUBLIC S16 RgLiTfuErrInd
2779 TfuErrIndInfo *errInd
2782 PUBLIC S16 RgLiTfuErrInd(pst, suId, errInd)
2785 TfuErrIndInfo *errInd;
2790 Inst inst = (pst->dstInst - SCH_INST_START);
2793 TRC3(RgLiTfuErrInd);
2796 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2799 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2803 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2805 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2811 /* Now call the TOM (Tfu ownership module) primitive to process further */
2812 ret = rgSCHLaaErrInd(rgSchCb[inst].tfuSap[suId].cell, errInd);
2815 } /* RgLiTfuErrInd */
2819 /**********************************************************************
2822 **********************************************************************/