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 "envopt.h" /* environment options */
41 #include "envdep.h" /* environment dependent */
42 #include "envind.h" /* environment independent */
43 #include "gen.h" /* general layer */
44 #include "ssi.h" /* system service interface */
45 #include "cm_hash.h" /* common hash list */
46 #include "cm_llist.h" /* common linked list library */
47 #include "cm_err.h" /* common error */
48 #include "cm_lte.h" /* common LTE */
54 #include "rg_sch_inf.h"
56 #include "rg_sch_err.h"
57 #include "rg_sch_cmn.h"
58 #include "rl_interface.h"
59 #include "rl_common.h"
61 /* header/extern include files (.x) */
62 #include "gen.x" /* general layer typedefs */
63 #include "ssi.x" /* system services typedefs */
64 #include "cm5.x" /* common timers */
65 #include "cm_hash.x" /* common hash list */
66 #include "cm_lib.x" /* common library */
67 #include "cm_llist.x" /* common linked list */
68 #include "cm_mblk.x" /* memory management */
69 #include "cm_tkns.x" /* common tokens */
70 #include "cm_lte.x" /* common tokens */
71 #include "tfu.x" /* TFU types */
72 #include "lrg.x" /* layer management typedefs for MAC */
73 #include "rgr.x" /* layer management typedefs for MAC */
74 #include "rgm.x" /* layer management typedefs for MAC */
75 #include "rg_sch_inf.x" /* typedefs for Scheduler */
76 #include "rg_sch.x" /* typedefs for Scheduler */
77 #include "rg_sch_cmn.x"
80 EXTERN S16 rgEmtcMacSchUeDelInd ARGS((RgSchCellCb *cell,RgInfUeDelInd *ueDelInd));
81 EXTERN S16 rgSCHGomEmtcHndlSiCfg ARGS((
86 RgrCfgTransId transId,
87 RgrSiCfgReqInfo *cfgReqInfo
89 EXTERN S16 rgSCHGomEmtcHndlWarningSiCfg ARGS((
94 RgrCfgTransId transId,
95 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
99 /************** LRG Interface ****************/
101 * @brief Layer Manager Configuration request handler.
105 * Function : HandleSchGenCfgReq
107 * This function handles the configuration
108 * request received at scheduler instance from the Layer Manager.
109 * -# Based on the cfg->hdr.elmId.elmnt value it invokes one of the
110 * functions rgHdlGenCfg() or rgHdlSapCfg().
111 * -# Invokes RgMiLrgSchCfgCfm() to send back the confirmation to the LM.
113 * @param[in] Pst *pst, the post structure
114 * @param[in] RgMngmt *cfg, the configuration parameter's structure
119 PUBLIC S16 HandleSchGenCfgReq
121 Pst *pst, /* post structure */
122 RgMngmt *cfg /* config structure */
125 PUBLIC S16 HandleSchGenCfgReq(pst, cfg)
126 Pst *pst; /* post structure */
127 RgMngmt *cfg; /* config structure */
130 U16 ret = LCM_PRIM_OK;
131 U16 reason = LCM_REASON_NOT_APPL;
135 Inst inst = (pst->dstInst - SCH_INST_START);
138 TRC3(HandleSchGenCfgReq)
141 if(pst->dstInst < SCH_INST_START)
143 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Invalid inst ID");
144 RLOG_ARG2(L_DEBUG,DBG_INSTID,inst, "HandleSchGenCfgReq(): "
145 "pst->dstInst=%d SCH_INST_START=%d", pst->dstInst,SCH_INST_START);
148 printf("\nReceived scheduler gen config");
149 /* Fill the post structure for sending the confirmation */
150 SchFillCfmPst(pst, &cfmPst, cfg);
152 /* Initialize the cfg cfm structure
153 if (SGetSBuf(cfmPst.region, cfmPst.pool, (Data **)&cfm, sizeof(RgMngmt))
156 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Memory Unavailable for Confirmation");
159 cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
166 cfm.hdr.elmId.elmnt = cfg->hdr.elmId.elmnt;
167 switch(cfg->hdr.elmId.elmnt)
170 reason = SchInstCfg(&cfg->t.cfg,pst->dstInst );
174 reason = LCM_REASON_INVALID_ELMNT;
175 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "Invalid Elmnt=%d", cfg->hdr.elmId.elmnt);
179 if (reason != LCM_REASON_NOT_APPL)
184 cfm.cfm.status = ret;
185 cfm.cfm.reason = reason;
187 SchSendCfgCfm(&cfmPst, &cfm);
188 /* SPutSBuf(pst->region, pst->pool, (Data *)cfg, sizeof(RgMngmt)); */
191 }/*-- HandleSchGenCfgReq --*/
195 * @brief Layer Manager Control request handler.
199 * Function : RgMiLrgSchCntrlReq
201 * This function handles the control
202 * request received from the Layer Manager.
203 * -# Based on cntrl->hdr.elmId.elmnt, cntrl->t.cntrl.action
204 * and cntrl->t.cntrl.subAction, it performs the appropriate control action
205 * of SAP (enable/disable) and layer shutdown.
206 * -# Invokes the RgMiLrgSchCntrlCfm to send back the confirmation to LM.
208 * @param[in] Pst *pst, the post structure
209 * @param[in] RgMngmt *cntrl, the control parameter's structure
214 PUBLIC S16 RgMiLrgSchCntrlReq
216 Pst *pst, /* post structure */
217 RgMngmt *cntrl /* control structure */
220 PUBLIC S16 RgMiLrgSchCntrlReq(pst, cntrl)
221 Pst *pst; /* post structure */
222 RgMngmt *cntrl; /* control structure */
225 S16 ret = ROK; /* return value */
229 Inst inst = (pst->dstInst - SCH_INST_START); /* Scheduler instance Id */
230 TRC3(RgMiLrgSchCntrlReq)
233 /* Fill the post structure for sending the confirmation */
234 SchFillCfmPst(pst, &cfmPst, cntrl);
236 /* Initialize the cfg cfm structure
237 if (SGetSBuf(cfmPst.region, cfmPst.pool, (Data **)&cfm, sizeof(RgMngmt))
240 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Memory Unavailable for Confirmation");
241 SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt));
244 cmMemset((U8 *)&cfm, 0, sizeof(RgMngmt));
251 cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
252 cfm.t.cntrl.action = cntrl->t.cntrl.action;
253 cfm.t.cntrl.subAction = cntrl->t.cntrl.subAction;
255 /* Check if General Config Done*/
256 if(rgSchCb[inst].rgSchInit.cfgDone != TRUE)
258 cfm.cfm.status = LCM_PRIM_NOK;
259 cfm.cfm.reason = LCM_REASON_GENCFG_NOT_DONE;
260 cfm.hdr.elmId.elmnt = cntrl->hdr.elmId.elmnt;
261 RgMiLrgSchCntrlCfm(&cfmPst, &cfm);
262 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Gen Cfg not done.");
263 /* SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); */
267 /* General Config done, process the Control request */
268 switch(cntrl->hdr.elmId.elmnt)
271 rgSCHLmmGenCntrl(cntrl, &cfm, &cfmPst);
275 rgSCHLmmSapCntrl(cntrl, &cfm, &cfmPst);
278 cfm.cfm.status = LCM_PRIM_NOK;
279 cfm.cfm.reason = LCM_REASON_INVALID_PAR_VAL;
280 RgMiLrgSchCntrlCfm(&cfmPst, &cfm);
281 RLOG_ARG1(L_ERROR,DBG_INSTID,inst, "invalid elmnt=%d",
282 cntrl->hdr.elmId.elmnt);
285 /* SPutSBuf(pst->region, pst->pool, (Data *)cntrl, sizeof(RgMngmt)); */
287 }/*-- RgMiLrgSchCntrlReq --*/
291 * @brief Layer Manager L2 Measurement request handler.
295 * Function : RgMiLrgSchL2MeasReq
297 * This function handles the control
298 * measurement request received from the Layer Manager.
300 * @param[in] Pst *pst, the post structure
301 * @param[in] LrgSchMeasReqInfo *measInfo, measurement request info
306 PUBLIC S16 RgMiLrgSchL2MeasReq
308 Pst *pst, /* post structure */
309 LrgSchMeasReqInfo *measInfo /* Meas Req Info */
312 PUBLIC S16 RgMiLrgSchL2MeasReq(pst, measInfo)
313 Pst *pst; /* post structure */
314 LrgSchMeasReqInfo *measInfo; /* Meas Req Info */
321 RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
322 #if (ERRCLASS & ERRCLS_ADD_RES)
326 RgSchL2MeasCb *measCb = NULLP;
328 Inst inst = (pst->dstInst - SCH_INST_START); /* Scheduler instance Id */
334 TRC3(RgMiLrgSchL2MeasReq)
337 /* Find the cellCb using cellId in measInfo. Iterate through all cells
338 * in rgrsapCb in RgschCb */
340 for (idx = 0; idx < instCb->numSaps; idx++)
342 if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
344 /* got the cell break the loop */
345 cell = instCb->rgrSap[idx].cell;
349 /* If no cellCb return Err with Invalid Cell Id */
352 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
353 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_CELLID);
354 rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE);
355 RLOG_ARG2(L_ERROR,DBG_INSTID,inst,
356 "Meas req Failed.Invalid Cell Id errType(%d) errCause(%d)",
357 err.errType, err.errCause);
360 /* Validate for Meas Types */
361 if ( (ret = rgSCHUtlValidateMeasReq(cell, measInfo, &err)) != ROK)
363 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
364 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_INVALID_MEASTYPE);
365 rgSchL2mSndCfm(&cfmPst, NULLP, measInfo, TRUE);
366 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
367 "Meas req Failed.Invalid Measurement Type"
368 "errCasue(%d) errType(%d)", err.errType, err.errCause);
371 /* Iterate through all meas requests in l2mList in cellCb */
372 #if (ERRCLASS & ERRCLS_ADD_RES)
373 lnk = cell->l2mList.first;
376 /* Get the MeasCb : RgSchL2MeasCb */
377 measCb = (RgSchL2MeasCb *)lnk->node;
379 if (measCb->measReq.hdr.transId == measInfo->hdr.transId)
381 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
382 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_DUP_TRANSID);
383 rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE);
384 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
385 "Meas req Failed.Dublicate TransId"
386 "errType(%d) errCause(%d)", err.errType, err.errCause);
391 /* Call L2M Function to store Meas req */
392 ret = rgSchL2mMeasReq(cell, measInfo, err);
395 rgSchL2mFillCfmPst(pst, &cfmPst, measInfo);
396 RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ, RGSCHERR_SCH_L2MEAS_FAILED);
397 rgSchL2mSndCfm(&cfmPst, measCb, measInfo, TRUE);
398 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
399 "Meas req Failed.errType(%d) errCause(%d)",
400 err.errType, err.errCause);
404 } /* -- RRgMiLrgSchL2MeasReq-- */
407 * @brief Layer Manager L2 Measurement Stop request handler.
411 * Function : RgMiLrgSchL2MeasStopReq
413 * This function handles the control
414 * measurement stop request received from the Layer Manager.
416 * @param[in] Pst *pst, the post structure
417 * @param[in] LrgSchMeasReqInfo *measInfo, measurement stop request info
422 PUBLIC S16 RgMiLrgSchL2MeasStopReq
424 Pst *pst, /* post structure */
425 LrgSchMeasStopReqInfo *measInfo /* Meas Req Info */
428 PUBLIC S16 RgMiLrgSchL2MeasStopReq(pst, measInfo)
429 Pst *pst; /* post structure */
430 LrgSchMeasStopReqInfo *measInfo; /* Meas Req Info */
434 RgSchCellCb *cell = NULLP;
435 RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
436 CmLList *node = NULLP;
437 RgSchL2MeasCb *measCb = NULLP;
438 LrgSchMeasCfmInfo measCfm;
442 TRC3(RgMiLrgSchL2MeasStopReq)
445 for (idx = 0; idx < instCb->numSaps; idx++)
447 if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
449 /* got the cell break the loop */
450 cell = instCb->rgrSap[idx].cell;
456 RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId,
457 "Stop req Failed.Invalid Cell Id ");
460 cmMemset((U8 *)&measCfm, 0, sizeof(LrgSchMeasCfmInfo));
461 node = cell->l2mList.first;
464 measCb = (RgSchL2MeasCb *)(node)->node;
467 cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
468 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb,
469 sizeof(RgSchL2MeasCb));
472 if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
474 RgInfL2MeasStopReq measStopReq;
476 cmMemset((U8 *)&measStopReq, 0, sizeof(RgInfL2MeasStopReq));
477 measStopReq.transId = measInfo->hdr.transId;
478 measStopReq.measType = measInfo->measType;
479 /* measReq.timePrd = measInfo->timePrd; */
480 measStopReq.cellId = measInfo->cellId;
481 rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst);
482 RgSchMacL2MeasStop(&pstMac,&measStopReq);
486 RgMiLrgSchL2MeasStopCfm(&(rgSchCb[cell->instIdx].rgSchInit.lmPst),
490 }/*RgMiLrgSchL2MeasStopReq*/
492 * @brief Layer Manager L2 Measurement request handler.
493 * for Send l2 measurement req
496 * Function : RgMiLrgSchL2MeasSendReq
498 * This function handles the control
499 * measurement send request received from the Layer Manager.
501 * @param[in] Pst *pst, the post structure
502 * @param[in] LrgSchMeasReqInfo *measInfo, measurement stop request info
507 PUBLIC S16 RgMiLrgSchL2MeasSendReq
509 Pst *pst, /* post structure */
510 LrgSchMeasSndReqInfo *measInfo /* Meas Req Info */
513 PUBLIC S16 RgMiLrgSchL2MeasSendReq(pst, measInfo)
514 Pst *pst; /* post structure */
515 LrgSchMeasSndReqInfo *measInfo; /* Meas Req Info */
520 RgSchCb *instCb = &rgSchCb[(pst->dstInst - SCH_INST_START)];
523 TRC3(RgMiLrgSchL2MeasSendReq)
528 for (idx = 0; idx < instCb->numSaps; idx++)
530 if ( instCb->rgrSap[idx].cell->cellId == measInfo->cellId)
532 /* got the cell break the loop */
533 cell = instCb->rgrSap[idx].cell;
539 RLOG_ARG0(L_ERROR,DBG_CELLID,measInfo->cellId,
540 "Send req Failed.Invalid Cell Id");
544 if(measInfo->measType & LRG_L2MEAS_AVG_PRB_PER_QCI_UL)
546 RgInfL2MeasSndReq measSndReq;
548 cmMemset((U8 *)&measSndReq, 0, sizeof(RgInfL2MeasSndReq));
549 measSndReq.transId = measInfo->hdr.transId;
550 measSndReq.measType = measInfo->measType;
551 measSndReq.timePrd = measInfo->timePrd;
552 measSndReq.cellId = measInfo->cellId;
553 rgSCHUtlGetPstToLyr(&pstMac, &rgSchCb[cell->instIdx], cell->macInst);
554 RgSchMacL2MeasSend(&pstMac, &measSndReq);
558 cell->sndL2Meas = TRUE;
562 }/*RgMiLrgSchL2MeasSendReq*/
563 #endif /* LTE_L2_MEAS */
568 /************* RGR Interface ****************/
570 * @brief API for bind request from RRM towards MAC.
574 * Function: RgUiRgrBndReq
576 * This API is invoked by RRM towards MAC to bind RGR SAP.
577 * These API validates the Pst, spId, suId and sends the bind confirm to
581 * @param[in] Pst *pst
582 * @param[in] SuId suId
583 * @param[in] SpId spId
589 PUBLIC S16 RgUiRgrBndReq
596 PUBLIC S16 RgUiRgrBndReq(pst, suId, spId)
603 Pst tmpPst; /* Temporary Post Structure */
604 Inst instId = pst->dstInst-SCH_INST_START;
605 RgUstaDgn dgn; /* Alarm diagnostics structure */
610 tmpPst.prior = pst->prior;
611 tmpPst.route = pst->route;
612 tmpPst.selector = pst->selector;
613 tmpPst.region = rgSchCb[instId].rgSchInit.region;
614 tmpPst.pool = rgSchCb[instId].rgSchInit.pool;
615 tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId;
616 tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent;
617 tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + SCH_INST_START;
618 tmpPst.event = EVTNONE;
619 tmpPst.dstProcId = pst->srcProcId;
620 tmpPst.dstEnt = pst->srcEnt;
621 tmpPst.dstInst = pst->srcInst;
623 if(spId < rgSchCb[instId].numSaps)
625 /* Check the state of the SAP */
626 switch (rgSchCb[instId].rgrSap[spId].sapSta.sapState)
628 /* This case might not be needed if SAP not configured then it will go
629 * to else of above if condition */
630 case LRG_UNBND: /* SAP is not bound */
631 RLOG0(L_DEBUG,"SAP Not yet bound");
632 rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_BND;
633 rgSchCb[instId].rgrSap[spId].sapCfg.suId = suId;
634 /* Send Bind Confirm with status as SUCCESS */
635 ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK);
636 /*Indicate to Layer manager */
637 rgSCHUtlFillDgnParams(instId, &dgn, LRG_USTA_DGNVAL_MEM);
638 ret = rgSCHLmmStaInd(instId, LCM_CATEGORY_INTERFACE,
639 LRG_EVENT_RGRSAP_ENB, LCM_CAUSE_UNKNOWN, &dgn);
641 case LRG_BND: /* SAP is already bound*/
642 RLOG0(L_DEBUG,"SAP is already bound");
643 ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_OK);
645 default: /* Should Never Enter here */
646 #if (ERRCLASS & ERRCLS_ADD_RES)
647 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001,
648 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
649 "Invalid SAP State:RgUiRrgBndReq failed\n");
651 ret = rgSCHUtlRgrBndCfm(instId, suId, CM_BND_NOK);
657 #if (ERRCLASS & ERRCLS_ADD_RES)
658 /* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state
659 to spId to avoid seg fault due to invalid sapID */
660 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002,
661 (ErrVal)spId, "Invalid SAP Id:RgUiRrgBndReq failed\n");
663 ret = RgUiRgrBndCfm(&tmpPst, suId, CM_BND_NOK);
666 } /* RgUiRgrBndReq */
669 * @brief API for unbind request from RRM towards MAC.
673 * Function: RgUiRgrUbndReq
675 * This API is invoked by RRM towards MAC to unbind RGR SAP.
676 * These API validates the Pst, spId, suId and transfers the unbind request
677 * specific information to corresponding ownership module (GOM) API.
680 * @param[in] Pst *pst
681 * @param[in] SuId suId
682 * @param[in] Reason reason
688 PUBLIC S16 RgUiRgrUbndReq
695 PUBLIC S16 RgUiRgrUbndReq(pst, spId, reason)
701 Inst instId = pst->dstInst-SCH_INST_START;
705 /* SAP Id validation */
706 if (spId < rgSchCb[instId].numSaps)
708 switch(rgSchCb[instId].rgrSap[spId].sapSta.sapState)
710 case LRG_BND: /* SAP is already bound*/
711 RLOG0(L_DEBUG,"SAP is already bound");
712 /* setting SAP state to UN BOUND */
713 rgSchCb[instId].rgrSap[spId].sapSta.sapState = LRG_UNBND;
716 #if (ERRCLASS & ERRCLS_ADD_RES)
717 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003,
718 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
719 "Invalid SAP State: RgUiRgrUbndReq failed\n");
726 #if (ERRCLASS & ERRCLS_ADD_RES)
727 RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004,
728 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
729 "Invalid SAP Id:RgUiRgrUbndReq failed\n");
734 } /* RgUiRgrUbndReq */
737 * @brief API for configuration request from RRM towards MAC.
741 * Function: HandleSchCfgReq
743 * This API is invoked by RRM towards MAC to configure MAC.
744 * These API validates the Pst, spId, suId and transfers the config request
745 * specific information to corresponding ownership module (GOM) API.
748 * @param[in] Pst *pst
749 * @param[in] RgrCfgTransId transId
750 * @param[in] RgrCfgReqInfo *cfgReqInfo
756 PUBLIC S16 HandleSchCfgReq
759 RgrCfgTransId transId,
760 RgrCfgReqInfo *cfgReqInfo
763 PUBLIC S16 HandleSchCfgReq(pst, transId, cfgReqInfo)
765 RgrCfgTransId transId;
766 RgrCfgReqInfo *cfgReqInfo;
772 U8 cfmStatus = 0x00ff;
773 U8 prntTrans[RGR_CFG_TRANSID_SIZE+1];
774 Inst instId = pst->dstInst-SCH_INST_START;
776 TRC3(HandleSchCfgReq);
778 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
779 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
782 if (cfgReqInfo == NULLP)
784 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer is NULL");
785 schSendCfgCfm(pst->region, pst->pool, transId, cfmStatus);
789 if (spId < rgSchCb[instId].numSaps)
791 switch(rgSchCb[instId].rgrSap[spId].sapSta.sapState)
793 case LRG_BND: /* SAP is already bound */
794 RLOG0(L_DEBUG,"SAP is already bound");
796 default: /* Should never reach here */
797 #if (ERRCLASS & ERRCLS_ADD_RES)
798 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG005,
799 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
800 "Invalid SAP State: HandleSchCfgReq failed\n");
802 SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
803 (Size)sizeof(*cfgReqInfo));
804 schSendCfgCfm(pst->region, pst->pool, transId, cfmStatus);
810 #if (ERRCLASS & ERRCLS_ADD_RES)
811 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG006,
812 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
813 "Invalid SAP Id:HandleSchCfgReq failed\n");
815 SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
816 (Size)sizeof(*cfgReqInfo));
817 schSendCfgCfm(pst->region, pst->pool, transId, cfmStatus);
821 /* Handle configuration */
822 ret = rgSCHGomHndlCfg(pst, &rgSchCb[instId],
823 transId, cfgReqInfo);
826 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Configuration Request Handling Failed");
831 } /* HandleSchCfgReq */
835 * @brief API for SI configuration request from RRM towards MAC.
839 * Function: RgUiRgrSiCfgReq
841 * This API is invoked by RRM towards MAC to configure SI at MAC.
842 * These API validates the Pst, spId, suId and transfers the
843 * config request specific information to corresponding ownership
847 * @param[in] Pst *pst
848 * @param[in] SpId spId
849 * @param[in] RgrCfgTransId transId
850 * @param[in] RgrSiCfgReqInfo *cfgReqInfo
856 PUBLIC S16 RgUiRgrSiCfgReq
860 RgrCfgTransId transId,
861 RgrSiCfgReqInfo *cfgReqInfo
864 PUBLIC S16 RgUiRgrSiCfgReq(pst, spId, transId, cfgReqInfo)
867 RgrCfgTransId transId;
868 RgrSiCfgReqInfo *cfgReqInfo;
872 U8 cfmStatus = RGR_CFG_CFM_NOK;
873 U8 prntTrans[RGR_CFG_TRANSID_SIZE+1];
874 Inst instId = pst->dstInst-SCH_INST_START;
876 TRC2(RgUiRgrSiCfgReq);
878 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
879 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
882 if (cfgReqInfo == NULLP)
884 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
886 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
890 if (spId < rgSchCb[instId].numSaps)
892 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
894 #if (ERRCLASS & ERRCLS_ADD_RES)
895 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007,
896 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
897 "Invalid SAP State: RgUiRgrSiCfgReq failed\n");
899 SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
900 (Size)sizeof(*cfgReqInfo));
901 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
907 #if (ERRCLASS & ERRCLS_ADD_RES)
908 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008,
909 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
910 "Invalid SAP Id:RgUiRgrSiCfgReq failed\n");
912 SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
913 (Size)sizeof(*cfgReqInfo));
914 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
918 /* Handle configuration */
920 if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable)
922 ret = rgSCHGomEmtcHndlSiCfg(pst->region, pst->pool,
923 &rgSchCb[instId], spId, transId,
928 ret = rgSCHGomHndlSiCfg(pst->region, pst->pool,
929 &rgSchCb[instId], spId, transId,
933 ret = rgSCHGomHndlSiCfg(pst->region, pst->pool,
934 &rgSchCb[instId], spId, transId,
939 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"RgUiRgrSiCfgReq:"
940 "Configuration Request Handling Failed");
945 } /* RgUiRgrSiCfgReq */
949 * @brief API for Warning SI configuration request from RRM towards MAC.
953 * Function: RgUiRgrWarningSiCfgReq
955 * This API is invoked by RRM towards MAC to configure SI at MAC.
956 * These API validates the Pst, spId, suId and transfers the
957 * config request specific information to corresponding ownership
961 * @param[in] Pst *pst
962 * @param[in] SpId spId
963 * @param[in] RgrCfgTransId transId
964 * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
970 PUBLIC S16 RgUiRgrWarningSiCfgReq
974 RgrCfgTransId transId,
975 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
978 PUBLIC S16 RgUiRgrWarningSiCfgReq(pst, spId, transId, warningSiCfgReqInfo)
981 RgrCfgTransId transId;
982 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo;
985 Inst instId = pst->dstInst-SCH_INST_START;
987 U8 cfmStatus = RGR_CFG_CFM_NOK;
988 U8 prntTrans[RGR_CFG_TRANSID_SIZE+1];
990 TRC2(RgUiRgrWarningSiCfgReq);
992 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
993 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
997 if (warningSiCfgReqInfo == NULLP)
999 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
1001 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, 0, transId, cfmStatus);
1005 if (spId < rgSchCb[instId].numSaps)
1007 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
1009 #if (ERRCLASS & ERRCLS_ADD_RES)
1010 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG023,
1011 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
1012 "Invalid SAP State: warningSiCfgReqInfo failed\n");
1014 rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool,
1015 &warningSiCfgReqInfo->siPduLst);
1016 SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
1017 sizeof(RgrWarningSiCfgReqInfo));
1018 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId,
1019 transId, cfmStatus);
1025 #if (ERRCLASS & ERRCLS_ADD_RES)
1026 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG024,
1027 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
1028 "Invalid SAP Id:warningSiCfgReqInfo failed\n");
1030 rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool,
1031 &warningSiCfgReqInfo->siPduLst);
1032 SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
1033 sizeof(RgrWarningSiCfgReqInfo));
1034 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId,
1035 transId, cfmStatus);
1039 /* Handle configuration */
1041 if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable)
1043 ret = rgSCHGomEmtcHndlWarningSiCfg(pst->region, pst->pool,
1044 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
1048 ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool,
1049 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
1052 ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool,
1053 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
1057 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,
1058 "Configuration Request Handling Failed");
1067 * @brief API for Warning SI Stop request from RRM towards MAC.
1071 * Function: RgUiRgrWarningSiStopReq
1073 * This API is invoked by RRM towards MAC to Stop warning SI at MAC.
1074 * These API validates the Pst, spId, suId and transfers the
1075 * stop request specific information to corresponding ownership
1079 * @param[in] Pst *pst
1080 * @param[in] SpId spId
1081 * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
1087 PUBLIC S16 RgUiRgrWarningSiStopReq
1091 RgrCfgTransId transId,
1095 PUBLIC S16 RgUiRgrWarningSiStopReq(pst,spId, transId, siId)
1098 RgrCfgTransId transId;
1102 Inst instId = pst->dstInst-SCH_INST_START;
1104 TRC3(RgUiRgrWarningSiStopReq)
1108 if (spId < rgSchCb[instId].numSaps)
1110 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
1112 #if (ERRCLASS & ERRCLS_ADD_RES)
1113 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG025,
1114 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
1115 "Invalid SAP State: RgUiRgrWarningSiStopReq failed\n");
1122 #if (ERRCLASS & ERRCLS_ADD_RES)
1123 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG026,
1124 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
1125 "Invalid SAP Id:RgUiRgrWarningSiStopReq failed\n");
1130 rgSCHGomHndlWarningSiStopReq(pst->region, pst->pool,
1131 &rgSchCb[instId], siId, transId, spId);
1135 #endif /*RGR_SI_SCH */
1137 /* LTE_ADV_FLAG_REMOVED_START */
1140 * @brief API for LOAD INF request from RRM towards MAC.
1144 * Function: RgUiRgrLoadInfReq
1146 * This API is invoked by RRM towards MAC to configure LOAD INF Parameters at MAC.
1147 * These API validates the Pst, spId, suId and transfers the
1148 * LOAD INF request to corresponding ownership
1152 * @param[in] Pst *pst
1153 * @param[in] SpId spId
1154 * @param[in] RgrCfgTransId transId
1155 * @param[in] RgrLoadInfReqInfo *loadInfReq
1161 PUBLIC S16 RgUiRgrLoadInfReq
1165 RgrCfgTransId transId,
1166 RgrLoadInfReqInfo *loadInfReq
1169 PUBLIC S16 RgUiRgrLoadInfReq(pst, spId, transId, loadInfReq)
1172 RgrCfgTransId transId;
1173 RgrLoadInfReqInfo *loadInfReq;
1177 U8 prntTrans[RGR_CFG_TRANSID_SIZE+1];
1178 Inst instId = pst->dstInst-SCH_INST_START;
1180 TRC2(RgUiRgrLoadInfReq);
1182 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
1183 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
1186 if (loadInfReq == NULLP)
1188 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
1193 if (spId < rgSchCb[instId].numSaps)
1195 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
1197 #if (ERRCLASS & ERRCLS_ADD_RES)
1198 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007,
1199 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
1200 "Invalid SAP State: RgUiRgrLoadInfReq failed\n");
1202 SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq,
1203 (Size)sizeof(*loadInfReq));
1209 #if (ERRCLASS & ERRCLS_ADD_RES)
1210 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008,
1211 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
1212 "Invalid SAP Id:RgUiRgrLoadInfReq failed\n");
1214 SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq,
1215 (Size)sizeof(*loadInfReq));
1219 /* Handle configuration */
1220 ret = rgSCHGomHndlLoadInf(pst->region, pst->pool,
1221 &rgSchCb[(pst->dstInst - SCH_INST_START)], spId, transId,
1225 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,
1226 "Configuration Request Handling Failed");
1231 } /* RgUiRgrLoadInfReq */
1232 /* LTE_ADV_FLAG_REMOVED_END */
1234 /************** MAC SCH Interface **************/
1236 * @brief Function for updating dedicated channel BO at scheduler from MAC.
1240 * Function : rgMacSchDedBoUpdtReq
1242 * This function shall be invoked whenever MAC gets staRsp from RLC
1243 * Scheduler shall update BO in its dedicated logical channel control block.
1245 * @param[in] Pst* pst
1246 * @param[in] S16 cellSapId
1247 * @param[in] RgInfDedBoRpt *boRpt
1252 PUBLIC S16 RgMacSchDedBoUpdtReq
1255 RgInfDedBoRpt *boRpt
1258 PUBLIC S16 RgMacSchDedBoUpdtReq(pst, boRpt)
1260 RgInfDedBoRpt *boRpt;
1270 Inst inst = (pst->dstInst - SCH_INST_START);
1271 S16 cellSapId = boRpt->cellSapId;
1273 TRC3(RgMacSchDedBoUpdtReq)
1275 RLOG_ARG2(L_DEBUG,DBG_CELLID,boRpt->cellId,"rgMacSchDedBoUpdtReq():"
1276 " boRpt->rnti = %u boRpt->lcId = %u",boRpt->rnti, boRpt->lcId);
1278 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1279 * it doesnt exist */
1280 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1283 if (cell->cellId != boRpt->cellId)
1285 /* Handle Cell fetch failure */
1286 RGSCHLOGERROR(inst, ERRCLS_INT_PAR,ERG009,(ErrVal)boRpt->cellId,
1287 "rgMacSchDedBoUpdtReq(): Invalid cell Id");
1292 /* Update Bo in the given logical channel of the UE */
1293 if ((ue = rgSCHDbmGetUeCb(cell, boRpt->rnti)) != NULLP)
1296 /* Honor BO Reports only from PCELL */
1298 if (cell != ue->cell)
1303 if ((dlLc = rgSCHDbmGetDlDedLcCb(ue, boRpt->lcId)) != NULLP)
1306 if(dlLc->lcType == CM_LTE_LCH_DTCH)
1308 if((dlLc->bo == 0) &&(boRpt->bo != 0))
1311 if(!(ue->qciActiveLCs[dlLc->qciCb->qci]))
1313 dlLc->qciCb->dlUeCount++;
1315 ue->qciActiveLCs[dlLc->qciCb->qci]++;
1317 else if((dlLc->bo != 0) && (boRpt->bo == 0) && (dlLc->qciCb->dlUeCount))
1319 /* UE is inactive */
1320 if (ue->qciActiveLCs[dlLc->qciCb->qci])
1322 ue->qciActiveLCs[dlLc->qciCb->qci]--;
1323 if (!(ue->qciActiveLCs[dlLc->qciCb->qci]))
1325 dlLc->qciCb->dlUeCount--;
1332 dlUe = RG_SCH_CMN_GET_DL_UE(ue, cell);
1333 if (boRpt->bo > dlLc->bo)
1335 dlUe->boReported += (boRpt->bo - dlLc->bo);
1339 if (boRpt->bo > dlLc->bo)
1341 ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlBo += ((boRpt->bo - dlLc->bo)<<3);
1344 /* RLC provides cumulative BO for each LC.
1345 * Reduce the left out unscheduled bo from total bo and
1346 * update the new BO to the total bo */
1347 if(ue->totalBo >= dlLc->bo)
1349 ue->totalBo -= dlLc->bo;
1353 ue->totalBo = 0; /* this case should not arise
1354 * Resetting for safety */
1357 ue->totalBo += boRpt->bo;
1358 dlLc->bo = boRpt->bo;
1359 dlLc->oldestSduArrTime = boRpt->oldestSduArrTime;
1360 dlLc->staPduBo = boRpt->staPduBo;
1362 dlLc->setMaxUlPrio = boRpt->setMaxUlPrio;
1363 dlLc->setMaxDlPrio = boRpt->setMaxDlPrio;
1364 /* Update the scheduler */
1365 rgSCHUtlDlDedBoUpd(cell, ue, dlLc);
1371 } /* end of rgMacSchDedBoUpdtReq */
1375 * @brief Function for updating common channel BO at scheduler from MAC.
1379 * Function : RgMacSchCmnBoUpdtReq
1381 * This function shall be invoked whenever MAC gets staRsp from RLC
1382 * Scheduler shall update BO in its common logical channel control block.
1384 * @param[in] Pst* pst
1385 * @param[in] S16 cellSapId
1386 * @param[in] RgInfCmnBoRpt *boRpt
1391 PUBLIC S16 RgMacSchCmnBoUpdtReq
1394 RgInfCmnBoRpt *boRpt
1397 PUBLIC S16 RgMacSchCmnBoUpdtReq(pst, boRpt)
1399 RgInfCmnBoRpt *boRpt;
1403 Inst inst = (pst->dstInst - SCH_INST_START);
1404 S16 cellSapId = boRpt->cellSapId;
1406 TRC3(RgMacSchCmnBoUpdtReq)
1408 /* No need to chk for cell being NULL as MAC would not have found instance if
1409 * it doesnt exist */
1410 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1411 if (cell->cellId != boRpt->cellId)
1413 RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():"
1414 "Invalid boRpt cell Id:%d",boRpt->cellId);
1418 /* handle status response on CCCH */
1419 if(boRpt->lcId == cell->dlCcchId)
1421 RLOG_ARG0(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():"
1422 " BO update for CCCH");
1423 rgSCHUtlHndlCcchBoUpdt(cell, boRpt);
1427 rgSCHUtlHndlBcchPcchBoUpdt(cell, boRpt);
1431 } /* end of RgMacSchCmnBoUpdtReq */
1432 /*Fix: start: Inform UE delete to scheduler*/
1434 * @brief This API is used to send data indication to Scheduler instance from MAC.
1438 * Function : rgMacSchUeDelInd
1440 * This function shall be invoked whenever MAC gets Ue delete request.
1443 * @param[in] Pst* pst
1444 * @param[in] RgInfUeDelInd *ueDelInd
1449 PUBLIC S16 RgMacSchUeDelInd
1452 RgInfUeDelInd *ueDelInd
1455 PUBLIC S16 RgMacSchUeDelInd(pst, ueDelInd)
1457 RgInfUeDelInd *ueDelInd;
1461 Inst inst = (pst->dstInst - SCH_INST_START);
1462 S16 cellSapId = ueDelInd->cellSapId;
1464 RgSchRntiLnk *rntiLnk=NULL;
1466 TRC3(RgMacSchUeDelInd)
1468 if (rgSchCb[inst].rgrSap == NULLP || rgSchCb[inst].rgrSap[cellSapId].cell == NULLP)
1470 RLOG_ARG0(L_ERROR,DBG_CELLID,ueDelInd->cellId,"rgrSap or cell is not configured");
1473 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1475 if (cell->cellId != ueDelInd->cellId)
1477 /* Handle Cell fetch failure */
1478 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1479 "rgMacSchUeDelInd(): Invalid ueDelInd cell Id:%d",
1485 CM_LLIST_FIRST_NODE(&cell->rntiDb.rntiGuardPool, tmp);
1489 rntiLnk = (RgSchRntiLnk *)(tmp->node);
1490 if(rntiLnk->rnti == ueDelInd->rnti)
1492 cmLListDelFrm(&cell->rntiDb.rntiGuardPool, tmp);
1494 rgSCHDbmRlsRnti(cell, rntiLnk);
1495 RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId,
1496 "RNTI:%d Released from the Guard pool(%ld)",
1497 ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count);
1501 CM_LLIST_NEXT_NODE(&cell->rntiDb.rntiGuardPool, tmp);
1505 rgEmtcMacSchUeDelInd(cell,ueDelInd);
1510 /* Fix : syed HO UE does not have a valid ue->rntiLnk */
1511 RLOG_ARG2(L_INFO,DBG_CELLID,ueDelInd->cellId,"HO CRNTI:%d not present in the"
1512 "Guard Pool:%ld", ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count);
1516 } /* rgMacSchUeDelInd */
1517 /*Fix: end: Inform UE delete to scheduler*/
1519 * @brief This API is used to send data indication to Scheduler instance from MAC.
1523 * Function : rgMacSchSfRecpInd
1525 * This function shall be invoked whenever MAC gets datInd on TFU
1526 * Scheduler shall act on the CEs and data that are received as part of
1529 * @param[in] Pst* pst
1530 * @param[in] S16 cellSapId
1531 * @param[in] CmLteRnti rnti
1532 * @param[in] DatIndInfo *datInd
1537 PUBLIC S16 RgMacSchSfRecpInd
1540 RgInfSfDatInd *subfrmInfo
1543 PUBLIC S16 RgMacSchSfRecpInd(pst, subfrmInfo)
1545 RgInfSfDatInd *subfrmInfo;
1551 RgInfUeDatInd *datInd;
1553 Inst inst = (pst->dstInst - SCH_INST_START);
1557 S16 cellSapId = subfrmInfo->cellSapId;
1558 RgrUeStaIndInfo *ueStaInd;
1561 RgSchCmnUlUeSpsInfo *ulSpsUe ;
1569 U16 datIndActQci = 0;
1570 U16 combDatIndActQci = 0; /* Prev and Latest Dat Ind combined */
1571 U16 tempUeActQci = 0; /* UE specific Active QCIs */
1575 TRC3(RgMacSchSfRecpInd)
1577 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1578 * it doesnt exist */
1579 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1581 /* lnkLst assignment */
1582 lnkLst = &(subfrmInfo->ueLst);
1584 CM_LLIST_FIRST_NODE(lnkLst, tmp);
1586 while((NULLP != tmp) && ((RgInfUeDatInd *)tmp->node != NULLP))
1592 datInd = (RgInfUeDatInd *)tmp->node;
1593 rnti = datInd->rnti;
1595 /* We shall try and find
1596 * out the RaCb based on the following -
1597 * 1. If the incoming PDU contained a CCCH SDU i.e. this is message 3.
1598 * 2. If the incoming PDU contained a CRNTI control element, i.e. we should
1599 * have a ueCb also for this
1602 /* It could be that a non-msg3 pdu contains a CRNTI Control element. We
1603 * should check for CRNTI CE and if it exists the UECb must exist, also an
1604 * if the CRNTI in the CE and the one with which the message came in are
1605 * different we shall look for an raCb as well.
1607 if (datInd->ceInfo.bitMask & RGSCH_CRNTI_CE_PRSNT)
1609 /* SR_RACH_STATS : CRNTI CE*/
1612 if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT)
1614 RGSCH_FREE_MEM(subfrmInfo);
1615 err.errType = RGSCHERR_TOM_DATIND;
1616 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1617 "Received MSG3 with CRNTI:%d and also CCCH ",
1618 datInd->ceInfo.ces.cRnti);
1621 ue = rgSCHDbmGetUeCb (cell, datInd->ceInfo.ces.cRnti);
1624 /* SR_RACH_STATS : CRNTI CE UECB NOT FOUND*/
1625 rgNumCrntiCeCrntiNotFound++;
1626 /* ccpu00141318 - Removed condition for SPS rnti checking*/
1627 RGSCH_FREE_MEM(subfrmInfo);
1628 err.errType = RGSCHERR_TOM_DATIND;
1629 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Received MSG3 "
1630 "with CRNTI:%d unable to find ueCb",
1631 datInd->ceInfo.ces.cRnti);
1635 if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue,
1636 rnti, datInd, &err)) != ROK)
1638 RGSCH_FREE_MEM(subfrmInfo);
1639 err.errType = RGSCHERR_TOM_DATIND;
1640 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Processing for MSG3 failed for CRNTI:%d",
1646 rgSCHUtlHdlCrntiCE (cell, ue);
1648 ret = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&ueStaInd,
1649 sizeof(RgrUeStaIndInfo));
1652 ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD;
1655 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue);
1656 if(ulSpsUe->isUlSpsActv)
1658 ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD_IN_SPS_ACTIVE;
1659 ue->ul.ulSpsCfg.isLcSRMaskEnab = FALSE;
1662 ret = rgSCHUtlFillSndUeStaInd(cell, ue, ueStaInd);
1665 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1666 "Could not Send Ue Sta Ind UEID:%d",ue->ueId);
1669 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1671 } /* end of CRNTI based message */
1672 else if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT)
1674 /* SR_RACH_STATS : CCCH SDU */
1676 /* SR_RACH_STATS : CCCH SDU RACB NOT FOUND*/
1677 if (NULLP == rgSCHDbmGetRaCb (cell, rnti))
1679 rgNumCCCHSduCrntiNotFound++;
1682 if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue,
1683 rnti, datInd, &err)) != ROK)
1685 RGSCH_FREE_MEM(subfrmInfo);
1686 err.errType = RGSCHERR_TOM_DATIND;
1687 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Processing for MSG3 failed for CRNTI:%d",
1692 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1694 } /* end of Msg3 processing */
1698 ue = rgSCHDbmGetUeCb (cell, datInd->rnti);
1702 if((ue = rgSCHDbmGetSpsUeCb (cell, datInd->rnti)) == NULLP)
1705 RGSCH_FREE_MEM(subfrmInfo);
1706 err.errType = RGSCHERR_TOM_DATIND;
1707 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the UE CB for CRNTI:%d",
1715 /* The LCs for which data is received at MAC is provided to SCH.
1716 This information is used to estimate the Active LCs at UE
1717 since estimates based on only BSR is not accurate */
1718 if (datInd->ceInfo.bitMask & RGSCH_ACTIVE_LC_PRSNT)
1721 /* Compose a Bitmask with for the QCI's for which Data
1723 for (lcCount = 0; lcCount < RGINF_MAX_NUM_DED_LC; lcCount++)
1725 if ((datInd->ceInfo.ulActLCs[lcCount] == TRUE) && (TRUE == ue->ul.lcCb[lcCount].isValid))
1727 datIndActQci |= (1 << (ue->ul.lcCb[lcCount].qciCb->qci -1));
1730 if (ue->ulActiveLCs && ue->lastDatIndLCs)
1732 /* Combine previous Dat Ind and current Dat Ind to
1733 estimate active LCs at UE */
1734 combDatIndActQci = ue->lastDatIndLCs | datIndActQci;
1735 tempUeActQci = ue->ulActiveLCs;
1736 ue->ulActiveLCs = combDatIndActQci;
1737 diffBits = combDatIndActQci ^ tempUeActQci;
1743 if (0x1 & tempUeActQci)
1745 /* An active QCI has become inactive */
1746 cell->qciArray[qci].ulUeCount--;
1750 /* An Inactive QCI has become active */
1751 cell->qciArray[qci].ulUeCount++;
1758 ue->lastDatIndLCs = datIndActQci;
1762 #endif /* LTE_L2_MEAS */
1763 /* Just copy the timing information from the dat indication into the one
1764 * stored in the UE CB, will be later utilized to handle Timing advance
1767 if ((ret = rgSCHUtlUpdSch (subfrmInfo, cell, ue, datInd, &err)) != ROK)
1769 RGSCH_FREE_MEM(subfrmInfo);
1770 err.errType = RGSCHERR_TOM_DATIND;
1771 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to handle Data"
1772 " Indication for UEID:%d",ue->ueId);
1776 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1779 /* update the UL PRB usage for all GBR QCIs*/
1780 for (idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++)
1782 cell->prbUsage.qciPrbRpts[idx].ulTotPrbUsed += subfrmInfo->qcisUlPrbCnt[idx];
1786 /* chk if Sch needs to dealloc datInd after unpk */
1787 RGSCH_FREE_MEM(subfrmInfo);
1789 } /* rgMacSchSfRecpInd */
1793 * @brief Function to handle relInd from MAC for a UE
1797 * Function: RgMacSchSpsRelInd
1799 * Handler for processing relInd for UL SPS of a UE
1806 * @param[in] Pst *pst
1807 * @param[in] RgInfSpsRelInfo *relInfo
1813 PUBLIC S16 RgMacSchSpsRelInd
1816 RgInfSpsRelInfo *relInfo
1819 PUBLIC S16 RgMacSchSpsRelInd(pst, relInfo)
1821 RgInfSpsRelInfo *relInfo;
1826 Inst inst = (pst->dstInst - SCH_INST_START);
1828 TRC2(RgMacSchSpsRelInd);
1830 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1831 * it doesnt exist */
1832 cell = rgSchCb[inst].rgrSap[relInfo->cellSapId].cell;
1834 if ((ue = rgSCHDbmGetUeCb(cell, relInfo->cRnti)) == NULLP)
1836 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1837 "No Ue exists with CRNTI:%d",relInfo->cRnti);
1841 if ((rgSCHUtlSpsRelInd(cell, ue, relInfo->isExplRel)) != ROK)
1843 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1844 "RelInd processing for CRNTI:%d failed",relInfo->cRnti);
1848 } /* end of RgMacSchSpsRelInd */
1849 #endif /* LTEMAC_SPS */
1854 * @brief Function to handle L2MeasCfm from MAC
1858 * Function: RgMacSchL2MeasCfm
1860 * Handler for processing L2 measurement confirm
1867 * @param[in] Pst *pst
1868 * @param[in] RgInfL2MeasCfm *measCfm
1874 PUBLIC S16 RgMacSchL2MeasCfm
1877 RgInfL2MeasCfm *measCfm
1880 PUBLIC S16 RgMacSchL2MeasCfm(pst, measCfm)
1882 RgInfL2MeasCfm *measCfm;
1885 RgSchCellCb *cell = NULLP;
1886 Inst inst = (pst->dstInst - SCH_INST_START);
1888 RgSchL2MeasCb *measCb = NULLP;
1889 RgSchCb *instCb = &rgSchCb[inst];
1891 LrgSchMeasCfmInfo schMeasCfm;
1893 U8 idx1; /*LTE_L2_MEAS_PHASE2*/
1895 TRC2(RgMacSchL2MeasCfm);
1897 /* Find the cellCb using cellId in measInfo. Iterate through all cells
1898 * in rgrsapCb in RgschCb */
1899 for (idx = 0; idx < instCb->numSaps; idx++)
1901 if ( instCb->rgrSap[idx].cell->cellId == measCfm->cellId)
1903 /* got the cell break the loop */
1904 cell = instCb->rgrSap[idx].cell;
1908 /* If no cellCb return Err with Invalid Cell Id */
1911 RLOG_ARG0(L_ERROR,DBG_CELLID,measCfm->cellId,
1912 "Meas Cfm Failed.Invalid Cell Id");
1917 /* Iterate through all meas requests in l2mList in cellCb */
1918 lnk = cell->l2mList.first;
1921 /* Get the MeasCb : RgSchL2MeasCb */
1922 measCb = (RgSchL2MeasCb *)lnk->node;
1924 if (measCb->measReq.hdr.transId == measCfm->transId)
1929 if ( measCb == NULLP )
1931 RETVALUE( RFAILED );
1935 if(measCfm->cfm.status != LCM_PRIM_OK)
1937 for (idx = 0; idx < measCb->measReq.avgPrbQciUl.numQci; idx++)
1939 qciVal = measCb->measReq.avgPrbQciUl.qci[idx];
1940 cell->qciArray[qciVal].qci = 0;
1942 /* Delete this measCb, send the negative confirmation to
1944 cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
1945 /* ccpu00117052 - MOD - Passing double pointer
1946 for proper NULLP assignment*/
1947 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb, sizeof(RgSchL2MeasCb));
1948 cmMemset((U8 *)&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo));
1949 schMeasCfm.measType = measCfm->measType;
1950 schMeasCfm.cfm = measCfm->cfm;
1951 schMeasCfm.hdr.transId = measCfm->transId;
1952 schMeasCfm.cellId = measCfm->cellId;
1953 RgMiLrgSchL2MeasCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm);
1956 for(idx = 0; idx < measCfm->u.prbCfm.numQci; idx++)
1958 measCb->avgPrbQciUl.prbUsage[idx].prbUsage = measCfm->u.prbCfm.prbUsage[idx].prbUsage;
1959 measCb->avgPrbQciUl.prbUsage[idx].qciValue = measCfm->u.prbCfm.prbUsage[idx].qciValue;
1960 /*LTE_L2_MEAS_PHASE2*/
1961 qciVal1 = measCfm->u.prbCfm.prbUsage[idx].qciValue;
1962 for(idx1=0;idx1<measCb->measReq.avgPrbQciUl.numQci;idx1++)
1964 if(measCb->measReq.avgPrbQciUl.qci[idx1] == qciVal1)
1969 if(idx1 == measCb->measReq.avgPrbQciUl.numQci)
1971 measCb->measReq.avgPrbQciUl.qci[measCb->measReq.avgPrbQciUl.numQci++] = qciVal1;
1974 measCb->avgPrbQciUl.numQci = measCfm->u.prbCfm.numQci;
1975 measCb->cfmRcvd = TRUE;
1976 cell->sndL2Meas = TRUE;
1978 } /* end of RgMacSchL2MeasCfm */
1981 * @brief Function to handle L2MeasStopCfm from MAC
1985 * Function: RgMacSchL2MeasStopCfm
1987 * Handler for processing L2 measurement confirm
1994 * @param[in] Pst *pst
1995 * @param[in] RgInfL2MeasCfm *measCfm
2001 PUBLIC S16 RgMacSchL2MeasStopCfm
2004 RgInfL2MeasCfm *measCfm
2007 PUBLIC S16 RgMacSchL2MeasStopCfm(pst, measCfm)
2009 RgInfL2MeasCfm *measCfm;
2012 LrgSchMeasCfmInfo schMeasCfm;
2013 Inst inst = (pst->dstInst - SCH_INST_START);
2014 RgSchCb *instCb = &rgSchCb[inst];
2016 TRC2(RgMacSchL2MeasStopCfm);
2018 cmMemset((U8 *)&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo));
2019 schMeasCfm.measType = measCfm->measType;
2020 schMeasCfm.cfm = measCfm->cfm;
2021 schMeasCfm.hdr.transId = measCfm->transId;
2022 schMeasCfm.cellId = measCfm->cellId;
2023 RgMiLrgSchL2MeasStopCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm);
2028 /************** TFU Interface *************/
2031 * @brief Bind confirm API for TFU SAP on scheduler instance.
2035 * Function : RgLiTfuSchBndCfm
2037 * This API is invoked by PHY to confirm TFU SAP bind.
2040 * @param[in] Pst *pst
2041 * @param[in] SuId suId
2042 * @param[in] U8 status
2048 PUBLIC S16 RgLiTfuSchBndCfm
2055 PUBLIC S16 RgLiTfuSchBndCfm(pst, suId, status)
2062 RgSchLowSapCb *tfuSap;
2063 Inst instId = pst->dstInst - SCH_INST_START;
2065 TRC3(RgLiTfuSchBndCfm);
2068 if(suId >= rgSchCb[instId].numSaps)
2070 RLOG_ARG0(L_ERROR,DBG_INSTID,instId, "Incorrect SuId");
2073 /* Lets validate suId first */
2074 tfuSap = &(rgSchCb[instId].tfuSap[suId]);
2076 if (suId != tfuSap->sapCfg.suId)
2078 RLOG_ARG2(L_ERROR,DBG_INSTID,instId, "Incorrect SuId. Configured (%d)"
2079 "Recieved (%d)", tfuSap->sapCfg.suId, suId);
2082 ret = rgSCHLmmBndCfm (pst, suId, status);
2084 } /* RgLiTfuSchBndCfm */
2087 * @brief Random Access Request indication from PHY.
2091 * Function : RgLiTfuRaReqInd
2093 * This API is invoked by PHY to send Random Access Request to Scheduler.
2094 * This API contains information for Random Access Request including
2095 * raRnti, list of associated RAPIDs and related information.
2097 * @param[in] Pst *pst
2098 * @param[in] SuId suId
2099 * @param[in] TfuRaReqIndInfo *raReqInd
2105 PUBLIC S16 RgLiTfuRaReqInd
2109 TfuRaReqIndInfo *raReqInd
2112 PUBLIC S16 RgLiTfuRaReqInd(pst, suId, raReqInd)
2115 TfuRaReqIndInfo *raReqInd;
2119 Inst inst = pst->dstInst-SCH_INST_START;
2121 TRC3(RgLiTfuRaReqInd);
2123 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2125 RLOG_ARG1(L_ERROR,DBG_INSTID,inst,"SAP Validation failed SuId(%d)", suId);
2126 /* Free up the memory for the request structure */
2127 RGSCH_FREE_MEM(raReqInd);
2131 if(raReqInd == NULLP)
2133 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"Invalid input pointer for raReqInd Failed");
2137 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2139 RLOG_ARG0(L_ERROR,DBG_CELLID,raReqInd->cellId,"No cell exists");
2143 ret = rgSCHTomRaReqInd(rgSchCb[inst].tfuSap[suId].cell, raReqInd);
2144 /* Free up the memory for the request structure */
2145 RGSCH_FREE_MEM(raReqInd);
2146 /*SPutSBuf (pst->region, pst->pool, (Data *)raReqInd,
2147 sizeof(TfuRaReqIndInfo)); */
2149 } /* RgLiTfuRaReqInd */
2152 * @brief Uplink CQI indication from PHY.
2156 * Function : RgLiTfuUlCqiInd
2158 * This API is invoked by PHY to send Uplink CQI to Scheduler.
2159 * This API contains Uplink CQI information reported per UE.
2161 * @param[in] Pst *pst
2162 * @param[in] SuId suId
2163 * @param[in] TfuUlCqiIndInfo *ulCqiInd
2169 PUBLIC S16 RgLiTfuUlCqiInd
2173 TfuUlCqiIndInfo *ulCqiInd
2176 PUBLIC S16 RgLiTfuUlCqiInd(pst, suId, ulCqiInd)
2179 TfuUlCqiIndInfo *ulCqiInd;
2183 Inst inst = pst->dstInst-SCH_INST_START;
2185 TRC3(RgLiTfuUlCqiInd);
2187 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2189 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2190 /* Free up the memory for the request structure */
2191 RGSCH_FREE_MEM(ulCqiInd);
2195 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2197 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2198 /* Free up the memory for the request structure */
2199 RGSCH_FREE_MEM(ulCqiInd);
2202 ret = rgSCHTomUlCqiInd (rgSchCb[inst].tfuSap[suId].cell, ulCqiInd);
2203 /* Free up the memory for the request structure */
2204 RGSCH_FREE_MEM(ulCqiInd);
2206 } /* RgLiTfuUlCqiInd */
2209 * @brief PUCCH power adjustment indication.
2213 * Function : RgLiTfuPucchDeltaPwrInd
2215 * This API is invoked by PHY to send PUCCH power adjustment
2218 * @param[in] Pst *pst
2219 * @param[in] SuId suId
2220 * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
2226 PUBLIC S16 RgLiTfuPucchDeltaPwrInd
2230 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
2233 PUBLIC S16 RgLiTfuPucchDeltaPwrInd(pst, suId, pucchDeltaPwr)
2236 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr;
2240 Inst inst = pst->dstInst-SCH_INST_START;
2242 TRC3(RgLiTfuPucchDeltaPwrInd);
2244 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2246 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2247 /* Free up the memory for the request structure */
2248 RGSCH_FREE_MEM(pucchDeltaPwr);
2252 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2254 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2257 ret = rgSCHTomPucchDeltaPwrInd (rgSchCb[inst].tfuSap[suId].cell, pucchDeltaPwr);
2258 /* Free up the memory for the request structure */
2259 RGSCH_FREE_MEM(pucchDeltaPwr);
2261 } /* RgLiTfuPucchDeltaPwrInd */
2265 * @brief HARQ ACK indication from PHY for Downlink transmissions.
2269 * Function : RgLiTfuHqInd
2271 * This API is invoked by PHY to send HARQ ACK information to Scheduler
2272 * on recieving HARQ ACK/NACK from UEs.
2273 * This API contains HARQ ACK information recieved by PHY for downlink
2276 * @param[in] Pst *pst
2277 * @param[in] SuId suId
2278 * @param[in] TfuHqIndInfo *harqAckInd
2284 PUBLIC S16 RgLiTfuHqInd
2288 TfuHqIndInfo *harqAckInd
2291 PUBLIC S16 RgLiTfuHqInd(pst, suId, harqAckInd)
2294 TfuHqIndInfo *harqAckInd;
2298 Inst inst = (pst->dstInst - SCH_INST_START);
2303 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2305 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2306 RGSCH_FREE_MEM(harqAckInd);
2310 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2312 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2317 /* Now call the TOM (Tfu ownership module) primitive to process further */
2318 ret = rgSCHTomHarqAckInd (rgSchCb[inst].tfuSap[suId].cell, harqAckInd);
2319 /* Free up the memory for the request structure */
2320 RGSCH_FREE_MEM(harqAckInd);
2322 } /* RgLiTfuHqInd */
2326 * @brief Scheduling request(SR) indication from PHY for an UE.
2330 * Function : RgLiTfuSrInd
2332 * This API is invoked by PHY to send Scheduling request information to
2333 * Scheduler on recieving SR from a list of UEs.
2334 * This API contains scheduling request information recieved by PHY for UEs.
2336 * @param[in] Pst *pst
2337 * @param[in] SuId suId
2338 * @param[in] TfuSrIndInfo *srInd
2344 PUBLIC S16 RgLiTfuSrInd
2351 PUBLIC S16 RgLiTfuSrInd(pst, suId, srInd)
2354 TfuSrIndInfo *srInd;
2358 Inst inst = pst->dstInst-SCH_INST_START;
2363 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2365 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"() SAP Validation failed");
2366 RGSCH_FREE_MEM(srInd);
2370 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2372 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"RgLiTfuSrInd()No cell exists");
2376 /* Now call the TOM (Tfu ownership module) primitive to process further */
2377 ret = rgSCHTomSrInd (rgSchCb[inst].tfuSap[suId].cell, srInd);
2378 /* Free up the memory for the request structure */
2379 RGSCH_FREE_MEM(srInd);
2381 } /* RgLiTfuSrInd */
2385 * @brief Downlink CQI indication from PHY for an UE.
2389 * Function : RgLiTfuDlCqiInd
2391 * This API is invoked by PHY to send Downlink CQI indication to Scheduler
2392 * on recieving downlink CQI from UE.
2393 * This API contains downlink CQI information recieved by PHY for an UE.
2395 * @param[in] Pst *pst
2396 * @param[in] SuId suId
2397 * @param[in] TfuDlCqiIndInfo *dlCqiInd
2403 PUBLIC S16 RgLiTfuDlCqiInd
2407 TfuDlCqiIndInfo *dlCqiInd
2410 PUBLIC S16 RgLiTfuDlCqiInd(pst, suId, dlCqiInd)
2413 TfuDlCqiIndInfo *dlCqiInd;
2417 Inst inst = pst->dstInst-SCH_INST_START;
2419 TRC3(RgLiTfuDlCqiInd);
2421 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2423 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed");
2424 /* Free up the memory for the request structure */
2425 RGSCH_FREE_MEM(dlCqiInd);
2429 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2431 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2434 ret = rgSCHTomDlCqiInd (rgSchCb[inst].tfuSap[suId].cell, dlCqiInd);
2435 /* Free up the memory for the request structure */
2436 RGSCH_FREE_MEM(dlCqiInd);
2438 } /* RgLiTfuDlCqiInd */
2442 * @brief Raw CQI indication from PHY for an UE.
2446 * Function : RgLiTfuRawCqiInd
2448 * This API is invoked by PHY to send Raw CQI indication to Scheduler
2449 * on receiving Raw CQI from UE.
2450 * This API contains Raw CQI information recieved by PHY for an UE.
2452 * @param[in] Pst *pst
2453 * @param[in] SuId suId
2454 * @param[in] TfuRawCqiIndInfo *rawCqiInd
2460 PUBLIC S16 RgLiTfuRawCqiInd
2464 TfuRawCqiIndInfo *rawCqiInd
2467 PUBLIC S16 RgLiTfuRawCqiInd(pst, suId, rawCqiInd)
2470 TfuRawCqiIndInfo *rawCqiInd;
2474 Inst inst = pst->dstInst-SCH_INST_START;
2476 TRC3(RgLiTfuRawCqiInd);
2479 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2481 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2482 /* Free up the memory for the request structure */
2483 RGSCH_FREE_MEM(rawCqiInd);
2487 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2489 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," No cell exists");
2493 ret = rgSCHTomRawCqiInd (rgSchCb[inst].tfuSap[suId].cell, rawCqiInd);
2494 /* Free up the memory for the request structure */
2495 RGSCH_FREE_MEM(rawCqiInd);
2497 } /* RgLiTfuRawCqiInd */
2500 * @brief SRS indication from PHY for an UE.
2504 * Function : RgLiTfuSrsInd
2506 * This API is invoked by PHY to send UL SRS indication to Scheduler
2507 * on receiving a SRS from UE.
2508 * This API contains SRS information recieved by PHY for an UE.
2510 * @param[in] Pst *pst
2511 * @param[in] SuId suId
2512 * @param[in] TfuSrsIndInfo *srsInd
2518 PUBLIC S16 RgLiTfuSrsInd
2522 TfuSrsIndInfo *srsInd
2525 PUBLIC S16 RgLiTfuSrsInd(pst, suId, srsInd)
2528 TfuSrsIndInfo *srsInd;
2532 Inst inst = pst->dstInst-SCH_INST_START;
2534 TRC3(RgLiTfuSrsInd);
2536 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2538 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed");
2539 /* Free up the memory for the request structure */
2540 RGSCH_FREE_MEM(srsInd);
2544 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2546 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2549 ret = rgSCHTomSrsInd (rgSchCb[inst].tfuSap[suId].cell, srsInd);
2550 /* Free up the memory for the request structure */
2551 RGSCH_FREE_MEM(srsInd);
2553 } /* RgLiTfuSrsInd */
2558 * @brief DOA indication from PHY for an UE.
2562 * Function : RgLiTfuDoaInd
2564 * This API is invoked by PHY to send Direction Of Arrival to Scheduler
2565 * on calculating DOA at PHYSICAL LAYER for an UE.
2566 * This API contains DOA information calculated by PHY for an UE.
2568 * @param[in] Pst *pst
2569 * @param[in] SuId suId
2570 * @param[in] TfuDoaIndInfo *doaInd
2576 PUBLIC S16 RgLiTfuDoaInd
2580 TfuDoaIndInfo *doaInd
2583 PUBLIC S16 RgLiTfuDoaInd(pst, suId, doaInd)
2586 TfuDoaIndInfo *doaInd;
2590 Inst inst = pst->dstInst-SCH_INST_START;
2592 TRC2(RgLiTfuDoaInd);
2594 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2596 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2597 /* Free up the memory for the request structure */
2598 RGSCH_FREE_MEM(doaInd);
2602 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2604 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2607 ret = rgSCHTomDoaInd (rgSchCb[inst].tfuSap[suId].cell, doaInd);
2608 /* Free up the memory for the request structure */
2609 RGSCH_FREE_MEM(doaInd);
2611 } /* RgLiTfuDlCqiInd */
2614 * @brief CRC indication from PHY.
2618 * Function : RgLiTfuCrcInd
2620 * This API is invoked by PHY to give CRC indication to scheduler.
2622 * @param[in] Pst *pst
2623 * @param[in] SuId suId
2624 * @param[in] TfuCrcIndInfo *crcInd
2630 PUBLIC S16 RgLiTfuCrcInd
2634 TfuCrcIndInfo *crcInd
2637 PUBLIC S16 RgLiTfuCrcInd (pst, suId, crcInd)
2640 TfuCrcIndInfo *crcInd;
2644 Inst inst = pst->dstInst-SCH_INST_START;
2646 TRC3(RgLiTfuCrcInd);
2647 #ifdef XEON_SPECIFIC_CHANGES
2648 struct timeval start6, end6;
2649 gettimeofday(&start6, NULL);
2652 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2654 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2655 RGSCH_FREE_MEM(crcInd);
2659 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2661 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2666 /* Now call the TOM (Tfu ownership module) primitive to process further */
2667 ret = rgSCHTomCrcInd(rgSchCb[inst].tfuSap[suId].cell, crcInd);
2668 /* Free up the memory for the request structure */
2669 RGSCH_FREE_MEM(crcInd);
2670 #ifdef XEON_SPECIFIC_CHANGES
2671 gettimeofday(&end6, NULL);
2674 } /* RgLiTfuCrcInd */
2677 * @brief Timing Advance indication from PHY.
2681 * Function : RgLiTfuTimingAdvInd
2683 * This API is invoked by PHY to indicate timing advance to Scheduler for
2686 * @param[in] Pst *pst
2687 * @param[in] SuId suId
2688 * @param[in] TfuTimingAdvIndInfo *timingAdvInd
2694 PUBLIC S16 RgLiTfuTimingAdvInd
2698 TfuTimingAdvIndInfo *timingAdvInd
2701 PUBLIC S16 RgLiTfuTimingAdvInd(pst, suId, timingAdvInd)
2704 TfuTimingAdvIndInfo *timingAdvInd;
2708 Inst inst = pst->dstInst-SCH_INST_START;
2710 TRC3(RgLiTfuTimingAdvInd);
2712 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2714 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2715 /* Free up the memory for the request structure */
2716 RGSCH_FREE_MEM(timingAdvInd);
2720 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2722 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2725 /* Now call the TOM (Tfu ownership module) primitive to process further */
2726 ret = rgSCHTomTimingAdvInd(rgSchCb[inst].tfuSap[suId].cell, timingAdvInd);
2727 /* Free up the memory for the request structure */
2728 RGSCH_FREE_MEM(timingAdvInd);
2730 } /* RgLiTfuTimingAdvInd */
2734 * @brief Transmission time interval indication from PHY.
2738 * Function : RgLiTfuSchTtiInd
2740 * This API is invoked by PHY to indicate TTI indication to Scheduler for
2743 * @param[in] Pst *pst
2744 * @param[in] SuId suId
2745 * @param[in] TfuTtiIndInfo *ttiInd
2751 PUBLIC S16 RgLiTfuSchTtiInd
2755 TfuTtiIndInfo *ttiInd
2758 PUBLIC S16 RgLiTfuSchTtiInd(pst, suId, ttiInd)
2761 TfuTtiIndInfo *ttiInd;
2765 Inst inst = pst->dstInst-SCH_INST_START;
2767 TRC3(RgLiTfuSchTtiInd);
2770 /* Removing the validation with every TTI - for optimization */
2772 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2774 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2778 /* Moved check for cell outside ERRCLS*/
2780 /* Now call the TOM (Tfu ownership module) primitive to process further */
2781 rgSCHTomTtiInd(ttiInd, inst);
2784 } /* RgLiTfuSchTtiInd */
2786 /************* RGM Interface ****************/
2788 * @brief API for bind request from RRM towards MAC.
2792 * Function: RgUiRgmBndReq
2794 * This API is invoked by RRM towards MAC to bind RGM SAP.
2795 * These API validates the Pst, spId, suId and sends the bind confirm to
2799 * @param[in] Pst *pst
2800 * @param[in] SuId suId
2801 * @param[in] SpId spId
2807 PUBLIC S16 RgUiRgmBndReq
2814 PUBLIC S16 RgUiRgmBndReq(pst, suId, spId)
2821 Pst tmpPst; /* Temporary Post Structure */
2822 Inst instId = pst->dstInst-SCH_INST_START;
2827 tmpPst.prior = pst->prior;
2828 tmpPst.route = pst->route;
2829 tmpPst.selector = pst->selector;
2830 tmpPst.region = rgSchCb[instId].rgSchInit.region;
2831 tmpPst.pool = rgSchCb[instId].rgSchInit.pool;
2833 tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId;
2834 tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent;
2835 tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + SCH_INST_START;
2837 tmpPst.event = EVTNONE;
2839 tmpPst.dstProcId = pst->srcProcId;
2840 tmpPst.dstEnt = pst->srcEnt;
2841 tmpPst.dstInst = pst->srcInst;
2843 /*TODO remove follo statement*/
2844 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND;
2846 if(spId < rgSchCb[instId].numSaps)
2848 /* Check the state of the SAP */
2849 switch (rgSchCb[instId].rgmSap[spId].sapSta.sapState)
2851 /* This case might not be needed if SAP not configured then it will go
2852 * to else of above if condition */
2853 case LRG_UNBND: /* SAP is not bound */
2854 RLOG0(L_DEBUG,"SAP is not yet bound");
2855 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_BND;
2856 rgSchCb[instId].rgmSap[spId].sapCfg.suId = suId;
2857 /* Send Bind Confirm with status as SUCCESS */
2858 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK);
2859 /*Indicate to Layer manager */
2861 case LRG_BND: /* SAP is already bound*/
2862 RLOG0(L_DEBUG,"SAP is already bound");
2863 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK);
2865 default: /* Should Never Enter here */
2866 #if (ERRCLASS & ERRCLS_ADD_RES)
2867 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001,
2868 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2869 "Invalid SAP State:RgUiRgmBndReq failed\n");
2871 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_NOK);
2877 #if (ERRCLASS & ERRCLS_ADD_RES)
2878 /* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state
2879 to spId to avoid seg fault due to invalid sapID */
2880 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002,
2881 (ErrVal)spId, "Invalid SAP Id:RgUiRrmBndReq failed\n");
2883 ret = RgUiRgmBndCfm(&tmpPst, suId, CM_BND_NOK);
2886 } /* RgUiRgmBndReq */
2889 * @brief API for unbind request from RRM towards MAC.
2893 * Function: RgUiRgmUbndReq
2895 * This API is invoked by RRM towards MAC to unbind RGM SAP.
2896 * These API validates the Pst, spId, suId and transfers the unbind request
2897 * specific information to corresponding ownership module (GOM) API.
2900 * @param[in] Pst *pst
2901 * @param[in] SuId suId
2902 * @param[in] Reason reason
2908 PUBLIC S16 RgUiRgmUbndReq
2915 PUBLIC S16 RgUiRgmUbndReq(pst, spId, reason)
2921 Inst instId = pst->dstInst-SCH_INST_START;
2922 TRC3(RgUiRgmUbndReq)
2925 /* SAP Id validation */
2926 if (spId < rgSchCb[instId].numSaps)
2928 switch(rgSchCb[instId].rgmSap[spId].sapSta.sapState)
2930 case LRG_BND: /* SAP is already bound*/
2931 /* setting SAP state to UN BOUND */
2932 RLOG0(L_DEBUG,"SAP is already bound");
2933 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND;
2936 #if (ERRCLASS & ERRCLS_ADD_RES)
2937 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003,
2938 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2939 "Invalid SAP State: RgUiRgmUbndReq failed\n");
2946 #if (ERRCLASS & ERRCLS_ADD_RES)
2947 RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004,
2948 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2949 "Invalid SAP Id:RgUiRgmUbndReq failed\n");
2954 } /* RgUiRgmUbndReq */
2958 * @brief API for start or stop PRB reporting from RRM towards MAC.
2962 * Function: RgUiRgmCfgPrbRprt
2964 * This API is invoked by RRM towards MAC to start or stop calculating
2965 * Average PRB usage in downlink and uplink. The average PRB usage will
2966 * be reported to RRM based on confiured periodicity.
2969 * @param[in] Pst *pst
2970 * @param[in] SuId suId
2971 * @param[in] SpId spId
2977 PUBLIC S16 RgUiRgmCfgPrbRprt
2981 RgmPrbRprtCfg *prbRprtCfg
2984 PUBLIC S16 RgUiRgmCfgPrbRprt(pst, spId, prbRprtCfg)
2987 RgmPrbRprtCfg *prbRprtCfg;
2992 RgSchPrbUsage *prbUsage;
2993 Inst inst = (pst->dstInst - SCH_INST_START);
2995 TRC2(RgUiRgmCfgPrbRprt);
2996 cell = rgSchCb[inst].rgmSap[spId].cell;
2997 prbUsage = &cell->prbUsage;
2998 prbUsage->prbRprtEnabld = prbRprtCfg->bConfigType;
2999 prbUsage->rprtPeriod = prbRprtCfg->usPrbAvgPeriodicty;
3000 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, prbUsage->startTime, 1);
3002 /* clear the qciPrbRpts for all GBR QCIs */
3003 cmMemset((U8*)&prbUsage->qciPrbRpts[0], 0,
3004 (RGM_MAX_QCI_REPORTS * sizeof(RgSchQciPrbUsage)));
3006 RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId,
3007 "RgUiRgmCfgPrbRprt config type %d with the report period %d",
3008 prbUsage->prbRprtEnabld,prbUsage->rprtPeriod);
3010 /* ccpu00134393 : mem leak fix */
3011 SPutSBuf(pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
3016 * @brief ERROR INDICATION from PHY for the i failed unlicensed Scell transmission.
3020 * Function : RgLiTfuErrInd
3022 * This API is invoked by PHY to send ERROR INDICATION to scheduler
3023 * Currently invoked in the cases when the Unlicensed SCell transmission
3025 * This API contains the Cell and subframe information for which the
3026 * transmission failed.
3028 * @param[in] Pst *pst
3029 * @param[in] SuId suId
3030 * @param[in] TfuErrIndInfo *errIndInfo
3036 PUBLIC S16 RgLiTfuErrInd
3040 TfuErrIndInfo *errInd
3043 PUBLIC S16 RgLiTfuErrInd(pst, suId, errInd)
3046 TfuErrIndInfo *errInd;
3051 Inst inst = (pst->dstInst - SCH_INST_START);
3054 TRC3(RgLiTfuErrInd);
3057 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
3060 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
3064 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
3066 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
3072 /* Now call the TOM (Tfu ownership module) primitive to process further */
3073 ret = rgSCHLaaErrInd(rgSchCb[inst].tfuSap[suId].cell, errInd);
3076 } /* RgLiTfuErrInd */
3080 /**********************************************************************
3083 **********************************************************************/