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 : RgMiLrgSchCfgReq
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 RgMiLrgSchCfgReq
121 Pst *pst, /* post structure */
122 RgMngmt *cfg /* config structure */
125 PUBLIC S16 RgMiLrgSchCfgReq(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 - RGSCH_INST_START);
138 TRC3(RgMiLrgSchCfgReq)
141 //if(pst->dstInst < RGSCH_INST_START)
143 RLOG_ARG0(L_ERROR,DBG_INSTID,inst, "Invalid inst ID");
144 RLOG_ARG2(L_DEBUG,DBG_INSTID,inst, "RgMiLrgSchCfgReq(): "
145 "pst->dstInst=%d RGSCH_INST_START=%d", pst->dstInst,RGSCH_INST_START);
149 /* Fill the post structure for sending the confirmation */
150 rgSCHLmmFillCfmPst(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 = rgSCHLmmInstCfg(&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 RgMiLrgSchCfgCfm(&cfmPst, &cfm);
188 /* SPutSBuf(pst->region, pst->pool, (Data *)cfg, sizeof(RgMngmt)); */
191 }/*-- RgMiLrgSchCfgReq --*/
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 - RGSCH_INST_START); /* Scheduler instance Id */
230 TRC3(RgMiLrgSchCntrlReq)
233 /* Fill the post structure for sending the confirmation */
234 rgSCHLmmFillCfmPst(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 - RGSCH_INST_START)];
322 #if (ERRCLASS & ERRCLS_ADD_RES)
326 RgSchL2MeasCb *measCb = NULLP;
328 Inst inst = (pst->dstInst - RGSCH_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 - RGSCH_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 - RGSCH_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-RGSCH_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 + RGSCH_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-RGSCH_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: RgUiRgrCfgReq
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] SpId spId
750 * @param[in] RgrCfgTransId transId
751 * @param[in] RgrCfgReqInfo *cfgReqInfo
757 PUBLIC S16 RgUiRgrCfgReq
761 RgrCfgTransId transId,
762 RgrCfgReqInfo *cfgReqInfo
765 PUBLIC S16 RgUiRgrCfgReq(pst, spId, transId, cfgReqInfo)
768 RgrCfgTransId transId;
769 RgrCfgReqInfo *cfgReqInfo;
774 U8 cfmStatus = 0x00ff;
775 U8 prntTrans[RGR_CFG_TRANSID_SIZE+1];
776 Inst instId = pst->dstInst-RGSCH_INST_START;
780 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
781 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
784 if (cfgReqInfo == NULLP)
786 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer is NULL");
787 rgSCHUtlRgrCfgCfm(instId, spId, transId, cfmStatus);
791 if (spId < rgSchCb[instId].numSaps)
793 switch(rgSchCb[instId].rgrSap[spId].sapSta.sapState)
795 case LRG_BND: /* SAP is already bound */
796 RLOG0(L_DEBUG,"SAP is already bound");
798 default: /* Should never reach here */
799 #if (ERRCLASS & ERRCLS_ADD_RES)
800 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG005,
801 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
802 "Invalid SAP State: RgUiRgrCfgReq failed\n");
804 SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
805 (Size)sizeof(*cfgReqInfo));
806 rgSCHUtlRgrCfgCfm(instId, spId, transId, cfmStatus);
812 #if (ERRCLASS & ERRCLS_ADD_RES)
813 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG006,
814 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
815 "Invalid SAP Id:RgUiRgrCfgReq failed\n");
817 SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
818 (Size)sizeof(*cfgReqInfo));
819 rgSCHUtlRgrCfgCfm(instId, spId, transId, cfmStatus);
823 /* Handle configuration */
824 ret = rgSCHGomHndlCfg(pst->region, pst->pool,
825 &rgSchCb[instId], spId, transId,
829 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Configuration Request Handling Failed");
834 } /* RgUiRgrCfgReq */
838 * @brief API for SI configuration request from RRM towards MAC.
842 * Function: RgUiRgrSiCfgReq
844 * This API is invoked by RRM towards MAC to configure SI at MAC.
845 * These API validates the Pst, spId, suId and transfers the
846 * config request specific information to corresponding ownership
850 * @param[in] Pst *pst
851 * @param[in] SpId spId
852 * @param[in] RgrCfgTransId transId
853 * @param[in] RgrSiCfgReqInfo *cfgReqInfo
859 PUBLIC S16 RgUiRgrSiCfgReq
863 RgrCfgTransId transId,
864 RgrSiCfgReqInfo *cfgReqInfo
867 PUBLIC S16 RgUiRgrSiCfgReq(pst, spId, transId, cfgReqInfo)
870 RgrCfgTransId transId;
871 RgrSiCfgReqInfo *cfgReqInfo;
875 U8 cfmStatus = RGR_CFG_CFM_NOK;
876 U8 prntTrans[RGR_CFG_TRANSID_SIZE+1];
877 Inst instId = pst->dstInst-RGSCH_INST_START;
879 TRC2(RgUiRgrSiCfgReq);
881 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
882 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
885 if (cfgReqInfo == NULLP)
887 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
889 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
893 if (spId < rgSchCb[instId].numSaps)
895 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
897 #if (ERRCLASS & ERRCLS_ADD_RES)
898 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007,
899 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
900 "Invalid SAP State: RgUiRgrSiCfgReq failed\n");
902 SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
903 (Size)sizeof(*cfgReqInfo));
904 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
910 #if (ERRCLASS & ERRCLS_ADD_RES)
911 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008,
912 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
913 "Invalid SAP Id:RgUiRgrSiCfgReq failed\n");
915 SPutSBuf(pst->region, pst->pool, (Data *)cfgReqInfo,
916 (Size)sizeof(*cfgReqInfo));
917 rgSCHUtlRgrSiCfgCfm(instId, spId, transId, cfmStatus);
921 /* Handle configuration */
923 if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable)
925 ret = rgSCHGomEmtcHndlSiCfg(pst->region, pst->pool,
926 &rgSchCb[instId], spId, transId,
931 ret = rgSCHGomHndlSiCfg(pst->region, pst->pool,
932 &rgSchCb[instId], spId, transId,
936 ret = rgSCHGomHndlSiCfg(pst->region, pst->pool,
937 &rgSchCb[instId], spId, transId,
942 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"RgUiRgrSiCfgReq:"
943 "Configuration Request Handling Failed");
948 } /* RgUiRgrSiCfgReq */
952 * @brief API for Warning SI configuration request from RRM towards MAC.
956 * Function: RgUiRgrWarningSiCfgReq
958 * This API is invoked by RRM towards MAC to configure SI at MAC.
959 * These API validates the Pst, spId, suId and transfers the
960 * config request specific information to corresponding ownership
964 * @param[in] Pst *pst
965 * @param[in] SpId spId
966 * @param[in] RgrCfgTransId transId
967 * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
973 PUBLIC S16 RgUiRgrWarningSiCfgReq
977 RgrCfgTransId transId,
978 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
981 PUBLIC S16 RgUiRgrWarningSiCfgReq(pst, spId, transId, warningSiCfgReqInfo)
984 RgrCfgTransId transId;
985 RgrWarningSiCfgReqInfo *warningSiCfgReqInfo;
988 Inst instId = pst->dstInst-RGSCH_INST_START;
990 U8 cfmStatus = RGR_CFG_CFM_NOK;
991 U8 prntTrans[RGR_CFG_TRANSID_SIZE+1];
993 TRC2(RgUiRgrWarningSiCfgReq);
995 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
996 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
1000 if (warningSiCfgReqInfo == NULLP)
1002 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
1004 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, 0, transId, cfmStatus);
1008 if (spId < rgSchCb[instId].numSaps)
1010 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
1012 #if (ERRCLASS & ERRCLS_ADD_RES)
1013 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG023,
1014 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
1015 "Invalid SAP State: warningSiCfgReqInfo failed\n");
1017 rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool,
1018 &warningSiCfgReqInfo->siPduLst);
1019 SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
1020 sizeof(RgrWarningSiCfgReqInfo));
1021 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId,
1022 transId, cfmStatus);
1028 #if (ERRCLASS & ERRCLS_ADD_RES)
1029 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG024,
1030 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
1031 "Invalid SAP Id:warningSiCfgReqInfo failed\n");
1033 rgSCHUtlFreeWarningSiSeg(pst->region, pst->pool,
1034 &warningSiCfgReqInfo->siPduLst);
1035 SPutSBuf(pst->region, pst->pool, (Data *)warningSiCfgReqInfo,
1036 sizeof(RgrWarningSiCfgReqInfo));
1037 rgSCHUtlRgrWarningSiCfgCfm(instId, spId, warningSiCfgReqInfo->siId,
1038 transId, cfmStatus);
1042 /* Handle configuration */
1044 if(rgSchCb[instId].rgrSap[spId].cell->emtcEnable)
1046 ret = rgSCHGomEmtcHndlWarningSiCfg(pst->region, pst->pool,
1047 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
1051 ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool,
1052 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
1055 ret = rgSCHGomHndlWarningSiCfg(pst->region, pst->pool,
1056 &rgSchCb[instId], spId, transId, warningSiCfgReqInfo);
1060 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,
1061 "Configuration Request Handling Failed");
1070 * @brief API for Warning SI Stop request from RRM towards MAC.
1074 * Function: RgUiRgrWarningSiStopReq
1076 * This API is invoked by RRM towards MAC to Stop warning SI at MAC.
1077 * These API validates the Pst, spId, suId and transfers the
1078 * stop request specific information to corresponding ownership
1082 * @param[in] Pst *pst
1083 * @param[in] SpId spId
1084 * @param[in] RgrWarningSiCfgReqInfo *warningSiCfgReqInfo
1090 PUBLIC S16 RgUiRgrWarningSiStopReq
1094 RgrCfgTransId transId,
1098 PUBLIC S16 RgUiRgrWarningSiStopReq(pst,spId, transId, siId)
1101 RgrCfgTransId transId;
1105 Inst instId = pst->dstInst-RGSCH_INST_START;
1107 TRC3(RgUiRgrWarningSiStopReq)
1111 if (spId < rgSchCb[instId].numSaps)
1113 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
1115 #if (ERRCLASS & ERRCLS_ADD_RES)
1116 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG025,
1117 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
1118 "Invalid SAP State: RgUiRgrWarningSiStopReq failed\n");
1125 #if (ERRCLASS & ERRCLS_ADD_RES)
1126 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG026,
1127 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
1128 "Invalid SAP Id:RgUiRgrWarningSiStopReq failed\n");
1133 rgSCHGomHndlWarningSiStopReq(pst->region, pst->pool,
1134 &rgSchCb[instId], siId, transId, spId);
1138 #endif /*RGR_SI_SCH */
1140 /* LTE_ADV_FLAG_REMOVED_START */
1143 * @brief API for LOAD INF request from RRM towards MAC.
1147 * Function: RgUiRgrLoadInfReq
1149 * This API is invoked by RRM towards MAC to configure LOAD INF Parameters at MAC.
1150 * These API validates the Pst, spId, suId and transfers the
1151 * LOAD INF request to corresponding ownership
1155 * @param[in] Pst *pst
1156 * @param[in] SpId spId
1157 * @param[in] RgrCfgTransId transId
1158 * @param[in] RgrLoadInfReqInfo *loadInfReq
1164 PUBLIC S16 RgUiRgrLoadInfReq
1168 RgrCfgTransId transId,
1169 RgrLoadInfReqInfo *loadInfReq
1172 PUBLIC S16 RgUiRgrLoadInfReq(pst, spId, transId, loadInfReq)
1175 RgrCfgTransId transId;
1176 RgrLoadInfReqInfo *loadInfReq;
1180 U8 prntTrans[RGR_CFG_TRANSID_SIZE+1];
1181 Inst instId = pst->dstInst-RGSCH_INST_START;
1183 TRC2(RgUiRgrLoadInfReq);
1185 cmMemcpy((U8 *)prntTrans, (U8 *)transId.trans, RGR_CFG_TRANSID_SIZE);
1186 prntTrans[RGR_CFG_TRANSID_SIZE] = '\0';
1189 if (loadInfReq == NULLP)
1191 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,"Input Message Buffer "
1196 if (spId < rgSchCb[instId].numSaps)
1198 if(LRG_BND != rgSchCb[instId].rgrSap[spId].sapSta.sapState)
1200 #if (ERRCLASS & ERRCLS_ADD_RES)
1201 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG007,
1202 (ErrVal)rgSchCb[instId].rgrSap[spId].sapSta.sapState,
1203 "Invalid SAP State: RgUiRgrLoadInfReq failed\n");
1205 SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq,
1206 (Size)sizeof(*loadInfReq));
1212 #if (ERRCLASS & ERRCLS_ADD_RES)
1213 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG008,
1214 (ErrVal)rgSchCb[instId].rgrSap[spId].sapCfg.spId,
1215 "Invalid SAP Id:RgUiRgrLoadInfReq failed\n");
1217 SPutSBuf(pst->region, pst->pool, (Data *)loadInfReq,
1218 (Size)sizeof(*loadInfReq));
1222 /* Handle configuration */
1223 ret = rgSCHGomHndlLoadInf(pst->region, pst->pool,
1224 &rgSchCb[(pst->dstInst - RGSCH_INST_START)], spId, transId,
1228 RLOG_ARG0(L_ERROR,DBG_INSTID,instId,
1229 "Configuration Request Handling Failed");
1234 } /* RgUiRgrLoadInfReq */
1235 /* LTE_ADV_FLAG_REMOVED_END */
1237 /************** MAC SCH Interface **************/
1239 * @brief Function for updating dedicated channel BO at scheduler from MAC.
1243 * Function : rgMacSchDedBoUpdtReq
1245 * This function shall be invoked whenever MAC gets staRsp from RLC
1246 * Scheduler shall update BO in its dedicated logical channel control block.
1248 * @param[in] Pst* pst
1249 * @param[in] S16 cellSapId
1250 * @param[in] RgInfDedBoRpt *boRpt
1255 PUBLIC S16 RgMacSchDedBoUpdtReq
1258 RgInfDedBoRpt *boRpt
1261 PUBLIC S16 RgMacSchDedBoUpdtReq(pst, boRpt)
1263 RgInfDedBoRpt *boRpt;
1273 Inst inst = (pst->dstInst - RGSCH_INST_START);
1274 S16 cellSapId = boRpt->cellSapId;
1276 TRC3(RgMacSchDedBoUpdtReq)
1278 RLOG_ARG2(L_DEBUG,DBG_CELLID,boRpt->cellId,"rgMacSchDedBoUpdtReq():"
1279 " boRpt->rnti = %u boRpt->lcId = %u",boRpt->rnti, boRpt->lcId);
1281 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1282 * it doesnt exist */
1283 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1286 if (cell->cellId != boRpt->cellId)
1288 /* Handle Cell fetch failure */
1289 RGSCHLOGERROR(inst, ERRCLS_INT_PAR,ERG009,(ErrVal)boRpt->cellId,
1290 "rgMacSchDedBoUpdtReq(): Invalid cell Id");
1295 /* Update Bo in the given logical channel of the UE */
1296 if ((ue = rgSCHDbmGetUeCb(cell, boRpt->rnti)) != NULLP)
1299 /* Honor BO Reports only from PCELL */
1301 if (cell != ue->cell)
1306 if ((dlLc = rgSCHDbmGetDlDedLcCb(ue, boRpt->lcId)) != NULLP)
1309 if(dlLc->lcType == CM_LTE_LCH_DTCH)
1311 if((dlLc->bo == 0) &&(boRpt->bo != 0))
1314 if(!(ue->qciActiveLCs[dlLc->qciCb->qci]))
1316 dlLc->qciCb->dlUeCount++;
1318 ue->qciActiveLCs[dlLc->qciCb->qci]++;
1320 else if((dlLc->bo != 0) && (boRpt->bo == 0) && (dlLc->qciCb->dlUeCount))
1322 /* UE is inactive */
1323 if (ue->qciActiveLCs[dlLc->qciCb->qci])
1325 ue->qciActiveLCs[dlLc->qciCb->qci]--;
1326 if (!(ue->qciActiveLCs[dlLc->qciCb->qci]))
1328 dlLc->qciCb->dlUeCount--;
1335 dlUe = RG_SCH_CMN_GET_DL_UE(ue, cell);
1336 if (boRpt->bo > dlLc->bo)
1338 dlUe->boReported += (boRpt->bo - dlLc->bo);
1342 if (boRpt->bo > dlLc->bo)
1344 ue->tenbStats->stats.nonPersistent.sch[RG_SCH_CELLINDEX(cell)].dlBo += ((boRpt->bo - dlLc->bo)<<3);
1347 /* RLC provides cumulative BO for each LC.
1348 * Reduce the left out unscheduled bo from total bo and
1349 * update the new BO to the total bo */
1350 if(ue->totalBo >= dlLc->bo)
1352 ue->totalBo -= dlLc->bo;
1356 ue->totalBo = 0; /* this case should not arise
1357 * Resetting for safety */
1360 ue->totalBo += boRpt->bo;
1361 dlLc->bo = boRpt->bo;
1362 dlLc->oldestSduArrTime = boRpt->oldestSduArrTime;
1363 dlLc->staPduBo = boRpt->staPduBo;
1365 dlLc->setMaxUlPrio = boRpt->setMaxUlPrio;
1366 dlLc->setMaxDlPrio = boRpt->setMaxDlPrio;
1367 /* Update the scheduler */
1368 rgSCHUtlDlDedBoUpd(cell, ue, dlLc);
1374 } /* end of rgMacSchDedBoUpdtReq */
1378 * @brief Function for updating common channel BO at scheduler from MAC.
1382 * Function : RgMacSchCmnBoUpdtReq
1384 * This function shall be invoked whenever MAC gets staRsp from RLC
1385 * Scheduler shall update BO in its common logical channel control block.
1387 * @param[in] Pst* pst
1388 * @param[in] S16 cellSapId
1389 * @param[in] RgInfCmnBoRpt *boRpt
1394 PUBLIC S16 RgMacSchCmnBoUpdtReq
1397 RgInfCmnBoRpt *boRpt
1400 PUBLIC S16 RgMacSchCmnBoUpdtReq(pst, boRpt)
1402 RgInfCmnBoRpt *boRpt;
1406 Inst inst = (pst->dstInst - RGSCH_INST_START);
1407 S16 cellSapId = boRpt->cellSapId;
1409 TRC3(RgMacSchCmnBoUpdtReq)
1411 /* No need to chk for cell being NULL as MAC would not have found instance if
1412 * it doesnt exist */
1413 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1414 if (cell->cellId != boRpt->cellId)
1416 RLOG_ARG1(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():"
1417 "Invalid boRpt cell Id:%d",boRpt->cellId);
1421 /* handle status response on CCCH */
1422 if(boRpt->lcId == cell->dlCcchId)
1424 RLOG_ARG0(L_DEBUG,DBG_CELLID,cell->cellId,"RgMacSchCmnBoUpdtReq():"
1425 " BO update for CCCH");
1426 rgSCHUtlHndlCcchBoUpdt(cell, boRpt);
1430 rgSCHUtlHndlBcchPcchBoUpdt(cell, boRpt);
1434 } /* end of RgMacSchCmnBoUpdtReq */
1435 /*Fix: start: Inform UE delete to scheduler*/
1437 * @brief This API is used to send data indication to Scheduler instance from MAC.
1441 * Function : rgMacSchUeDelInd
1443 * This function shall be invoked whenever MAC gets Ue delete request.
1446 * @param[in] Pst* pst
1447 * @param[in] RgInfUeDelInd *ueDelInd
1452 PUBLIC S16 RgMacSchUeDelInd
1455 RgInfUeDelInd *ueDelInd
1458 PUBLIC S16 RgMacSchUeDelInd(pst, ueDelInd)
1460 RgInfUeDelInd *ueDelInd;
1464 Inst inst = (pst->dstInst - RGSCH_INST_START);
1465 S16 cellSapId = ueDelInd->cellSapId;
1467 RgSchRntiLnk *rntiLnk=NULL;
1469 TRC3(RgMacSchUeDelInd)
1471 if (rgSchCb[inst].rgrSap == NULLP || rgSchCb[inst].rgrSap[cellSapId].cell == NULLP)
1473 RLOG_ARG0(L_ERROR,DBG_CELLID,ueDelInd->cellId,"rgrSap or cell is not configured");
1476 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1478 if (cell->cellId != ueDelInd->cellId)
1480 /* Handle Cell fetch failure */
1481 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1482 "rgMacSchUeDelInd(): Invalid ueDelInd cell Id:%d",
1488 CM_LLIST_FIRST_NODE(&cell->rntiDb.rntiGuardPool, tmp);
1492 rntiLnk = (RgSchRntiLnk *)(tmp->node);
1493 if(rntiLnk->rnti == ueDelInd->rnti)
1495 cmLListDelFrm(&cell->rntiDb.rntiGuardPool, tmp);
1497 rgSCHDbmRlsRnti(cell, rntiLnk);
1498 RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId,
1499 "RNTI:%d Released from the Guard pool(%ld)",
1500 ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count);
1504 CM_LLIST_NEXT_NODE(&cell->rntiDb.rntiGuardPool, tmp);
1508 rgEmtcMacSchUeDelInd(cell,ueDelInd);
1513 /* Fix : syed HO UE does not have a valid ue->rntiLnk */
1514 RLOG_ARG2(L_INFO,DBG_CELLID,ueDelInd->cellId,"HO CRNTI:%d not present in the"
1515 "Guard Pool:%ld", ueDelInd->rnti, cell->rntiDb.rntiGuardPool.count);
1519 } /* rgMacSchUeDelInd */
1520 /*Fix: end: Inform UE delete to scheduler*/
1522 * @brief This API is used to send data indication to Scheduler instance from MAC.
1526 * Function : rgMacSchSfRecpInd
1528 * This function shall be invoked whenever MAC gets datInd on TFU
1529 * Scheduler shall act on the CEs and data that are received as part of
1532 * @param[in] Pst* pst
1533 * @param[in] S16 cellSapId
1534 * @param[in] CmLteRnti rnti
1535 * @param[in] DatIndInfo *datInd
1540 PUBLIC S16 RgMacSchSfRecpInd
1543 RgInfSfDatInd *subfrmInfo
1546 PUBLIC S16 RgMacSchSfRecpInd(pst, subfrmInfo)
1548 RgInfSfDatInd *subfrmInfo;
1554 RgInfUeDatInd *datInd;
1556 Inst inst = (pst->dstInst - RGSCH_INST_START);
1560 S16 cellSapId = subfrmInfo->cellSapId;
1561 RgrUeStaIndInfo *ueStaInd;
1564 RgSchCmnUlUeSpsInfo *ulSpsUe ;
1572 U16 datIndActQci = 0;
1573 U16 combDatIndActQci = 0; /* Prev and Latest Dat Ind combined */
1574 U16 tempUeActQci = 0; /* UE specific Active QCIs */
1578 TRC3(RgMacSchSfRecpInd)
1580 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1581 * it doesnt exist */
1582 cell = rgSchCb[inst].rgrSap[cellSapId].cell;
1584 /* lnkLst assignment */
1585 lnkLst = &(subfrmInfo->ueLst);
1587 CM_LLIST_FIRST_NODE(lnkLst, tmp);
1589 while((NULLP != tmp) && ((RgInfUeDatInd *)tmp->node != NULLP))
1595 datInd = (RgInfUeDatInd *)tmp->node;
1596 rnti = datInd->rnti;
1598 /* We shall try and find
1599 * out the RaCb based on the following -
1600 * 1. If the incoming PDU contained a CCCH SDU i.e. this is message 3.
1601 * 2. If the incoming PDU contained a CRNTI control element, i.e. we should
1602 * have a ueCb also for this
1605 /* It could be that a non-msg3 pdu contains a CRNTI Control element. We
1606 * should check for CRNTI CE and if it exists the UECb must exist, also an
1607 * if the CRNTI in the CE and the one with which the message came in are
1608 * different we shall look for an raCb as well.
1610 if (datInd->ceInfo.bitMask & RGSCH_CRNTI_CE_PRSNT)
1612 /* SR_RACH_STATS : CRNTI CE*/
1615 if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT)
1617 RGSCH_FREE_MEM(subfrmInfo);
1618 err.errType = RGSCHERR_TOM_DATIND;
1619 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1620 "Received MSG3 with CRNTI:%d and also CCCH ",
1621 datInd->ceInfo.ces.cRnti);
1624 ue = rgSCHDbmGetUeCb (cell, datInd->ceInfo.ces.cRnti);
1627 /* SR_RACH_STATS : CRNTI CE UECB NOT FOUND*/
1628 rgNumCrntiCeCrntiNotFound++;
1629 /* ccpu00141318 - Removed condition for SPS rnti checking*/
1630 RGSCH_FREE_MEM(subfrmInfo);
1631 err.errType = RGSCHERR_TOM_DATIND;
1632 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Received MSG3 "
1633 "with CRNTI:%d unable to find ueCb",
1634 datInd->ceInfo.ces.cRnti);
1638 if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue,
1639 rnti, datInd, &err)) != ROK)
1641 RGSCH_FREE_MEM(subfrmInfo);
1642 err.errType = RGSCHERR_TOM_DATIND;
1643 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId, "Processing for MSG3 failed for CRNTI:%d",
1649 rgSCHUtlHdlCrntiCE (cell, ue);
1651 ret = rgSCHUtlAllocSBuf (cell->instIdx,(Data**)&ueStaInd,
1652 sizeof(RgrUeStaIndInfo));
1655 ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD;
1658 ulSpsUe = RG_SCH_CMN_GET_UL_SPS_UE(ue);
1659 if(ulSpsUe->isUlSpsActv)
1661 ueStaInd->status = RGR_UESTA_MAC_CRNTI_CE_RECVD_IN_SPS_ACTIVE;
1662 ue->ul.ulSpsCfg.isLcSRMaskEnab = FALSE;
1665 ret = rgSCHUtlFillSndUeStaInd(cell, ue, ueStaInd);
1668 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1669 "Could not Send Ue Sta Ind UEID:%d",ue->ueId);
1672 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1674 } /* end of CRNTI based message */
1675 else if (datInd->ceInfo.bitMask & RGSCH_CCCH_SDU_PRSNT)
1677 /* SR_RACH_STATS : CCCH SDU */
1679 /* SR_RACH_STATS : CCCH SDU RACB NOT FOUND*/
1680 if (NULLP == rgSCHDbmGetRaCb (cell, rnti))
1682 rgNumCCCHSduCrntiNotFound++;
1685 if ((ret = rgSCHUtlProcMsg3 (subfrmInfo, cell, ue,
1686 rnti, datInd, &err)) != ROK)
1688 RGSCH_FREE_MEM(subfrmInfo);
1689 err.errType = RGSCHERR_TOM_DATIND;
1690 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Processing for MSG3 failed for CRNTI:%d",
1695 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1697 } /* end of Msg3 processing */
1701 ue = rgSCHDbmGetUeCb (cell, datInd->rnti);
1705 if((ue = rgSCHDbmGetSpsUeCb (cell, datInd->rnti)) == NULLP)
1708 RGSCH_FREE_MEM(subfrmInfo);
1709 err.errType = RGSCHERR_TOM_DATIND;
1710 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to get the UE CB for CRNTI:%d",
1718 /* The LCs for which data is received at MAC is provided to SCH.
1719 This information is used to estimate the Active LCs at UE
1720 since estimates based on only BSR is not accurate */
1721 if (datInd->ceInfo.bitMask & RGSCH_ACTIVE_LC_PRSNT)
1724 /* Compose a Bitmask with for the QCI's for which Data
1726 for (lcCount = 0; lcCount < RGINF_MAX_NUM_DED_LC; lcCount++)
1728 if ((datInd->ceInfo.ulActLCs[lcCount] == TRUE) && (TRUE == ue->ul.lcCb[lcCount].isValid))
1730 datIndActQci |= (1 << (ue->ul.lcCb[lcCount].qciCb->qci -1));
1733 if (ue->ulActiveLCs && ue->lastDatIndLCs)
1735 /* Combine previous Dat Ind and current Dat Ind to
1736 estimate active LCs at UE */
1737 combDatIndActQci = ue->lastDatIndLCs | datIndActQci;
1738 tempUeActQci = ue->ulActiveLCs;
1739 ue->ulActiveLCs = combDatIndActQci;
1740 diffBits = combDatIndActQci ^ tempUeActQci;
1746 if (0x1 & tempUeActQci)
1748 /* An active QCI has become inactive */
1749 cell->qciArray[qci].ulUeCount--;
1753 /* An Inactive QCI has become active */
1754 cell->qciArray[qci].ulUeCount++;
1761 ue->lastDatIndLCs = datIndActQci;
1765 #endif /* LTE_L2_MEAS */
1766 /* Just copy the timing information from the dat indication into the one
1767 * stored in the UE CB, will be later utilized to handle Timing advance
1770 if ((ret = rgSCHUtlUpdSch (subfrmInfo, cell, ue, datInd, &err)) != ROK)
1772 RGSCH_FREE_MEM(subfrmInfo);
1773 err.errType = RGSCHERR_TOM_DATIND;
1774 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Unable to handle Data"
1775 " Indication for UEID:%d",ue->ueId);
1779 CM_LLIST_NEXT_NODE(lnkLst, tmp);
1782 /* update the UL PRB usage for all GBR QCIs*/
1783 for (idx = 0; idx < RGM_MAX_QCI_REPORTS; idx++)
1785 cell->prbUsage.qciPrbRpts[idx].ulTotPrbUsed += subfrmInfo->qcisUlPrbCnt[idx];
1789 /* chk if Sch needs to dealloc datInd after unpk */
1790 RGSCH_FREE_MEM(subfrmInfo);
1792 } /* rgMacSchSfRecpInd */
1796 * @brief Function to handle relInd from MAC for a UE
1800 * Function: RgMacSchSpsRelInd
1802 * Handler for processing relInd for UL SPS of a UE
1809 * @param[in] Pst *pst
1810 * @param[in] RgInfSpsRelInfo *relInfo
1816 PUBLIC S16 RgMacSchSpsRelInd
1819 RgInfSpsRelInfo *relInfo
1822 PUBLIC S16 RgMacSchSpsRelInd(pst, relInfo)
1824 RgInfSpsRelInfo *relInfo;
1829 Inst inst = (pst->dstInst - RGSCH_INST_START);
1831 TRC2(RgMacSchSpsRelInd);
1833 /* No need to chk for cell being NULL as MAC wouldn't have found instance if
1834 * it doesnt exist */
1835 cell = rgSchCb[inst].rgrSap[relInfo->cellSapId].cell;
1837 if ((ue = rgSCHDbmGetUeCb(cell, relInfo->cRnti)) == NULLP)
1839 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1840 "No Ue exists with CRNTI:%d",relInfo->cRnti);
1844 if ((rgSCHUtlSpsRelInd(cell, ue, relInfo->isExplRel)) != ROK)
1846 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
1847 "RelInd processing for CRNTI:%d failed",relInfo->cRnti);
1851 } /* end of RgMacSchSpsRelInd */
1852 #endif /* LTEMAC_SPS */
1857 * @brief Function to handle L2MeasCfm from MAC
1861 * Function: RgMacSchL2MeasCfm
1863 * Handler for processing L2 measurement confirm
1870 * @param[in] Pst *pst
1871 * @param[in] RgInfL2MeasCfm *measCfm
1877 PUBLIC S16 RgMacSchL2MeasCfm
1880 RgInfL2MeasCfm *measCfm
1883 PUBLIC S16 RgMacSchL2MeasCfm(pst, measCfm)
1885 RgInfL2MeasCfm *measCfm;
1888 RgSchCellCb *cell = NULLP;
1889 Inst inst = (pst->dstInst - RGSCH_INST_START);
1891 RgSchL2MeasCb *measCb = NULLP;
1892 RgSchCb *instCb = &rgSchCb[inst];
1894 LrgSchMeasCfmInfo schMeasCfm;
1896 U8 idx1; /*LTE_L2_MEAS_PHASE2*/
1898 TRC2(RgMacSchL2MeasCfm);
1900 /* Find the cellCb using cellId in measInfo. Iterate through all cells
1901 * in rgrsapCb in RgschCb */
1902 for (idx = 0; idx < instCb->numSaps; idx++)
1904 if ( instCb->rgrSap[idx].cell->cellId == measCfm->cellId)
1906 /* got the cell break the loop */
1907 cell = instCb->rgrSap[idx].cell;
1911 /* If no cellCb return Err with Invalid Cell Id */
1914 RLOG_ARG0(L_ERROR,DBG_CELLID,measCfm->cellId,
1915 "Meas Cfm Failed.Invalid Cell Id");
1920 /* Iterate through all meas requests in l2mList in cellCb */
1921 lnk = cell->l2mList.first;
1924 /* Get the MeasCb : RgSchL2MeasCb */
1925 measCb = (RgSchL2MeasCb *)lnk->node;
1927 if (measCb->measReq.hdr.transId == measCfm->transId)
1932 if ( measCb == NULLP )
1934 RETVALUE( RFAILED );
1938 if(measCfm->cfm.status != LCM_PRIM_OK)
1940 for (idx = 0; idx < measCb->measReq.avgPrbQciUl.numQci; idx++)
1942 qciVal = measCb->measReq.avgPrbQciUl.qci[idx];
1943 cell->qciArray[qciVal].qci = 0;
1945 /* Delete this measCb, send the negative confirmation to
1947 cmLListDelFrm(&cell->l2mList, &measCb->measLnk);
1948 /* ccpu00117052 - MOD - Passing double pointer
1949 for proper NULLP assignment*/
1950 rgSCHUtlFreeSBuf(cell->instIdx, (Data **)&measCb, sizeof(RgSchL2MeasCb));
1951 cmMemset((U8 *)&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo));
1952 schMeasCfm.measType = measCfm->measType;
1953 schMeasCfm.cfm = measCfm->cfm;
1954 schMeasCfm.hdr.transId = measCfm->transId;
1955 schMeasCfm.cellId = measCfm->cellId;
1956 RgMiLrgSchL2MeasCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm);
1959 for(idx = 0; idx < measCfm->u.prbCfm.numQci; idx++)
1961 measCb->avgPrbQciUl.prbUsage[idx].prbUsage = measCfm->u.prbCfm.prbUsage[idx].prbUsage;
1962 measCb->avgPrbQciUl.prbUsage[idx].qciValue = measCfm->u.prbCfm.prbUsage[idx].qciValue;
1963 /*LTE_L2_MEAS_PHASE2*/
1964 qciVal1 = measCfm->u.prbCfm.prbUsage[idx].qciValue;
1965 for(idx1=0;idx1<measCb->measReq.avgPrbQciUl.numQci;idx1++)
1967 if(measCb->measReq.avgPrbQciUl.qci[idx1] == qciVal1)
1972 if(idx1 == measCb->measReq.avgPrbQciUl.numQci)
1974 measCb->measReq.avgPrbQciUl.qci[measCb->measReq.avgPrbQciUl.numQci++] = qciVal1;
1977 measCb->avgPrbQciUl.numQci = measCfm->u.prbCfm.numQci;
1978 measCb->cfmRcvd = TRUE;
1979 cell->sndL2Meas = TRUE;
1981 } /* end of RgMacSchL2MeasCfm */
1984 * @brief Function to handle L2MeasStopCfm from MAC
1988 * Function: RgMacSchL2MeasStopCfm
1990 * Handler for processing L2 measurement confirm
1997 * @param[in] Pst *pst
1998 * @param[in] RgInfL2MeasCfm *measCfm
2004 PUBLIC S16 RgMacSchL2MeasStopCfm
2007 RgInfL2MeasCfm *measCfm
2010 PUBLIC S16 RgMacSchL2MeasStopCfm(pst, measCfm)
2012 RgInfL2MeasCfm *measCfm;
2015 LrgSchMeasCfmInfo schMeasCfm;
2016 Inst inst = (pst->dstInst - RGSCH_INST_START);
2017 RgSchCb *instCb = &rgSchCb[inst];
2019 TRC2(RgMacSchL2MeasStopCfm);
2021 cmMemset((U8 *)&schMeasCfm, 0, sizeof(LrgSchMeasCfmInfo));
2022 schMeasCfm.measType = measCfm->measType;
2023 schMeasCfm.cfm = measCfm->cfm;
2024 schMeasCfm.hdr.transId = measCfm->transId;
2025 schMeasCfm.cellId = measCfm->cellId;
2026 RgMiLrgSchL2MeasStopCfm(&(instCb->rgSchInit.lmPst), &schMeasCfm);
2031 /************** TFU Interface *************/
2034 * @brief Bind confirm API for TFU SAP on scheduler instance.
2038 * Function : RgLiTfuSchBndCfm
2040 * This API is invoked by PHY to confirm TFU SAP bind.
2043 * @param[in] Pst *pst
2044 * @param[in] SuId suId
2045 * @param[in] U8 status
2051 PUBLIC S16 RgLiTfuSchBndCfm
2058 PUBLIC S16 RgLiTfuSchBndCfm(pst, suId, status)
2065 RgSchLowSapCb *tfuSap;
2066 Inst instId = pst->dstInst - RGSCH_INST_START;
2068 TRC3(RgLiTfuSchBndCfm);
2071 if(suId >= rgSchCb[instId].numSaps)
2073 RLOG_ARG0(L_ERROR,DBG_INSTID,instId, "Incorrect SuId");
2076 /* Lets validate suId first */
2077 tfuSap = &(rgSchCb[instId].tfuSap[suId]);
2079 if (suId != tfuSap->sapCfg.suId)
2081 RLOG_ARG2(L_ERROR,DBG_INSTID,instId, "Incorrect SuId. Configured (%d)"
2082 "Recieved (%d)", tfuSap->sapCfg.suId, suId);
2085 ret = rgSCHLmmBndCfm (pst, suId, status);
2087 } /* RgLiTfuSchBndCfm */
2090 * @brief Random Access Request indication from PHY.
2094 * Function : RgLiTfuRaReqInd
2096 * This API is invoked by PHY to send Random Access Request to Scheduler.
2097 * This API contains information for Random Access Request including
2098 * raRnti, list of associated RAPIDs and related information.
2100 * @param[in] Pst *pst
2101 * @param[in] SuId suId
2102 * @param[in] TfuRaReqIndInfo *raReqInd
2108 PUBLIC S16 RgLiTfuRaReqInd
2112 TfuRaReqIndInfo *raReqInd
2115 PUBLIC S16 RgLiTfuRaReqInd(pst, suId, raReqInd)
2118 TfuRaReqIndInfo *raReqInd;
2122 Inst inst = pst->dstInst-RGSCH_INST_START;
2124 TRC3(RgLiTfuRaReqInd);
2126 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2128 RLOG_ARG1(L_ERROR,DBG_INSTID,inst,"SAP Validation failed SuId(%d)", suId);
2129 /* Free up the memory for the request structure */
2130 RGSCH_FREE_MEM(raReqInd);
2134 if(raReqInd == NULLP)
2136 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"Invalid input pointer for raReqInd Failed");
2140 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2142 RLOG_ARG0(L_ERROR,DBG_CELLID,raReqInd->cellId,"No cell exists");
2146 ret = rgSCHTomRaReqInd(rgSchCb[inst].tfuSap[suId].cell, raReqInd);
2147 /* Free up the memory for the request structure */
2148 RGSCH_FREE_MEM(raReqInd);
2149 /*SPutSBuf (pst->region, pst->pool, (Data *)raReqInd,
2150 sizeof(TfuRaReqIndInfo)); */
2152 } /* RgLiTfuRaReqInd */
2155 * @brief Uplink CQI indication from PHY.
2159 * Function : RgLiTfuUlCqiInd
2161 * This API is invoked by PHY to send Uplink CQI to Scheduler.
2162 * This API contains Uplink CQI information reported per UE.
2164 * @param[in] Pst *pst
2165 * @param[in] SuId suId
2166 * @param[in] TfuUlCqiIndInfo *ulCqiInd
2172 PUBLIC S16 RgLiTfuUlCqiInd
2176 TfuUlCqiIndInfo *ulCqiInd
2179 PUBLIC S16 RgLiTfuUlCqiInd(pst, suId, ulCqiInd)
2182 TfuUlCqiIndInfo *ulCqiInd;
2186 Inst inst = pst->dstInst-RGSCH_INST_START;
2188 TRC3(RgLiTfuUlCqiInd);
2190 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2192 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2193 /* Free up the memory for the request structure */
2194 RGSCH_FREE_MEM(ulCqiInd);
2198 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2200 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2201 /* Free up the memory for the request structure */
2202 RGSCH_FREE_MEM(ulCqiInd);
2205 ret = rgSCHTomUlCqiInd (rgSchCb[inst].tfuSap[suId].cell, ulCqiInd);
2206 /* Free up the memory for the request structure */
2207 RGSCH_FREE_MEM(ulCqiInd);
2209 } /* RgLiTfuUlCqiInd */
2212 * @brief PUCCH power adjustment indication.
2216 * Function : RgLiTfuPucchDeltaPwrInd
2218 * This API is invoked by PHY to send PUCCH power adjustment
2221 * @param[in] Pst *pst
2222 * @param[in] SuId suId
2223 * @param[in] TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
2229 PUBLIC S16 RgLiTfuPucchDeltaPwrInd
2233 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr
2236 PUBLIC S16 RgLiTfuPucchDeltaPwrInd(pst, suId, pucchDeltaPwr)
2239 TfuPucchDeltaPwrIndInfo *pucchDeltaPwr;
2243 Inst inst = pst->dstInst-RGSCH_INST_START;
2245 TRC3(RgLiTfuPucchDeltaPwrInd);
2247 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2249 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2250 /* Free up the memory for the request structure */
2251 RGSCH_FREE_MEM(pucchDeltaPwr);
2255 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2257 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2260 ret = rgSCHTomPucchDeltaPwrInd (rgSchCb[inst].tfuSap[suId].cell, pucchDeltaPwr);
2261 /* Free up the memory for the request structure */
2262 RGSCH_FREE_MEM(pucchDeltaPwr);
2264 } /* RgLiTfuPucchDeltaPwrInd */
2268 * @brief HARQ ACK indication from PHY for Downlink transmissions.
2272 * Function : RgLiTfuHqInd
2274 * This API is invoked by PHY to send HARQ ACK information to Scheduler
2275 * on recieving HARQ ACK/NACK from UEs.
2276 * This API contains HARQ ACK information recieved by PHY for downlink
2279 * @param[in] Pst *pst
2280 * @param[in] SuId suId
2281 * @param[in] TfuHqIndInfo *harqAckInd
2287 PUBLIC S16 RgLiTfuHqInd
2291 TfuHqIndInfo *harqAckInd
2294 PUBLIC S16 RgLiTfuHqInd(pst, suId, harqAckInd)
2297 TfuHqIndInfo *harqAckInd;
2301 Inst inst = (pst->dstInst - RGSCH_INST_START);
2306 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2308 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2309 RGSCH_FREE_MEM(harqAckInd);
2313 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2315 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2320 /* Now call the TOM (Tfu ownership module) primitive to process further */
2321 ret = rgSCHTomHarqAckInd (rgSchCb[inst].tfuSap[suId].cell, harqAckInd);
2322 /* Free up the memory for the request structure */
2323 RGSCH_FREE_MEM(harqAckInd);
2325 } /* RgLiTfuHqInd */
2329 * @brief Scheduling request(SR) indication from PHY for an UE.
2333 * Function : RgLiTfuSrInd
2335 * This API is invoked by PHY to send Scheduling request information to
2336 * Scheduler on recieving SR from a list of UEs.
2337 * This API contains scheduling request information recieved by PHY for UEs.
2339 * @param[in] Pst *pst
2340 * @param[in] SuId suId
2341 * @param[in] TfuSrIndInfo *srInd
2347 PUBLIC S16 RgLiTfuSrInd
2354 PUBLIC S16 RgLiTfuSrInd(pst, suId, srInd)
2357 TfuSrIndInfo *srInd;
2361 Inst inst = pst->dstInst-RGSCH_INST_START;
2366 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2368 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"() SAP Validation failed");
2369 RGSCH_FREE_MEM(srInd);
2373 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2375 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"RgLiTfuSrInd()No cell exists");
2379 /* Now call the TOM (Tfu ownership module) primitive to process further */
2380 ret = rgSCHTomSrInd (rgSchCb[inst].tfuSap[suId].cell, srInd);
2381 /* Free up the memory for the request structure */
2382 RGSCH_FREE_MEM(srInd);
2384 } /* RgLiTfuSrInd */
2388 * @brief Downlink CQI indication from PHY for an UE.
2392 * Function : RgLiTfuDlCqiInd
2394 * This API is invoked by PHY to send Downlink CQI indication to Scheduler
2395 * on recieving downlink CQI from UE.
2396 * This API contains downlink CQI information recieved by PHY for an UE.
2398 * @param[in] Pst *pst
2399 * @param[in] SuId suId
2400 * @param[in] TfuDlCqiIndInfo *dlCqiInd
2406 PUBLIC S16 RgLiTfuDlCqiInd
2410 TfuDlCqiIndInfo *dlCqiInd
2413 PUBLIC S16 RgLiTfuDlCqiInd(pst, suId, dlCqiInd)
2416 TfuDlCqiIndInfo *dlCqiInd;
2420 Inst inst = pst->dstInst-RGSCH_INST_START;
2422 TRC3(RgLiTfuDlCqiInd);
2424 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2426 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed");
2427 /* Free up the memory for the request structure */
2428 RGSCH_FREE_MEM(dlCqiInd);
2432 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2434 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2437 ret = rgSCHTomDlCqiInd (rgSchCb[inst].tfuSap[suId].cell, dlCqiInd);
2438 /* Free up the memory for the request structure */
2439 RGSCH_FREE_MEM(dlCqiInd);
2441 } /* RgLiTfuDlCqiInd */
2445 * @brief Raw CQI indication from PHY for an UE.
2449 * Function : RgLiTfuRawCqiInd
2451 * This API is invoked by PHY to send Raw CQI indication to Scheduler
2452 * on receiving Raw CQI from UE.
2453 * This API contains Raw CQI information recieved by PHY for an UE.
2455 * @param[in] Pst *pst
2456 * @param[in] SuId suId
2457 * @param[in] TfuRawCqiIndInfo *rawCqiInd
2463 PUBLIC S16 RgLiTfuRawCqiInd
2467 TfuRawCqiIndInfo *rawCqiInd
2470 PUBLIC S16 RgLiTfuRawCqiInd(pst, suId, rawCqiInd)
2473 TfuRawCqiIndInfo *rawCqiInd;
2477 Inst inst = pst->dstInst-RGSCH_INST_START;
2479 TRC3(RgLiTfuRawCqiInd);
2482 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2484 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2485 /* Free up the memory for the request structure */
2486 RGSCH_FREE_MEM(rawCqiInd);
2490 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2492 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," No cell exists");
2496 ret = rgSCHTomRawCqiInd (rgSchCb[inst].tfuSap[suId].cell, rawCqiInd);
2497 /* Free up the memory for the request structure */
2498 RGSCH_FREE_MEM(rawCqiInd);
2500 } /* RgLiTfuRawCqiInd */
2503 * @brief SRS indication from PHY for an UE.
2507 * Function : RgLiTfuSrsInd
2509 * This API is invoked by PHY to send UL SRS indication to Scheduler
2510 * on receiving a SRS from UE.
2511 * This API contains SRS information recieved by PHY for an UE.
2513 * @param[in] Pst *pst
2514 * @param[in] SuId suId
2515 * @param[in] TfuSrsIndInfo *srsInd
2521 PUBLIC S16 RgLiTfuSrsInd
2525 TfuSrsIndInfo *srsInd
2528 PUBLIC S16 RgLiTfuSrsInd(pst, suId, srsInd)
2531 TfuSrsIndInfo *srsInd;
2535 Inst inst = pst->dstInst-RGSCH_INST_START;
2537 TRC3(RgLiTfuSrsInd);
2539 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2541 RLOG_ARG0(L_ERROR,DBG_INSTID,inst," SAP Validation failed");
2542 /* Free up the memory for the request structure */
2543 RGSCH_FREE_MEM(srsInd);
2547 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2549 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2552 ret = rgSCHTomSrsInd (rgSchCb[inst].tfuSap[suId].cell, srsInd);
2553 /* Free up the memory for the request structure */
2554 RGSCH_FREE_MEM(srsInd);
2556 } /* RgLiTfuSrsInd */
2561 * @brief DOA indication from PHY for an UE.
2565 * Function : RgLiTfuDoaInd
2567 * This API is invoked by PHY to send Direction Of Arrival to Scheduler
2568 * on calculating DOA at PHYSICAL LAYER for an UE.
2569 * This API contains DOA information calculated by PHY for an UE.
2571 * @param[in] Pst *pst
2572 * @param[in] SuId suId
2573 * @param[in] TfuDoaIndInfo *doaInd
2579 PUBLIC S16 RgLiTfuDoaInd
2583 TfuDoaIndInfo *doaInd
2586 PUBLIC S16 RgLiTfuDoaInd(pst, suId, doaInd)
2589 TfuDoaIndInfo *doaInd;
2593 Inst inst = pst->dstInst-RGSCH_INST_START;
2595 TRC2(RgLiTfuDoaInd);
2597 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2599 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2600 /* Free up the memory for the request structure */
2601 RGSCH_FREE_MEM(doaInd);
2605 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2607 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2610 ret = rgSCHTomDoaInd (rgSchCb[inst].tfuSap[suId].cell, doaInd);
2611 /* Free up the memory for the request structure */
2612 RGSCH_FREE_MEM(doaInd);
2614 } /* RgLiTfuDlCqiInd */
2617 * @brief CRC indication from PHY.
2621 * Function : RgLiTfuCrcInd
2623 * This API is invoked by PHY to give CRC indication to scheduler.
2625 * @param[in] Pst *pst
2626 * @param[in] SuId suId
2627 * @param[in] TfuCrcIndInfo *crcInd
2633 PUBLIC S16 RgLiTfuCrcInd
2637 TfuCrcIndInfo *crcInd
2640 PUBLIC S16 RgLiTfuCrcInd (pst, suId, crcInd)
2643 TfuCrcIndInfo *crcInd;
2647 Inst inst = pst->dstInst-RGSCH_INST_START;
2649 TRC3(RgLiTfuCrcInd);
2650 #ifdef XEON_SPECIFIC_CHANGES
2651 struct timeval start6, end6;
2652 gettimeofday(&start6, NULL);
2655 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2657 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2658 RGSCH_FREE_MEM(crcInd);
2662 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2664 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2669 /* Now call the TOM (Tfu ownership module) primitive to process further */
2670 ret = rgSCHTomCrcInd(rgSchCb[inst].tfuSap[suId].cell, crcInd);
2671 /* Free up the memory for the request structure */
2672 RGSCH_FREE_MEM(crcInd);
2673 #ifdef XEON_SPECIFIC_CHANGES
2674 gettimeofday(&end6, NULL);
2677 } /* RgLiTfuCrcInd */
2680 * @brief Timing Advance indication from PHY.
2684 * Function : RgLiTfuTimingAdvInd
2686 * This API is invoked by PHY to indicate timing advance to Scheduler for
2689 * @param[in] Pst *pst
2690 * @param[in] SuId suId
2691 * @param[in] TfuTimingAdvIndInfo *timingAdvInd
2697 PUBLIC S16 RgLiTfuTimingAdvInd
2701 TfuTimingAdvIndInfo *timingAdvInd
2704 PUBLIC S16 RgLiTfuTimingAdvInd(pst, suId, timingAdvInd)
2707 TfuTimingAdvIndInfo *timingAdvInd;
2711 Inst inst = pst->dstInst-RGSCH_INST_START;
2713 TRC3(RgLiTfuTimingAdvInd);
2715 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2717 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2718 /* Free up the memory for the request structure */
2719 RGSCH_FREE_MEM(timingAdvInd);
2723 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
2725 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
2728 /* Now call the TOM (Tfu ownership module) primitive to process further */
2729 ret = rgSCHTomTimingAdvInd(rgSchCb[inst].tfuSap[suId].cell, timingAdvInd);
2730 /* Free up the memory for the request structure */
2731 RGSCH_FREE_MEM(timingAdvInd);
2733 } /* RgLiTfuTimingAdvInd */
2737 * @brief Transmission time interval indication from PHY.
2741 * Function : RgLiTfuSchTtiInd
2743 * This API is invoked by PHY to indicate TTI indication to Scheduler for
2746 * @param[in] Pst *pst
2747 * @param[in] SuId suId
2748 * @param[in] TfuTtiIndInfo *ttiInd
2754 PUBLIC S16 RgLiTfuSchTtiInd
2758 TfuTtiIndInfo *ttiInd
2761 PUBLIC S16 RgLiTfuSchTtiInd(pst, suId, ttiInd)
2764 TfuTtiIndInfo *ttiInd;
2768 Inst inst = pst->dstInst-RGSCH_INST_START;
2770 TRC3(RgLiTfuSchTtiInd);
2773 /* Removing the validation with every TTI - for optimization */
2775 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
2777 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
2781 /* Moved check for cell outside ERRCLS*/
2783 /* Now call the TOM (Tfu ownership module) primitive to process further */
2784 rgSCHTomTtiInd(ttiInd, inst);
2787 } /* RgLiTfuSchTtiInd */
2789 /************* RGM Interface ****************/
2791 * @brief API for bind request from RRM towards MAC.
2795 * Function: RgUiRgmBndReq
2797 * This API is invoked by RRM towards MAC to bind RGM SAP.
2798 * These API validates the Pst, spId, suId and sends the bind confirm to
2802 * @param[in] Pst *pst
2803 * @param[in] SuId suId
2804 * @param[in] SpId spId
2810 PUBLIC S16 RgUiRgmBndReq
2817 PUBLIC S16 RgUiRgmBndReq(pst, suId, spId)
2824 Pst tmpPst; /* Temporary Post Structure */
2825 Inst instId = pst->dstInst-RGSCH_INST_START;
2830 tmpPst.prior = pst->prior;
2831 tmpPst.route = pst->route;
2832 tmpPst.selector = pst->selector;
2833 tmpPst.region = rgSchCb[instId].rgSchInit.region;
2834 tmpPst.pool = rgSchCb[instId].rgSchInit.pool;
2836 tmpPst.srcProcId = rgSchCb[instId].rgSchInit.procId;
2837 tmpPst.srcEnt = rgSchCb[instId].rgSchInit.ent;
2838 tmpPst.srcInst = rgSchCb[instId].rgSchInit.inst + RGSCH_INST_START;
2840 tmpPst.event = EVTNONE;
2842 tmpPst.dstProcId = pst->srcProcId;
2843 tmpPst.dstEnt = pst->srcEnt;
2844 tmpPst.dstInst = pst->srcInst;
2846 /*TODO remove follo statement*/
2847 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND;
2849 if(spId < rgSchCb[instId].numSaps)
2851 /* Check the state of the SAP */
2852 switch (rgSchCb[instId].rgmSap[spId].sapSta.sapState)
2854 /* This case might not be needed if SAP not configured then it will go
2855 * to else of above if condition */
2856 case LRG_UNBND: /* SAP is not bound */
2857 RLOG0(L_DEBUG,"SAP is not yet bound");
2858 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_BND;
2859 rgSchCb[instId].rgmSap[spId].sapCfg.suId = suId;
2860 /* Send Bind Confirm with status as SUCCESS */
2861 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK);
2862 /*Indicate to Layer manager */
2864 case LRG_BND: /* SAP is already bound*/
2865 RLOG0(L_DEBUG,"SAP is already bound");
2866 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_OK);
2868 default: /* Should Never Enter here */
2869 #if (ERRCLASS & ERRCLS_ADD_RES)
2870 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG001,
2871 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2872 "Invalid SAP State:RgUiRgmBndReq failed\n");
2874 ret = rgSCHUtlRgmBndCfm(instId, suId, CM_BND_NOK);
2880 #if (ERRCLASS & ERRCLS_ADD_RES)
2881 /* ccpu00117035 - MOD - Changed ErrVal argument from accessing sap state
2882 to spId to avoid seg fault due to invalid sapID */
2883 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG002,
2884 (ErrVal)spId, "Invalid SAP Id:RgUiRrmBndReq failed\n");
2886 ret = RgUiRgmBndCfm(&tmpPst, suId, CM_BND_NOK);
2889 } /* RgUiRgmBndReq */
2892 * @brief API for unbind request from RRM towards MAC.
2896 * Function: RgUiRgmUbndReq
2898 * This API is invoked by RRM towards MAC to unbind RGM SAP.
2899 * These API validates the Pst, spId, suId and transfers the unbind request
2900 * specific information to corresponding ownership module (GOM) API.
2903 * @param[in] Pst *pst
2904 * @param[in] SuId suId
2905 * @param[in] Reason reason
2911 PUBLIC S16 RgUiRgmUbndReq
2918 PUBLIC S16 RgUiRgmUbndReq(pst, spId, reason)
2924 Inst instId = pst->dstInst-RGSCH_INST_START;
2925 TRC3(RgUiRgmUbndReq)
2928 /* SAP Id validation */
2929 if (spId < rgSchCb[instId].numSaps)
2931 switch(rgSchCb[instId].rgmSap[spId].sapSta.sapState)
2933 case LRG_BND: /* SAP is already bound*/
2934 /* setting SAP state to UN BOUND */
2935 RLOG0(L_DEBUG,"SAP is already bound");
2936 rgSchCb[instId].rgmSap[spId].sapSta.sapState = LRG_UNBND;
2939 #if (ERRCLASS & ERRCLS_ADD_RES)
2940 RGSCHLOGERROR(instId, ERRCLS_INT_PAR, ERG003,
2941 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2942 "Invalid SAP State: RgUiRgmUbndReq failed\n");
2949 #if (ERRCLASS & ERRCLS_ADD_RES)
2950 RGSCHLOGERROR(instId,ERRCLS_INT_PAR, ERG004,
2951 (ErrVal)rgSchCb[instId].rgmSap[spId].sapSta.sapState,
2952 "Invalid SAP Id:RgUiRgmUbndReq failed\n");
2957 } /* RgUiRgmUbndReq */
2961 * @brief API for start or stop PRB reporting from RRM towards MAC.
2965 * Function: RgUiRgmCfgPrbRprt
2967 * This API is invoked by RRM towards MAC to start or stop calculating
2968 * Average PRB usage in downlink and uplink. The average PRB usage will
2969 * be reported to RRM based on confiured periodicity.
2972 * @param[in] Pst *pst
2973 * @param[in] SuId suId
2974 * @param[in] SpId spId
2980 PUBLIC S16 RgUiRgmCfgPrbRprt
2984 RgmPrbRprtCfg *prbRprtCfg
2987 PUBLIC S16 RgUiRgmCfgPrbRprt(pst, spId, prbRprtCfg)
2990 RgmPrbRprtCfg *prbRprtCfg;
2995 RgSchPrbUsage *prbUsage;
2996 Inst inst = (pst->dstInst - RGSCH_INST_START);
2998 TRC2(RgUiRgmCfgPrbRprt);
2999 cell = rgSchCb[inst].rgmSap[spId].cell;
3000 prbUsage = &cell->prbUsage;
3001 prbUsage->prbRprtEnabld = prbRprtCfg->bConfigType;
3002 prbUsage->rprtPeriod = prbRprtCfg->usPrbAvgPeriodicty;
3003 RG_SCH_ADD_TO_CRNT_TIME(cell->crntTime, prbUsage->startTime, 1);
3005 /* clear the qciPrbRpts for all GBR QCIs */
3006 cmMemset((U8*)&prbUsage->qciPrbRpts[0], 0,
3007 (RGM_MAX_QCI_REPORTS * sizeof(RgSchQciPrbUsage)));
3009 RLOG_ARG2(L_DEBUG,DBG_CELLID,cell->cellId,
3010 "RgUiRgmCfgPrbRprt config type %d with the report period %d",
3011 prbUsage->prbRprtEnabld,prbUsage->rprtPeriod);
3013 /* ccpu00134393 : mem leak fix */
3014 SPutSBuf(pst->region, pst->pool, (Data *)prbRprtCfg, sizeof(RgmPrbRprtCfg));
3019 * @brief ERROR INDICATION from PHY for the i failed unlicensed Scell transmission.
3023 * Function : RgLiTfuErrInd
3025 * This API is invoked by PHY to send ERROR INDICATION to scheduler
3026 * Currently invoked in the cases when the Unlicensed SCell transmission
3028 * This API contains the Cell and subframe information for which the
3029 * transmission failed.
3031 * @param[in] Pst *pst
3032 * @param[in] SuId suId
3033 * @param[in] TfuErrIndInfo *errIndInfo
3039 PUBLIC S16 RgLiTfuErrInd
3043 TfuErrIndInfo *errInd
3046 PUBLIC S16 RgLiTfuErrInd(pst, suId, errInd)
3049 TfuErrIndInfo *errInd;
3054 Inst inst = (pst->dstInst - RGSCH_INST_START);
3057 TRC3(RgLiTfuErrInd);
3060 if ((ret = rgSCHUtlValidateTfuSap (inst, suId)) != ROK)
3063 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"SAP Validation failed");
3067 if (rgSchCb[inst].tfuSap[suId].cell == NULLP)
3069 RLOG_ARG0(L_ERROR,DBG_INSTID,inst,"No cell exists");
3075 /* Now call the TOM (Tfu ownership module) primitive to process further */
3076 ret = rgSCHLaaErrInd(rgSchCb[inst].tfuSap[suId].cell, errInd);
3079 } /* RgLiTfuErrInd */
3083 /**********************************************************************
3086 **********************************************************************/